From aa9428707255387c5301b324c9b86cd741df04a3 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Tue, 22 May 2018 21:45:38 -0500 Subject: [PATCH] Remove pristine-tar files. --- AUTHORS | 8 - CHANGELOG | 265 ---------- CMakeLists.txt | 44 -- LICENSE | 458 ------------------ README.md | 31 -- autostart/CMakeLists.txt | 17 - autostart/lxqt-powermanagement.desktop.in | 11 - .../lxqt-powermanagement_da.desktop | 2 - .../lxqt-powermanagement_de.desktop | 2 - .../lxqt-powermanagement_el.desktop | 1 - .../lxqt-powermanagement_fr.desktop | 1 - .../lxqt-powermanagement_it.desktop | 2 - .../lxqt-powermanagement_lt.desktop | 1 - .../lxqt-powermanagement_pl.desktop | 1 - .../lxqt-powermanagement_pt.desktop | 2 - config/CMakeLists.txt | 81 ---- config/batterywatchersettings.cpp | 111 ----- config/batterywatchersettings.h | 66 --- config/batterywatchersettings.ui | 249 ---------- config/helpers.cpp | 60 --- config/helpers.h | 20 - config/icons/laptop-lid.svg | 119 ----- config/idlenesswatchersettings.cpp | 117 ----- config/idlenesswatchersettings.h | 60 --- config/idlenesswatchersettings.ui | 103 ---- config/lidwatchersettings.cpp | 83 ---- config/lidwatchersettings.h | 58 --- config/lidwatchersettings.ui | 152 ------ config/lxqt-config-powermanagement.desktop.in | 11 - config/main.cpp | 55 --- config/mainwindow.cpp | 49 -- config/mainwindow.h | 40 -- config/powermanagementsettings.cpp | 225 --------- config/powermanagementsettings.h | 95 ---- .../lxqt-config-powermanagement_ar.desktop | 3 - .../lxqt-config-powermanagement_ca.desktop | 3 - .../lxqt-config-powermanagement_da.desktop | 3 - .../lxqt-config-powermanagement_de.desktop | 3 - .../lxqt-config-powermanagement_el.desktop | 3 - .../lxqt-config-powermanagement_fr.desktop | 4 - .../lxqt-config-powermanagement_hu.desktop | 4 - .../lxqt-config-powermanagement_it.desktop | 3 - .../lxqt-config-powermanagement_ja.desktop | 4 - .../lxqt-config-powermanagement_lt.desktop | 3 - .../lxqt-config-powermanagement_pl.desktop | 3 - .../lxqt-config-powermanagement_pt.desktop | 3 - .../lxqt-config-powermanagement_ru.desktop | 4 - src/CMakeLists.txt | 81 ---- src/batteryhelper.cpp | 101 ---- src/batteryhelper.h | 44 -- src/batteryinfodialog.cpp | 50 -- src/batteryinfodialog.h | 37 -- src/batteryinfodialog.ui | 64 --- src/batteryinfoframe.cpp | 68 --- src/batteryinfoframe.h | 54 --- src/batteryinfoframe.ui | 203 -------- src/batterywatcher.cpp | 177 ------- src/batterywatcher.h | 56 --- src/iconproducer.cpp | 242 --------- src/iconproducer.h | 53 -- src/idlenesswatcher.cpp | 67 --- src/idlenesswatcher.h | 48 -- src/lid.cpp | 76 --- src/lid.h | 54 --- src/lidwatcher.cpp | 127 ----- src/lidwatcher.h | 61 --- src/main.cpp | 63 --- src/powermanagementd.cpp | 114 ----- src/powermanagementd.h | 44 -- src/trayicon.cpp | 127 ----- src/trayicon.h | 65 --- src/watcher.cpp | 51 -- src/watcher.h | 36 -- 73 files changed, 4806 deletions(-) delete mode 100644 AUTHORS delete mode 100644 CHANGELOG delete mode 100644 CMakeLists.txt delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 autostart/CMakeLists.txt delete mode 100644 autostart/lxqt-powermanagement.desktop.in delete mode 100644 autostart/translations/lxqt-powermanagement_da.desktop delete mode 100644 autostart/translations/lxqt-powermanagement_de.desktop delete mode 100644 autostart/translations/lxqt-powermanagement_el.desktop delete mode 100644 autostart/translations/lxqt-powermanagement_fr.desktop delete mode 100644 autostart/translations/lxqt-powermanagement_it.desktop delete mode 100644 autostart/translations/lxqt-powermanagement_lt.desktop delete mode 100644 autostart/translations/lxqt-powermanagement_pl.desktop delete mode 100644 autostart/translations/lxqt-powermanagement_pt.desktop delete mode 100644 config/CMakeLists.txt delete mode 100644 config/batterywatchersettings.cpp delete mode 100644 config/batterywatchersettings.h delete mode 100644 config/batterywatchersettings.ui delete mode 100644 config/helpers.cpp delete mode 100644 config/helpers.h delete mode 100644 config/icons/laptop-lid.svg delete mode 100644 config/idlenesswatchersettings.cpp delete mode 100644 config/idlenesswatchersettings.h delete mode 100644 config/idlenesswatchersettings.ui delete mode 100644 config/lidwatchersettings.cpp delete mode 100644 config/lidwatchersettings.h delete mode 100644 config/lidwatchersettings.ui delete mode 100644 config/lxqt-config-powermanagement.desktop.in delete mode 100644 config/main.cpp delete mode 100644 config/mainwindow.cpp delete mode 100644 config/mainwindow.h delete mode 100644 config/powermanagementsettings.cpp delete mode 100644 config/powermanagementsettings.h delete mode 100644 config/translations/lxqt-config-powermanagement_ar.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_ca.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_da.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_de.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_el.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_fr.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_hu.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_it.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_ja.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_lt.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_pl.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_pt.desktop delete mode 100644 config/translations/lxqt-config-powermanagement_ru.desktop delete mode 100644 src/CMakeLists.txt delete mode 100644 src/batteryhelper.cpp delete mode 100644 src/batteryhelper.h delete mode 100644 src/batteryinfodialog.cpp delete mode 100644 src/batteryinfodialog.h delete mode 100644 src/batteryinfodialog.ui delete mode 100644 src/batteryinfoframe.cpp delete mode 100644 src/batteryinfoframe.h delete mode 100644 src/batteryinfoframe.ui delete mode 100644 src/batterywatcher.cpp delete mode 100644 src/batterywatcher.h delete mode 100644 src/iconproducer.cpp delete mode 100644 src/iconproducer.h delete mode 100644 src/idlenesswatcher.cpp delete mode 100644 src/idlenesswatcher.h delete mode 100644 src/lid.cpp delete mode 100644 src/lid.h delete mode 100644 src/lidwatcher.cpp delete mode 100644 src/lidwatcher.h delete mode 100644 src/main.cpp delete mode 100644 src/powermanagementd.cpp delete mode 100644 src/powermanagementd.h delete mode 100644 src/trayicon.cpp delete mode 100644 src/trayicon.h delete mode 100644 src/watcher.cpp delete mode 100644 src/watcher.h diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 95bad47..0000000 --- a/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -Upstream Authors: - LXQt team: http://lxqt.org - -Copyright: - Copyright (c) 2013-2017 LXQt team - -License: LGPL-2.1+ -The full text of the licenses can be found in the 'COPYING' file. diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 7d8230f..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,265 +0,0 @@ - -lxqt-powermanagement-0.12.0 / 2017-10-21 -======================================== - - * Set patch version - * Spell check (add "," and "-") - * Don't export github templates - * Adding missing "Comment" section to .desktop files. Fix for https://github.com/lxde/lxqt/issues/1339 - * Added Lithuanian language - * Drops Qt5Core_VERSION_STRING - * lxqt-config-powermanagement: set Qt::AA_UseHighDpiPixmaps to true - * Added QCommandLineParser and basic cli interface to lxqt-config-powermanagement and lxqt-powermanagement - * Added default CMAKE_BUILD_TYPE and LXQT_POWERMANAGEMENT_PATCH_VERSION - * added *pl.desktop - * Fixes a FTBFS in superbuild mode - * Added merged autostart to CMakeLists.txt - * Updated *_da.desktop files and removed *_da_DK.desktop files - * Update desktop entries and Replace fr_FR by fr - * Move Italian desktop entry to correct path - * Update Greek translation (el) Remove country variant from language code - * Rename LxQt to LXQt everywhere - * CMake: Adds Runtime and Devel install COMPONENTs - * Coding style changes - * Updates the build system to use the Targets infrastructure - * Rename Power Management module name again - * Rename LXQt Power Management module name - * Drops hardcoded /etc/xdg paths - * Updated german translation, replaced Qt4 by Qt in all xsession/translations - * Portuguese update for .desktop files - * Updates translations infrastructure - * Update the required minimum cmake version - * remove dead template lines switch OnlyShowIn from Razor -> LXQt stringchanges LxQt -> LXQt - * Renamed lxqt-autosuspend.desktop.in --> lxqt-powermanagement.desktop.in - * Support lxqt-session and add necessary xdg autostart desktop entry files. - * Default to no action if the action is not specified in the config file - * BatteryWatcher: Fix indentation - * Bump year - -0.11.1 / 2017-01-01 -=================== - - * Release 0.11.1: Update changelog - * Add lxqt-config-powermanagement_da.desktop - * Create lxqt-config-powermanagement_fr.desktop - * Make CMakeLists.txt more uniform. - * Remove cpack (#43) - -0.11.0 / 2016-09-24 -=================== - - * Release 0.11.0: Add changelog - * README.md: Replace dependency XCB with KIdleTime - * Idleness Watcher: rely on KIdleTime instead of XCB (#33) - * fix indents - * Update and extend README.md - * Add Catalan translation - * Add Arabic Translation for Desktop File - * I18N: Fix Plural Strings (#38) - * Removes the QEventLoop from the Watcher class - * build: Use external translations - * ts-files removal (#34) - * Bump year Fix licenses, lxqt-powermanagement is LGPL only - * Fix source language in Italian translation file - * Italian translation update - * Update Russian translation Remove ru_RU files - * Fix typo in Greek translation - * update: lxqt-powermanagement_hu.ts - * Add German translation - -0.10.0 / 2015-10-31 -=================== - - * Update translations - * Fix LICENSE file - * Add (re)enabling info message - * Rename "On Ac" to "On AC" to have a single string for both - * Fix typo in message - * Remove "LXQt " from .desktop to follow pattern - * Update batteryhelper.cpp - * Fixed typo Unkown -> Unknown - * lidwatcher: don't listen to Changed signal - * Add some missing license headers - * OnlyShowIn=LXQt; - * Add Greek (el) translation Add the 'Comment' key in desktop file - * Add key "Comment" to desktop entry file - * Rename LxQt to LXQt everywhere - * Handles CMake policy CMP0063 - * Use the LXQtCompilerSettings CMake module - * Make built-in icon move clockwise when charging - * Fix red-painting of built-in icon when power low - * Adds Runtime install COMPONENT - * Coding sytle change - * Use GNUInstallDirs - * Removes non existent RESOURCES - * Use CMAKE_AUTOUIC, drop qt5_wrap_ui() - * Remove unneeded include_directories() entries - * Minor strings update - * Updates the build system to the Targets infrastructure - * Remove trailing whitespaces - * Enable screen locking from the idleness watcher - * Prevent a too small value for the idle watcher - * Correctly check for batteries on first run - * re-add notification about missing battery - * Added italian translations - * Hungarian translations added - * Support CMake 2.8.11 again - * Typos: fix "Idle" capitalization and misspelling - * Add icons to the action in the systray icon's menu - * Polish translation updated - * Only show batteries of type PrimaryBattery. Fixes #535 - * Make lxqt-powermanagement tray's tooltip work again - * Fix warning from clang - * Fix some wrong use of Solid::Battery::capacity instead of ..::energy - * Align slots and connects with what signals Solid offers - * Make batterywatcher react to energylevel- and powersupplystate changes - * Port to KF5's Solid - -0.9.0 / 2015-01-26 -================== - - * Portuguese update - * Fix some translation keys - * Small layoutchange in batterysettings - * Fix strings to be easier translatable - * Portuguese update - * Add Japanese translation - * - Unify naming for a unique lxqt. No more suffixes - * Fix battery info dialog's layout - * Small tweak to the built-in icon - * Added semitransparent background to built in icon - * Simplified rendering of built-in icons and added a gradient to them - * Use SingleApplication rather than Application - * Handle more than one battery - * Reordered responsibillities between classes - * Some refactoring - * Some cleanup - * Remove cancel button from batteryinfodialog.ui - * Correct one fontsize in batteryinfo.ui - * Refactor battery info dialog to handle more than one battery - * Cleaned out a lot of old debug statements - * Adjusted how chargelevels are mapped to icons - * Added icon preview to batterywatcher config - * Factor out icon producing in separate class - * Clean up code for picking battery icon from theme - * Add icon to config window - * Fix config gui - * Use the new LXQtTranslate modules. - * Fixes translations not being loaded. - * Updates translations - * Adds and uses QtTranslate cmake module for handling .ts translations - * Add Russian translation - * Include Qt5Gui_PRIVATE_INCLUDE_DIRS for qplatformnativeinterface.h - * Clean up CMakeLists.txt, drop Qt4 support - * Adds option to disable systray icon in preferences and on the icon's context menu - -0.8.0 / 2014-06-29 -================== - - * Fix incorrect lib linking. - * Add initial Qt5 support. - * Add missing lgpl-headers - * Recognize Alec Moskvin as author in 'about' dialog - * Fix includes, hopefuly correct this time - * Clean up includes - * Tell logind to not handle lidswitch when lidwatcher is enabled - * Added contextmenu to battery systemtray icon - * On first run disable lidwatcher/batterywatcher if lid/battery not present - * Add missing ${QTXDG_INCLUDE_DIRS} to include_directories(). - * Use preferred header style - * Temporary fix for #86 - * Corrected badly formed includes. Fix for #81 - -0.7.0 / 2014-05-01 -================== - - * Remove outdated and unused manpage - * Add AUTHORS - * Strings improvements - * Add CPack rules for creating tarball - * Fix .desktop icon (thanks, @agaida) - * Improvements to .desktop file - * Adapt to recent upower api changes - * Update README - * Fix updating of minutes and seconds in idleness settings - * Fix small bugs in idleness-settings, update of seconds - * Fix icons in configure-powermanager - * Slightly more userfriendly idleness-settings-dialog - * Added first-time-run notification with configure-button - * Some cleanup + fix idlenesswatcher to use power - * More code cleanup - * Minor adjustments to config ui's - * cleanup - * Code cleanup - * ui cleanups - * Clean up battery-watcher-settings ui - * Fixed lxqt-config-powermanagement.desktop file - * Renames and cleanup - * Lid, Idleness and Battery merged into one application - * Normalize imports - * Config for idleness and some more options for lidsettings - * Removed CMAKE_SOURCE_DIR usage from CMakeLists.txt files - * Fix renaming bugs, replacing lxqt-qt with lxde-qt - * Finish the crazy razor=>lxqt renaming tasks. - * rename razor to lxqt in some strings - * Replace lxqt with ${LXQT_LIBRARIES} when linking. - * Compile-time dependancy on lxqt library added - * Project name fixed - * Fix build and adopt new APIs of liblxqt. - * Renamed some #ifndef/#define s - * Make powermanagement compile and link with liblxqt and libqtxdg - * Changed prefix from lz to lxqt for all powermanagement apps - * Cleanup of old razor-autosuspend code - * cmake-files cleanup - * Initial commit - * Renames and cleanup in config - * Renames and cleanup in idleness - * Renames and cleanup in battery - * Rename and cleanup in lid - * Split razorautosuspend into lid and battery, make stuff compile - * Moved razorqt-screenlocker into razor-autosuspend - * X-RAZOR changed to Razor in desktop files - * razor-autosuspend handle more battery-icon naming schemes - * Fix underlinking with QtDbus - * Autosuspend: Force icon to update when settings change - * Autosuspend: Add config option to start/stop - * Autosuspend: Perform a first-run check for a battery - * Set battery info dialog title - * Trtanslations - * Fixes to razor-autosuspend trayicon drawing - * New, dynamically generated battery icon for razor-autosuspend - * preliminary manpages primary for razorqt and usefully in venenux - * autosuspend: fix discharging() - * Razor-autosuspend fix missing initialization of Battery - * Rename fields in razor-config-autosuspend to comply with code style - * Rename variables in razor-autosuspend to comply with coding standards - * Now possible to use theme-icons in razor-autosuspend - * Translations updated - * Translations updated - * first part of fixes based on Coverity Scan (code static analysis) - * Fix components missing translations - * Added copyright headers to constants.h, batteryinfo.h and batteryinfo.cpp in razor-autosuspend - * Typos found during translation - * Translations - * Delete bad en_GB translations - * Update translations - * Enable translations for some components that were missing them - * Load setting on startup and fix wrong slot - * razor-autosuspend watch for changes in settings - * Translations updated - * Removed line num from TS files. - * Make razorqt-autosuspend a module - * Generate translations for razorqt-autosuspend - * Use flexible layouts - * Translations - * Deleted old translation methods. - * New translation infrastructure - * Fixes in the debs files for the razor-config-autosuspend.desktop - * razor-autosuspend: When batteryinfo open it closes when trayicon clicked - * Detailed battery info when clicking razor-autosuspend tray icon - * razor-autosuspend registers as dbus-service (org.razor-qt.razor-autosuspend) - fixes #346 - * Razor-autosuspend: power-low-level is now configurable - * Razor-autosuspend: Added shutdown as action on lidclosed or powerlow - * Added config app for razor-autosuspend - * Moved razor-autosuspend sourcefiles to src-dir - * Moved razor-autosuspend to toplevel as it is not really a part of razorqt-power diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 49e01c3..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) - -project(lxqt-powermanagement) - -include(GNUInstallDirs) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - -option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF) - -find_package(Qt5DBus REQUIRED) -find_package(Qt5LinguistTools REQUIRED) -find_package(Qt5Svg REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5X11Extras REQUIRED) -message(STATUS "Building with Qt${Qt5Core_VERSION}") - -find_package(KF5Solid REQUIRED) - -find_package(lxqt REQUIRED) - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -# Patch Version -set(LXQT_POWERMANAGEMENT_PATCH_VERSION 0) - -set(LXQT_POWERMANAGEMENT_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_POWERMANAGEMENT_PATCH_VERSION}) -add_definitions("-DLXQT_POWERMANAGEMENT_VERSION=\"${LXQT_POWERMANAGEMENT_VERSION}\"") - -include(LXQtCompilerSettings NO_POLICY_SCOPE) - -# Translations ********************************** -include(LXQtTranslate) - -add_subdirectory(config) -add_subdirectory(src) - -# merged from lxqt-common -add_subdirectory(autostart) diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 20fb9c7..0000000 --- a/LICENSE +++ /dev/null @@ -1,458 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md deleted file mode 100644 index 648363f..0000000 --- a/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# lxqt-powermanagement - -## Overview - -This repository is providing tools to monitor power management events and optionally trigger actions like e. g. shut down a system when laptop batteries are low on power. - -The core components are two binaries `lxqt-powermanagement` and `lxqt-config-powermanagement`. -`lxqt-powermanagement` is running in a daemon-like manner as so-called "LXQt Module" and doing the actual work. GUI "Power Management Settings (binary `lxqt-config-powermanagement`) is used to customize settings. - -Warning messages are displayed on the desktop by [lxqt-notificationd](https://github.com/lxde/lxqt-notificationd). - -## Installation - -### Compiling source code - -Runtime dependencies are UPower, KIdleTime, qtsvg and [liblxqt](https://github.com/lxde/liblxqt). -Additional build dependencies are CMake and Solid, optionally Git to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information. - -Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` has to be set to `/usr` on most operating systems. - -To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual. - -### Binary packages - -Official binary packages are provided by all major Linux distributions like Arch Linux, Debian (as of Debian stretch only), Fedora and openSUSE. Just use your package manager to search for string `lxqt-powermanagement`. - -## Configuration, Usage - -Daemon-like `lxqt-powermanagement` can be adjusted from section "Basic Settings" in configuration dialogue "LXQt Session Settings" (binary `lxqt-config-session`) of [lxqt-session](https://github.com/lxde/lxqt-session). - -To customize settings there's configuration dialogue "Power Management Settings" (binary `lxqt-config-powermanagement`). It can be opened from the panel's main menu - Preferences - LXQt Settings - Power Management and is provided by the "Configuration Center" (binary `lxqt-config`) of [lxqt-config](https://github.com/lxde/lxqt-config) as well. diff --git a/autostart/CMakeLists.txt b/autostart/CMakeLists.txt deleted file mode 100644 index 2760792..0000000 --- a/autostart/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) - -file(GLOB DESKTOP_FILES_IN *.desktop.in) - -# Translations ********************************** -lxqt_translate_desktop(DESKTOP_FILES - SOURCES - ${DESKTOP_FILES_IN} -) -add_custom_target(lxqt_powermanagement_autostart_desktop_files ALL DEPENDS ${DESKTOP_FILES}) -#************************************************ - -install(FILES - ${DESKTOP_FILES} - DESTINATION "${LXQT_ETC_XDG_DIR}/autostart" - COMPONENT Runtime -) diff --git a/autostart/lxqt-powermanagement.desktop.in b/autostart/lxqt-powermanagement.desktop.in deleted file mode 100644 index 624f5d0..0000000 --- a/autostart/lxqt-powermanagement.desktop.in +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Application -Version=1.0 -Name=Power Management -TryExec=lxqt-powermanagement -Exec=lxqt-powermanagement -OnlyShowIn=LXQt; -X-LXQt-Need-Tray=true -X-LXQt-Module=true - -#TRANSLATIONS_DIR=translations diff --git a/autostart/translations/lxqt-powermanagement_da.desktop b/autostart/translations/lxqt-powermanagement_da.desktop deleted file mode 100644 index 4f9e38d..0000000 --- a/autostart/translations/lxqt-powermanagement_da.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[da]=Strømstyring diff --git a/autostart/translations/lxqt-powermanagement_de.desktop b/autostart/translations/lxqt-powermanagement_de.desktop deleted file mode 100644 index 4cad910..0000000 --- a/autostart/translations/lxqt-powermanagement_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -#TRANSLATIONS -Name[de]=LXQt-Energieverwaltung diff --git a/autostart/translations/lxqt-powermanagement_el.desktop b/autostart/translations/lxqt-powermanagement_el.desktop deleted file mode 100644 index 7d60988..0000000 --- a/autostart/translations/lxqt-powermanagement_el.desktop +++ /dev/null @@ -1 +0,0 @@ -Name[el]=Διαχείριση ενέργειας diff --git a/autostart/translations/lxqt-powermanagement_fr.desktop b/autostart/translations/lxqt-powermanagement_fr.desktop deleted file mode 100644 index c0bb680..0000000 --- a/autostart/translations/lxqt-powermanagement_fr.desktop +++ /dev/null @@ -1 +0,0 @@ -Name[fr]=Gestion de l'énergie diff --git a/autostart/translations/lxqt-powermanagement_it.desktop b/autostart/translations/lxqt-powermanagement_it.desktop deleted file mode 100644 index e6ea051..0000000 --- a/autostart/translations/lxqt-powermanagement_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -#TRANSLATIONS -Name[it]=Gestore energia diff --git a/autostart/translations/lxqt-powermanagement_lt.desktop b/autostart/translations/lxqt-powermanagement_lt.desktop deleted file mode 100644 index 7b7ebd6..0000000 --- a/autostart/translations/lxqt-powermanagement_lt.desktop +++ /dev/null @@ -1 +0,0 @@ -Name[lt]=Maitinimo valdymas diff --git a/autostart/translations/lxqt-powermanagement_pl.desktop b/autostart/translations/lxqt-powermanagement_pl.desktop deleted file mode 100644 index adb8d81..0000000 --- a/autostart/translations/lxqt-powermanagement_pl.desktop +++ /dev/null @@ -1 +0,0 @@ -Name[pl]=Zarządzanie energią diff --git a/autostart/translations/lxqt-powermanagement_pt.desktop b/autostart/translations/lxqt-powermanagement_pt.desktop deleted file mode 100644 index 2557bca..0000000 --- a/autostart/translations/lxqt-powermanagement_pt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -#TRANSLATIONS -Name[pt]=Gestor de energia do LXQt diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt deleted file mode 100644 index 616618d..0000000 --- a/config/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -project(lxqt-config-powermanagement) - -set(QTX_LIBRARIES Qt5::Widgets Qt5::DBus Qt5::Svg) - -set(SOURCES - main.cpp - mainwindow.cpp - lidwatchersettings.cpp - batterywatchersettings.cpp - idlenesswatchersettings.cpp - powermanagementsettings.cpp - helpers.cpp - ../src/iconproducer.cpp -) - -set(UI_FILES - lidwatchersettings.ui - batterywatchersettings.ui - idlenesswatchersettings.ui -) - -set(ICON_FILES - icons/laptop-lid.svg -) - -set(DESKTOP_FILES_IN - lxqt-config-powermanagement.desktop.in -) - -# Translations ********************************** - -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS} - SOURCES - ${SOURCES} - ${UI_FILES} - INSTALL_DIR - ${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME} - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-powermanagement/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(config-powermanagement_QM_LOADER ${PROJECT_NAME}) -lxqt_translate_desktop(DESKTOP_FILES SOURCES ${DESKTOP_FILES_IN}) - -add_executable(${PROJECT_NAME} - ${SOURCES} - ${DESKTOP_FILES} - ${QM_FILES} - ${config-powermanagement_QM_LOADER} -) - -target_link_libraries(lxqt-config-powermanagement - lxqt - ${QTX_LIBRARIES} - KF5::Solid -) - -install(TARGETS - ${PROJECT_NAME} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT Runtime -) -install(FILES - ${DESKTOP_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" - COMPONENT Runtime -) -install(FILES - ${ICON_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/devices" - COMPONENT Runtime -) diff --git a/config/batterywatchersettings.cpp b/config/batterywatchersettings.cpp deleted file mode 100644 index 8bfe4ff..0000000 --- a/config/batterywatchersettings.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#include - -#include -#include -#include -#include - -#include "batterywatchersettings.h" -#include "ui_batterywatchersettings.h" -#include "powermanagementsettings.h" - -BatteryWatcherSettings::BatteryWatcherSettings(QWidget *parent) : - QWidget(parent), - mSettings(), - mUi(new Ui::BatteryWatcherSettings), - mChargingIconProducer(), - mDischargingIconProducer() - -{ - mUi->setupUi(this); - fillComboBox(mUi->actionComboBox); - mUi->chargeLevelSlider->setValue(53); - mChargingIconProducer.updateState(Solid::Battery::Charging); - mDischargingIconProducer.updateState(Solid::Battery::Discharging); - - connect(mUi->groupBox, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(mUi->actionComboBox, SIGNAL(activated(int)), this, SLOT(saveSettings())); - connect(mUi->warningSpinBox, SIGNAL(editingFinished()), this, SLOT(saveSettings())); - connect(mUi->levelSpinBox, SIGNAL(editingFinished()), this, SLOT(saveSettings())); - connect(mUi->showIconCheckBox, SIGNAL(clicked(bool)), this, SLOT(saveSettings())); - connect(mUi->showIconCheckBox, SIGNAL(clicked(bool)), mUi->previewBox, SLOT(setEnabled(bool))); - connect(mUi->useThemeIconsCheckBox, SIGNAL(clicked(bool)), this, SLOT(saveSettings())); - connect(mUi->useThemeIconsCheckBox, SIGNAL(clicked(bool)), this, SLOT(updatePreview())); - connect(mUi->chargeLevelSlider, SIGNAL(valueChanged(int)), this, SLOT(updatePreview())); - connect(&mChargingIconProducer, SIGNAL(iconChanged()), this, SLOT(onChargeIconChanged())); - connect(&mDischargingIconProducer, SIGNAL(iconChanged()), this, SLOT(onDischargeIconChanged())); - updatePreview(); -} - -BatteryWatcherSettings::~BatteryWatcherSettings() -{ - delete mUi; -} - -void BatteryWatcherSettings::loadSettings() -{ - mUi->groupBox->setChecked(mSettings.isBatteryWatcherEnabled()); - setComboBoxToValue(mUi->actionComboBox, mSettings.getPowerLowAction()); - mUi->warningSpinBox->setValue(mSettings.getPowerLowWarningTime()); - mUi->levelSpinBox->setValue(mSettings.getPowerLowLevel()); - mUi->showIconCheckBox->setChecked(mSettings.isShowIcon()); - mUi->useThemeIconsCheckBox->setChecked(mSettings.isUseThemeIcons()); -} - -void BatteryWatcherSettings::saveSettings() -{ - mSettings.setBatteryWatcherEnabled(mUi->groupBox->isChecked()); - mSettings.setPowerLowAction(currentValue(mUi->actionComboBox)); - mSettings.setPowerLowWarningTime(mUi->warningSpinBox->value()); - mSettings.setPowerLowLevel(mUi->levelSpinBox->value()); - mSettings.setShowIcon(mUi->showIconCheckBox->isChecked()); - mSettings.setUseThemeIcons(mUi->useThemeIconsCheckBox->isChecked()); -} - -void BatteryWatcherSettings::updatePreview() -{ - mUi->previewBox->setTitle(tr("Preview") + QString(" (%1)").arg(mSettings.isUseThemeIcons() ? QIcon::themeName() : tr("built in"))); - - int chargePercent = mUi->chargeLevelSlider->value(); - mChargingIconProducer.updateChargePercent(chargePercent); - mDischargingIconProducer.updateChargePercent(chargePercent); - mUi->chargeLevelLabel->setText(tr("Level: %1%").arg(chargePercent)); -} - -void BatteryWatcherSettings::onChargeIconChanged() -{ - mUi->chargingIcon->setPixmap(mChargingIconProducer.mIcon.pixmap(mUi->chargingIcon->size())); - mUi->chargingLabel->setText(mChargingIconProducer.mIconName); -} - -void BatteryWatcherSettings::onDischargeIconChanged() -{ - mUi->dischargingIcon->setPixmap(mDischargingIconProducer.mIcon.pixmap(mUi->dischargingIcon->size())); - mUi->dischargingLabel->setText(mDischargingIconProducer.mIconName); -} diff --git a/config/batterywatchersettings.h b/config/batterywatchersettings.h deleted file mode 100644 index f9b92a5..0000000 --- a/config/batterywatchersettings.h +++ /dev/null @@ -1,66 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef POWERLOWSETTINGS_H -#define POWERLOWSETTINGS_H - -#include -#include - -#include "../config/powermanagementsettings.h" -#include "../src/iconproducer.h" - -#include "helpers.h" - -namespace Ui { -class BatteryWatcherSettings; -} - -class BatteryWatcherSettings : public QWidget -{ - Q_OBJECT - -public: - explicit BatteryWatcherSettings(QWidget *parent = 0); - ~BatteryWatcherSettings(); - -public slots: - void loadSettings(); - -private slots: - void saveSettings(); - void updatePreview(); - void onChargeIconChanged(); - void onDischargeIconChanged(); - -private: - PowerManagementSettings mSettings; - Ui::BatteryWatcherSettings *mUi; - IconProducer mChargingIconProducer; - IconProducer mDischargingIconProducer; -}; - -#endif // POWERLOWSETTINGS_H diff --git a/config/batterywatchersettings.ui b/config/batterywatchersettings.ui deleted file mode 100644 index c4ae1d0..0000000 --- a/config/batterywatchersettings.ui +++ /dev/null @@ -1,249 +0,0 @@ - - - BatteryWatcherSettings - - - - 0 - 0 - 428 - 414 - - - - Battery Watcher Settings - - - - - - - 0 - 0 - - - - E&nable Battery Watcher - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - When power is low then: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Warning: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - seconds - - - 500 - - - - - - - Level is low at: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - % - - - - - - - Show icon: - - - - - - - - - - - - - - Use icons from theme: - - - - - - - - - - - - - - Preview - - - - - - 100 - - - Qt::Horizontal - - - - - - - - 50 - 50 - - - - - - - Qt::AlignCenter - - - - - - - - 9 - - - - Charging - - - Qt::AlignCenter - - - - - - - - 50 - 50 - - - - - - - Qt::AlignCenter - - - - - - - - - - - - - - - 9 - - - - Discharging - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 15 - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 25 - - - - - - - - - - - - diff --git a/config/helpers.cpp b/config/helpers.cpp deleted file mode 100644 index 3181488..0000000 --- a/config/helpers.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include - -#include - -#include "helpers.h" - -void fillComboBox(QComboBox* comboBox) -{ - comboBox->clear(); - comboBox->addItem(QObject::tr("Nothing"), -1); - comboBox->addItem(QObject::tr("Lock screen"), -2); // FIXME - comboBox->addItem(QObject::tr("Suspend"), LXQt::Power::PowerSuspend); - comboBox->addItem(QObject::tr("Hibernate"), LXQt::Power::PowerHibernate); - comboBox->addItem(QObject::tr("Shutdown"), LXQt::Power::PowerShutdown); -} - -void setComboBoxToValue(QComboBox* comboBox, int value) -{ - for (int index = 0; index < comboBox->count(); index++) - { - if (value == comboBox->itemData(index).toInt()) - { - comboBox->setCurrentIndex(index); - return; - } - } - - comboBox->setCurrentIndex(0); -} - -int currentValue(QComboBox *comboBox) -{ - return comboBox->itemData(comboBox->currentIndex()).toInt(); -} - diff --git a/config/helpers.h b/config/helpers.h deleted file mode 100644 index 8d54fcb..0000000 --- a/config/helpers.h +++ /dev/null @@ -1,20 +0,0 @@ -/* -* Copyright (c) 2014 Christian Surlykke -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license. -*/ -#ifndef POWER_MANAGEMENT_SETTINGS_H -#define POWER_MANAGEMENT_SETTINGS_H - -#include - -void fillComboBox(QComboBox* comboBox); - -void setComboBoxToValue(QComboBox* comboBox, int value); - -int currentValue(QComboBox *comboBox); - -#endif // POWER_MANAGEMENT_SETTINGS_H - diff --git a/config/icons/laptop-lid.svg b/config/icons/laptop-lid.svg deleted file mode 100644 index e66164d..0000000 --- a/config/icons/laptop-lid.svg +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/config/idlenesswatchersettings.cpp b/config/idlenesswatchersettings.cpp deleted file mode 100644 index 9844a29..0000000 --- a/config/idlenesswatchersettings.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include - -#include "idlenesswatchersettings.h" -#include "ui_idlenesswatchersettings.h" -#include "helpers.h" - -#define MINIMUM_SECONDS 30 - -IdlenessWatcherSettings::IdlenessWatcherSettings(QWidget *parent) : - QWidget(parent), - mSettings(), - mUi(new Ui::IdlenessWatcherSettings) -{ - mUi->setupUi(this); - fillComboBox(mUi->idleActionComboBox); - connect(mUi->idlenessWatcherGroupBox, SIGNAL(clicked()), SLOT(saveSettings())); - connect(mUi->idleActionComboBox, SIGNAL(activated(int)), SLOT(saveSettings())); - connect(mUi->idleTimeMinutesSpinBox, SIGNAL(editingFinished()), SLOT(saveSettings())); - connect(mUi->idleTimeMinutesSpinBox, SIGNAL(valueChanged(int)), SLOT(minutesChanged(int))); - connect(mUi->idleTimeSecondsSpinBox, SIGNAL(valueChanged(int)), SLOT(secondsChanged(int))); - - connect(mUi->idleTimeSecondsSpinBox, SIGNAL(editingFinished()), SLOT(saveSettings())); -} - -IdlenessWatcherSettings::~IdlenessWatcherSettings() -{ - delete mUi; -} - -void IdlenessWatcherSettings::loadSettings() -{ - mUi->idlenessWatcherGroupBox->setChecked(mSettings.isIdlenessWatcherEnabled()); - setComboBoxToValue(mUi->idleActionComboBox, mSettings.getIdlenessAction()); - - int idlenessTimeSeconds = mSettings.getIdlenessTimeSecs(); - // if less than minimum, change to 15 minutes - if (idlenessTimeSeconds < MINIMUM_SECONDS) - idlenessTimeSeconds = 900; - int idlenessTimeMinutes = idlenessTimeSeconds / 60; - idlenessTimeSeconds = idlenessTimeSeconds % 60; - mUi->idleTimeMinutesSpinBox->setValue(idlenessTimeMinutes); - mUi->idleTimeSecondsSpinBox->setValue(idlenessTimeSeconds); -} - -void IdlenessWatcherSettings::minutesChanged(int newVal) -{ - if (newVal < 1 && mUi->idleTimeSecondsSpinBox->value() < MINIMUM_SECONDS) - { - mUi->idleTimeSecondsSpinBox->setValue(MINIMUM_SECONDS); - } -} - -void IdlenessWatcherSettings::secondsChanged(int newVal) -{ - if (newVal > 59) - { - mUi->idleTimeSecondsSpinBox->setValue(0); - mUi->idleTimeMinutesSpinBox->setValue(mUi->idleTimeMinutesSpinBox->value() + 1); - } - else if (mUi->idleTimeMinutesSpinBox->value() < 1 && newVal < MINIMUM_SECONDS) - { - mUi->idleTimeMinutesSpinBox->setValue(0); - mUi->idleTimeSecondsSpinBox->setValue(MINIMUM_SECONDS); - } - else if (newVal < 0) - { - mUi->idleTimeMinutesSpinBox->setValue(mUi->idleTimeMinutesSpinBox->value() - 1); - mUi->idleTimeSecondsSpinBox->setValue(59); - } -} - - - -void IdlenessWatcherSettings::saveSettings() -{ - mSettings.setIdlenessWatcherEnabled(mUi->idlenessWatcherGroupBox->isChecked()); - mSettings.setIdlenessAction(currentValue(mUi->idleActionComboBox)); - - int idleTimeSecs = 60 * mUi->idleTimeMinutesSpinBox->value() + mUi->idleTimeSecondsSpinBox->value(); - // if less than minimum, change 15 minutes - if (idleTimeSecs < MINIMUM_SECONDS) - { - idleTimeSecs = 900; - mUi->idleTimeMinutesSpinBox->setValue(15); - mUi->idleTimeSecondsSpinBox->setValue(0); - } - - mSettings.setIdlenessTimeSecs(idleTimeSecs); -} diff --git a/config/idlenesswatchersettings.h b/config/idlenesswatchersettings.h deleted file mode 100644 index 2219eb4..0000000 --- a/config/idlenesswatchersettings.h +++ /dev/null @@ -1,60 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef IDLE_SETTINGS_H -#define IDLE_SETTINGS_H - -#include -#include - -#include "powermanagementsettings.h" - -namespace Ui { - class IdlenessWatcherSettings; -} - -class IdlenessWatcherSettings : public QWidget -{ - Q_OBJECT - -public: - explicit IdlenessWatcherSettings(QWidget *parent = 0); - ~IdlenessWatcherSettings(); - -public slots: - void loadSettings(); - -private slots: - void minutesChanged(int newVal); - void secondsChanged(int newVal); - void saveSettings(); - -private: - PowerManagementSettings mSettings; - Ui::IdlenessWatcherSettings *mUi; -}; - -#endif // IDLE_SETTINGS_H diff --git a/config/idlenesswatchersettings.ui b/config/idlenesswatchersettings.ui deleted file mode 100644 index c00d729..0000000 --- a/config/idlenesswatchersettings.ui +++ /dev/null @@ -1,103 +0,0 @@ - - - IdlenessWatcherSettings - - - - 0 - 0 - 309 - 177 - - - - Form - - - - - - Enab&le Idleness Watcher - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 0 - 0 - - - - When idle then: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - 0 - 0 - - - - Idle time: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - minutes - - - 999 - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - seconds - - - -1 - - - 60 - - - - - - - - - - - diff --git a/config/lidwatchersettings.cpp b/config/lidwatchersettings.cpp deleted file mode 100644 index bfdb88c..0000000 --- a/config/lidwatchersettings.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include - -#include "lidwatchersettings.h" -#include "ui_lidwatchersettings.h" -#include "helpers.h" - -LidWatcherSettings::LidWatcherSettings(QWidget *parent) : - QWidget(parent), - mSettings(), - mUi(new Ui::LidWatcherSettings) -{ - mUi->setupUi(this); - - fillComboBox(mUi->onBatteryActionComboBox); - fillComboBox(mUi->onAcActionComboBox); - fillComboBox(mUi->extMonOnBatteryActionComboBox); - fillComboBox(mUi->extMonOnAcActionComboBox); - - connect(mUi->lidWatcherSettingsGroupBox, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(mUi->onBatteryActionComboBox, SIGNAL(activated(int)), this, SLOT(saveSettings())); - connect(mUi->onAcActionComboBox, SIGNAL(activated(int)), this, SLOT(saveSettings())); - connect(mUi->extMonOnBatteryActionComboBox, SIGNAL(activated(int)), this, SLOT(saveSettings())); - connect(mUi->extMonOnAcActionComboBox, SIGNAL(activated(int)), this, SLOT(saveSettings())); - connect(mUi->extMonGroupBox, SIGNAL(clicked()), this, SLOT(saveSettings())); -} - -LidWatcherSettings::~LidWatcherSettings() -{ - delete mUi; -} - -void LidWatcherSettings::loadSettings() -{ - mUi->lidWatcherSettingsGroupBox->setChecked(mSettings.isLidWatcherEnabled()); - - setComboBoxToValue(mUi->onBatteryActionComboBox, mSettings.getLidClosedAction()); - setComboBoxToValue(mUi->onAcActionComboBox, mSettings.getLidClosedAcAction()); - - mUi->extMonGroupBox->setChecked(mSettings.isEnableExtMonLidClosedActions()); - setComboBoxToValue(mUi->extMonOnBatteryActionComboBox, mSettings.getLidClosedExtMonAction()); - setComboBoxToValue(mUi->extMonOnAcActionComboBox, mSettings.getLidClosedExtMonAcAction()); - -} - -void LidWatcherSettings::saveSettings() -{ - mSettings.setLidWatcherEnabled(mUi->lidWatcherSettingsGroupBox->isChecked()); - - mSettings.setLidClosedAction(currentValue(mUi->onBatteryActionComboBox)); - mSettings.setLidClosedAcAction(currentValue(mUi->onAcActionComboBox)); - - mSettings.setEnableExtMonLidClosedActions(mUi->extMonGroupBox->isChecked()); - mSettings.setLidClosedExtMonAction(currentValue(mUi->extMonOnBatteryActionComboBox)); - mSettings.setLidClosedExtMonAcAction(currentValue(mUi->extMonOnAcActionComboBox)); -} diff --git a/config/lidwatchersettings.h b/config/lidwatchersettings.h deleted file mode 100644 index 9c5feb1..0000000 --- a/config/lidwatchersettings.h +++ /dev/null @@ -1,58 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef LIDSETTINGS_H -#define LIDSETTINGS_H - -#include -#include - -#include "powermanagementsettings.h" - -namespace Ui { -class LidWatcherSettings; -} - -class LidWatcherSettings : public QWidget -{ - Q_OBJECT - -public: - explicit LidWatcherSettings(QWidget *parent = 0); - ~LidWatcherSettings(); - -public slots: - void loadSettings(); - -private slots: - void saveSettings(); - -private: - PowerManagementSettings mSettings; - Ui::LidWatcherSettings *mUi; -}; - -#endif // LIDSETTINGS_H diff --git a/config/lidwatchersettings.ui b/config/lidwatchersettings.ui deleted file mode 100644 index d5e1647..0000000 --- a/config/lidwatchersettings.ui +++ /dev/null @@ -1,152 +0,0 @@ - - - LidWatcherSettings - - - - 0 - 0 - 276 - 289 - - - - Form - - - QGroupBox QGroupBox { -border: none; -padding-top: 30px; -} - - - - - - Enable &Lid Watcher - - - true - - - true - - - - - - - - - Action when lid is closed - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - On Battery - - - - - - - - Nothing - - - - - Suspend - - - - - Hibernate - - - - - Shut down - - - - - - - - On AC - - - - - - - - - - - - - When &using external monitor - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 0 - 0 - - - - On Battery - - - - - - - - - - On AC - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - diff --git a/config/lxqt-config-powermanagement.desktop.in b/config/lxqt-config-powermanagement.desktop.in deleted file mode 100644 index 2da97fd..0000000 --- a/config/lxqt-config-powermanagement.desktop.in +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Power Management -GenericName=Power Management Settings -Comment=Various settings regarding Power Management like battery or idleness watcher -Exec=lxqt-config-powermanagement -Icon=preferences-system-power-management -Categories=Settings;DesktopSettings;Qt;LXQt; -OnlyShowIn=LXQt; - -#TRANSLATIONS_DIR=translations diff --git a/config/main.cpp b/config/main.cpp deleted file mode 100644 index 52c0c0f..0000000 --- a/config/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include - -#include - -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - LXQt::SingleApplication a(argc, argv); - a.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Config Powermanagement")); - const QString VERINFO = QStringLiteral(LXQT_POWERMANAGEMENT_VERSION - "\nliblxqt " LXQT_VERSION - "\nQt " QT_VERSION_STR); - a.setApplicationVersion(VERINFO); - parser.addVersionOption(); - parser.addHelpOption(); - parser.process(a); - - MainWindow mainWindow; - mainWindow.setWindowIcon(QIcon::fromTheme("preferences-system-power-management")); - mainWindow.show(); - a.setActivationWindow(&mainWindow); - - return a.exec(); -} diff --git a/config/mainwindow.cpp b/config/mainwindow.cpp deleted file mode 100644 index e54fa5c..0000000 --- a/config/mainwindow.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include "mainwindow.h" -#include "lidwatchersettings.h" -#include "batterywatchersettings.h" -#include "idlenesswatchersettings.h" - -MainWindow::MainWindow(QWidget *parent) : - LXQt::ConfigDialog(tr("Power Management Settings"), new PowerManagementSettings(parent)) -{ - BatteryWatcherSettings* batteryWatcherSettings = new BatteryWatcherSettings(this); - addPage(batteryWatcherSettings, tr("Battery"), "battery"); - connect(this, SIGNAL(reset()), batteryWatcherSettings, SLOT(loadSettings())); - - LidWatcherSettings *lidwatcherSettings = new LidWatcherSettings(this); - addPage(lidwatcherSettings, tr("Lid"), "laptop-lid"); - connect(this, SIGNAL(reset()), lidwatcherSettings, SLOT(loadSettings())); - - IdlenessWatcherSettings* idlenessWatcherSettings = new IdlenessWatcherSettings(this); - addPage(idlenessWatcherSettings, tr("Idle"), (QStringList() << "user-idle" << "user-away")); - connect(this, SIGNAL(reset()), idlenessWatcherSettings, SLOT(loadSettings())); - - emit reset(); -} diff --git a/config/mainwindow.h b/config/mainwindow.h deleted file mode 100644 index 51aad10..0000000 --- a/config/mainwindow.h +++ /dev/null @@ -1,40 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -class MainWindow : public LXQt::ConfigDialog -{ - Q_OBJECT - -public: - MainWindow(QWidget *parent = 0); -}; - -#endif // MAINWINDOW_H diff --git a/config/powermanagementsettings.cpp b/config/powermanagementsettings.cpp deleted file mode 100644 index b52b368..0000000 --- a/config/powermanagementsettings.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include - -#include - -#include "powermanagementsettings.h" - -namespace PowerManagementSettingsConstants -{ - const QString RUN_CHECK_LEVEL = "runCheckLevel"; - const QString ENABLE_BATTERY_WATCHER_KEY = "enableBatteryWatcher"; - const QString ENABLE_LID_WATCHER_KEY = "enableLidWatcher"; - const QString ENABLE_IDLENESS_WATCHER_KEY = "enableIdlenessWatcher"; - const QString LID_CLOSED_ACTION_KEY = "lidClosedAction"; - const QString LID_CLOSED_AC_ACTION_KEY = "lidClosedAcAction"; - const QString LID_CLOSED_EXT_MON_ACTION_KEY = "lidClosedExtMonAction"; - const QString LID_CLOSED_EXT_MON_AC_ACTION_KEY = "lidClosedExtMonAcAction"; - const QString ENABLE_EXT_MON_LIDCLOSED_ACTIONS_KEY = "enableExtMonLidClosedActions"; - const QString POWER_LOW_ACTION_KEY = "powerLowAction"; - const QString POWER_LOW_WARNING_KEY = "powerLowWarning"; - const QString POWER_LOW_LEVEL_KEY = "powerLowLevel"; - const QString SHOW_ICON_KEY = "showIcon"; - const QString USE_THEME_ICONS_KEY = "useThemeIcons"; - const QString IDLENESS_ACTION_KEY = "idlenessAction"; - const QString IDLENESS_TIME_SECS_KEY = "idlenessTimeSecs"; -} - -using namespace PowerManagementSettingsConstants; - -PowerManagementSettings::PowerManagementSettings(QObject* parent) : LXQt::Settings("lxqt-powermanagement") -{ -} - -PowerManagementSettings::~PowerManagementSettings() -{ -} - -int PowerManagementSettings::getRunCheckLevel() -{ - return value(RUN_CHECK_LEVEL, 0).toInt(); -} - -void PowerManagementSettings::setRunCheckLevel(int newLevel) -{ - setValue(RUN_CHECK_LEVEL, newLevel); -} - -bool PowerManagementSettings::isBatteryWatcherEnabled() -{ - return value(ENABLE_BATTERY_WATCHER_KEY, true).toBool(); -} - -void PowerManagementSettings::setBatteryWatcherEnabled(bool batteryWatcherEnabled) -{ - setValue(ENABLE_BATTERY_WATCHER_KEY, batteryWatcherEnabled); -} - -int PowerManagementSettings::getPowerLowAction() -{ - return value(POWER_LOW_ACTION_KEY, -1).toInt(); -} - -void PowerManagementSettings::setPowerLowAction(int powerLowAction) -{ - setValue(POWER_LOW_ACTION_KEY, powerLowAction); -} - -int PowerManagementSettings::getPowerLowLevel() -{ - return value(POWER_LOW_LEVEL_KEY, 5).toInt(); -} - -void PowerManagementSettings::setPowerLowLevel(int powerLowLevel) -{ - setValue(POWER_LOW_LEVEL_KEY, powerLowLevel); -} - -int PowerManagementSettings::getPowerLowWarningTime() -{ - return value(POWER_LOW_WARNING_KEY, 30).toInt(); -} - -void PowerManagementSettings::setPowerLowWarningTime(int powerLowWarningTime) -{ - setValue(POWER_LOW_WARNING_KEY, powerLowWarningTime); -} - -bool PowerManagementSettings::isShowIcon() -{ - return value(SHOW_ICON_KEY, true).toBool(); -} - -void PowerManagementSettings::setShowIcon(bool showIcon) -{ - setValue(SHOW_ICON_KEY, showIcon); -} - -bool PowerManagementSettings::isUseThemeIcons() -{ - return value(USE_THEME_ICONS_KEY, false).toBool(); -} - -void PowerManagementSettings::setUseThemeIcons(bool useThemeIcons) -{ - setValue(USE_THEME_ICONS_KEY, useThemeIcons); -} - -bool PowerManagementSettings::isLidWatcherEnabled() -{ - return value(ENABLE_LID_WATCHER_KEY, true).toBool(); -} - -void PowerManagementSettings::setLidWatcherEnabled(bool lidWatcherEnabled) -{ - setValue(ENABLE_LID_WATCHER_KEY, lidWatcherEnabled); -} - -int PowerManagementSettings::getLidClosedAcAction() -{ - return value(LID_CLOSED_AC_ACTION_KEY, -1).toInt(); -} - -void PowerManagementSettings::setLidClosedAcAction(int lidClosedAcAction) -{ - setValue(LID_CLOSED_AC_ACTION_KEY, lidClosedAcAction); -} - -int PowerManagementSettings::getLidClosedAction() -{ - return value(LID_CLOSED_ACTION_KEY, -1).toInt(); -} - -void PowerManagementSettings::setLidClosedAction(int lidClosedAction) -{ - setValue(LID_CLOSED_ACTION_KEY, lidClosedAction); -} - -int PowerManagementSettings::getLidClosedExtMonAcAction() -{ - return value(LID_CLOSED_EXT_MON_AC_ACTION_KEY, -1).toInt(); -} - -void PowerManagementSettings::setLidClosedExtMonAcAction(int lidClosedExtMonAcAction) -{ - setValue(LID_CLOSED_EXT_MON_AC_ACTION_KEY, lidClosedExtMonAcAction); -} - -int PowerManagementSettings::getLidClosedExtMonAction() -{ - return value(LID_CLOSED_EXT_MON_ACTION_KEY, -1).toInt(); -} - -void PowerManagementSettings::setLidClosedExtMonAction(int lidClosedExtMonAction) -{ - setValue(LID_CLOSED_EXT_MON_ACTION_KEY, lidClosedExtMonAction); -} - -bool PowerManagementSettings::isEnableExtMonLidClosedActions() -{ - return value(ENABLE_EXT_MON_LIDCLOSED_ACTIONS_KEY, 0).toBool(); -} - -void PowerManagementSettings::setEnableExtMonLidClosedActions(bool enableExtMonLidClosedActions) -{ - setValue(ENABLE_EXT_MON_LIDCLOSED_ACTIONS_KEY, enableExtMonLidClosedActions); -} - -int PowerManagementSettings::getIdlenessAction() -{ - // default to nothing (-1) - return value(IDLENESS_ACTION_KEY, -1).toInt(); -} - -void PowerManagementSettings::setIdlenessAction(int idlenessAction) -{ - setValue(IDLENESS_ACTION_KEY, idlenessAction); -} - -int PowerManagementSettings::getIdlenessTimeSecs() -{ - // default to 15 minutes - return value(IDLENESS_TIME_SECS_KEY, 900).toInt(); -} - -void PowerManagementSettings::setIdlenessTimeSecs(int idlenessTimeSecs) -{ - setValue(IDLENESS_TIME_SECS_KEY, idlenessTimeSecs); -} - - -bool PowerManagementSettings::isIdlenessWatcherEnabled() -{ - return value(ENABLE_IDLENESS_WATCHER_KEY, false).toBool(); -} - -void PowerManagementSettings::setIdlenessWatcherEnabled(bool idlenessWatcherEnabled) -{ - setValue(ENABLE_IDLENESS_WATCHER_KEY, idlenessWatcherEnabled); -} - - diff --git a/config/powermanagementsettings.h b/config/powermanagementsettings.h deleted file mode 100644 index f30b93f..0000000 --- a/config/powermanagementsettings.h +++ /dev/null @@ -1,95 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef COMMON_H -#define COMMON_H - -#include -#include - -#include - -class PowerManagementSettings : public LXQt::Settings -{ - Q_OBJECT - -public: - PowerManagementSettings(QObject* parent = 0); - ~PowerManagementSettings(); - - int getRunCheckLevel(); - void setRunCheckLevel(int newLevel); - - bool isBatteryWatcherEnabled(); - void setBatteryWatcherEnabled(bool batteryWatcherEnabled); - - int getPowerLowAction(); - void setPowerLowAction(int powerLowAction); - - int getPowerLowLevel(); - void setPowerLowLevel(int powerLowLevel); - - int getPowerLowWarningTime(); - void setPowerLowWarningTime(int powerLowWarningTime); - - bool isShowIcon(); - void setShowIcon(bool showIcon); - - bool isUseThemeIcons(); - void setUseThemeIcons(bool useThemeIcons); - - - bool isLidWatcherEnabled(); - void setLidWatcherEnabled(bool lidWatcherEnabled); - - int getLidClosedAcAction(); - void setLidClosedAcAction(int lidClosedAcAction); - - int getLidClosedAction(); - void setLidClosedAction(int lidClosedAction); - - int getLidClosedExtMonAcAction(); - void setLidClosedExtMonAcAction(int lidClosedExtMonAcAction); - - int getLidClosedExtMonAction(); - void setLidClosedExtMonAction(int lidClosedExtMonAction); - - bool isEnableExtMonLidClosedActions(); - void setEnableExtMonLidClosedActions(bool enableExtMonLidClosedActions); - - int getIdlenessAction(); - void setIdlenessAction(int idlenessAction); - - int getIdlenessTimeSecs(); - void setIdlenessTimeSecs(int idlenessTimeSecs); - - bool isIdlenessWatcherEnabled(); - void setIdlenessWatcherEnabled(bool idlenessWatcherEnabled); -}; - - -#endif // COMMON_H diff --git a/config/translations/lxqt-config-powermanagement_ar.desktop b/config/translations/lxqt-config-powermanagement_ar.desktop deleted file mode 100644 index e1dffc2..0000000 --- a/config/translations/lxqt-config-powermanagement_ar.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[ar]=إدارة الطّاقة -GenericName[ar]=إعدادات إدارة الطّاقة -Comment[ar]=عدّة إعدادات لإدارة الطّاقة مثل مراقبات البطّاريّة أو الخمول diff --git a/config/translations/lxqt-config-powermanagement_ca.desktop b/config/translations/lxqt-config-powermanagement_ca.desktop deleted file mode 100644 index 8bb204a..0000000 --- a/config/translations/lxqt-config-powermanagement_ca.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[ca]=Gestió de l'energia -GenericName[ca]=Ajusts de la gestió de l'energia -Comment[ca]=Diversos ajusts pel que fa a la gestió de l'energia com la bateria o l'observador de l'ociositat diff --git a/config/translations/lxqt-config-powermanagement_da.desktop b/config/translations/lxqt-config-powermanagement_da.desktop deleted file mode 100644 index a2c1cd7..0000000 --- a/config/translations/lxqt-config-powermanagement_da.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[da]=Strømstyring -GenericName[da]=Indstillinger for strømstyring -Comment[da]=Diverse indstillinger omhandlende strømstyring, såsom batteri- eller tomgangsovervågning diff --git a/config/translations/lxqt-config-powermanagement_de.desktop b/config/translations/lxqt-config-powermanagement_de.desktop deleted file mode 100644 index 4357f9d..0000000 --- a/config/translations/lxqt-config-powermanagement_de.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[de]=Energieverwaltung -GenericName[de]=Einstellungen der Energieverwaltung -Comment[de]=Verschiedene Einstellungen zur Energieverwaltung wie Batterie- oder Leerlaufüberwachung diff --git a/config/translations/lxqt-config-powermanagement_el.desktop b/config/translations/lxqt-config-powermanagement_el.desktop deleted file mode 100644 index fba769a..0000000 --- a/config/translations/lxqt-config-powermanagement_el.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[el]=Διαχείριση ενέργειας -GenericName[el]=Ρυθμίσεις της διαχείρισης ενέργειας -Comment[el]=Διάφορες ρυθμίσεις σχετικά με την διαχείριση ενέργειας όπως ο επόπτης μπαταρίας ή αδράνειας diff --git a/config/translations/lxqt-config-powermanagement_fr.desktop b/config/translations/lxqt-config-powermanagement_fr.desktop deleted file mode 100644 index 7506b69..0000000 --- a/config/translations/lxqt-config-powermanagement_fr.desktop +++ /dev/null @@ -1,4 +0,0 @@ -#Translations -Name[fr]=Gestion de l'énergie -GenericName[fr]=Paramétrage de la gestion de l'énergie -Comment[fr]=Divers paramétrages de la gestion de l'énergie, tels que batteries ou contrôle de l'activité diff --git a/config/translations/lxqt-config-powermanagement_hu.desktop b/config/translations/lxqt-config-powermanagement_hu.desktop deleted file mode 100644 index 531a865..0000000 --- a/config/translations/lxqt-config-powermanagement_hu.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[hu]=Energiakezelés -GenericName[hu]=LXQt energiakezelés beállítása -Comment[hu]=LXQt energiakezelés beállítása diff --git a/config/translations/lxqt-config-powermanagement_it.desktop b/config/translations/lxqt-config-powermanagement_it.desktop deleted file mode 100644 index 8bfc77c..0000000 --- a/config/translations/lxqt-config-powermanagement_it.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[it]=Gestore energia -GenericName[it]=Impostazioni del risparmio energetico -Comment[it]=Diverse impostazioni per il risparmio energetico diff --git a/config/translations/lxqt-config-powermanagement_ja.desktop b/config/translations/lxqt-config-powermanagement_ja.desktop deleted file mode 100644 index 9b9ab96..0000000 --- a/config/translations/lxqt-config-powermanagement_ja.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ja]=電源管理 -GenericName[ja]=電源管理の設定 -Comment[ja]=電源管理の設定 diff --git a/config/translations/lxqt-config-powermanagement_lt.desktop b/config/translations/lxqt-config-powermanagement_lt.desktop deleted file mode 100644 index 5c17425..0000000 --- a/config/translations/lxqt-config-powermanagement_lt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[lt]=Maitinimo valdymas -GenericName[lt]=Maitinimo valdymo nustatymai -Comment[lt]=Įvairūs su maitinimo valdymu susiję nustatymai diff --git a/config/translations/lxqt-config-powermanagement_pl.desktop b/config/translations/lxqt-config-powermanagement_pl.desktop deleted file mode 100644 index 79cb70e..0000000 --- a/config/translations/lxqt-config-powermanagement_pl.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[pl]=Zarządzanie energią -GenericName[pl]=Konfiguracja zarządzania energią -Comment[pl]=Konfiguracja zarządzania energią diff --git a/config/translations/lxqt-config-powermanagement_pt.desktop b/config/translations/lxqt-config-powermanagement_pt.desktop deleted file mode 100644 index 6bc18b9..0000000 --- a/config/translations/lxqt-config-powermanagement_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[pt]=Gestão de energia -GenericName[pt]=Definições do gestor de energia -Comment[pt]=Definições do gestor de energia diff --git a/config/translations/lxqt-config-powermanagement_ru.desktop b/config/translations/lxqt-config-powermanagement_ru.desktop deleted file mode 100644 index 5649054..0000000 --- a/config/translations/lxqt-config-powermanagement_ru.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ru]=Управление энергопотреблением -GenericName[ru]=Настройки управления энергопотреблением -Comment[ru]=Настройки управления энергопотреблением diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 3b5c7b7..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -project(lxqt-powermanagement) - -set(QTX_LIBRARIES Qt5::Widgets Qt5::DBus Qt5::Svg Qt5::X11Extras) - -set(SOURCES - watcher.cpp - batteryhelper.cpp - batteryinfoframe.cpp - batteryinfodialog.cpp - batterywatcher.cpp - idlenesswatcher.cpp - lid.cpp - lidwatcher.cpp - main.cpp - powermanagementd.cpp - trayicon.cpp - iconproducer.cpp - ../config/powermanagementsettings.cpp -) - -set(UI_FILES - batteryinfoframe.ui - batteryinfodialog.ui -) - -set(DESKTOP_FILES_IN - lxqt-powermanagement.desktop.in -) - -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS} - SOURCES - ${SOURCES} - ${UI_FILES} - INSTALL_DIR - ${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME} - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-powermanagement/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(lxqt-powermanagement_QM_LOADER ${PROJECT_NAME}) - -find_package(KF5IdleTime REQUIRED) - -include_directories( - ${Qt5Gui_PRIVATE_INCLUDE_DIRS} -) - -add_executable(lxqt-powermanagement - ${SOURCES} - ${RSCS} - ${QM_FILES} - ${lxqt-powermanagement_QM_LOADER} - ${DESKTOP_FILES} -) - -target_link_libraries(lxqt-powermanagement - lxqt - ${QTX_LIBRARIES} - KF5::Solid - KF5::IdleTime -) - -install(TARGETS - ${PROJECT_NAME} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT Runtime -) -install(FILES - ${DESKTOP_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" - COMPONENT Runtime -) diff --git a/src/batteryhelper.cpp b/src/batteryhelper.cpp deleted file mode 100644 index 00ae063..0000000 --- a/src/batteryhelper.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2011 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include -#include -#include - -#include "batteryhelper.h" -#include "../config/powermanagementsettings.h" - -QString BatteryHelper::stateToString(Solid::Battery::ChargeState state) -{ - switch (state) - { - case Solid::Battery::NoCharge: - return tr("Empty"); - case Solid::Battery::Discharging: - return tr("Discharging"); - case Solid::Battery::FullyCharged: - return tr("Fully charged"); - case Solid::Battery::Charging: - default: - return tr("Charging"); - } -} - -QString BatteryHelper::technologyToString(Solid::Battery::Technology tech) -{ - switch (tech) - { - case Solid::Battery::LithiumIon: - return tr("Lithium ion"); - case Solid::Battery::LithiumPolymer: - return tr("Lithium polymer"); - case Solid::Battery::LithiumIronPhosphate: - return tr("Lithium iron phosphate"); - case Solid::Battery::LeadAcid: - return tr("Lead acid"); - case Solid::Battery::NickelCadmium: - return tr("Nickel cadmium"); - case Solid::Battery::NickelMetalHydride: - return tr("Nickel metal hydride"); - case Solid::Battery::UnknownTechnology: - default: - return tr("Unknown"); - } -} - -QString BatteryHelper::typeToString(Solid::Battery::BatteryType type) -{ - switch (type) - { - case Solid::Battery::PdaBattery: - return tr("Personal Digital Assistant's battery"); - case Solid::Battery::UpsBattery: - return tr("Uninterruptible Power Supply's battery"); - case Solid::Battery::PrimaryBattery: - return tr("Primary battery"); - case Solid::Battery::MouseBattery: - return tr("Mouse battery"); - case Solid::Battery::KeyboardBattery: - return tr("Keyboard battery"); - case Solid::Battery::KeyboardMouseBattery: - return tr("Keyboard and mouse's battery"); - case Solid::Battery::CameraBattery: - return tr("Camera battery"); - case Solid::Battery::PhoneBattery: - return tr("Phone battery"); - case Solid::Battery::MonitorBattery: - return tr("Monitor battery"); - case Solid::Battery::UnknownBattery: - default: - return tr("Unknown battery"); - } -} diff --git a/src/batteryhelper.h b/src/batteryhelper.h deleted file mode 100644 index a99adec..0000000 --- a/src/batteryhelper.h +++ /dev/null @@ -1,44 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2011 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef BATTERYHELPER_H -#define BATTERYHELPER_H - -#include -#include -#include -#include - -class BatteryHelper : public QObject -{ - Q_OBJECT - -public: - static QString stateToString(Solid::Battery::ChargeState state); - static QString technologyToString(Solid::Battery::Technology tech); - static QString typeToString(Solid::Battery::BatteryType type); -}; -#endif diff --git a/src/batteryinfodialog.cpp b/src/batteryinfodialog.cpp deleted file mode 100644 index a6c9a9a..0000000 --- a/src/batteryinfodialog.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2014 Christian Surlykke -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license. -*/ - -#include "batteryinfodialog.h" -#include "ui_batteryinfodialog.h" - -#include -#include -#include - -BatteryInfoDialog::BatteryInfoDialog(QList batteries, QWidget *parent) : - QDialog(parent), - ui(new Ui::BatteryInfoDialog) -{ - ui->setupUi(this); - - setWindowTitle(tr("Battery Info")); - - if (batteries.size() == 1) - { - BatteryInfoFrame *batteryInfoFrame = new BatteryInfoFrame(batteries[0]); - ui->verticalLayout->insertWidget(0, batteryInfoFrame); - } - else - { - QTabWidget *tabWidget = new QTabWidget(this); - ui->verticalLayout->insertWidget(0, tabWidget); - foreach (Solid::Battery *battery, batteries) - { - BatteryInfoFrame *batteryInfoFrame = new BatteryInfoFrame(battery); - tabWidget->addTab(batteryInfoFrame, "BAT"); - } - } -} - -BatteryInfoDialog::~BatteryInfoDialog() -{ - delete ui; -} - -void BatteryInfoDialog::toggleShow() -{ - qDebug() << "toggleShow"; - isVisible() ? hide() : show(); -} diff --git a/src/batteryinfodialog.h b/src/batteryinfodialog.h deleted file mode 100644 index c512060..0000000 --- a/src/batteryinfodialog.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2014 Christian Surlykke -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license. -*/ - -#ifndef BATTERYINFODIALOG_H -#define BATTERYINFODIALOG_H - -#include "batteryinfoframe.h" - -#include -#include -#include - -namespace Ui { -class BatteryInfoDialog; -} - -class BatteryInfoDialog : public QDialog -{ - Q_OBJECT - -public: - explicit BatteryInfoDialog(QList batteries, QWidget *parent = 0); - ~BatteryInfoDialog(); - -public slots: - void toggleShow(); - -private: - Ui::BatteryInfoDialog *ui; -}; - -#endif // BATTERYINFODIALOG_H diff --git a/src/batteryinfodialog.ui b/src/batteryinfodialog.ui deleted file mode 100644 index bfc14a1..0000000 --- a/src/batteryinfodialog.ui +++ /dev/null @@ -1,64 +0,0 @@ - - - BatteryInfoDialog - - - - 0 - 0 - 334 - 301 - - - - Dialog - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - BatteryInfoDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - BatteryInfoDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/src/batteryinfoframe.cpp b/src/batteryinfoframe.cpp deleted file mode 100644 index 295fb0b..0000000 --- a/src/batteryinfoframe.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#include -#include - -#include "batteryinfoframe.h" -#include "batteryhelper.h" -#include "ui_batteryinfoframe.h" - -BatteryInfoFrame::BatteryInfoFrame(Solid::Battery *battery) : - QFrame(), - mBattery(battery), - mUi(new Ui::BatteryInfoFrame) -{ - mUi->setupUi(this); - - mUi->energyFullDesignValue->setText(QString("%1 Wh").arg(mBattery->energyFullDesign(), 0, 'f', 2)); - mUi->typeValue->setText(BatteryHelper::typeToString(mBattery->type())); - mUi->technologyValue->setText(BatteryHelper::technologyToString(mBattery->technology())); - - QString vendor = QString("%1 %2").arg(battery->recallVendor()).arg(battery->serial()); - if (vendor.trimmed().isEmpty()) - vendor = "Unknown"; - mUi->vendorValue->setText(vendor); - - connect(mBattery, SIGNAL(energyChanged(double, const QString)), this, SLOT(onBatteryChanged())); - connect(mBattery, SIGNAL(chargeStateChanged(int, const QString)), this, SLOT(onBatteryChanged())); - onBatteryChanged(); -} - -BatteryInfoFrame::~BatteryInfoFrame() -{ - delete mUi; -} - -void BatteryInfoFrame::onBatteryChanged() -{ - mUi->stateValue->setText(BatteryHelper::stateToString(mBattery->chargeState())); - mUi->energyFullValue->setText(QString("%1 Wh (%2 %)").arg(mBattery->energyFull(), 0, 'f', 2).arg(mBattery->capacity())); - mUi->energyValue->setText(QString("%1 Wh (%2 %)").arg(mBattery->energy(), 0, 'f', 2).arg(mBattery->chargePercent())); - mUi->energyRateValue->setText(QString("%1 W").arg(mBattery->energyRate(), 0, 'f', 2)); - mUi->voltageValue->setText(QString("%1 V").arg(mBattery->voltage(), 0, 'f', 2)); - mUi->temperatureValue->setText(QString("%1 ºC").arg(mBattery->temperature())); -} diff --git a/src/batteryinfoframe.h b/src/batteryinfoframe.h deleted file mode 100644 index a4249cf..0000000 --- a/src/batteryinfoframe.h +++ /dev/null @@ -1,54 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef BATTERYINFOFRAME_H -#define BATTERYINFOFRAME_H - -#include - -#include - -namespace Ui { -class BatteryInfoFrame; -} - -class BatteryInfoFrame : public QFrame -{ - Q_OBJECT - -public: - explicit BatteryInfoFrame(Solid::Battery* battery); - ~BatteryInfoFrame(); - -private slots: - void onBatteryChanged(); - -private: - Solid::Battery* mBattery; - Ui::BatteryInfoFrame *mUi; -}; - -#endif // BATTERYINFOFRAME_H diff --git a/src/batteryinfoframe.ui b/src/batteryinfoframe.ui deleted file mode 100644 index 0465881..0000000 --- a/src/batteryinfoframe.ui +++ /dev/null @@ -1,203 +0,0 @@ - - - BatteryInfoFrame - - - - 0 - 0 - 277 - 292 - - - - Power Management - - - - 6 - - - 12 - - - 12 - - - 12 - - - - - DELL 00 - - - - - - - Primary - - - - - - - 12.27 ºC - - - - - - - Temperature: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Type: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - State: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Charging - - - - - - - Energy Full Design: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 73.26 Wh - - - - - - - Energy Full: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 64.58 Wh (88.2 %) - - - - - - - Energy Now: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 63.41 Wh (98.2 %) - - - - - - - Energy rate: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 15.11 W - - - - - - - Lithium ion - - - - - - - Technology: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 12.27 V - - - - - - - Voltage: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Vendor: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - diff --git a/src/batterywatcher.cpp b/src/batterywatcher.cpp deleted file mode 100644 index 7b120d6..0000000 --- a/src/batterywatcher.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "batterywatcher.h" -#include "../config/powermanagementsettings.h" - -BatteryWatcher::BatteryWatcher(QObject *parent) : Watcher(parent) -{ - QList devices = Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString()); - - if (devices.isEmpty()) - { - LXQt::Notification::notify(tr("No battery!"), - tr("LXQt could not find data about any battery - monitoring disabled"), - "lxqt-powermanagement"); - } - - foreach (Solid::Device device, devices) - { - Solid::Battery *battery = device.as(); - if (battery->type() != Solid::Battery::PrimaryBattery) - { - continue; - } - mBatteries << battery; - connect(battery, &Solid::Battery::energyChanged, this, &BatteryWatcher::batteryChanged); - connect(battery, &Solid::Battery::chargeStateChanged, this, &BatteryWatcher::batteryChanged); - } - - mBatteryInfoDialog = new BatteryInfoDialog(mBatteries); - - connect(&mSettings, SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); - connect(LXQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(settingsChanged())); - - settingsChanged(); - batteryChanged(); -} - -BatteryWatcher::~BatteryWatcher() -{ -} - -void BatteryWatcher::batteryChanged() -{ - static QTime actionTime; - static LXQt::Notification *notification = 0; - - double totalEnergyFull = 0; - double totalEnergyNow = 0; - bool discharging = true; - double chargeLevel; - - foreach (Solid::Battery *battery, mBatteries) - { - totalEnergyFull += battery->energyFull(); - totalEnergyNow += battery->energy(); - discharging &= (battery->chargeState() == Solid::Battery::Discharging); - } - - chargeLevel = 100 * totalEnergyNow / totalEnergyFull; - - qDebug() << "BatteryChanged" - << "discharging:" << discharging - << "chargeLevel:" << chargeLevel - << "actionTime:" << actionTime; - - bool powerLowActionRequired = - discharging && - chargeLevel < mSettings.getPowerLowLevel() && - mSettings.getPowerLowAction() > 0; - - if (powerLowActionRequired) - { - if (actionTime.isNull()) - actionTime = QTime::currentTime().addMSecs(mSettings.getPowerLowWarningTime() * 1000); - - if (!notification) - { - notification = new LXQt::Notification(tr("Power low!"), this); - notification->setTimeout(2000); - } - - int milliSecondsToAction = QTime::currentTime().msecsTo(actionTime); - - if (milliSecondsToAction > 0) - { - int secondsToAction = milliSecondsToAction / 1000; - switch (mSettings.getPowerLowAction()) - { - case LXQt::Power::PowerSuspend: - notification->setBody(tr("Suspending in %n second(s)", nullptr, secondsToAction).arg(secondsToAction)); - break; - case LXQt::Power::PowerHibernate: - notification->setBody(tr("Hibernating in %n second(s)", nullptr, secondsToAction).arg(secondsToAction)); - break; - case LXQt::Power::PowerShutdown: - notification->setBody(tr("Shutting down in %n second(s)", nullptr, secondsToAction).arg(secondsToAction)); - break; - } - - notification->update(); - - QTimer::singleShot(200, this, SLOT(batteryChanged())); - } - else - { - doAction(mSettings.getPowerLowAction()); - } - } - else - { - if (!actionTime.isNull()) - actionTime = QTime(); - - if (notification) - { - delete notification; - notification = 0; - } - } -} - -void BatteryWatcher::settingsChanged() -{ - if (!mSettings.isShowIcon()) - { - while (!mTrayIcons.isEmpty()) - { - mTrayIcons.first()->hide(); - mTrayIcons.takeFirst()->deleteLater(); - } - } - else if (mTrayIcons.isEmpty()) - { - foreach (Solid::Battery *battery, mBatteries) - { - mTrayIcons.append(new TrayIcon(battery, this)); - connect(mTrayIcons.last(), SIGNAL(toggleShowInfo()), mBatteryInfoDialog, SLOT(toggleShow())); - mTrayIcons.last()->show(); - } - } -} - diff --git a/src/batterywatcher.h b/src/batterywatcher.h deleted file mode 100644 index 4c1075e..0000000 --- a/src/batterywatcher.h +++ /dev/null @@ -1,56 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef BATTERYWATCHER_H -#define BATTERYWATCHER_H - -#include "watcher.h" -#include "trayicon.h" -#include "batteryinfodialog.h" -#include "../config/powermanagementsettings.h" - -#include - -class BatteryWatcher : public Watcher -{ - Q_OBJECT -public: - explicit BatteryWatcher(QObject *parent = 0); - virtual ~BatteryWatcher(); - -private slots: - void batteryChanged(); - void settingsChanged(); - -private: - QList mBatteries; - QList mTrayIcons; - - PowerManagementSettings mSettings; - BatteryInfoDialog *mBatteryInfoDialog; -}; - -#endif // BATTERYWATCHER_H diff --git a/src/iconproducer.cpp b/src/iconproducer.cpp deleted file mode 100644 index e257be8..0000000 --- a/src/iconproducer.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/* -* Copyright (c) 2014, 2015 Christian Surlykke, Paulo Lieuthier -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license. -*/ -#include "iconproducer.h" -#include -#include -#include -#include -#include -#include - -IconProducer::IconProducer(Solid::Battery *battery, QObject *parent) : QObject(parent) -{ - connect(battery, &Solid::Battery::chargeStateChanged, this, &IconProducer::updateState); - connect(battery, &Solid::Battery::chargePercentChanged, this, &IconProducer::updateChargePercent); - connect(&mSettings, SIGNAL(settingsChanged()), this, SLOT(update())); - - mChargePercent = battery->chargePercent(); - mState = battery->chargeState(); - themeChanged(); -} - -IconProducer::IconProducer(QObject *parent): QObject(parent) -{ - themeChanged(); - update(); -} - - -void IconProducer::updateChargePercent(int newChargePercent) -{ - mChargePercent = newChargePercent; - - update(); -} - -void IconProducer::updateState(int newState) -{ - mState = (Solid::Battery::ChargeState) newState; - - update(); -} - -void IconProducer::update() -{ - QString newIconName; - - if (mSettings.isUseThemeIcons()) - { - QMap *levelNameMap = (mState == Solid::Battery::Discharging ? &mLevelNameMapDischarging : &mLevelNameMapCharging); - foreach (float level, levelNameMap->keys()) - { - if (level >= mChargePercent) - { - newIconName = levelNameMap->value(level); - break; - } - } - } - - if (mSettings.isUseThemeIcons() && newIconName == mIconName) - return; - - mIconName = newIconName; - mIcon = mSettings.isUseThemeIcons() ? QIcon::fromTheme(mIconName) : circleIcon(); - emit iconChanged(); -} - -void IconProducer::themeChanged() -{ - /* - * We maintain specific charge-level-to-icon-name mappings for Oxygen and Awoken and - * asume all other themes adhere to the freedesktop standard. - * This is certainly not true, and as bug reports come in stating that - * this and that theme is not working we will probably have to add new - * mappings beside Oxygen and Awoken - */ - mLevelNameMapDischarging.clear(); - mLevelNameMapCharging.clear(); - - if (QIcon::themeName() == "oxygen") - { - // Means: - // Use 'battery-low' for levels up to 10 - // - 'battery-caution' for levels between 10 and 20 - // - 'battery-040' for levels between 20 and 40, etc.. - mLevelNameMapDischarging[10] = "battery-low"; - mLevelNameMapDischarging[20] = "battery-caution"; - mLevelNameMapDischarging[40] = "battery-040"; - mLevelNameMapDischarging[60] = "battery-060"; - mLevelNameMapDischarging[80] = "battery-080"; - mLevelNameMapDischarging[101] = "battery-100"; - mLevelNameMapCharging[10] = "battery-charging-low"; - mLevelNameMapCharging[20] = "battery-charging-caution"; - mLevelNameMapCharging[40] = "battery-charging-040"; - mLevelNameMapCharging[60] = "battery-charging-060"; - mLevelNameMapCharging[80] = "battery-charging-080"; - mLevelNameMapCharging[101] = "battery-charging"; - } - else if (QIcon::themeName().startsWith("AwOken")) // AwOken, AwOkenWhite, AwOkenDark - { - mLevelNameMapDischarging[5] = "battery-000"; - mLevelNameMapDischarging[30] = "battery-020"; - mLevelNameMapDischarging[50] = "battery-040"; - mLevelNameMapDischarging[70] = "battery-060"; - mLevelNameMapDischarging[95] = "battery-080"; - mLevelNameMapDischarging[101] = "battery-100"; - mLevelNameMapCharging[5] = "battery-000-charging"; - mLevelNameMapCharging[30] = "battery-020-charging"; - mLevelNameMapCharging[50] = "battery-040-charging"; - mLevelNameMapCharging[70] = "battery-060-charging"; - mLevelNameMapCharging[95] = "battery-080-charging"; - mLevelNameMapCharging[101] = "battery-100-charging"; - } - else // As default we fall back to the freedesktop scheme. - { - mLevelNameMapDischarging[3] = "battery-empty"; - mLevelNameMapDischarging[10] = "battery-caution"; - mLevelNameMapDischarging[50] = "battery-low"; - mLevelNameMapDischarging[90] = "battery-good"; - mLevelNameMapDischarging[101] = "battery-full"; - mLevelNameMapCharging[3] = "battery-empty"; - mLevelNameMapCharging[10] = "battery-caution-charging"; - mLevelNameMapCharging[50] = "battery-low-charging"; - mLevelNameMapCharging[90] = "battery-good-charging"; - mLevelNameMapCharging[101] = "battery-full-charging"; - } - - update(); -} - -QIcon& IconProducer::circleIcon() -{ - static QMap > cache; - - int chargeLevelAsInt = (int) (mChargePercent + 0.49); - - if (!cache[mState].contains(chargeLevelAsInt)) - cache[mState][chargeLevelAsInt] = buildCircleIcon(mState, mChargePercent); - - return cache[mState][chargeLevelAsInt]; -} - -QIcon IconProducer::buildCircleIcon(Solid::Battery::ChargeState state, int chargeLevel) -{ - static QString svg_template = - "\n" - "\n" - "\n" - " \n" - " \n" - " \n" - " \n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - " STATE_MARKER\n" - "\n" - ""; - - static QString filledCircle = ""; - static QString plus = ""; - static QString minus = ""; - static QString hollowCircle = ""; - - QString svg = svg_template; - - if (chargeLevel > 99) - chargeLevel = 99; - - double angle; - QString sweepFlag; - if (state == Solid::Battery::Discharging) - { - angle = M_PI_2 + 2 * M_PI * chargeLevel/100; - sweepFlag = "0"; - } - else - { - angle = M_PI_2 - 2 *M_PI * chargeLevel/100; - sweepFlag = "1"; - } - double circle_endpoint_x = 80.0 * cos(angle) + 100; - double circle_endpoint_y = -80.0 * sin(angle) + 100; - - QString largeArgFlag = chargeLevel > 50 ? "1" : "0"; - - svg.replace(QString("END_X"), QString::number(circle_endpoint_x)); - svg.replace(QString("END_Y"), QString::number(circle_endpoint_y)); - svg.replace(QString("LARGE_ARC_FLAG"), largeArgFlag); - svg.replace(QString("SWEEP_FLAG"), sweepFlag); - - switch (state) - { - case Solid::Battery::FullyCharged: - svg.replace("STATE_MARKER", filledCircle); - break; - case Solid::Battery::Charging: - svg.replace("STATE_MARKER", plus); - break; - case Solid::Battery::Discharging: - svg.replace("STATE_MARKER", minus); - break; - default: - svg.replace("STATE_MARKER", hollowCircle); - } - - if (state != Solid::Battery::FullyCharged && state != Solid::Battery::Charging && chargeLevel < mSettings.getPowerLowLevel() + 30) - { - if (chargeLevel <= mSettings.getPowerLowLevel() + 10) - svg.replace("RED_OPACITY", "1"); - else - svg.replace("RED_OPACITY", QString::number((mSettings.getPowerLowLevel() + 30 - chargeLevel)/20.0)); - } - else - svg.replace("RED_OPACITY", "0"); - - // qDebug() << svg; - - // Paint the svg on a pixmap and create an icon from that. - QSvgRenderer render(svg.toLatin1()); - QPixmap pixmap(render.defaultSize()); - pixmap.fill(QColor(0,0,0,0)); - QPainter painter(&pixmap); - render.render(&painter); - return QIcon(pixmap); -} diff --git a/src/iconproducer.h b/src/iconproducer.h deleted file mode 100644 index 4e5d166..0000000 --- a/src/iconproducer.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2014 Christian Surlykke -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license. -*/ - -#ifndef ICONPRODUCER_H -#define ICONPRODUCER_H -#include -#include -#include -#include "../config/powermanagementsettings.h" -#include - -class IconProducer : public QObject -{ - Q_OBJECT - -public: - IconProducer(Solid::Battery* battery, QObject *parent = 0); - IconProducer(QObject *parent = 0); - - QIcon mIcon; - QString mIconName; - -signals: - void iconChanged(); - -public slots: - void updateChargePercent(int newChargePercent); - void updateState(int newState); - void update(); - void themeChanged(); - -private: - - QIcon &circleIcon(); - QIcon buildCircleIcon(Solid::Battery::ChargeState state, int chargeLevel); - - - int mChargePercent; - Solid::Battery::ChargeState mState; - - PowerManagementSettings mSettings; - - QMap mLevelNameMapCharging; - QMap mLevelNameMapDischarging; - -}; - -#endif // ICONPRODUCER_H diff --git a/src/idlenesswatcher.cpp b/src/idlenesswatcher.cpp deleted file mode 100644 index e669b6a..0000000 --- a/src/idlenesswatcher.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright (C) 2013 Alec Moskvin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include "idlenesswatcher.h" - -#include -#include -#include - -IdlenessWatcher::IdlenessWatcher(QObject* parent): - Watcher(parent) -{ - qDebug() << "Starting idlenesswatcher"; - - connect(KIdleTime::instance(), - static_cast(&KIdleTime::timeoutReached), - this, - &IdlenessWatcher::timeoutReached); - - connect(&mPSettings, &LXQt::Settings::settingsChanged, - this, &IdlenessWatcher::onSettingsChanged); - - setup(); -} - -IdlenessWatcher::~IdlenessWatcher() -{ - KIdleTime::instance()->removeAllIdleTimeouts(); -} - -void IdlenessWatcher::setup() -{ - int timeout = 1000 * mPSettings.getIdlenessTimeSecs(); - KIdleTime::instance()->addIdleTimeout(timeout); -} - -void IdlenessWatcher::timeoutReached(int identifier) -{ - doAction(mPSettings.getIdlenessAction()); -} - -void IdlenessWatcher::onSettingsChanged() -{ - KIdleTime::instance()->removeAllIdleTimeouts(); - setup(); -} diff --git a/src/idlenesswatcher.h b/src/idlenesswatcher.h deleted file mode 100644 index d402e28..0000000 --- a/src/idlenesswatcher.h +++ /dev/null @@ -1,48 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright (C) 2013 Alec Moskvin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef IDLENESSWATCHER_H -#define IDLENESSWATCHER_H - -#include "../config/powermanagementsettings.h" -#include "watcher.h" - -class IdlenessWatcher : public Watcher -{ - Q_OBJECT - -public: - explicit IdlenessWatcher(QObject* parent = 0); - virtual ~IdlenessWatcher(); - -private slots: - void setup(); - void timeoutReached(int identifier); - void onSettingsChanged(); - -private: - PowerManagementSettings mPSettings; -}; - -#endif // IDLENESSWATCHER_H diff --git a/src/lid.cpp b/src/lid.cpp deleted file mode 100644 index 35216c4..0000000 --- a/src/lid.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2011 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include -#include - -#include "lid.h" - -Lid::Lid() -{ - mUPowerInterface = new QDBusInterface("org.freedesktop.UPower", - "/org/freedesktop/UPower", - "org.freedesktop.UPower", - QDBusConnection::systemBus(), this); - - mUPowerPropertiesInterface = new QDBusInterface("org.freedesktop.UPower", - "/org/freedesktop/UPower", - "org.freedesktop.DBus.Properties", - QDBusConnection::systemBus(), this); - - if (!QDBusConnection::systemBus().connect("org.freedesktop.UPower", - "/org/freedesktop/UPower", - "org.freedesktop.DBus.Properties", - "PropertiesChanged", - this, - SLOT(uPowerChange()))) - qDebug() << "Could not connect to org.freedesktop.DBus.Properties.PropertiesChanged()"; - - mIsClosed = mUPowerPropertiesInterface->property("LidIsClosed").toBool(); -} - -bool Lid::haveLid() -{ - return mUPowerInterface->property("LidIsPresent").toBool(); -} - -bool Lid::onBattery() -{ - return mUPowerInterface->property("OnBattery").toBool(); -} - -void Lid::uPowerChange() -{ - bool newIsClosed = mUPowerInterface->property("LidIsClosed").toBool(); - if (newIsClosed != mIsClosed) - { - mIsClosed = newIsClosed; - emit changed(mIsClosed); - } -} diff --git a/src/lid.h b/src/lid.h deleted file mode 100644 index 9043ad5..0000000 --- a/src/lid.h +++ /dev/null @@ -1,54 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2011 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef LID_H -#define LID_H - -#include - -class Lid : public QObject -{ - Q_OBJECT - -signals: - void changed(bool closed); - -public: - Lid(); - bool haveLid(); - bool onBattery(); - bool isClosed() { return mIsClosed; } - -private: - bool mIsClosed; - QDBusInterface *mUPowerInterface; - QDBusInterface *mUPowerPropertiesInterface; - -private slots: - void uPowerChange(); -}; - -#endif // LID_H diff --git a/src/lidwatcher.cpp b/src/lidwatcher.cpp deleted file mode 100644 index 673020d..0000000 --- a/src/lidwatcher.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include -#include -#include -#include - -#include "lidwatcher.h" -#include "../config/powermanagementsettings.h" - -LidWatcher::LidWatcher(QObject *parent) : Watcher(parent) -{ - inhibitSystemdLogin(); - connect(&mLid, SIGNAL(changed(bool)), this, SLOT(lidChanged(bool))); -} - -LidWatcher::~LidWatcher(){ -} - -void LidWatcher::lidChanged(bool closed) -{ - if (closed) - { - doAction(action()); - } -} - -int LidWatcher::action() -{ - if (mSettings.isEnableExtMonLidClosedActions() && externalMonitorPlugged()) - { - if (mLid.onBattery()) - { - return mSettings.getLidClosedExtMonAction(); - } - else - { - return mSettings.getLidClosedExtMonAcAction(); - } - } - else - { - if (mLid.onBattery()) - { - return mSettings.getLidClosedAction(); - } - else - { - return mSettings.getLidClosedAcAction(); - } - } -} - -bool LidWatcher::externalMonitorPlugged() -{ - int monitorCount = 0; - - QProcess xrandr(this); - xrandr.start("xrandr", QIODevice::ReadOnly); - xrandr.waitForFinished(1000); - - if (xrandr.exitCode() != 0) - { - return false; // Well, what to do? - } - - QTextStream xrandr_stdout(&xrandr); - while (!xrandr_stdout.atEnd()) - { - QString line = xrandr_stdout.readLine(); - qDebug() << ">>" << line; - if (line.indexOf(" connected", 0) > -1) - { - monitorCount++; - } - } - - qDebug() << "monitorCount: " << monitorCount; - - return monitorCount >= 2; -} - -void LidWatcher::inhibitSystemdLogin() -{ - QDBusInterface manager("org.freedesktop.login1", - "/org/freedesktop/login1", - "org.freedesktop.login1.Manager", - QDBusConnection::systemBus(), this); - QDBusReply reply = manager.call("Inhibit", "handle-lid-switch", "lxqt-powermanagment", "LidWatcher is in da house!", "block"); - if (reply.isValid()) - { - logindLock = reply.value(); - qDebug() << "Inhibit got:" << logindLock.fileDescriptor(); - } - else - { - qDebug() << "Error from inhibit:" << reply.error(); - } -} - diff --git a/src/lidwatcher.h b/src/lidwatcher.h deleted file mode 100644 index c7fdef3..0000000 --- a/src/lidwatcher.h +++ /dev/null @@ -1,61 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ -#ifndef LIDWATCHER_H -#define LIDWATCHER_H - -#include -#include -#include - -#include - -#include "../config/powermanagementsettings.h" -#include "watcher.h" -#include "lid.h" - -class LidWatcher : public Watcher -{ - Q_OBJECT -public: - explicit LidWatcher(QObject *parent = 0); - virtual ~LidWatcher(); - -private slots: - void lidChanged(bool closed); - -private: - int action(); - bool externalMonitorPlugged(); - void inhibitSystemdLogin(); - - Lid mLid; - LXQt::Power mLXQtPower; - PowerManagementSettings mSettings; - QDBusUnixFileDescriptor logindLock; -}; - -#endif // LIDWATCHER_H diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 2043912..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include - -#include - -#include "powermanagementd.h" - -int main(int argc, char *argv[]) -{ - - LXQt::Application a(argc, argv); - a.setQuitOnLastWindowClosed(false); - - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Powermanagement Daemon")); - const QString VERINFO = LXQT_POWERMANAGEMENT_VERSION \ - "\nliblxqt " LXQT_VERSION \ - "\nQt " QT_VERSION_STR; - a.setApplicationVersion(VERINFO); - parser.addVersionOption(); - parser.addHelpOption(); - parser.process(a); - - // To ensure only one instance of lxqt-powermanagement is running we register as a DBus service and refuse to run - // if not able to do so. - // We do not register any object as we don't have any dbus-operations to expose. - if (! QDBusConnection::sessionBus().registerService("org.lxqt.lxqt-powermanagement")) - { - qWarning() << "Unable to register 'org.lxqt.lxqt-powermanagement' service - is another instance of lxqt-powermanagement running?"; - return 1; - } - else - { - PowerManagementd powerManagementd; - return a.exec(); - } -} diff --git a/src/powermanagementd.cpp b/src/powermanagementd.cpp deleted file mode 100644 index f0bb570..0000000 --- a/src/powermanagementd.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include - -#include "batteryhelper.h" -#include "powermanagementd.h" -#include "../config/powermanagementsettings.h" -#include "idlenesswatcher.h" -#include "lidwatcher.h" -#include "batterywatcher.h" - -#define CURRENT_RUNCHECK_LEVEL 1 - -PowerManagementd::PowerManagementd() : - mBatterywatcherd(0), - mLidwatcherd(0), - mIdlenesswatcherd(0), - mSettings() - { - connect(&mSettings, SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); - settingsChanged(); - - if (mSettings.getRunCheckLevel() < CURRENT_RUNCHECK_LEVEL) - { - performRunCheck(); - mSettings.setRunCheckLevel(CURRENT_RUNCHECK_LEVEL); - } -} - -PowerManagementd::~PowerManagementd() -{ -} - -void PowerManagementd::settingsChanged() -{ - if (mSettings.isBatteryWatcherEnabled() && !mBatterywatcherd) - mBatterywatcherd = new BatteryWatcher(this); - else if (mBatterywatcherd && ! mSettings.isBatteryWatcherEnabled()) - { - mBatterywatcherd->deleteLater(); - mBatterywatcherd = 0; - } - - if (mSettings.isLidWatcherEnabled() && !mLidwatcherd) - { - mLidwatcherd = new LidWatcher(this); - } - else if (mLidwatcherd && ! mSettings.isLidWatcherEnabled()) - { - mLidwatcherd->deleteLater(); - mLidwatcherd = 0; - } - - if (mSettings.isIdlenessWatcherEnabled() && !mIdlenesswatcherd) - { - mIdlenesswatcherd = new IdlenessWatcher(this); - } - else if (mIdlenesswatcherd && !mSettings.isIdlenessWatcherEnabled()) - { - mIdlenesswatcherd->deleteLater(); - mIdlenesswatcherd = 0; - } - -} - -void PowerManagementd::runConfigure() -{ - mNotification.close(); - QProcess::startDetached("lxqt-config-powermanagement"); -} - -void PowerManagementd::performRunCheck() -{ - mSettings.setLidWatcherEnabled(Lid().haveLid()); - bool hasBattery = false; - foreach (Solid::Device device, Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString())) - if (device.as()->type() == Solid::Battery::PrimaryBattery) - hasBattery = true; - mSettings.setBatteryWatcherEnabled(hasBattery); - mSettings.setIdlenessWatcherEnabled(true); - mSettings.sync(); - - mNotification.setSummary(tr("Power Management")); - mNotification.setBody(tr("You are running LXQt Power Management for the first time.\nYou can configure it from settings... ")); - mNotification.setActions(QStringList() << tr("Configure...")); - mNotification.setTimeout(10000); - connect(&mNotification, SIGNAL(actionActivated(int)), SLOT(runConfigure())); - mNotification.update(); -} diff --git a/src/powermanagementd.h b/src/powermanagementd.h deleted file mode 100644 index ce1c397..0000000 --- a/src/powermanagementd.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2014 Christian Surlykke -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license. -*/ - -#ifndef POWERMANAGEMENTD_H -#define POWERMANAGEMENTD_H - -#include - -#include "../config/powermanagementsettings.h" - -class BatteryWatcher; -class LidWatcher; -class IdlenessWatcher; - -class PowerManagementd : public QObject -{ - Q_OBJECT - -public: - PowerManagementd(); - virtual ~PowerManagementd(); - -private slots: - void settingsChanged(); - void runConfigure(); - -private: - void performRunCheck(); - - BatteryWatcher* mBatterywatcherd; - LidWatcher* mLidwatcherd; - IdlenessWatcher* mIdlenesswatcherd; - - PowerManagementSettings mSettings; - LXQt::Notification mNotification; -}; - -#endif /* POWERMANAGEMENTD_H */ - diff --git a/src/trayicon.cpp b/src/trayicon.cpp deleted file mode 100644 index 8bb5885..0000000 --- a/src/trayicon.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2011 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "trayicon.h" -#include "batteryhelper.h" -#include "../config/powermanagementsettings.h" -#include - -TrayIcon::TrayIcon(Solid::Battery *battery, QObject *parent) - : QSystemTrayIcon(parent), - mBattery(battery), - mIconProducer(battery), - mContextMenu() -{ - connect(mBattery, &Solid::Battery::chargePercentChanged, this, &TrayIcon::updateTooltip); - connect(mBattery, &Solid::Battery::chargeStateChanged, this, &TrayIcon::updateTooltip); - updateTooltip(); - - connect(&mIconProducer, SIGNAL(iconChanged()), this, SLOT(iconChanged())); - iconChanged(); - - connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - SLOT(onActivated(QSystemTrayIcon::ActivationReason))); - - mContextMenu.addAction(XdgIcon::fromTheme(QStringLiteral("configure")), tr("Configure"), - this, SLOT(onConfigureTriggered())); - mContextMenu.addAction(XdgIcon::fromTheme(QStringLiteral("help-about")), tr("About"), - this, SLOT(onAboutTriggered())); - mContextMenu.addAction(XdgIcon::fromTheme(QStringLiteral("edit-delete")), tr("Disable icon"), - this, SLOT(onDisableIconTriggered())); - setContextMenu(&mContextMenu); -} - -TrayIcon::~TrayIcon() -{ -} - -void TrayIcon::iconChanged() -{ - setIcon(mIconProducer.mIcon); -} - -void TrayIcon::updateTooltip() -{ - QString tooltip = BatteryHelper::stateToString(mBattery->chargeState()); - tooltip += QString(" (%1 %)").arg(mBattery->chargePercent()); - setToolTip(tooltip); -} - -void TrayIcon::onConfigureTriggered() -{ - QProcess::startDetached("lxqt-config-powermanagement"); -} - -void TrayIcon::onAboutTriggered() -{ - QMessageBox::about(0, - tr("About"), - tr( "

" - " LXQt Power Management
" - " - Power Management for the LXQt Desktop Environment" - "

" - "

" - " Authors:
" - "   Christian Surlykke, Alec Moskvin
" - "   - and others from the Razor and LXQt projects" - "

" - "

" - " Copyright © 2012-2014" - "

" - )); -} - - -void TrayIcon::onDisableIconTriggered() -{ - auto notification = new LXQt::Notification{tr("LXQt Power Management info"), nullptr}; - notification->setBody(tr("The LXQt Power Management tray icon can be (re)enabled in lxqt-config-powermanagement")); - notification->setIcon("preferences-system-power-management"); - notification->setActions({tr("Configure now")}); - notification->setUrgencyHint(LXQt::Notification::UrgencyLow); - connect(notification, &LXQt::Notification::actionActivated, [notification] { notification->close(); QProcess::startDetached("lxqt-config-powermanagement"); }); - connect(notification, &LXQt::Notification::notificationClosed, notification, &QObject::deleteLater); - notification->update(); - - PowerManagementSettings().setShowIcon(false); -} - -void TrayIcon::onActivated(QSystemTrayIcon::ActivationReason reason) -{ - qDebug() << "onActivated" << reason; - if (Trigger == reason) emit toggleShowInfo(); -} diff --git a/src/trayicon.h b/src/trayicon.h deleted file mode 100644 index f00c70e..0000000 --- a/src/trayicon.h +++ /dev/null @@ -1,65 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2011 Razor team - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef TRAYICON_H -#define TRAYICON_H - -#include -#include -#include - -#include "iconproducer.h" -#include "../config/powermanagementsettings.h" - -class TrayIcon : public QSystemTrayIcon -{ - Q_OBJECT - -public: - TrayIcon(Solid::Battery *battery, QObject *parent = 0); - ~TrayIcon(); - -signals: - void toggleShowInfo(); - -public slots: - void iconChanged(); - void updateTooltip(); - -private slots: - void onConfigureTriggered(); - void onAboutTriggered(); - void onDisableIconTriggered(); - void onActivated(QSystemTrayIcon::ActivationReason reason); - -private: - Solid::Battery *mBattery; - IconProducer mIconProducer; - QMenu mContextMenu; -}; - -#endif // TRAYICON_H diff --git a/src/watcher.cpp b/src/watcher.cpp deleted file mode 100644 index 1fd5cd7..0000000 --- a/src/watcher.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * - * Authors: - * Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include "../config/powermanagementsettings.h" -#include "watcher.h" - -Watcher::Watcher(QObject *parent) : - QObject(parent), - mScreenSaver(this) -{ -} - -Watcher::~Watcher() -{ -} - -void Watcher::doAction(int action) -{ - // if (action == -1) { } - if (action == -2) - { - mScreenSaver.lockScreen(); - } - else if (action >= 0) - mPower.doAction((LXQt::Power::Action) action); - - emit done(); -} diff --git a/src/watcher.h b/src/watcher.h deleted file mode 100644 index 0bcdfe3..0000000 --- a/src/watcher.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2014,2015 Christian Surlykke, Paulo Lieuthier -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license. -*/ - -#ifndef WATCHER_H -#define WATCHER_H - -#include -#include -#include -#include - -class Watcher : public QObject -{ - Q_OBJECT - -public: - Watcher(QObject *parent = 0); - virtual ~Watcher(); - -protected: - void doAction(int action); - -signals: - void done(); - -private: - LXQt::Power mPower; - LXQt::ScreenSaver mScreenSaver; -}; - -#endif // WATCHER_H