diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c95972f..18ab4f9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,82 +1,82 @@ cmake_minimum_required(VERSION 3.0) project(PowerDevil) set(PROJECT_VERSION "5.17.80") set(PROJECT_VERSION_MAJOR 5) set(QT_MIN_VERSION "5.12.0") set(KF5_MIN_VERSION "5.62.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) include(ECMSetupVersion) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets DBus X11Extras) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Activities Auth IdleTime Config DBusAddons Solid I18n GlobalAccel KIO NotifyConfig Wayland DocTools Crash Notifications) find_package(KF5Screen CONFIG REQUIRED) find_package(LibKWorkspace CONFIG REQUIRED) find_package(KF5BluezQt ${KF5_MIN_VERSION}) set_package_properties(KF5BluezQt PROPERTIES DESCRIPTION "Qt wrapper for BlueZ 5 DBus API" TYPE OPTIONAL PURPOSE "Support for wireless energy saving actions" ) find_package(KF5NetworkManagerQt ${KF5_MIN_VERSION}) set_package_properties(KF5NetworkManagerQt PROPERTIES DESCRIPTION "Qt wrapper for NetworkManager API" TYPE OPTIONAL PURPOSE "Support for wireless energy saving actions" ) set(HAVE_WIRELESS_SUPPORT FALSE) if(KF5NetworkManagerQt_FOUND AND KF5BluezQt_FOUND) set(HAVE_WIRELESS_SUPPORT TRUE) endif() add_feature_info( "Wireless power saving" HAVE_WIRELESS_SUPPORT "Support turning off signal-transmitting devices to save energy" ) find_package(LibKWorkspace ${PROJECT_VERSION} REQUIRED) find_package(UDev REQUIRED) find_package(XCB REQUIRED COMPONENTS XCB RANDR DPMS) option(HAVE_DDCUTIL "DDCUtil library support" OFF) if(HAVE_DDCUTIL) find_package(DDCUtil REQUIRED) add_compile_definitions(WITH_DDCUTIL) set_package_properties(DDCUtil PROPERTIES DESCRIPTION "DDCUtil library support" TYPE OPTIONAL PURPOSE "Set monitor settings over DDC/CI channel" ) else() - add_feature_info("DDCUtil" HAVE_DDCUTIL "DDCUtil library support is disabled by default as recomended by authors, add -DHAVE_DDCUTIL=On to enable") + add_feature_info("DDCUtil" HAVE_DDCUTIL "DDCUtil library support is disabled by default as recommended by authors, add -DHAVE_DDCUTIL=On to enable") endif() include_directories ( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/daemon ) add_definitions(-DQT_NO_KEYWORDS) add_definitions(-DQT_NO_FOREACH) if (EXISTS "${CMAKE_SOURCE_DIR}/.git") add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) endif() add_subdirectory(daemon) add_subdirectory(kcmodule) add_subdirectory(doc) install( FILES powerdevil.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} ) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/daemon/actions/bundled/brightnesscontrolconfig.cpp b/daemon/actions/bundled/brightnesscontrolconfig.cpp index 3b5aaadd..f4ed2915 100644 --- a/daemon/actions/bundled/brightnesscontrolconfig.cpp +++ b/daemon/actions/bundled/brightnesscontrolconfig.cpp @@ -1,82 +1,81 @@ /*************************************************************************** * Copyright (C) 2010 by Dario Freddi * * * * 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 . * ***************************************************************************/ #include "brightnesscontrolconfig.h" #include #include #include #include #include #include -#include #include K_PLUGIN_FACTORY(PowerDevilBrightnessControlConfigFactory, registerPlugin(); ) namespace PowerDevil { namespace BundledActions { BrightnessControlConfig::BrightnessControlConfig(QObject *parent, const QVariantList& ) : ActionConfig(parent) { } BrightnessControlConfig::~BrightnessControlConfig() { } void BrightnessControlConfig::save() { configGroup().writeEntry("value", m_slider->value()); configGroup().sync(); } void BrightnessControlConfig::load() { configGroup().config()->reparseConfiguration(); m_slider->setValue(configGroup().readEntry("value", 50)); } QList< QPair< QString, QWidget* > > BrightnessControlConfig::buildUi() { m_slider = new QSlider(Qt::Horizontal); m_slider->setRange(0, 100); QWidget *tempWidget = new QWidget; QHBoxLayout *hlay = new QHBoxLayout; hlay->addWidget(m_slider); tempWidget->setLayout(hlay); QList< QPair< QString, QWidget* > > retlist; retlist.append(qMakePair< QString, QWidget* >(i18nc("Brightness level, label for the slider", "Level"), tempWidget)); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); return retlist; } } } #include "brightnesscontrolconfig.moc" diff --git a/daemon/actions/bundled/runscriptconfig.cpp b/daemon/actions/bundled/runscriptconfig.cpp index 47f681c3..62025165 100644 --- a/daemon/actions/bundled/runscriptconfig.cpp +++ b/daemon/actions/bundled/runscriptconfig.cpp @@ -1,113 +1,112 @@ /*************************************************************************** * Copyright (C) 2010 by Dario Freddi * * * * 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 . * ***************************************************************************/ #include "runscriptconfig.h" #include #include #include #include #include #include #include #include -#include K_PLUGIN_FACTORY(PowerDevilRunScriptConfigFactory, registerPlugin(); ) namespace PowerDevil { namespace BundledActions { RunScriptConfig::RunScriptConfig(QObject* parent, const QVariantList&) : ActionConfig(parent) { } RunScriptConfig::~RunScriptConfig() { } void RunScriptConfig::save() { configGroup().writeEntry("scriptCommand", m_urlRequester->text()); configGroup().writeEntry("scriptPhase", m_comboBox->currentIndex()); configGroup().writeEntry("idleTime", m_idleTime->value() * 60 * 1000); configGroup().sync(); } void RunScriptConfig::load() { configGroup().config()->reparseConfiguration(); m_urlRequester->setText(configGroup().readEntry("scriptCommand", QString())); m_comboBox->setCurrentIndex(configGroup().readEntry("scriptPhase", 0)); m_idleTime->setValue((configGroup().readEntry("idleTime", 600000) / 60) / 1000); } QList< QPair< QString, QWidget* > > RunScriptConfig::buildUi() { QList< QPair< QString, QWidget* > > retlist; m_urlRequester = new KUrlRequester(); m_urlRequester->setMode(KFile::File | KFile::LocalOnly | KFile::ExistingOnly); retlist.append(qMakePair< QString, QWidget* >(i18n("Script"), m_urlRequester)); QWidget *tempWidget = new QWidget; QHBoxLayout *hlay = new QHBoxLayout; m_comboBox = new KComboBox; m_idleTime = new QSpinBox; m_idleTime->setMaximumWidth(150); m_idleTime->setMinimum(1); m_idleTime->setMaximum(360); m_idleTime->setValue(0); m_idleTime->setDisabled(true); m_idleTime->setSuffix(i18n(" min")); m_comboBox->addItem(i18n("On Profile Load")); m_comboBox->addItem(i18n("On Profile Unload")); m_comboBox->addItem(i18n("After")); connect(m_comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onIndexChanged(QString))); hlay->addWidget(m_comboBox); hlay->addWidget(m_idleTime); hlay->addStretch(); tempWidget->setLayout(hlay); retlist.append(qMakePair< QString, QWidget* >(i18n("Run script"), tempWidget)); connect(m_urlRequester, SIGNAL(textChanged(QString)), this, SLOT(setChanged())); connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); connect(m_idleTime, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); return retlist; } void RunScriptConfig::onIndexChanged(const QString &text) { m_idleTime->setEnabled(text == i18n("After")); } } } #include "runscriptconfig.moc" diff --git a/daemon/powerdevil_debug.h b/daemon/powerdevil_debug.h index fcd9c10f..a618bb2b 100644 --- a/daemon/powerdevil_debug.h +++ b/daemon/powerdevil_debug.h @@ -1,26 +1,26 @@ /* This file is part of the KDE project Copyright (C) 2014 Hrvoje Senjan This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef PROCESSCORE_DEBUG_H -#define PROCESSCORE_DEBUG_H +#ifndef POWERDEVIL_DEBUG_H +#define POWERDEVIL_DEBUG_H #include Q_DECLARE_LOGGING_CATEGORY(POWERDEVIL) #endif diff --git a/daemon/powerdevilapp.cpp b/daemon/powerdevilapp.cpp index 36890309..4d78a444 100644 --- a/daemon/powerdevilapp.cpp +++ b/daemon/powerdevilapp.cpp @@ -1,222 +1,222 @@ /*************************************************************************** * Copyright (C) 2010 by Dario Freddi * * * * 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 . * ***************************************************************************/ #include "powerdevilapp.h" #include "powerdevilfdoconnector.h" #include "powermanagementadaptor.h" #include "powermanagementpolicyagentadaptor.h" #include "powerdevilcore.h" #include "powerdevil_debug.h" #include "powerdevil_version.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include PowerDevilApp::PowerDevilApp(int &argc, char **argv) : QGuiApplication(argc, argv) , m_core(nullptr) { migratePre512KeyboardShortcuts(); } PowerDevilApp::~PowerDevilApp() { delete m_core; } void PowerDevilApp::init() { KLocalizedString::setApplicationDomain("powerdevil"); KAboutData aboutData(QStringLiteral("org_kde_powerdevil"), i18n("KDE Power Management System"), QStringLiteral(POWERDEVIL_VERSION_STRING), i18nc("@title", "PowerDevil, an advanced, modular and lightweight power management daemon"), KAboutLicense::GPL, i18nc("@info:credit", "(c) 2015-2019 Kai Uwe Broulik")); aboutData.addAuthor(i18nc("@info:credit", "Kai Uwe Broulik"), i18nc("@info:credit", "Maintainer"), QStringLiteral("kde@privat.broulik.de")); aboutData.addAuthor(i18nc("@info:credit", "Dario Freddi"), i18nc("@info:credit", "Previous maintainer"), QStringLiteral("drf@kde.org")); aboutData.setProductName("Powerdevil"); KAboutData::setApplicationData(aboutData); if (QDBusConnection::systemBus().interface()->isServiceRegistered(QLatin1String("org.freedesktop.PowerManagement")) || QDBusConnection::systemBus().interface()->isServiceRegistered(QLatin1String("com.novell.powersave")) || QDBusConnection::systemBus().interface()->isServiceRegistered(QLatin1String("org.freedesktop.Policy.Power"))) { qCCritical(POWERDEVIL) << "KDE Power Management system not initialized, another power manager has been detected"; return; } // not parenting Core to PowerDevilApp as it is the deleted too late on teardown - // where the X connection is already lost leading to a a crash (Bug 371127) + // where the X connection is already lost leading to a crash (Bug 371127) m_core = new PowerDevil::Core(nullptr/*, KComponentData(aboutData)*/); connect(m_core, SIGNAL(coreReady()), this, SLOT(onCoreReady())); // Before doing anything, let's set up our backend const QStringList paths = QCoreApplication::libraryPaths(); QFileInfoList fileInfos; for (const QString &path : paths) { QDir dir(path + QLatin1String("/kf5/powerdevil/"), QStringLiteral("*"), QDir::SortFlags(QDir::QDir::Name), QDir::NoDotAndDotDot | QDir::Files); fileInfos.append(dir.entryInfoList()); } QFileInfo backendFileInfo; for (const QFileInfo &f : qAsConst(fileInfos)) { if (f.baseName().toLower() == QLatin1String("powerdevilupowerbackend")) { backendFileInfo = f; break; } } QPluginLoader *loader = new QPluginLoader(backendFileInfo.filePath(), m_core); QObject *instance = loader->instance(); if (!instance) { qCDebug(POWERDEVIL) << loader->errorString(); qCCritical(POWERDEVIL) << "KDE Power Management System init failed!"; m_core->loadCore(nullptr); return; } auto interface = qobject_cast(instance); if (!interface) { qCDebug(POWERDEVIL) << "Failed to cast plugin instance to BackendInterface, check your plugin"; qCCritical(POWERDEVIL) << "KDE Power Management System init failed!"; m_core->loadCore(nullptr); return; } qCDebug(POWERDEVIL) << "Backend loaded, loading core"; m_core->loadCore(interface); } void PowerDevilApp::onCoreReady() { qCDebug(POWERDEVIL) << "Core is ready, registering various services on the bus..."; //DBus logic for the core new PowerManagementAdaptor(m_core); new PowerDevil::FdoConnector(m_core); QDBusConnection::sessionBus().registerService(QLatin1String("org.kde.Solid.PowerManagement")); QDBusConnection::sessionBus().registerObject(QLatin1String("/org/kde/Solid/PowerManagement"), m_core); QDBusConnection::systemBus().interface()->registerService("org.freedesktop.Policy.Power"); // Start the Policy Agent service qDBusRegisterMetaType>(); qDBusRegisterMetaType(); new PowerManagementPolicyAgentAdaptor(PowerDevil::PolicyAgent::instance()); QDBusConnection::sessionBus().registerService(QLatin1String("org.kde.Solid.PowerManagement.PolicyAgent")); QDBusConnection::sessionBus().registerObject(QLatin1String("/org/kde/Solid/PowerManagement/PolicyAgent"), PowerDevil::PolicyAgent::instance()); } /* * 5.11 -> 5.12 migrated shortcuts from kded5 to the correct component name org_kde_powerdevil for good reasons however despite a kconfupdate script working correctly and moving the old keys, because kglobalaccel is running whilst we update it synced the old values, and then ignores the powerdevil copy on future loads this removes the old powermanagent entries in the kded5 component at powerdevil startup //which is at runtime where we can talk to kglobalaccel and then re-register ours this method can probably be deleted at some point in the future */ void PowerDevilApp::migratePre512KeyboardShortcuts() { auto configGroup = KSharedConfig::openConfig("powermanagementprofilesrc")->group("migration"); if (!configGroup.hasKey("kdedShortcutMigration")) { const QStringList actionIds({ "Decrease Keyboard Brightness", "Decrease Screen Brightness", "Hibernate", "Increase Keyboard Brightness", "Increase Screen Brightness", "PowerOff", "Sleep", "Toggle Keyboard Backlight" }); for (const QString &actionId: actionIds) { QAction oldAction; oldAction.setObjectName(actionId); oldAction.setProperty("componentName", "kded5"); //claim the old shortcut so we can remove it.. KGlobalAccel::self()->setShortcut(&oldAction, QList(), KGlobalAccel::Autoloading); auto shortcuts = KGlobalAccel::self()->shortcut(&oldAction); KGlobalAccel::self()->removeAllShortcuts(&oldAction); QAction newAction; newAction.setObjectName(actionId); newAction.setProperty("componentName", "org_kde_powerdevil"); if (!shortcuts.isEmpty()) { //register with no autoloading to sync config, we then delete our QAction, and powerdevil will //re-register as normal KGlobalAccel::self()->setShortcut(&newAction, shortcuts, KGlobalAccel::NoAutoloading); } } } configGroup.writeEntry(QStringLiteral("kdedShortcutMigration"), true); configGroup.sync(); } int main(int argc, char **argv) { QGuiApplication::setDesktopSettingsAware(false); KWorkSpace::detectPlatform(argc, argv); PowerDevilApp app(argc, argv); auto disableSessionManagement = [](QSessionManager &sm) { sm.setRestartHint(QSessionManager::RestartNever); }; QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement); QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement); KDBusService service(KDBusService::Unique); KCrash::setFlags(KCrash::AutoRestart); app.setQuitOnLastWindowClosed(false); app.init(); return app.exec(); } diff --git a/daemon/powerdevilbrightnesslogic.h b/daemon/powerdevilbrightnesslogic.h index c6caf839..9ffdd02c 100644 --- a/daemon/powerdevilbrightnesslogic.h +++ b/daemon/powerdevilbrightnesslogic.h @@ -1,184 +1,184 @@ /*************************************************************************** * Copyright (C) 2014 by Nikita Skovoroda * * * * 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 POWERDEVIL_BRIGHNTESSLOGIC_H -#define POWERDEVIL_BRIGHNTESSLOGIC_H +#ifndef POWERDEVIL_BRIGHTNESSLOGIC_H +#define POWERDEVIL_BRIGHTNESSLOGIC_H namespace PowerDevil { class BrightnessLogic { public: BrightnessLogic(); virtual ~BrightnessLogic() = default; /** * This enum defines the different types brightness keys. * * - Increase: Key to increase brightness (Qt::Key_MonBrightnessUp or Qt::Key_KeyboardBrightnessUp) * - 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 }; /** * This struct contains information about current brightness state for a single device */ struct BrightnessInfo { /** The raw brightness value, from 0 to valueMax */ int value; /** The maximum possible brightness value for this device */ int valueMax; /** The maximum possible brightness step for this device */ int steps; }; /** * Sets the current brightness value. * * @param value Raw brightness value */ void setValue(int value); /** * Sets the maximum brightness value. * * @param value Maximum brightness value */ void setValueMax(int valueMax); /** * Calculate new brightness value that should be set by an action. * * @param type The action type of the key that was pressed. * @return The brightness value that the action should set, or -1 if nothing should be done */ int action(BrightnessKeyType type) const; /** * Calculates the brightness value of the closest step upwards. * (Closest step that is higher than current brightness value). * * @return The brightness value of the closest step upwards */ virtual int increased() const; /** * Calculates the brightness value of the closest step downwards. * (Closest step that is lower than current brightness value). * * @return The brightness value of the closest step downwards */ virtual int decreased() const; /** * Calculates the brightness value of the toggled state. * (Sets the brightness value to either 0 or valueMax). * * @return The brightness value that should be set, or -1 if nothing should be done */ virtual int toggled() const; /** * Retrieve the current brightness value. * * @return Raw brightness value, from 0 to valueMax */ int value() const; /** * Retrieve the maximum possible brightness value for this device. * * @return Maximum possible brightness value */ int valueMax() const; /** * Retrieve the brightness step that is closest to the current brightness value. * * @return Nearest brightness step */ int step() const; /** * Retrieve the maximum possible brightness step for this instance * * @return Maximum possible brightness step */ int steps() const; /** * Retrieve the supplied brightness value expressed as a percentage from 0 to 100 * * @param value Brightness value, from 0 to valueMax * @return The brightness percentage for the supplied value */ float percentage(int value) const; /** * Retrieve a copy of the current brightness state * * @return A struct that contains the current brightness state. */ const BrightnessInfo info() const; /** * Convert brightness step to raw brightness value * * @param step Brightness step, from 0 to steps * @return Brightness value that corresponds to the given step */ int stepToValue(int step) const; /** * Convert raw brightness value to brightness step * * @param value Brightness value, from 0 to valueMax * @return Brightness step that is nearest to the given brightness value */ int valueToStep(int value) const; protected: /** * Calculate the optimal number of brightness steps. * * It should be based on three assumptions: * 1) The user generally expects to see equal brightness steps, and likes round percentage numbers. * 2) Actual brightness is rounded to whole percents before being displayed to the user. * 3) An assumption on a generally good number of brightness steps, which varies with implementations. * * This function does not depend on anything except the argument. * * @param valueMax the maximum brightness value for which we want to calculate the number of steps * @return the optimal maximum step number */ virtual int calculateSteps(int valueMax) const = 0; private: int m_value = -1; int m_valueMax = -1; int m_steps = -1; }; } -#endif // POWERDEVIL_BRIGHNTESSLOGIC_H +#endif // POWERDEVIL_BRIGHTNESSLOGIC_H diff --git a/daemon/powerdevilkeyboardbrightnesslogic.h b/daemon/powerdevilkeyboardbrightnesslogic.h index 1173d3d2..0ae630f7 100644 --- a/daemon/powerdevilkeyboardbrightnesslogic.h +++ b/daemon/powerdevilkeyboardbrightnesslogic.h @@ -1,38 +1,38 @@ /*************************************************************************** * Copyright (C) 2014 by Nikita Skovoroda * * * * 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 POWERDEVIL_KEYBOARDBRIGHNTESSLOGIC_H -#define POWERDEVIL_KEYBOARDBRIGHNTESSLOGIC_H +#ifndef POWERDEVIL_KEYBOARDBRIGHTNESSLOGIC_H +#define POWERDEVIL_KEYBOARDBRIGHTNESSLOGIC_H #include "powerdevilbrightnesslogic.h" namespace PowerDevil { class KeyboardBrightnessLogic : public BrightnessLogic { protected: int calculateSteps(int valueMax) const override; }; } -#endif // POWERDEVIL_KEYBOARDBRIGHNTESSLOGIC_H +#endif // POWERDEVIL_KEYBOARDBRIGHTNESSLOGIC_H diff --git a/daemon/powerdevilscreenbrightnesslogic.h b/daemon/powerdevilscreenbrightnesslogic.h index ccfc194b..ce71e6bd 100644 --- a/daemon/powerdevilscreenbrightnesslogic.h +++ b/daemon/powerdevilscreenbrightnesslogic.h @@ -1,41 +1,41 @@ /*************************************************************************** * Copyright (C) 2014 by Nikita Skovoroda * * * * 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 POWERDEVIL_SCREENBRIGHNTESSLOGIC_H -#define POWERDEVIL_SCREENBRIGHNTESSLOGIC_H +#ifndef POWERDEVIL_SCREENBRIGHTNESSLOGIC_H +#define POWERDEVIL_SCREENBRIGHTNESSLOGIC_H #include "powerdevilbrightnesslogic.h" namespace PowerDevil { class ScreenBrightnessLogic : public BrightnessLogic { public: int toggled() const override; protected: int calculateSteps(int valueMax) const override; }; } -#endif // POWERDEVIL_SCREENBRIGHNTESSLOGIC_H +#endif // POWERDEVIL_SCREENBRIGHTNESSLOGIC_H