[-]
[+]
|
Changed |
powerdevil.spec
|
|
[-]
[+]
|
Deleted |
powerdevil-5.2.0.tar.xz/daemon/backends/upower/xlibandxrandr.h
^
|
@@ -1,36 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <afiestas@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 2 *
- * of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-
-#ifndef XLIBANDXRANDR_H
-#define XLIBANDXRANDR_H
-
-extern "C"
-{
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#define INT8 _X11INT8
-#define INT32 _X11INT32
-#include <X11/Xproto.h>
-#undef INT8
-#undef INT32
-#include <X11/extensions/Xrandr.h>
-}
-
-#include <fixx11h.h>
-
-#endif // XLIBANDXRANDR
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/CMakeLists.txt
^
|
@@ -1,9 +1,9 @@
project(PowerDevil)
-set(PROJECT_VERSION "5.2.0")
+set(PROJECT_VERSION "5.3.0")
set(PROJECT_VERSION_MAJOR 5)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
-set(QT_MIN_VERSION "5.2.0")
+set(QT_MIN_VERSION "5.4.0")
find_package(ECM 1.2.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@@ -14,31 +14,26 @@
include(KDECMakeSettings)
include(KDECompilerSettings)
+# require at least gcc 4.8
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.8")
+ message(SEND_ERROR "Version ${CMAKE_CXX_COMPILER_VERSION} of the ${CMAKE_CXX_COMPILER_ID} C++ compiler is not supported. Please use version 4.8 or later.")
+ endif()
+endif()
+
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets DBus X11Extras)
-find_package(KF5 REQUIRED COMPONENTS Auth IdleTime Config Solid I18n GlobalAccel KIO NotifyConfig KDELibs4Support)
+find_package(KF5 REQUIRED COMPONENTS Activities Auth IdleTime Config DBusAddons Solid I18n GlobalAccel KIO NotifyConfig Screen KDELibs4Support)
find_package(LibKWorkspace CONFIG REQUIRED)
-find_package(ScreenSaverDBusInterface CONFIG REQUIRED)
find_package(UDev) #upower/udev backend
-find_package(X11)
-set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
- URL "http://www.x.org"
- TYPE OPTIONAL
- PURPOSE "Required for building the X11 based workspace"
-)
-if(X11_FOUND)
- find_package(XCB REQUIRED COMPONENTS XCB RANDR)
- set_package_properties(XCB PROPERTIES TYPE REQUIRED)
-endif()
+find_package(XCB REQUIRED COMPONENTS XCB RANDR DPMS)
include_directories (
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/daemon
)
-set(HAVE_DPMS ${X11_dpms_FOUND})
-
configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h)
add_subdirectory(daemon)
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/PowerDevilSettings.kcfg
^
|
@@ -6,31 +6,24 @@
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="powerdevilrc"/>
- <!--The following group is retained just for compatibility and upgrades.-->
- <group name="Profiles">
- <entry name="ACProfile" type="String">
- <default></default>
- </entry>
- <entry name="BatteryProfile" type="String">
- <default></default>
- </entry>
- <entry name="LowProfile" type="String">
- <default></default>
- </entry>
- <entry name="WarningProfile" type="String">
- <default></default>
- </entry>
- </group>
-
<group name="General">
<entry name="doNotInhibitOnLidClose" type="Bool">
<default>true</default>
</entry>
</group>
+ <group name="Brightness">
+ <entry name="brightnessAnimationDuration" type="Int">
+ <default>250</default>
+ </entry>
+ <entry name="brightnessAnimationThreshold" type="Int">
+ <default>100</default>
+ </entry>
+ </group>
+
<group name="BatteryManagement">
<entry name="BatteryLowLevel" type="Int">
- <default>20</default>
+ <default>10</default>
</entry>
<entry name="BatteryCriticalLevel" type="Int">
<default>5</default>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/CMakeLists.txt
^
|
@@ -39,8 +39,6 @@
kconfig_add_kcfg_files(powerdevilcore_SRCS ../PowerDevilSettings.kcfgc)
-qt5_add_dbus_interface(powerdevilcore_SRCS ${SCREENSAVER_DBUS_INTERFACE} screensaver_interface )
-
# Action DBus Adaptors
qt5_add_dbus_adaptor(powerdevilcore_SRCS actions/bundled/org.kde.Solid.PowerManagement.Actions.BrightnessControl.xml
actions/bundled/brightnesscontrol.h PowerDevil::BundledActions::BrightnessControl)
@@ -56,12 +54,15 @@
# not exported, so just make the deps public
target_link_libraries(powerdevilcore
+ KF5::Activities
KF5::ConfigCore
KF5::ConfigGui
+ KF5::DBusAddons
KF5::I18n
KF5::Solid
KF5::IdleTime
KF5::GlobalAccel
+ KF5::Screen
KF5::Service
KF5::WidgetsAddons
KF5::Notifications
@@ -69,7 +70,7 @@
PW::KWorkspace
)
-if (X11_FOUND) # kwin kscreen helper effect
+if (XCB_FOUND) # kwin kscreen helper effect
target_link_libraries(powerdevilcore Qt5::X11Extras XCB::XCB)
endif ()
@@ -83,7 +84,7 @@
# DBus Adaptors
qt5_add_dbus_adaptor(kded_powerdevil_SRCS org.kde.Solid.PowerManagement.xml powerdevilcore.h PowerDevil::Core)
-qt5_add_dbus_adaptor(kded_powerdevil_SRCS ${KDE4_DBUS_INTERFACES_DIR}/kf5_org.kde.Solid.PowerManagement.PolicyAgent.xml
+qt5_add_dbus_adaptor(kded_powerdevil_SRCS org.kde.Solid.PowerManagement.PolicyAgent.xml
powerdevilpolicyagent.h PowerDevil::PolicyAgent
powermanagementpolicyagentadaptor PowerManagementPolicyAgentAdaptor)
@@ -104,7 +105,7 @@
KF5::DBusAddons
powerdevilcore
)
-if (X11_FOUND)
+if (XCB_FOUND)
target_link_libraries(kded_powerdevil Qt5::X11Extras)
endif ()
@@ -131,7 +132,7 @@
)
set(HAVE_UDEV ${UDEV_FOUND})
-set(HAVE_X11 ${X11_FOUND})
+set(HAVE_XCB ${XCB_FOUND})
configure_file(config-powerdevil.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-powerdevil.h )
install(TARGETS powerdevilui ${INSTALL_TARGETS_DEFAULT_ARGS})
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/CMakeLists.txt
^
|
@@ -1,6 +1,4 @@
install(FILES powerdevilaction.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
add_subdirectory(bundled)
-if(HAVE_DPMS)
- add_subdirectory(dpms)
-endif()
+add_subdirectory(dpms)
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/brightnesscontrol.cpp
^
|
@@ -62,10 +62,6 @@
connect(globalAction, SIGNAL(triggered(bool)), SLOT(decreaseBrightness()));
}
-BrightnessControl::~BrightnessControl()
-{
-}
-
void BrightnessControl::onProfileUnload()
{
//
@@ -83,32 +79,38 @@
void BrightnessControl::onProfileLoad()
{
- // This unparsable conditional block means: if the current profile is more
- // conservative than the previous one and the current brightness is lower
- // than the new profile
+ // if the current profile is more conservative than the previous one and the
+ // current brightness is lower than the new profile
if (((m_currentProfile == "Battery" && m_lastProfile == "AC") ||
(m_currentProfile == "LowBattery" && (m_lastProfile == "AC" || m_lastProfile == "Battery"))) &&
m_defaultValue > brightness()) {
+
// We don't want to change anything here
qCDebug(POWERDEVIL) << "Not changing brightness, the current one is lower and the profile is more conservative";
} else if (m_defaultValue >= 0) {
- QVariantMap args;
- args["Value"] = QVariant::fromValue((float)m_defaultValue);
+ const int absoluteValue = qRound(m_defaultValue / 100.0 * brightnessMax());
+ QVariantMap args{
+ {QStringLiteral("Value"), QVariant::fromValue(absoluteValue)}
+ };
+
+ // plugging in/out the AC is always explicit
+ if ((m_currentProfile == "AC" && m_lastProfile != "AC") ||
+ (m_currentProfile != "AC" && m_lastProfile == "AC")) {
+ args["Explicit"] = true;
+ args["Silent"] = true; // but we still don't want to show the OSD then
+ }
+
trigger(args);
}
}
-void BrightnessControl::triggerImpl(const QVariantMap& args)
+void BrightnessControl::triggerImpl(const QVariantMap &args)
{
- if (args.contains("Step")) {
- backend()->setBrightnessStep(args["Step"].toInt());
- } else if ((QMetaType::Type) args["Value"].type() == QMetaType::Int) {
- backend()->setBrightnessValue(args["Value"].toInt());
- } else {
- backend()->setBrightness(args["Value"].toFloat());
- }
- if (args["Explicit"].toBool() && !args["Silent"].toBool()) {
- BrightnessOSDWidget::show(brightness());
+ const int value = args.value(QStringLiteral("Value")).toInt();
+
+ backend()->setBrightness(value);
+ if (args.value(QStringLiteral("Explicit")).toBool() && !args.value(QStringLiteral("Silent")).toBool()) {
+ BrightnessOSDWidget::show(brightnessPercent(value));
}
}
@@ -132,8 +134,6 @@
if (config.hasKey("value")) {
m_defaultValue = config.readEntry<int>("value", 50);
- } else {
- m_defaultValue = -1;
}
return true;
@@ -142,90 +142,67 @@
void BrightnessControl::onBrightnessChangedFromBackend(const BrightnessLogic::BrightnessInfo &info, BackendInterface::BrightnessControlType type)
{
if (type == BackendInterface::Screen) {
- int brightness = qRound(info.percentage);
- Q_EMIT brightnessValueChanged(info.value);
- Q_EMIT brightnessStepChanged(info.step);
- Q_EMIT brightnessChanged(brightness);
+ Q_EMIT brightnessChanged(info.value);
+ Q_EMIT brightnessMaxChanged(info.valueMax);
}
}
int BrightnessControl::brightness() const
{
- return qRound(backend()->brightness());
+ return backend()->brightness();
}
-void BrightnessControl::setBrightness(int percent)
+int BrightnessControl::brightnessMax() const
{
- QVariantMap args;
- args["Value"] = QVariant::fromValue<float>((float)percent);
- args["Explicit"] = true;
- trigger(args);
+ return backend()->brightnessMax();
}
-void BrightnessControl::setBrightnessSilent(int percent)
+void BrightnessControl::setBrightness(int value)
{
- QVariantMap args;
- args["Value"] = QVariant::fromValue<float>((float)percent);
- args["Explicit"] = true;
- args["Silent"] = true;
- trigger(args);
+ trigger({
+ {QStringLiteral("Value"), QVariant::fromValue(value)},
+ {QStringLiteral("Explicit"), true}
+ });
}
-void BrightnessControl::increaseBrightness()
-{
- backend()->brightnessKeyPressed(BrightnessLogic::Increase);
- BrightnessOSDWidget::show(brightness());
-}
-
-void BrightnessControl::decreaseBrightness()
+void BrightnessControl::setBrightnessSilent(int value)
{
- backend()->brightnessKeyPressed(BrightnessLogic::Decrease);
- BrightnessOSDWidget::show(brightness());
+ trigger({
+ {QStringLiteral("Value"), QVariant::fromValue(value)},
+ {QStringLiteral("Explicit"), true},
+ {QStringLiteral("Silent"), true}
+ });
}
-int BrightnessControl::brightnessValue() const
-{
- return backend()->brightnessValue();
-}
-
-int BrightnessControl::brightnessValueMax() const
-{
- return backend()->brightnessValueMax();
-}
-
-void BrightnessControl::setBrightnessValue(int value)
+void BrightnessControl::increaseBrightness()
{
- QVariantMap args;
- args["Value"] = QVariant::fromValue<int>(value);
- args["Explicit"] = true;
- trigger(args);
+ const int newBrightness = backend()->brightnessKeyPressed(BrightnessLogic::Increase);
+ if (newBrightness > -1) {
+ BrightnessOSDWidget::show(brightnessPercent(newBrightness));
+ }
}
-void BrightnessControl::setBrightnessValueSilent(int value)
+void BrightnessControl::decreaseBrightness()
{
- QVariantMap args;
- args["Value"] = QVariant::fromValue<int>(value);
- args["Explicit"] = true;
- args["Silent"] = true;
- trigger(args);
+ const int newBrightness = backend()->brightnessKeyPressed(BrightnessLogic::Decrease);
+ if (newBrightness > -1) {
+ BrightnessOSDWidget::show(brightnessPercent(newBrightness));
+ }
}
-int BrightnessControl::brightnessStep() const
+int BrightnessControl::brightnessSteps() const
{
- return backend()->brightnessStep();
+ return backend()->brightnessSteps();
}
-int BrightnessControl::brightnessStepMax() const
+int BrightnessControl::brightnessPercent(float value) const
{
- return backend()->brightnessStepMax();
-}
+ const float maxBrightness = brightnessMax();
+ if (maxBrightness <= 0) {
+ return 0;
+ }
-void BrightnessControl::setBrightnessStep(int step)
-{
- QVariantMap args;
- args["Step"] = QVariant::fromValue<int>(step);
- args["Explicit"] = true;
- trigger(args);
+ return qRound(value / maxBrightness * 100);
}
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/brightnesscontrol.h
^
|
@@ -35,7 +35,7 @@
public:
explicit BrightnessControl(QObject* parent);
- virtual ~BrightnessControl();
+ virtual ~BrightnessControl() = default;
protected:
virtual void onProfileUnload();
@@ -53,28 +53,23 @@
void increaseBrightness();
void decreaseBrightness();
int brightness() const;
+ int brightnessMax() const;
void setBrightness(int percent);
void setBrightnessSilent(int percent);
- int brightnessValue() const;
- int brightnessValueMax() const;
- void setBrightnessValue(int value);
- void setBrightnessValueSilent(int value);
-
- int brightnessStep() const;
- int brightnessStepMax() const;
- void setBrightnessStep(int step);
+ int brightnessSteps() const;
private Q_SLOTS:
void onBrightnessChangedFromBackend(const BrightnessLogic::BrightnessInfo &brightnessInfo, BackendInterface::BrightnessControlType type);
Q_SIGNALS:
- void brightnessChanged(int percent);
- void brightnessValueChanged(int value);
- void brightnessStepChanged(int step);
+ void brightnessChanged(int value);
+ void brightnessMaxChanged(int valueMax);
private:
- int m_defaultValue;
+ int brightnessPercent(float value) const;
+
+ int m_defaultValue = -1;
QString m_lastProfile;
QString m_currentProfile;
};
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/dimdisplay.cpp
^
|
@@ -30,19 +30,14 @@
namespace PowerDevil {
namespace BundledActions {
-DimDisplay::DimDisplay(QObject* parent)
- : Action(parent), m_dimmed(false)
+DimDisplay::DimDisplay(QObject* parent) : Action(parent)
{
setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings);
}
-DimDisplay::~DimDisplay()
-{
-
-}
-
void DimDisplay::onProfileUnload()
{
+
}
void DimDisplay::onWakeupFromIdle()
@@ -50,13 +45,13 @@
if (!m_dimmed) {
return;
}
- setBrightnessHelper(m_oldScreenBrightnessValue, m_oldKeyboardBrightnessValue);
+ setBrightnessHelper(m_oldScreenBrightness, m_oldKeyboardBrightness);
m_dimmed = false;
}
void DimDisplay::onIdleTimeout(int msec)
{
- if (backend()->brightnessValue() == 0) {
+ if (backend()->brightness() == 0) {
//Some drivers report brightness == 0 when display is off because of DPMS
//(especially Intel driver). Don't change brightness in this case, or
//backlight won't switch on later.
@@ -67,13 +62,13 @@
if (msec == m_dimOnIdleTime) {
setBrightnessHelper(0, 0);
} else if (msec == (m_dimOnIdleTime * 3 / 4)) {
- const int newBrightness = qRound(m_oldScreenBrightnessValue / 8.0);
+ const int newBrightness = qRound(m_oldScreenBrightness / 8.0);
setBrightnessHelper(newBrightness, 0);
} else if (msec == (m_dimOnIdleTime * 1 / 2)) {
- m_oldScreenBrightnessValue = backend()->brightnessValue();
- m_oldKeyboardBrightnessValue = backend()->brightnessValue(BackendInterface::Keyboard);
+ m_oldScreenBrightness = backend()->brightness();
+ m_oldKeyboardBrightness = backend()->brightness(BackendInterface::Keyboard);
- const int newBrightness = qRound(m_oldScreenBrightnessValue / 2.0);
+ const int newBrightness = qRound(m_oldScreenBrightness / 2.0);
setBrightnessHelper(newBrightness, 0);
}
@@ -87,19 +82,19 @@
void DimDisplay::setBrightnessHelper(int screen, int keyboard)
{
- QVariantMap args;
- args["_ScreenBrightnessValue"] = QVariant::fromValue(screen);
- args["_KeyboardBrightnessValue"] = QVariant::fromValue(keyboard);
- trigger(args);
+ trigger({
+ {QStringLiteral("_ScreenBrightness"), QVariant::fromValue(screen)},
+ {QStringLiteral("_KeyboardBrightness"), QVariant::fromValue(keyboard)}
+ });
}
void DimDisplay::triggerImpl(const QVariantMap &args)
{
- backend()->setBrightnessValue(args["_ScreenBrightnessValue"].toInt(), BackendInterface::Screen);
+ backend()->setBrightness(args.value(QStringLiteral("_ScreenBrightness")).toInt(), BackendInterface::Screen);
// don't manipulate keyboard brightness if it's already zero to prevent races with DPMS action
- if (m_oldKeyboardBrightnessValue > 0) {
- backend()->setBrightnessValue(args["_KeyboardBrightnessValue"].toInt(), BackendInterface::Keyboard);
+ if (m_oldKeyboardBrightness > 0) {
+ backend()->setBrightness(args.value(QStringLiteral("_KeyboardBrightness")).toInt(), BackendInterface::Keyboard);
}
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/dimdisplay.h
^
|
@@ -34,7 +34,7 @@
public:
explicit DimDisplay(QObject *parent);
- virtual ~DimDisplay();
+ virtual ~DimDisplay() = default;
protected:
virtual void onProfileUnload();
@@ -50,12 +50,12 @@
private:
void setBrightnessHelper(int screen, int keyboard);
- int m_dimOnIdleTime;
+ int m_dimOnIdleTime = 0;
- int m_oldScreenBrightnessValue;
- int m_oldKeyboardBrightnessValue;
+ int m_oldScreenBrightness = 0;
+ int m_oldKeyboardBrightness = 0;
- bool m_dimmed;
+ bool m_dimmed = false;
};
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/handlebuttonevents.cpp
^
|
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2010 by Dario Freddi <drf@kde.org> *
+ * Copyright (C) 2015 by Kai Uwe Broulik <kde@privat.broulik.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -23,29 +24,28 @@
#include "suspendsession.h"
#include <powerdevilactionpool.h>
+#include <powerdevil_debug.h>
#include <QAction>
+
#include <KActionCollection>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KIdleTime>
-#include <Solid/Device>
-
-#include "PowerDevilSettings.h"
-#include "screensaver_interface.h"
+#include <KScreen/Config>
+#include <KScreen/ConfigMonitor>
+#include <KScreen/GetConfigOperation>
+#include <KScreen/Output>
#include <kglobalaccel.h>
namespace PowerDevil {
namespace BundledActions {
-HandleButtonEvents::HandleButtonEvents(QObject* parent)
+HandleButtonEvents::HandleButtonEvents(QObject *parent)
: Action(parent)
- , m_lidAction(0)
- , m_powerButtonAction(0)
- , m_sleepButtonAction(1)
- , m_hibernateButtonAction(2)
+ , m_screenConfiguration(nullptr)
{
new HandleButtonEventsAdaptor(this);
// We enforce no policies here - after all, we just call other actions - which have their policies.
@@ -70,6 +70,15 @@
//globalAction->setText(i18nc("Global shortcut", "Power Off button"));
accel->setGlobalShortcut(globalAction, Qt::Key_PowerOff);
connect(globalAction, SIGNAL(triggered(bool)), SLOT(powerOffButtonTriggered()));
+
+ connect(new KScreen::GetConfigOperation(KScreen::GetConfigOperation::NoEDID), &KScreen::ConfigOperation::finished,
+ this, [this](KScreen::ConfigOperation *op) {
+ m_screenConfiguration = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
+ checkOutputs();
+
+ KScreen::ConfigMonitor::instance()->addConfig(m_screenConfiguration);
+ connect(KScreen::ConfigMonitor::instance(), &KScreen::ConfigMonitor::configurationChanged, this, &HandleButtonEvents::checkOutputs);
+ });
}
HandleButtonEvents::~HandleButtonEvents()
@@ -79,7 +88,8 @@
bool HandleButtonEvents::isSupported()
{
- return backend()->isLidPresent();
+ //we handles keyboard shortcuts in our button handling, users always have a keyboard
+ return true;
}
void HandleButtonEvents::onProfileUnload()
@@ -107,52 +117,53 @@
{
switch (type) {
case BackendInterface::LidClose:
- // Check if the configuration makes it explicit or not
- processAction(m_lidAction, PowerDevilSettings::doNotInhibitOnLidClose());
+ if (!triggersLidAction()) {
+ qCWarning(POWERDEVIL) << "Lid action was suppressed because an external monitor is present";
+ return;
+ }
+
+ processAction(m_lidAction);
break;
case BackendInterface::LidOpen:
// In this case, let's send a wakeup event
KIdleTime::instance()->simulateUserActivity();
break;
case BackendInterface::PowerButton:
- // This one is always explicit
- processAction(m_powerButtonAction, true);
+ processAction(m_powerButtonAction);
break;
case BackendInterface::SleepButton:
- // This one is always explicit
- processAction(m_sleepButtonAction, true);
+ processAction(m_sleepButtonAction);
break;
case BackendInterface::HibernateButton:
- // This one is always explicit
- processAction(m_hibernateButtonAction, true);
+ processAction(m_hibernateButtonAction);
break;
default:
break;
}
}
-void HandleButtonEvents::processAction(uint action, bool isExplicit)
+void HandleButtonEvents::processAction(uint action)
{
// Basically, we simply trigger other actions :)
- switch ((SuspendSession::Mode)action) {
+ switch (static_cast<SuspendSession::Mode>(action)) {
case SuspendSession::TurnOffScreenMode:
// Turn off screen
- triggerAction("DPMSControl", qVariantFromValue< QString >("TurnOff"), isExplicit);
+ triggerAction("DPMSControl", QStringLiteral("TurnOff"));
break;
default:
- triggerAction("SuspendSession", qVariantFromValue< uint >(action), isExplicit);
+ triggerAction("SuspendSession", action);
break;
}
}
-void HandleButtonEvents::triggerAction(const QString& action, const QVariant &type, bool isExplicit)
+void HandleButtonEvents::triggerAction(const QString &action, const QVariant &type)
{
PowerDevil::Action *helperAction = ActionPool::instance()->loadAction(action, KConfigGroup(), core());
if (helperAction) {
- QVariantMap args;
- args["Type"] = type;
- args["Explicit"] = QVariant::fromValue(isExplicit);
- helperAction->trigger(args);
+ helperAction->trigger({
+ {QStringLiteral("Type"), type},
+ {QStringLiteral("Explicit"), true}
+ });
}
}
@@ -161,8 +172,8 @@
// For now, let's just accept the phantomatic "32" button. It is also always explicit
if (args["Button"].toInt() == 32) {
if (args.contains("Type")) {
- triggerAction("SuspendSession", args["Type"], true);
- }
+ triggerAction("SuspendSession", args["Type"]);
+ }
}
}
@@ -170,8 +181,11 @@
{
// Read configs
m_lidAction = config.readEntry<uint>("lidAction", 0);
+ m_triggerLidActionWhenExternalMonitorPresent = config.readEntry<bool>("triggerLidActionWhenExternalMonitorPresent", false);
m_powerButtonAction = config.readEntry<uint>("powerButtonAction", 0);
+ checkOutputs();
+
return true;
}
@@ -180,6 +194,11 @@
return m_lidAction;
}
+bool HandleButtonEvents::triggersLidAction() const
+{
+ return m_triggerLidActionWhenExternalMonitorPresent || !m_externalMonitorPresent;
+}
+
void HandleButtonEvents::powerOffButtonTriggered()
{
onButtonPressed(BackendInterface::PowerButton);
@@ -195,7 +214,30 @@
onButtonPressed(BackendInterface::SleepButton);
}
-}
+void HandleButtonEvents::checkOutputs()
+{
+ if (!m_screenConfiguration) {
+ qCWarning(POWERDEVIL) << "Handle button events action could not check for screen configuration";
+ return;
+ }
+
+ const bool old_triggersLidAction = triggersLidAction();
+
+ bool hasExternalMonitor = false;
+
+ for(const KScreen::OutputPtr &output : m_screenConfiguration->outputs()) {
+ if (output->isConnected() && output->isEnabled() && output->type() != KScreen::Output::Panel) {
+ hasExternalMonitor = true;
+ break;
+ }
+ }
+
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/handlebuttonevents.h
^
|
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2010 by Dario Freddi <drf@kde.org> *
+ * Copyright (C) 2015 by Kai Uwe Broulik <kde@privat.broulik.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -21,6 +22,8 @@
#ifndef POWERDEVIL_BUNDLEDACTIONS_HANDLEBUTTONEVENTS_H
#define POWERDEVIL_BUNDLEDACTIONS_HANDLEBUTTONEVENTS_H
+#include <KScreen/Types>
+
#include <powerdevilaction.h>
#include <powerdevilbackendinterface.h>
@@ -40,6 +43,9 @@
virtual bool loadAction(const KConfigGroup& config);
virtual bool isSupported();
+signals:
+ void triggersLidActionChanged(bool triggers);
+
protected:
virtual void triggerImpl(const QVariantMap& args);
virtual void onProfileUnload();
@@ -47,23 +53,30 @@
virtual void onIdleTimeout(int msec);
virtual void onProfileLoad();
-public Q_SLOTS:
+public slots:
int lidAction() const;
+ bool triggersLidAction() const;
-private Q_SLOTS:
+private slots:
void onButtonPressed(PowerDevil::BackendInterface::ButtonType type);
void powerOffButtonTriggered();
void suspendToRam();
void suspendToDisk();
+ void checkOutputs();
+
private:
- void processAction(uint action, bool isExplicit);
- void triggerAction(const QString &action, const QVariant &type, bool isExplicit);
+ void processAction(uint action);
+ void triggerAction(const QString &action, const QVariant &type);
- uint m_lidAction;
- uint m_powerButtonAction;
- uint m_sleepButtonAction;
- uint m_hibernateButtonAction;
+ KScreen::ConfigPtr m_screenConfiguration;
+ uint m_lidAction = 0;
+ bool m_triggerLidActionWhenExternalMonitorPresent = false;
+ bool m_externalMonitorPresent = false;
+
+ uint m_powerButtonAction = 0;
+ uint m_sleepButtonAction = 1;
+ uint m_hibernateButtonAction = 2;
};
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/handlebuttoneventsconfig.cpp
^
|
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2010 by Dario Freddi <drf@kde.org> *
+ * Copyright (C) 2015 by Kai Uwe Broulik <kde@privat.broulik.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -28,7 +29,8 @@
#include <KLocalizedString>
#include <KPluginFactory>
#include <KSharedConfig>
-#include <KComboBox>
+#include <QComboBox>
+#include <QCheckBox>
#include <QIcon>
K_PLUGIN_FACTORY(PowerDevilSuspendSessionConfigFactory, registerPlugin<PowerDevil::BundledActions::HandleButtonEventsConfig>(); )
@@ -51,10 +53,13 @@
void HandleButtonEventsConfig::save()
{
if (m_lidCloseCombo) {
- configGroup().writeEntry< uint >("lidAction", m_lidCloseCombo->itemData(m_lidCloseCombo->currentIndex()).toUInt());
+ configGroup().writeEntry<uint>("lidAction", m_lidCloseCombo->itemData(m_lidCloseCombo->currentIndex()).toUInt());
+ }
+ if (m_triggerLidActionWhenExternalMonitorPresent) {
+ configGroup().writeEntry<bool>("triggerLidActionWhenExternalMonitorPresent", m_triggerLidActionWhenExternalMonitorPresent->isChecked());
}
if (m_powerButtonCombo) {
- configGroup().writeEntry< uint >("powerButtonAction", m_powerButtonCombo->itemData(m_powerButtonCombo->currentIndex()).toUInt());
+ configGroup().writeEntry<uint>("powerButtonAction", m_powerButtonCombo->itemData(m_powerButtonCombo->currentIndex()).toUInt());
}
configGroup().sync();
@@ -65,27 +70,33 @@
configGroup().config()->reparseConfiguration();
if (m_lidCloseCombo) {
- m_lidCloseCombo->setCurrentIndex(m_lidCloseCombo->findData(QVariant::fromValue(configGroup().readEntry< uint >("lidAction", 0))));
+ m_lidCloseCombo->setCurrentIndex(m_lidCloseCombo->findData(QVariant::fromValue(configGroup().readEntry<uint>("lidAction", 0))));
+ }
+ if (m_triggerLidActionWhenExternalMonitorPresent) {
+ m_triggerLidActionWhenExternalMonitorPresent->setChecked(configGroup().readEntry<bool>("triggerLidActionWhenExternalMonitorPresent", false));
}
if (m_powerButtonCombo) {
- m_powerButtonCombo->setCurrentIndex(m_powerButtonCombo->findData(QVariant::fromValue(configGroup().readEntry< uint >("powerButtonAction", 0))));
+ m_powerButtonCombo->setCurrentIndex(m_powerButtonCombo->findData(QVariant::fromValue(configGroup().readEntry<uint>("powerButtonAction", 0))));
}
}
QList< QPair< QString, QWidget* > > HandleButtonEventsConfig::buildUi()
{
// Create the boxes
- m_lidCloseCombo = new KComboBox;
- m_powerButtonCombo = new KComboBox;
+ m_lidCloseCombo = new QComboBox;
+ m_triggerLidActionWhenExternalMonitorPresent = new QCheckBox(
+ i18nc("Execute action on lid close even when external monitor is connected", "Even when an external monitor is connected")
+ );
+ m_powerButtonCombo = new QComboBox;
// Fill the boxes with options!
{
- QList< KComboBox* > boxes;
+ QList<QComboBox *> boxes;
boxes << m_lidCloseCombo << m_powerButtonCombo;
QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates();
- foreach (KComboBox *box, boxes) {
+ foreach (QComboBox *box, boxes) {
box->addItem(QIcon::fromTheme("dialog-cancel"), i18n("Do nothing"), (uint)SuspendSession::None);
if (methods.contains(Solid::PowerManagement::SuspendState)) {
box->addItem(QIcon::fromTheme("system-suspend"), i18n("Sleep"), (uint)SuspendSession::ToRamMode);
@@ -103,13 +114,11 @@
}
connect(m_lidCloseCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged()));
+ connect(m_triggerLidActionWhenExternalMonitorPresent, SIGNAL(stateChanged(int)), this, SLOT(setChanged()));
connect(m_powerButtonCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged()));
- m_lidCloseCombo->setMaximumWidth(300);
- m_powerButtonCombo->setMaximumWidth(300);
-
bool lidFound = false;
- bool powerFound = false;
+ bool powerFound = true; // HACK This needs proper API!!
// get a list of all devices that are Buttons
/* foreach (Solid::Device device, Solid::Device::listFromType(Solid::DeviceInterface::Button, QString())) {
Solid::Button *button = device.as<Solid::Button>();
@@ -126,17 +135,38 @@
QList< QPair< QString, QWidget* > > retlist;
if (lidFound) {
- retlist.append(qMakePair< QString, QWidget* >(i18n("When laptop lid closed"), m_lidCloseCombo));
+ retlist.append(qMakePair<QString, QWidget *>(i18n("When laptop lid closed"), m_lidCloseCombo));
+ // an empty label will make it treat the widget as title checkbox and left-align it
+ retlist.append(qMakePair<QString, QWidget *>(QLatin1Literal("NONE"), m_triggerLidActionWhenExternalMonitorPresent));
} else {
m_lidCloseCombo->deleteLater();
- m_lidCloseCombo = 0;
+ m_lidCloseCombo = nullptr;
+ m_triggerLidActionWhenExternalMonitorPresent->deleteLater();
+ m_triggerLidActionWhenExternalMonitorPresent = nullptr;
}
if (powerFound) {
retlist.append(qMakePair< QString, QWidget* >(i18n("When power button pressed"), m_powerButtonCombo));
} else {
m_powerButtonCombo->deleteLater();
- m_powerButtonCombo = 0;
+ m_powerButtonCombo = nullptr;
+ }
+
+ // unified width for the comboboxes
+ int comboBoxMaxWidth = 300;
+ if (m_lidCloseCombo) {
+ comboBoxMaxWidth = qMax(comboBoxMaxWidth, m_lidCloseCombo->sizeHint().width());
+ }
+ if (m_powerButtonCombo) {
+ comboBoxMaxWidth = qMax(comboBoxMaxWidth, m_powerButtonCombo->sizeHint().width());
+ }
+ if (m_lidCloseCombo) {
+ m_lidCloseCombo->setMinimumWidth(300);
+ m_lidCloseCombo->setMaximumWidth(comboBoxMaxWidth);
+ }
+ if (m_powerButtonCombo) {
+ m_powerButtonCombo->setMinimumWidth(300);
+ m_powerButtonCombo->setMaximumWidth(comboBoxMaxWidth);
}
return retlist;
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/handlebuttoneventsconfig.h
^
|
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2010 by Dario Freddi <drf@kde.org> *
+ * Copyright (C) 2015 by Kai Uwe Broulik <kde@privat.broulik.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -22,7 +23,8 @@
#include <powerdevilactionconfig.h>
-class KComboBox;
+class QComboBox;
+class QCheckBox;
namespace PowerDevil {
namespace BundledActions {
@@ -40,8 +42,9 @@
virtual QList< QPair< QString, QWidget* > > buildUi();
private:
- KComboBox *m_lidCloseCombo;
- KComboBox *m_powerButtonCombo;
+ QComboBox *m_lidCloseCombo;
+ QCheckBox *m_triggerLidActionWhenExternalMonitorPresent;
+ QComboBox *m_powerButtonCombo;
};
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/keyboardbrightnesscontrol.cpp
^
|
@@ -35,8 +35,7 @@
#include <KActionCollection>
#include <KConfigGroup>
#include <KLocalizedString>
-#include <kglobalaccel.h>
-#include <kglobalaccel.h>
+#include <KGlobalAccel>
#include <QDBusInterface>
#include <QDBusPendingCall>
@@ -73,10 +72,6 @@
connect(globalAction, SIGNAL(triggered(bool)), SLOT(toggleKeyboardBacklight()));
}
-KeyboardBrightnessControl::~KeyboardBrightnessControl()
-{
-}
-
void KeyboardBrightnessControl::onProfileUnload()
{
//
@@ -94,32 +89,37 @@
void KeyboardBrightnessControl::onProfileLoad()
{
- // This unparsable conditional block means: if the current profile is more
- // conservative than the previous one and the current brightness is lower
- // than the new profile
+ // if the current profile is more conservative than the previous one and the
+ // current brightness is lower than the new profile
if (((m_currentProfile == "Battery" && m_lastProfile == "AC") ||
(m_currentProfile == "LowBattery" && (m_lastProfile == "AC" || m_lastProfile == "Battery"))) &&
m_defaultValue > keyboardBrightness()) {
+
// We don't want to change anything here
qCDebug(POWERDEVIL) << "Not changing keyboard brightness, the current one is lower and the profile is more conservative";
} else if (m_defaultValue > 0) {
- QVariantMap args;
- args["Value"] = QVariant::fromValue((float)m_defaultValue);
+ const int absoluteValue = qRound(m_defaultValue / 100.0 * keyboardBrightnessMax());
+ QVariantMap args{
+ {QStringLiteral("Value"), QVariant::fromValue(absoluteValue)}
+ };
+
+ // plugging in/out the AC is always explicit
+ if ((m_currentProfile == "AC" && m_lastProfile != "AC") ||
+ (m_currentProfile != "AC" && m_lastProfile == "AC")) {
+ args["Explicit"] = true;
+ args["Silent"] = true; // but we still don't want to show the OSD then
+ }
+
trigger(args);
}
}
-void KeyboardBrightnessControl::triggerImpl(const QVariantMap& args)
+void KeyboardBrightnessControl::triggerImpl(const QVariantMap &args)
{
- if (args.contains("Step")) {
- backend()->setBrightnessStep(args["Step"].toInt(), BackendInterface::Keyboard);
- } else if ((QMetaType::Type) args["Value"].type() == QMetaType::Int) {
- backend()->setBrightnessValue(args["Value"].toInt(), BackendInterface::Keyboard);
- } else {
- backend()->setBrightness(args["Value"].toFloat(), BackendInterface::Keyboard);
- }
- if (args["Explicit"].toBool() && !args["Silent"].toBool()) {
- BrightnessOSDWidget::show(keyboardBrightness(), BackendInterface::Keyboard);
+ backend()->setBrightness(args.value(QStringLiteral("Value")).toInt(), BackendInterface::Keyboard);
+
+ if (args.value(QStringLiteral("Explicit")).toBool() && !args.value(QStringLiteral("Silent")).toBool()) {
+ BrightnessOSDWidget::show(keyboardBrightnessPercent(), BackendInterface::Keyboard);
}
}
@@ -143,8 +143,6 @@
if (config.hasKey("value")) {
m_defaultValue = config.readEntry<int>("value", 50);
- } else {
- m_defaultValue = -1;
}
return true;
@@ -153,96 +151,69 @@
void KeyboardBrightnessControl::onBrightnessChangedFromBackend(const BrightnessLogic::BrightnessInfo &info, BackendInterface::BrightnessControlType type)
{
if (type == BackendInterface::Keyboard) {
- int brightness = qRound(info.percentage);
- Q_EMIT keyboardBrightnessValueChanged(info.value);
- Q_EMIT keyboardBrightnessStepChanged(info.step);
- Q_EMIT keyboardBrightnessChanged(brightness);
+ Q_EMIT keyboardBrightnessChanged(info.value);
+ Q_EMIT keyboardBrightnessMaxChanged(info.valueMax);
}
}
void KeyboardBrightnessControl::increaseKeyboardBrightness()
{
backend()->brightnessKeyPressed(BrightnessLogic::Increase, BackendInterface::Keyboard);
- BrightnessOSDWidget::show(keyboardBrightness(), BackendInterface::Keyboard);
+ BrightnessOSDWidget::show(keyboardBrightnessPercent(), BackendInterface::Keyboard);
}
void KeyboardBrightnessControl::decreaseKeyboardBrightness()
{
backend()->brightnessKeyPressed(BrightnessLogic::Decrease, BackendInterface::Keyboard);
- BrightnessOSDWidget::show(keyboardBrightness(), BackendInterface::Keyboard);
+ BrightnessOSDWidget::show(keyboardBrightnessPercent(), BackendInterface::Keyboard);
}
void KeyboardBrightnessControl::toggleKeyboardBacklight()
{
backend()->brightnessKeyPressed(BrightnessLogic::Toggle, BackendInterface::Keyboard);
- BrightnessOSDWidget::show(keyboardBrightness(), BackendInterface::Keyboard);
+ BrightnessOSDWidget::show(keyboardBrightnessPercent(), BackendInterface::Keyboard);
}
int KeyboardBrightnessControl::keyboardBrightness() const
{
- return qRound(backend()->brightness(BackendInterface::Keyboard));
-}
-
-void KeyboardBrightnessControl::setKeyboardBrightness(int percent)
-{
- QVariantMap args;
- args["Value"] = QVariant::fromValue<float>((float)percent);
- args["Explicit"] = true;
- trigger(args);
+ return backend()->brightness(BackendInterface::Keyboard);
}
-void KeyboardBrightnessControl::setKeyboardBrightnessSilent(int percent)
+int KeyboardBrightnessControl::keyboardBrightnessMax() const
{
- QVariantMap args;
- args["Value"] = QVariant::fromValue<float>((float)percent);
- args["Explicit"] = true;
- args["Silent"] = true;
- trigger(args);
+ return backend()->brightnessMax(BackendInterface::Keyboard);
}
-int KeyboardBrightnessControl::keyboardBrightnessValue() const
-{
- return backend()->brightnessValue(BackendInterface::Keyboard);
-}
-
-int KeyboardBrightnessControl::keyboardBrightnessValueMax() const
-{
- return backend()->brightnessValueMax(BackendInterface::Keyboard);
-}
-
-void KeyboardBrightnessControl::setKeyboardBrightnessValue(int value)
+void KeyboardBrightnessControl::setKeyboardBrightness(int percent)
{
- QVariantMap args;
- args["Value"] = QVariant::fromValue<int>(value);
- args["Explicit"] = true;
- trigger(args);
+ trigger({
+ {QStringLiteral("Value"), QVariant::fromValue(percent)},
+ {QStringLiteral("Explicit"), true}
+ });
}
-void KeyboardBrightnessControl::setKeyboardBrightnessValueSilent(int value)
+void KeyboardBrightnessControl::setKeyboardBrightnessSilent(int percent)
{
- QVariantMap args;
- args["Value"] = QVariant::fromValue<int>(value);
- args["Explicit"] = true;
- args["Silent"] = true;
- trigger(args);
+ trigger({
+ {QStringLiteral("Value"), QVariant::fromValue(percent)},
+ {QStringLiteral("Explicit"), true},
+ {QStringLiteral("Silent"), true}
+ });
}
-int KeyboardBrightnessControl::keyboardBrightnessStep() const
+int KeyboardBrightnessControl::keyboardBrightnessSteps() const
{
- return backend()->brightnessStep(BackendInterface::Keyboard);
+ return backend()->brightnessSteps(BackendInterface::Keyboard);
}
-int KeyboardBrightnessControl::keyboardBrightnessStepMax() const
+int KeyboardBrightnessControl::keyboardBrightnessPercent() const
{
- return backend()->brightnessStepMax(BackendInterface::Keyboard);
-}
+ const float maxBrightness = keyboardBrightnessMax();
+ if (maxBrightness <= 0) {
+ return 0;
+ }
-void KeyboardBrightnessControl::setKeyboardBrightnessStep(int step)
-{
- QVariantMap args;
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/keyboardbrightnesscontrol.h
^
|
@@ -35,7 +35,7 @@
public:
explicit KeyboardBrightnessControl(QObject* parent);
- virtual ~KeyboardBrightnessControl();
+ virtual ~KeyboardBrightnessControl() = default;
protected:
virtual void onProfileUnload();
@@ -57,25 +57,20 @@
void toggleKeyboardBacklight();
int keyboardBrightness() const;
- void setKeyboardBrightness(int percent);
- void setKeyboardBrightnessSilent(int percent);
+ int keyboardBrightnessMax() const;
+ void setKeyboardBrightness(int value);
+ void setKeyboardBrightnessSilent(int value);
- int keyboardBrightnessValue() const;
- int keyboardBrightnessValueMax() const;
- void setKeyboardBrightnessValue(int value);
- void setKeyboardBrightnessValueSilent(int value);
-
- int keyboardBrightnessStep() const;
- int keyboardBrightnessStepMax() const;
- void setKeyboardBrightnessStep(int step);
+ int keyboardBrightnessSteps() const;
Q_SIGNALS:
- void keyboardBrightnessChanged(int percent);
- void keyboardBrightnessValueChanged(int value);
- void keyboardBrightnessStepChanged(int step);
+ void keyboardBrightnessChanged(int value);
+ void keyboardBrightnessMaxChanged(int valueMax);
private:
- int m_defaultValue;
+ int keyboardBrightnessPercent() const;
+
+ int m_defaultValue = -1;
QString m_lastProfile;
QString m_currentProfile;
};
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/org.kde.Solid.PowerManagement.Actions.BrightnessControl.xml
^
|
@@ -10,41 +10,20 @@
<method name="brightness">
<arg type="i" direction="out" />
</method>
+ <method name="brightnessMax">
+ <arg type="i" direction="out" />
+ </method>
<signal name="brightnessChanged">
<arg type="i" direction="out" />
</signal>
-
- <method name="setBrightnessValue">
- <arg type="i" direction="in" />
- </method>
- <method name="setBrightnessValueSilent">
- <arg type="i" direction="in" />
- </method>
- <method name="brightnessValue">
- <arg type="i" direction="out" />
- </method>
- <method name="brightnessValueMax">
- <arg type="i" direction="out" />
- </method>
-
- <signal name="brightnessValueChanged">
+ <signal name="brightnessMaxChanged">
<arg type="i" direction="out" />
</signal>
- <method name="setBrightnessStep">
- <arg type="i" direction="in" />
- </method>
- <method name="brightnessStep">
- <arg type="i" direction="out" />
- </method>
- <method name="brightnessStepMax">
+ <method name="brightnessSteps">
<arg type="i" direction="out" />
</method>
- <signal name="brightnessStepChanged">
- <arg type="i" direction="out" />
- </signal>
-
</interface>
</node>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/org.kde.Solid.PowerManagement.Actions.HandleButtonEvents.xml
^
|
@@ -4,5 +4,11 @@
<method name="lidAction">
<arg type="i" direction="out" />
</method>
+ <method name="triggersLidAction">
+ <arg type="b" direction="out" />
+ </method>
+ <signal name="triggersLidActionChanged">
+ <arg type="b" />
+ </signal>
</interface>
</node>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/org.kde.Solid.PowerManagement.Actions.KeyboardBrightnessControl.xml
^
|
@@ -10,41 +10,21 @@
<method name="keyboardBrightness">
<arg type="i" direction="out" />
</method>
+ <method name="keyboardBrightnessMax">
+ <arg type="i" direction="out" />
+ </method>
+
<signal name="keyboardBrightnessChanged">
<arg type="i" direction="out" />
</signal>
-
- <method name="setKeyboardBrightnessValue">
- <arg type="i" direction="in" />
- </method>
- <method name="setKeyboardBrightnessValueSilent">
- <arg type="i" direction="in" />
- </method>
- <method name="keyboardBrightnessValue">
- <arg type="i" direction="out" />
- </method>
- <method name="keyboardBrightnessValueMax">
- <arg type="i" direction="out" />
- </method>
-
- <signal name="keyboardBrightnessValueChanged">
+ <signal name="keyboardBrightnessMaxChanged">
<arg type="i" direction="out" />
</signal>
- <method name="setKeyboardBrightnessStep">
- <arg type="i" direction="in" />
- </method>
- <method name="keyboardBrightnessStep">
- <arg type="i" direction="out" />
- </method>
- <method name="keyboardBrightnessStepMax">
+ <method name="keyboardBrightnessSteps">
<arg type="i" direction="out" />
</method>
- <signal name="keyboardBrightnessStepChanged">
- <arg type="i" direction="out" />
- </signal>
-
</interface>
</node>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/powerdevilbrightnesscontrolaction.desktop
^
|
@@ -5,6 +5,7 @@
Icon=preferences-system-power-management
Name=Screen brightness
Name[ar]=سطوع الشاشة
+Name[bs]=Svjetlost ekrana
Name[ca]=Lluminositat de la pantalla
Name[cs]=Jas obrazovky
Name[da]=Skærmens lysstyrke
@@ -13,10 +14,12 @@
Name[en_GB]=Screen brightness
Name[es]=Brillo de la pantalla
Name[fi]=Näytön kirkkaus
+Name[fr]=Luminosité de l'écran
Name[gl]=Brillo da pantalla
Name[hu]=Képernyő fényessége
Name[ia]=Brillantia de Schermo
Name[id]=Kecerahan layar
+Name[it]=Luminosità dello schermo
Name[ko]=화면 밝기
Name[lt]=Ekrano šviesumas
Name[nb]=Skjermlysstyrke
@@ -34,11 +37,14 @@
Name[sr@ijekavianlatin]=Osvjetljaj ekrana
Name[sr@latin]=Osvetljaj ekrana
Name[sv]=Skärmljusstyrka
+Name[tr]=Ekran parlaklığı
Name[uk]=Яскравість екрана
Name[x-test]=xxScreen brightnessxx
Name[zh_CN]=屏幕亮度
+Name[zh_TW]=螢幕亮度
Comment=Basic Controls for brightness
Comment[ar]=تحكم بسيط بالسطوع
+Comment[bs]=Osnovne kontrole osvjetljenja
Comment[ca]=Controls bàsics per la lluminositat
Comment[cs]=Základní ovládání jasu
Comment[da]=Basal kontrol af lysstyrke
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/powerdevildimdisplayaction.desktop
^
|
@@ -5,6 +5,7 @@
Icon=preferences-desktop-display
Name=Dim screen
Name[ar]=أعتِم الشاشة
+Name[bs]=Priguši ekran
Name[ca]=Enfosquiment de la pantalla
Name[cs]=Ztmavit obrazovku
Name[da]=Dæmp skærmen
@@ -13,10 +14,12 @@
Name[en_GB]=Dim screen
Name[es]=Oscurecer la pantalla
Name[fi]=Näytön himmennys
-Name[gl]=Escurecer a pantalla
+Name[fr]=Diminuer la luminosité de l'écran
+Name[gl]=Atenuar a pantalla
Name[hu]=Fényerő csökkentése
Name[ia]=Obscura Schermo
Name[id]=Layar redup
+Name[it]=Oscuramento dello schermo
Name[ko]=화면 어둡게 하기
Name[lt]=Ekrano užtemdymas
Name[nb]=Mørklegg skjerm
@@ -34,11 +37,14 @@
Name[sr@ijekavianlatin]=Priguši ekran
Name[sr@latin]=Priguši ekran
Name[sv]=Dämpa skärmen
+Name[tr]=Ekranı karart
Name[uk]=Зменшення яскравості екрана
Name[x-test]=xxDim screenxx
Name[zh_CN]=暗淡屏幕
+Name[zh_TW]=將螢幕變暗
Comment=Dims gradually the display on a time basis
Comment[ar]=يعتِم الشاشة تدريجياً بناء على توقيت
+Comment[bs]=Postepeno prigušuje ekran na zadano vrijeme
Comment[ca]=Atenua gradualment la pantalla en funció del temps
Comment[cs]=Postupné ztmavení obrazovky
Comment[da]=Dæmper skærmen gradvist baseret på tid
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/powerdevilhandlebuttoneventsaction.desktop
^
|
@@ -6,6 +6,7 @@
Name=Button events handling
Name[ar]=التعامل مع أحداث ضغط الأزرار
+Name[bs]=Rukovanje događajima dugmadi
Name[ca]=Gestió d'esdeveniments de botons
Name[cs]=Řízení událostí tlačítek
Name[da]=Håndtering af knaphændelser
@@ -46,6 +47,7 @@
Comment=Performs an action whenever a button is pressed
Comment[ar]=تنفيذ حَدَث عند ضغط زِرّ
+Comment[bs]=Izvršava radnju na svaki pritisak dugmeta
Comment[ca]=Porta a terme una acció quan es prem un botó
Comment[cs]=Vykoná akci kdykoli je tlačítko stisknuto
Comment[da]=Udfører en handling når der trykkes på en knap
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/powerdevilkeyboardbrightnesscontrolaction.desktop
^
|
@@ -5,6 +5,7 @@
Icon=input-keyboard
Name=Keyboard backlight
Name[ar]=الإضاءة الخلفيّة للوحة المفاتيح
+Name[bs]=Pozadinsko osvjetljenje tastature
Name[ca]=Retroil·luminació del teclat
Name[cs]=Podsvícení klávesnice
Name[da]=Tastaturets baglys
@@ -13,10 +14,12 @@
Name[en_GB]=Keyboard backlight
Name[es]=Luz trasera del teclado
Name[fi]=Näppäimistön taustavalo
+Name[fr]=Rétroéclairage du clavier
Name[gl]=Luz do teclado
Name[hu]=Billentyűzet háttérvilágítás
Name[ia]=Luce de retro (Backlight) de claviero
Name[id]=Lampu papan ketik
+Name[it]=Retro-illuminazione della tastiera
Name[ko]=키보드 백라이트
Name[lt]=Klaviatūros apšvietimas
Name[nb]=Tastaturbaklys
@@ -34,11 +37,14 @@
Name[sr@ijekavianlatin]=Osvetljenje tastature
Name[sr@latin]=Osvetljenje tastature
Name[sv]=Bakgrundsbelysning på tangentbord
+Name[tr]=Klavye arka-ışığı
Name[uk]=Підсвічування клавіатури
Name[x-test]=xxKeyboard backlightxx
Name[zh_CN]=键盘背光
+Name[zh_TW]=鍵盤背光
Comment=Basic Controls for the keyboard backlight brightness
Comment[ar]=تحكم بسيط بالإضاءة الخلفية للوحة المفاتيح
+Comment[bs]=Osnovne kontrole za pozadisnko osvjetljenje tastature
Comment[ca]=Controls bàsics per la brillantor de la retroil·luminació del teclat
Comment[cs]=Základní ovládání jasu podsvícení klávesnice
Comment[da]=Basal kontrol af lysstyrke på tastaturets baglys
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/powerdevilrunscriptaction.desktop
^
|
@@ -4,6 +4,7 @@
# X-KDE-Library=powerdevilrunscriptaction
Icon=system-run
Name=Run script
+Name[bs]=Pokreni skriptu
Name[ca]=Executa un script
Name[cs]=Spustit skript
Name[da]=Kør script
@@ -12,10 +13,12 @@
Name[en_GB]=Run script
Name[es]=Ejecutar script
Name[fi]=Suorita skripti
+Name[fr]=Lancer un script
Name[gl]=Executar un script
Name[hu]=Parancsfájl futtatása
Name[ia]=Exeque Script
Name[id]=Menjalankan skrip
+Name[it]=Esegui script
Name[ko]=스크립트 실행
Name[lt]=Paleisti scenarijų
Name[nb]=Kjør skript
@@ -33,10 +36,13 @@
Name[sr@ijekavianlatin]=Izvrši skriptu
Name[sr@latin]=Izvrši skriptu
Name[sv]=Kör skript
+Name[tr]=Betik çalıştır
Name[uk]=Виконати скрипт
Name[x-test]=xxRun scriptxx
Name[zh_CN]=运行脚本
+Name[zh_TW]=執行文稿
Comment=Runs a custom script
+Comment[bs]=Izvršava posebnu skriptu
Comment[ca]=Executa un script personalitzat
Comment[cs]=Spustit vlastní skript
Comment[da]=Kører et brugerdefineret script
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/powerdevilsuspendsessionaction.desktop
^
|
@@ -5,6 +5,7 @@
Icon=system-shutdown
Name=Suspend session
Name[ar]=علِّق الحِلسة
+Name[bs]=Obustavi sesiju
Name[ca]=Suspèn la sessió
Name[cs]=Pozastavit sezení
Name[da]=Suspendér session
@@ -13,10 +14,12 @@
Name[en_GB]=Suspend session
Name[es]=Suspender la sesión
Name[fi]=Keskeytä istunto
+Name[fr]=Suspendre la session
Name[gl]=Suspender a sesión
Name[hu]=Munkamenet felfüggesztése
Name[ia]=Suspende session
Name[id]=Suspensi sesi
+Name[it]=Sospendi la sessione
Name[ko]=세션 일시 중지
Name[lt]=Pristabdyti sesiją
Name[nb]=Suspender økt
@@ -34,11 +37,14 @@
Name[sr@ijekavianlatin]=Suspenduj sesiju
Name[sr@latin]=Suspenduj sesiju
Name[sv]=Stoppa tillfälligt session
+Name[tr]=Oturumu askıya al
Name[uk]=Призупинити сеанс
Name[x-test]=xxSuspend sessionxx
Name[zh_CN]=挂起会话
+Name[zh_TW]=暫停工作階段
Comment=Suspends the session
Comment[ar]=يعلّق الجلسة
+Comment[bs]=Obustavlja sesiju
Comment[ca]=Suspèn la sessió
Comment[cs]=Pozastaví sezení
Comment[da]=Suspenderer sessionen
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/runscript.cpp
^
|
@@ -19,7 +19,7 @@
#include "runscript.h"
-#include <QtCore/QProcess>
+#include <QProcess>
#include <KConfigGroup>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/suspendsession.cpp
^
|
@@ -28,12 +28,12 @@
#include <kwinkscreenhelpereffect.h>
#include <KConfigGroup>
+#include <KIdleTime>
#include <KLocalizedString>
#include <KJob>
#include <kworkspace.h>
-#include "screensaver_interface.h"
#include <PowerDevilSettings.h>
namespace PowerDevil
@@ -51,9 +51,8 @@
setRequiredPolicies(PowerDevil::PolicyAgent::InterruptSession);
connect(backend(), &PowerDevil::BackendInterface::resumeFromSuspend, this, [this]() {
- // Notify the screensaver
- OrgFreedesktopScreenSaverInterface iface("org.freedesktop.ScreenSaver", "/ScreenSaver", QDBusConnection::sessionBus());
- iface.SimulateUserActivity();
+ KIdleTime::instance()->simulateUserActivity();
+
PowerDevil::PolicyAgent::instance()->setupSystemdInhibition();
m_fadeEffect->stop();
@@ -82,14 +81,22 @@
void SuspendSession::onWakeupFromIdle()
{
- // Nothing to do
+ m_fadeEffect->stop();
}
void SuspendSession::onIdleTimeout(int msec)
{
- Q_UNUSED(msec);
- QVariantMap args;
- args.insert("Type", m_autoType);
+ QVariantMap args{
+ {QStringLiteral("Type"), m_autoType}
+ };
+
+ // we fade the screen to black 5 seconds prior to suspending to alert the user
+ if (msec == m_idleTime - 5000) {
+ args.insert(QStringLiteral("GraceFade"), true);
+ } else {
+ args.insert(QStringLiteral("SkipFade"), true);
+ }
+
trigger(args);
}
@@ -98,23 +105,28 @@
// Nothing to do
}
-void SuspendSession::triggerImpl(const QVariantMap& args)
+void SuspendSession::triggerImpl(const QVariantMap &args)
{
- qCDebug(POWERDEVIL) << "Triggered with " << args["Type"].toString() << args["SkipFade"].toBool();
+ qCDebug(POWERDEVIL) << "Suspend session triggered with" << args;
- // Switch for screen fading
- switch ((Mode) (args["Type"].toUInt())) {
- case ToRamMode:
- case ToDiskMode:
- case SuspendHybridMode:
- if (!args["SkipFade"].toBool()) {
- m_savedArgs = args;
- m_fadeEffect->start();
- return;
- }
- break;
- default:
- break;
+ const auto mode = static_cast<Mode>(args["Type"].toUInt());
+
+ if (mode == ToRamMode || mode == ToDiskMode || mode == SuspendHybridMode) {
+ // don't suspend if shutting down
+ if (KWorkSpace::isShuttingDown()) {
+ qCDebug(POWERDEVIL) << "Not suspending because a shutdown is in progress";
+ return;
+ }
+
+ if (!args["SkipFade"].toBool()) {
+ m_savedArgs = args;
+ m_fadeEffect->start();
+ return;
+ }
+ }
+
+ if (args["GraceFade"].toBool()) {
+ return;
}
// Switch for real action
@@ -140,8 +152,10 @@
break;
case LockScreenMode: {
// TODO should probably go through the backend (logind perhaps) eventually
- OrgFreedesktopScreenSaverInterface iface("org.freedesktop.ScreenSaver", "/ScreenSaver", QDBusConnection::sessionBus());
- iface.Lock();
+ QDBusConnection::sessionBus().asyncCall(QDBusMessage::createMethodCall("org.freedesktop.ScreenSaver",
+ "/ScreenSaver",
+ "org.freedesktop.ScreenSaver",
+ "Lock"));
break;
}
default:
@@ -158,7 +172,11 @@
{
if (config.isValid() && config.hasKey("idleTime") && config.hasKey("suspendType")) {
// Add the idle timeout
- registerIdleTimeout(config.readEntry<int>("idleTime", 0));
+ m_idleTime = config.readEntry<int>("idleTime", 0);
+ if (m_idleTime) {
+ registerIdleTimeout(m_idleTime - 5000);
+ registerIdleTimeout(m_idleTime);
+ }
m_autoType = config.readEntry<uint>("suspendType", 0);
}
@@ -182,13 +200,11 @@
void SuspendSession::triggerSuspendSession(uint action)
{
- QVariantMap args;
- args["Type"] = action;
- args["Explicit"] = true;
- trigger(args);
+ trigger({
+ {QStringLiteral("Type"), action},
+ {QStringLiteral("Explicit"), true}
+ });
}
}
}
-
-#include "suspendsession.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/bundled/suspendsession.h
^
|
@@ -76,6 +76,7 @@
void triggerSuspendSession(uint action);
private:
+ int m_idleTime = 0;
uint m_autoType;
QVariantMap m_savedArgs;
QScopedPointer<PowerDevil::KWinKScreenHelperEffect> m_fadeEffect;
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/dpms/CMakeLists.txt
^
|
@@ -1,14 +1,14 @@
include_directories(${PowerDevil_SOURCE_DIR}/daemon
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${X11_dpms_INCLUDE_PATH})
+ ${CMAKE_CURRENT_BINARY_DIR})
set(powerdevildpmsaction_SRCS ${PowerDevil_SOURCE_DIR}/daemon/powerdevil_debug.cpp powerdevildpmsaction.cpp ${PowerDevil_SOURCE_DIR}/daemon/kwinkscreenhelpereffect.cpp)
add_library(powerdevildpmsaction MODULE ${powerdevildpmsaction_SRCS})
target_link_libraries(powerdevildpmsaction
- ${X11_LIBRARIES}
Qt5::X11Extras
+ XCB::XCB
+ XCB::DPMS
KF5::CoreAddons
KF5::ConfigGui
Qt5::Widgets
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/dpms/powerdevildpmsaction.cpp
^
|
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2010 by Dario Freddi <drf@kde.org> *
+ * Copyright (C) 2015 by Kai Uwe Broulik <kde@privat.broulik.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -35,59 +36,22 @@
#include <KPluginFactory>
#include <KSharedConfig>
-#include <X11/Xmd.h>
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <X11/Xos.h>
-extern "C" {
-#include <X11/extensions/dpms.h>
- int __kde_do_not_unload = 1;
-
-#ifndef HAVE_DPMSCAPABLE_PROTO
- Bool DPMSCapable(Display *);
-#endif
-
-#ifndef HAVE_DPMSINFO_PROTO
- Status DPMSInfo(Display *, CARD16 *, BOOL *);
-#endif
-
-int dropError(Display *, XErrorEvent *);
-typedef int (*XErrFunc)(Display *, XErrorEvent *);
-}
-
-int dropError(Display *, XErrorEvent *)
-{
- return 0;
-}
-
-class PowerDevilDPMSAction::Private
-{
-public:
- XErrorHandler defaultHandler;
-};
+#include <xcb/dpms.h>
K_PLUGIN_FACTORY(PowerDevilDPMSActionFactory, registerPlugin<PowerDevilDPMSAction>(); )
PowerDevilDPMSAction::PowerDevilDPMSAction(QObject* parent, const QVariantList &args)
: Action(parent)
- , m_idleTime(0)
- , m_inhibitScreen(0) // can't use PowerDevil::PolicyAgent enum because X11/X.h defines None as 0L
- , m_oldKeyboardBrightnessValue(0)
, m_fadeEffect(new PowerDevil::KWinKScreenHelperEffect())
- , d(new Private)
{
-
setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings);
- // We want to query for DPMS in the constructor, before anything else happens
- d->defaultHandler = XSetErrorHandler(dropError);
+ ScopedCPointer<xcb_dpms_capable_reply_t> capableReply(xcb_dpms_capable_reply(QX11Info::connection(),
+ xcb_dpms_capable(QX11Info::connection()),
+ nullptr));
- // Since we are in the constructor, we should check for support manually
- if (!isSupported()) {
- XSetErrorHandler(d->defaultHandler);
- return;
+ if (capableReply && capableReply->capable) {
+ m_supported = true;
}
// Is the action being loaded outside the core?
@@ -102,63 +66,53 @@
onProfileUnload();
// Listen to the policy agent
- connect(PowerDevil::PolicyAgent::instance(),
- SIGNAL(unavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies)),
- this,
- SLOT(onUnavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies)));
+ connect(PowerDevil::PolicyAgent::instance(), &PowerDevil::PolicyAgent::unavailablePoliciesChanged,
+ this, &PowerDevilDPMSAction::onUnavailablePoliciesChanged);
+
// inhibitions persist over kded module unload/load
m_inhibitScreen = PowerDevil::PolicyAgent::instance()->unavailablePolicies() & PowerDevil::PolicyAgent::ChangeScreenSettings;
}
-PowerDevilDPMSAction::~PowerDevilDPMSAction()
-{
- delete d;
-}
-
bool PowerDevilDPMSAction::isSupported()
{
- Display *dpy = QX11Info::display();
- int dummy;
-
- return DPMSQueryExtension(dpy, &dummy, &dummy) && DPMSCapable(dpy);
+ return m_supported;
}
void PowerDevilDPMSAction::onProfileUnload()
{
using namespace PowerDevil;
- Display *dpy = QX11Info::display();
+
if (!(PolicyAgent::instance()->unavailablePolicies() & PolicyAgent::ChangeScreenSettings)) {
- DPMSDisable(dpy);
+ xcb_dpms_disable(QX11Info::connection());
} else {
qCDebug(POWERDEVIL) << "Not performing DPMS action due to inhibition";
}
- DPMSSetTimeouts(dpy, 0, 0, 0);
+
+ xcb_dpms_set_timeouts(QX11Info::connection(), 0, 0, 0);
}
void PowerDevilDPMSAction::onWakeupFromIdle()
{
m_fadeEffect->stop();
- if (m_oldKeyboardBrightnessValue > 0) {
- setKeyboardBrightnessHelper(m_oldKeyboardBrightnessValue);
- m_oldKeyboardBrightnessValue = 0;
+ if (m_oldKeyboardBrightness > 0) {
+ setKeyboardBrightnessHelper(m_oldKeyboardBrightness);
+ m_oldKeyboardBrightness = 0;
}
}
void PowerDevilDPMSAction::onIdleTimeout(int msec)
{
- Q_UNUSED(msec);
-
- //Do not inhibit anything even if idleTimeout reaches because we are inhibit
+ // Do not inhibit anything even if idleTimeout reaches because we are inhibit
if (m_inhibitScreen) {
return;
}
- if (msec == m_idleTime * 1000 - 3000) { // fade out screen
+ if (msec == m_idleTime * 1000 - 5000) { // fade out screen
m_fadeEffect->start();
} else if (msec == m_idleTime * 1000) {
- const int brightness = backend()->brightnessValue(PowerDevil::BackendInterface::Keyboard);
+ const int brightness = backend()->brightness(PowerDevil::BackendInterface::Keyboard);
if (brightness > 0) {
- m_oldKeyboardBrightnessValue = brightness;
+ m_oldKeyboardBrightness = brightness;
setKeyboardBrightnessHelper(0);
}
}
@@ -166,69 +120,64 @@
void PowerDevilDPMSAction::setKeyboardBrightnessHelper(int brightness)
{
- trigger(QVariantMap{ {"KeyboardBrightness", QVariant::fromValue(brightness)} });
+ trigger({
+ {"KeyboardBrightness", QVariant::fromValue(brightness)}
+ });
}
void PowerDevilDPMSAction::onProfileLoad()
{
using namespace PowerDevil;
- Display *dpy = QX11Info::display();
+
if (!(PolicyAgent::instance()->unavailablePolicies() & PolicyAgent::ChangeScreenSettings)) {
- DPMSEnable(dpy);
+ xcb_dpms_enable(QX11Info::connection());
} else {
qCDebug(POWERDEVIL) << "Not performing DPMS action due to inhibition";
return;
}
- XFlush(dpy);
- XSetErrorHandler(d->defaultHandler);
-
// An unloaded action will have m_idleTime = 0:
// DPMS enabled with zeroed timeouts is effectively disabled.
// So onProfileLoad is always safe
- DPMSSetTimeouts(dpy, (CARD16)m_idleTime, (CARD16)(m_idleTime * 1.5), (CARD16)(m_idleTime * 2));
-
- XFlush(dpy);
- XSetErrorHandler(d->defaultHandler);
+ xcb_dpms_set_timeouts(QX11Info::connection(), m_idleTime, m_idleTime * 1.5, m_idleTime * 2);
}
void PowerDevilDPMSAction::triggerImpl(const QVariantMap& args)
{
if (args.contains("KeyboardBrightness")) {
- backend()->setBrightnessValue(args["KeyboardBrightness"].toInt(), PowerDevil::BackendInterface::Keyboard);
+ backend()->setBrightness(args.value(QStringLiteral("KeyboardBrightness")).toInt(), PowerDevil::BackendInterface::Keyboard);
return;
}
- CARD16 dummy;
- BOOL enabled;
- Display *dpy = QX11Info::display();
- DPMSInfo(dpy, &dummy, &enabled);
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/dpms/powerdevildpmsaction.desktop
^
|
@@ -5,6 +5,7 @@
Icon=preferences-desktop-screensaver
Name=Screen Energy Saving
Name[ar]=حِفظ طاقة الشاشة
+Name[bs]=Štednja energije ekrana
Name[ca]=Estalvi d'energia de pantalla
Name[cs]=Úsporný režim obrazovky
Name[da]=Strømbesparelse for skærm
@@ -43,6 +44,7 @@
Name[zh_CN]=屏幕节能
Name[zh_TW]=螢幕節能
Comment=Controls DPMS settings
+Comment[bs]=Upravlja DPMS postavkama
Comment[ca]=Controla l'arranjament del DPMS
Comment[cs]=Ovládání nastavení DPMS
Comment[da]=Styrer DPMS-indstillinger
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/dpms/powerdevildpmsaction.h
^
|
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2010 by Dario Freddi <drf@kde.org> *
+ * Copyright (C) 2015 by Kai Uwe Broulik <kde@privat.broulik.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -25,6 +26,8 @@
#include <QScopedPointer>
+template <typename T> using ScopedCPointer = QScopedPointer<T, QScopedPointerPodDeleter>;
+
namespace PowerDevil {
class KWinKScreenHelperEffect;
}
@@ -35,8 +38,8 @@
Q_DISABLE_COPY(PowerDevilDPMSAction)
public:
- explicit PowerDevilDPMSAction(QObject* parent, const QVariantList&);
- virtual ~PowerDevilDPMSAction();
+ explicit PowerDevilDPMSAction(QObject *parent, const QVariantList &);
+ virtual ~PowerDevilDPMSAction() = default;
protected:
virtual void onProfileUnload();
@@ -44,11 +47,11 @@
virtual void onWakeupFromIdle();
virtual void onIdleTimeout(int msec);
virtual void onProfileLoad();
- virtual void triggerImpl(const QVariantMap& args);
+ virtual void triggerImpl(const QVariantMap &args);
bool isSupported();
public:
- virtual bool loadAction(const KConfigGroup& config);
+ virtual bool loadAction(const KConfigGroup &config);
private Q_SLOTS:
void onUnavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies policies);
@@ -56,14 +59,14 @@
private:
void setKeyboardBrightnessHelper(int brightness);
- int m_idleTime;
- PowerDevil::PolicyAgent::RequiredPolicies m_inhibitScreen;
+ bool m_supported = false;
+
+ int m_idleTime = 0;
+ PowerDevil::PolicyAgent::RequiredPolicies m_inhibitScreen = PowerDevil::PolicyAgent::None;
- int m_oldKeyboardBrightnessValue;
+ int m_oldKeyboardBrightness = 0;
QScopedPointer<PowerDevil::KWinKScreenHelperEffect> m_fadeEffect;
- class Private;
- Private * const d;
};
#endif // POWERDEVILDPMSACTION_H
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/actions/powerdevilaction.desktop
^
|
@@ -4,6 +4,7 @@
Comment=Power Management Action Extension
Comment[ar]=امتداد أحداث إدارة الطاقة
+Comment[bs]=Proširenje radnji za upravljanje napajanjem
Comment[ca]=Extensió d'accions de gestió d'energia
Comment[cs]=Rozšiřující akce správy napájení
Comment[da]=Udvidelse af strømstyringshandling
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/hal/halsuspendjob.cpp
^
|
@@ -19,9 +19,10 @@
#include "halsuspendjob.h"
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
+#include <QDBusMessage>
+#include <QDBusReply>
#include <QTimer>
+
#include <KConfig>
#include <KConfigGroup>
@@ -132,5 +133,3 @@
emitResult();
}
-
-#include "halsuspendjob.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/hal/halsuspendjob.h
^
|
@@ -20,9 +20,10 @@
#ifndef HALSUSPENDJOB_H
#define HALSUSPENDJOB_H
-#include <kjob.h>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
+#include <QDBusInterface>
+#include <QDBusMessage>
+
+#include <KJob>
#include "powerdevilhalbackend.h"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/hal/powerdevilhalbackend.cpp
^
|
@@ -20,18 +20,19 @@
#include "powerdevilhalbackend.h"
+#include "halsuspendjob.h"
#include <powerdevil_debug.h>
-#include <Solid/DeviceNotifier>
-#include <QtDBus/QDBusReply>
-#include <QtDBus/QDBusConnectionInterface>
+
+#include <QTimer>
+#include <QDBusReply>
+#include <QDBusConnectionInterface>
#include <QDebug>
-#include "halsuspendjob.h"
-#include <Solid/Device>
+
#include <Solid/Battery>
#include <Solid/GenericInterface>
+
#include <KPluginFactory>
#include <KSharedConfig>
-#include <QtCore/QTimer>
PowerDevilHALBackend::PowerDevilHALBackend(QObject* parent)
: BackendInterface(parent),
@@ -105,7 +106,7 @@
QList<QString> screenControls = controls.keys(Screen);
if (!screenControls.isEmpty()) {
- m_cachedScreenBrightness = brightnessValue(Screen);
+ m_cachedScreenBrightness = brightness(Screen);
QDBusInterface deviceInterface("org.freedesktop.Hal",
screenControls.at(0),
@@ -173,20 +174,20 @@
setBackendIsReady(controls, supported);
}
-void PowerDevilHALBackend::brightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType)
+int PowerDevilHALBackend::brightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType)
{
BrightnessControlsList allControls = brightnessControlsAvailable();
QList<QString> controls = allControls.keys(controlType);
if (controls.isEmpty()) {
- return; // ignore as we are not able to determine the brightness level
+ return -1; // ignore as we are not able to determine the brightness level
}
if (type == PowerDevil::BrightnessLogic::Toggle && controlType == Screen) {
- return; // ignore as we wont toggle the display off
+ return -1; // ignore as we wont toggle the display off
}
- int currentBrightness = brightnessValue(controlType);
+ int currentBrightness = brightness(controlType);
int cachedBrightness;
@@ -197,16 +198,15 @@
}
if ((currentBrightness == cachedBrightness) && (!m_screenBrightnessInHardware || controlType == Screen)) {
- int maxBrightness = brightnessValueMax(controlType),
+ int maxBrightness = brightnessMax(controlType),
newBrightness = calculateNextStep(currentBrightness, maxBrightness, controlType, type);
if (newBrightness >= 0) {
- if (setBrightnessValue(newBrightness, controlType)) {
- newBrightness = brightnessValue(controlType);
- if (newBrightness != cachedBrightness) {
- cachedBrightness = newBrightness;
- onBrightnessChanged(controlType, newBrightness, maxBrightness);
- }
+ setBrightness(newBrightness, controlType);
+ newBrightness = brightness(controlType);
+ if (newBrightness != cachedBrightness) {
+ cachedBrightness = newBrightness;
+ onBrightnessChanged(controlType, newBrightness, maxBrightness);
}
}
} else {
@@ -218,9 +218,11 @@
} else {
m_cachedKeyboardBrightness = cachedBrightness;
}
+
+ return cachedBrightness;
}
-int PowerDevilHALBackend::brightnessValue(PowerDevil::BackendInterface::BrightnessControlType type) const
+int PowerDevilHALBackend::brightness(PowerDevil::BackendInterface::BrightnessControlType type) const
{
if (type == Screen) {
QDBusPendingReply<QStringList> reply = m_halManager.asyncCall("FindDeviceByCapability", "laptop_panel");
@@ -254,7 +256,7 @@
return 0;
}
-int PowerDevilHALBackend::brightnessValueMax(PowerDevil::BackendInterface::BrightnessControlType type) const
+int PowerDevilHALBackend::brightnessMax(PowerDevil::BackendInterface::BrightnessControlType type) const
{
if (type == Screen) {
QDBusPendingReply<QStringList> reply = m_halManager.asyncCall("FindDeviceByCapability", "laptop_panel");
@@ -287,7 +289,7 @@
return 0;
}
-bool PowerDevilHALBackend::setBrightnessValue(int brightnessValue, PowerDevil::BackendInterface::BrightnessControlType type)
+void PowerDevilHALBackend::setBrightness(int value, PowerDevil::BackendInterface::BrightnessControlType type)
{
if (type == Screen) {
QDBusPendingReply<QStringList> reply = m_halManager.asyncCall("FindDeviceByCapability", "laptop_panel");
@@ -296,9 +298,9 @@
foreach (const QString &device, reply.value()) {
QDBusInterface deviceInterface("org.freedesktop.Hal", device,
"org.freedesktop.Hal.Device.LaptopPanel", QDBusConnection::systemBus());
- deviceInterface.call("SetBrightness", brightnessValue);
+ deviceInterface.call("SetBrightness", value);
if (!deviceInterface.lastError().isValid()) {
- return true;
+ return;
}
}
}
@@ -311,14 +313,14 @@
QDBusInterface deviceInterface("org.freedesktop.Hal", device,
"org.freedesktop.Hal.Device.KeyboardBacklight", QDBusConnection::systemBus());
- deviceInterface.call("SetBrightness", brightnessValue);
+ deviceInterface.call("SetBrightness", value);
if(!deviceInterface.lastError().isValid()) {
- return true;
+ return;
}
}
}
}
- return false;
+ return;
}
KJob* PowerDevilHALBackend::suspend(PowerDevil::BackendInterface::SuspendMethod method)
@@ -519,5 +521,3 @@
m_criticalBatteryCharge = m_lowBatteryCharge/2;
}
-
-#include "powerdevilhalbackend.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/hal/powerdevilhalbackend.desktop
^
|
@@ -5,6 +5,7 @@
InitialPreference=100
Icon=preferences-system-power-management
Name=HAL PowerDevil Backend
+Name[bs]=HAL kao pozadina Powerdevila
Name[ca]=Dorsal de HAL per al PowerDevil
Name[cs]=Podpůrná vrstva HAL PowerDevil
Name[da]=HAL-motor til PowerDevil
@@ -45,6 +46,7 @@
Name[zh_TW]=HAL PowerDevil 後端介面
Comment=Use KDE Power Management system through freedesktop.org HAL daemon
Comment[ar]=استخدِم نظام إدارة طاقة كدي باستخدام مراقب HAL من freedesktop.org
+Comment[bs]=KDE‑ov sistem za upravljanje napajanjem preko freedesktop.org demona HAL‑a
Comment[ca]=Usa el sistema de gestió d'energia del KDE mitjançant el dimoni HAL del freedesktop.org
Comment[cs]=Využít démon freedesktop.org HAL pro systém správy napájení KDE
Comment[da]=Brug KDE strømstyring via HAL-dæmonen fra freedesktop.org
@@ -54,7 +56,7 @@
Comment[es]=Usar el sistema de ahorro de energía de KDE a través del demonio HAL de freedesktop.org
Comment[fi]=KDE:n virranhallintajärjestelmän käyttö freedesktop.org HAL-taustaprosessilla
Comment[fr]=Utiliser le système de gestion de l'énergie du matériel via le démon HAL de « freedesktop.org »
-Comment[gl]=Usa o sistema de xestión enerxética de KDE mediante o servizo HAL de freedesktop.org.
+Comment[gl]=Usa o sistema de xestión enerxética de KDE mediante o daemon HAL de freedesktop.org
Comment[hu]=A KDE energiakezelő rendszerének használata a freedesktop.org HAL-démonán keresztül
Comment[ia]=Usa systema de gestion de energia de KDE usante demone HAL de freedesktop.org
Comment[id]=Gunakan sistem Manajemen Daya KDE melalui freedesktop.org HAL daemon
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/hal/powerdevilhalbackend.h
^
|
@@ -23,11 +23,11 @@
#include <powerdevilbackendinterface.h>
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusInterface>
+#include <QDBusConnection>
+#include <QDBusInterface>
-#include <solid/devicenotifier.h>
-#include <solid/device.h>
+#include <Solid/Device>
+#include <Solid/DeviceNotifier>
namespace Solid {
class Device;
@@ -45,11 +45,11 @@
virtual void init();
static bool isAvailable();
- virtual int brightnessValue(BrightnessControlType type = Screen) const;
- virtual int brightnessValueMax(BrightnessControlType type = Screen) const;
+ virtual int brightness(BrightnessControlType type = Screen) const;
+ virtual int brightnessMax(BrightnessControlType type = Screen) const;
- virtual void brightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType = Screen);
- virtual bool setBrightnessValue(int brightnessValue, PowerDevil::BackendInterface::BrightnessControlType type = Screen);
+ virtual int brightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType = Screen);
+ virtual void setBrightness(int value, PowerDevil::BackendInterface::BrightnessControlType type = Screen);
virtual KJob* suspend(PowerDevil::BackendInterface::SuspendMethod method);
private:
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/backlight_helper_actions.actions
^
|
@@ -1,6 +1,7 @@
[Domain]
Name=KDE
Name[ar]=كدي
+Name[bs]=KDE
Name[ca]=KDE
Name[cs]=KDE
Name[da]=KDE
@@ -41,22 +42,31 @@
Name[zh_TW]=KDE
Icon=kde
-[org.kde.powerdevil.backlighthelper.brightnessvaluemax]
+[org.kde.powerdevil.backlighthelper.brightnessmax]
Name=Get maximum brightness value
+Name[bs]=Dobij maksimalnu vrijednost osvjetljenja
Name[ca]=Obtén el valor màxim de la lluminositat
Name[cs]=Získat maximální hodnotu jasu
+Name[da]=Hent maksimal værdi for lysstyrke
Name[de]=Maximale Bildschirmhelligkeit abrufen
Name[el]=Ανάκτηση της μέγιστης τιμής φωτεινότητας
Name[en_GB]=Get maximum brightness value
Name[es]=Obtener el valor del brillo máximo
Name[fi]=Lue kirkkauden enimmäisarvo
+Name[fr]=Obtenir la luminosité maximale
+Name[gl]=Obter o valor de brillo máximo
Name[hu]=Maximális fényerősség lekérdezése
+Name[id]=Dapatkan nilai kecerahan maksimum
+Name[it]=Ottieni il valore massimo di luminosità
+Name[ko]=최대 밝기 가져오기
Name[lt]=Gauti maksimalią šviesumo vertė
Name[nb]=Hent største verdi for lysstyrke
+Name[nds]=Hööchst Helligkeitweert afropen
Name[nl]=Waarde van maximale helderheid ophalen
Name[pl]=Pobierz największą wartość jasności
Name[pt]=Obter o valor máximo do brilho
Name[pt_BR]=Obter o valor máximo do brilho
+Name[ru]=Определение максимального значения яркости
Name[sk]=Získať maximálnu hodnotu jasnosti
Name[sl]=Dobi največjo vrednost svetlosti
Name[sr]=Добави највећу вредност осветљаја
@@ -64,11 +74,14 @@
Name[sr@ijekavianlatin]=Dobavi najveću vrednost osvjetljaja
Name[sr@latin]=Dobavi najveću vrednost osvetljaja
Name[sv]=Hämta maximalt värde på ljusstyrka
+Name[tr]=En yüksek parlaklık değerini al
Name[uk]=Отримання максимального значення яскравості
Name[x-test]=xxGet maximum brightness valuexx
Name[zh_CN]=获取最大亮度
+Name[zh_TW]=取得最大亮度值
Description=System policies prevent you from getting the brightness level.
Description[ar]=تمنعك سياسات النظام من الحصول على معلومات مستوى السطوع.
+Description[bs]=Sistemska pravila vas sprečavju od dobijanja nivoa osvjetljenja.
Description[ca]=Les polítiques del sistema impedeixen que conegueu el nivell de brillantor de la pantalla.
Description[cs]=Nastavení systému vám znemožňuje získat úroveň podsvícení.
Description[da]=Systempolitikker forhindrer dig i at hente lysstyrkeniveauet.
@@ -78,7 +91,7 @@
Description[es]=Las políticas del sistema le impiden obtener el nivel de brillo.
Description[fi]=Järjestelmäkäytäntö estää sinua lukemasta kirkkauden tasoa.
Description[fr]=La stratégie système vous empêche d'obtenir le niveau de luminosité.
-Description[gl]=As normas do sistema non lle permiten coñecer o nivel de brillo.
+Description[gl]=As políticas do sistema evitan que coñeza o nivel de brillo.
Description[hu]=A rendszer házirendjei nem engedik meg Önnek a fényesség lekérdezését.
Description[ia]=Le politicas de systema preveni te ex obtener le nivello de brillantia.
Description[id]=Kebijakan sistem mencegah Anda dari mendapatkan tingkat kecerahan.
@@ -109,9 +122,10 @@
Policy=yes
PolicyInactive=yes
-[org.kde.powerdevil.backlighthelper.brightnessvalue]
+[org.kde.powerdevil.backlighthelper.brightness]
Name=Get brightness
Name[ar]=احصل على معلومات السطوع
+Name[bs]=Dobavi osvetljenje
Name[ca]=Obtén la lluminositat
Name[cs]=Získat jas
Name[da]=Hent lysstyrke
@@ -136,7 +150,7 @@
Name[pt]=Obter o brilho
Name[pt_BR]=Obter brilho
Name[ro]=Obține luminozitatea
-Name[ru]=Настройка яркости
+Name[ru]=Определение значения яркости
Name[sk]=Získať jas
Name[sl]=Dobi svetlost
Name[sr]=Добави осветљај
@@ -151,6 +165,7 @@
Name[zh_TW]=取得亮度
Description=System policies prevent you from getting the brightness level.
Description[ar]=تمنعك سياسات النظام من الحصول على معلومات مستوى السطوع.
+Description[bs]=Sistemska pravila vas sprečavju od dobijanja nivoa osvjetljenja.
Description[ca]=Les polítiques del sistema impedeixen que conegueu el nivell de brillantor de la pantalla.
Description[cs]=Nastavení systému vám znemožňuje získat úroveň podsvícení.
Description[da]=Systempolitikker forhindrer dig i at hente lysstyrkeniveauet.
@@ -160,7 +175,7 @@
Description[es]=Las políticas del sistema le impiden obtener el nivel de brillo.
Description[fi]=Järjestelmäkäytäntö estää sinua lukemasta kirkkauden tasoa.
Description[fr]=La stratégie système vous empêche d'obtenir le niveau de luminosité.
-Description[gl]=As normas do sistema non lle permiten coñecer o nivel de brillo.
+Description[gl]=As políticas do sistema evitan que coñeza o nivel de brillo.
Description[hu]=A rendszer házirendjei nem engedik meg Önnek a fényesség lekérdezését.
Description[ia]=Le politicas de systema preveni te ex obtener le nivello de brillantia.
Description[id]=Kebijakan sistem mencegah Anda dari mendapatkan tingkat kecerahan.
@@ -191,9 +206,10 @@
Policy=yes
PolicyInactive=yes
-[org.kde.powerdevil.backlighthelper.setbrightnessvalue]
+[org.kde.powerdevil.backlighthelper.setbrightness]
Name=Set brightness
Name[ar]=اضبط السطوع
+Name[bs]=Postavi osvetljenje
Name[ca]=Ajusta la lluminositat
Name[cs]=Nastavit jas
Name[da]=Sæt lysstyrke
@@ -219,7 +235,7 @@
Name[pt]=Mudar o brilho
Name[pt_BR]=Definir o brilho
Name[ro]=Stabilește luminozitatea
-Name[ru]=Настройка яркости
+Name[ru]=Установка значения яркости
Name[sk]=Nastaviť jas
Name[sl]=Nastavi svetlost
Name[sr]=Постави осветљај
@@ -234,6 +250,7 @@
Name[zh_TW]=設定亮度
Description=System policies prevent you from setting the brightness level.
Description[ar]=تمنعك سياسات النظام من ضبط مستويات السطوع.
+Description[bs]=Sistemska pravila vas sprečavaju u postavljanju nivoa osvjetljenja.
Description[ca]=Les polítiques del sistema impedeixen que ajusteu la lluminositat de la pantalla.
Description[cs]=Systémové omezení vám neumožňuje nastavit úroveň podsvícení.
Description[da]=Systempolitikker forhindrer dig i at sætte lysstyrkeniveauet.
@@ -243,7 +260,7 @@
Description[es]=Las políticas del sistema le impiden fijar el nivel de brillo.
Description[fi]=Järjestelmäkäytäntö estää sinua asettamasta kirkkauden tasoa.
Description[fr]=La stratégie système vous empêche de fixer le niveau de luminosité.
-Description[gl]=As normas do sistema non lle permiten modificar o nivel de brillo.
+Description[gl]=As políticas do sistema evitan que modifique o nivel de brillo.
Description[hu]=A rendszer házirendjei nem engedik meg Önnek a fényesség beállítását.
Description[ia]=Le politicas de systema preveni te ex fixar le nivello de brillantia.
Description[id]=Kebijakan sistem mencegah Anda dari mengatur tingkat kecerahan.
@@ -277,6 +294,7 @@
[org.kde.powerdevil.backlighthelper.syspath]
Name=Get syspath
Name[ar]=احصل على مسار النظام
+Name[bs]=Dobavi sistemsku stazu
Name[ca]=Obtén el «syspath»
Name[cs]=Získat syspath
Name[da]=Hent syspath
@@ -286,7 +304,7 @@
Name[es]=Obtener ruta del sistema
Name[fi]=Lue järjestelmäpolku
Name[fr]=Obtenir « syspath »
-Name[gl]=Obter a ruta do sistema
+Name[gl]=Obter syspath
Name[hu]=Rendszerútvonal lekérése
Name[ia]=Obtene syspath
Name[id]=Dapatkan syspath
@@ -316,6 +334,7 @@
Name[zh_TW]=取得系統路徑
Description=System policies prevent you from getting the syspath
Description[ar]=تمنعك سياسات النظام من الحصول على مسار النظام
+Description[bs]=Sistemske smjernice sprečavaju dobavljanje sistemske staze.
Description[ca]=Les polítiques del sistema impedeixen que conegueu el camí del sistema «syspath»
Description[cs]=Nastavení systému vám znemožňuje získat syspath
Description[da]=Systempolitikker forhindrer dig i at hente syspath
@@ -325,7 +344,7 @@
Description[es]=Las políticas del sistema le impiden obtener la ruta del sistema.
Description[fi]=Järjestelmäkäytäntö estää sinua lukemasta järjestelmäpolkua.
Description[fr]=La stratégie système vous empêche d'obtenir « syspath ».
-Description[gl]=As normas do sistema non lle permiten coñecer a ruta do sistema.
+Description[gl]=As políticas do sistema evitan que coñeza syspath
Description[hu]=A rendszer házirendjei nem engedik meg Önnek a rendszerútvonal lekérdezését.
Description[ia]=Le politicas de systema preveni te ex obtener le syspath
Description[id]=Kebijakan sistem mencegah Anda dari mendapatkan syspath.
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/backlighthelper.cpp
^
|
@@ -21,8 +21,9 @@
#include <powerdevil_debug.h>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
+#include <QDir>
+#include <QDebug>
+
#include <KLocalizedString>
#include <sys/utsname.h>
@@ -40,20 +41,14 @@
#define PREFIX "/sys/class/backlight/"
-BacklightHelper::BacklightHelper(QObject * parent)
- : QObject(parent), m_isSupported(false)
+BacklightHelper::BacklightHelper(QObject *parent) : QObject(parent)
{
init();
}
void BacklightHelper::init()
{
-
- if (useWhitelistInit()) {
- initUsingWhitelist();
- } else {
- initUsingBacklightType();
- }
+ initUsingBacklightType();
if (m_dirname.isEmpty()) {
initUsingSysctl();
@@ -119,67 +114,6 @@
}
}
-
-void BacklightHelper::initUsingWhitelist()
-{
- QStringList interfaces;
- interfaces << "nv_backlight" << "radeon_bl" << "mbp_backlight" << "asus_laptop"
- << "toshiba" << "eeepc" << "thinkpad_screen" << "acpi_video1" << "acpi_video0"
- << "intel_backlight" << "apple_backlight" << "fujitsu-laptop" << "samsung"
- << "nvidia_backlight" << "dell_backlight" << "sony" << "pwm-backlight"
- ;
-
- QDir dir;
- foreach (const QString & interface, interfaces) {
- dir.setPath(PREFIX + interface);
- //qCDebug(POWERDEVIL) << "searching dir:" << dir;
- if (dir.exists()) {
- m_dirname = dir.path();
- //qCDebug(POWERDEVIL) << "kernel backlight support found in" << m_dirname;
- break;
- }
- }
-
- //If none of our whitelisted interface is available, get the first one (if any)
- if (m_dirname.isEmpty()) {
- dir.setPath(PREFIX);
- dir.setFilter(QDir::AllDirs | QDir::NoDot | QDir::NoDotDot | QDir::NoDotAndDotDot | QDir::Readable);
- QStringList dirList = dir.entryList();
- if (!dirList.isEmpty()) {
- m_dirname = dirList.first();
- }
- }
-}
-
-bool BacklightHelper::useWhitelistInit()
-{
- struct utsname uts;
- uname(&uts);
-
- int major, minor, patch, result;
- result = sscanf(uts.release, "%d.%d", &major, &minor);
-
- if (result != 2) {
- return true; // Malformed version
- }
-
- if (major == 3) {
- return false; //Kernel 3, we want type based init
- }
-
- result = sscanf(uts.release, "%d.%d.%d", &major, &minor, &patch);
-
- if (result != 3) {
- return true; // Malformed version
- }
-
- if (patch < 37) {
- return true; //Minor than 2.6.37, use whiteList based
- }
-
- return false;//Use Type based interafce
-}
-
void BacklightHelper::initUsingSysctl()
{
#ifdef USE_SYSCTL
@@ -234,7 +168,7 @@
#endif
}
-ActionReply BacklightHelper::brightnessvalue(const QVariantMap & args)
+ActionReply BacklightHelper::brightness(const QVariantMap &args)
{
Q_UNUSED(args);
@@ -269,17 +203,17 @@
#endif
//qCDebug(POWERDEVIL) << "brightness:" << brightness;
- reply.addData("brightnessvalue", brightness);
- //qCDebug(POWERDEVIL) << "data contains:" << reply.data()["brightnessvalue"];
+ reply.addData("brightness", brightness);
+ //qCDebug(POWERDEVIL) << "data contains:" << reply.data()["brightness"];
return reply;
}
-ActionReply BacklightHelper::setbrightnessvalue(const QVariantMap & args)
+ActionReply BacklightHelper::setbrightness(const QVariantMap &args)
{
ActionReply reply;
- int actual_brightness = args["brightnessvalue"].toInt();
+ int actual_brightness = args.value(QStringLiteral("brightness")).toInt();
if (!m_isSupported) {
reply = ActionReply::HelperErrorReply();
@@ -333,7 +267,7 @@
return reply;
}
-ActionReply BacklightHelper::syspath(const QVariantMap& args)
+ActionReply BacklightHelper::syspath(const QVariantMap &args)
{
Q_UNUSED(args);
@@ -349,7 +283,7 @@
return reply;
}
-ActionReply BacklightHelper::brightnessvaluemax(const QVariantMap & args)
+ActionReply BacklightHelper::brightnessmax(const QVariantMap &args)
{
Q_UNUSED(args);
@@ -386,8 +320,8 @@
return reply;
}
- reply.addData("brightnessvaluemax", max_brightness);
- //qCDebug(POWERDEVIL) << "data contains:" << reply.data()["brightnessvaluemax"];
+ reply.addData("brightnessmax", max_brightness);
+ //qCDebug(POWERDEVIL) << "data contains:" << reply.data()["brightnessmax"];
return reply;
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/backlighthelper.h
^
|
@@ -29,22 +29,16 @@
{
Q_OBJECT
public:
- BacklightHelper(QObject * parent = 0);
+ BacklightHelper(QObject *parent = nullptr);
public slots:
- ActionReply brightnessvalue(const QVariantMap & args);
- ActionReply brightnessvaluemax(const QVariantMap & args);
- ActionReply setbrightnessvalue(const QVariantMap & args);
- ActionReply syspath(const QVariantMap & args);
+ ActionReply brightness(const QVariantMap &args);
+ ActionReply brightnessmax(const QVariantMap &args);
+ ActionReply setbrightness(const QVariantMap &args);
+ ActionReply syspath(const QVariantMap &args);
private:
void init();
- /**
- * For older kernels that doesn't indicate which type the interface use we have
- * a whitelsit based on the feedback given by our users, if the interface is not
- * within our whitelist we will look for a random one within the backlight folder
- */
- void initUsingWhitelist();
/**
* The kernel offer from version 2.6.37 the type of the interface, and based on that
@@ -58,12 +52,7 @@
*/
void initUsingSysctl();
- /**
- * If Kernel older than 2.6.37 use whitelsit, otherwise use backlight/type
- * @see https://bugs.kde.org/show_bug.cgi?id=288180
- */
- bool useWhitelistInit();
- bool m_isSupported;
+ bool m_isSupported = false;
QString m_dirname;
QString m_sysctlDevice;
QList<int> m_sysctlBrightnessLevels;
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/login1suspendjob.cpp
^
|
@@ -23,10 +23,11 @@
#include <powerdevil_debug.h>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
+#include <QDBusReply>
+#include <QDBusMessage>
#include <QTimer>
#include <QDebug>
+
#include <KLocalizedString>
Login1SuspendJob::Login1SuspendJob(QDBusInterface *login1Interface,
@@ -53,8 +54,7 @@
void Login1SuspendJob::doStart()
{
- if (m_supported & m_method)
- {
+ if (m_supported & m_method) {
QVariantList args;
args << true; // interactive, ie. with polkit dialogs
@@ -62,8 +62,7 @@
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(sendResult(QDBusPendingCallWatcher*)));
- switch(m_method)
- {
+ switch(m_method) {
case PowerDevil::BackendInterface::ToRam:
reply = m_login1Interface->asyncCallWithArgumentList("Suspend", args);
break;
@@ -85,13 +84,12 @@
void Login1SuspendJob::sendResult(QDBusPendingCallWatcher *watcher)
{
const QDBusPendingReply<void> reply = *watcher;
+ watcher->deleteLater();
if (!reply.isError()) {
emitResult();
} else {
qCWarning(POWERDEVIL) << "Failed to start suspend job" << reply.error().name() << reply.error().message();
}
-
- watcher->deleteLater();
}
void Login1SuspendJob::slotLogin1Resuming(bool active)
@@ -99,6 +97,3 @@
if (!active)
emitResult();
}
-
-
-#include "login1suspendjob.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/login1suspendjob.h
^
|
@@ -22,10 +22,10 @@
#ifndef LOGIN1SUSPENDJOB_H
#define LOGIN1SUSPENDJOB_H
-#include <kjob.h>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusPendingCallWatcher>
+#include <QDBusInterface>
+#include <QDBusPendingCallWatcher>
+
+#include <KJob>
#include "powerdevilbackendinterface.h"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/powerdevilupowerbackend.cpp
^
|
@@ -3,6 +3,7 @@
Copyright (C) 2008-2010 Dario Freddi <drf@kde.org>
Copyright (C) 2010 Alejandro Fiestas <alex@eyeos.org>
Copyright (C) 2010-2013 Lukáš Tinkl <ltinkl@redhat.com>
+ Copyright (C) 2015 Kai Uwe Broulik <kde@privat.broulik.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -23,10 +24,12 @@
#include "powerdevilupowerbackend.h"
#include <powerdevil_debug.h>
+#include <PowerDevilSettings.h>
#include <qtextstream.h>
#include <QtDBus>
#include <QDebug>
+#include <QPropertyAnimation>
#include <kauthexecutejob.h>
#include <KPluginFactory>
@@ -43,7 +46,8 @@
PowerDevilUPowerBackend::PowerDevilUPowerBackend(QObject* parent)
: BackendInterface(parent),
- m_brightnessControl(0),
+ m_displayDevice(Q_NULLPTR),
+ m_brightnessControl(Q_NULLPTR),
m_kbdMaxBrightness(0),
m_lidIsPresent(false), m_lidIsClosed(false), m_onBattery(false)
{
@@ -132,24 +136,54 @@
m_upowerInterface = new OrgFreedesktopUPowerInterface(UPOWER_SERVICE, "/org/freedesktop/UPower", QDBusConnection::systemBus(), this);
m_brightnessControl = new XRandrBrightness();
if (!m_brightnessControl->isSupported()) {
- qCDebug(POWERDEVIL) << "Using helper";
- KAuth::Action action("org.kde.powerdevil.backlighthelper.syspath");
- action.setHelperId(HELPER_ID);
- KAuth::ExecuteJob* job = action.execute();
- if (job->exec()) {
- m_syspath = job->data()["syspath"].toString();
- m_syspath = QFileInfo(m_syspath).readLink();
-
- UdevQt::Client *client = new UdevQt::Client(QStringList("backlight"), this);
- connect(client, SIGNAL(deviceChanged(UdevQt::Device)), SLOT(onDeviceChanged(UdevQt::Device)));
- screenBrightnessAvailable = true;
+ qCDebug(POWERDEVIL) << "Falling back to helper to get brightness";
+
+ KAuth::Action brightnessAction("org.kde.powerdevil.backlighthelper.brightness");
+ brightnessAction.setHelperId(HELPER_ID);
+ KAuth::ExecuteJob *brightnessJob = brightnessAction.execute();
+ if (!brightnessJob->exec()) {
+ qCWarning(POWERDEVIL) << "org.kde.powerdevil.backlighthelper.brightness failed";
+ } else {
+ m_cachedBrightnessMap.insert(Screen, brightnessJob->data()["brightness"].toFloat());
+
+ KAuth::Action brightnessMaxAction("org.kde.powerdevil.backlighthelper.brightnessmax");
+ brightnessMaxAction.setHelperId(HELPER_ID);
+ KAuth::ExecuteJob *brightnessMaxJob = brightnessMaxAction.execute();
+ if (brightnessMaxJob->exec()) {
+ m_brightnessMax = brightnessMaxJob->data()["brightnessmax"].toInt();
+ } else {
+ qCWarning(POWERDEVIL) << "org.kde.powerdevil.backlighthelper.brightnessmax failed";
+ }
+
+ KAuth::Action syspathAction("org.kde.powerdevil.backlighthelper.syspath");
+ syspathAction.setHelperId(HELPER_ID);
+ KAuth::ExecuteJob* syspathJob = syspathAction.execute();
+ if (syspathJob->exec()) {
+ m_syspath = syspathJob->data()["syspath"].toString();
+ m_syspath = QFileInfo(m_syspath).readLink();
+
+ UdevQt::Client *client = new UdevQt::Client(QStringList("backlight"), this);
+ connect(client, SIGNAL(deviceChanged(UdevQt::Device)), SLOT(onDeviceChanged(UdevQt::Device)));
+
+ screenBrightnessAvailable = true;
+ }
}
} else {
qCDebug(POWERDEVIL) << "Using XRandR";
m_randrHelper = XRandRXCBHelper::self();
Q_ASSERT(m_randrHelper);
- connect(m_randrHelper, SIGNAL(brightnessChanged()), this, SLOT(slotScreenBrightnessChanged()));
+ connect(m_randrHelper, &XRandRXCBHelper::brightnessChanged, this, &PowerDevilUPowerBackend::slotScreenBrightnessChanged);
+ m_cachedBrightnessMap.insert(Screen, brightness(Screen));
screenBrightnessAvailable = true;
+
+ const int duration = PowerDevilSettings::brightnessAnimationDuration();
+ if (duration > 0 && brightnessMax() >= PowerDevilSettings::brightnessAnimationThreshold()) {
+ m_brightnessAnimation = new QPropertyAnimation(this);
+ m_brightnessAnimation->setTargetObject(this);
+ m_brightnessAnimation->setDuration(duration);
+ m_brightnessAnimation->setEasingCurve(QEasingCurve::InOutQuad);
+ connect(m_brightnessAnimation, &QPropertyAnimation::valueChanged, this, &PowerDevilUPowerBackend::animationValueChanged);
+ }
}
// Capabilities
@@ -178,7 +212,6 @@
BrightnessControlsList controls;
if (screenBrightnessAvailable) {
controls.insert(QLatin1String("LVDS1"), Screen);
- m_cachedBrightnessMap.insert(Screen, brightnessValue(Screen));
qCDebug(POWERDEVIL) << "current screen brightness value: " << m_cachedBrightnessMap.value(Screen);
}
@@ -193,7 +226,7 @@
// TODO Do a proper check if the kbd backlight dbus object exists. But that should work for now ..
if (m_kbdMaxBrightness) {
controls.insert(QLatin1String("KBD"), Keyboard);
- m_cachedBrightnessMap.insert(Keyboard, brightnessValue(Keyboard));
+ m_cachedBrightnessMap.insert(Keyboard, brightness(Keyboard));
qCDebug(POWERDEVIL) << "current keyboard backlight brightness value: " << m_cachedBrightnessMap.value(Keyboard);
connect(m_kbdBacklight, SIGNAL(BrightnessChanged(int)), this, SLOT(onKeyboardBrightnessChanged(int)));
}
@@ -236,24 +269,12 @@
}
// battery
- QList<RecallNotice> recallList;
foreach(OrgFreedesktopUPowerDeviceInterface * upowerDevice, m_devices) {
if (upowerDevice->type() == 2 && upowerDevice->powerSupply()) {
QString udi = upowerDevice->path();
setCapacityForBattery(udi, qRound(upowerDevice->capacity())); // acknowledge capacity
-
- if (upowerDevice->recallNotice()) { // check for recall notices
- RecallNotice notice;
- notice.batteryId = udi;
- notice.url = upowerDevice->recallUrl();
- notice.vendor = upowerDevice->recallVendor();
-
- recallList.append(notice);
- }
}
}
- if (!recallList.isEmpty())
- setRecallNotices(recallList);
// backend ready
setBackendIsReady(controls, supported);
@@ -278,51 +299,46 @@
}
}
-void PowerDevilUPowerBackend::brightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType)
+int PowerDevilUPowerBackend::brightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType)
{
BrightnessControlsList allControls = brightnessControlsAvailable();
QList<QString> controls = allControls.keys(controlType);
if (controls.isEmpty()) {
- return; // ignore as we are not able to determine the brightness level
+ return -1; // ignore as we are not able to determine the brightness level
}
- int currentBrightness = brightnessValue(controlType);
- if (currentBrightness != m_cachedBrightnessMap.value(controlType)) {
+ int currentBrightness = brightness(controlType);
+ if (currentBrightness != m_cachedBrightnessMap.value(controlType)) {
m_cachedBrightnessMap[controlType] = currentBrightness;
- return;
+ return currentBrightness;
}
- int maxBrightness = brightnessValueMax(controlType),
- newBrightness = calculateNextStep(currentBrightness, maxBrightness, controlType, type);
+ int maxBrightness = brightnessMax(controlType);
+ int newBrightness = calculateNextStep(currentBrightness, maxBrightness, controlType, type);
if (newBrightness < 0) {
- return;
+ return -1;
}
- setBrightnessValue(newBrightness, controlType);
+ setBrightness(newBrightness, controlType);
+ return newBrightness;
}
-int PowerDevilUPowerBackend::brightnessValue(PowerDevil::BackendInterface::BrightnessControlType type) const
+int PowerDevilUPowerBackend::brightness(PowerDevil::BackendInterface::BrightnessControlType type) const
{
int result = 0;
if (type == Screen) {
if (m_brightnessControl->isSupported()) {
- //qCDebug(POWERDEVIL) << "Calling xrandr brightness";
- result = (int) m_brightnessControl->brightnessValue();
- } else {
- //qCDebug(POWERDEVIL) << "Falling back to helper to get brightness";
- KAuth::Action action("org.kde.powerdevil.backlighthelper.brightnessvalue");
- action.setHelperId(HELPER_ID);
- KAuth::ExecuteJob *job = action.execute();
- if (job->exec()) {
- result = job->data()["brightnessvalue"].toFloat();
- //qCDebug(POWERDEVIL) << "org.kde.powerdevil.backlighthelper.brightnessvalue succeeded: " << reply.data()["brightnessvalue"];
+ if (m_brightnessAnimation && m_brightnessAnimation->state() == QPropertyAnimation::Running) {
+ result = m_brightnessAnimation->endValue().toInt();
+ } else {
+ //qCDebug(POWERDEVIL) << "Calling xrandr brightness";
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/powerdevilupowerbackend.desktop
^
|
@@ -5,6 +5,7 @@
InitialPreference=200
Icon=preferences-system-power-management
Name=UPower PowerDevil Backend
+Name[bs]=UPower PowerDevil pozadina
Name[ca]=Dorsal d'UPower per al PowerDevil
Name[cs]=Podpůrná vrstva UPower PowerDevil
Name[da]=UPower-motor til PowerDevil
@@ -45,6 +46,7 @@
Name[zh_TW]=UPower PowerDevil 後端介面
Comment=Use KDE Power Management system through freedesktop.org upower daemon
Comment[ar]=استخدِم نظام إدارة طاقة كدي باستخدام مراقِب upower من freedesktop.org
+Comment[bs]=KDE‑ov sistem za upravljanje napajanjem preko freedesktop.org demona UPower
Comment[ca]=Usa el sistema de gestió d'energia del KDE mitjançant el dimoni upower del freedesktop.org
Comment[cs]=Využít démon freedesktop.org upower pro systém správy napájení KDE
Comment[da]=Brug KDE strømstyring via upower-dæmonen fra freedesktop.org
@@ -54,7 +56,7 @@
Comment[es]=Usar el sistema de ahorro de energía de KDE a través del demonio upower de freedesktop.org
Comment[fi]=KDE:n virranhallintajärjestelmän käyttö freedesktop.org upower-taustaprosessilla
Comment[fr]=Utiliser la gestion de l'énergie du matériel de KDE via le démon « UPower » de « freedesktop.org »
-Comment[gl]=Usa o sistema de xestión enerxética de KDE mediante o servizo upower de freedesktop.org.
+Comment[gl]=Usa o sistema de xestión enerxética de KDE mediante o daemon upower de freedesktop.org
Comment[hu]=A KDE energiakezelő rendszerének használata a freedesktop.org upower démonán keresztül
Comment[ia]=Usa systema de gestion de energia de KDE usante demone upower de freedesktop.org
Comment[id]=Gunakan sistem Manajemen Daya KDE melalui freedesktop.org upower daemon
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/powerdevilupowerbackend.h
^
|
@@ -2,6 +2,7 @@
Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
Copyright (C) 2008-2010 Dario Freddi <drf@kde.org>
Copyright (C) 2010 Alejandro Fiestas <alex@eyeos.org>
+ Copyright (C) 2015 Kai Uwe Broulik <kde@privat.broulik.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -42,11 +43,13 @@
class UdevHelper;
class XRandRXCBHelper;
class XRandrBrightness;
+class QPropertyAnimation;
class Q_DECL_EXPORT PowerDevilUPowerBackend : public PowerDevil::BackendInterface
{
Q_OBJECT
Q_DISABLE_COPY(PowerDevilUPowerBackend)
+
public:
explicit PowerDevilUPowerBackend(QObject* parent);
virtual ~PowerDevilUPowerBackend();
@@ -54,11 +57,11 @@
virtual void init();
static bool isAvailable();
- virtual int brightnessValue(BrightnessControlType type = Screen) const;
- virtual int brightnessValueMax(BrightnessControlType type = Screen) const;
+ virtual int brightness(BrightnessControlType type = Screen) const;
+ virtual int brightnessMax(BrightnessControlType type = Screen) const;
- virtual void brightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType);
- virtual bool setBrightnessValue(int brightnessValue, PowerDevil::BackendInterface::BrightnessControlType type = Screen);
+ virtual int brightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType);
+ virtual void setBrightness(int value, PowerDevil::BackendInterface::BrightnessControlType type = Screen);
virtual KJob* suspend(PowerDevil::BackendInterface::SuspendMethod method);
private:
@@ -82,8 +85,11 @@
void onDevicePropertiesChanged(const QString &ifaceName, const QVariantMap &changedProps, const QStringList &invalidatedProps);
private:
+ void animationValueChanged(const QVariant &value);
+
// upower devices
QMap<QString, OrgFreedesktopUPowerDeviceInterface *> m_devices;
+ OrgFreedesktopUPowerDeviceInterface *m_displayDevice;
// brightness
QMap<BrightnessControlType, int> m_cachedBrightnessMap;
@@ -93,6 +99,9 @@
OrgFreedesktopUPowerInterface *m_upowerInterface;
OrgFreedesktopUPowerKbdBacklightInterface *m_kbdBacklight;
int m_kbdMaxBrightness;
+ int m_brightnessMax = 0;
+
+ QPropertyAnimation *m_brightnessAnimation = nullptr;
// login1 interface
QWeakPointer<QDBusInterface> m_login1Interface;
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/udevqtclient.cpp
^
|
@@ -23,7 +23,7 @@
#include <powerdevil_debug.h>
-#include <QtCore/QSocketNotifier>
+#include <QSocketNotifier>
#include <qplatformdefs.h>
namespace UdevQt {
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/upowersuspendjob.cpp
^
|
@@ -18,18 +18,17 @@
*/
-#include "upowersuspendjob.h"
-
-#include "upower_interface.h"
-
-#include <powerdevil_debug.h>
-
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
+#include <QDBusMessage>
+#include <QDBusReply>
#include <QTimer>
#include <QDebug>
+
#include <KLocalizedString>
+#include "upowersuspendjob.h"
+#include "upower_interface.h"
+#include <powerdevil_debug.h>
+
UPowerSuspendJob::UPowerSuspendJob(OrgFreedesktopUPowerInterface *upowerInterface,
PowerDevil::BackendInterface::SuspendMethod method,
PowerDevil::BackendInterface::SuspendMethods supported)
@@ -54,10 +53,8 @@
void UPowerSuspendJob::doStart()
{
- if (m_supported & m_method)
- {
- switch(m_method)
- {
+ if (m_supported & m_method) {
+ switch(m_method) {
case PowerDevil::BackendInterface::ToRam:
m_upowerInterface->AboutToSleep("suspend");
m_upowerInterface->Suspend();
@@ -76,10 +73,7 @@
}
}
-
void UPowerSuspendJob::resumeDone()
{
emitResult();
}
-
-#include "upowersuspendjob.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/upowersuspendjob.h
^
|
@@ -21,9 +21,9 @@
#ifndef UPOWERSUSPENDJOB_H
#define UPOWERSUSPENDJOB_H
-#include <kjob.h>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
+#include <QDBusInterface>
+
+#include <KJob>
#include "powerdevilbackendinterface.h"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/xrandrbrightness.cpp
^
|
@@ -1,5 +1,6 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Lukas Tinkl <ltinkl@redhat.com>
+ * Copyright (C) 2015 Kai Uwe Broulik <kde@privat.broulik.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -19,67 +20,70 @@
#include <powerdevil_debug.h>
-#include "xrandrbrightness.h"
-
-#include <stdio.h>
-#include <stdlib.h>
+#include <QX11Info>
-#include <ctype.h>
-#include <string.h>
-#include <unistd.h>
+#include "xrandrbrightness.h"
XRandrBrightness::XRandrBrightness()
- : m_backlight(None), m_resources(0)
{
- // init
- int major, minor;
- if (!XRRQueryVersion (QX11Info::display(), &major, &minor))
- {
- qCWarning(POWERDEVIL, "RandR extension missing");
+ ScopedCPointer<xcb_randr_query_version_reply_t> versionReply(xcb_randr_query_version_reply(QX11Info::connection(),
+ xcb_randr_query_version(QX11Info::connection(), 1, 2),
+ nullptr));
+
+ if (!versionReply) {
+ qCWarning(POWERDEVIL) << "RandR Query version returned null";
return;
}
- if (major < 1 || (major == 1 && minor < 2))
- {
- qCWarning(POWERDEVIL, "RandR version %d.%d too old", major, minor);
+ if (versionReply->major_version < 1 || (versionReply->major_version == 1 && versionReply->minor_version < 2)) {
+ qCWarning(POWERDEVIL, "RandR version %d.%d too old", versionReply->major_version, versionReply->minor_version);
return;
}
- m_backlight = XInternAtom(QX11Info::display(), "Backlight", True);
- if (m_backlight == None)
- m_backlight = XInternAtom(QX11Info::display(), "BACKLIGHT", True); // try with legacy atom
+ ScopedCPointer<xcb_intern_atom_reply_t> backlightReply(xcb_intern_atom_reply(QX11Info::connection(),
+ xcb_intern_atom (QX11Info::connection(), 1, strlen("Backlight"), "Backlight"),
+ nullptr));
- if (m_backlight == None)
- {
- qCWarning(POWERDEVIL, "No outputs have backlight property");
+ if (!backlightReply) {
+ qCWarning(POWERDEVIL, "Intern Atom for Backlight returned null");
return;
}
- m_resources = XRRGetScreenResources(QX11Info::display(), QX11Info::appRootWindow());
+ m_backlight = backlightReply->atom;
- if (!m_resources)
- {
- qCWarning(POWERDEVIL, "No available Randr resources");
+ if (m_backlight == XCB_NONE) {
+ qCWarning(POWERDEVIL, "No outputs have backlight property");
return;
}
-}
-XRandrBrightness::~XRandrBrightness()
-{
- if (m_resources) {
- XRRFreeScreenResources(m_resources);
+ xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(QX11Info::connection()));
+ if (!iter.rem) {
+ qCWarning(POWERDEVIL, "XCB Screen Roots Iterator rem was null");
+ return;
+ }
+
+ xcb_screen_t *screen = iter.data;
+ xcb_window_t root = screen->root;
+
+ m_resources.reset(xcb_randr_get_screen_resources_current_reply(QX11Info::connection(),
+ xcb_randr_get_screen_resources_current(QX11Info::connection(), root)
+ , nullptr));
+
+ if (!m_resources) {
+ qCWarning(POWERDEVIL, "RANDR Get Screen Resources returned null");
+ return;
}
}
bool XRandrBrightness::isSupported() const
{
- if (!m_resources)
+ if (!m_resources) {
return false;
+ }
- // Verify that there are outputs that actually support backlight control...
- for (int o = 0; o < m_resources->noutput; o++)
- {
- if (backlight_get(m_resources->outputs[o]) != -1) {
+ auto *outputs = xcb_randr_get_screen_resources_current_outputs(m_resources.data());
+ for (int i = 0; i < m_resources->num_outputs; ++i) {
+ if (backlight_get(outputs[i]) != -1) {
return true;
}
}
@@ -87,14 +91,16 @@
return false;
}
-long XRandrBrightness::brightnessValue() const
+long XRandrBrightness::brightness() const
{
- if (!m_resources)
+ if (!m_resources) {
return 0;
+ }
+
+ auto *outputs = xcb_randr_get_screen_resources_current_outputs(m_resources.data());
+ for (int i = 0; i < m_resources->num_outputs; ++i) {
+ auto output = outputs[i];
- for (int o = 0; o < m_resources->noutput; o++)
- {
- RROutput output = m_resources->outputs[o];
long cur, min, max;
if (backlight_get_with_range(output, cur, min, max)) {
// FIXME for now just return the first output's value
@@ -105,14 +111,16 @@
return 0;
}
-long XRandrBrightness::brightnessValueMax() const
+long XRandrBrightness::brightnessMax() const
{
- if (!m_resources)
+ if (!m_resources) {
return 0;
+ }
+
+ auto *outputs = xcb_randr_get_screen_resources_current_outputs(m_resources.data());
+ for (int i = 0; i < m_resources->num_outputs; ++i) {
+ auto output = outputs[i];
- for (int o = 0; o < m_resources->noutput; o++)
- {
- RROutput output = m_resources->outputs[o];
long cur, min, max;
if (backlight_get_with_range(output, cur, min, max)) {
// FIXME for now just return the first output's value
@@ -123,72 +131,77 @@
return 0;
}
-void XRandrBrightness::setBrightnessValue(long brightnessValue)
+void XRandrBrightness::setBrightness(long value)
{
- if (!m_resources)
+ if (!m_resources) {
return;
+ }
+
+ auto *outputs = xcb_randr_get_screen_resources_current_outputs(m_resources.data());
+ for (int i = 0; i < m_resources->num_outputs; ++i) {
+ auto output = outputs[i];
- for (int o = 0; o < m_resources->noutput; o++)
- {
- RROutput output = m_resources->outputs[o];
long cur, min, max;
if (backlight_get_with_range(output, cur, min, max)) {
// FIXME for now just set the first output's value
- backlight_set(output, min + brightnessValue);
+ backlight_set(output, min + value);
}
}
- XSync(QX11Info::display(), False);
+ free(xcb_get_input_focus_reply(QX11Info::connection(), xcb_get_input_focus(QX11Info::connection()), nullptr)); // sync
}
-bool XRandrBrightness::backlight_get_with_range(RROutput output, long &value, long &min, long &max) const {
- long cur = backlight_get(output);
- if (cur == -1) {
+bool XRandrBrightness::backlight_get_with_range(xcb_randr_output_t output, long &value, long &min, long &max) const {
+ long cur = backlight_get(output);
+ if (cur == -1) {
return false;
- }
+ }
- XRRPropertyInfo * info = XRRQueryOutputProperty(QX11Info::display(), output, m_backlight);
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/backends/upower/xrandrbrightness.h
^
|
@@ -1,5 +1,6 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Lukas Tinkl <ltinkl@redhat.com>
+ * Copyright (C) 2015 Kai Uwe Broulik <kde@privat.broulik.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,29 +21,31 @@
#ifndef XRANDRBRIGHTNESS_H
#define XRANDRBRIGHTNESS_H
-#include <QX11Info>
+#include <xcb/xcb.h>
+#include <xcb/randr.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/Xrandr.h>
-#include <X11/Xatom.h>
+#include <QScopedPointer>
+
+template <typename T> using ScopedCPointer = QScopedPointer<T, QScopedPointerPodDeleter>;
class XRandrBrightness
{
public:
XRandrBrightness();
- ~XRandrBrightness();
+ ~XRandrBrightness() = default;
bool isSupported() const;
- long brightnessValue() const;
- long brightnessValueMax() const;
- void setBrightnessValue(long brightnessValue);
+ long brightness() const;
+ long brightnessMax() const;
+ void setBrightness(long value);
private:
- bool backlight_get_with_range(RROutput output, long &value, long &min, long &max) const;
- long backlight_get(RROutput output) const;
- void backlight_set(RROutput output, long value);
+ bool backlight_get_with_range(xcb_randr_output_t output, long &value, long &min, long &max) const;
+ long backlight_get(xcb_randr_output_t output) const;
+ void backlight_set(xcb_randr_output_t output, long value);
+
+ xcb_atom_t m_backlight = XCB_ATOM_NONE;
+ ScopedCPointer<xcb_randr_get_screen_resources_current_reply_t> m_resources;
- Atom m_backlight;
- XRRScreenResources *m_resources;
};
#endif // XRANDRBRIGHTNESS_H
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/brightnessosdwidget.cpp
^
|
@@ -24,8 +24,8 @@
#include "brightnessosdwidget.h"
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusPendingCall>
+#include <QDBusInterface>
+#include <QDBusPendingCall>
namespace BrightnessOSDWidget
{
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/config-powerdevil.h.cmake
^
|
@@ -1,5 +1,5 @@
/* Defines if you have UDev */
#cmakedefine HAVE_UDEV 1
-/* Defines if you have X11 */
-#cmakedefine HAVE_X11 1
+/* Defines if you have XCB */
+#cmakedefine HAVE_XCB 1
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/kdedpowerdevil.cpp
^
|
@@ -27,10 +27,9 @@
#include "powerdevilcore.h"
#include "powerdevil_debug.h"
-#include <QtCore/QTimer>
-
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusConnectionInterface>
+#include <QTimer>
+#include <QDBusConnection>
+#include <QDBusConnectionInterface>
#include <QDebug>
#include <KAboutData>
@@ -103,6 +102,8 @@
QDBusConnection::systemBus().interface()->registerService("org.freedesktop.Policy.Power");
// Start the Policy Agent service
+ qDBusRegisterMetaType<QList<InhibitionInfo>>();
+ qDBusRegisterMetaType<InhibitionInfo>();
new PowerManagementPolicyAgentAdaptor(PowerDevil::PolicyAgent::instance());
QDBusConnection::sessionBus().registerService("org.kde.Solid.PowerManagement.PolicyAgent");
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/kdedpowerdevil.h
^
|
@@ -27,6 +27,8 @@
class Core;
}
+using InhibitionInfo = QPair<QString, QString>;
+
class KDEDPowerDevil : public KDEDModule
{
Q_OBJECT
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/kwinkscreenhelpereffect.cpp
^
|
@@ -28,7 +28,7 @@
KWinKScreenHelperEffect::KWinKScreenHelperEffect(QObject *parent) : QObject(parent)
{
m_abortTimer.setSingleShot(true);
- m_abortTimer.setInterval(5000);
+ m_abortTimer.setInterval(8000);
connect(&m_abortTimer, &QTimer::timeout, this, &KWinKScreenHelperEffect::stop);
qApp->installNativeEventFilter(this);
@@ -68,7 +68,7 @@
bool KWinKScreenHelperEffect::checkValid()
{
-#ifdef HAVE_X11
+#ifdef HAVE_XCB
if (QX11Info::isPlatformX11()) {
QScopedPointer<xcb_list_properties_reply_t, QScopedPointerPodDeleter> propsReply(xcb_list_properties_reply(QX11Info::connection(),
xcb_list_properties_unchecked(QX11Info::connection(), QX11Info::appRootWindow()),
@@ -98,7 +98,7 @@
void KWinKScreenHelperEffect::setEffectProperty(long value)
{
-#ifdef HAVE_X11
+#ifdef HAVE_XCB
if (m_isValid && QX11Info::isPlatformX11()) {
xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, QX11Info::appRootWindow(), m_atom, XCB_ATOM_CARDINAL, 32, 1, &value);
}
@@ -115,7 +115,7 @@
return false;
}
-#ifdef HAVE_X11
+#ifdef HAVE_XCB
if (m_isValid && QX11Info::isPlatformX11()) {
auto e = static_cast<xcb_generic_event_t *>(message);
const uint8_t type = e->response_type & ~0x80;
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/kwinkscreenhelpereffect.h
^
|
@@ -27,7 +27,7 @@
#include <QScopedPointer>
#include <QTimer>
-#ifdef HAVE_X11
+#ifdef HAVE_XCB
#include <xcb/xcb.h>
#endif
@@ -70,7 +70,7 @@
QTimer m_abortTimer;
-#ifdef HAVE_X11
+#ifdef HAVE_XCB
xcb_atom_t m_atom;
#endif
|
[-]
[+]
|
Added |
powerdevil-5.3.0.tar.xz/daemon/org.kde.Solid.PowerManagement.PolicyAgent.xml
^
|
@@ -0,0 +1,33 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.kde.Solid.PowerManagement.PolicyAgent">
+ <method name="AddInhibition">
+ <arg type="u" direction="in" />
+ <arg type="s" direction="in" />
+ <arg type="s" direction="in" />
+
+ <arg type="u" direction="out" />
+ </method>
+
+ <method name="ReleaseInhibition">
+ <arg type="u" direction="in" />
+ </method>
+
+ <method name="ListInhibitions">
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<InhibitionInfo>"/>
+ <arg type="a{ss}" direction="out" />
+ </method>
+
+ <method name="HasInhibition">
+ <arg type="u" direction="in" />
+ <arg type="b" direction="out" />
+ </method>
+
+ <signal name="InhibitionsChanged">
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QList<InhibitionInfo>"/>
+ <arg type="a{ss}" />
+ <arg type="as" />
+ </signal>
+
+ </interface>
+</node>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/org.kde.Solid.PowerManagement.xml
^
|
@@ -9,6 +9,9 @@
<method name="loadProfile">
<arg type="b" direction="in" />
</method>
+ <method name="currentProfile">
+ <arg type="s" direction="out" />
+ </method>
<method name="checkBatteryStatus">
<arg type="b" direction="in" />
<arg type="s" direction="out" />
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevil.desktop
^
|
@@ -10,6 +10,7 @@
Name=Power Management
Name[ar]=إدارة الطاقة
+Name[bs]=Upravljanje napajanjem
Name[ca]=Gestió d'energia
Name[cs]=Správa napájení
Name[da]=Strømstyring
@@ -18,6 +19,7 @@
Name[en_GB]=Power Management
Name[es]=Gestión de energía
Name[fi]=Virranhallinta
+Name[fr]=Système de gestion de l'énergie
Name[gl]=Xestión da enerxía
Name[hu]=Energiakezelés
Name[ia]=Gestion de energia
@@ -49,6 +51,7 @@
Comment=Battery, Display and CPU power management and notification
Comment[ar]=تنبيهات وإدارة طاقة المعالِج والعَرض والبطارية
+Comment[bs]=Obavještavanje i upravljanje baterijom i napajanjem ekrana i procesora
Comment[ca]=Gestió d'energia i notificació de la bateria, pantalla i CPU
Comment[cs]=Správa a oznamování baterie, zobrazení a výkonu CPU
Comment[da]=Bekendtgørelser om strømstyring for batteri, skærm og CPU
@@ -58,7 +61,7 @@
Comment[es]=Gestión de energía y notificaciones de la batería, la pantalla y la CPU
Comment[fi]=Akun, näytön ja suorittimen virranhallinta sekä ilmoitukset
Comment[fr]=Gestion et notifications de l'énergie pour les batteries, l'affichage et la consommation du processeur
-Comment[gl]=Xestión e notificacións da xestión enerxética da batería, da pantalla e do procesador.
+Comment[gl]=Xestión e notificacións da xestión enerxética da batería, da pantalla e da CPU
Comment[hu]=Akkumulátor-, kijelző- és processzorkezelés és értesítés
Comment[ia]=Batteria, monstrator, gestion de energia de CPU e notification
Comment[id]=Baterai, Penampil dan manajemen daya CPU dan pemberitahuan
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilaction.cpp
^
|
@@ -112,5 +112,3 @@
}
}
-
-#include "powerdevilaction.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilaction.h
^
|
@@ -23,8 +23,8 @@
#include "powerdevilpolicyagent.h"
-#include <QtCore/QObject>
-#include <QtCore/QVariantMap>
+#include <QObject>
+#include <QVariantMap>
class KConfigGroup;
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilactionconfig.cpp
^
|
@@ -56,5 +56,3 @@
}
}
-
-#include "powerdevilactionconfig.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilactionpool.cpp
^
|
@@ -28,7 +28,7 @@
#include <KServiceTypeTrader>
#include <KPluginInfo>
-#include <QtDBus/QDBusConnection>
+#include <QDBusConnection>
#include <QDebug>
// Bundled actions:
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilactionpool.h
^
|
@@ -21,8 +21,8 @@
#ifndef POWERDEVIL_POWERDEVILACTIONPOOL_H
#define POWERDEVIL_POWERDEVILACTIONPOOL_H
-#include <QtCore/QHash>
-#include <QtCore/QStringList>
+#include <QHash>
+#include <QStringList>
class KConfigGroup;
namespace PowerDevil
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilbackendinterface.cpp
^
|
@@ -45,7 +45,6 @@
bool isLidClosed;
bool isLidPresent;
QHash< QString, uint > capacities;
- QList< RecallNotice > recallNotices;
};
BackendInterface::BackendInterface(QObject* parent)
@@ -78,63 +77,32 @@
return d->batteryState;
}
-bool BackendInterface::setBrightness(float brightness, BackendInterface::BrightnessControlType type)
+void BackendInterface::setBrightness(int brightness, BackendInterface::BrightnessControlType type)
{
if (type == Screen) {
- qCDebug(POWERDEVIL) << "set screen brightness percentage: " << brightness;
+ qCDebug(POWERDEVIL) << "set screen brightness: " << brightness;
} else {
- qCDebug(POWERDEVIL) << "set kbd backlight percentage: " << brightness;
+ qCDebug(POWERDEVIL) << "set kbd backlight: " << brightness;
}
- return setBrightnessValue(qRound(brightness / 100 * brightnessValueMax(type)), type);
+ d->brightnessLogic.value(type)->setValue(brightness);
}
-bool BackendInterface::setBrightnessStep(int brightnessStep, BackendInterface::BrightnessControlType type)
+int BackendInterface::brightness(BackendInterface::BrightnessControlType type) const
{
- BrightnessLogic *logic = d->brightnessLogic[type];
- logic->setValueMax(brightnessValueMax(type));
-
- return setBrightnessValue(logic->stepToValue(brightnessStep), type);
-}
-
-float BackendInterface::brightness(BackendInterface::BrightnessControlType type) const
-{
- BrightnessLogic *logic = d->brightnessLogic[type];
- logic->setValueMax(brightnessValueMax(type));
- logic->setValue(brightnessValue(type));
-
- return logic->percentage();
-}
-
-int BackendInterface::brightnessValue(BackendInterface::BrightnessControlType type) const
-{
- BrightnessLogic *logic = d->brightnessLogic[type];
-
- return logic->value();
-}
-
-int BackendInterface::brightnessValueMax(BackendInterface::BrightnessControlType type) const
-{
- BrightnessLogic *logic = d->brightnessLogic[type];
-
- return logic->valueMax();
+ return d->brightnessLogic.value(type)->value();
}
-int BackendInterface::brightnessStep(BackendInterface::BrightnessControlType type) const
+int BackendInterface::brightnessMax(BackendInterface::BrightnessControlType type) const
{
- BrightnessLogic *logic = d->brightnessLogic[type];
- logic->setValueMax(brightnessValueMax(type));
- logic->setValue(brightnessValue(type));
-
- return logic->step();
+ return d->brightnessLogic.value(type)->valueMax();
}
-int BackendInterface::brightnessStepMax(BackendInterface::BrightnessControlType type) const
+int BackendInterface::brightnessSteps(BackendInterface::BrightnessControlType type) const
{
- BrightnessLogic *logic = d->brightnessLogic[type];
- logic->setValueMax(brightnessValueMax(type));
-
- return logic->stepMax();
+ BrightnessLogic *logic = d->brightnessLogic.value(type);
+ logic->setValueMax(brightnessMax(type));
+ return logic->steps();
}
BackendInterface::BrightnessControlsList BackendInterface::brightnessControlsAvailable() const
@@ -147,11 +115,6 @@
return d->capacities;
}
-QList< BackendInterface::RecallNotice > BackendInterface::recallNotices() const
-{
- return d->recallNotices;
-}
-
BackendInterface::SuspendMethods BackendInterface::supportedSuspendMethods() const
{
return d->suspendMethods;
@@ -222,16 +185,11 @@
d->capacities.insert(batteryId, percent);
}
-void BackendInterface::setRecallNotices(const QList< BackendInterface::RecallNotice >& notices)
+void BackendInterface::onBrightnessChanged(BrightnessControlType type, int value, int valueMax)
{
- d->recallNotices = notices;
-}
-
-void BackendInterface::onBrightnessChanged(BrightnessControlType type, int brightnessValue, int brightnessValueMax)
-{
- BrightnessLogic *logic = d->brightnessLogic[type];
- logic->setValueMax(brightnessValueMax);
- logic->setValue(brightnessValue);
+ BrightnessLogic *logic = d->brightnessLogic.value(type);
+ logic->setValueMax(valueMax);
+ logic->setValue(value);
emit brightnessChanged(logic->info(), type);
}
@@ -251,15 +209,13 @@
d->capabilities = capabilities;
}
-int BackendInterface::calculateNextStep(int brightnessValue, int brightnessValueMax, BrightnessControlType type, BrightnessLogic::BrightnessKeyType keyType)
+int BackendInterface::calculateNextStep(int value, int valueMax, BrightnessControlType type, BrightnessLogic::BrightnessKeyType keyType)
{
- BrightnessLogic *logic = d->brightnessLogic[type];
- logic->setValueMax(brightnessValueMax);
- logic->setValue(brightnessValue);
+ BrightnessLogic *logic = d->brightnessLogic.value(type);
+ logic->setValueMax(valueMax);
+ logic->setValue(value);
return logic->action(keyType);
}
}
-
-#include "powerdevilbackendinterface.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilbackendinterface.h
^
|
@@ -21,8 +21,8 @@
#ifndef POWERDEVIL_BACKENDINTERFACE_H
#define POWERDEVIL_BACKENDINTERFACE_H
-#include <QtCore/QObject>
-#include <QtCore/QHash>
+#include <QObject>
+#include <QHash>
#include "powerdevilbrightnesslogic.h"
@@ -106,18 +106,6 @@
Q_DECLARE_FLAGS(Capabilities, Capability)
/**
- * This struct contains information for a recall notice from the vendor
- */
- struct RecallNotice {
- /** The battery uuid */
- QString batteryId;
- /** The vendor's name */
- QString vendor;
- /** The vendor's website */
- QString url;
- };
-
- /**
* Initializes the backend. This function @b MUST be called before the backend is usable. Using
* any method in BackendInterface without initializing it might lead to undefined behavior. The signal
* @c backendReady or @c backendError will be streamed upon completion.
@@ -155,7 +143,6 @@
*/
AcAdapterState acAdapterState() const;
-
/**
* Retrieves the set of suspend methods supported by the system.
*
@@ -181,20 +168,12 @@
BrightnessControlsList brightnessControlsAvailable() const;
/**
- * Gets the device brightness.
- *
- * @param device the name of the device that you would like to control
- * @return the brightness of the device, as a percentage
- */
- virtual float brightness(BrightnessControlType type = Screen) const;
-
- /**
* Gets the device brightness value.
*
* @param device the name of the device that you would like to control
* @return the brightness of the device, as an integer from 0 to brightnessValueMax
*/
- virtual int brightnessValue(BrightnessControlType type = Screen) const;
+ virtual int brightness(BrightnessControlType type = Screen) const;
/**
* Gets the maximum device brightness value.
@@ -202,15 +181,7 @@
* @param device the name of the device that you would like to control
* @return the maximum brightness of the device
*/
- virtual int brightnessValueMax(BrightnessControlType type = Screen) const;
-
- /**
- * Gets the device brightness step.
- *
- * @param device the name of the device that you would like to control
- * @return the brightness of the device, as an integer from 0 to brightnessStepMax
- */
- virtual int brightnessStep(BrightnessControlType type = Screen) const;
+ virtual int brightnessMax(BrightnessControlType type = Screen) const;
/**
* Gets the maximum device brightness step.
@@ -218,7 +189,7 @@
* @param device the name of the device that you would like to control
* @return the maximum brightness of the device
*/
- virtual int brightnessStepMax(BrightnessControlType type = Screen) const;
+ virtual int brightnessSteps(BrightnessControlType type = Screen) const;
/**
* @returns whether the lid is closed or not.
@@ -232,54 +203,29 @@
void setLidPresent(bool present);
/**
- * Sets the device brightness.
- *
- * @param brightness the desired device brightness, as a percentage
- * @param device the name of the device that you would like to control
- * @return true if the brightness change succeeded, false otherwise
- */
- virtual bool setBrightness(float brightness, BrightnessControlType type = Screen);
-
- /**
- * Sets the device brightness.
- *
- * @param brightnessStep the desired device brightness, as an integer from 0 to brightnessStepMax
- * @param device the name of the device that you would like to control
- * @return true if the brightness change succeeded, false otherwise
- */
- virtual bool setBrightnessStep(int brightnessStep, BrightnessControlType type = Screen);
-
- /**
* Sets the device brightness value.
*
* @param brightnessValue the desired device brightness, as an integer from 0 to brightnessValueMax
* @param device the name of the device that you would like to control
* @return true if the brightness change succeeded, false otherwise
*/
- virtual bool setBrightnessValue(int brightnessValue, BrightnessControlType type = Screen) = 0;
+ virtual void setBrightness(int value, BrightnessControlType type = Screen) = 0;
/**
* Should be called when the user presses a brightness key.
*
* @param type the type of the brightness key press
+ * @return the new brightness value, or -1 if it could not be changed or determined
* @see PowerDevil::BrightnessLogic::BrightnessKeyType
*/
- virtual void brightnessKeyPressed(BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType = Screen) = 0;
+ virtual int brightnessKeyPressed(BrightnessLogic::BrightnessKeyType type, BrightnessControlType controlType = Screen) = 0;
/**
* Retrieves the capacities of the installed batteries in percentage.
*
* @returns A dictionary with the battery's capacity percentage mapped to the battery uuid.
*/
- QHash< QString, uint > capacities() const;
-
- /**
- * Returns a list of recall notices, if available
- *
- * @return a list of recall notices
- * @see PowerDevil::BackendInterface::RecallNotice
- */
- QList< RecallNotice > recallNotices() const;
+ QHash<QString, uint> capacities() const;
Q_SIGNALS:
/**
@@ -344,20 +290,19 @@
protected:
void setCapabilities(Capabilities capabilities);
- void onBrightnessChanged(BrightnessControlType device, int brightnessValue, int brightnessValueMax);
+ void onBrightnessChanged(BrightnessControlType device, int value, int valueMax);
void setBatteryRemainingTime(qulonglong time);
void setButtonPressed(PowerDevil::BackendInterface::ButtonType type);
void setBatteryState(PowerDevil::BackendInterface::BatteryState state);
void setAcAdapterState(PowerDevil::BackendInterface::AcAdapterState state);
void setCapacityForBattery(const QString &batteryId, uint percent);
- void setRecallNotices(const QList< RecallNotice > ¬ices);
void setBackendIsReady(BrightnessControlsList availableBrightnessControls, SuspendMethods supportedSuspendMethods);
void setBackendHasError(const QString &errorDetails);
// Steps logic
- int calculateNextStep(int brightnessValue, int brightnessValueMax, BrightnessControlType controlType, BrightnessLogic::BrightnessKeyType type);
+ int calculateNextStep(int value, int valueMax, BrightnessControlType controlType, BrightnessLogic::BrightnessKeyType type);
protected slots:
// This function is actually here due to HAL
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilbrightnesslogic.cpp
^
|
@@ -24,23 +24,19 @@
{
BrightnessLogic::BrightnessLogic()
- : m_value(-1), m_valueMax(-1), m_step(-1), m_stepMax(-1)
{
}
-BrightnessLogic::~BrightnessLogic()
+void BrightnessLogic::setValue(int value)
{
-}
-
-void BrightnessLogic::setValue(int value) {
m_value = value;
- m_step = valueToStep(value);
}
-void BrightnessLogic::setValueMax(int valueMax) {
+void BrightnessLogic::setValueMax(int valueMax)
+{
if (valueMax != m_valueMax) {
m_valueMax = valueMax;
- m_stepMax = calculateStepMax(valueMax);
+ m_steps = calculateSteps(valueMax);
}
}
@@ -57,67 +53,83 @@
return -1; // We shouldn't get here
}
-int BrightnessLogic::increased() const {
+int BrightnessLogic::increased() const
+{
if (m_value == m_valueMax) {
return -1; // ignore, we are at the maximum
}
// Add 1 and round upwards to the nearest step
- int step = m_stepMax - (m_valueMax - m_value - 1) * m_stepMax / m_valueMax;
+ int step = m_steps - (m_valueMax - m_value - 1) * m_steps / m_valueMax;
+
+ if (m_valueMax > 100 && qRound(percentage(stepToValue(step))) <= qRound(percentage(m_value))) {
+ // When no visible change was made, add 1 step.
+ // This can happen only if valueMax > 100, else 1 >= 1%.
+ step++;
+ }
+
return stepToValue(step);
}
-int BrightnessLogic::decreased() const {
+int BrightnessLogic::decreased() const
+{
if (m_value == 0) {
return -1; // ignore, we are at the minimum
}
// Subtract 1 and round downwards to the nearest Step
- int step = (m_value - 1) * m_stepMax / m_valueMax;
+ int step = (m_value - 1) * m_steps / m_valueMax;
+
+ if (m_valueMax > 100 && qRound(percentage(stepToValue(step))) >= qRound(percentage(m_value))) {
+ // When no visible change was made, subtract 1 step.
+ // This can happen only if valueMax > 100, else 1 >= 1%.
+ step--;
+ }
+
return stepToValue(step);
}
-int BrightnessLogic::toggled() const {
+int BrightnessLogic::toggled() const
+{
// If it's not minimum, set to minimum, if it's minimum, set to maximum
return m_value > 0 ? 0 : m_valueMax;
}
-int BrightnessLogic::value() const {
+int BrightnessLogic::value() const
+{
return m_value;
}
-int BrightnessLogic::valueMax() const {
+int BrightnessLogic::valueMax() const
+{
return m_valueMax;
}
-int BrightnessLogic::step() const {
- return m_step;
+int BrightnessLogic::steps() const
+{
+ return m_steps;
}
-int BrightnessLogic::stepMax() const {
- return m_stepMax;
+float BrightnessLogic::percentage(int value) const
+{
+ return value * 100.0 / m_valueMax;
}
-float BrightnessLogic::percentage() const {
- return m_value * 100.0 / m_valueMax;
+const BrightnessLogic::BrightnessInfo BrightnessLogic::info() const
+{
+ return BrightnessInfo{
+ m_value, m_valueMax, m_steps
+ };
}
-const BrightnessLogic::BrightnessInfo BrightnessLogic::info() const {
- BrightnessInfo brightnessInfo;
- brightnessInfo.valueMax = m_valueMax;
- brightnessInfo.value = m_value;
- brightnessInfo.stepMax = m_stepMax;
- brightnessInfo.step = m_step;
- brightnessInfo.percentage = percentage();
- return brightnessInfo;
+int BrightnessLogic::stepToValue(int step) const
+{
+ return qBound(0, qRound(step * 1.0 * m_valueMax / m_steps), m_valueMax);
}
-int BrightnessLogic::stepToValue(int step) const {
- return qBound(0, qRound(step * 1.0 * m_valueMax / m_stepMax), m_valueMax);
+int BrightnessLogic::valueToStep(int value) const
+{
+ return qBound(0, qRound(value * 1.0 * m_steps / m_valueMax), m_steps);
}
-int BrightnessLogic::valueToStep(int value) const {
- return qBound(0, qRound(value * 1.0 * m_stepMax / m_valueMax), m_stepMax);
}
-
-};
\ No newline at end of file
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilbrightnesslogic.h
^
|
@@ -28,7 +28,7 @@
public:
BrightnessLogic();
- virtual ~BrightnessLogic();
+ virtual ~BrightnessLogic() = default;
/**
* This enum defines the different types brightness keys.
@@ -37,7 +37,7 @@
* - Decrease: Key to decrease brightness (Qt::Key_MonBrightnessDown or Qt::Key_KeyboardBrightnessDown)
* - Toggle: Key to toggle backlight (Qt::Key_KeyboardBacklightOnOff)
*/
- enum BrightnessKeyType{ Increase, Decrease, Toggle };
+ enum BrightnessKeyType { Increase, Decrease, Toggle };
/**
* This struct contains information about current brightness state for a single device
@@ -47,12 +47,8 @@
int value;
/** The maximum possible brightness value for this device */
int valueMax;
- /** Current brightness step, approximate (rounded to the nearest step) */
- int step;
/** The maximum possible brightness step for this device */
- int stepMax;
- /** Brightness value expressed as a percentage of maximum possible value */
- float percentage;
+ int steps;
};
/**
@@ -127,14 +123,15 @@
*
* @return Maximum possible brightness step
*/
- int stepMax() const;
+ int steps() const;
/**
- * Retreive the brightness value expressed as a percentage from 0 to 100
+ * Retreive the supplied brightness value expressed as a percentage from 0 to 100
*
- * @return The brightness percentage
+ * @param value Brightness value, from 0 to valueMax
+ * @return The brightness percentage for the supplied value
*/
- float percentage() const;
+ float percentage(int value) const;
/**
* Retreive a copy of the current brightness state
@@ -146,7 +143,7 @@
/**
* Convert brightness step to raw brightness value
*
- * @param step Brightness step, from 0 to stepMax
+ * @param step Brightness step, from 0 to steps
* @return Brightness value that corresponds to the given step
*/
int stepToValue(int step) const;
@@ -174,13 +171,12 @@
* @param valueMax the maximum brightness value for which we want to calculate the number of steps
* @return the optimal maximum step number
*/
- virtual int calculateStepMax(int valueMax) const = 0;
+ virtual int calculateSteps(int valueMax) const = 0;
private:
- int m_value;
- int m_valueMax;
- int m_step;
- int m_stepMax;
+ int m_value = -1;
+ int m_valueMax = -1;
+ int m_steps = -1;
};
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilcore.cpp
^
|
@@ -20,7 +20,6 @@
#include "powerdevilcore.h"
#include "PowerDevilSettings.h"
-#include "screensaver_interface.h"
#include "powerdevilaction.h"
#include "powerdevilactionpool.h"
@@ -41,7 +40,7 @@
#include <KNotification>
#include <KServiceTypeTrader>
-// #include <KActivities/Consumer>
+#include <KActivities/Consumer>
#include <QtCore/QTimer>
#include <QtDBus/QDBusConnection>
@@ -58,7 +57,7 @@
, m_backend(0)
, m_notificationsWatcher(nullptr)
, m_criticalBatteryTimer(new QTimer(this))
-// , m_activityConsumer(new KActivities::Consumer(this))
+ , m_activityConsumer(new KActivities::Consumer(this))
, m_pendingWakeupEvent(true)
{
}
@@ -85,9 +84,6 @@
connect(m_backend, SIGNAL(backendReady()), this, SLOT(onBackendReady()));
connect(m_backend, SIGNAL(backendError(QString)), this, SLOT(onBackendError(QString)));
m_backend->init();
-
- // Register DBus Metatypes
- qDBusRegisterMetaType< StringStringMap >();
}
void Core::onBackendReady()
@@ -127,8 +123,9 @@
this, SLOT(onKIdleTimeoutReached(int,int)));
connect(KIdleTime::instance(), SIGNAL(resumingFromIdle()),
this, SLOT(onResumingFromIdle()));
-// connect(m_activityConsumer, SIGNAL(currentActivityChanged(QString)),
-// this, SLOT(loadProfile()));
+ connect(m_activityConsumer, &KActivities::Consumer::currentActivityChanged, this, [this]() {
+ loadProfile();
+ });
// Set up the policy agent
PowerDevil::PolicyAgent::instance()->init();
@@ -138,7 +135,7 @@
// Set up the critical battery timer
m_criticalBatteryTimer->setSingleShot(true);
- m_criticalBatteryTimer->setInterval(30000);
+ m_criticalBatteryTimer->setInterval(60000);
connect(m_criticalBatteryTimer, SIGNAL(timeout()), this, SLOT(onCriticalBatteryTimerExpired()));
// wait until the notification system is set up before firing notifications
@@ -194,26 +191,6 @@
}
}
- // Any recalled batteries?
- foreach (const BackendInterface::RecallNotice ¬ice, m_backend->recallNotices()) {
- // Notify, a battery has been recalled
- if (m_loadedBatteriesUdi.size() == 1) {
- lastMessage = i18n("Your battery might have been recalled by %1. Usually, when vendors recall the "
- "hardware, it is because of factory defects which are usually eligible for a "
- "free repair or substitution. Please check <a href=\"%2\">%1's website</a> to "
- "verify if your battery is faulted.", notice.vendor, notice.url);
- } else {
- lastMessage = i18n("One of your batteries (ID %3) might have been recalled by %1. "
- "Usually, when vendors recall the hardware, it is because of factory defects "
- "which are usually eligible for a free repair or substitution. "
- "Please check <a href=\"%2\">%1's website</a> to "
- "verify if your battery is faulted.", notice.vendor, notice.url, notice.batteryId);
- }
- if (notify) {
- emitRichNotification("brokenbattery", i18n("Check Your Battery"), lastMessage);
- }
- }
-
return lastMessage;
}
@@ -236,6 +213,11 @@
emit configurationReloaded();
}
+QString Core::currentProfile() const
+{
+ return m_currentProfile;
+}
+
void Core::loadProfile(bool force)
{
QString profileId;
@@ -249,10 +231,7 @@
KConfigGroup config;
// Check the activity in which we are in
- QString activity;/* = m_activityConsumer->currentActivity();*/
- if (activity.isEmpty()) {
- activity = "default";
- }
+ QString activity = m_activityConsumer->currentActivity();
qCDebug(POWERDEVIL) << "We are now into activity " << activity;
KConfigGroup activitiesConfig(m_profilesConfig, "Activities");
qCDebug(POWERDEVIL) << activitiesConfig.groupList() << activitiesConfig.keyList();
@@ -524,17 +503,17 @@
switch (PowerDevilSettings::batteryCriticalAction()) {
case PowerDevil::BundledActions::SuspendSession::ShutdownMode:
emitRichNotification("criticalbattery", i18n("Battery Critical (%1% Remaining)", currentPercent),
- i18n("Your battery level is critical, the computer will be halted in 30 seconds."));
+ i18n("Your battery level is critical, the computer will be halted in 60 seconds."));
m_criticalBatteryTimer->start();
break;
case PowerDevil::BundledActions::SuspendSession::ToDiskMode:
emitRichNotification("criticalbattery", i18n("Battery Critical (%1% Remaining)", currentPercent),
- i18n("Your battery level is critical, the computer will be hibernated in 30 seconds."));
+ i18n("Your battery level is critical, the computer will be hibernated in 60 seconds."));
m_criticalBatteryTimer->start();
break;
case PowerDevil::BundledActions::SuspendSession::ToRamMode:
emitRichNotification("criticalbattery", i18n("Battery Critical (%1% Remaining)", currentPercent),
- i18n("Your battery level is critical, the computer will be suspended in 30 seconds."));
+ i18n("Your battery level is critical, the computer will be suspended in 60 seconds."));
m_criticalBatteryTimer->start();
break;
default:
@@ -776,5 +755,3 @@
}
}
-
-#include "powerdevilcore.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilcore.h
^
|
@@ -23,8 +23,8 @@
#include "powerdevilbackendinterface.h"
-#include <QtCore/QWeakPointer>
-#include <QtCore/QStringList>
+#include <QWeakPointer>
+#include <QStringList>
#include <KSharedConfig>
@@ -32,7 +32,6 @@
{
class Consumer;
} // namespace KActivities
-typedef QMap< QString, QString > StringStringMap;
class KDirWatch;
class QDBusServiceWatcher;
@@ -79,6 +78,7 @@
QString checkBatteryStatus(bool notify = true);
+ QString currentProfile() const;
void loadProfile(bool force = false);
qulonglong batteryRemainingTime() const;
@@ -120,7 +120,7 @@
QTimer *m_criticalBatteryTimer;
-// KActivities::Consumer *m_activityConsumer;
+ KActivities::Consumer *m_activityConsumer;
// Idle time management
QHash< Action*, QList< int > > m_registeredActionTimeouts;
@@ -149,6 +149,4 @@
}
-Q_DECLARE_METATYPE(StringStringMap)
-
#endif // POWERDEVILCORE_H
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilfdoconnector.cpp
^
|
@@ -98,10 +98,10 @@
// Inhibit here means we cannot interrupt the session.
// If we've been called from DBus, use PolicyAgent's service watching system
if (calledFromDBus()) {
- return PolicyAgent::instance()->addInhibitionWithExplicitDBusService((uint)PolicyAgent::InterruptSession,
+ return PolicyAgent::instance()->addInhibitionWithExplicitDBusService((uint)PolicyAgent::ChangeScreenSettings,
application, reason, message().service());
} else {
- return PolicyAgent::instance()->AddInhibition((uint)PolicyAgent::InterruptSession, application, reason);
+ return PolicyAgent::instance()->AddInhibition((uint)PolicyAgent::ChangeScreenSettings, application, reason);
}
}
@@ -137,5 +137,3 @@
}
}
-
-#include "powerdevilfdoconnector.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilfdoconnector.h
^
|
@@ -21,7 +21,7 @@
#ifndef POWERDEVILFDOCONNECTOR_H
#define POWERDEVILFDOCONNECTOR_H
-#include <QtCore/QObject>
+#include <QObject>
#include "powerdevilbackendinterface.h"
#include "powerdevilpolicyagent.h"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilkeyboardbrightnesslogic.cpp
^
|
@@ -24,7 +24,7 @@
namespace PowerDevil
{
-int KeyboardBrightnessLogic::calculateStepMax(int maxValue) const
+int KeyboardBrightnessLogic::calculateSteps(int maxValue) const
{
// We assume that a generally good number of steps for keyboard brightness is about 5.
@@ -54,4 +54,4 @@
return 5;
}
-};
\ No newline at end of file
+}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilkeyboardbrightnesslogic.h
^
|
@@ -29,7 +29,7 @@
{
protected:
- int calculateStepMax(int valueMax) const;
+ int calculateSteps(int valueMax) const;
};
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilpolicyagent.cpp
^
|
@@ -18,17 +18,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
-#include <QtCore/QCoreApplication>
-#include <QtDBus/QDBusObjectPath>
-#include <QtDBus/QDBusArgument>
-#include <QtCore/QMetaType>
-#include <QtDBus/QDBusMetaType>
-
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusPendingReply>
-#include <QtDBus/QDBusConnectionInterface>
-#include <QtDBus/QDBusServiceWatcher>
+#include <QCoreApplication>
+#include <QDBusObjectPath>
+#include <QDBusArgument>
+#include <QMetaType>
+#include <QDBusMetaType>
+#include <QDBusConnection>
+#include <QDBusInterface>
+#include <QDBusPendingReply>
+#include <QDBusConnectionInterface>
+#include <QDBusServiceWatcher>
#include "powerdevilpolicyagent.h"
#include "powerdevil_debug.h"
@@ -58,6 +57,8 @@
}
Q_DECLARE_METATYPE(NamedDBusObjectPath)
+Q_DECLARE_METATYPE(InhibitionInfo)
+Q_DECLARE_METATYPE(QList<InhibitionInfo>)
namespace PowerDevil
{
@@ -104,6 +105,9 @@
void PolicyAgent::init()
{
+ qDBusRegisterMetaType<InhibitionInfo>();
+ qDBusRegisterMetaType<QList<InhibitionInfo>>();
+
// Watch over the systemd service
m_sdWatcher.data()->setConnection(QDBusConnection::systemBus());
m_sdWatcher.data()->setWatchMode(QDBusServiceWatcher::WatchForUnregistration |
@@ -422,6 +426,8 @@
addInhibitionTypeHelper(m_lastCookie, static_cast< PolicyAgent::RequiredPolicies >(types));
+ emit InhibitionsChanged({ {qMakePair(appName, reason)} }, QStringList());
+
return m_lastCookie;
}
@@ -447,9 +453,13 @@
addInhibitionTypeHelper(m_lastCookie, static_cast< PolicyAgent::RequiredPolicies >(types));
+ emit InhibitionsChanged({ {qMakePair(appName, reason)} }, QStringList());
+
return m_lastCookie;
}
+
+
void PolicyAgent::addInhibitionTypeHelper(uint cookie, PolicyAgent::RequiredPolicies types)
{
// Look through all of the inhibition types
@@ -489,7 +499,10 @@
void PolicyAgent::ReleaseInhibition(uint cookie)
{
qCDebug(POWERDEVIL) << "Released inhibition with cookie " << cookie;
+ emit InhibitionsChanged(QList<InhibitionInfo>(), { {m_cookieToAppName.value(cookie).first} });
m_cookieToAppName.remove(cookie);
+
+
QString service = m_cookieToBusService.take(cookie);
if (!m_busWatcher.isNull() && !service.isEmpty() && !m_cookieToBusService.key(service)) {
// no cookies from service left
@@ -526,6 +539,16 @@
}
}
+QList<InhibitionInfo> PolicyAgent::ListInhibitions() const
+{
+ return m_cookieToAppName.values();
+}
+
+bool PolicyAgent::HasInhibition(/*PolicyAgent::RequiredPolicies*/ uint types)
+{
+ return requirePolicyCheck(static_cast<PolicyAgent::RequiredPolicies>(types)) != PolicyAgent::None;
+}
+
void PolicyAgent::releaseAllInhibitions()
{
QList< uint > allCookies = m_cookieToAppName.keys();
@@ -560,5 +583,3 @@
}
}
-
-#include "powerdevilpolicyagent.moc"
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilpolicyagent.h
^
|
@@ -22,12 +22,13 @@
#ifndef POWERDEVIL_POWERDEVILPOLICYAGENT_H
#define POWERDEVIL_POWERDEVILPOLICYAGENT_H
-#include <QtCore/QObject>
-#include <QtCore/QHash>
-#include <QtCore/QWeakPointer>
+#include <QObject>
+#include <QHash>
+#include <QStringList>
+#include <QWeakPointer>
-#include <QtDBus/QDBusContext>
-#include <QtDBus/QDBusUnixFileDescriptor>
+#include <QDBusContext>
+#include <QDBusUnixFileDescriptor>
class QDBusServiceWatcher;
class QDBusInterface;
@@ -40,6 +41,7 @@
#define CONSOLEKIT_SERVICE "org.freedesktop.ConsoleKit"
+using InhibitionInfo = QPair<QString, QString>;
namespace PowerDevil
{
@@ -78,9 +80,15 @@
// Exported slots
uint AddInhibition(uint types, const QString &appName, const QString &reason);
void ReleaseInhibition(uint cookie);
+ QList<InhibitionInfo> ListInhibitions() const;
+ bool HasInhibition(uint types);
void releaseAllInhibitions();
+
Q_SIGNALS:
+ // Exported signals
+ void InhibitionsChanged(const QList<InhibitionInfo> &added, const QStringList &removed);
+
void unavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies newpolicies);
private Q_SLOTS:
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilprofilegenerator.cpp
^
|
@@ -31,13 +31,15 @@
void ProfileGenerator::generateProfiles(bool toRam, bool toDisk)
{
- // Let's change some defaults
- if (!toRam) {
- if (!toDisk) {
+ // Change critical action if default (hibernate) is unavailable
+ if (!toDisk) {
+ if (!toRam) {
PowerDevilSettings::setBatteryCriticalAction(0);
} else {
- PowerDevilSettings::setBatteryCriticalAction(2);
+ PowerDevilSettings::setBatteryCriticalAction(1);
}
+
+ PowerDevilSettings::self()->save();
}
// Ok, let's get our config file.
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilscreenbrightnesslogic.cpp
^
|
@@ -30,44 +30,47 @@
return -1;
}
-int ScreenBrightnessLogic::calculateStepMax(int maxValue) const
+int ScreenBrightnessLogic::calculateSteps(int maxValue) const
{
- // We assume that a generally good number of steps for screen brightness is about 10.
+ // We assume that the preferred number of steps for screen brightness is 20, but we don't want more.
- if (maxValue <= 15 || maxValue == 17) {
+ if (maxValue <= 20) {
// Too few steps, return the number of actual steps.
+ // Those would be uniform, but not round in some cases.
return maxValue;
}
- if (maxValue % 5 == 0 || maxValue >= 80) {
- /* If there are more than 100 actual steps, any value will be displayed nicely.
- If maxValue >= 80 and maxValue % 2 = 0, then 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80% and 90% are displayed nicely.
- If maxValue >= 80 and maxValue % 2 = 1, then it is showed as
- 0% 10% 20% 30% 40% 51% 60% 70% 80% 90% 100% or 0% 11% 20% 31% 40% 51% 60% 71% 80% 91% 100%, which looks good.
- If maxValue >= 35 and maxValue % 5 = 0, then it is showed as
- 0% 11% 20% 31% 40% 51% 60% 71% 80% 91% 100% (when maxValue % 10 != 0), which also looks good.
- For maxValue == 25 steps are showed as
- 0% 12% 20% 32% 40% 52% 60% 72% 80% 92% 100%, which is also fine.
- */
- return 10;
+ if (maxValue >= 100 || maxValue % 20 == 0 || maxValue >= 80 && maxValue % 4 == 0) {
+ // In this case all 20 steps are perfect.
+ return 20;
}
- for (int steps = 10; steps <= 15; steps++) {
- if (maxValue % steps == 0) {
- return steps;
- }
+ // At this point we have maxValue in the range 21-79 which probably is a rare case.
+
+ if (maxValue >= 34 || maxValue == 32 || maxValue == 28) {
+ // In this case all 20 steps are matched +-1%, which is fine.
+ return 20;
}
- for (int steps = 9; steps >= 8; steps--) {
+ // At this point we have maxValue in the range 21-33.
+ // Trying to make 20 steps from here will make them not uniform.
+
+ if (maxValue % 5 == 0) {
+ // For maxValue == 30 there are 10 even and round steps.
+ // For maxValue == 25 steps are shown as
+ // 0% 12% 20% 32% 40% 52% 60% 72% 80% 92% 100%, which is also fine.
+ return 10;
+ }
+
+ // Trying hard to find an uniform steps set
+ for (int steps = 9; steps <= 14; steps++) {
if (maxValue % steps == 0) {
return steps;
}
}
- // 28 different maxValue values between 17 and 79 are left at this point.
- //qCDebug(POWERDEVIL) << "maxValue" << maxValue;
-
- // Give up and return 10, there is nothing much we can do here.
+ // 4 different maxValue values left: 21, 23, 29, 31.
+ // Those produce +-2% on 10 steps, there is nothing better we can do here.
return 10;
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/daemon/powerdevilscreenbrightnesslogic.h
^
|
@@ -32,7 +32,7 @@
int toggled() const;
protected:
- int calculateStepMax(int valueMax) const;
+ int calculateSteps(int valueMax) const;
};
|
|
Changed |
powerdevil-5.3.0.tar.xz/doc/kcm/advanced.png
^
|
|
Changed |
powerdevil-5.3.0.tar.xz/doc/kcm/energy.png
^
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/CMakeLists.txt
^
|
@@ -6,6 +6,6 @@
add_subdirectory(common)
-# add_subdirectory(activities)
+add_subdirectory(activities)
add_subdirectory(global)
add_subdirectory(profiles)
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/activities/CMakeLists.txt
^
|
@@ -1,6 +1,7 @@
add_definitions(-DTRANSLATION_DOMAIN=\"powerdevilactivitiesconfig\")
set( kcm_powerdevil_activities_SRCS
+ ${PowerDevil_SOURCE_DIR}/daemon/powerdevil_debug.cpp
activitypage.cpp
activitywidget.cpp
../common/ErrorOverlay.cpp
@@ -14,9 +15,9 @@
add_library(kcm_powerdevilactivitiesconfig MODULE ${kcm_powerdevil_activities_SRCS})
target_link_libraries(kcm_powerdevilactivitiesconfig
-
KF5::Solid
KF5::Activities
+ KF5::KDELibs4Support
powerdevilconfigcommonprivate
)
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/activities/activityWidget.ui
^
|
@@ -33,7 +33,7 @@
</widget>
</item>
<item>
- <widget class="KComboBox" name="actLikeComboBox">
+ <widget class="QComboBox" name="actLikeComboBox">
<property name="enabled">
<bool>false</bool>
</property>
@@ -93,7 +93,7 @@
</widget>
</item>
<item>
- <widget class="KComboBox" name="alwaysActionBox"/>
+ <widget class="QComboBox" name="alwaysActionBox"/>
</item>
<item>
<widget class="QLabel" name="alwaysAfterLabel">
@@ -163,13 +163,6 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- </customwidgets>
<resources/>
<connections>
<connection>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/activities/activitypage.cpp
^
|
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2011 by Dario Freddi <drf@kde.org> *
+ * Copyright (C) 2015 by Kai Uwe Broulik <kde@privat.broulik.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -29,6 +30,8 @@
#include <QScrollArea>
#include <QVBoxLayout>
+#include <QtWidgets/QTabWidget>
+
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusConnectionInterface>
#include <QtDBus/QDBusMessage>
@@ -41,7 +44,6 @@
#include <KMessageWidget>
#include <KPluginFactory>
#include <KSharedConfig>
-#include <KTabWidget>
#include <KLocalizedString>
K_PLUGIN_FACTORY(PowerDevilActivitiesKCMFactory,
@@ -50,12 +52,12 @@
K_EXPORT_PLUGIN(PowerDevilActivitiesKCMFactory("powerdevilactivitiesconfig","powerdevil"))
ActivityPage::ActivityPage(QWidget *parent, const QVariantList &args)
- : KCModule(PowerDevilActivitiesKCMFactory::componentData(), parent, args)
+ : KCModule(0, parent, args)
, m_activityConsumer(new KActivities::Consumer(this))
{
setButtons(Apply | Help);
- KAboutData *about =
+ /*KAboutData *about =
new KAboutData("powerdevilactivitiesconfig", "powerdevilactivitiesconfig", ki18n("Activities Power Management Configuration"),
"", ki18n("A per-activity configurator of KDE Power Management System"),
KAboutData::License_GPL, ki18n("(c), 2010 Dario Freddi"),
@@ -64,35 +66,12 @@
about->addAuthor(ki18n("Dario Freddi"), ki18n("Maintainer") , "drf@kde.org",
"http://drfav.wordpress.com");
- setAboutData(about);
+ setAboutData(about);*/
// Build the UI
- KTabWidget *tabWidget = new KTabWidget();
+ m_tabWidget = new QTabWidget();
QVBoxLayout *lay = new QVBoxLayout();
- foreach (const QString &activity, m_activityConsumer->listActivities()) {
- KActivities::Info *info = new KActivities::Info(activity, this);
- QString icon = info->icon();
- QString name = info->name();
- qCDebug(POWERDEVIL) << activity << info->isValid() << info->availability();
-
- QScrollArea *scrollArea = new QScrollArea();
- scrollArea->setFrameShape(QFrame::NoFrame);
- scrollArea->setFrameShadow(QFrame::Plain);
- scrollArea->setLineWidth(0);
- scrollArea->setWidgetResizable(true);
-
- ActivityWidget *activityWidget = new ActivityWidget(activity);
- scrollArea->setWidget(activityWidget);
-
- activityWidget->load();
- m_activityWidgets.append(activityWidget);
-
- connect(activityWidget, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)));
-
- tabWidget->addTab(scrollArea, QIcon::fromTheme(icon), name);
- }
-
// Message widget
m_messageWidget = new KMessageWidget(i18n("The activity service is running with bare functionalities.\n"
"Names and icons of the activities might not be available."));
@@ -100,12 +79,11 @@
m_messageWidget.data()->hide();
lay->addWidget(m_messageWidget.data());
- lay->addWidget(tabWidget);
+ lay->addWidget(m_tabWidget);
setLayout(lay);
- connect(m_activityConsumer, SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)),
- this, SLOT(onActivityServiceStatusChanged(KActivities::Consumer::ServiceStatus)));
onActivityServiceStatusChanged(m_activityConsumer->serviceStatus());
+ connect(m_activityConsumer, &KActivities::Consumer::serviceStatusChanged, this, &ActivityPage::onActivityServiceStatusChanged);
QDBusServiceWatcher *watcher = new QDBusServiceWatcher("org.kde.Solid.PowerManagement",
QDBusConnection::sessionBus(),
@@ -161,6 +139,7 @@
void ActivityPage::onActivityServiceStatusChanged(KActivities::Consumer::ServiceStatus status)
{
switch (status) {
+ case KActivities::Consumer::Unknown: // fall through
case KActivities::Consumer::NotRunning:
// Create error overlay, if not present
if (m_errorOverlay.isNull()) {
@@ -170,25 +149,69 @@
this);
}
break;
- case KActivities::Consumer::BareFunctionality:
- // Show message widget
- m_messageWidget.data()->show();
- break;
- case KActivities::Consumer::FullFunctionality:
- if (m_previousServiceStatus != KActivities::Consumer::FullFunctionality &&
- !m_errorOverlay.isNull()) {
- m_errorOverlay.data()->deleteLater();
- if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.Solid.PowerManagement")) {
- onServiceRegistered("org.kde.Solid.PowerManagement");
- } else {
- onServiceUnregistered("org.kde.Solid.PowerManagement");
+ case KActivities::Consumer::Running:
+ if (m_previousServiceStatus != KActivities::Consumer::Running) {
+
+ if (!m_errorOverlay.isNull()) {
+ m_errorOverlay.data()->deleteLater();
+ if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.Solid.PowerManagement")) {
+ onServiceRegistered("org.kde.Solid.PowerManagement");
+ } else {
+ onServiceUnregistered("org.kde.Solid.PowerManagement");
+ }
}
+
+ populateTabs();
}
+
if (m_messageWidget.data()->isVisible()) {
m_messageWidget.data()->hide();
}
+
break;
}
+
+ m_previousServiceStatus = status;
+}
+
+void ActivityPage::populateTabs()
+{
+ if (m_activityConsumer->serviceStatus() != KActivities::Consumer::Running) {
+ return;
+ }
+
+ int index = 0;
+ foreach (const QString &activity, m_activityConsumer->activities()) {
+ KActivities::Info *info = new KActivities::Info(activity, this);
+ const QString icon = info->icon();
+ const QString name = info->name();
+ qCDebug(POWERDEVIL) << activity << info->isValid() << info->availability();
+
+ QScrollArea *scrollArea = new QScrollArea();
+ scrollArea->setFrameShape(QFrame::NoFrame);
+ scrollArea->setFrameShadow(QFrame::Plain);
+ scrollArea->setLineWidth(0);
+ scrollArea->setWidgetResizable(true);
+
+ ActivityWidget *activityWidget = new ActivityWidget(activity);
+ scrollArea->setWidget(activityWidget);
+
+ activityWidget->load();
+ m_activityWidgets.append(activityWidget);
+
+ connect(activityWidget, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)));
+ if (!icon.isEmpty()) {
+ m_tabWidget->addTab(scrollArea, QIcon::fromTheme(icon), name);
+ } else {
+ m_tabWidget->addTab(scrollArea, name);
+ }
+
+ if (m_activityConsumer->currentActivity() == activity) {
+ m_tabWidget->setCurrentIndex(index);
+ }
+
+ ++index;
+ }
}
void ActivityPage::defaults()
@@ -203,8 +226,6 @@
if (!m_errorOverlay.isNull()) {
m_errorOverlay.data()->deleteLater();
}
-
- onActivityServiceStatusChanged(m_activityConsumer->serviceStatus());
}
void ActivityPage::onServiceUnregistered(const QString& service)
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/activities/activitypage.h
^
|
@@ -25,9 +25,13 @@
#include <KActivities/Consumer>
+class QTabWidget;
+
+class KMessageWidget;
+
class ErrorOverlay;
class ActivityWidget;
-class KMessageWidget;
+
class ActivityPage : public KCModule
{
Q_OBJECT
@@ -47,6 +51,10 @@
void onServiceUnregistered(const QString &service);
private:
+ void populateTabs();
+
+ QTabWidget *m_tabWidget;
+
KActivities::Consumer *m_activityConsumer;
QList< ActivityWidget* > m_activityWidgets;
QWeakPointer< ErrorOverlay > m_errorOverlay;
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/activities/activitywidget.cpp
^
|
@@ -22,8 +22,9 @@
#include "ui_activityWidget.h"
-#include "daemon/actions/bundled/suspendsession.h"
+#include "../daemon/actions/bundled/suspendsession.h"
+#include <KConfigGroup>
#include <KActivities/Consumer>
#include <Solid/PowerManagement>
#include <actioneditwidget.h>
@@ -106,7 +107,7 @@
m_ui->actLikeComboBox->addItem(QIcon::fromTheme("battery-060"), i18n("PC running on battery power"), "Battery");
m_ui->actLikeComboBox->addItem(QIcon::fromTheme("battery-low"), i18n("PC running on low battery"), "LowBattery");
- foreach (const QString &activity, m_activityConsumer->listActivities()) {
+ foreach (const QString &activity, m_activityConsumer->activities()) {
if (activity == m_activity) {
continue;
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/activities/powerdevilactivitiesconfig.desktop
^
|
@@ -13,6 +13,7 @@
Name=Activity Settings
Name[ar]=إعدادات الأنشطة
+Name[bs]=Postavke aktivnosti
Name[ca]=Arranjament d'activitat
Name[cs]=Nastavení aktivit
Name[da]=Aktivitetsindstillinger
@@ -53,6 +54,7 @@
Comment=Per-Activity Power Management
Comment[ar]=إدارة طاقة ما قبل الأحداث
+Comment[bs]=Upravljitej napajanjem po aktivnosti
Comment[ca]=Gestió d'energia per activitat
Comment[cs]=Správa napájení pro činnost
Comment[da]=Strømstyring pr. aktivitet
@@ -61,10 +63,12 @@
Comment[en_GB]=Per-Activity Power Management
Comment[es]=Gestión de energía por actividad
Comment[fi]=Aktiviteettikohtainen virranhallinta
+Comment[fr]=Gestion de l'énergie par activité
Comment[gl]=Xestión da enerxía para cada actividade
Comment[hu]=Aktivitásonkénti energiakezelési
Comment[ia]=Gestion de energia per activitate
Comment[id]=Manajemen Daya Per-Aktivitas
+Comment[it]=Gestione energetica per attività
Comment[ko]=활동별 전원 관리
Comment[lt]=Atskiros veiklos energijos tvarkymas
Comment[nb]=Sett opp strømstyring per aktivitet
@@ -81,12 +85,15 @@
Comment[sr@ijekavianlatin]=Upravljanje napajanjem prema aktivnosti
Comment[sr@latin]=Upravljanje napajanjem prema aktivnosti
Comment[sv]=Strömhantering per aktivitet
+Comment[tr]=Tüm Etkinlik Güç Yönetimi
Comment[uk]=Налаштування окремих параметрів керування живленням простору дій
Comment[x-test]=xxPer-Activity Power Managementxx
Comment[zh_CN]=基于活动的电源管理
+Comment[zh_TW]=個別活動的電源管理
X-KDE-Keywords=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities
X-KDE-Keywords[ar]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,نظام,النظام,طاقة,الطاقة,إدارة الطاقة,ادارة الطاقة, لابتوب,حاسوب محمول,محمول,سطوع,إضاءة,اضاءة,تعليق,علق,نم,نوم,أسبت,اسبت,اسبات,إسبات,أداء,اداء,الأداء,نشاط,جدث,أنشطة,أحداث,
+X-KDE-Keywords[bs]=sistem, Napajanje, Upravljanje napajanjem, energija, laptop, baterija, suspenzija, AC, suspendiraj, hiberniranje, osvljetljenje, perfomanse, kapak, aktivnost, aktivnosti
X-KDE-Keywords[ca]=sistema,energia,gestió d'energia,corrent,portàtil,bateria,suspensió,AC,suspendre,hibernació,lluminositat,rendiment,tapa,activitat,activitats
X-KDE-Keywords[da]=system,strøm,strømstyring,energi,laptop,bærbar,batteri,suspension,AC,strømforsyning,suspender,slumre,dvale,lysstyrke,ydelse,låg,aktivitet,aktiviteter
X-KDE-Keywords[de]=system,energie,energieverwaltung,laptop,notebook,akku,batterie,ruhezustand,tiefschlaf,helligkeit,leistung,deckel,aktivität
@@ -95,7 +102,7 @@
X-KDE-Keywords[es]=sistema,energía,gestión de energía,portátil,laptop,batería,suspensión,AC,suspender,hibernar,brillo,rendimiento,tapa,actividad,actividades
X-KDE-Keywords[fi]=järjestelmä,virta,virranhallinta,energia,kannettava,tietokone,läppäri,akku,lepotila,valmiustila,keskeytä,AC,virtalähde,kirkkaus,suorituskyky,kansi,aktiviteetti,aktiviteetit
X-KDE-Keywords[fr]=système, alimentation, gestion énergétique, énergie, portable, batterie, suspension, AC, suspendre, hiberner, luminosité, performance, capot, activité, activités
-X-KDE-Keywords[gl]=sistema,enerxía,xestión da enerxía, xestión enerxética,carga,portátil,suspensión,batería,pila,suspender,corrente,hibernar,hibernación,durmir,brillo,rendemento,luz,tapa,actividade,actividades
+X-KDE-Keywords[gl]=sistema,enerxía,xestión da enerxía, xestión enerxética,carga,portátil,batería, suspender,corrente,hibernar,durmir,brillo,rendemento,tapa,actividade
X-KDE-Keywords[hu]=rendszer,energia,energiakezelés,energia,laptop,akkumulátor,AC,felfüggesztés,hibernálás,fényerő,teljesítmény,fedél,aktivitás,aktivitások
X-KDE-Keywords[ia]=systema,potentia,gestion de potentia,energia,laptop,batteria,suspension,CA,suspende,hiberna,brillantia,prestation,coperculo,activitate,activitates
X-KDE-Keywords[id]=sistem,daya,manajemen daya,energi,laptop,batterai,suspensi,AC,suspen,hibernasi,kecerahan,kinerja,penutup,activitas,kegiatan
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/common/actionconfigwidget.cpp
^
|
@@ -57,6 +57,13 @@
currentSectionCheckbox = qobject_cast<QCheckBox*>(line.second);
currentSectionCheckbox->setChecked(true);
m_gridLayout->addWidget(line.second, row, 0, 1, 3);
+
+ // allow left-aligning checkboxes without treating them as section header
+ } else if (line.first == QLatin1String("NONE")) {
+ m_gridLayout->addItem(new QSpacerItem(50 ,3), row, 0);
+ m_gridLayout->addWidget(line.second, row, 1, Qt::AlignRight);
+ //m_gridLayout->addWidget(line.second, row, 1, 2, 1, Qt::AlignRight);
+
} else {
// connect enabled / disabled
QLabel* label = new QLabel(this);
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/global/GeneralPage.cpp
^
|
@@ -46,14 +46,9 @@
registerPlugin<GeneralPage>();
)
-typedef QMap< QString, QString > StringStringMap;
-Q_DECLARE_METATYPE(StringStringMap)
-
GeneralPage::GeneralPage(QWidget *parent, const QVariantList &args)
: KCModule(0, parent, args)
{
- qDBusRegisterMetaType< StringStringMap >();
-
setButtons(Apply | Help);
// KAboutData *about =
@@ -119,8 +114,6 @@
// modified fields...
- connect(doNotInhibitLid, SIGNAL(stateChanged(int)), SLOT(changed()));
-
connect(notificationsButton, SIGNAL(clicked()), SLOT(configureNotifications()));
connect(lowSpin, SIGNAL(valueChanged(int)), SLOT(changed()));
@@ -143,8 +136,6 @@
void GeneralPage::load()
{
- doNotInhibitLid->setChecked(PowerDevilSettings::doNotInhibitOnLidClose());
-
lowSpin->setValue(PowerDevilSettings::batteryLowLevel());
criticalSpin->setValue(PowerDevilSettings::batteryCriticalLevel());
@@ -158,8 +149,6 @@
void GeneralPage::save()
{
- PowerDevilSettings::setDoNotInhibitOnLidClose(doNotInhibitLid->isChecked());
-
PowerDevilSettings::setBatteryLowLevel(lowSpin->value());
PowerDevilSettings::setBatteryCriticalLevel(criticalSpin->value());
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/global/generalPage.ui
^
|
@@ -6,28 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
- <width>635</width>
- <height>370</height>
+ <width>494</width>
+ <height>276</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>8</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
@@ -142,40 +126,7 @@
</property>
</spacer>
</item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string><b>Events</b></string>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QCheckBox" name="doNotInhibitLid">
- <property name="toolTip">
- <string>When this option is selected, applications will not be allowed to inhibit sleep when the lid is closed</string>
- </property>
- <property name="whatsThis">
- <string>When this option is selected, applications will not be allowed to inhibit sleep when the lid is closed</string>
- </property>
- <property name="text">
- <string>Never prevent an action on lid close</string>
- </property>
- </widget>
- </item>
- <item row="7" column="1">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>8</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="8" column="1">
+ <item row="5" column="1">
<widget class="QPushButton" name="notificationsButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
@@ -196,6 +147,22 @@
</item>
</layout>
</item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>8</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
<customwidgets>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/global/powerdevilglobalconfig.desktop
^
|
@@ -13,6 +13,7 @@
Name=Advanced Settings
Name[ar]=الإعدادات المتقدمة
+Name[bs]=Napredne postavke
Name[ca]=Arranjament avançat
Name[cs]=Pokročilá nastavení
Name[da]=Avancerede indstillinger
@@ -53,6 +54,7 @@
Comment=Advanced Power Management Settings
Comment[ar]=إعدادات إدارة الطاقة المتقدمة
+Comment[bs]=Postavke naprednog upravljanja napajanjem
Comment[ca]=Arranjament avançat de gestió d'energia
Comment[cs]=Pokročilé nastavení správy napájení
Comment[da]=Indstil avanceret strømstyring
@@ -61,10 +63,12 @@
Comment[en_GB]=Advanced Power Management Settings
Comment[es]=Preferencias avanzadas de la gestión de energía
Comment[fi]=Virranhallinnan lisäasetukset
-Comment[gl]=Configuración da xestión avanzada da enerxía
+Comment[fr]=Configuration avancée de la gestion de l'énergie
+Comment[gl]=Xestión avanzada da enerxía
Comment[hu]=Speciális energiakezelési beállítások
Comment[ia]=Preferentias avantiate de gestion de energia
Comment[id]=Pengaturan Manajemen Daya Tingkat Lanjut
+Comment[it]=Impostazioni avanzate della gestione energetica
Comment[ko]=고급 전원 관리 설정
Comment[lt]=Išsamesni energijos tvarkymo nustatymai
Comment[nb]=Avanserte strømstyringsinnstillinger
@@ -82,12 +86,15 @@
Comment[sr@ijekavianlatin]=Napredne postavke za upravljanje napajanjem
Comment[sr@latin]=Napredne postavke za upravljanje napajanjem
Comment[sv]=Avancerade inställningar av strömhantering
+Comment[tr]=Gelişmiş Güç Yönetimi Ayarları
Comment[uk]=Налаштування додаткових параметрів керування живленням
Comment[x-test]=xxAdvanced Power Management Settingsxx
Comment[zh_CN]=高级电源管理设置
+Comment[zh_TW]=進階電源管理設定
X-KDE-Keywords=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid
X-KDE-Keywords[ar]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,نظام,النظام,طاقة,الطاقة,إدارة الطاقة,ادارة الطاقة, لابتوب,حاسوب محمول,محمول,سطوع,إضاءة,اضاءة,تعليق,علق,نم,نوم,أسبت,اسبت,اسبات,إسبات,أداء,اداء,الأداء,نشاط,جدث,أنشطة,أحداث,
+X-KDE-Keywords[bs]=sistem, Napajanje, Upravljanje napajanjem, energija, laptop, baterija, suspenzija, AC, suspendiraj, hiberniranje, osvljetljenje, kapak
X-KDE-Keywords[ca]=sistema,energia,gestió d'energia,corrent,portàtil,bateria,suspensió,AC,suspèn,hiberna,lluminositat,rendiment,tapa
X-KDE-Keywords[da]=system,strøm,strømstyring,energi,laptop,bærbar,batteri,suspension,AC,strømforsyning,suspender,slumre,dvale,lysstyrke,ydelse,låg
X-KDE-Keywords[de]=system,energie,energieverwaltung,laptop,notebook,akku,batterie,ruhezustand,tiefschlaf,helligkeit,leistung,deckel
@@ -96,7 +103,7 @@
X-KDE-Keywords[es]=sistema,energía,gestión de energía,portátil,laptop,batería,suspensión,AC,suspender,hibernar,brillo,rendimiento,tapa
X-KDE-Keywords[fi]=järjestelmä,virta,virranhallinta,energia,kannettava,tietokone,läppäri,akku,lepotila,valmiustila,AC,virtalähde,keskeytä,kirkkaus,suorituskyky,kansi
X-KDE-Keywords[fr]=système, alimentation, gestion énergétique, énergie, portable, batterie, suspension, AC, suspendre, hiberner, luminosité, performance, capot
-X-KDE-Keywords[gl]=sistema,enerxía,xestión da enerxía, xestión enerxética,carga,portátil,suspensión,batería,pila,suspender,corrente,hibernar,hibernación,durmir,brillo,rendemento,luz,tapa
+X-KDE-Keywords[gl]=sistema,enerxía,xestión da enerxía, xestión enerxética,carga,portátil,batería, suspender,corrente,hibernar,durmir,brillo,rendemento,tapa
X-KDE-Keywords[hu]=rendszer,energia,energiakezelés,energia,laptop,akkumulátor,AC,felfüggesztés,hibernálás,fényerő,teljesítmény,fedél
X-KDE-Keywords[ia]=systema,potentia,gestion de potentia,energia,laptop,batteria,suspension,CA,suspende,hiberna,brillantia,prestation,coperculo
X-KDE-Keywords[id]=sistem,daya,manajemen daya,energi,laptop,baterai,suspensi, AC,suspen,hibernasi,kecerahan,kinerja,penutup
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/profiles/EditPage.cpp
^
|
@@ -39,11 +39,8 @@
#include <QtDBus/QDBusServiceWatcher>
#include <KConfigGroup>
-#include <KLineEdit>
#include <QDebug>
#include <KMessageBox>
-#include <KIconButton>
-#include <KToolBar>
#include <KAboutData>
#include <KPluginFactory>
#include <KSharedConfig>
@@ -59,14 +56,9 @@
registerPlugin<EditPage>();
)
-typedef QMap< QString, QString > StringStringMap;
-Q_DECLARE_METATYPE(StringStringMap)
-
EditPage::EditPage(QWidget *parent, const QVariantList &args)
: KCModule(0, parent, args)
{
- qDBusRegisterMetaType< StringStringMap >();
-
setButtons(Apply | Help | Default);
// KAboutData *about =
@@ -137,7 +129,7 @@
if (!hasBattery) {
tabWidget->setTabEnabled(1, false);
tabWidget->setTabEnabled(2, false);
- tabWidget->setTabBarHidden(true);
+ tabWidget->tabBar()->hide();
}
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.Solid.PowerManagement")) {
@@ -147,10 +139,6 @@
}
}
-EditPage::~EditPage()
-{
-}
-
void EditPage::onChanged(bool value)
{
ActionEditWidget *editWidget = qobject_cast< ActionEditWidget* >(sender());
@@ -180,52 +168,25 @@
void EditPage::save()
{
- QStringList profiles;
-
- for (QHash< QString, ActionEditWidget* >::const_iterator i = m_editWidgets.constBegin();
- i != m_editWidgets.constEnd(); ++i) {
- i.value()->save();
- if (m_profileEdited[i.value()->configName()]) {
- profiles.append(i.value()->configName());
- }
-
- m_profileEdited[i.value()->configName()] = false;
+ for (auto it = m_editWidgets.constBegin(); it != m_editWidgets.constEnd(); ++it) {
+ (*it)->save();
}
- // Notify the daemon
- notifyDaemon(profiles);
+
+ notifyDaemon();
emit changed(false);
}
-void EditPage::notifyDaemon(const QStringList &editedProfiles)
+void EditPage::notifyDaemon()
{
- QDBusMessage call;
- if (!editedProfiles.isEmpty()) {
- call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement",
- "org.kde.Solid.PowerManagement", "currentProfile");
- QDBusPendingReply< QString > reply = QDBusConnection::sessionBus().asyncCall(call);
- reply.waitForFinished();
-
- if (reply.isValid()) {
- if (!editedProfiles.contains(reply.value())) {
- // Ask to reparse config
- qCDebug(POWERDEVIL) << "Inactive profile edited, reparsing configuration";
- call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement",
- "org.kde.Solid.PowerManagement", "reparseConfiguration");
-
- // Perform call
- QDBusConnection::sessionBus().asyncCall(call);
- return;
- }
- }
- }
-
- // Refresh status
- call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement",
- "org.kde.Solid.PowerManagement", "refreshStatus");
-
- // Perform call
- QDBusConnection::sessionBus().asyncCall(call);
+ QDBusConnection::sessionBus().asyncCall(
+ QDBusMessage::createMethodCall(
+ QStringLiteral("org.kde.Solid.PowerManagement"),
+ QStringLiteral("/org/kde/Solid/PowerManagement"),
+ QStringLiteral("org.kde.Solid.PowerManagement"),
+ QStringLiteral("refreshStatus")
+ )
+ );
}
void EditPage::restoreDefaultProfiles()
@@ -245,7 +206,6 @@
load();
- // Notify the daemon
notifyDaemon();
}
}
@@ -277,6 +237,30 @@
{
Q_UNUSED(service);
+ QDBusPendingCallWatcher *currentProfileWatcher = new QDBusPendingCallWatcher(QDBusConnection::sessionBus().asyncCall(
+ QDBusMessage::createMethodCall(
+ QStringLiteral("org.kde.Solid.PowerManagement"),
+ QStringLiteral("/org/kde/Solid/PowerManagement"),
+ QStringLiteral("org.kde.Solid.PowerManagement"),
+ QStringLiteral("currentProfile")
+ )
+ ), this);
+
+ QObject::connect(currentProfileWatcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<QString> reply = *watcher;
+
+ if (!reply.isError()) {
+ const QString ¤tProfile = reply.value();
+ if (currentProfile == QLatin1String("Battery")) {
+ tabWidget->setCurrentIndex(1);
+ } else if (currentProfile == QLatin1String("LowBattery")) {
+ tabWidget->setCurrentIndex(2);
+ }
+ }
+
+ watcher->deleteLater();
+ });
+
if (!m_errorOverlay.isNull()) {
m_errorOverlay.data()->deleteLater();
}
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/profiles/EditPage.h
^
|
@@ -21,9 +21,10 @@
#define EDITPAGE_H
#include <KCModule>
+#include <KSharedConfig>
#include "ui_profileEditPage.h"
-#include <KSharedConfig>
+
class ActionEditWidget;
namespace PowerDevil {
class ActionConfig;
@@ -39,7 +40,7 @@
public:
explicit EditPage(QWidget *parent, const QVariantList &args);
- ~EditPage();
+ virtual ~EditPage() = default;
void load();
void save();
@@ -50,7 +51,7 @@
void restoreDefaultProfiles();
- void notifyDaemon(const QStringList &editedProfiles = QStringList());
+ void notifyDaemon();
void openUrl(const QString &url);
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/profiles/powerdevilprofilesconfig.desktop
^
|
@@ -9,14 +9,15 @@
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=power-management
-X-KDE-Weight=1
+X-KDE-Weight=3
Name=Energy Saving
Name[ar]=حِفظ الطاقة
+Name[bs]=Štednja energije
Name[ca]=Estalvi d'energia
Name[cs]=Úsporný režim
Name[da]=Strømbesparelse
-Name[de]=Energiesparen
+Name[de]=Energiesparmodus
Name[el]=Εξοικονόμηση ενέργειας
Name[en_GB]=Energy Saving
Name[es]=Ahorro de energía
@@ -53,6 +54,7 @@
Comment=Energy Saving
Comment[ar]=حِفظ الطاقة
+Comment[bs]=Štednja energije
Comment[ca]=Estalvi d'energia
Comment[cs]=Úsporný režim
Comment[da]=Strømbesparelse
@@ -66,6 +68,7 @@
Comment[hu]=Energiatakarékosság
Comment[ia]=Sparnio de energia
Comment[id]=Hemat Energi
+Comment[it]=Risparmio energetico
Comment[ko]=에너지 절약
Comment[lt]=Energijos taupymas
Comment[nb]=Energisparing
@@ -83,12 +86,15 @@
Comment[sr@ijekavianlatin]=Štednja energije
Comment[sr@latin]=Štednja energije
Comment[sv]=Strömsparhantering
+Comment[tr]=Güç Tasarrufu
Comment[uk]=Заощадження енергії
Comment[x-test]=xxEnergy Savingxx
Comment[zh_CN]=节能
+Comment[zh_TW]=省電模式
X-KDE-Keywords=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid
X-KDE-Keywords[ar]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,نظام,النظام,طاقة,الطاقة,إدارة الطاقة,ادارة الطاقة, لابتوب,حاسوب محمول,محمول,سطوع,إضاءة,اضاءة,تعليق,علق,نم,نوم,أسبت,اسبت,اسبات,إسبات,أداء,اداء,الأداء,نشاط,جدث,أنشطة,أحداث,
+X-KDE-Keywords[bs]=sistem, Napajanje, Upravljanje napajanjem, energija, laptop, baterija, suspenzija, AC, suspendiraj, hiberniranje, osvljetljenje, kapak
X-KDE-Keywords[ca]=sistema,energia,gestió d'energia,corrent,portàtil,bateria,suspensió,AC,suspèn,hiberna,lluminositat,rendiment,tapa
X-KDE-Keywords[da]=system,strøm,strømstyring,energi,laptop,bærbar,batteri,suspension,AC,strømforsyning,suspender,slumre,dvale,lysstyrke,ydelse,låg
X-KDE-Keywords[de]=system,energie,energieverwaltung,laptop,notebook,akku,batterie,ruhezustand,tiefschlaf,helligkeit,leistung,deckel
@@ -97,7 +103,7 @@
X-KDE-Keywords[es]=sistema,energía,gestión de energía,portátil,laptop,batería,suspensión,AC,suspender,hibernar,brillo,rendimiento,tapa
X-KDE-Keywords[fi]=järjestelmä,virta,virranhallinta,energia,kannettava,tietokone,läppäri,akku,lepotila,valmiustila,AC,virtalähde,keskeytä,kirkkaus,suorituskyky,kansi
X-KDE-Keywords[fr]=système, alimentation, gestion énergétique, énergie, portable, batterie, suspension, AC, suspendre, hiberner, luminosité, performance, capot
-X-KDE-Keywords[gl]=sistema,enerxía,xestión da enerxía, xestión enerxética,carga,portátil,suspensión,batería,pila,suspender,corrente,hibernar,hibernación,durmir,brillo,rendemento,luz,tapa
+X-KDE-Keywords[gl]=sistema,enerxía,xestión da enerxía, xestión enerxética,carga,portátil,batería, suspender,corrente,hibernar,durmir,brillo,rendemento,tapa
X-KDE-Keywords[hu]=rendszer,energia,energiakezelés,energia,laptop,akkumulátor,AC,felfüggesztés,hibernálás,fényerő,teljesítmény,fedél
X-KDE-Keywords[ia]=systema,potentia,gestion de potentia,energia,laptop,batteria,suspension,CA,suspende,hiberna,brillantia,prestation,coperculo
X-KDE-Keywords[id]=sistem,daya,manajemen daya,energi,laptop,baterai,suspensi, AC,suspen,hibernasi,kecerahan,kinerja,penutup
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/kcmodule/profiles/profileEditPage.ui
^
|
@@ -12,7 +12,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="KTabWidget" name="tabWidget">
+ <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
@@ -50,14 +50,6 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>KTabWidget</class>
- <extends>QTabWidget</extends>
- <header>ktabwidget.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<resources/>
<connections/>
</ui>
|
[-]
[+]
|
Changed |
powerdevil-5.3.0.tar.xz/powerdevil.notifyrc
^
|
@@ -1,6 +1,7 @@
[Global]
Name=KDE Power Management System
Name[ar]=نظام إدارة طاقة كدي
+Name[bs]=KDE‑ov sistem za upravljanje napajanjem
Name[ca]=Sistema de gestió d'energia del KDE
Name[cs]=Systém správy napájení KDE
Name[da]=KDE's strømstyringssystem
@@ -42,6 +43,7 @@
IconName=preferences-system-power-management
Comment=Power Management System
Comment[ar]=نظام إدارة الطاقة
+Comment[bs]=Sistem za upravljanje napajanjem
Comment[ca]=Sistema de gestió d'energia
Comment[cs]=Systém správy napájení
Comment[da]=Strømstyringssystem
@@ -84,6 +86,7 @@
[Context/warningnot]
Name=Warning
Name[ar]=تحذير
+Name[bs]=Upozorenje
Name[ca]=Avís
Name[cs]=Varování
Name[da]=Advarsel
@@ -92,6 +95,7 @@
Name[en_GB]=Warning
Name[es]=Advertencia
Name[fi]=Varoitus
+Name[fr]=Avertissement
Name[gl]=Aviso
Name[hu]=Figyelem
Name[ia]=Aviso
@@ -122,6 +126,7 @@
Name[zh_TW]=警告
Comment=Used for warning notifications
Comment[ar]=يُتسخدَم لتنبيهات التحذير
+Comment[bs]=Koristi se za obavještenja o upozorenjima
Comment[ca]=S'usa per a les notificacions d'avís
Comment[cs]=Použito pro varování a upozornění
Comment[da]=Bruges til advarselsbekendtgørelser
@@ -130,7 +135,8 @@
Comment[en_GB]=Used for warning notifications
Comment[es]=Usado para notificaciones de advertencia
Comment[fi]=Käytetään varoitusilmoituksiin
-Comment[gl]=Emprégase para as notificacións de aviso.
+Comment[fr]=Utilisé pour les notifications d'avertissement
+Comment[gl]=Emprégase para as notificacións de aviso
Comment[hu]=Kezelőprogram figyelmeztető üzenetekhez
Comment[ia]=Usate pro notificationes de avisos
Comment[id]=Digunakan untuk pemberitahuan peringatan
@@ -162,6 +168,7 @@
[Context/stdnot]
Name=Notification
Name[ar]=تنبيه
+Name[bs]=Obavještenje
Name[ca]=Notificació
Name[cs]=Hlášení
Name[da]=Bekendtgørelse
@@ -204,6 +211,7 @@
Name[zh_TW]=通知
Comment=Used for standard notifications
Comment[ar]=يُستخدَم للتنبيهات الاعتيادية
+Comment[bs]=Koristi se za standardna obavještenja
Comment[ca]=S'usa per a les notificacions estàndard
Comment[cs]=Použito pro běžná oznámení
Comment[da]=Bruges til almindelige bekendtgørelser
@@ -213,7 +221,7 @@
Comment[es]=Usado para notificaciones estándar
Comment[fi]=Käytetään normaaleihin ilmoituksiin
Comment[fr]=Utilisé pour les notifications standards
-Comment[gl]=Emprégase para as notificacións estándar.
+Comment[gl]=Emprégase para as notificacións estándar
Comment[hu]=Kezelő értesítő üzenetekhez
Comment[ia]=Usate pro notificationes standard
Comment[id]=Digunakan untuk pemberitahuan standar
@@ -247,6 +255,7 @@
[Context/criticalnot]
Name=Critical notification
Name[ar]=تحذير حَرِج
+Name[bs]=Kritično obavještenje
Name[ca]=Notificacions crítiques
Name[cs]=Kritické hlášení
Name[da]=Kritisk bekendtgørelse
@@ -288,6 +297,7 @@
Name[zh_TW]=緊急通知
Comment=Notifies a critical event
Comment[ar]=يُنبِّه عن حدث حَرِج
+Comment[bs]=Obavještava o kritičnom događaju
Comment[ca]=Notifiquen esdeveniments crítics
Comment[cs]=Upozorňuje na kritickou událost
Comment[da]=Bekendtgør en kritisk begivenhed
@@ -297,7 +307,7 @@
Comment[es]=Notifica de un evento crítico
Comment[fi]=Ilmoittaa kriittisestä tapahtumasta
Comment[fr]=Notifie un évènement critique
-Comment[gl]=Notifica un suceso crítico.
+Comment[gl]=Notifica un suceso crítico
Comment[hu]=Kritikus fontosságú üzenetet jelez
Comment[ia]=Il notifica un evento critic
Comment[id]=Pemberitahu kejadian kritis
@@ -331,6 +341,7 @@
[Event/lowbattery]
Name=Battery Low
Name[ar]=البطارية منخفضة
+Name[bs]=Nizak nivo baterije
Name[ca]=Bateria baixa
Name[cs]=Baterie je téměř vybitá
Name[da]=Lavt batteri
@@ -370,6 +381,7 @@
Name[zh_TW]=電池電力偏低
Comment=Your battery has reached low level
Comment[ar]=وصلت بطاريتك إلى مستوى منخفض
+Comment[bs]=Baterija je dosegla nizak nivo
Comment[ca]=La bateria ha arribat al nivell baix
Comment[cs]=Baterie dosáhla nízké úrovně
Comment[da]=Dit batteri har nået lavt niveau
@@ -379,7 +391,7 @@
Comment[es]=La batería ha alcanzado un nivel bajo
Comment[fi]=Akku on vähissä
Comment[fr]=Votre batterie a atteint un niveau bas
-Comment[gl]=A batería acadou o nivel de carga baixo.
+Comment[gl]=A batería acadou o nivel de carga baixa
Comment[hu]=A telepek feltöltöttsége alacsony szintű
Comment[ia]=Tu batteria ha attingite nivello basse
Comment[id]=Baterai anda telah mencapai level rendah
@@ -417,6 +429,7 @@
[Event/criticalbattery]
Name=Battery Critical
Name[ar]=البطارية حَرِجة
+Name[bs]=Baterija kritična
Name[ca]=Bateria crítica
Name[cs]=Baterie na kritické úrovni
Name[da]=Kritisk batteri
@@ -456,6 +469,7 @@
Name[zh_TW]=電池電力嚴重不足
Comment=Your battery has reached critical level. This notification triggers a countdown before doing the configured action, hence it is strongly advised to leave that on.
Comment[ar]=وصلت بطاريتك إلى مستوى حرج. يُفعِّل هذا التنبيه عدًّا تنازليًّا قبل تنفيذ حَدَث، حيث يُنصّح بشدّة إبقاء هذا الخيار مفعّلاً.
+Comment[bs]=Popunjenost baterija je spala na kritičan nivo. Ovo obavještenje okida odbrojavanje prije izvođenja podešene radnje, stoga vam ozbiljno savetujemo da ga ostavite uključenim.
Comment[ca]=La bateria ha arribat al nivell crític. Aquesta notificació activa un compte enrere abans d'efectuar l'acció configurada, per tant, es recomana deixar-ho actiu.
Comment[cs]=Baterie dosáhla kritické úrovně. Tímto upozorněním se spustí odpočet a následně se provede nastavená činnost, proto je doporučeno nezasahovat.
Comment[da]=Dit batteri har nået kritisk niveau. Denne bekendtgørelse udløser en nedtælling før den konfigurerede handling udføres, derfor anbefales det kraftigt at lade den være slået til.
@@ -503,6 +517,7 @@
[Event/fullbattery]
Name=Charge Complete
Name[ar]=تمَّ الشحن
+Name[bs]=Gotovo punjenje
Name[ca]=Càrrega completada
Name[cs]=Nabití bylo dokončeno
Name[da]=Opladning fuldført
@@ -542,6 +557,7 @@
Name[zh_TW]=充電完成
Comment=The battery is fully charged
Comment[ar]=البطارية مشحونة بالكامل
+Comment[bs]=Baterija je potpuno puna
Comment[ca]=La bateria està totalment carregada
Comment[cs]=Baterie je plně nabitá
Comment[da]=Batteriet er fuldt opladet
@@ -551,7 +567,7 @@
Comment[es]=La batería está completamente cargada
Comment[fi]=Akku on ladattu täyteen
Comment[fr]=La batterie est totalement chargée
-Comment[gl]=A batería ten a carga completa.
+Comment[gl]=A batería ten a carga completa
Comment[hu]=Az akkumulátor teljesen feltöltve
Comment[ia]=Le batteria es cargate completemente
Comment[id]=Baterai sudah terisi penuh
@@ -587,6 +603,7 @@
[Event/pluggedin]
Name=AC adaptor plugged in
Name[ar]=وُصِلَ محوِّل الكهرباء
+Name[bs]=AC adapter utaknut
Name[ca]=Adaptador de CA endollat
Name[cs]=AC adaptér zapojen
Name[da]=Strømforsyning tilsluttet
@@ -628,6 +645,7 @@
Name[zh_TW]=AC 電源已插入
Comment=The power adaptor has been plugged in
Comment[ar]=تم توصيل محوِّل الكهرباء
+Comment[bs]=Utaknut je adapter napajanja
Comment[ca]=L'adaptador de corrent s'ha endollat
Comment[cs]=Zdroj napájení byl připojen
Comment[da]=Strømforsyningen er blevet tilsluttet
@@ -637,7 +655,7 @@
Comment[es]=Se ha conectado el adaptador de alimentación de energía
Comment[fi]=Tietokone kytkettiin verkkovirtaan
Comment[fr]=L'adaptateur secteur a été branché
-Comment[gl]=Enchufouse o transformador de corrente.
+Comment[gl]=Enchufouse o transformador de corrente
Comment[hu]=Az áramellátást biztosító tápcsatlakozó bedugva
Comment[ia]=Le adaptator de energia ha essite connectite
Comment[id]=Adaptor daya telah ditancapkan
@@ -675,6 +693,7 @@
[Event/unplugged]
Name=AC adaptor unplugged
Name[ar]=فُصِل محوِّل الكهرباء
+Name[bs]=AC adapter izvučen
Name[ca]=Adaptador de CA desendollat
Name[cs]=AC adaptér odpojen
Name[da]=Strømforsyning frakoblet
@@ -716,6 +735,7 @@
|
[-]
[+]
|
Changed |
powerdevil.yaml
^
|
@@ -1,5 +1,5 @@
Name : powerdevil
-Version : 5.2.0
+Version : 5.3.0
Release : 1
Group : System/Base
License : GPLv2+
|