diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index abb6e1f..0000000 --- a/AUTHORS +++ /dev/null @@ -1,10 +0,0 @@ -Upstream Authors: - LXQt team: http://lxqt.org - Razor team: http://razor-qt.org - -Copyright: - Copyright (c) 2010-2012 Razor team - Copyright (c) 2012-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 17a2df3..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,1528 +0,0 @@ - -lxqt-panel-0.12.0 / 2017-10-21 -============================== - - * Set patch version - * quicklaunch: Show popup menu aligned to clicked button - * quicklaunch: Add "Desktop Action" support - * l10n: Update Polish translation - * Fix Danish spelling - * plugin-tray: Fix dupe icon display error - * Don't export github templates - * Use worldclock by default instead of clock. - * clock: Show deprecation message on startup/add - * Fix clock text update - * Avoid calling text() in MatchAction on a QAction == 0 - * volume: Do check for OSS availability in run-time - * Update Polish .desktop entry - * Remove space from end of "Show popup on mouse hover " string - * Updated Lithuanian translation - * Add/update Lithuanian translation - * Update directorymenu_it.desktop - * mainmenu: Don't hold the references for menu-cache - * mainmenu: Fix menu-cache usage - * set Qt::AA_UseHighDpiPixmaps to true - * l10n: Updated Polish translation - * Improved lxqt-panel version display - * Added default CMAKE_BUILD_TYPE and LXQT_PANEL_PATCH_VERSION - * plugins: Make widgets/buttons use whole space - * LXQtPanelLayout: Honor item's expanding size policy - * mainmenu: Install eventFiler for all (sub)menus - * volume: Add all changes notifications (configurable) - * Fixes a FTBFS in superbuild mode - * Added merged autostart and menu to CMakeLists.txt - * Updated *_da.desktop files and removed *_da_DK.desktop files - * translation: Add Portugese directories - * Update desktop entries and Replace fr_FR by fr - * Merge pull request #45 from lxde/menu-comment - * lxqt-applications.menu: remove accidentally added topics from "System Tools" - * 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 - * Adds double quotes to everything that may break - * Use GNUINnstallDirs - * Updates the build system to use the Targets infrastructure - * Place LXQt About over Preferences in the main menu - * Added italian translation in menu - * Added german translation for the settings directory. - * Drops hardcoded /etc/xdg paths - * menu: hungarian translations added - * Add Russian translation - * Restore the old preferences menu layout of razor-qt. - * Updated german translation, replaced Qt4 by Qt in all xsession/translations - * add lxqt-leave directory files - * use LXQt-specific menu file - * Updates translations infrastructure - * Update the required minimum cmake version - * remove dead template lines switch OnlyShowIn from Razor -> LXQt stringchanges LxQt -> LXQt - * Support lxqt-session and add necessary xdg autostart desktop entry files. - * Fit the task group to its contents - * mainmenu: Add "true" translucency support - * Show "unknown" when an icon is missing - * volume: Force step for wheel over popup slider - * volume: Always show tooltip over button - * volume: Force configured step for wheel over button - * volume: Use "override" keyword - * Enable translucency for taskbar group popup - * tray: Move tray icon window into correct place - * taskbar: Elide texts of buttons when needed - * volume: Fix calculating of alsa volume - * volume: Remove duplicated code - * volume: Fix reporting of pulse volume - * sysstat: Fix saving of network maximum speed - * mainmenu: Redesign config dialog - * mainmenu: Clear search upon show (configurable) - * plugin-kbindicator: Undef the "explicit" workaround - * plugin-sysstat: Avoid "set but unused var" warning - * panel: Make space reserve on display configurable - * panel: Add wrong logic warning - * panel: Hide correctly upon the DragLeave - * plugin-mount: Fix firing the actions - * plugin-mount: Notify just on "real" add/remove - * plugin: Save settings before signal connect - * taskbar: Add Meta+1..9 shortcuts to raise windows - * Bump year - -0.11.1 / 2017-01-01 -=================== - - * Release 0.11.1: Update changelog - * Show Auto-Hiding Panels with Delay (#387) - * Enabling testing on weston (#380) - * Update *da.desktop files - * plugin-showdesktop: Cleanup left behind XCB artifacts - * plugin-kbindicator: Use FindXCB CMake module - * plugin-tray: Use the FindXCB CMake module - * Use the new lxqt-build-tools CMake modules (FindMenuCache) - * plugin-desktopswitch: Add LABEL_TYPE_NONE - * Add/Update Portugese translations - * taskbar: Add "cycle on wheel" configuration - * taskbar: Forward wheelEvent - * Add/Update french desktop entries - * taskbar: Set toolButtonStyle for popup correctly - * Fix faulty link in README.md - * Remove arbitrary limit of taskbar button width - * Remove cpack (#371) - -0.11.0 / 2016-09-24 -=================== - - * Release 0.11.0: Add changelog - * Update README.md: Reflect changes introduced in 1c22479 - * CMakeLists: Fail for unmet dependencies - * mainmenu: Remove setting base style in StyleChange - * mainmenu: Workaround transparent search - * mainmenu: Dispose old menu first when building new - * Add README.md - * sensors: Add default bar scale - * sensors: Check for existence of the max value - * sensors: Add minor code optimization - * mainmenu: Handle QAction disposal correctly - * panel: Don't use autoFillBackground - * Plugin: Fix FTBFS for older Qt versions - * mainmenu: Fix show/hide actions after menu rebuild - * Statusnotifier: Remove setParent on StatusNotifierMenu. - * Add XKB_COMMON_X11_INCLUDE_DIRS - * panel: Remove/deprecate plugin-screensaver (#363) - * Add and Update Arabic Translations for Desktop Files - * Fix updating panel geometry on screen size change - * panel: Fix screen number config change saving - * Separate a String for I18N Enhancement - * plugin: Force config dialog activation/raise - * plugin: Fix crossreferencing of config dialogs - * panel: Dispose unneeded menu - * panel: Destroy panel's config dialog - * showPopupMenu: Remove extraneous setParent() call (#359) - * statusnotifier: fix popup position on right click - * desktopswitch: Take layoutDirection into account - * taskbar: Remove orientation specific logic for DnD - * LXQtPanelLayout: Take layoutDirection into account - * taskbar: Remove forgotten debug - * taskbar: Consider layoutDirection for DnD - * panel: Optimize search a bit - * plugin-volume: Avoid an buffer overflow - * Respect the OnlyShowIn property for menu entries when using menu-cache (#351) - * kbindicator-plugin: fix linking with libxcb-1.12 - * plugin-volume: Handle errors when trying to determine the next card - * Clean up CMakeLists.txt - * plugin/directorymenu: Removes no use code (#350) - * build: Forward translations parameters - * ts-files removal (#346) - * Fix memory leaks - * Use const references with the foreach iterator - * Small fix - * statusnotifier: Fix showing icons in menu - * kbindicator: (Re)Add .desktop translations - * Update desktopswitchconfiguration.ui - * panel: (Re)Add translations dir - * Revert unintended *.desktop files removal - * Remove translations (can be pulled in build time) - * Use external translations - * Update lxqt-panel_it.ts - * Add documentation/comments for PanelPluginsModel. - * Fix segfault on plugin initialization (#338) - * translations: updated german translation (#323) - * plugin-mainmenu: update mainmenu_it.ts (#337) - * Russian translation update - * mainmenu: Use style sheet to override icon - * plugins: Change "repolish" logic - * mainmenu: Reduce delay of popup when using shortcut - * volume: Remove debug - * plugins: Don't unload -> avoid dangling resources - * Added new translated strings. - * Added missing context for lupdate. - * Updated german translation. - * Ask for confirmation when removing a panel - * panel: Add "Lock Panel" functionality - * fix updating panel geometry on screen changes - * Try find a free position when adding a new panel - * LXQtPanelApplication: Use D-Pointers - * Animate auto-hiding panels. - * Add QT_USE_QSTRINGBUILDER to the compile definitions - * tray: Fix SEGFAULT on stop - * mainmenu: Fix visual search problems - * mainmenu: Remove duplicates from search - * mainmenu: Add new configuration options for search - * mainmenu: Workadound QLineEdit's wakups(QTBUG-52021) - * mainmenu: Add configurable way of search - * taskbar: separate adding from changing windows - * plugins: Make buttons flat for cleaner look - * mainmenu: Fix search interacion - * mainmenu: Add search/hide possibility - * taskbar: Add show icon by WindowClass to config - * taskbar: Use icon from theme (based on windowClass) - * panellayout: Do not allow oversized plugins - * panellayout: Avoid plugin margins - * PluginSettings: Make settings object/class public - * Bump year Fix licenses: lxqt-panel is pure LGPL - * worldclock: Fix possible SEGFAULT - * Add comments for ILXQtPanel and LXQtPanel. - * plugin-taskbar: fix German translation of configuration dialogue - * panel: Correct PanelPluginsModel logic - * volume: Avoid infinite cycle in config dialog - * plugins: Use "cleaner" style logic - * mainmenu: Remove unneeded includes - * mainmenu: Fix freeze for some widget styles (e.g. breeze) - * tray: Fix "BadDamage" warning message - * tray: Postpone tray icon initialization - * PluginSettings: Emit settingsChanged only for owned keys - * taskbar: Fix (auto)hide after window menu is shown - * mainmenu: Use directory of current icon for search - * mainmenu: Fix showing icon path in configuration - * plugin-taskbar: avoid icon-only style for groups - * statusnotifier: fix position of context menus - * plugin-quicklaunch: remove preset applications - * plugin-tray: Fix native window sizes for high DPI devices - * taskbar: Refactor/improove window handling logic - * taskbar: Fix multiple groups when WindowClass changes - * plugin settings: Publish PluginSettings symbols - * Add support for nested groups in PluginSettings - * Add PluginSettings::{read,set}Array for atomicity - * Add PluginSettings for shared settings for plugins - * plugins config: remove a lot of redundant code - * LXQtPanelPluginConfigDialog: add ctor overload - * Update lxqt-panel_fr_FR.ts - * Create HR translations for panel and plugins - * lxqt-panel: Update/format and install man page - * plugin-kbindicator: remove ru_RU translations - * plugin-kbindicator: add russian translations - * Update Russian translations for the panel and plugins - * Italian translation update - * Updated german translation. - * Adds comments for lxqtpanelapplication.h. - * Correct some minor spelling mistakes. - * panel-config: Fix background opacity slider - * taskbar: Avoid "noop" button if window ID changes - * mainmenu: Fix URL assembly for Drag&Drop - * panel: Fill background - * mainmenu: Use configurable icon - * worldclock: Fix update interval - * panel: Add periodic hide checking - * clock: Fix content update if transform/autorotate - * quicklaunch: Fix panel hiding upon showing menu - * worldclock: Decrease (unnecessary) wake-ups - * panel: Remove periodic checking for hide - * Prevent panel hiding in case any (standalone) window shown - * plugins: Unify window popup-ing - * directorymenu: Fix indentation (spaces) - * panel: Use override for overriden virt func - * hu translations fixed - * plugin-sysstat: translations fix - * desktop-switch: Hightlight only windows in taskbar - * fix misspelled prefered - -0.10.0 / 2015-10-31 -=================== - - * Fix license file - * panel: Fix reserved space on screen - * mainmenu: Fix close menu by "weird" shortcut - * volume: Handle add/removal of pulse sink correcly - * Workaround to the QStringLiteral static finalization bug - * plugin-mount: Fix SEGFAULT in finalization time - * mainmenu: Fix global shortcut configuration - * taskbar: Enhance show icon for moving - * taskbar: Fix incorrect move between multiple instances - * taskbar: Simplify drag originator logic - * Fix a couple of warnings - * Make panel's settings private for more reliability - * Fix warning about possibly uninitialized variable - * taskbar: Use the icon as the DnD pixmap - * taskbar: Add visual effect to button move - * worldclock: Fix popup showing after closed - * plugins: Unify popups behaviour - * taskbar: Fix showing group popup for DnD - * taskbar: Enhance moving buttons - * CPU count begins with 0 not with 1. - * Updated german translation. - * Added missing cpu10, updated translation template. - * Added some translateable strings, tooltips. - * plugin-statusnotifier: corrected CMakeLists.txt - * panel: referencing symbol in static plugins to not stip the loader object in linking time - * Use "automatic" plugin translations loader - * addplugindialog: show also the plugin ID (desktop file name) - * Optimization on plugin name generation, as suggested by palinek. - * Fix #839 - lxqt-panel plugins enumeration - * Revert "plugin-statusnotifier: fix FTBFS with dbusmenu-qt" - * panel: remeber configured screen - * plugin-statusnotifier: fix FTBFS with dbusmenu-qt - * plugin-statusnotifier: better callable checking for static_assert - * plugin-statusnotifier: polish of SniAsync::propertyGetAsync usage - * Replace QPixmap::grabWindow with QScreen's version - * plugin-statusnotifier: add missing license headers - * plugin-statusnotifier: get all icons from DBus - * plugin-statusnotifier: async communication in DBus - * plugin-statusnotifier: postpone registration of new item to not block DBus response - * plugin-statusnotifier: correct memory release & existing menu check (avoid SEGFAULT) - * Transition LxQt --> LXQt: remnants in TS files - * Italian translation: remove country-specific translation "_IT", several updates - * Rename LxQt to LXQt everywhere - * Update Greek translation Remove country variant from language code - * license text don't match license declaration - * license headers for kbindicator plugin - * plugin-mainmenu: set icon size according to font size - * plugin-mainmenu: removed unused QProxyStyle object - * plugin-statusnotifier: fix popup position on - * Redesigned settings dialog, switching policy setted as global by default - * Update Russian translation - * Removed unneeded entries from include_directories() - * Use CMAKE_AUTORCC. Drop qt5_add_resources(). - * Use CMAKE_AUTOUIC. Drop qt5_wrap_ui(). - * Prefer list(APPEND ...) over set(....) - * panel: QMenu positioning workaround for multihead/multipanel setup - * plugin-sysstat: fix for source strings translation - * plugin-sysstat: translatable type/source strings - * plugin-sysstat: enhanced tooltip texts - * plugin-sysstat: correct configuration displaying/changing - * plugin-spacer: configuration UI load fix - * Removes ancient QT_USE_XXXX variables - * Use find_package() to find libdbusmenu-qt5 - * plugin-sysstat: added tooltip information - * minor fix in German translation of plugin-kbindicator - * Re-added german translation. - * Updated translation template for tooltips. - * Updated german translation. - * Add placeholders to fr translation - * Add french translation - * Remove faulty lithuanian translation - * Complete dutch translation - * Fix romanian translation - * Remove country specific Italian - * Complete italian translation - * Update hungarian translation - * Remove faulty lithaunian - * Update slovenian - * Delte incomplete arabian translations - * Update romanian translations for the desktopswitch plugin - * Update romanian translations for the cpuload plugin - * Update romanian desktop file for the cpuload plugin - * Update romanian translations for the clock plugin - * Update romanian translation for the clock desktop file - * Update romanian translations for the main panel ui - * Add missing romanian translation for the network monitor - * Update romanian translations for the network monitor desktop file - * panel: fix reserved space - * autohide: correctly reserve screen space, always. - * autohide: change only apparent height/width, - * panel-configplugins: Adds tooltips - * kbindicator: depend on xkbcommon & show lang flag - * application: use standard liblxqt unix signal handling to quit - * plugin-showdesktop: remove xcb dependency, use KF5 - * Use KWindowSystem to set window type as Dock - * plugin-taskbar: Enhances Configuration Ui layout - * Updates the build system to use the Targets infrastructure - * plugin-clock: static width based on characters count - * Finish networkmonitor turkish translation - * addplugindialog: prevent segfault on dialog opening - * plugins: new flag to set the need for a flag - * plugin-mainmenu: applying custom font size on the fly - * Added missing german translation, updated template. - * fixes in French and German translation - * plugin-spacer: simplified configuration signal handling - * plugin-mount: avoid realign-resize recursion - * Remove trailing whitespaces - * Replace LXDE-Qt with LXQt in desktop file - * Fix naming and links - * Delete faulty indonesian translation - * Rename greek and french translation file to be country independant - * Delete duplicate russian translation - * Delete duplicate hungary translation - * Delete duplicate danks files - * Delete czech country specific files - * Add polish translation - * Moved croatian translations to the correct directories. - * Updated german translations for the taskbar plugin. - * Added german translation for the spacer plugin. - * Updated german translations for the showdesktop plugin. - * Updated german translations for the sensors plugin. - * Delete Venezuela specific translations - * Correct dutch translations for networkmonitor desktop file - * Improved network monitor Spanish translations - * Provide esperanto translation for networkmonitor - * Correct translation for esperanto desktop file - * Add turkish translation - * Fix lxde/lxqt#684: activate window on some options - * plugins: unified handling for single instance plugins across all panels - * plugins: flag to limit plugins to single instances - * plugin-volume: handle maximum volume proportionally - * plugin-clock: calculate min widget size - * panel: retest conditions for autohide regulary after Leave event - * Updated / unified german translation for taskbar plugin. - * Added german translation for sysstat plugin. - * Added german translation for statusnotifier. - * Updated template by removing old file and trigger an update. - * Updated german translation for the screensaver plugin. - * Updated german translation for the quicklaunch plugin. - * Updated german translation for the networkmonitor plugin. - * Updated german translation for mainmenu plugin. - * Updated template for mount plugin. - * Updated german translation for mount plugin. - * Added german translation for kbindicator plugin. - * Added german translation for DOM. - * Moved croatian translation to correct directory. - * Updated german translation for directorymenu. - * Updated german translation. - * Updated german translation for cpuload plugin. - * Updated german translation for colorpicker plugin. - * Cleaned german desktop file for tray plugin. - * Updated german translation for volume plugin. - * Added german translation for worldclock plugin. - * plugin-clock: adjust size only when needed - * plugin-taskbar: show only particular desktop windows - * panel: only for supported objects the iconSize qproperty styling is applied - * plugin-sensors: (re)added warning timer fequency initialization - * plugin-tray/statusnotifier: icon in .desktop file - * plugin-desktopswitch: Check if the button exists dereferencing it. - * plugin-volume: more obvious popup buttons - * plugin-spacer: slovak translation - * plugin-spacer: translatable type texts - * Updated german translation for clock plugin. - * Added new string to template and german translation. - * plugin-clock: use Qt::PreciseTimer for better accuracy - * panelconfig: default background opacity to 100 & compositing note - * plugin-clock: content down-scaling & proper size adjustments after config change - * Updated german translation, removed now obsolete _de_DE.ts. - * Updated template, sorted line numbers and contexts - like created from scratch by 'lupdate'. - * Better name for dialog window. - * pluginsmodel: fix crash in QAbstractItemModel::endMoveRows for noop move - * plugin-mainmenu: config: editable menu file & button icon - * panel: improve multi-monitor support - * Create networkmonitor_hr.ts - * Create mount_hr.ts - * Create mainmenu_hr.ts - * Create kbindicator_hr.ts - * Create directorymenu_hr.ts - * Create desktopswitch_hr.ts - * Create cpuload_hr.ts - * Hungarian translations added, modified - * plugin-mainmenu: fix crash on changing menu file - * Fixes lxde/lxqt#647, FTBFS - * Update networkmonitor_it.desktop - * Update networkmonitor_it_IT.desktop - * Update networkmonitor_it_IT.desktop - * Update networkmonitor_it.desktop - * Update networkmonitor_it_IT.desktop - * Update networkmonitor_it.desktop - * plugin-networkmonitor: fix faulty French translation - * Fix German translation of panel context menu (addendum). - * Fix German translation of panel context menu. - * panelconfig: improve title and labels - * Update lxqt-panel_es.ts - * panelconfig: fixed type in "cannot reset" note - * Make "spacer" a static plugin. - * panelconfig: no margin for plugins configuration widget - * plugin-mount: popup size handling upon show event - * plugin-mount: startup speedup (potential long time operation is done after object construction) - * plugin-mount: correct popup size handling - * plugin-taskbar: reverting commit b0a1f3d007c2369fdf624f406aa36b883c72fd5f - * panel: fix volume's type in the default config - * panel: save settings after plugin move from config dialog - * panel: plugins correct positiong - * panelconfig: corrected usage of Plugin in button states logic - * CMakeLists: re-enable default building state for plugins - * panel: PanelPluginsModel signals handled directly by layout - * Enable/disable buttons in Manage Plugins dialog - * panel: subclass QAbstractListModel to handle plugins - * panel: separate GUI of panel settings from plugin - * CMakeLists: fix translation loader include (usage of lxqt_app_translation_loader) - * plugin-taskbar: don't stretch along the panel in icon only - * plugin-taskbar: raise minimized windows on current desktop - * plugin-taskbar: show only minimized windows - * plugin-taskbar: fix for show/hide of moved window if "show only panel's screen windows" active - * plugin-taskbar: fix of crash after closing not showed window - * Update Russian translation - * Add QtCreator project file type to .gitignore - * plugin-mainmenu: fixed panel autohide after menu closed - * plugin-mount: remove of doubled signal connection - * plugin-mount: fix error message construction - * plugin-mount: add device actions back - * Fix FTBFS with Qt 5.3 and memory leak - * plugin-mount: typo for updating the status - * plugin-mount: large refactoring and simplification - * plugin-mount: improoved state changes handling - * plugin-taskbar: integrated "current screen only" commit into current master - grouping - * Added show windows from current screen only - * panel: layout elements centering fix - * Refactoring of panel's main - * panel: fixed creation of translation files - * plugin-taskbar: left-aligned labels in case "Only Text" - * plugin-taskbar: initial popup button style fix - * plugin-taskbar: fix grouping popup follow icon/text style - * CMAKE_AUTOMOC=ON and cleanup of all CMakeLists.txt - * Improve panel's configuration dialog arrangement - * plugin-taskbar: configurable maximum button height - * panel: layout position optimization - * plugin-desktopswitch: urgency handling improvements - * plugin-desktopswitch: initial desktop renaming - * plugin-desktopswitch: set urgency for desktops - * plugin-taskbar: correct handling of SkipTaskbar state - * plugin-taskbar: moved handling of KWindowSystem::windowChanged into LxQtTaskBar - * plugin-taskbar: optimized window icon geometry handling - * plugin-taskbar: enhanced "is on current desktop" handling - * plugin-taskbar: fixed group vs. window class handling - * plugin-taskbar: "regroup" every time when visibility is refreshed - * plugin-statusnotifier: correctly place context menu - * plugin-statusnotifier: fix showing menu/icon showing - * plugin-taskbar: proprely handle window class name change - * Fix NetBSD build - * plugin-directorymenu: fixed directory choosing - * plugin-worldclock: use Qt::WindowModal dialogs to not "inactivate" panel - * panelconfig: correct dialog handling (avoid access to deleted object) - * plugins config: use Qt::WindowModal dialogs to not "inactivate" panel - * panelconfig: use Qt::WindowModal dialogs to not "inactivate" panel - * panel: make config dialog top-level window - * plugin-clock: removed unneeded adjusting size of widget to it's content - * plugin-worldclock: removed unneeded adjusting size of widget to it's content - * panel: show panel after lauch if hidable - * plugin-taskbar: optimized calculation of popup position - * panel: widgets manageable from "add plugin dialog" - * Updates translations sources - * plugin-directorymenu: cleanup & icon - * new plugin - directorymenu - * Update mainmenu_it_IT.ts - * Updates translations sources - * panel: correct background of hidden panel - * lxqtpanellayout: respecting contentsMargins() value - * plugin-dom: enhanced properties output - * plugin-screensaver: proper shortcut regstration - * plugin-desktopswitch: proper shortcut regstration - * plugin-volume: proper shortcut regstration - * plugin-showdesktop: proper shortcut regstration - * plugin-desktopswitch: delayed registering shortcuts - * plugin-desktopswitch: refactoring & optimizations - * plugin-desktopswitch: Option to display names instead of numbers - * plugin-volume: avoid warning of hiding overloaded virtual function - * Create kbindicator_it.ts - * Update clock_it_IT.ts - * Update taskbar_it_IT.ts - * Update lxqt-panel_it_IT.ts - * Update lxqt-panel_it.ts - * Add required package xcb-util to plugin-tray - * plugin-spacer: reordered type - default now lined - * panel: auto-hide feature - * plugin-dom: non-stretchable heading - * plugins: static plugins initialization on one place - * plugins: const for ILxQtPanelPluginLibrary::instance - * plugin-mainmenu: if menu shown click on button closes menu - * plugin-clock: configurable first day of week - * panel: fix for multilplicating plugin counts when "Add Panel Widgets" shown and reactivated - * panel: conditional statically linked plugins - * plugin-volume: show perentage tooltip - * plugin-statusnotifier: standardize context menus - * plugin-taskbar: multiple fixes - * plugin-taskbar: large refactoring and cleanup - * plugin-taskbar: fixes for lxqttaskgroup and lxqtgrouppopup - * plugin-taskbar: refactor how we handle settings - * plugin-taskbar: removed eyecandy, re-sorted configuration item(s) and fixes - * plugin-taskbar: initial implementation of window grouping - * panel: added smart pointer guard to main (avoiding ad-hoc SEGFAULTs on application end) - * plugin-statusnotifier: workaround for invalid items - * plugin-statusnotifier: better icon handling - * Require C++11 support - * plugin-statusnotifier: added license to files headers - * plugin-statusnotifier: fix registration of StatusNotifierHost and protocol version - * plugin-statusnotifier: get some ideas from Plasma's - * panel: fix warning in findStaticPlugin - * plugin-statusnotifier: retrieve and cache the icons - * plugin-statusnotifier: handle Status and display correct icon - * plugin-statusnotifier: correctly handle mouse clicks - * plugin-dom: added all widget's properties view - * Added Status Notifier Plugin, from equim/lxqt-panel-plugin-snw - * plugin-dom: added all widget's properties view - * Adds a threshold which a user has to pass when scrolling on the desktopswitch plugin for the lxqt-panel. This makes scrolling less sensitive and more usable. - * Quit gracefully on Unix kill signals - * plugin-mount: Use drive-removable-media icon as fallback - * plugin-spacer: support for stylable spaces - * plugin-mount: Use only one icon instead a list of possible ones - * added support for setting desktoplayout - * plugin-desktopswitch: configurable number of rows - * plugin-networkmonitor: fixed Czech translation - * Fixes #473, mouse wheel on DesktopSwitch not functioning properly. - * plugin-mainmenu: fix for not showing menu for next added widget - * plugin-mainmenu: avoid menu loading if menu file not changed - * panel: connected cleanup to signal aboutToQuit - * Style/headers cleanups in Sensors plugin - * Updated polish translations - * Add support for "local" timezone. Fixes lxde/lxqt#519 - * Simplify update timeout. Fixes lxde/lxqt#525 - * plugin-mount: switch from liblxqt-mount to KF5Solid - * Style cleanups in ColorPicker, DOM, Mount and QuickLaunch plugins - * added separate list of configured plugins to not delete them from configuration in case plugin not found - * Fixing drag and drop of running programs' icons when panel is vertical - * plugin-spacer: suitable icon?! - * new spacer plugin/widget - * plugin-cpuload: configurable bar width - * plugin-cpuload: indentation corrected to follow rquired coding style - * Add some debug code to benchmark the loading time of each plugin during panel startup. - * Make some frequently used plugins "statically-linked" to speed up loading. * The static plugins are: clock, desktopswitch, mainmenu, quicklaunch, showdesktop, taskbar, tray, and worldclock. - * Add missing libxcb linkage to showdesktop and tray plugins since they still uses xcb. - * remove KF5/ prefix from includes as done in lxde/liblxqt/pull/36 - -0.9.0 / 2015-02-05 -================== - - * Change the delay of main menu popup from 500 ms to 250 ms. - * Try to fix lxde/lxqt#459, lxde/lxqt##142, and lxde/lxqt#401 at the same time. * Delay showing the menu when it's activated by shortcut key to workaround keyboard focus related issues. * Code cleanup. Remove unnecessary keyboard event hacks. - * Revert "Fix mainmenu's focus" - * Add icons to the panel plugins - * Add missing action icons to the panel popup menu - * fix networkmonitor_de_DE.desktop for the time being - * Fix mainmenu's focus - * Update Russian translation - * remove specialized leave-menu handling - * Remove teatime plugin - * Portuguese update - * Update Japanese translation - * Add #TRANSLATIONS_DIR to colorpicker.desktop. - * Fix dom.desktop.in (LXDE-Qt to LXQt) - * Update all translations - * Make sure widgets in settings dialog have corrent enabled state when settings are loaded - * Remove a translation message that gotten mixed accidentally - * Update spanish translation - * worldclock: Fix Ui date settings load inconsistency - * Removes ${PLUGIN_DIR} duplicate definition - * Include the BuildPlugin one time only - * Fixes CMake CMP0038 warnings - * Makes the Show Desktop shortcut work again - * Remove plugin settings from panel settings file when plugin is removed - * Portuguese language update - * Rename some text. See lxde/lxqt#416 - * Cleanup of CMakes, using GNUInstallDirs now - * Updates translations sources - * Unify plugin files naming - * Support custom time zone names (as per request in https://github.com/lxde/lxqt/issues/312#issuecomment-68588776 ) - * Rewrite worldclock's configuration - * - Reverse wrong placed translations. - * - Update brazilian portuguese desktop translation - * Toggle lock keys' state on click on keyboard indicator - * Use xcb on Show Desktop plugin. This is related to lxde/lxqt#338 - * Add QX11Extras to cmake include dir - * - Unify naming for a unique lxqt. No more suffixes - * Network Monitor plugin: fix faulty German translation - * Use XdgDesktopFile::load() - * Revert "Commit from LXDE Pootle server by user LStranger.: 391 of 391 strings translated (0 need review)." - * Commit from LXDE Pootle server by user vgezer.: 320 of 320 strings translated (0 need review). - * Update Russian translation - * Commit from LXDE Pootle server by user LStranger.: 391 of 391 strings translated (0 need review). - * Add keyboard navigation to main menu - * Reorganization of mainmenu's configuration panel - * Fixes lxde/lxqt#318 configurable font size in mainmenu - * Commit from LXDE Pootle server by user flywheel.: 262 of 264 strings translated (2 need review). - * Update taskbar buttons' icons on event - * Add KDevelop project file type to .gitignore - * Commit from LXDE Pootle server by user DanWin.: 305 of 305 strings translated (0 need review). - * Commit from LXDE Pootle server by user DanWin.: 294 of 305 strings translated (0 need review). - * Plugin name fixed. Fixes #382 - * Update Russian translation - * Sort plugins alphabetically, remove non-existing plugin-helloworld - * Add time-only formats, improve popup in plugin-worldclock - * Cancel widget move on panel with esc - * Get rid of Xlib on the keyboard indicator - * Fix draggind action from main menu - * Fixes translations generation - * Moves translations from the local to the translations dir - * Uses the new translations cmake modules - * Renames the translations source files - * Reorganize panel configuration dialog - * Make the lxqtmount-qt5 required only when building the mount plugin. - * Custom font color handling. Fixes #101. - * Panel background configuration - * Commit from LXDE Pootle server by user H.Humpel.: 124 of 305 strings translated (0 need review). - * Reset statistics widget only when size changes. Fixes lxde/lxde-qt#353 - * Relax limits on size and update frequency - * Set the systray plugin free form liblxqt's XfitMan - * Fix segfault on i3 when changing workspaces. Fixes lxde/lxde-qt#240 - * Commit from LXDE Pootle server by user rago1975.: 65 of 65 strings translated (0 need review). - * Fixes an FTBFS on openSuse - * Commit from LXDE Pootle server by user JSonic.: 391 of 391 strings translated (0 need review). - * Commit from LXDE Pootle server by user rago1975.: 10 of 10 strings translated (0 need review). - * Commit from LXDE Pootle server by user rago1975.: 24 of 24 strings translated (0 need review). - * Commit from LXDE Pootle server by user rago1975.: 21 of 25 strings translated (0 need review). - * Commit from LXDE Pootle server by user rago1975.: 57 of 57 strings translated (0 need review). - * Commit from LXDE Pootle server by user rago1975.: 39 of 39 strings translated (0 need review). - * Commit from LXDE Pootle server by user KlemenKosir.: 360 of 356 strings translated (0 need review). - * Fixes translations not being loaded. - * Fixes lxde/lxde-qt#325. Drop .desktop files on quicklaunch - * Update Russian translation - * Fix taskbar window filter - * Reset calendar's selected date when showing. Fixes lxde/lxde-qt#322 - * worldclock: get rid of ICU - * CMakeLists.txt cleanup - * Commented line that was causing high CPU and memory usage - * Port to KWindowSystem. Purges Qt4. - * Commit from LXDE Pootle server by user H.Humpel.: 78 of 305 strings translated (0 need review). - * Popup the configuration dialog when the user adds a panel - * Commit from LXDE Pootle server by user Pjotr.: 356 of 356 strings translated (0 need review). - * Commit from LXDE Pootle server by user KlemenKosir.: 285 of 356 strings translated (0 need review). - -0.8.0 / 2014-10-09 -================== - - * Load the plugins translations - * Adapt to the translation infrastructure - * Fix plugin title in context menu - * Allow opening more than one plugin configuration panel. Fixes lxde/lxde-qt#60 - * Make Removable Media's panel be closable with ESC. Fixes lxde/lxde-qt#126 - * Needed for lxde/lxde-qt#140 and #54 - * Make version detection work with Qt4 - * Fixes bug that resets panel configuration on panel deletion - * Make calendar dialog hide when it loses focus - * Fix scroll order after drag and drop - * Use Qt5.2+ for WorldClock plugin instead of ICU4.2+ if possible - * Prevent infinite repainting - * Keep layout direction linked to rotation - * Update copyright info - * Fix lxde/lxde-qt#61 - * Fix iterator type - * Fix lxde/lxde-qt#279 - * Avoid using XdgDesktopFileCache which loads the whole cache just to get info for several files. This can speed up startup of lxqt-panel. - * Adapts to the new libqtxdg XdgMimeType class - * Removes "Set from theme" panel size button - * Commit from LXDE Pootle server by user dforsi.: 57 of 57 strings translated (0 need review). - * Commit from LXDE Pootle server by user psokol.: 16 of 32 strings translated (0 need review). - * Fix incorrect handling of work area and WM_STRUT which cause incorrect popup menu places. - * Workaround for Qt 5 bug #40681 by monitoring QScreen::destroyed() and re-create affected panels manually. * This closes lxde/lxde-qt bug #204, #205, and #206 at the same time. * Store the result of QX11Info::display() and avoid repeated calls to the methods. (When called during the primary screen being destroyed, QX11Info::display() crashes.) - * Force re-creation of the panel window when screen count is changed to workaround Qt bug 40681. * Fix lxde/lxde-qt bug #204, #205, and fix incorrect WM_STRUT & WM_STRUT_PARTIAL X window properties. - * Use the edge of the whole screen instead of that of individual monitors when setting strut as specified in the xdg EWMH spec. - * Fix incorrect _NET_WM_STRUT settings under multi-head environment. - * Do not activate the panel on mouse click. This closes lxde/lxde-qt bug # 161. - * Replace Qt5 only API QWidget::grab() with QWidget::render() when compiled with Qt4. - * Always use percentage (0-100) for the volume of audio devices. - * Delete invalid slot. - * Taskbar buttons manual ordering - * Refactor lxqt taskbar plugin and made using more than 1 taskbar possible. - * Set proper default value for sysstat plugin to turn on cpu monitoring by default. - * Fix the bug that 100% volume cannot be used. * Make AudioDevice::setVolume() accept real volume rather than percent and make all backends consistent. * Set the maximal volume of the alsa devices to 100. - * Fix dropping an action from menu - * Remove repeated find_package() from CMakeLists.txt - * Return 0 for QStyle::SH_MenuBar_AltKeyNavigation style hint of mainmenu. With this, the menu won't be closed when the user press Alt key. - * Avoid duplicated ElidedButtonStyle instances to save some resources. Update the ElidedButtonStyle proxy style when its base style is changed. - * Implements Urgency Hint handling - * Apply the new QStyles correctly to the main menu when the style is changed. - * Fix bug #14: ilxqtpanel.h misses its dependency on lxqtpanelglobals.h. - * Add missing xcb packages to CMakeLists.txt. - * Try to fix lxde-qt bug #208: Volume applet slider closes immediately after touching. * Do not hide the volume popup when realign(). * Activate the popup window, and hide the popup when it's deactivated. * Fix the timeout handling in VolumeButton. - * Update the sink list in the config dialog of volume control plugin when changing audio engine. - * Fix the incorrect default value of audio backend of volume control plugin. - * Properly include sysstat directories - * Use portable SysStat headers - * Use portable LXQt header in .ui files too - * Look for the Qt5 version of SysStat when appropriate - * Set _NET_WM_WINDOW_TYPE_DOCK to the panel to workaround a bug in Qt5. - * Fix incorrect handling of xcb event, fixing tray plugin. - * Fix building kbindicator plugin with Qt5 and XCB (not fully working). - * Try to fix tray plugin. - * Fix taskbar plugin for Qt5. - * Add missing plugin metadata to make them loadable in Qt5. - * Qt5 fixes - * Prepare for Qt5 - * Prepare the CMakeLists.txt files for building with Qt5. - * Make the "Mixer" link in volume plugin be themeable - * emit realigned () is now called always AFTER LxQtPanel::realign() - * Update quicklaunchaction.cpp - * Use the libqtxdg portable headers - * Make it work for vertical panels too - * Panel height handling - * Adapt to the new liblxqtmount portable headers - * Adds the liblxqtmount include dirs to the build system. - * Call for realign() when position is changed and a name fix for positionChanged() - * Remove unused btnClicked slot - * Use new LXQt header files. - * Update clock_pl_PL.ts - * Update lxqt-panel_pl_PL.ts - * Apply again patch for special meaning of negative size for panel - * Improve OSS backend of volume plugin and fix its configuration dialog. - * Add initial OSS support for the volume plugin - * Use the new libqtxdg environment neutral API - * Fix instantiation order - * Plugin wording fixes - * fixed version output and make it less verbose - * cmake option to build without menu-cache even if it is installed - * RGBA support for panel - -0.7.0 / 2014-04-30 -================== - - * Avoid mnemonics in the main application menu caused by & symbol in the name of the desktop apps. - -0.6.99 / 2014-04-29 -=================== - - * Update AUTHORS and COPYING - * Add CPack rules for creating tarball - * Support libstatgrab 0.90 - * Trivial fix - * Fix zh_TW translation for networkmonitor. - * Little fix for the previous commit - * Delay loading of menu icons when they are about to be shown. - * Delay the initiation of mount manager to speed up the startup of the mount plugin - * Fix incorrect signal/slot connections. - * Add a dirty hack to workaround bug #23 - Status icon for GTK3 applications present but not visible. - * Improve handling of app menu tooltips. - * Removed CMAKE_SOURCE_DIR usage from CMakeLists.txt - * Fix bug #11 - moc generation error - * Add missing lib linking for plugins. - * Properly export symbols needed by plugins. - * Include libsysstat cmake package correctly. - * Use gcc visibility to reduce unnecessary symbol exports - * Set NETWM icon geometry for task buttons while the panel is being resized or moved. - * Removed unneeded variable in realign - * Update NETWM icon geometry for task buttons. * Fix incorrect signal connection of ConfigPanelDialog::accept(). - * Fix renaming bugs, replacing lxqt-qt with lxde-qt - * Finish the crazy razor=>lxqt renaming tasks. - * Create default panel on startup if panel/panels list in the config is empty. - * Fix #5 Wrong panel size sometimes (happens randomly) - * Fixed #6. Panel size fluctuated due to change in task buttons. - * Fix drag and drop of application menu items. - * Build main menu with libmenu-cache optionally to speed up loading greatly. - * Replace razormount with lxqtmount and close bug #4. - * Fix issue #1 by replacing razor includes with lxqt ones and use proper namespace. - * Replace links to librazorqt with ${LXQT_LIBRARIES}. - * Explicit namespace added to RotatedWidget class name - * ICU can be found by cmake now - * Fix incorrect header inclusion for lxqt-globalkeys-ui. - * Rename razor-panel to lxqt-panel and fix broken build. * Use the latest liblxqt and liblxqt-globalkeys. - * Empty taskbar collapses to zero size again - fixed - * New resizing algorithm, now we set iconSize. - * Delay when saving settings decreased to 3 seconds. - * Add COPYING and AUTHORS - * Fix for Issue #571 [try plugin] - * Fixed issue #645 "Panel plugins settings cleanup" - * QuckLaunch plugin. Placeholder takes all the available space, regardless of the number of rows of columns. - * Fix for Issue #571 [quicklaunch plugin] - * Add options for the razor-panel. Missing file - * Add options for the razor-panel -h, --help Show help about options --version Show version information -c, --configfile=CONFIGFILE Use alternate configuration file - * razor-desktop and razor-panel: Adds missing tr() to setWindowTitle() - * razorqt-panel/panel: Replace "Delete Panel" by "Remove Panel" - * razorqt-panel/panel: Use capitals for in menus and window titles - * razorqt-panel/panel: Renames "Add plugins ..." to "Add Panel Widgets" - * Removes hardcoded "Add plugin" window title - * razorqt-panel/panel: Save settings right after the close button clicked - * All spinboxes for panel config have step of 1 - * Taskbar does not collapse when empty - * Some plugin alignments fixed - * Include polished - * Panel plugin popups unified and are QDialog based now - * Object renamed for easier theming - * KBIndicator plugin initialization delayed - * Correct tab set as default - * Typo fixed - * More verbose constants - * C includes fixed - * X11 Bool declaration conflict fixed - * No dependencies on STL - * Fix for issue #618 - * Fix for issue #413 - * Fix for Issue #531 This work for me in the OpenBox and KWin - * fixed #455 Panel->automatic height setting (sensors layouting) - * panel: add/remove panel in context menu. And it works. - * Simplified global key shortcut action names since all panels share the same config file. - * panel: single file config is used - * Better text (issue #583) - * Some improvements and optimizations in worldclock plugin - * Main menu has "reset shortcut" feature - * Unique panel & plugin identification - * Global shortcuts client library added and all support for it refactored and fixed. - * Crash on plugin removal fixed - * Memory leak fixed - * World clock has auto-rotation - * Rotated widget requires content - * Standard clock can be autorotated - * A better name for config variable - * Theme change makes properties update (issue #553 fix) - * potential solution for #553 - Cpuload: adjust text color with theme - * hotfix for hardcoded path in init - it's work in progress... - * Add pcmanfm-qt to quicklaunch (when it's installed) - * fixed #578: Please clarify/fix license in razorqt-panel/plugin-mount/mountbutton.* and menudiskitem.* - * panel: more panels in one executable. It allows to start more panels in a time - * initial implementation for #473 Highlight installed plugins. Now it needs to be "designed" - * fixed #561: Feature: drag and drop of local file (URL) in panel taskbar - * fix "shorcut" typo - * panel: set panel position when screen resizes (used eg. in virtualization) - * Fix typos - * Fix Issue #564 for the mainmenu plugin #564 "new panel: cfg "Line size" can be set to 10px but the value is not accepted" - * Rename Maximum button width to Preferr button width in the taskbar - * Fix Issue #564 for the mainmenu plugin #564 "new panel: cfg "Line size" can be set to 10px but the value is not accepted" - * Fix Issue #564 for non separate plugins #564 "new panel: cfg "Line size" can be set to 10px but the value is not accepted" - * Fix Issue #564 for the colorpicker #564 "new panel: cfg "Line size" can be set to 10px but the value is not accepted" - * Fix Issue #564 for the quicklaunch, set correct size for the placeHolder message #564 "new panel: cfg "Line size" can be set to 10px but the value is not accepted" - * Fix Issue #564 for the quicklaunch #564 "new panel: cfg "Line size" can be set to 10px but the value is not accepted" - * Fix Issues for the tray #564 "new panel: cfg "Line size" can be set to 10px but the value is not accepted" - * Fix for Issues #564 "new panel: cfg "Line size" can be set to 10px but the value is not accepted" #563 "new panel: vertical mode makes panel too lerge (width)" - * optimized panel calculations for icons only mode - * fix for tasbar's icon only view - autoreduce size expanding - * Don't use separate Layout for Placeholder in the QuickLaunch. - * Use separate Layout for Placeholder in the QuickLaunch. - * Show placeholder if QuickLaunch is empty. - * The DesktopSwitch buttons is strachable. - * Use RazorGridLayout in the DesktopSwitch plugin. - * Incorrect height for plugins on vert panel. - * Disable TeaTime plugin - * Improving the appearance of the mount popup - 2. - * Improving the appearance of the mount popup. - * The WorldClock plugin is separated - * New plugin Dom tree, usable for theme writers. - * Fix for "Set correct event_mask in the RazorTaskButton" breaks the button titles. https://github.com/Razor-qt/razor-qt/commit/c955007b951c7f4e35206a2f6e9d1911649bae10#commitcomment-2774274 - * Kb indicator plugin simplified - * Fix: If you add several plugins at once, RazorPanel::findNewPluginSettingsGroup allocated one name at all new plugins. - * Removed panel HelloWorld plugin, you can use TeaTime as example plugin. Removed from razorqt-panel/CMakeLists.txt - * Removed panel HelloWorld plugin, you can use TeaTime as example plugin. - * The WorldClock plugin was ported - * The KbIndicator plugin was ported - * The SysStat plugin was ported - * The Sensors plugin: settings().value to mPlugin->settings()->value - * The Sensors plugin was ported - * The NetworkMonitor plugin was ported - * The CpuLoad plugin was ported - * The ColorPicker plugin was ported - * Remove garbage include directivies - * The ShowDesktop plugin was ported - * The ScreenSaver plugin was ported - * Set correct event_mask in the RazorTaskButton - * Refactored rezor-mount plugin, added DeviceAction classes. - * The RazorPanel::calculatePopupWindowPos function handles the situation when the window is out of the screen. - * The Mount plugin was ported - * The QuckLaunch plugin was ported - * Fixed #538 razor-panel: Restore (a minimized window) is not working while using Fluxb - * Network Monitor plugin: provide interface list in configuration - * Removed debug item from plugin menu - * The DesktopSwitch plugin was ported - * Now panel does not take ownership of the config dialog. - * The Volume plugin was ported - * Typo fixed - * Mainmenu: Use xfitman to force focus when menu raised via shortcut - * The Tray plugin was ported - * Fix plugins list was saved incorectly - * Trivial fix for "sysstat/cpustat.hpp not found" - * Style follows the Coding Standard - * Main menu focus fixed if activated by hotkey - * Sysstat panel plugin: collapse when vertical panel is autosizing prevented - * RazorSysStat: fix build on ARM - * Update layout when plugin shows. - * Improved razorpanellayout and new razorgridlayout. - * Fix for devision by zerro exception. - * Layout for TaskBar - * Create a rows on panel only if it's necessary (exists some plugin on this row). - * New panel layout and many changes - * Improve icons handling. - * Clock panel plugin: update time once a minute if no seconds displayed - * SysStat: license updated & unused files removed - * Add strings to translate in volume plugin - * Quicklaunch: Don't stack buttons on small panels - * Panel WorldClock plugin: restart timer only if update interval is long - * Panel WorldClock plugin: Smarter timer interval handling - * plugin-clock: Don't try to get the firstDayofWeek from saved settings - * fixed #484 Ugly mount plugin appearance without any mountpoints present - * Panel Worldclock plugin: proper version dependancy (issue #500) - * Fix various build falures - * Debug included back - * Panel: Duplicated line removed - * Remove ifdef nesting - * Panel Clock plugin: epic failure fixed - * Panel Clock plugin: comment with explanation added - * Panel Clock plugin: C++-style casting used, multilevel if/else changed to switch/case, conversion formula simplified. - * Panel Clock plugin: variable declarations moved to their usage places. - * Panel Clock plugin: C locale initialised only once - * Panel Clock plugin: Implementations reordered - * plugin-mount: Don't add devices that are not usable - * plugin-clock: Get locale LC_TIME from the environment - * plugin-clock: Add missing word to a comment - * plugin-clock: Check if _NL_TIME_WEEK_1STDAY exists - * plugin-clock: Add documentation to firstDayOfWeek() - * plugin-clock: Initialize variable at declaration. - * plugin-clock: Declare one variable per line - * plugin-clock: Use camelCase style for variables - * Add myself to the authors list - * plugin-clock: Fix first day of week auto-detection. Closes #489. - * plugin-clock: Use nl_langinfo() only if available - * WorldClock plugin: all timezones shown on middle click, styles updated - * WorldClock plugin: local timezone used if no timezones selected - * WorldClock plugin: Good default custom format set, synchroTimer removed, main timer sped up, popup calendar added with current day in a region supported - * WorldClock plugin: mouse wheel supported - * WorldClock plugin: main functionality works - * Active timezone support improved - * Time zones can be added to the main list - * Time zone list built from ICU - * Settings loaded and saved - * Config added - * Initial WorldClock plugin skeleton - * SysStat plugin: Custom colours are in separate dialog - * SysStat plugin: Colours and font are read from theme - * potential solution for #484 - to display text placeholder when there is no item connected - * Icon in the TeaTime plugin. - * Plugin emit SettingsChanged only if really changes present - * Fix build on older Qt - * Trtanslations - * Graph uses all available space - * Class variables renamed - * History preserved when possible in Sysstat plugin - * Painting refactored in sysstat plugin - * forced y-position clamping - * Transparent background & theme-able container added - * sysstat: a better fix for older Qt - * panel systat plugin: a potential fix for older Qts - * Handle QSS position property - * panel-volume: add compile time switch for ALSA/Pulseaudio support - * ClockPlugin was ported - * Added IRazorPanelPlugin::calculatePopupWindowPos(), improvements. - * Re-enable kbindicator plugin - * More natural logarithmic scale - * Control over logarithmic scale added - * Dependancy on internal library fixed - * SysStat library and plugin - * Separator between the screens in the select panel position combobox - * Razor-panel: New plugin API - * preliminary manpages primary for razorqt and usefully in venenux - * Simplify code in the PowerManager - * Do not display non-urgent notifications in fallback mode - * Issue #460 fixed - * Style polishing - * Removed unnecessary copied code - * unused member removed, code style is up to Coding Standards - * mainmenu: position menu based on actual width of panel - * Simpler configuration dialogue - * Issue #426 addressed - * Clock plugin simplified: no more custom fonts - * More clear code - * Translations updated - * Translations updated - * first part of fixes based on Coverity Scan (code static analysis) - * Fixes notification in volume - * Font set correctly on theme change - * Custom font for clock plugin applied correctly - * Typos found during translation - * Panel Keyboard indicator plugin - Done - * Panel Keyboard indicator plugin - skeleton - * Translations - * Delete bad en_GB translations - * Update translations - * Fix various typos - * Fix menu for plugins with an ampersand - * Translations updated - * Removed line num from TS files. - * panel-volume: remove unused translation file - * panel-volume: Fix compilation issue when one of the AudioEngines not found - * panel-volume: Fix runtime AudioEngine if multiple are available - * panel-volume: Add logistics to change AudioEngine on runtime - * Translations - * Deleted old translation methods. - * Translations for librazorqt - * panel volume: show some icon when there is no device - * panel-audio: do not crash audio plugin if there is no sound configured in the system - * Fix middle-click config - * convert annoying QMessageBox to RazorNotification - * Make close-on-middle-click optional - * Update panel plugin names and descriptions. Closes issue #361 - * Lazy start and additional nullpoiter check in the razor-tray plugin. - * variable fix for cmake - * fixed #257 razor-panel segfaults - when there is no DBUS server running. The RzMountProvider's RazorMountDeviceList is not handled over pointer/casting anymore because QList is always implicitly shared. - * New translation infrastructure - * First day of week removed from UI - * The first day of week autodetection - * The first day of week autodetection - * Closed Issue #382 - * Updated .ts.src files - * panel-volume: fix issue #362 about max volume - honor device max volume in pulseaudio as a default - add setting to ignore device max volume on pulseaudio - * panel-volume: fix usage of volume adjust step when using scrollwheel - * panel-volume: fix deadlock when sinkinfo retrieval failed - * panel-volume: Use same icon in panel as well as in popup for mute toggle - * Fix for Issue #290 Fails to build on BSD - * panel-volume: Change mixer QPushButton to a QLabel The label includes a link-style text instead of the flat pushbutton, which lacks some indication on some QStyles like Cleanlooks - * panel-volume: visual improvements - add mixer button with label instead of icon - add checkable pushbutton to mute on the popup - * razor-panel/plugin-volume: Use center alignment - * razor-panel: Sets the limits to the panel size (Ui) - * razor-panel: Add panel config size limits (Ui) - * razor-panel: Use PANEL_DEFAULT_SIZE instead of obscure 32s - * razor-panel: Remove minimum size definition from the config ui - * razor-panel: Refactor minimum panel size definition - * New translations for razor-panel plugins - * New translations for razor-panel - * detect soub backends by proper cmake modules because of cmake variable errors on some systems; allow to be built with no pulse (ifdefs) - * panel-volume: add settings defines - Use defines rather than strings for the setting names - Change settings default for mixer to 'qasmixer' for alsa - Change settings default for volume adjust step to 5 - * panel-volume: Add volume adjust step - settings has now an item to adjust volume step - inc/dec volume on AudioDevice is remove as it depends on the settings step - * panel-volume: Finally make members in AudioDevice private - * panel-volume: - Receive updates on external volume changes for alsa - Fix alsa mute setter - * panel-volume: Add alsa event handling, no usage yet - * panel-volume: Try to get proper card name instead of card index - * panel-volume: - Fix mute handling - Add mute setting for alsa backend - * panel-volume: - Add initial alsa channel listing - Volume on selected alsa channel can now be set - No external volume changes are handled in alsa backend - No mute ability in alsa backend - * panel-volume: - fix logic around mute and setVolume - Unmute is volume is reset from eg. inc/dec volume - * panel-volume: add missing files - * panel-volume: Add initial Alsa support, only detects devices so far for a start - * panel-volume: qBound is much nicer, thanks for the hint from Alexander Sokolov - * panel-volume: set proper fallback icon for mixer launcher - * panel-volume: Fix global shortcuts. - * panel-volume: fix bug in setVolume on device, stupid me - * panel-volume: apply utf8 patch from Alexander Sokolov, thanks - * panel-volume: add global shortcuts, yet not configurable - * panel-volume: build fixes - add missing QMetaType include - add define for PA_VOLUME_UI_MAX, which is only defined since pulseaudio 0.9.23 - * panel-volume: - make volumepopup member private - make volumeslider member private - * panel-volume: - Rename slots to proper names - Remove unused destructor - * panel-volume: Set slider value for initial volume value whenever the managed device changes - * panel-volume: Rework pulseaudio state tracking to recover pulseaudio daemon shutdowns and/or restarts. - * panel-volume: Expose ready state from pulseaudioengine - * panel-volume: Rename method to what it actually does - * panel-volume: Add guard when context is not ready - * panel-volume: Improve internal context state tracking - * panel-volume: Finally fix the default behavior to show popup - * panel-volume: Fix creating intances in a different thread - * panel-volume: No need to set the layout explicitly - * panel-volume: Fix margin on popup layout - * panel-volume: Click to show the volume popup is now the default - * panel-volume: Fix settings dialog title - * panel-volume: Make change wheel behavior on volume slider - * panel-volume: Rename to 'Volume Control' - * panel-volume: Fix configuration and add external mixer settings - * panel-volume: use full volume range, even over 100% - * panel-volume: Make device type private - * panel-volume: Add mute toggle on middleclick - * panel-volume: Launch pavucontrol as a default mixer - * panel-volume: Fix segfault - * panel-volume: Add middleclick option - * panel-volume: Change icon accordingly to volume - * panel-volume: Reflect external volume changes in slider - * panel-volume: Start volume plugin - * panel-volume: add settings defines - Use defines rather than strings for the setting names - Change settings default for mixer to 'qasmixer' for alsa - Change settings default for volume adjust step to 5 - * razoor-panel: Adds Orientation property - * razor-panel: Refactors useTheme variables names - * razor-panel: Renames "Use theme size" to "Use automatic sizing" - * panel-volume: Add volume adjust step - settings has now an item to adjust volume step - inc/dec volume on AudioDevice is remove as it depends on the settings step - * panel-volume: Finally make members in AudioDevice private - * panel-volume: - Receive updates on external volume changes for alsa - Fix alsa mute setter - * panel-volume: Add alsa event handling, no usage yet - * panel-volume: Try to get proper card name instead of card index - * panel-volume: - Fix mute handling - Add mute setting for alsa backend - * panel-volume: - Add initial alsa channel listing - Volume on selected alsa channel can now be set - No external volume changes are handled in alsa backend - No mute ability in alsa backend - * panel-volume: - fix logic around mute and setVolume - Unmute is volume is reset from eg. inc/dec volume - * panel-volume: add missing files - * panel-volume: Add initial Alsa support, only detects devices so far for a start - * panel-volume: qBound is much nicer, thanks for the hint from Alexander Sokolov - * panel-volume: set proper fallback icon for mixer launcher - * panel-volume: Fix global shortcuts. - * panel-volume: fix bug in setVolume on device, stupid me - * panel-volume: apply utf8 patch from Alexander Sokolov, thanks - * panel-volume: add global shortcuts, yet not configurable - * panel-volume: build fixes - add missing QMetaType include - add define for PA_VOLUME_UI_MAX, which is only defined since pulseaudio 0.9.23 - * panel-volume: - make volumepopup member private - make volumeslider member private - * panel-volume: - Rename slots to proper names - Remove unused destructor - * panel-volume: Set slider value for initial volume value whenever the managed device changes - * panel-volume: Rework pulseaudio state tracking to recover pulseaudio daemon shutdowns and/or restarts. - * panel-volume: Expose ready state from pulseaudioengine - * panel-volume: Rename method to what it actually does - * panel-volume: Add guard when context is not ready - * panel-volume: Improve internal context state tracking - * panel-volume: Finally fix the default behavior to show popup - * panel-volume: Fix creating intances in a different thread - * panel-volume: No need to set the layout explicitly - * panel-volume: Fix margin on popup layout - * panel-volume: Click to show the volume popup is now the default - * panel-volume: Fix settings dialog title - * panel-volume: Make change wheel behavior on volume slider - * panel-volume: Rename to 'Volume Control' - * panel-volume: Fix configuration and add external mixer settings - * panel-volume: use full volume range, even over 100% - * panel-volume: Make device type private - * panel-volume: Add mute toggle on middleclick - * panel-volume: Launch pavucontrol as a default mixer - * panel-volume: Fix segfault - * panel-volume: Add middleclick option - * panel-volume: Change icon accordingly to volume - * panel-volume: Reflect external volume changes in slider - * panel-volume: Start volume plugin - * razor-panel: Adjust panel size on plugin load/remove - * RazorCpuLoad bar has configurable orientation - * Updated ts.src files - * Panel clock plugin: first day of week is configurable in popup calendar - * Panel clock plugin: tooltip returned back - * networkmonitor: reformat (tabs to spaces) - * networkmonitor: Use appropriate units - * razor-panel: Replace 'Delete' by 'Remove'. Closes #339 - * razor-panel: Read the panel size value when not using the theme size - * part of #329: on-click on notification launces default action or it tries to find appropariate window to raise; xfitman method renamed + one new - * colorpicker: get rid of all the hairy X11 code - * Fix indent - * Color picker as panel plugin, it doesn't change cursor icon yet. - * Syntax fixed - * Prevented potential index overflow problem - * Reordering with context menus fixed - * Showdesktop: display notification instead of a popup - * removed complaining invalid signal-slot connection - * Themes supported - * Second line visibility fixed - * Labels renamed - * Better layout - * configure clock font size (issue #213) - * Show calendar only on left-click - * [297] Sensors panel plugin - blink progress bar when the temperature is too high - * issue #276: annoying sub-menu removed - * razor-panel: Adds mount to the default plugin list - * Fix comma - * razor-panel: Setup Configure Panel>Panel size Ui properly - * Implement Actions and add some more functions - * Implement new RazorNotification class - * Ts.src files updated. - * Language name zh_CN.GB2312 braked cmake process. - * Translations updated - * [193] lm-sensors applet for panel [missing Qt parent assignment to the widgets] - * [193] lm-sensors applet for panel [sensors_cleanup fix] - * Fix a problem with colors - * Issue # 276 Panel context menus redesign - * [193] lm-sensors applet for panel [feature index out of bounds fixed] - * [193] lm-sensors applet for panel [more debug info added] - * [193] lm-sensors applet for panel [more debug info added] - * qt<4.7 compilation fix - * fix compilation for qt4.6.x - * [193] lm-sensors applet for panel - * quicklaunch: fixed layouting (matrix, horiz/vert. panel) broken by previous commit - * fixed #252 [quicklaunch] issue dragging from qtfm - * Move panel position into the configuration dialog - * Convert Panel config dialog to use RazorConfigDialog - * Environments should be "Razor", not "RAZOR" Thanks Alec Moskvin - * Fixed for Preloading menu - * panel cpu plugin: allow user to setup update interval (1sec is default now instead of 0.5). It can drastically reduce CPU load caused bu this plugin - * Move lock screen back in root menu, per amoskvin - * tooltip workaround uses notification system - * Move Lock Screen to the Leave submenu (#210) - * GUI for change razor theme. - * Close application by middle click. - * Set window titles for use with WM's like fvwm - * Typos in code. Thanks Aaron Lewis. * In razor-runner , providers item: title() was typed as tile() * For RazorSettings class , settingsChanged() was typed as settigsChanged() - * Network monitor: don't needlessly set the tooltip - * install fix for panel's network monitor - * Improve size of cpu monitor on change of pannel orientation. - * Fixed error on network interface down. - * Nemo is renamed to NetworkMonitor - * Fixed init settings of panel-plugin network monitor. - * Added Netwok Monitor plugin for razor-panel. - * Added configuration. - * Fixed text cropping (when 100% cpu usage). - * fix default value for custom panel size - * /etc/xdg can vary on some system. Autodetected using qmake in cmake run. - * Properly show &'s in taskbar - * fix for cpuload plugin installation. cmake re-run needed. - * Preloading menu in the main menu plugin. - * Revert "Global shortcuts now based on PSI code." - * Revert "The panel did not receive the focus." - * The panel did not receive the focus. - * Global shortcuts now based on PSI code - * warning if there is no libstatgrab found - * Hide main menu when it's visible. Thanks Aaron Lewis. - * Closes #224: Application menu button don't show full text/icon when text is selected - * Config coresponds XDG directory specification - * Transifex desktop: sr_BA.ts should be a local - * Transifex desktop: local translations - * Transifex desktop: cmake files - * Transifex desktop: Translations pulled - * Transifex desktop: Reomove translations from desktop.in - * Transifex desktop: desktop->desktop.in - * Update Tradidtional Chinese Translations - * CpuLoad plugin required libstatgrab. - * Committer:stuarch modified: razorqt-desktop/config/razor-config-desktop.desktop modified: razorqt-desktop/desktop-razor/plugin-analogclock/resources/analogclock.desktop new file: razorqt-desktop/desktop-razor/plugin-analogclock/translations/analogclock_zh_TW.ts modified: razorqt-desktop/desktop-razor/plugin-helloworld/resources/helloworld.desktop modified: razorqt-desktop/desktop-razor/plugin-iconview/resources/iconview.desktop modified: razorqt-desktop/desktop-razor/plugin-notepad/resources/notepad.desktop new file: razorqt-panel/panel/translations/razor-panel_zh_TW.ts modified: razorqt-panel/plugin-clock/resources/clock.desktop new file: razorqt-panel/plugin-clock/translations/clock_zh_TW.ts modified: razorqt-panel/plugin-desktopswitch/resources/desktopswitch.desktop new file: razorqt-panel/plugin-desktopswitch/translations/desktopswitch_zh_TW.ts modified: razorqt-panel/plugin-helloworld/resources/panelhelloworld.desktop modified: razorqt-panel/plugin-mainmenu/resources/mainmenu.desktop new file: razorqt-panel/plugin-mainmenu/translations/mainmenu_zh_TW.ts modified: razorqt-panel/plugin-mount/resources/mount.desktop new file: razorqt-panel/plugin-mount/translations/mount_zh_TW.ts modified: razorqt-panel/plugin-quicklaunch/resources/quicklaunch.desktop new file: razorqt-panel/plugin-quicklaunch/translations/quicklaunch_zh_TW.ts new file: razorqt-panel/plugin-screensaver/translations/screensaver_zh_TW.ts - * Changing box layout to grid layout in quick launch plugin - * Translations update - * Added support for the online translation service. www.transifex.net - * RazorApplication class implemented; all modules ported to this class - * Update razorqt-panel/panel/translations/razor-panel_it_IT.ts - * A lot of renames. - * CpuLoad depends on Linux. It doesn't work on BSD (using /proc). - * CpuLoad-plugin height fixed on changing of panel position. - * Serbian translation files - * Serbian translations (2 variants) - * Removed dead slots declarations. - * Added simple cpu monitor. - * Greek translation by iosifidis - * Improved searching for devices in the mount plugin. - * Fix desktopswitch shrinking on panel resize - * Ensure Desktopswitch buttons are all the same size - * Plugins alignments depends on the panel positions. - * Added danish translations - * Russian translation - * Panel plugins not found .ts files - * Save quicklaunch button position after moving - * Grey out "All Desktops" when window is on all desktops - * Grey out "All Desktops" when window is on all desktops - * Change Height/Width to Size/Length in panel dialog - * The razormount library now based on the providers. - * Set a default panel height - * The razormount library now based on the providers. - * Make remaining plugins expand - * Fix - icons are clickable on all button area. - * Closes #131 Closes #181 Vertical panel fixed. All plugins should look good. - * Fix a typo - * edit my email address - * fix #169: italian translation - * Finish the code for clock's popup calendar - * Put Move and Delete into plugins' context menus - * Vertical panel. Improved layouting in plugins - * Env variables for plugins dirs RAZORQT_DESKTOP_PLUGINS_DIR & RAZORQT_DESKTOP_PLUGINS_SO_DIR RAZORQT_PANEL_PLUGINS_DIR & RAZORQT_PANEL_PLUGINS_SO_DIR - * Relicense panel & runner - * Relicense panel - * The panel is not correctly positioned in the dual-monitor configurations. - * cmake fix - * razormount rewriten (lgpl2+) - * Fix gmail.ru -> gmail.com - * Hello World plugin for panel - * original and our code compared - it seems 99% rewritem so it's relicensed to lgpl2+ - * Clean up configure panel dialog - * close panel/desktop in the debug builds - for development - * Czech translations (cs_CZ) Desktop files - * SVK translation finalized - * Replaces return"" by return QString() - * Closes #128 - * More translation to german - * more work done - * Initial german release, only a tiny part - * Add "Configure" to plugins' context menus - * Fix crash due to null pointer - * Fix issue #116 - * License audit - * implemented #49: keyboard shortcut for main menu - * Add Chinese(simplified) translation files. - * Switch scroll direction for the pager - * Switch windows when scrolling over taskbar - * Hide moved window (properly this time) - * Apply previous typo fix to newly-added translations - * HU translation by Kristóf Kiszel - * Fix another typo - * Fix typo - * Fix Taskbar in "Show windows from current desktop" mode - * added ability to change panel height/width/alignment - * Initial spanish translation - * razorqt-panel: use MODULE type for plugin libraries - * Add Slovak (sk) translation - * Adds newline to the end of .desktop files - * initial. added ability to change panel height - * Set tooltip only when the tooltip is shown - * Czech translations (cs_CZ) - * Fix a few typos - * XdgDesktopFile is implicitly shared - * huge refactoring of the libraries build organization - * Initialize order fixed - * Init values in tray plugin - * Mem leak in mount plugin & lib - * showdesktop: a bettre fix - * fixed memleak for panel/showdesktop (X11 deallocation) - * handle actions and its parents correctly - * only for debug builds: enable "exit" action in the context menu (for valgrind checking) - * Fix russian translation - * Fix russian translation - * fixed crash in the quicklaunch on the new suse 12.1 - * Fix: segfaults when panel orientation is changed - * Fix: In Fedora 16 tray icons are invisible. - * quicklaunch: do not change button order when you drag'n'drop different mimetype - * quicklaunch: "title" action in the context menu too - * QuickLauncher: Programs do not run, fixed. - * QuickLauncher: Added: * Removing the buttons by dragging. * The menu items "move left" and "move right". - * forgotten files. Sorry. - * quicklaunch: editable icons - delete and move (ctrl+drag) - * Mount: Mount/unmount hide popup dialog - * Panel screensaver: Fix in RU translation. - * refresh desktop switch names on change too - * XfitMan: fix for XfitMan::getDesktopNames() - * XfitMan: fix for XfitMan::getDesktopNames() - * potential fix for "one desktop in openbox" panel crash - * RazorPanel: New icon theme handler for razor-panel plugins. - * RazorPanel: IconThemeChanged handler for razor-panel. - * New icon theme handler. - * iconThemeChanged handler for plugin-showdesktop - * iconThemeChanged handler for plugin-mount - * iconThemeChanged handler for plugin-quicklaunch - * iconThemeChanged handler for taskbar - * iconThemeChanged handler for mainmenu - * Razor-panel: iconThemeChanged & razorThemeChanged functions for plugins. - * Fix for wrong translations of the panel plugins. - * GPL->LGPL where I'm the author - * GPL->LGPL where I'm the author - * Issue #50 razor-mount: Filemanager can open dirs with whitespace in mount points. - * Plugins translations - * Translation for session - * Polish translation part X - * Fix: Desktop Menu Specification category must be X-RAZOR. - * Russian translations - * Russian translations. - * Fixes in polish translation - * Polish translation. Closes #46 - * Closes #43 - * first part of fix for #48 - * fix for "remove/add device" in virtualbox - * Mount plugin: Workaround about duplication of items. - * Mount plugin: Debug messages for "Except that newly inserted CD/DVD is shown twice in the menu widget (using virtualbox)" - * Mount plugin: If the dialog is visible, the button is depressed. - * Mount plugin: A popup window is hidden when the panel changes position. - * Mount plugin: Fix, on dual monitor configurations, popup window always showed on a first monitor. - * New popup window in mount plugin. - * potential fix (workaround) from #40: XdgMenu does not display environment related items - * udev configuration handling; minimal version requirements - * qt4.6 fix for application default icon name - * Translation for mount plugin - * Configure dialog for mount plugin - * In the menu use the ToolButton instead of diskIcon and diskLabel. This looks nicer. - * Fixed: Click on the mount button, doing nothing. - * Fixed: At first start the names already mounted devices are not visible. - * better icon for #39 The appearance of the mount plugin.; tooltip too - * fixed (workaround before real event notifications) #42 mount plugin: display notifications when connected - * Don't use bool typed member to check _NET_SHOWING_DESKTOP property, use Xlib API instead - * Add Ctrl+F(1|2|3|4...) to switch virtual desktops - * Shortcut for showing desktop, also restore windows on another hit - * issue #39 - fix the unmount icon/button drawing - * homepage updated + auto replacement script - * mounting: initial status (mounted/unmounted) when starting - * icons logic for removable media - * initial revision of "removable media" support. Still lots to do but it's functional - * Potential fix2 for issue #18: Panel clock plugin changes your size - * XDG-files are splitted into qtxdg library. - * new panel plugin: "show desktop" - * Polish translation - * Panel plugins can use translation now - * Panel plugins: clock, mainmenu and taskbar translate.h fix. - * fix for build (includes) - * Dialog name changed. Menu file path fix. - * MainMenu plugin configuration window. Closes #16 - * potential fix for issue #18: Panel clock plugin changes your size - * fix for #4 BadWindow when a window is closed - * removed unneeded call - * directories dupport for quicklaunch - * support for regular files in the quicklaunch - * initial support for drop events in the quicklaunch panel plugin - * Closes #1 - * RazorTaskButton: Don't accept the drag event - * Small RazorClockConfiguration fixes. RazorTaskbarConfiguration use RazorSettingsCache now. - * RazorClockConfiguration small fixes and improvements proposed by Alex. RazorClockConfiguration use RazorSettingsCache. Testing new HIG - Reset/Close. Signed-off-by: Maciej Płaza - * Task manager configuration window. Task button with only Icon isn't so big now. User can decide about task button max width. - * Removed accepChanges() declaration - * Clock configuration - * global key shortcut is a new library for razor; plugins updated - * RazorTaskButton with D'n'D support - * Animates the mouse movement to the position of the panel plugin that will be moved - * final port to new settings class; desktopbackgrounddialog improved with initial loading values - * Add: MainMenu tracks changes in the installed programs. - * The project uses RazorTheme. All except the desktop, switched to RazorSettings. - * Remuved garbage from help. - * initial support for screensaver/screen locking - * Added RazorTheme class. - * Fixed multithreaded building. Thanks Gustavo. - * Plugin config dialogs infrastructure. Instead, RazorPanelPlugin::preferredAlignment() introduced RazorPanelPlugin::flags method. - * New RazorSettings class. Now ReadSettings is deprecated. Use RazorSettings instead. - * Separate dir for XdgMenu. Fixed includes. - * Feature 3316330: Tasks from one desktop. Task Manager should have option to show tasks only from one (active) desktop. Now it shows all tasks. Without config GUI. - * Feature 3316331: Task Manager - only icon/text. Task Manager should have ability to show only name or icon (or both) of task. Without config GUI. - * Bug 3314795: The panel is not in the bottom of screen. - * Tracker 3314481: Elided text in the taskbar buttons - * Segfault in MainMenu if xdg-menu file not found. - * Copyright - * Copyright - * Fixed segfault in tray plugin. - * set default razor icon for all apps - * The settings are saved immediately after the change. - * lib_suffix location improved - * Logout dialog in main menu. - * Removed "Exit" item on panel menu. - * Fix: Missing cmake checks 2. - * Fix: Missing cmake checks. - * Fix: Segmetation fault on desktopswitch. - * Fix: Removed saveSettings method from plugins. - * Plugin-clock: added tooltip. - * From XdgIcon deleted parameter "size". - * move addplugindialog into shared lib for panel and desktop - * New /usr/share & ~/razor directory structure. - * Added: Add plugin dialog. - * initial horizontal panels - * Translations. - * In the thene you can specify the tray icon size. - * RazorPanel2 now is main panel. - * Legacy panel - * Mainmrnu plugin added - * battery icon names fixed - * fixed build cmake warnings - * XfitMan.setStrut allowed to reserve a place only from bottom. - * better XDG handling - * initial support for desktop files in quicklaunch - * Changed config param style to "param_style". Added well known menu files. - * fixed crash when there is only one desktop available - * forgotten refactored getClientList - * clocks are placed without additional unrequired space again - * clocks are correct in vertical panels too - * make quicklaunch vertically friendly, part II (final hopefully) - * make quicklaunch vertically friendly - * MainMenu plugin: Added log out menu - * Added XdgDesktopFile::icon method - * New version of main menu plugin - * allow to specify quicklaunch button size (like on netbooks) - * removed unused files - * - * better fix for tasks layout - * include fix; kdm/gdm/*dm session file; fix for taskbar resizing - * panel alignment works now (top/left, center, bottom/right) - * typos fixed in battery plugin; icon auto-size - * You can enable and disable plugins using cmake options. - * The new realization of librasorqt * XdgEnv * XdgDesktopFile * XdgMenu - * experimental: battery plugin for laptops - * better sizing in systray - * forgotten paths - * vertical panels work basically - * configuration reworked (may require to drop ~/.razor); plugins code split; new plugin: spacer - * panel plugins are modularized now; simplified plugin loading - * minor layouting changes - * patch from alex to load relative qss url - * fixed clock behavior for sizing. Using sizeHint now. - * panel plugins share API layout; don't freeze trying to load non-existing theme; experimantal value placeholders in QSS - * initial refactoring for common plugin handling. Work in progress. Done: * all plugins are using the same base class * all plugins can handle dynamic resizing (eg. systray can be smaller after embed app close, taskbar occupies all available space...) * all is fully scriptable with QSS - some layout glitches have to be fixed - * initial API for plugins. No other changes in functionality yet - * Made RazorHal mounting/unmounting work and added a new function to Xfitman for checking if a window wants attention _NET_WM_WINDOW_DEMANDS_ATTENTION - tried to get the buttons at the taskmanager to glow when this is true but it didnt work.. - * - * - * do not set layout too many times - * avoid huge moving of widgets after 1st clocks update - * src formatted with astyle -A1 - * settings refactored a bit: SHARE_DIR dependen on th CMAKE_INSTALL_PREFIX is defined for the compilation phase (it allows to have more razors installed eg. for development); SHARE_DIR is searched in the startup too; optimized cfg file access (1x vs. 4x as before for every file); redundant conversions merged into Razorsettings; usage of QSettings to read the settings (it does the error handling for us). - * - * - * implementation of the 'quicklaunch icons' (Razorspinbutton like widget); disabled some debug outputs; tooltips enabled for panel widgets - * - * fixed cmake stuff (debug,lib location,do not install .svn,make uninstall,etc.); fixes for qss skinning - * - * - * - * - * diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 732861d..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,277 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) -project(lxqt-panel) - -option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF) -option(PULL_TRANSLATIONS "Pull translations" ON) -option(WITH_SCREENSAVER_FALLBACK "Include support for converting the deprecated 'screensaver' plugin to 'quicklaunch'. This requires the lxqt-leave (lxqt-session) to be installed in runtime." ON) - -# additional cmake files -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -else() - message(FATAL "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. C++11 support is required") -endif() - -macro(setByDefault VAR_NAME VAR_VALUE) - if(NOT DEFINED ${VAR_NAME}) - set (${VAR_NAME} ${VAR_VALUE}) - endif(NOT DEFINED ${VAR_NAME}) -endmacro() - -# use gcc visibility feature to decrease unnecessary exported symbols -if (CMAKE_COMPILER_IS_GNUCXX) - # set visibility to hidden to hide symbols, unlesss they're exporeted manually in the code - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-no-undefined") -endif() - -######################################################################### - -add_definitions (-Wall) -include(GNUInstallDirs) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) - -find_package(Qt5Widgets REQUIRED) -find_package(Qt5DBus REQUIRED) -find_package(Qt5LinguistTools REQUIRED) -find_package(Qt5Xml REQUIRED) -find_package(Qt5X11Extras REQUIRED) -find_package(KF5WindowSystem REQUIRED) - -find_package(lxqt REQUIRED) -find_package(lxqt-globalkeys REQUIRED) -find_package(lxqt-globalkeys-ui REQUIRED) - -# Patch Version -set(LXQT_PANEL_PATCH_VERSION 0) - -set(LXQT_PANEL_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PANEL_PATCH_VERSION}) -add_definitions("-DLXQT_PANEL_VERSION=\"${LXQT_PANEL_VERSION}\"") - -include(LXQtTranslate) - -# Warning: This must be before add_subdirectory(panel). Move with caution. -set(PLUGIN_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/lxqt-panel") -add_definitions( - -DPLUGIN_DIR=\"${PLUGIN_DIR}\" - -DQT_USE_QSTRINGBUILDER -) -message(STATUS "Panel plugins location: ${PLUGIN_DIR}") - -######################################################################### - -# Plugin system -# You can enable/disable building of the plugin using cmake options. -# cmake -DCLOCK_PLUGIN=Yes .. # Enable clock plugin -# cmake -DCLOCK_PLUGIN=No .. # Disable clock plugin - -include("cmake/BuildPlugin.cmake") - -set(ENABLED_PLUGINS) # list of enabled plugins -set(STATIC_PLUGINS) # list of statically linked plugins - -setByDefault(CLOCK_PLUGIN Yes) -if(CLOCK_PLUGIN) - list(APPEND STATIC_PLUGINS "clock") - add_definitions(-DWITH_CLOCK_PLUGIN) - list(APPEND ENABLED_PLUGINS "Clock") - add_subdirectory(plugin-clock) -endif() - -setByDefault(COLORPICKER_PLUGIN Yes) -if(COLORPICKER_PLUGIN) - list(APPEND ENABLED_PLUGINS "Color Picker") - add_subdirectory(plugin-colorpicker) -endif() - -setByDefault(CPULOAD_PLUGIN Yes) -if(CPULOAD_PLUGIN) - find_library(STATGRAB_LIB statgrab) - - if(NOT STATGRAB_LIB) - message(FATAL_ERROR "CPU Load plugin requires libstatgrab") - endif() - list(APPEND ENABLED_PLUGINS "Cpu Load") - add_subdirectory(plugin-cpuload) -endif() - -setByDefault(DIRECTORYMENU_PLUGIN Yes) -if(DIRECTORYMENU_PLUGIN) - list(APPEND ENABLED_PLUGINS "Directory menu") - add_subdirectory(plugin-directorymenu) -endif() - -setByDefault(DOM_PLUGIN No) -if(DOM_PLUGIN) - list(APPEND ENABLED_PLUGINS "DOM") - add_subdirectory(plugin-dom) -endif(DOM_PLUGIN) - -setByDefault(DESKTOPSWITCH_PLUGIN Yes) -if(DESKTOPSWITCH_PLUGIN) - list(APPEND STATIC_PLUGINS "desktopswitch") - add_definitions(-DWITH_DESKTOPSWITCH_PLUGIN) - list(APPEND ENABLED_PLUGINS "Desktop Switcher") - add_subdirectory(plugin-desktopswitch) -endif() - -setByDefault(KBINDICATOR_PLUGIN Yes) -if(KBINDICATOR_PLUGIN) - list(APPEND ENABLED_PLUGINS "Keyboard Indicator") - add_subdirectory(plugin-kbindicator) -endif(KBINDICATOR_PLUGIN) - -setByDefault(MAINMENU_PLUGIN Yes) -if(MAINMENU_PLUGIN) - list(APPEND STATIC_PLUGINS "mainmenu") - add_definitions(-DWITH_MAINMENU_PLUGIN) - list(APPEND ENABLED_PLUGINS "Application menu") - add_subdirectory(plugin-mainmenu) -endif() - -setByDefault(MOUNT_PLUGIN Yes) -if(MOUNT_PLUGIN) - list(APPEND ENABLED_PLUGINS "Mount") - add_subdirectory(plugin-mount) -endif(MOUNT_PLUGIN) - -setByDefault(QUICKLAUNCH_PLUGIN Yes) -if(QUICKLAUNCH_PLUGIN) - list(APPEND STATIC_PLUGINS "quicklaunch") - add_definitions(-DWITH_QUICKLAUNCH_PLUGIN) - list(APPEND ENABLED_PLUGINS "Quicklaunch") - add_subdirectory(plugin-quicklaunch) -endif() - -setByDefault(SENSORS_PLUGIN Yes) -if(SENSORS_PLUGIN) - find_library(SENSORS_LIB sensors) - - if(NOT SENSORS_LIB) - message(FATAL_ERROR "Sensors plugin requires lm_sensors") - endif() - list(APPEND ENABLED_PLUGINS "Sensors") - add_subdirectory(plugin-sensors) -endif() - -setByDefault(SHOWDESKTOP_PLUGIN Yes) -if(SHOWDESKTOP_PLUGIN) - list(APPEND STATIC_PLUGINS "showdesktop") - add_definitions(-DWITH_SHOWDESKTOP_PLUGIN) - list(APPEND ENABLED_PLUGINS "Show Desktop") - add_subdirectory(plugin-showdesktop) -endif() - -setByDefault(NETWORKMONITOR_PLUGIN Yes) -if(NETWORKMONITOR_PLUGIN) - find_library(STATGRAB_LIB statgrab) - - if(NOT STATGRAB_LIB) - message(FATAL_ERROR "Network Monitor plugin requires libstatgrab") - endif() - list(APPEND ENABLED_PLUGINS "Network Monitor") - add_subdirectory(plugin-networkmonitor) -endif() - -setByDefault(SYSSTAT_PLUGIN Yes) -if(SYSSTAT_PLUGIN) - list(APPEND ENABLED_PLUGINS "System Stats") - add_subdirectory(plugin-sysstat) -endif(SYSSTAT_PLUGIN) - -setByDefault(TASKBAR_PLUGIN Yes) -if(TASKBAR_PLUGIN) - list(APPEND STATIC_PLUGINS "taskbar") - add_definitions(-DWITH_TASKBAR_PLUGIN) - list(APPEND ENABLED_PLUGINS "Taskbar") - add_subdirectory(plugin-taskbar) -endif() - -setByDefault(STATUSNOTIFIER_PLUGIN Yes) -if(STATUSNOTIFIER_PLUGIN) - list(APPEND STATIC_PLUGINS "statusnotifier") - add_definitions(-DWITH_STATUSNOTIFIER_PLUGIN) - list(APPEND ENABLED_PLUGINS "Status Notifier") - add_subdirectory(plugin-statusnotifier) -endif() - -setByDefault(TRAY_PLUGIN Yes) -if(TRAY_PLUGIN) - list(APPEND STATIC_PLUGINS "tray") - add_definitions(-DWITH_TRAY_PLUGIN) - list(APPEND ENABLED_PLUGINS "System Tray") - add_subdirectory(plugin-tray) -endif() - -setByDefault(VOLUME_PLUGIN Yes) -setByDefault(VOLUME_USE_PULSEAUDIO Yes) -setByDefault(VOLUME_USE_ALSA Yes) -if(VOLUME_PLUGIN) - if (VOLUME_USE_PULSEAUDIO) - find_package(PulseAudio) - if (NOT PULSEAUDIO_FOUND) - message(FATAL_ERROR "PulseAudio not found, but required (VOLUME_USE_PULSEAUDIO) for Volume plugin!") - endif () - endif(VOLUME_USE_PULSEAUDIO) - - if(VOLUME_USE_ALSA) - find_package(ALSA) - if (NOT ALSA_FOUND) - message(FATAL_ERROR "ALSA not found, but required (VOLUME_USE_ALSA) for Volume plugin!") - endif () - endif() - - list(APPEND ENABLED_PLUGINS "Volume") - message(STATUS "") - message(STATUS "Volume plugin will be built") - message(STATUS " ALSA: ${ALSA_FOUND}") - message(STATUS " PulseAudio: ${PULSEAUDIO_FOUND}") - message(STATUS "") - add_subdirectory(plugin-volume) -endif() - -setByDefault(WORLDCLOCK_PLUGIN Yes) -if(WORLDCLOCK_PLUGIN) - list(APPEND STATIC_PLUGINS "worldclock") - add_definitions(-DWITH_WORLDCLOCK_PLUGIN) - list(APPEND ENABLED_PLUGINS "World Clock") - add_subdirectory(plugin-worldclock) -endif(WORLDCLOCK_PLUGIN) - -setByDefault(SPACER_PLUGIN Yes) -if(SPACER_PLUGIN) - list(APPEND STATIC_PLUGINS "spacer") - add_definitions(-DWITH_SPACER_PLUGIN) - list(APPEND ENABLED_PLUGINS "Spacer") - add_subdirectory(plugin-spacer) -endif() - -######################################################################### - -message(STATUS "**************** The following plugins will be built ****************") -foreach (PLUGIN_STR ${ENABLED_PLUGINS}) - message(STATUS " ${PLUGIN_STR}") -endforeach() -message(STATUS "*********************************************************************") - -add_subdirectory(panel) - -# merged from lxqt-common -add_subdirectory(autostart) -add_subdirectory(menu) 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 9b2d156..0000000 --- a/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# lxqt-panel - -## Overview - -`lxqt-panel` represents the taskbar of LXQt. - -The elements available in lxqt-panel are called "plugin" technically. This applies e. g. to the source code where they reside in directories `./plugin-` like `plugin-mainmenu`. In contrast to this they are called "widgets" by the configuration GUI so far. Also, a more descriptive term is used to refer to distinct plugins within the GUI. E. g. the aforementioned `plugin-mainmenu` is called "Application menu" that way. -Configuration dialogue "Add Plugins", see [below](https://github.com/lxde/lxqt-panel#customizing), is listing all available plugins plus a short description and hence provides an overview of the available ones. -Notes on some of the plugins, sorted by terms used within the GUI in alphabetical order, technical term in parenthesis: - -#### Date & time (plugin-clock) / World clock (plugin-worldclock) - -Both provide clock and calendar functionality. plugin-worldclock can display various time zones in addition but lacks a tooltip displaying current date und time upon hovering. -These plugins will probably be merged into one, see https://github.com/lxde/lxqt/issues/312. - -#### Quick launch (plugin-quicklaunch) - -A plugin to launch applications from the panel. By default it is empty and displays a message "Drop application icons here". Applications need to be available in panel's main menu and can be included into plugin-quicklaunch by drag & drop. - -#### Status Notifier Plugin (plugin-statusnotifier) / System Tray (plugin-tray) - -Both provide a notification area within the panel, that is an area where arbitrary applications can place informational icons. This is frequently used e. g. by chat or mail clients to inform about incoming messages or tools configuring the network to inform about connections. (So it's some kind of counterpart to the desktop notifications displayed by [lxqt-notificationd](https://github.com/lxde/lxqt-notificationd)). -The difference between the two plugins is a technical one. **plugin-tray** is implementing the so-called [System Tray Protocol](https://www.freedesktop.org/wiki/Specifications/systemtray-spec). It's a specification that has been around for years but has some serious technical limitations and in particular won't work under Wayland. **plugin-statusnotifier** on the other hand is implementing the so-called [StatusNotifierItem (SNI)](https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem) specification which can be considered a successor of the System Tray Protocol. -Both plugins are maintained in parallel as not all relevant applications are compatible with SNI so far. In particular both Qt 4 and all GTK applications need some kind of wrapper to deal with it. Both plugins can be used in parallel without any issue, applications supporting both specifications will normally chose to display their icons in plugin-statusnotifier. - -#### Volume control (plugin-volume) - -As indicated by the name, a volume control. Technically Alsa, OSS and PulseAudio can be used as backend. The plugin itself is providing a control to adjust the main volume only but it allows for launching specific UIs of the backend in use like e. g. [pavucontrol-qt](https://github.com/lxde/pavucontrol-qt) to adjust PulseAudio. - -## Installation - -### Compiling source code - -The runtime dependencies are libxcomposite, libdbusmenu-qt5, KGuiAddons, KWindowSystem, Solid, menu-cache, lxmenu-data, [liblxqt](https://github.com/lxde/liblxqt) and [lxqt-globalkeys](https://github.com/lxde/lxqt-globalkeys). -Several plugins or features thereof are optional and need additional runtime dependencies. Namely these are (plugin / feature in parenthesis) Alsa library (Alsa support in plugin-volume), PulseAudio client library (PulseAudio support in plugin-volume), lm-sensors (plugin-sensors), libstatgrab (plugin-cpuload, plugin-networkmonitor), [libsysstat](https://github.com/lxde/libsysstat) (plugin-sysstat). All of them are enabled by default and have to be disabled by CMake variables as required, see below. -In addition CMake is a mandatory build dependency. Git is optionally needed 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, depending on the way library paths are dealt with on 64bit systems variables like CMAKE_INSTALL_LIBDIR may have to be set as well. -By default all available plugins and features thereof are built and CMake fails when dependencies aren't met. Building particular plugins can be disabled by boolean CMake variables `_PLUGIN` where the plugin is referred by its technical term like e. g. in `SYSSTAT_PLUGIN`. Alsa and PulseAudio support in plugin-volume can be disabled by boolean CMake variables `VOLUME_USE_ALSA` and `VOLUME_USE_PULSEAUDIO`. - -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-panel`. - -## Configuration, Usage - -### Launching - -The panel is run as a daemon-like [LXQt Module](https://github.com/lxde/lxqt-session#lxqt-modules) the launch of which can be adjusted in section "Basic Settings" of configuration dialogue [LXQt Session Settings](https://github.com/lxde/lxqt-session#lxqt-session-settings) of [lxqt-session](https://github.com/lxde/lxqt-session). - -### Customizing - -To customize the panel itself there's a context menu, that is a menu opened by right-clicking the pointer device. It is comprising sections "\" and "Panel" which allow for configuring the plugin the pointer is currently over and the panel as a whole respectively. - -In section "Panel" topics "Configure Panel" and "Manage Widgets" open different panes of a dialogue "Configure Panel" which allow for configuring the panel as a whole and the various plugins respectively. -Pane "Widgets" allows for configuring and removing all plugins currently included in lxqt-panel. The plus sign opens another dialogue "Add plugins" which is used to add plugins. It comes with a list of all plugins plus some short descriptions and can hence serve as overview what plugins are available. - -Sometimes right-clicking over particular plugins may bring up a context menu dealing with the respective plugin's functionality *only* which means the plugin in question cannot be configured the usual way. This affects e. g. plugin-quicklaunch as soon as items were added (the context menu is limited to topics dealing with the items included in plugin-quicklaunch). -Currently there are two ways to deal with this. Some themes like e. g. `Frost` come with handles at the plugins' left end providing the regular context menu. Also, it can be assumed at least one plugin is included in the panel that's always featuring the regular context menu like e. g. plugin-mainmenu. Either way pane "Widgets" of "Configure Panel" can be accessed and used to configure the particular plugin. diff --git a/autostart/CMakeLists.txt b/autostart/CMakeLists.txt deleted file mode 100644 index 1a436b8..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_panel_autostart_desktop_files ALL DEPENDS ${DESKTOP_FILES}) -#************************************************ - -install(FILES - ${DESKTOP_FILES} - DESTINATION "${LXQT_ETC_XDG_DIR}/autostart" - COMPONENT Runtime -) diff --git a/autostart/lxqt-panel.desktop.in b/autostart/lxqt-panel.desktop.in deleted file mode 100644 index 5d6489b..0000000 --- a/autostart/lxqt-panel.desktop.in +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Panel -TryExec=lxqt-panel -Exec=lxqt-panel -OnlyShowIn=LXQt; -X-LXQt-Module=true - -#TRANSLATIONS_DIR=translations diff --git a/autostart/translations/lxqt-panel_ar.desktop b/autostart/translations/lxqt-panel_ar.desktop deleted file mode 100644 index 1942242..0000000 --- a/autostart/translations/lxqt-panel_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ar]=اللوحة diff --git a/autostart/translations/lxqt-panel_cs.desktop b/autostart/translations/lxqt-panel_cs.desktop deleted file mode 100644 index 81370cd..0000000 --- a/autostart/translations/lxqt-panel_cs.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[cs]=Panel diff --git a/autostart/translations/lxqt-panel_cs_CZ.desktop b/autostart/translations/lxqt-panel_cs_CZ.desktop deleted file mode 100644 index a0c4f77..0000000 --- a/autostart/translations/lxqt-panel_cs_CZ.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[cs_CZ]=Panel diff --git a/autostart/translations/lxqt-panel_da.desktop b/autostart/translations/lxqt-panel_da.desktop deleted file mode 100644 index 6621367..0000000 --- a/autostart/translations/lxqt-panel_da.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[da]=Panel diff --git a/autostart/translations/lxqt-panel_de.desktop b/autostart/translations/lxqt-panel_de.desktop deleted file mode 100644 index 61bd964..0000000 --- a/autostart/translations/lxqt-panel_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[de]=Bedienfeld diff --git a/autostart/translations/lxqt-panel_el.desktop b/autostart/translations/lxqt-panel_el.desktop deleted file mode 100644 index 6314199..0000000 --- a/autostart/translations/lxqt-panel_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[el]=Πίνακας diff --git a/autostart/translations/lxqt-panel_eo.desktop b/autostart/translations/lxqt-panel_eo.desktop deleted file mode 100644 index 48dd77b..0000000 --- a/autostart/translations/lxqt-panel_eo.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[eo]=Panelo diff --git a/autostart/translations/lxqt-panel_es.desktop b/autostart/translations/lxqt-panel_es.desktop deleted file mode 100644 index 005996f..0000000 --- a/autostart/translations/lxqt-panel_es.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[es]=Panel diff --git a/autostart/translations/lxqt-panel_es_VE.desktop b/autostart/translations/lxqt-panel_es_VE.desktop deleted file mode 100644 index bcfb02a..0000000 --- a/autostart/translations/lxqt-panel_es_VE.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[es_VE]=Panel diff --git a/autostart/translations/lxqt-panel_eu.desktop b/autostart/translations/lxqt-panel_eu.desktop deleted file mode 100644 index 2727809..0000000 --- a/autostart/translations/lxqt-panel_eu.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[eu]=Panela diff --git a/autostart/translations/lxqt-panel_fi.desktop b/autostart/translations/lxqt-panel_fi.desktop deleted file mode 100644 index 4969141..0000000 --- a/autostart/translations/lxqt-panel_fi.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[fi]=Paneeli diff --git a/autostart/translations/lxqt-panel_fr.desktop b/autostart/translations/lxqt-panel_fr.desktop deleted file mode 100644 index f01e11b..0000000 --- a/autostart/translations/lxqt-panel_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[fr]=Tableau de bord diff --git a/autostart/translations/lxqt-panel_hu.desktop b/autostart/translations/lxqt-panel_hu.desktop deleted file mode 100644 index 85d818a..0000000 --- a/autostart/translations/lxqt-panel_hu.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[hu]=Panel diff --git a/autostart/translations/lxqt-panel_hu_HU.desktop b/autostart/translations/lxqt-panel_hu_HU.desktop deleted file mode 100644 index 88c74c0..0000000 --- a/autostart/translations/lxqt-panel_hu_HU.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[hu_HU]=Panel diff --git a/autostart/translations/lxqt-panel_ia.desktop b/autostart/translations/lxqt-panel_ia.desktop deleted file mode 100644 index c4feed9..0000000 --- a/autostart/translations/lxqt-panel_ia.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ia]=Panello diff --git a/autostart/translations/lxqt-panel_it_IT.desktop b/autostart/translations/lxqt-panel_it_IT.desktop deleted file mode 100644 index a3517ea..0000000 --- a/autostart/translations/lxqt-panel_it_IT.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[it_IT]=Pannello diff --git a/autostart/translations/lxqt-panel_ja.desktop b/autostart/translations/lxqt-panel_ja.desktop deleted file mode 100644 index 0a526a8..0000000 --- a/autostart/translations/lxqt-panel_ja.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ja]=パネル diff --git a/autostart/translations/lxqt-panel_lt.desktop b/autostart/translations/lxqt-panel_lt.desktop deleted file mode 100644 index d92fe64..0000000 --- a/autostart/translations/lxqt-panel_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[lt]=Skydelis diff --git a/autostart/translations/lxqt-panel_nl.desktop b/autostart/translations/lxqt-panel_nl.desktop deleted file mode 100644 index 697ba61..0000000 --- a/autostart/translations/lxqt-panel_nl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[nl]=Paneel diff --git a/autostart/translations/lxqt-panel_pl.desktop b/autostart/translations/lxqt-panel_pl.desktop deleted file mode 100644 index 4947596..0000000 --- a/autostart/translations/lxqt-panel_pl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[pl]=Panel diff --git a/autostart/translations/lxqt-panel_pt.desktop b/autostart/translations/lxqt-panel_pt.desktop deleted file mode 100644 index 957e373..0000000 --- a/autostart/translations/lxqt-panel_pt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[pt]=Painel diff --git a/autostart/translations/lxqt-panel_pt_BR.desktop b/autostart/translations/lxqt-panel_pt_BR.desktop deleted file mode 100644 index 07927e9..0000000 --- a/autostart/translations/lxqt-panel_pt_BR.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[pt_BR]=Painel diff --git a/autostart/translations/lxqt-panel_ro_RO.desktop b/autostart/translations/lxqt-panel_ro_RO.desktop deleted file mode 100644 index a78ac35..0000000 --- a/autostart/translations/lxqt-panel_ro_RO.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ro_RO]=Panou diff --git a/autostart/translations/lxqt-panel_ru.desktop b/autostart/translations/lxqt-panel_ru.desktop deleted file mode 100644 index be9e12e..0000000 --- a/autostart/translations/lxqt-panel_ru.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ru]=панель diff --git a/autostart/translations/lxqt-panel_ru_RU.desktop b/autostart/translations/lxqt-panel_ru_RU.desktop deleted file mode 100644 index 16f05b6..0000000 --- a/autostart/translations/lxqt-panel_ru_RU.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ru_RU]=Панель diff --git a/autostart/translations/lxqt-panel_sl.desktop b/autostart/translations/lxqt-panel_sl.desktop deleted file mode 100644 index 75e5358..0000000 --- a/autostart/translations/lxqt-panel_sl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[sl]=Pult diff --git a/autostart/translations/lxqt-panel_th_TH.desktop b/autostart/translations/lxqt-panel_th_TH.desktop deleted file mode 100644 index b12a42b..0000000 --- a/autostart/translations/lxqt-panel_th_TH.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[th_TH]=พาเนล diff --git a/autostart/translations/lxqt-panel_tr.desktop b/autostart/translations/lxqt-panel_tr.desktop deleted file mode 100644 index 7cb9ff1..0000000 --- a/autostart/translations/lxqt-panel_tr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[tr]=Panel diff --git a/autostart/translations/lxqt-panel_uk.desktop b/autostart/translations/lxqt-panel_uk.desktop deleted file mode 100644 index f1a03b0..0000000 --- a/autostart/translations/lxqt-panel_uk.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[uk]=Панель diff --git a/autostart/translations/lxqt-panel_zh_CN.desktop b/autostart/translations/lxqt-panel_zh_CN.desktop deleted file mode 100644 index bbbca23..0000000 --- a/autostart/translations/lxqt-panel_zh_CN.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[zh_CN]=面板 diff --git a/autostart/translations/lxqt-panel_zh_TW.desktop b/autostart/translations/lxqt-panel_zh_TW.desktop deleted file mode 100644 index 3f12f59..0000000 --- a/autostart/translations/lxqt-panel_zh_TW.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[zh_TW]=面板 diff --git a/cmake/BuildPlugin.cmake b/cmake/BuildPlugin.cmake deleted file mode 100644 index b09bbec..0000000 --- a/cmake/BuildPlugin.cmake +++ /dev/null @@ -1,69 +0,0 @@ -MACRO (BUILD_LXQT_PLUGIN NAME) - set(PROGRAM "lxqt-panel") - project(${PROGRAM}_${NAME}) - - set(PROG_SHARE_DIR ${CMAKE_INSTALL_FULL_DATAROOTDIR}/lxqt/${PROGRAM}) - set(PLUGIN_SHARE_DIR ${PROG_SHARE_DIR}/${NAME}) - - # Translations ********************************** - lxqt_translate_ts(${PROJECT_NAME}_QM_FILES - UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS} - SOURCES - ${HEADERS} - ${SOURCES} - ${MOCS} - ${UIS} - TEMPLATE - ${NAME} - INSTALL_DIR - ${LXQT_TRANSLATIONS_DIR}/${PROGRAM}/${NAME} - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "${PROGRAM}/plugin-${NAME}" - ) - - #lxqt_translate_to(QM_FILES ${CMAKE_INSTALL_FULL_DATAROOTDIR}/lxqt/${PROGRAM}/${PROJECT_NAME}) - file (GLOB ${PROJECT_NAME}_DESKTOP_FILES_IN resources/*.desktop.in) - lxqt_translate_desktop(DESKTOP_FILES - SOURCES - ${${PROJECT_NAME}_DESKTOP_FILES_IN} - ) - - lxqt_plugin_translation_loader(QM_LOADER ${NAME} "lxqt-panel") - #************************************************ - - file (GLOB CONFIG_FILES resources/*.conf) - - if (NOT DEFINED PLUGIN_DIR) - set (PLUGIN_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROGRAM}) - endif (NOT DEFINED PLUGIN_DIR) - - set(QTX_LIBRARIES Qt5::Widgets) - if(QT_USE_QTXML) - set(QTX_LIBRARIES ${QTX_LIBRARIES} Qt5::Xml) - endif() - if(QT_USE_QTDBUS) - set(QTX_LIBRARIES ${QTX_LIBRARIES} Qt5::DBus) - endif() - - list(FIND STATIC_PLUGINS ${NAME} IS_STATIC) - set(SRC ${HEADERS} ${SOURCES} ${QM_LOADER} ${MOC_SOURCES} ${${PROJECT_NAME}_QM_FILES} ${RESOURCES} ${UIS} ${DESKTOP_FILES}) - if (${IS_STATIC} EQUAL -1) # not static - add_library(${NAME} MODULE ${SRC}) # build dynamically loadable modules - install(TARGETS ${NAME} DESTINATION ${PLUGIN_DIR}) # install the *.so file - else() # static - add_library(${NAME} STATIC ${SRC}) # build statically linked lib - endif() - target_link_libraries(${NAME} ${QTX_LIBRARIES} lxqt ${LIBRARIES} KF5::WindowSystem) - - install(FILES ${CONFIG_FILES} DESTINATION ${PLUGIN_SHARE_DIR}) - install(FILES ${DESKTOP_FILES} DESTINATION ${PROG_SHARE_DIR}) - -ENDMACRO(BUILD_LXQT_PLUGIN) diff --git a/menu/CMakeLists.txt b/menu/CMakeLists.txt deleted file mode 100644 index 5fccba5..0000000 --- a/menu/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -file(GLOB DIRECTORY_FILES_IN desktop-directories/*.directory.in) - -# Translations ********************************** -lxqt_translate_desktop(DIRECTORY_FILES - SOURCES - ${DIRECTORY_FILES_IN} -) -add_custom_target(desktop_directories_files ALL DEPENDS ${DIRECTORY_FILES}) -#************************************************ - -install(FILES - ${DIRECTORY_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/desktop-directories" - COMPONENT Runtime -) - -install(FILES - lxqt-applications.menu - DESTINATION "${LXQT_ETC_XDG_DIR}/menus" - COMPONENT Runtime -) diff --git a/menu/desktop-directories/lxqt-leave.directory.in b/menu/desktop-directories/lxqt-leave.directory.in deleted file mode 100644 index ef2e5fb..0000000 --- a/menu/desktop-directories/lxqt-leave.directory.in +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Name=Leave -Comment=Leave Session -Icon=system-shutdown -Type=Directory - -#TRANSLATIONS_DIR=../translations diff --git a/menu/desktop-directories/lxqt-settings.directory.in b/menu/desktop-directories/lxqt-settings.directory.in deleted file mode 100644 index 32eab4f..0000000 --- a/menu/desktop-directories/lxqt-settings.directory.in +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Directory -Name=LXQt settings -Icon=preferences-system - -#TRANSLATIONS_DIR=translations - -# Translations diff --git a/menu/lxqt-applications.menu b/menu/lxqt-applications.menu deleted file mode 100644 index 2cd802d..0000000 --- a/menu/lxqt-applications.menu +++ /dev/null @@ -1,237 +0,0 @@ - - - - - Applications - lxde-menu-applications.directory - - - - - - - - - - - Accessories - lxde-utility.directory - - - Utility - - Accessibility - System - - - - - - - Universal Access - lxde-utility-accessibility.directory - - - Accessibility - Settings - - - - - - - Development - lxde-development.directory - - - Development - - emacs.desktop - - - - - - Education - lxde-education.directory - - - Education - - - - - - - Games - lxde-game.directory - - - Game - - - - - - - Graphics - lxde-graphics.directory - - - Graphics - Utility - - - - - - - Internet - lxde-network.directory - - - Network - - - - - - - LXQt-About - - lxqt-about.desktop - - - - - - Multimedia - lxde-audio-video.directory - - - AudioVideo - - - - - - - Office - lxde-office.directory - - - Office - - - - - - - System - lxde-system-tools.directory - - - System - Settings - PackageManager - X-Leave - Screensaver - lxqt-about.desktop - - - - - - - Other - lxde-other.directory - - - - Core - Settings - Screensaver - - - - - - - DesktopSettings - lxde-settings.directory - - LXQtSettings - lxqt-settings.directory - - - LXQt - - Settings - PackageManager - - - - obconf-qt.desktop - compton-conf.desktop - pcmanfm-qt-desktop-pref.desktop - - - lxqt-config.desktop - - - - - - - - - Settings - PackageManager - - - - - lxqt-config.desktop - - - - - - - - - - - X-Leave - lxqt-leave.directory - - - X-Leave - - - - - - - Screensaver - - lxqt-lockscreen.desktop - - - - - - - - DesktopSettings - LXQt-About - - X-Leave - Screensaver - - - diff --git a/menu/translations/lxqt-leave_de.directory b/menu/translations/lxqt-leave_de.directory deleted file mode 100644 index 5593674..0000000 --- a/menu/translations/lxqt-leave_de.directory +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=Leave -Comment=Leave Session -Icon=system-shutdown -Type=Directory - -Comment[de]=Sitzung verlassen -Name[de]=Verlassen diff --git a/menu/translations/lxqt-leave_el.directory b/menu/translations/lxqt-leave_el.directory deleted file mode 100644 index 9c0068c..0000000 --- a/menu/translations/lxqt-leave_el.directory +++ /dev/null @@ -1 +0,0 @@ -Name[el]=Έξοδος diff --git a/menu/translations/lxqt-leave_fr.directory b/menu/translations/lxqt-leave_fr.directory deleted file mode 100644 index 79b4dbe..0000000 --- a/menu/translations/lxqt-leave_fr.directory +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Name[fr]=Quitter -Comment[fr]=Quitter la session diff --git a/menu/translations/lxqt-leave_hu.directory b/menu/translations/lxqt-leave_hu.directory deleted file mode 100644 index 9e41bd8..0000000 --- a/menu/translations/lxqt-leave_hu.directory +++ /dev/null @@ -1,2 +0,0 @@ -Comment[hu]=LXQt elhagyása -Name[hu]=Kilépés diff --git a/menu/translations/lxqt-leave_it.directory b/menu/translations/lxqt-leave_it.directory deleted file mode 100644 index da74fd5..0000000 --- a/menu/translations/lxqt-leave_it.directory +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Esci -Comment[it]=Chiudere la sessione diff --git a/menu/translations/lxqt-leave_lt.directory b/menu/translations/lxqt-leave_lt.directory deleted file mode 100644 index 302ba9e..0000000 --- a/menu/translations/lxqt-leave_lt.directory +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=Leave -Comment=Leave Session -Icon=system-shutdown -Type=Directory - -Comment[lt]=Užbaigti seansą -Name[lt]=Išeiti diff --git a/menu/translations/lxqt-leave_pl.directory b/menu/translations/lxqt-leave_pl.directory deleted file mode 100644 index 360a81c..0000000 --- a/menu/translations/lxqt-leave_pl.directory +++ /dev/null @@ -1,2 +0,0 @@ -Name[pl]=Opuść -Comment[pl]=Zakończ sesję diff --git a/menu/translations/lxqt-leave_pt.directory b/menu/translations/lxqt-leave_pt.directory deleted file mode 100644 index aa7ed4a..0000000 --- a/menu/translations/lxqt-leave_pt.directory +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Name[pt]=Sair -Comment[pt]=Sair da sessão diff --git a/menu/translations/lxqt-leave_ru.directory b/menu/translations/lxqt-leave_ru.directory deleted file mode 100644 index 928988f..0000000 --- a/menu/translations/lxqt-leave_ru.directory +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Name=Leave -Comment=Leave Session -Icon=system-shutdown -Type=Directory - -Comment[ru]=Завершить сеанс -Name[ru]=Выйти - -Comment[ru_RU]=Завершить сеанс -Name[ru_RU]=Выйти diff --git a/menu/translations/lxqt-settings_de.directory b/menu/translations/lxqt-settings_de.directory deleted file mode 100644 index 9c203c7..0000000 --- a/menu/translations/lxqt-settings_de.directory +++ /dev/null @@ -1 +0,0 @@ -Name[de]=LXQt-Systemeinstellungen diff --git a/menu/translations/lxqt-settings_el.directory b/menu/translations/lxqt-settings_el.directory deleted file mode 100644 index 41f96db..0000000 --- a/menu/translations/lxqt-settings_el.directory +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Ρυθμίσεις LXQt - diff --git a/menu/translations/lxqt-settings_fr.directory b/menu/translations/lxqt-settings_fr.directory deleted file mode 100644 index 7f4607f..0000000 --- a/menu/translations/lxqt-settings_fr.directory +++ /dev/null @@ -1 +0,0 @@ -Name[fr]=LXQt-Paramétrage du système diff --git a/menu/translations/lxqt-settings_hu.directory b/menu/translations/lxqt-settings_hu.directory deleted file mode 100644 index 82b2b1d..0000000 --- a/menu/translations/lxqt-settings_hu.directory +++ /dev/null @@ -1 +0,0 @@ -Name[hu]=LXQt beállítása diff --git a/menu/translations/lxqt-settings_it.directory b/menu/translations/lxqt-settings_it.directory deleted file mode 100644 index 158bfaf..0000000 --- a/menu/translations/lxqt-settings_it.directory +++ /dev/null @@ -1 +0,0 @@ -Name[it]=Impostazioni di LXQt diff --git a/menu/translations/lxqt-settings_lt.directory b/menu/translations/lxqt-settings_lt.directory deleted file mode 100644 index 2d44ee4..0000000 --- a/menu/translations/lxqt-settings_lt.directory +++ /dev/null @@ -1 +0,0 @@ -Name[lt]=LXQt nustatymai diff --git a/menu/translations/lxqt-settings_pl.directory b/menu/translations/lxqt-settings_pl.directory deleted file mode 100644 index 5fb57ee..0000000 --- a/menu/translations/lxqt-settings_pl.directory +++ /dev/null @@ -1 +0,0 @@ -Name[pl]=Ustawienia LXQt diff --git a/menu/translations/lxqt-settings_pt.directory b/menu/translations/lxqt-settings_pt.directory deleted file mode 100644 index 38676ce..0000000 --- a/menu/translations/lxqt-settings_pt.directory +++ /dev/null @@ -1,2 +0,0 @@ -[Desktop Entry] -Name=Definições do LXQt diff --git a/menu/translations/lxqt-settings_ru.directory b/menu/translations/lxqt-settings_ru.directory deleted file mode 100644 index a090a0a..0000000 --- a/menu/translations/lxqt-settings_ru.directory +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Directory -Name=LXQt settings -Icon=preferences-system - -#TRANSLATIONS_DIR=translations - -# Translations - -Name[ru]=Настройки LXQt - -Name[ru_RU]=Настройки LXQt \ No newline at end of file diff --git a/panel/CMakeLists.txt b/panel/CMakeLists.txt deleted file mode 100644 index 5a322a3..0000000 --- a/panel/CMakeLists.txt +++ /dev/null @@ -1,123 +0,0 @@ -set(PROJECT lxqt-panel) - -set(PRIV_HEADERS - panelpluginsmodel.h - windownotifier.h - lxqtpanel.h - lxqtpanelapplication.h - lxqtpanelapplication_p.h - lxqtpanellayout.h - plugin.h - pluginsettings_p.h - lxqtpanellimits.h - popupmenu.h - pluginmoveprocessor.h - lxqtpanelpluginconfigdialog.h - config/configpaneldialog.h - config/configpanelwidget.h - config/configpluginswidget.h - config/addplugindialog.h -) - -# using LXQt namespace in the public headers. -set(PUB_HEADERS - lxqtpanelglobals.h - pluginsettings.h - ilxqtpanelplugin.h - ilxqtpanel.h -) - -set(SOURCES - main.cpp - panelpluginsmodel.cpp - windownotifier.cpp - lxqtpanel.cpp - lxqtpanelapplication.cpp - lxqtpanellayout.cpp - plugin.cpp - pluginsettings.cpp - popupmenu.cpp - pluginmoveprocessor.cpp - lxqtpanelpluginconfigdialog.cpp - config/configpaneldialog.cpp - config/configpanelwidget.cpp - config/configpluginswidget.cpp - config/addplugindialog.cpp -) - -set(UI - config/configpanelwidget.ui - config/configpluginswidget.ui - config/addplugindialog.ui -) - -set(LIBRARIES - lxqt -) - -file(GLOB CONFIG_FILES resources/*.conf) - -############################################ - -add_definitions(-DCOMPILE_LXQT_PANEL) - -set(PLUGIN_DESKTOPS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/lxqt/${PROJECT}") -add_definitions(-DPLUGIN_DESKTOPS_DIR=\"${PLUGIN_DESKTOPS_DIR}\") - -if (WITH_SCREENSAVER_FALLBACK) - message(STATUS "Building with conversion of deprecated 'screensaver' plugin") - add_definitions(-DWITH_SCREENSAVER_FALLBACK "-DLXQT_LOCK_DESKTOP=\"${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications/lxqt-lockscreen.desktop\"") -endif () - -project(${PROJECT}) - -set(QTX_LIBRARIES Qt5::Widgets Qt5::Xml Qt5::DBus) - -# Translations -lxqt_translate_ts(QM_FILES SOURCES - UPDATE_TRANSLATIONS - ${UPDATE_TRANSLATIONS} - SOURCES - ${PUB_HEADERS} - ${PRIV_HEADERS} - ${SOURCES} - ${UI} - 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 - "${PROJECT_NAME}/panel" -) - -lxqt_app_translation_loader(SOURCES ${PROJECT_NAME}) - -add_executable(${PROJECT} - ${PUB_HEADERS} - ${PRIV_HEADERS} - ${QM_FILES} - ${SOURCES} - ${UI} -) - -target_link_libraries(${PROJECT} - ${LIBRARIES} - ${QTX_LIBRARIES} - KF5::WindowSystem - ${STATIC_PLUGINS} -) - -install(TARGETS ${PROJECT} RUNTIME DESTINATION bin) -install(FILES ${CONFIG_FILES} DESTINATION ${LXQT_ETC_XDG_DIR}/lxqt) -install(FILES ${PUB_HEADERS} DESTINATION include/lxqt) -install(FILES - man/lxqt-panel.1 - DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" - COMPONENT Runtime -) diff --git a/panel/config/addplugindialog.cpp b/panel/config/addplugindialog.cpp deleted file mode 100644 index b282338..0000000 --- a/panel/config/addplugindialog.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "ui_addplugindialog.h" -#include "addplugindialog.h" -#include "plugin.h" -#include "../lxqtpanelapplication.h" - -#include -#include -#include - -#include -#include -#include -#include - -#define SEARCH_ROLE Qt::UserRole -#define INDEX_ROLE SEARCH_ROLE+1 - -AddPluginDialog::AddPluginDialog(QWidget *parent): - QDialog(parent), - ui(new Ui::AddPluginDialog) -{ - ui->setupUi(this); - - QStringList desktopFilesDirs; - desktopFilesDirs << QString(getenv("LXQT_PANEL_PLUGINS_DIR")).split(':', QString::SkipEmptyParts); - desktopFilesDirs << QString("%1/%2").arg(XdgDirs::dataHome(), "/lxqt/lxqt-panel"); - desktopFilesDirs << PLUGIN_DESKTOPS_DIR; - - mPlugins = LXQt::PluginInfo::search(desktopFilesDirs, QLatin1String("LXQtPanel/Plugin"), QLatin1String("*")); - std::sort(mPlugins.begin(), mPlugins.end(), [](const LXQt::PluginInfo &p1, const LXQt::PluginInfo &p2) { - return p1.name() < p2.name() || (p1.name() == p2.name() && p1.comment() < p2.comment()); - }); - - ui->pluginList->setItemDelegate(new LXQt::HtmlDelegate(QSize(32, 32), ui->pluginList)); - ui->pluginList->setContextMenuPolicy(Qt::CustomContextMenu); - - filter(); - - // search - mSearchTimer.setInterval(300); - mSearchTimer.setSingleShot(true); - connect(ui->searchEdit, &QLineEdit::textEdited, - &mSearchTimer, static_cast(&QTimer::start)); - connect(&mSearchTimer, &QTimer::timeout, this, &AddPluginDialog::filter); - connect(ui->pluginList, &QListWidget::doubleClicked, this, &AddPluginDialog::emitPluginSelected); - connect(ui->addButton, &QPushButton::clicked, this, &AddPluginDialog::emitPluginSelected); - - connect(dynamic_cast(qApp), &LXQtPanelApplication::pluginAdded - , this, &AddPluginDialog::filter); - connect(dynamic_cast(qApp), &LXQtPanelApplication::pluginRemoved - , this, &AddPluginDialog::filter); -} - -AddPluginDialog::~AddPluginDialog() -{ - delete ui; -} - -void AddPluginDialog::filter() -{ - QListWidget* pluginList = ui->pluginList; - - const int curr_item = 0 < pluginList->count() ? pluginList->currentRow() : 0; - pluginList->clear(); - - static QIcon fallIco = XdgIcon::fromTheme("preferences-plugin"); - - int pluginCount = mPlugins.length(); - for (int i = 0; i < pluginCount; ++i) - { - const LXQt::PluginInfo &plugin = mPlugins.at(i); - - QString s = QString("%1 %2 %3 %4 %5").arg(plugin.name(), - plugin.comment(), - plugin.value("Name").toString(), - plugin.value("Comment").toString(), - plugin.id()); - if (!s.contains(ui->searchEdit->text(), Qt::CaseInsensitive)) - continue; - - QListWidgetItem* item = new QListWidgetItem(ui->pluginList); - // disable single-instances plugins already in use - if (dynamic_cast(qApp)->isPluginSingletonAndRunnig(plugin.id())) - { - item->setFlags(item->flags() & ~Qt::ItemIsEnabled); - item->setBackground(palette().brush(QPalette::Disabled, QPalette::Text)); - item->setText(QString("%1 (%2)
%3
%4") - .arg(plugin.name(), plugin.id(), plugin.comment(), tr("(only one instance can run at a time)"))); - } else - item->setText(QString("%1 (%2)
%3").arg(plugin.name(), plugin.id(), plugin.comment())); - item->setIcon(plugin.icon(fallIco)); - item->setData(INDEX_ROLE, i); - } - - if (pluginCount > 0) - ui->pluginList->setCurrentRow(curr_item < pluginCount ? curr_item : pluginCount - 1); -} - -void AddPluginDialog::emitPluginSelected() -{ - QListWidget* pluginList = ui->pluginList; - if (pluginList->currentItem() && pluginList->currentItem()->isSelected()) - { - LXQt::PluginInfo plugin = mPlugins.at(pluginList->currentItem()->data(INDEX_ROLE).toInt()); - emit pluginSelected(plugin); - } -} - diff --git a/panel/config/addplugindialog.h b/panel/config/addplugindialog.h deleted file mode 100644 index 7c1b2bb..0000000 --- a/panel/config/addplugindialog.h +++ /dev/null @@ -1,63 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQT_ADDPLUGINDIALOG_H -#define LXQT_ADDPLUGINDIALOG_H - -#include -#include -#include - -#define SEARCH_DELAY 125 - -namespace Ui { - class AddPluginDialog; -} - -class AddPluginDialog : public QDialog -{ - Q_OBJECT - -public: - AddPluginDialog(QWidget *parent = 0); - ~AddPluginDialog(); - -signals: - void pluginSelected(const LXQt::PluginInfo &plugin); - -private: - Ui::AddPluginDialog *ui; - LXQt::PluginInfoList mPlugins; - QTimer mSearchTimer; - -private slots: - void filter(); - void emitPluginSelected(); -}; - -#endif // LXQT_ADDPLUGINDIALOG_H diff --git a/panel/config/addplugindialog.ui b/panel/config/addplugindialog.ui deleted file mode 100644 index 57ab441..0000000 --- a/panel/config/addplugindialog.ui +++ /dev/null @@ -1,144 +0,0 @@ - - - AddPluginDialog - - - - 0 - 0 - 400 - 359 - - - - Add Plugins - - - - - - - - Search: - - - - - - - - - - - - QAbstractScrollArea::AdjustToContents - - - true - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - QAbstractItemView::ScrollPerPixel - - - QListView::Static - - - QListView::TopToBottom - - - QListView::Adjust - - - 0 - - - 0 - - - false - - - true - - - -1 - - - false - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Add Widget - - - - - - - Close - - - false - - - true - - - - - - - - - pluginList - addButton - closeButton - searchEdit - - - - - closeButton - clicked() - AddPluginDialog - close() - - - 380 - 279 - - - 118 - 270 - - - - - diff --git a/panel/config/configpaneldialog.cpp b/panel/config/configpaneldialog.cpp deleted file mode 100644 index 089ce72..0000000 --- a/panel/config/configpaneldialog.cpp +++ /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: 2010-2011 Razor team - * Authors: - * Marat "Morion" Talipov - * - * 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 "configpaneldialog.h" - -ConfigPanelDialog::ConfigPanelDialog(LXQtPanel *panel, QWidget *parent): - LXQt::ConfigDialog(tr("Configure Panel"), panel->settings(), parent), - mPanelPage(nullptr), - mPluginsPage(nullptr) -{ - setAttribute(Qt::WA_DeleteOnClose); - - mPanelPage = new ConfigPanelWidget(panel, this); - addPage(mPanelPage, tr("Panel"), QLatin1String("configure")); - connect(this, &ConfigPanelDialog::reset, mPanelPage, &ConfigPanelWidget::reset); - - mPluginsPage = new ConfigPluginsWidget(panel, this); - addPage(mPluginsPage, tr("Widgets"), QLatin1String("preferences-plugin")); - connect(this, &ConfigPanelDialog::reset, mPluginsPage, &ConfigPluginsWidget::reset); - - connect(this, &ConfigPanelDialog::accepted, [panel] { - panel->saveSettings(); - }); -} - -void ConfigPanelDialog::showConfigPanelPage() -{ - showPage(mPanelPage); -} - -void ConfigPanelDialog::showConfigPluginsPage() -{ - showPage(mPluginsPage); -} diff --git a/panel/config/configpaneldialog.h b/panel/config/configpaneldialog.h deleted file mode 100644 index 579a39d..0000000 --- a/panel/config/configpaneldialog.h +++ /dev/null @@ -1,52 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Marat "Morion" Talipov - * - * 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 CONFIGPANELDIALOG_H -#define CONFIGPANELDIALOG_H - -#include "configpanelwidget.h" -#include "configpluginswidget.h" -#include "../lxqtpanel.h" - -#include - -class ConfigPanelDialog : public LXQt::ConfigDialog -{ - Q_OBJECT - -public: - ConfigPanelDialog(LXQtPanel *panel, QWidget *parent = 0); - - void showConfigPanelPage(); - void showConfigPluginsPage(); - -private: - ConfigPanelWidget *mPanelPage; - ConfigPluginsWidget *mPluginsPage; -}; - -#endif // CONFIGPANELDIALOG_H diff --git a/panel/config/configpanelwidget.cpp b/panel/config/configpanelwidget.cpp deleted file mode 100644 index 84da448..0000000 --- a/panel/config/configpanelwidget.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Marat "Morion" Talipov - * - * 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 "configpanelwidget.h" -#include "ui_configpanelwidget.h" - -#include "../lxqtpanellimits.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LXQt; - -struct ScreenPosition -{ - int screen; - ILXQtPanel::Position position; -}; -Q_DECLARE_METATYPE(ScreenPosition) - -ConfigPanelWidget::ConfigPanelWidget(LXQtPanel *panel, QWidget *parent) : - QWidget(parent), - ui(new Ui::ConfigPanelWidget), - mPanel(panel) -{ - ui->setupUi(this); - - fillComboBox_position(); - fillComboBox_alignment(); - - mOldPanelSize = mPanel->panelSize(); - mOldIconSize = mPanel->iconSize(); - mOldLineCount = mPanel->lineCount(); - - mOldLength = mPanel->length(); - mOldLengthInPercents = mPanel->lengthInPercents(); - - mOldAlignment = mPanel->alignment(); - - mOldScreenNum = mPanel->screenNum(); - mScreenNum = mOldScreenNum; - - mOldPosition = mPanel->position(); - mPosition = mOldPosition; - - mOldHidable = mPanel->hidable(); - - mOldAnimation = mPanel->animationTime(); - mOldShowDelay = mPanel->showDelay(); - - ui->spinBox_panelSize->setMinimum(PANEL_MINIMUM_SIZE); - ui->spinBox_panelSize->setMaximum(PANEL_MAXIMUM_SIZE); - - mOldFontColor = mPanel->fontColor(); - mFontColor = mOldFontColor; - mOldBackgroundColor = mPanel->backgroundColor(); - mBackgroundColor = mOldBackgroundColor; - mOldBackgroundImage = mPanel->backgroundImage(); - mOldOpacity = mPanel->opacity(); - mOldReserveSpace = mPanel->reserveSpace(); - - // reset configurations from file - reset(); - - connect(ui->spinBox_panelSize, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); - connect(ui->spinBox_iconSize, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); - connect(ui->spinBox_lineCount, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); - - connect(ui->spinBox_length, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); - connect(ui->comboBox_lenghtType, SIGNAL(activated(int)), this, SLOT(widthTypeChanged())); - - connect(ui->comboBox_alignment, SIGNAL(activated(int)), this, SLOT(editChanged())); - connect(ui->comboBox_position, SIGNAL(activated(int)), this, SLOT(positionChanged())); - connect(ui->checkBox_hidable, SIGNAL(toggled(bool)), this, SLOT(editChanged())); - connect(ui->spinBox_animation, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); - connect(ui->spinBox_delay, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); - - connect(ui->checkBox_customFontColor, SIGNAL(toggled(bool)), this, SLOT(editChanged())); - connect(ui->pushButton_customFontColor, SIGNAL(clicked(bool)), this, SLOT(pickFontColor())); - connect(ui->checkBox_customBgColor, SIGNAL(toggled(bool)), this, SLOT(editChanged())); - connect(ui->pushButton_customBgColor, SIGNAL(clicked(bool)), this, SLOT(pickBackgroundColor())); - connect(ui->checkBox_customBgImage, SIGNAL(toggled(bool)), this, SLOT(editChanged())); - connect(ui->lineEdit_customBgImage, SIGNAL(textChanged(QString)), this, SLOT(editChanged())); - connect(ui->pushButton_customBgImage, SIGNAL(clicked(bool)), this, SLOT(pickBackgroundImage())); - connect(ui->slider_opacity, &QSlider::valueChanged, this, &ConfigPanelWidget::editChanged); - - connect(ui->checkBox_reserveSpace, &QAbstractButton::toggled, [this](bool checked) { mPanel->setReserveSpace(checked, true); }); -} - - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::reset() -{ - ui->spinBox_panelSize->setValue(mOldPanelSize); - ui->spinBox_iconSize->setValue(mOldIconSize); - ui->spinBox_lineCount->setValue(mOldLineCount); - - ui->comboBox_position->setCurrentIndex(indexForPosition(mOldScreenNum, mOldPosition)); - - ui->checkBox_hidable->setChecked(mOldHidable); - - ui->spinBox_animation->setValue(mOldAnimation); - ui->spinBox_delay->setValue(mOldShowDelay); - - fillComboBox_alignment(); - ui->comboBox_alignment->setCurrentIndex(mOldAlignment + 1); - - ui->comboBox_lenghtType->setCurrentIndex(mOldLengthInPercents ? 0 : 1); - widthTypeChanged(); - ui->spinBox_length->setValue(mOldLength); - - mFontColor.setNamedColor(mOldFontColor.name()); - ui->pushButton_customFontColor->setStyleSheet(QString("background: %1").arg(mOldFontColor.name())); - mBackgroundColor.setNamedColor(mOldBackgroundColor.name()); - ui->pushButton_customBgColor->setStyleSheet(QString("background: %1").arg(mOldBackgroundColor.name())); - ui->lineEdit_customBgImage->setText(mOldBackgroundImage); - ui->slider_opacity->setValue(mOldOpacity); - ui->checkBox_reserveSpace->setChecked(mOldReserveSpace); - - ui->checkBox_customFontColor->setChecked(mOldFontColor.isValid()); - ui->checkBox_customBgColor->setChecked(mOldBackgroundColor.isValid()); - ui->checkBox_customBgImage->setChecked(QFileInfo(mOldBackgroundImage).exists()); - - // update position - positionChanged(); -} - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::fillComboBox_position() -{ - int screenCount = QApplication::desktop()->screenCount(); - if (screenCount == 1) - { - addPosition(tr("Top of desktop"), 0, LXQtPanel::PositionTop); - addPosition(tr("Left of desktop"), 0, LXQtPanel::PositionLeft); - addPosition(tr("Right of desktop"), 0, LXQtPanel::PositionRight); - addPosition(tr("Bottom of desktop"), 0, LXQtPanel::PositionBottom); - } - else - { - for (int screenNum = 0; screenNum < screenCount; screenNum++) - { - if (screenNum) - ui->comboBox_position->insertSeparator(9999); - - addPosition(tr("Top of desktop %1").arg(screenNum +1), screenNum, LXQtPanel::PositionTop); - addPosition(tr("Left of desktop %1").arg(screenNum +1), screenNum, LXQtPanel::PositionLeft); - addPosition(tr("Right of desktop %1").arg(screenNum +1), screenNum, LXQtPanel::PositionRight); - addPosition(tr("Bottom of desktop %1").arg(screenNum +1), screenNum, LXQtPanel::PositionBottom); - } - } -} - - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::fillComboBox_alignment() -{ - ui->comboBox_alignment->setItemData(0, QVariant(LXQtPanel::AlignmentLeft)); - ui->comboBox_alignment->setItemData(1, QVariant(LXQtPanel::AlignmentCenter)); - ui->comboBox_alignment->setItemData(2, QVariant(LXQtPanel::AlignmentRight)); - - - if (mPosition == ILXQtPanel::PositionTop || - mPosition == ILXQtPanel::PositionBottom) - { - ui->comboBox_alignment->setItemText(0, tr("Left")); - ui->comboBox_alignment->setItemText(1, tr("Center")); - ui->comboBox_alignment->setItemText(2, tr("Right")); - } - else - { - ui->comboBox_alignment->setItemText(0, tr("Top")); - ui->comboBox_alignment->setItemText(1, tr("Center")); - ui->comboBox_alignment->setItemText(2, tr("Bottom")); - }; -} - - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::addPosition(const QString& name, int screen, LXQtPanel::Position position) -{ - if (LXQtPanel::canPlacedOn(screen, position)) - ui->comboBox_position->addItem(name, QVariant::fromValue((ScreenPosition){screen, position})); -} - - -/************************************************ - * - ************************************************/ -int ConfigPanelWidget::indexForPosition(int screen, ILXQtPanel::Position position) -{ - for (int i = 0; i < ui->comboBox_position->count(); i++) - { - ScreenPosition sp = ui->comboBox_position->itemData(i).value(); - if (screen == sp.screen && position == sp.position) - return i; - } - return -1; -} - - -/************************************************ - * - ************************************************/ -ConfigPanelWidget::~ConfigPanelWidget() -{ - delete ui; -} - - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::editChanged() -{ - mPanel->setPanelSize(ui->spinBox_panelSize->value(), true); - mPanel->setIconSize(ui->spinBox_iconSize->value(), true); - mPanel->setLineCount(ui->spinBox_lineCount->value(), true); - - mPanel->setLength(ui->spinBox_length->value(), - ui->comboBox_lenghtType->currentIndex() == 0, - true); - - LXQtPanel::Alignment align = LXQtPanel::Alignment( - ui->comboBox_alignment->itemData( - ui->comboBox_alignment->currentIndex() - ).toInt()); - - mPanel->setAlignment(align, true); - mPanel->setPosition(mScreenNum, mPosition, true); - mPanel->setHidable(ui->checkBox_hidable->isChecked(), true); - mPanel->setAnimationTime(ui->spinBox_animation->value(), true); - mPanel->setShowDelay(ui->spinBox_delay->value(), true); - - mPanel->setFontColor(ui->checkBox_customFontColor->isChecked() ? mFontColor : QColor(), true); - if (ui->checkBox_customBgColor->isChecked()) - { - mPanel->setBackgroundColor(mBackgroundColor, true); - mPanel->setOpacity(ui->slider_opacity->value(), true); - } - else - { - mPanel->setBackgroundColor(QColor(), true); - mPanel->setOpacity(100, true); - } - - QString image = ui->checkBox_customBgImage->isChecked() ? ui->lineEdit_customBgImage->text() : QString(); - mPanel->setBackgroundImage(image, true); -} - - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::widthTypeChanged() -{ - int max = getMaxLength(); - - if (ui->comboBox_lenghtType->currentIndex() == 0) - { - // Percents ............................. - int v = ui->spinBox_length->value() * 100.0 / max; - ui->spinBox_length->setRange(1, 100); - ui->spinBox_length->setValue(v); - } - else - { - // Pixels ............................... - int v = max / 100.0 * ui->spinBox_length->value(); - ui->spinBox_length->setRange(-max, max); - ui->spinBox_length->setValue(v); - } -} - - -/************************************************ - * - ************************************************/ -int ConfigPanelWidget::getMaxLength() -{ - QDesktopWidget* dw = QApplication::desktop(); - - if (mPosition == ILXQtPanel::PositionTop || - mPosition == ILXQtPanel::PositionBottom) - return dw->screenGeometry(mScreenNum).width(); - else - return dw->screenGeometry(mScreenNum).height(); -} - - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::positionChanged() -{ - ScreenPosition sp = ui->comboBox_position->itemData( - ui->comboBox_position->currentIndex()).value(); - - bool updateAlig = (sp.position == ILXQtPanel::PositionTop || - sp.position == ILXQtPanel::PositionBottom) != - (mPosition == ILXQtPanel::PositionTop || - mPosition == ILXQtPanel::PositionBottom); - - int oldMax = getMaxLength(); - mPosition = sp.position; - mScreenNum = sp.screen; - int newMax = getMaxLength(); - - if (ui->comboBox_lenghtType->currentIndex() == 1 && - oldMax != newMax) - { - // Pixels ............................... - int v = ui->spinBox_length->value() * 1.0 * newMax / oldMax; - ui->spinBox_length->setMaximum(newMax); - ui->spinBox_length->setValue(v); - } - - if (updateAlig) - fillComboBox_alignment(); - - editChanged(); -} - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::pickFontColor() -{ - QColorDialog d(QColor(mFontColor.name()), this); - d.setWindowTitle(tr("Pick color")); - d.setWindowModality(Qt::WindowModal); - if (d.exec() && d.currentColor().isValid()) - { - mFontColor.setNamedColor(d.currentColor().name()); - ui->pushButton_customFontColor->setStyleSheet(QString("background: %1").arg(mFontColor.name())); - editChanged(); - } -} - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::pickBackgroundColor() -{ - QColorDialog d(QColor(mBackgroundColor.name()), this); - d.setWindowTitle(tr("Pick color")); - d.setWindowModality(Qt::WindowModal); - if (d.exec() && d.currentColor().isValid()) - { - mBackgroundColor.setNamedColor(d.currentColor().name()); - ui->pushButton_customBgColor->setStyleSheet(QString("background: %1").arg(mBackgroundColor.name())); - editChanged(); - } -} - -/************************************************ - * - ************************************************/ -void ConfigPanelWidget::pickBackgroundImage() -{ - QString picturesLocation; - picturesLocation = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation); - - QFileDialog* d = new QFileDialog(this, tr("Pick image"), picturesLocation, tr("Images (*.png *.gif *.jpg)")); - d->setAttribute(Qt::WA_DeleteOnClose); - d->setWindowModality(Qt::WindowModal); - connect(d, &QFileDialog::fileSelected, ui->lineEdit_customBgImage, &QLineEdit::setText); - d->show(); -} - diff --git a/panel/config/configpanelwidget.h b/panel/config/configpanelwidget.h deleted file mode 100644 index 2b48744..0000000 --- a/panel/config/configpanelwidget.h +++ /dev/null @@ -1,102 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Marat "Morion" Talipov - * - * 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 CONFIGPANELWIDGET_H -#define CONFIGPANELWIDGET_H - -#include "../lxqtpanel.h" -#include -#include -#include - -class LXQtPanel; - -namespace Ui { - class ConfigPanelWidget; -} - -class ConfigPanelWidget : public QWidget -{ - Q_OBJECT - -public: - explicit ConfigPanelWidget(LXQtPanel *panel, QWidget *parent = 0); - ~ConfigPanelWidget(); - - int screenNum() const { return mScreenNum; } - ILXQtPanel::Position position() const { return mPosition; } - -signals: - void changed(); - -public slots: - void reset(); - -private slots: - void editChanged(); - void widthTypeChanged(); - void positionChanged(); - void pickFontColor(); - void pickBackgroundColor(); - void pickBackgroundImage(); - -private: - Ui::ConfigPanelWidget *ui; - LXQtPanel *mPanel; - int mScreenNum; - ILXQtPanel::Position mPosition; - - void addPosition(const QString& name, int screen, LXQtPanel::Position position); - void fillComboBox_position(); - void fillComboBox_alignment(); - int indexForPosition(int screen, ILXQtPanel::Position position); - int getMaxLength(); - - // new values - QColor mFontColor; - QColor mBackgroundColor; - - // old values for reset - int mOldPanelSize; - int mOldIconSize; - int mOldLineCount; - int mOldLength; - bool mOldLengthInPercents; - LXQtPanel::Alignment mOldAlignment; - ILXQtPanel::Position mOldPosition; - bool mOldHidable; - int mOldAnimation; - int mOldShowDelay; - int mOldScreenNum; - QColor mOldFontColor; - QColor mOldBackgroundColor; - QString mOldBackgroundImage; - int mOldOpacity; - bool mOldReserveSpace; -}; - -#endif diff --git a/panel/config/configpanelwidget.ui b/panel/config/configpanelwidget.ui deleted file mode 100644 index 27466b5..0000000 --- a/panel/config/configpanelwidget.ui +++ /dev/null @@ -1,675 +0,0 @@ - - - ConfigPanelWidget - - - - 0 - 0 - 382 - 517 - - - - - 0 - 0 - - - - Configure panel - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Size - - - false - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - <p>Negative pixel value sets the panel length to that many pixels less than available screen space.</p><p/><p><i>E.g. "Length" set to -100px, screen size is 1000px, then real panel length will be 900 px.</i></p> - - - 1 - - - 100 - - - - - - - Size: - - - - - - - Length: - - - - - - - - % - - - - - px - - - - - - - - px - - - 24 - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 5 - 20 - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - px - - - 10 - - - 128 - - - - - - - Icon size: - - - - - - - Rows count: - - - - - - - 1 - - - 20 - - - - - - - - - - - - - - 0 - 0 - - - - Alignment && position - - - - - - Alignment: - - - - - - - 1 - - - - Left - - - - - Center - - - - - Right - - - - - - - - Position: - - - - - - - - - - true - - - A&uto-hide - - - true - - - false - - - - - - Zero means no animation - - - Animation duration: - - - - - - - Qt::Horizontal - - - - 102 - 5 - - - - - - - - Zero means no animation - - - ms - - - 500 - - - 50 - - - - - - - Zero means no delay - - - Show with delay: - - - - - - - Zero means no delay - - - ms - - - 2000 - - - 50 - - - - - - - - - - Don't allow maximized windows go under the panel window - - - Reserve space on display - - - - - - - - - - - 0 - 0 - - - - Custom styling - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Font color: - - - - - - - false - - - - - - - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 5 - 20 - - - - - - - - Background color: - - - - - - - false - - - - - - - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - - - - - 6 - - - 6 - - - - - false - - - Background opacity: - - - - - - - false - - - 100 - - - 5 - - - 100 - - - Qt::Horizontal - - - - - - - - - - false - - - <small>Compositing is required for panel transparency.</small> - - - Qt::AlignCenter - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - Background image: - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - false - - - - - - - false - - - - - - - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - - - - - - - - - checkBox_customBgColor - toggled(bool) - pushButton_customBgColor - setEnabled(bool) - - - 144 - 332 - - - 350 - 350 - - - - - checkBox_customBgImage - toggled(bool) - lineEdit_customBgImage - setEnabled(bool) - - - 137 - 403 - - - 149 - 440 - - - - - checkBox_customBgImage - toggled(bool) - pushButton_customBgImage - setEnabled(bool) - - - 125 - 403 - - - 350 - 441 - - - - - checkBox_customFontColor - toggled(bool) - pushButton_customFontColor - setEnabled(bool) - - - 190 - 294 - - - 350 - 312 - - - - - checkBox_customBgColor - toggled(bool) - slider_opacity - setEnabled(bool) - - - 99 - 333 - - - 114 - 367 - - - - - checkBox_customBgColor - toggled(bool) - label_2 - setEnabled(bool) - - - 34 - 341 - - - 32 - 362 - - - - - checkBox_customBgColor - toggled(bool) - compositingL - setEnabled(bool) - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/panel/config/configpluginswidget.cpp b/panel/config/configpluginswidget.cpp deleted file mode 100644 index c7a7c06..0000000 --- a/panel/config/configpluginswidget.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Paulo Lieuthier - * - * 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 "configpluginswidget.h" -#include "ui_configpluginswidget.h" -#include "addplugindialog.h" -#include "panelpluginsmodel.h" -#include "../plugin.h" -#include "../ilxqtpanelplugin.h" - -#include -#include -#include - -ConfigPluginsWidget::ConfigPluginsWidget(LXQtPanel *panel, QWidget* parent) : - QWidget(parent), - ui(new Ui::ConfigPluginsWidget), - mPanel(panel) -{ - ui->setupUi(this); - - PanelPluginsModel * plugins = mPanel->mPlugins.data(); - { - QScopedPointer m(ui->listView_plugins->selectionModel()); - ui->listView_plugins->setModel(plugins); - } - { - QScopedPointer d(ui->listView_plugins->itemDelegate()); - ui->listView_plugins->setItemDelegate(new LXQt::HtmlDelegate(QSize(16, 16), ui->listView_plugins)); - } - - resetButtons(); - - connect(ui->listView_plugins->selectionModel(), &QItemSelectionModel::selectionChanged, - this, &ConfigPluginsWidget::resetButtons); - - connect(ui->pushButton_moveUp, &QToolButton::clicked, [this, plugins] { plugins->onMovePluginUp(ui->listView_plugins->currentIndex()); }); - connect(ui->pushButton_moveDown, &QToolButton::clicked, [this, plugins] { plugins->onMovePluginDown(ui->listView_plugins->currentIndex()); }); - - connect(ui->pushButton_addPlugin, &QPushButton::clicked, this, &ConfigPluginsWidget::showAddPluginDialog); - connect(ui->pushButton_removePlugin, &QToolButton::clicked, [this, plugins] { plugins->onRemovePlugin(ui->listView_plugins->currentIndex()); }); - - connect(ui->pushButton_pluginConfig, &QToolButton::clicked, [this, plugins] { plugins->onConfigurePlugin(ui->listView_plugins->currentIndex()); }); - - connect(plugins, &PanelPluginsModel::pluginAdded, this, &ConfigPluginsWidget::resetButtons); - connect(plugins, &PanelPluginsModel::pluginRemoved, this, &ConfigPluginsWidget::resetButtons); - connect(plugins, &PanelPluginsModel::pluginMoved, this, &ConfigPluginsWidget::resetButtons); -} - -ConfigPluginsWidget::~ConfigPluginsWidget() -{ - delete ui; -} - -void ConfigPluginsWidget::reset() -{ - -} - -void ConfigPluginsWidget::showAddPluginDialog() -{ - if (mAddPluginDialog.isNull()) - { - mAddPluginDialog.reset(new AddPluginDialog); - connect(mAddPluginDialog.data(), &AddPluginDialog::pluginSelected, - mPanel->mPlugins.data(), &PanelPluginsModel::addPlugin); - } - mAddPluginDialog->show(); - mAddPluginDialog->raise(); - mAddPluginDialog->activateWindow(); -} - -void ConfigPluginsWidget::resetButtons() -{ - PanelPluginsModel *model = mPanel->mPlugins.data(); - QItemSelectionModel *selectionModel = ui->listView_plugins->selectionModel(); - bool hasSelection = selectionModel->hasSelection(); - bool isFirstSelected = selectionModel->isSelected(model->index(0)); - bool isLastSelected = selectionModel->isSelected(model->index(model->rowCount() - 1)); - - bool hasConfigDialog = false; - if (hasSelection) - { - Plugin const * plugin - = ui->listView_plugins->model()->data(selectionModel->currentIndex(), Qt::UserRole).value(); - if (nullptr != plugin) - hasConfigDialog = plugin->iPlugin()->flags().testFlag(ILXQtPanelPlugin::HaveConfigDialog); - } - - ui->pushButton_removePlugin->setEnabled(hasSelection); - ui->pushButton_moveUp->setEnabled(hasSelection && !isFirstSelected); - ui->pushButton_moveDown->setEnabled(hasSelection && !isLastSelected); - ui->pushButton_pluginConfig->setEnabled(hasSelection && hasConfigDialog); -} diff --git a/panel/config/configpluginswidget.h b/panel/config/configpluginswidget.h deleted file mode 100644 index b4670ef..0000000 --- a/panel/config/configpluginswidget.h +++ /dev/null @@ -1,64 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Paulo Lieuthier - * - * 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 CONFIGPLUGINSWIDGET_H -#define CONFIGPLUGINSWIDGET_H - -#include "../lxqtpanel.h" - -#include - -namespace Ui { - class ConfigPluginsWidget; -} -class AddPluginDialog; - -class ConfigPluginsWidget : public QWidget -{ - Q_OBJECT - -public: - ConfigPluginsWidget(LXQtPanel *panel, QWidget* parent = 0); - ~ConfigPluginsWidget(); - -signals: - void changed(); - -public slots: - void reset(); - -private slots: - void showAddPluginDialog(); - void resetButtons(); - -private: - Ui::ConfigPluginsWidget *ui; - QScopedPointer mAddPluginDialog; - LXQtPanel *mPanel; -}; - -#endif diff --git a/panel/config/configpluginswidget.ui b/panel/config/configpluginswidget.ui deleted file mode 100644 index 413584c..0000000 --- a/panel/config/configpluginswidget.ui +++ /dev/null @@ -1,213 +0,0 @@ - - - ConfigPluginsWidget - - - - 0 - 0 - 339 - 220 - - - - Configure Plugins - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QAbstractScrollArea::AdjustToContents - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - QAbstractItemView::ScrollPerPixel - - - QListView::TopToBottom - - - QListView::Adjust - - - 0 - - - false - - - true - - - - - - - Note: changes made in this page cannot be reset. - - - true - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Move up - - - ... - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - Move down - - - ... - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - Qt::Horizontal - - - - - - - Add - - - ... - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - Remove - - - ... - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - Qt::Horizontal - - - - - - - Configure - - - ... - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - diff --git a/panel/ilxqtpanel.h b/panel/ilxqtpanel.h deleted file mode 100644 index 0ce811f..0000000 --- a/panel/ilxqtpanel.h +++ /dev/null @@ -1,115 +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: - * Alexander Sokoloff - * - * 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 ILXQTPANEL_H -#define ILXQTPANEL_H -#include -#include "lxqtpanelglobals.h" - -class ILXQtPanelPlugin; -class QWidget; - -/** - **/ -class LXQT_PANEL_API ILXQtPanel -{ -public: - /** - * @brief Specifies the position of the panel on screen. - */ - enum Position{ - PositionBottom, //!< The bottom side of the screen. - PositionTop, //!< The top side of the screen. - PositionLeft, //!< The left side of the screen. - PositionRight //!< The right side of the screen. - }; - - /** - * @brief Returns the position of the panel. Possible values for the - * return value are described by the Position enum. - */ - virtual Position position() const = 0; - - /** - * @brief Returns the edge length of the icons that are shown on the panel - * in pixels. The icons are square. - */ - virtual int iconSize() const = 0; - /** - * @brief Returns the number of lines/rows of this panel. - */ - virtual int lineCount() const = 0; - - /** - * @brief Helper function for convenient direction/alignment checking. - * @return True if the panel is on the top or the bottom of the - * screen; otherwise returns false. - */ - bool isHorizontal() const { return position() == PositionBottom || position() == PositionTop; } - - /** - * @brief Helper method that returns the global screen coordinates of the - * panel, so you do not need to use QWidget::mapToGlobal() by yourself. - * @return The QRect where the panel is located in global screen - * coordinates. - */ - virtual QRect globalGometry() const = 0; - - /** - * @brief Helper method for calculating the global screen position of a - * popup window with size windowSize. - * @param absolutePos Contains the global screen coordinates where the - * popup should be appear, i.e. the point where the user has clicked. - * @param windowSize The size that the window will occupy. - * @return The global screen position where the popup window can be shown. - */ - virtual QRect calculatePopupWindowPos(const QPoint &absolutePos, const QSize &windowSize) const = 0; - /** - * @brief Helper method for calculating the global screen position of a - * popup window with size windowSize. The parameter plugin should be a - * plugin - * @param plugin Plugin that the popup window will belong to. The position - * will be calculated according to the position of the plugin in the panel. - * @param windowSize The size that the window will occupy. - * @return The global screen position where the popup window can be shown. - */ - virtual QRect calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const QSize &windowSize) const = 0; - - /*! - * \brief By calling this function, a plugin (or any other object) notifies the panel - * about showing a (standalone) window/menu -> the panel needs this to avoid "hiding" in case any - * standalone window is shown. The widget/window must be shown later than this notification call because - * the panel needs to observe its show/hide/close events. - * - * \param w the window that will be shown - * - */ - virtual void willShowWindow(QWidget * w) = 0; -}; - -#endif // ILXQTPANEL_H diff --git a/panel/ilxqtpanelplugin.h b/panel/ilxqtpanelplugin.h deleted file mode 100644 index 6a4473d..0000000 --- a/panel/ilxqtpanelplugin.h +++ /dev/null @@ -1,241 +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: - * Alexander Sokoloff - * - * 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 ILXQTPANELPLUGIN_H -#define ILXQTPANELPLUGIN_H - -#include -#include "ilxqtpanel.h" -#include "lxqtpanelglobals.h" - -/** -LXQt panel plugins are standalone sharedlibraries -(*.so) located in PLUGIN_DIR (define provided by CMakeLists.txt). - -Plugin for the panel is a library written in C++. One more necessary thing -is a .desktop file describing this plugin. The same may be additional files, -like translations. Themselves plugins will be installed to -/usr/local/lib/lxqt-panel or /usr/lib/lxqt-panel (dependent on cmake option --DCMAKE_INSTALL_PREFIX). Desktop files are installed to -/usr/local/share/lxqt/lxqt-panel, translations to -/usr/local/share/lxqt/lxqt-panel/PLUGIN_NAME. -**/ - -class QDialog; -class PluginSettings; -namespace LXQt -{ - class PluginInfo; -} - -struct LXQT_PANEL_API ILXQtPanelPluginStartupInfo -{ - ILXQtPanel *lxqtPanel; - PluginSettings *settings; - const LXQt::PluginInfo *desktopFile; -}; - - -/** \brief Base abstract class for LXQt panel widgets/plugins. -All plugins *must* be inherited from this one. - -This class provides some basic API and inherited/implemented -plugins GUIs will be responsible on the functionality itself. -**/ - -class LXQT_PANEL_API ILXQtPanelPlugin -{ -public: - /** - This enum describes the properties of a plugin. - **/ - enum Flag { - NoFlags = 0, ///< It does not have any properties set. - PreferRightAlignment = 1, /**< The plugin prefers right alignment (for example the clock plugin); - otherwise the plugin prefers left alignment (like main menu). - This flag is used only at the first start, later positions of all - plugins are saved in a config, and this saved information is used. */ - HaveConfigDialog = 2, ///< The plugin have a configuration dialog. - SingleInstance = 4, ///< The plugin allows only one instance to run. - NeedsHandle = 8 ///< The plugin needs a handle for the context menu - }; - - Q_DECLARE_FLAGS(Flags, Flag) - - /** - This enum describes the reason the plugin was activated. - **/ - enum ActivationReason { - Unknown = 0, ///< Unknown reason - DoubleClick = 2, ///< The plugin entry was double clicked - Trigger = 3, ///< The plugin was clicked - MiddleClick = 4 ///< The plugin was clicked with the middle mouse button - }; - - /** - Constructs an ILXQtPanelPlugin object with the given startupInfo. You do not have to worry - about the startupInfo parameters, ILXQtPanelPlugin processes the parameters itself. - **/ - ILXQtPanelPlugin(const ILXQtPanelPluginStartupInfo &startupInfo): - mSettings(startupInfo.settings), - mPanel(startupInfo.lxqtPanel), - mDesktopFile(startupInfo.desktopFile) - {} - - /** - Destroys the object. - **/ - virtual ~ILXQtPanelPlugin() {} - - /** - Returns the plugin flags. - The base class implementation returns a NoFlags. - **/ - virtual Flags flags() const { return NoFlags; } - - /** - Returns the string that is used in the theme QSS file. - If you return "WorldClock" string, theme author may write something like `#WorldClock { border: 1px solid red; }` - to set a custom border for your plugin. - **/ - virtual QString themeId() const = 0; - - /** - From the user's point of view, your plugin is some visual widget on the panel. This function returns a pointer to it. - This method is called only once, so you are free to return the pointer on a class member, or create the widget on the fly. - **/ - virtual QWidget *widget() = 0; - - /** - Returns the plugin settings dialog. Reimplement this function if your plugin has it. - The panel does not take ownership of the dialog, it is probably a good idea to set Qt::WA_DeleteOnClose - attribute for the dialog. - The default implementation returns 0, no dialog; - - Note that the flags method has to return HaveConfigDialog flag. - To save the settings you should use a ready-to-use ILXQtPanelPlugin::settings() object. - - **/ - virtual QDialog *configureDialog() { return 0; } - - /** - This function is called when values are changed in the plugin settings. - Reimplement this function to your plugin corresponded the new settings. - - The default implementation do nothing. - **/ - virtual void settingsChanged() {} - - /** - This function is called when the user activates the plugin. reason specifies the reason for activation. - ILXQtPanelPlugin::ActivationReason enumerates the various reasons. - - The default implementation do nothing. - **/ - virtual void activated(ActivationReason reason) {} - - /** - This function is called when the panel geometry or lines count are changed. - - The default implementation do nothing. - - **/ - virtual void realign() {} - - /** - Returns the panel object. - **/ - ILXQtPanel *panel() const { return mPanel; } - - - PluginSettings *settings() const { return mSettings; } - const LXQt::PluginInfo *desktopFile() const { return mDesktopFile; } - - /** - Helper functions for calculating global screen position of some popup window with windowSize size. - If you need to show some popup window, you can use it, to get global screen position for the new window. - **/ - virtual QRect calculatePopupWindowPos(const QSize &windowSize) - { - return mPanel->calculatePopupWindowPos(this, windowSize); - } - - /*! - * \brief By calling this function plugin notifies the panel about showing a (standalone) window/menu. - * - * \param w the shown window - * - */ - inline void willShowWindow(QWidget * w) - { - mPanel->willShowWindow(w); - } - - virtual bool isSeparate() const { return false; } - virtual bool isExpandable() const { return false; } -private: - PluginSettings *mSettings; - ILXQtPanel *mPanel; - const LXQt::PluginInfo *mDesktopFile; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(ILXQtPanelPlugin::Flags) - -/** -Every plugin must have the ILXQtPanelPluginLibrary loader. You should only reimplement the instance() method which should return your plugin. -Example: -@code -class LXQtClockPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) { return new LXQtClock(startupInfo);} -}; -@endcode -**/ -class LXQT_PANEL_API ILXQtPanelPluginLibrary -{ -public: - /** - Destroys the ILXQtPanelPluginLibrary object. - **/ - virtual ~ILXQtPanelPluginLibrary() {} - - /** - Returns the root component object of the plugin. When the library is finally unloaded, the root component will automatically be deleted. - **/ - virtual ILXQtPanelPlugin* instance(const ILXQtPanelPluginStartupInfo &startupInfo) const = 0; -}; - - -Q_DECLARE_INTERFACE(ILXQtPanelPluginLibrary, - "lxde-qt.org/Panel/PluginInterface/3.0") - -#endif // ILXQTPANELPLUGIN_H diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp deleted file mode 100644 index 9bce88d..0000000 --- a/panel/lxqtpanel.cpp +++ /dev/null @@ -1,1358 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtpanel.h" -#include "lxqtpanellimits.h" -#include "ilxqtpanelplugin.h" -#include "lxqtpanelapplication.h" -#include "lxqtpanellayout.h" -#include "config/configpaneldialog.h" -#include "popupmenu.h" -#include "plugin.h" -#include "panelpluginsmodel.h" -#include "windownotifier.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -// Turn on this to show the time required to load each plugin during startup -// #define DEBUG_PLUGIN_LOADTIME -#ifdef DEBUG_PLUGIN_LOADTIME -#include -#endif - -// Config keys and groups -#define CFG_KEY_SCREENNUM "desktop" -#define CFG_KEY_POSITION "position" -#define CFG_KEY_PANELSIZE "panelSize" -#define CFG_KEY_ICONSIZE "iconSize" -#define CFG_KEY_LINECNT "lineCount" -#define CFG_KEY_LENGTH "width" -#define CFG_KEY_PERCENT "width-percent" -#define CFG_KEY_ALIGNMENT "alignment" -#define CFG_KEY_FONTCOLOR "font-color" -#define CFG_KEY_BACKGROUNDCOLOR "background-color" -#define CFG_KEY_BACKGROUNDIMAGE "background-image" -#define CFG_KEY_OPACITY "opacity" -#define CFG_KEY_RESERVESPACE "reserve-space" -#define CFG_KEY_PLUGINS "plugins" -#define CFG_KEY_HIDABLE "hidable" -#define CFG_KEY_ANIMATION "animation-duration" -#define CFG_KEY_SHOW_DELAY "show-delay" -#define CFG_KEY_LOCKPANEL "lockPanel" - -/************************************************ - Returns the Position by the string. - String is one of "Top", "Left", "Bottom", "Right", string is not case sensitive. - If the string is not correct, returns defaultValue. - ************************************************/ -ILXQtPanel::Position LXQtPanel::strToPosition(const QString& str, ILXQtPanel::Position defaultValue) -{ - if (str.toUpper() == "TOP") return LXQtPanel::PositionTop; - if (str.toUpper() == "LEFT") return LXQtPanel::PositionLeft; - if (str.toUpper() == "RIGHT") return LXQtPanel::PositionRight; - if (str.toUpper() == "BOTTOM") return LXQtPanel::PositionBottom; - return defaultValue; -} - - -/************************************************ - Return string representation of the position - ************************************************/ -QString LXQtPanel::positionToStr(ILXQtPanel::Position position) -{ - switch (position) - { - case LXQtPanel::PositionTop: - return QString("Top"); - case LXQtPanel::PositionLeft: - return QString("Left"); - case LXQtPanel::PositionRight: - return QString("Right"); - case LXQtPanel::PositionBottom: - return QString("Bottom"); - } - - return QString(); -} - - -/************************************************ - - ************************************************/ -LXQtPanel::LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidget *parent) : - QFrame(parent), - mSettings(settings), - mConfigGroup(configGroup), - mPlugins{nullptr}, - mStandaloneWindows{new WindowNotifier}, - mPanelSize(0), - mIconSize(0), - mLineCount(0), - mLength(0), - mAlignment(AlignmentLeft), - mPosition(ILXQtPanel::PositionBottom), - mScreenNum(0), //whatever (avoid conditional on uninitialized value) - mActualScreenNum(0), - mHidable(false), - mHidden(false), - mAnimationTime(0), - mReserveSpace(true), - mAnimation(nullptr), - mLockPanel(false) -{ - //You can find information about the flags and widget attributes in your - //Qt documentation or at http://doc.qt.io/qt-5/qt.html - //Qt::FramelessWindowHint = Produces a borderless window. The user cannot - //move or resize a borderless window via the window system. On X11, ... - //Qt::WindowStaysOnTopHint = Informs the window system that the window - //should stay on top of all other windows. Note that on ... - Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint; - - // NOTE: by PCMan: - // In Qt 4, the window is not activated if it has Qt::WA_X11NetWmWindowTypeDock. - // Since Qt 5, the default behaviour is changed. A window is always activated on mouse click. - // Please see the source code of Qt5: src/plugins/platforms/xcb/qxcbwindow.cpp. - // void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) - // This new behaviour caused lxqt bug #161 - Cannot minimize windows from panel 1 when two task managers are open - // Besides, this breaks minimizing or restoring windows when clicking on the taskbar buttons. - // To workaround this regression bug, we need to add this window flag here. - // However, since the panel gets no keyboard focus, this may decrease accessibility since - // it's not possible to use the panel with keyboards. We need to find a better solution later. - flags |= Qt::WindowDoesNotAcceptFocus; - - setWindowFlags(flags); - //Adds _NET_WM_WINDOW_TYPE_DOCK to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. - setAttribute(Qt::WA_X11NetWmWindowTypeDock); - //Enables tooltips for inactive windows. - setAttribute(Qt::WA_AlwaysShowToolTips); - //Indicates that the widget should have a translucent background, i.e., any non-opaque regions of the widgets will be translucent because the widget will have an alpha channel. Setting this ... - setAttribute(Qt::WA_TranslucentBackground); - //Allows data from drag and drop operations to be dropped onto the widget (see QWidget::setAcceptDrops()). - setAttribute(Qt::WA_AcceptDrops); - - setWindowTitle("LXQt Panel"); - setObjectName(QString("LXQtPanel %1").arg(configGroup)); - - //LXQtPanel (inherits QFrame) -> lav (QGridLayout) -> LXQtPanelWidget (QFrame) -> LXQtPanelLayout - LXQtPanelWidget = new QFrame(this); - LXQtPanelWidget->setObjectName("BackgroundWidget"); - QGridLayout* lav = new QGridLayout(); - lav->setContentsMargins(0, 0, 0, 0); - setLayout(lav); - this->layout()->addWidget(LXQtPanelWidget); - - mLayout = new LXQtPanelLayout(LXQtPanelWidget); - connect(mLayout, &LXQtPanelLayout::pluginMoved, this, &LXQtPanel::pluginMoved); - LXQtPanelWidget->setLayout(mLayout); - mLayout->setLineCount(mLineCount); - - mDelaySave.setSingleShot(true); - mDelaySave.setInterval(SETTINGS_SAVE_DELAY); - connect(&mDelaySave, SIGNAL(timeout()), this, SLOT(saveSettings())); - - mHideTimer.setSingleShot(true); - mHideTimer.setInterval(PANEL_HIDE_DELAY); - connect(&mHideTimer, SIGNAL(timeout()), this, SLOT(hidePanelWork())); - - mShowDelayTimer.setSingleShot(true); - mShowDelayTimer.setInterval(PANEL_SHOW_DELAY); - connect(&mShowDelayTimer, &QTimer::timeout, [this] { showPanel(mAnimationTime > 0); }); - - connect(QApplication::desktop(), &QDesktopWidget::resized, this, &LXQtPanel::ensureVisible); - connect(QApplication::desktop(), &QDesktopWidget::screenCountChanged, this, &LXQtPanel::ensureVisible); - - // connecting to QDesktopWidget::workAreaResized shouldn't be necessary, - // as we've already connceted to QDesktopWidget::resized, but it actually - // is. Read mode on https://github.com/lxde/lxqt-panel/pull/310 - connect(QApplication::desktop(), &QDesktopWidget::workAreaResized, - this, &LXQtPanel::ensureVisible); - - connect(LXQt::Settings::globalSettings(), SIGNAL(settingsChanged()), this, SLOT(update())); - connect(lxqtApp, SIGNAL(themeChanged()), this, SLOT(realign())); - - connect(mStandaloneWindows.data(), &WindowNotifier::firstShown, [this] { showPanel(true); }); - connect(mStandaloneWindows.data(), &WindowNotifier::lastHidden, this, &LXQtPanel::hidePanel); - - readSettings(); - - ensureVisible(); - - loadPlugins(); - - show(); - - // show it the first time, despite setting - if (mHidable) - { - showPanel(false); - QTimer::singleShot(PANEL_HIDE_FIRST_TIME, this, SLOT(hidePanel())); - } -} - -/************************************************ - - ************************************************/ -void LXQtPanel::readSettings() -{ - // Read settings ...................................... - mSettings->beginGroup(mConfigGroup); - - // Let Hidability be the first thing we read - // so that every call to realign() is without side-effect - mHidable = mSettings->value(CFG_KEY_HIDABLE, mHidable).toBool(); - mHidden = mHidable; - - mAnimationTime = mSettings->value(CFG_KEY_ANIMATION, mAnimationTime).toInt(); - mShowDelayTimer.setInterval(mSettings->value(CFG_KEY_SHOW_DELAY, mShowDelayTimer.interval()).toInt()); - - // By default we are using size & count from theme. - setPanelSize(mSettings->value(CFG_KEY_PANELSIZE, PANEL_DEFAULT_SIZE).toInt(), false); - setIconSize(mSettings->value(CFG_KEY_ICONSIZE, PANEL_DEFAULT_ICON_SIZE).toInt(), false); - setLineCount(mSettings->value(CFG_KEY_LINECNT, PANEL_DEFAULT_LINE_COUNT).toInt(), false); - - setLength(mSettings->value(CFG_KEY_LENGTH, 100).toInt(), - mSettings->value(CFG_KEY_PERCENT, true).toBool(), - false); - - mScreenNum = mSettings->value(CFG_KEY_SCREENNUM, QApplication::desktop()->primaryScreen()).toInt(); - setPosition(mScreenNum, - strToPosition(mSettings->value(CFG_KEY_POSITION).toString(), PositionBottom), - false); - - setAlignment(Alignment(mSettings->value(CFG_KEY_ALIGNMENT, mAlignment).toInt()), false); - - QColor color = mSettings->value(CFG_KEY_FONTCOLOR, "").value(); - if (color.isValid()) - setFontColor(color, true); - - setOpacity(mSettings->value(CFG_KEY_OPACITY, 100).toInt(), true); - mReserveSpace = mSettings->value(CFG_KEY_RESERVESPACE, true).toBool(); - color = mSettings->value(CFG_KEY_BACKGROUNDCOLOR, "").value(); - if (color.isValid()) - setBackgroundColor(color, true); - - QString image = mSettings->value(CFG_KEY_BACKGROUNDIMAGE, "").toString(); - if (!image.isEmpty()) - setBackgroundImage(image, false); - - mLockPanel = mSettings->value(CFG_KEY_LOCKPANEL, false).toBool(); - - mSettings->endGroup(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::saveSettings(bool later) -{ - mDelaySave.stop(); - if (later) - { - mDelaySave.start(); - return; - } - - mSettings->beginGroup(mConfigGroup); - - //Note: save/load of plugin names is completely handled by mPlugins object - //mSettings->setValue(CFG_KEY_PLUGINS, mPlugins->pluginNames()); - - mSettings->setValue(CFG_KEY_PANELSIZE, mPanelSize); - mSettings->setValue(CFG_KEY_ICONSIZE, mIconSize); - mSettings->setValue(CFG_KEY_LINECNT, mLineCount); - - mSettings->setValue(CFG_KEY_LENGTH, mLength); - mSettings->setValue(CFG_KEY_PERCENT, mLengthInPercents); - - mSettings->setValue(CFG_KEY_SCREENNUM, mScreenNum); - mSettings->setValue(CFG_KEY_POSITION, positionToStr(mPosition)); - - mSettings->setValue(CFG_KEY_ALIGNMENT, mAlignment); - - mSettings->setValue(CFG_KEY_FONTCOLOR, mFontColor.isValid() ? mFontColor : QColor()); - mSettings->setValue(CFG_KEY_BACKGROUNDCOLOR, mBackgroundColor.isValid() ? mBackgroundColor : QColor()); - mSettings->setValue(CFG_KEY_BACKGROUNDIMAGE, QFileInfo(mBackgroundImage).exists() ? mBackgroundImage : QString()); - mSettings->setValue(CFG_KEY_OPACITY, mOpacity); - mSettings->setValue(CFG_KEY_RESERVESPACE, mReserveSpace); - - mSettings->setValue(CFG_KEY_HIDABLE, mHidable); - mSettings->setValue(CFG_KEY_ANIMATION, mAnimationTime); - mSettings->setValue(CFG_KEY_SHOW_DELAY, mShowDelayTimer.interval()); - - mSettings->setValue(CFG_KEY_LOCKPANEL, mLockPanel); - - mSettings->endGroup(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::ensureVisible() -{ - if (!canPlacedOn(mScreenNum, mPosition)) - setPosition(findAvailableScreen(mPosition), mPosition, false); - else - mActualScreenNum = mScreenNum; - - // the screen size might be changed - realign(); -} - - -/************************************************ - - ************************************************/ -LXQtPanel::~LXQtPanel() -{ - mLayout->setEnabled(false); - delete mAnimation; - delete mConfigDialog.data(); - // do not save settings because of "user deleted panel" functionality saveSettings(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::show() -{ - QWidget::show(); - KWindowSystem::setOnDesktop(effectiveWinId(), NET::OnAllDesktops); -} - - -/************************************************ - - ************************************************/ -QStringList pluginDesktopDirs() -{ - QStringList dirs; - dirs << QString(getenv("LXQT_PANEL_PLUGINS_DIR")).split(':', QString::SkipEmptyParts); - dirs << QString("%1/%2").arg(XdgDirs::dataHome(), "/lxqt/lxqt-panel"); - dirs << PLUGIN_DESKTOPS_DIR; - return dirs; -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::loadPlugins() -{ - QString names_key(mConfigGroup); - names_key += '/'; - names_key += QLatin1String(CFG_KEY_PLUGINS); - mPlugins.reset(new PanelPluginsModel(this, names_key, pluginDesktopDirs())); - - connect(mPlugins.data(), &PanelPluginsModel::pluginAdded, mLayout, &LXQtPanelLayout::addPlugin); - connect(mPlugins.data(), &PanelPluginsModel::pluginMovedUp, mLayout, &LXQtPanelLayout::moveUpPlugin); - //reemit signals - connect(mPlugins.data(), &PanelPluginsModel::pluginAdded, this, &LXQtPanel::pluginAdded); - connect(mPlugins.data(), &PanelPluginsModel::pluginRemoved, this, &LXQtPanel::pluginRemoved); - - for (auto const & plugin : mPlugins->plugins()) - { - mLayout->addPlugin(plugin); - connect(plugin, &Plugin::dragLeft, [this] { mShowDelayTimer.stop(); hidePanel(); }); - } -} - -/************************************************ - - ************************************************/ -int LXQtPanel::getReserveDimension() -{ - return mHidable ? PANEL_HIDE_SIZE : qMax(PANEL_MINIMUM_SIZE, mPanelSize); -} - -void LXQtPanel::setPanelGeometry(bool animate) -{ - const QRect currentScreen = QApplication::desktop()->screenGeometry(mActualScreenNum); - QRect rect; - - if (isHorizontal()) - { - // Horiz panel *************************** - rect.setHeight(qMax(PANEL_MINIMUM_SIZE, mPanelSize)); - if (mLengthInPercents) - rect.setWidth(currentScreen.width() * mLength / 100.0); - else - { - if (mLength <= 0) - rect.setWidth(currentScreen.width() + mLength); - else - rect.setWidth(mLength); - } - - rect.setWidth(qMax(rect.size().width(), mLayout->minimumSize().width())); - - // Horiz ...................... - switch (mAlignment) - { - case LXQtPanel::AlignmentLeft: - rect.moveLeft(currentScreen.left()); - break; - - case LXQtPanel::AlignmentCenter: - rect.moveCenter(currentScreen.center()); - break; - - case LXQtPanel::AlignmentRight: - rect.moveRight(currentScreen.right()); - break; - } - - // Vert ....................... - if (mPosition == ILXQtPanel::PositionTop) - { - if (mHidden) - rect.moveBottom(currentScreen.top() + PANEL_HIDE_SIZE - 1); - else - rect.moveTop(currentScreen.top()); - } - else - { - if (mHidden) - rect.moveTop(currentScreen.bottom() - PANEL_HIDE_SIZE + 1); - else - rect.moveBottom(currentScreen.bottom()); - } - } - else - { - // Vert panel *************************** - rect.setWidth(qMax(PANEL_MINIMUM_SIZE, mPanelSize)); - if (mLengthInPercents) - rect.setHeight(currentScreen.height() * mLength / 100.0); - else - { - if (mLength <= 0) - rect.setHeight(currentScreen.height() + mLength); - else - rect.setHeight(mLength); - } - - rect.setHeight(qMax(rect.size().height(), mLayout->minimumSize().height())); - - // Vert ....................... - switch (mAlignment) - { - case LXQtPanel::AlignmentLeft: - rect.moveTop(currentScreen.top()); - break; - - case LXQtPanel::AlignmentCenter: - rect.moveCenter(currentScreen.center()); - break; - - case LXQtPanel::AlignmentRight: - rect.moveBottom(currentScreen.bottom()); - break; - } - - // Horiz ...................... - if (mPosition == ILXQtPanel::PositionLeft) - { - if (mHidden) - rect.moveRight(currentScreen.left() + PANEL_HIDE_SIZE - 1); - else - rect.moveLeft(currentScreen.left()); - } - else - { - if (mHidden) - rect.moveLeft(currentScreen.right() - PANEL_HIDE_SIZE + 1); - else - rect.moveRight(currentScreen.right()); - } - } - if (rect != geometry()) - { - setFixedSize(rect.size()); - if (animate) - { - if (mAnimation == nullptr) - { - mAnimation = new QPropertyAnimation(this, "geometry"); - mAnimation->setEasingCurve(QEasingCurve::Linear); - //Note: for hiding, the margins are set after animation is finished - connect(mAnimation, &QAbstractAnimation::finished, [this] { if (mHidden) setMargins(); }); - } - mAnimation->setDuration(mAnimationTime); - mAnimation->setStartValue(geometry()); - mAnimation->setEndValue(rect); - //Note: for showing-up, the margins are removed instantly - if (!mHidden) - setMargins(); - mAnimation->start(); - } - else - { - setMargins(); - setGeometry(rect); - } - } -} - -void LXQtPanel::setMargins() -{ - if (mHidden) - { - if (isHorizontal()) - { - if (mPosition == ILXQtPanel::PositionTop) - mLayout->setContentsMargins(0, 0, 0, PANEL_HIDE_SIZE); - else - mLayout->setContentsMargins(0, PANEL_HIDE_SIZE, 0, 0); - } - else - { - if (mPosition == ILXQtPanel::PositionLeft) - mLayout->setContentsMargins(0, 0, PANEL_HIDE_SIZE, 0); - else - mLayout->setContentsMargins(PANEL_HIDE_SIZE, 0, 0, 0); - } - } - else - mLayout->setContentsMargins(0, 0, 0, 0); -} - -void LXQtPanel::realign() -{ - if (!isVisible()) - return; -#if 0 - qDebug() << "** Realign *********************"; - qDebug() << "PanelSize: " << mPanelSize; - qDebug() << "IconSize: " << mIconSize; - qDebug() << "LineCount: " << mLineCount; - qDebug() << "Length: " << mLength << (mLengthInPercents ? "%" : "px"); - qDebug() << "Alignment: " << (mAlignment == 0 ? "center" : (mAlignment < 0 ? "left" : "right")); - qDebug() << "Position: " << positionToStr(mPosition) << "on" << mScreenNum; - qDebug() << "Plugins count: " << mPlugins.count(); -#endif - - setPanelGeometry(); - - // Reserve our space on the screen .......... - // It's possible that our geometry is not changed, but screen resolution is changed, - // so resetting WM_STRUT is still needed. To make it simple, we always do it. - updateWmStrut(); -} - - -// Update the _NET_WM_PARTIAL_STRUT and _NET_WM_STRUT properties for the window -void LXQtPanel::updateWmStrut() -{ - WId wid = effectiveWinId(); - if(wid == 0 || !isVisible()) - return; - - if (mReserveSpace) - { - const QRect wholeScreen = QApplication::desktop()->geometry(); - const QRect rect = geometry(); - // NOTE: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html - // Quote from the EWMH spec: " Note that the strut is relative to the screen edge, and not the edge of the xinerama monitor." - // So, we use the geometry of the whole screen to calculate the strut rather than using the geometry of individual monitors. - // Though the spec only mention Xinerama and did not mention XRandR, the rule should still be applied. - // At least openbox is implemented like this. - switch (mPosition) - { - case LXQtPanel::PositionTop: - KWindowSystem::setExtendedStrut(wid, - /* Left */ 0, 0, 0, - /* Right */ 0, 0, 0, - /* Top */ rect.top() + getReserveDimension(), rect.left(), rect.right(), - /* Bottom */ 0, 0, 0 - ); - break; - - case LXQtPanel::PositionBottom: - KWindowSystem::setExtendedStrut(wid, - /* Left */ 0, 0, 0, - /* Right */ 0, 0, 0, - /* Top */ 0, 0, 0, - /* Bottom */ wholeScreen.bottom() - rect.bottom() + getReserveDimension(), rect.left(), rect.right() - ); - break; - - case LXQtPanel::PositionLeft: - KWindowSystem::setExtendedStrut(wid, - /* Left */ rect.left() + getReserveDimension(), rect.top(), rect.bottom(), - /* Right */ 0, 0, 0, - /* Top */ 0, 0, 0, - /* Bottom */ 0, 0, 0 - ); - - break; - - case LXQtPanel::PositionRight: - KWindowSystem::setExtendedStrut(wid, - /* Left */ 0, 0, 0, - /* Right */ wholeScreen.right() - rect.right() + getReserveDimension(), rect.top(), rect.bottom(), - /* Top */ 0, 0, 0, - /* Bottom */ 0, 0, 0 - ); - break; - } - } else - { - KWindowSystem::setExtendedStrut(wid, - /* Left */ 0, 0, 0, - /* Right */ 0, 0, 0, - /* Top */ 0, 0, 0, - /* Bottom */ 0, 0, 0 - ); - } -} - - -/************************************************ - The panel can't be placed on boundary of two displays. - This function checks if the panel can be placed on the display - @screenNum on @position. - ************************************************/ -bool LXQtPanel::canPlacedOn(int screenNum, LXQtPanel::Position position) -{ - QDesktopWidget* dw = QApplication::desktop(); - - switch (position) - { - case LXQtPanel::PositionTop: - for (int i = 0; i < dw->screenCount(); ++i) - if (dw->screenGeometry(i).bottom() < dw->screenGeometry(screenNum).top()) - return false; - return true; - - case LXQtPanel::PositionBottom: - for (int i = 0; i < dw->screenCount(); ++i) - if (dw->screenGeometry(i).top() > dw->screenGeometry(screenNum).bottom()) - return false; - return true; - - case LXQtPanel::PositionLeft: - for (int i = 0; i < dw->screenCount(); ++i) - if (dw->screenGeometry(i).right() < dw->screenGeometry(screenNum).left()) - return false; - return true; - - case LXQtPanel::PositionRight: - for (int i = 0; i < dw->screenCount(); ++i) - if (dw->screenGeometry(i).left() > dw->screenGeometry(screenNum).right()) - return false; - return true; - } - - return false; -} - - -/************************************************ - - ************************************************/ -int LXQtPanel::findAvailableScreen(LXQtPanel::Position position) -{ - int current = mScreenNum; - - for (int i = current; i < QApplication::desktop()->screenCount(); ++i) - if (canPlacedOn(i, position)) - return i; - - for (int i = 0; i < current; ++i) - if (canPlacedOn(i, position)) - return i; - - return 0; -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::showConfigDialog() -{ - if (mConfigDialog.isNull()) - mConfigDialog = new ConfigPanelDialog(this, nullptr /*make it top level window*/); - - mConfigDialog->showConfigPanelPage(); - mStandaloneWindows->observeWindow(mConfigDialog.data()); - mConfigDialog->show(); - mConfigDialog->raise(); - mConfigDialog->activateWindow(); - WId wid = mConfigDialog->windowHandle()->winId(); - - KWindowSystem::activateWindow(wid); - KWindowSystem::setOnDesktop(wid, KWindowSystem::currentDesktop()); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::showAddPluginDialog() -{ - if (mConfigDialog.isNull()) - mConfigDialog = new ConfigPanelDialog(this, nullptr /*make it top level window*/); - - mConfigDialog->showConfigPluginsPage(); - mStandaloneWindows->observeWindow(mConfigDialog.data()); - mConfigDialog->show(); - mConfigDialog->raise(); - mConfigDialog->activateWindow(); - WId wid = mConfigDialog->windowHandle()->winId(); - - KWindowSystem::activateWindow(wid); - KWindowSystem::setOnDesktop(wid, KWindowSystem::currentDesktop()); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::updateStyleSheet() -{ - QStringList sheet; - sheet << QString("Plugin > QAbstractButton, LXQtTray { qproperty-iconSize: %1px %1px; }").arg(mIconSize); - sheet << QString("Plugin > * > QAbstractButton, TrayIcon { qproperty-iconSize: %1px %1px; }").arg(mIconSize); - - if (mFontColor.isValid()) - sheet << QString("Plugin * { color: " + mFontColor.name() + "; }"); - - QString object = LXQtPanelWidget->objectName(); - - if (mBackgroundColor.isValid()) - { - QString color = QString("%1, %2, %3, %4") - .arg(mBackgroundColor.red()) - .arg(mBackgroundColor.green()) - .arg(mBackgroundColor.blue()) - .arg((float) mOpacity / 100); - sheet << QString("LXQtPanel #BackgroundWidget { background-color: rgba(" + color + "); }"); - } - - if (QFileInfo(mBackgroundImage).exists()) - sheet << QString("LXQtPanel #BackgroundWidget { background-image: url('" + mBackgroundImage + "');}"); - - setStyleSheet(sheet.join("\n")); -} - - - -/************************************************ - - ************************************************/ -void LXQtPanel::setPanelSize(int value, bool save) -{ - if (mPanelSize != value) - { - mPanelSize = value; - realign(); - - if (save) - saveSettings(true); - } -} - - - -/************************************************ - - ************************************************/ -void LXQtPanel::setIconSize(int value, bool save) -{ - if (mIconSize != value) - { - mIconSize = value; - updateStyleSheet(); - mLayout->setLineSize(mIconSize); - - if (save) - saveSettings(true); - - realign(); - } -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::setLineCount(int value, bool save) -{ - if (mLineCount != value) - { - mLineCount = value; - mLayout->setEnabled(false); - mLayout->setLineCount(mLineCount); - mLayout->setEnabled(true); - - if (save) - saveSettings(true); - - realign(); - } -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::setLength(int length, bool inPercents, bool save) -{ - if (mLength == length && - mLengthInPercents == inPercents) - return; - - mLength = length; - mLengthInPercents = inPercents; - - if (save) - saveSettings(true); - - realign(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::setPosition(int screen, ILXQtPanel::Position position, bool save) -{ - if (mScreenNum == screen && - mPosition == position) - return; - - mActualScreenNum = screen; - mPosition = position; - mLayout->setPosition(mPosition); - - if (save) - { - mScreenNum = screen; - saveSettings(true); - } - - // Qt 5 adds a new class QScreen and add API for setting the screen of a QWindow. - // so we had better use it. However, without this, our program should still work - // as long as XRandR is used. Since XRandR combined all screens into a large virtual desktop - // every screen and their virtual siblings are actually on the same virtual desktop. - // So things still work if we don't set the screen correctly, but this is not the case - // for other backends, such as the upcoming wayland support. Hence it's better to set it. - if(windowHandle()) - { - // QScreen* newScreen = qApp->screens().at(screen); - // QScreen* oldScreen = windowHandle()->screen(); - // const bool shouldRecreate = windowHandle()->handle() && !(oldScreen && oldScreen->virtualSiblings().contains(newScreen)); - // Q_ASSERT(shouldRecreate == false); - - // NOTE: When you move a window to another screen, Qt 5 might recreate the window as needed - // But luckily, this never happen in XRandR, so Qt bug #40681 is not triggered here. - // (The only exception is when the old screen is destroyed, Qt always re-create the window and - // this corner case triggers #40681.) - // When using other kind of multihead settings, such as Xinerama, this might be different and - // unless Qt developers can fix their bug, we have no way to workaround that. - windowHandle()->setScreen(qApp->screens().at(screen)); - } - - realign(); -} - -/************************************************ - * - ************************************************/ -void LXQtPanel::setAlignment(Alignment value, bool save) -{ - if (mAlignment == value) - return; - - mAlignment = value; - - if (save) - saveSettings(true); - - realign(); -} - -/************************************************ - * - ************************************************/ -void LXQtPanel::setFontColor(QColor color, bool save) -{ - mFontColor = color; - updateStyleSheet(); - - if (save) - saveSettings(true); -} - -/************************************************ - - ************************************************/ -void LXQtPanel::setBackgroundColor(QColor color, bool save) -{ - mBackgroundColor = color; - updateStyleSheet(); - - if (save) - saveSettings(true); -} - -/************************************************ - - ************************************************/ -void LXQtPanel::setBackgroundImage(QString path, bool save) -{ - mBackgroundImage = path; - updateStyleSheet(); - - if (save) - saveSettings(true); -} - - -/************************************************ - * - ************************************************/ -void LXQtPanel::setOpacity(int opacity, bool save) -{ - mOpacity = opacity; - updateStyleSheet(); - - if (save) - saveSettings(true); -} - - -/************************************************ - * - ************************************************/ -void LXQtPanel::setReserveSpace(bool reserveSpace, bool save) -{ - if (mReserveSpace == reserveSpace) - return; - - mReserveSpace = reserveSpace; - - if (save) - saveSettings(true); - - updateWmStrut(); -} - - -/************************************************ - - ************************************************/ -QRect LXQtPanel::globalGometry() const -{ - return QRect(mapToGlobal(QPoint(0, 0)), this->size()); -} - - -/************************************************ - - ************************************************/ -bool LXQtPanel::event(QEvent *event) -{ - switch (event->type()) - { - case QEvent::ContextMenu: - showPopupMenu(); - break; - - case QEvent::LayoutRequest: - emit realigned(); - break; - - case QEvent::WinIdChange: - { - // qDebug() << "WinIdChange" << hex << effectiveWinId(); - if(effectiveWinId() == 0) - break; - - // Sometimes Qt needs to re-create the underlying window of the widget and - // the winId() may be changed at runtime. So we need to reset all X11 properties - // when this happens. - qDebug() << "WinIdChange" << hex << effectiveWinId() << "handle" << windowHandle() << windowHandle()->screen(); - - // Qt::WA_X11NetWmWindowTypeDock becomes ineffective in Qt 5 - // See QTBUG-39887: https://bugreports.qt-project.org/browse/QTBUG-39887 - // Let's use KWindowSystem for that - KWindowSystem::setType(effectiveWinId(), NET::Dock); - - updateWmStrut(); // reserve screen space for the panel - KWindowSystem::setOnAllDesktops(effectiveWinId(), true); - break; - } - case QEvent::DragEnter: - dynamic_cast(event)->setDropAction(Qt::IgnoreAction); - event->accept(); - //no break intentionally - case QEvent::Enter: - mShowDelayTimer.start(); - break; - - case QEvent::Leave: - case QEvent::DragLeave: - mShowDelayTimer.stop(); - hidePanel(); - break; - - default: - break; - } - - return QFrame::event(event); -} - -/************************************************ - - ************************************************/ - -void LXQtPanel::showEvent(QShowEvent *event) -{ - QFrame::showEvent(event); - realign(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::showPopupMenu(Plugin *plugin) -{ - PopupMenu * menu = new PopupMenu(tr("Panel"), this); - menu->setAttribute(Qt::WA_DeleteOnClose); - - menu->setIcon(XdgIcon::fromTheme("configure-toolbars")); - - // Plugin Menu .............................. - if (plugin) - { - QMenu *m = plugin->popupMenu(); - - if (m) - { - menu->addTitle(plugin->windowTitle()); - for (auto const & action : m->actions()) - { - action->setParent(menu); - action->setDisabled(mLockPanel); - menu->addAction(action); - } - delete m; - } - } - - // Panel menu ............................... - - menu->addTitle(QIcon(), tr("Panel")); - - menu->addAction(XdgIcon::fromTheme(QLatin1String("configure")), - tr("Configure Panel"), - this, SLOT(showConfigDialog()) - )->setDisabled(mLockPanel); - - menu->addAction(XdgIcon::fromTheme("preferences-plugin"), - tr("Manage Widgets"), - this, SLOT(showAddPluginDialog()) - )->setDisabled(mLockPanel); - - LXQtPanelApplication *a = reinterpret_cast(qApp); - menu->addAction(XdgIcon::fromTheme(QLatin1String("list-add")), - tr("Add New Panel"), - a, SLOT(addNewPanel()) - ); - - if (a->count() > 1) - { - menu->addAction(XdgIcon::fromTheme(QLatin1String("list-remove")), - tr("Remove Panel", "Menu Item"), - this, SLOT(userRequestForDeletion()) - )->setDisabled(mLockPanel); - } - - QAction * act_lock = menu->addAction(tr("Lock This Panel")); - act_lock->setCheckable(true); - act_lock->setChecked(mLockPanel); - connect(act_lock, &QAction::triggered, [this] { mLockPanel = !mLockPanel; saveSettings(false); }); - -#ifdef DEBUG - menu->addSeparator(); - menu->addAction("Exit (debug only)", qApp, SLOT(quit())); -#endif - - /* Note: in multihead & multipanel setup the QMenu::popup/exec places the window - * sometimes wrongly (it seems that this bug is somehow connected to misinterpretation - * of QDesktopWidget::availableGeometry) - */ - menu->setGeometry(calculatePopupWindowPos(QCursor::pos(), menu->sizeHint())); - willShowWindow(menu); - menu->show(); -} - -Plugin* LXQtPanel::findPlugin(const ILXQtPanelPlugin* iPlugin) const -{ - for (auto const & plug : mPlugins->plugins()) - if (plug->iPlugin() == iPlugin) - return plug; - return nullptr; -} - -/************************************************ - - ************************************************/ -QRect LXQtPanel::calculatePopupWindowPos(QPoint const & absolutePos, QSize const & windowSize) const -{ - int x = absolutePos.x(), y = absolutePos.y(); - - switch (position()) - { - case ILXQtPanel::PositionTop: - y = globalGometry().bottom(); - break; - - case ILXQtPanel::PositionBottom: - y = globalGometry().top() - windowSize.height(); - break; - - case ILXQtPanel::PositionLeft: - x = globalGometry().right(); - break; - - case ILXQtPanel::PositionRight: - x = globalGometry().left() - windowSize.width(); - break; - } - - QRect res(QPoint(x, y), windowSize); - - QRect screen = QApplication::desktop()->screenGeometry(this); - // NOTE: We cannot use AvailableGeometry() which returns the work area here because when in a - // multihead setup with different resolutions. In this case, the size of the work area is limited - // by the smallest monitor and may be much smaller than the current screen and we will place the - // menu at the wrong place. This is very bad for UX. So let's use the full size of the screen. - if (res.right() > screen.right()) - res.moveRight(screen.right()); - - if (res.bottom() > screen.bottom()) - res.moveBottom(screen.bottom()); - - if (res.left() < screen.left()) - res.moveLeft(screen.left()); - - if (res.top() < screen.top()) - res.moveTop(screen.top()); - - return res; -} - -/************************************************ - - ************************************************/ -QRect LXQtPanel::calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const QSize &windowSize) const -{ - Plugin *panel_plugin = findPlugin(plugin); - if (nullptr == panel_plugin) - { - qWarning() << Q_FUNC_INFO << "Wrong logic? Unable to find Plugin* for" << plugin << "known plugins follow..."; - for (auto const & plug : mPlugins->plugins()) - qWarning() << plug->iPlugin() << plug; - - return QRect(); - } - - return calculatePopupWindowPos(panel_plugin->mapToGlobal(QPoint(0, 0)), windowSize); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::willShowWindow(QWidget * w) -{ - mStandaloneWindows->observeWindow(w); -} - -/************************************************ - - ************************************************/ -QString LXQtPanel::qssPosition() const -{ - return positionToStr(position()); -} - -/************************************************ - - ************************************************/ -void LXQtPanel::pluginMoved(Plugin * plug) -{ - //get new position of the moved plugin - bool found{false}; - QString plug_is_before; - for (int i=0; icount(); ++i) - { - Plugin *plugin = qobject_cast(mLayout->itemAt(i)->widget()); - if (plugin) - { - if (found) - { - //we found our plugin in previous cycle -> is before this (or empty as last) - plug_is_before = plugin->settingsGroup(); - break; - } else - found = (plug == plugin); - } - } - mPlugins->movePlugin(plug, plug_is_before); -} - - -/************************************************ - - ************************************************/ -void LXQtPanel::userRequestForDeletion() -{ - const QMessageBox::StandardButton ret - = QMessageBox::warning(this, tr("Remove Panel", "Dialog Title") , - tr("Removing a panel can not be undone.\nDo you want to remove this panel?"), - QMessageBox::Yes | QMessageBox::No); - - if (ret != QMessageBox::Yes) { - return; - } - - mSettings->beginGroup(mConfigGroup); - QStringList plugins = mSettings->value("plugins").toStringList(); - mSettings->endGroup(); - - Q_FOREACH(QString i, plugins) - if (!i.isEmpty()) - mSettings->remove(i); - - mSettings->remove(mConfigGroup); - - emit deletedByUser(this); -} - -void LXQtPanel::showPanel(bool animate) -{ - if (mHidable) - { - mHideTimer.stop(); - if (mHidden) - { - mHidden = false; - setPanelGeometry(mAnimationTime > 0 && animate); - } - } -} - -void LXQtPanel::hidePanel() -{ - if (mHidable && !mHidden - && !mStandaloneWindows->isAnyWindowShown() - ) - mHideTimer.start(); -} - -void LXQtPanel::hidePanelWork() -{ - if (!geometry().contains(QCursor::pos())) - { - if (!mStandaloneWindows->isAnyWindowShown()) - { - mHidden = true; - setPanelGeometry(mAnimationTime > 0); - } else - { - mHideTimer.start(); - } - } -} - -void LXQtPanel::setHidable(bool hidable, bool save) -{ - if (mHidable == hidable) - return; - - mHidable = hidable; - - if (save) - saveSettings(true); - - realign(); -} - -void LXQtPanel::setAnimationTime(int animationTime, bool save) -{ - if (mAnimationTime == animationTime) - return; - - mAnimationTime = animationTime; - - if (save) - saveSettings(true); -} - -void LXQtPanel::setShowDelay(int showDelay, bool save) -{ - if (mShowDelayTimer.interval() == showDelay) - return; - - mShowDelayTimer.setInterval(showDelay); - - if (save) - saveSettings(true); -} - -bool LXQtPanel::isPluginSingletonAndRunnig(QString const & pluginId) const -{ - Plugin const * plugin = mPlugins->pluginByID(pluginId); - if (nullptr == plugin) - return false; - else - return plugin->iPlugin()->flags().testFlag(ILXQtPanelPlugin::SingleInstance); -} diff --git a/panel/lxqtpanel.h b/panel/lxqtpanel.h deleted file mode 100644 index 8b650d9..0000000 --- a/panel/lxqtpanel.h +++ /dev/null @@ -1,679 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTPANEL_H -#define LXQTPANEL_H - -#include -#include -#include -#include -#include -#include -#include "ilxqtpanel.h" -#include "lxqtpanelglobals.h" - -class QMenu; -class Plugin; -class QAbstractItemModel; - -namespace LXQt { -class Settings; -class PluginInfo; -} -class LXQtPanelLayout; -class ConfigPanelDialog; -class PanelPluginsModel; -class WindowNotifier; - -/*! \brief The LXQtPanel class provides a single lxqt-panel. All LXQtPanel - * instances should be created and handled by LXQtPanelApplication. In turn, - * all Plugins should be created and handled by LXQtPanels. - * - * LXQtPanel is just the panel, it does not incorporate any functionality. - * Each function of the panel is implemented by Plugins, even the mainmenu - * (plugin-mainmenu) and the taskbar (plugin-taskbar). So the LXQtPanel is - * just the container for several Plugins while the different Plugins - * incorporate the functions of the panel. Without the Plugins, the panel - * is quite useless because it is just a box occupying space on the screen. - * - * LXQtPanel itself is a window (QFrame/QWidget) and this class is mainly - * responsible for handling the size and position of this window on the - * screen(s) as well as the different settings. The handling of the plugins - * is outsourced in PanelPluginsModel and LXQtPanelLayout. PanelPluginsModel - * is responsible for loading/creating and handling the plugins. - * LXQtPanelLayout is inherited from QLayout and set as layout to the - * background of LXQtPanel, so LXQtPanelLayout is responsible for the - * layout of all the Plugins. - * - * \sa LXQtPanelApplication, Plugin, PanelPluginsModel, LXQtPanelLayout. - */ -class LXQT_PANEL_API LXQtPanel : public QFrame, public ILXQtPanel -{ - Q_OBJECT - - Q_PROPERTY(QString position READ qssPosition) - - // for configuration dialog - friend class ConfigPanelWidget; - friend class ConfigPluginsWidget; - friend class ConfigPanelDialog; - friend class PanelPluginsModel; - -public: - /** - * @brief Stores how the panel should be aligned. Obviously, this applies - * only if the panel does not occupy 100 % of the available space. If the - * panel is vertical, AlignmentLeft means align to the top border of the - * screen, AlignmentRight means align to the bottom. - */ - enum Alignment { - AlignmentLeft = -1, //!< Align the panel to the left or top - AlignmentCenter = 0, //!< Center the panel - AlignmentRight = 1 //!< Align the panel to the right or bottom - }; - - /** - * @brief Creates and initializes the LXQtPanel. Performs the following - * steps: - * 1. Sets Qt window title, flags, attributes. - * 2. Creates the panel layout. - * 3. Prepares the timers. - * 4. Connects signals and slots. - * 5. Reads the settings for this panel. - * 6. Optionally moves the panel to a valid screen (position-dependent). - * 7. Loads the Plugins. - * 8. Shows the panel, even if it is hidable (but then, starts the timer). - * @param configGroup The name of the panel which is used as identifier - * in the config file. - * @param settings The settings instance of this lxqt panel application. - * @param parent Parent QWidget, can be omitted. - */ - LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidget *parent = 0); - virtual ~LXQtPanel(); - - /** - * @brief Returns the name of this panel which is also used as identifier - * in the config file. - */ - QString name() { return mConfigGroup; } - - /** - * @brief Reads all the necessary settings from mSettings and stores them - * in local variables. Additionally, calls necessary methods like realign() - * or updateStyleSheet() which need to get called after changing settings. - */ - void readSettings(); - - /** - * @brief Creates and shows the popup menu (right click menu). If a plugin - * is given as parameter, the menu will be divided in two groups: - * plugin-specific options and panel-related options. As these two are - * shown together, this menu has to be created by LXQtPanel. - * @param plugin The plugin whose menu options will be included in the - * context menu. - */ - void showPopupMenu(Plugin *plugin = 0); - - // ILXQtPanel overrides ........ - ILXQtPanel::Position position() const override { return mPosition; } - QRect globalGometry() const override; - QRect calculatePopupWindowPos(QPoint const & absolutePos, QSize const & windowSize) const override; - QRect calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const QSize &windowSize) const override; - void willShowWindow(QWidget * w) override; - // ........ end of ILXQtPanel overrides - - /** - * @brief Searches for a Plugin in the Plugins-list of this panel. Takes - * an ILXQtPanelPlugin as parameter and returns the corresponding Plugin. - * @param iPlugin ILXQtPanelPlugin that we are looking for. - * @return The corresponding Plugin if it is loaded in this panel, nullptr - * otherwise. - */ - Plugin *findPlugin(const ILXQtPanelPlugin *iPlugin) const; - - // For QSS properties .................. - /** - * @brief Returns the position as string - * - * \sa positionToStr(). - */ - QString qssPosition() const; - - /** - * @brief Checks if this LXQtPanel can be placed at a given position - * on the screen with the given screenNum. The condition for doing so - * is that the panel is not located between two screens. - * - * For example, if position is PositionRight, there should be no screen to - * the right of the given screen. That means that there should be no - * screen whose left border has a higher x-coordinate than the x-coordinate - * of the right border of the given screen. This method iterates over all - * screens and checks these conditions. - * @param screenNum screen index as it is used by QDesktopWidget methods - * @param position position where the panel should be placed - * @return true if this panel can be placed at the given position on the - * given screen. - * - * \sa findAvailableScreen(), mScreenNum, mActualScreenNum. - */ - static bool canPlacedOn(int screenNum, LXQtPanel::Position position); - /** - * @brief Returns a string representation of the given position. This - * string is human-readable and can be used in config files. - * @param position position that should be converted to a string. - * @return the string representation of the given position, i.e. - * "Top", "Left", "Right" or "Bottom". - * - * \sa strToPosition() - */ - static QString positionToStr(ILXQtPanel::Position position); - /** - * @brief Returns an ILXQtPanel::Position from the given string. This can - * be used to retrieve ILXQtPanel::Position values from the config files. - * @param str string that should be converted to ILXQtPanel::Position - * @param defaultValue value that will be returned if the string can not - * be converted to an ILXQtPanel::Position. - * @return ILXQtPanel::Position that was determined from str or - * defaultValue if str could not be converted. - * - * \sa positionToStr() - */ - static ILXQtPanel::Position strToPosition(const QString &str, ILXQtPanel::Position defaultValue); - - // Settings - int iconSize() const override { return mIconSize; } //!< Implement ILXQtPanel::iconSize(). - int lineCount() const override { return mLineCount; } //!< Implement ILXQtPanel::lineCount(). - int panelSize() const { return mPanelSize; } - int length() const { return mLength; } - bool lengthInPercents() const { return mLengthInPercents; } - LXQtPanel::Alignment alignment() const { return mAlignment; } - int screenNum() const { return mScreenNum; } - QColor fontColor() const { return mFontColor; } - QColor backgroundColor() const { return mBackgroundColor; } - QString backgroundImage() const { return mBackgroundImage; } - int opacity() const { return mOpacity; } - int reserveSpace() const { return mReserveSpace; } - bool hidable() const { return mHidable; } - int animationTime() const { return mAnimationTime; } - int showDelay() const { return mShowDelayTimer.interval(); } - - /*! - * \brief Checks if a given Plugin is running and has the - * ILXQtPanelPlugin::SingleInstance flag set. - * \param pluginId Plugin Identifier which is the basename of the - * .desktop file that specifies the plugin. - * \return true if the Plugin is running and has the - * ILXQtPanelPlugin::SingleInstance flag set, false otherwise. - */ - bool isPluginSingletonAndRunnig(QString const & pluginId) const; - -public slots: - /** - * @brief Shows the QWidget and makes it visible on all desktops. This - * method is NOT related to showPanel(), hidePanel() and hidePanelWork() - * which handle the LXQt hiding by resizing the panel. - */ - void show(); - /** - * @brief Shows the panel (immediately) after it had been hidden before. - * Stops the QTimer mHideTimer. This it NOT the same as QWidget::show() - * because hiding the panel in LXQt is done by making it very thin. So - * this method in fact restores the original size of the panel. - * \param animate flag for the panel show-up animation disabling (\sa mAnimationTime). - * - * \sa mHidable, mHidden, mHideTimer, hidePanel(), hidePanelWork() - */ - void showPanel(bool animate); - /** - * @brief Hides the panel (delayed) by starting the QTimer mHideTimer. - * When this timer times out, hidePanelWork() will be called. So this - * method is called when the cursor leaves the panel area but the panel - * will be hidden later. - * - * \sa mHidable, mHidden, mHideTimer, showPanel(), hidePanelWork() - */ - void hidePanel(); - /** - * @brief Actually hides the panel. Will be invoked when the QTimer - * mHideTimer times out. That timer will be started by showPanel(). This - * is NOT the same as QWidget::hide() because hiding the panel in LXQt is - * done by making the panel very thin. So this method in fact makes the - * panel very thin while the QWidget stays visible. - * - * \sa mHidable, mHidden, mHideTimer, showPanel(), hidePanel() - */ - void hidePanelWork(); - - // Settings - /** - * @brief All the setter methods are designed similar: - * 1. Check if the given value is different from the current value. If not, - * do not do anything and return. - * 2. Set the value. - * 3. If parameter save is true, call saveSettings(true) to store the - * new settings on the disk. - * 4. If necessary, propagate the new value to child objects, e.g. to - * mLayout. - * 5. If necessary, call update methods like realign() or - * updateStyleSheet(). - * @param value The value that should be set. - * @param save If true, saveSettings(true) will be called. - */ - void setPanelSize(int value, bool save); - void setIconSize(int value, bool save); //!< \sa setPanelSize() - void setLineCount(int value, bool save); //!< \sa setPanelSize() - void setLength(int length, bool inPercents, bool save); //!< \sa setPanelSize() - void setPosition(int screen, ILXQtPanel::Position position, bool save); //!< \sa setPanelSize() - void setAlignment(LXQtPanel::Alignment value, bool save); //!< \sa setPanelSize() - void setFontColor(QColor color, bool save); //!< \sa setPanelSize() - void setBackgroundColor(QColor color, bool save); //!< \sa setPanelSize() - void setBackgroundImage(QString path, bool save); //!< \sa setPanelSize() - void setOpacity(int opacity, bool save); //!< \sa setPanelSize() - void setReserveSpace(bool reserveSpace, bool save); //!< \sa setPanelSize() - void setHidable(bool hidable, bool save); //!< \sa setPanelSize() - void setAnimationTime(int animationTime, bool save); //!< \sa setPanelSize() - void setShowDelay(int showDelay, bool save); //!< \sa setPanelSize() - - /** - * @brief Saves the current configuration, i.e. writes the current - * configuration varibles to mSettings. - * @param later Determines if the settings are written immediately or - * after a short delay. If later==true, the QTimer mDelaySave is started. - * As soon as this timer times out, saveSettings(false) will be called. If - * later==false, settings will be written. - */ - void saveSettings(bool later=false); - /** - * @brief Checks if the panel can be placed on the current screen at the - * current position. If it can not, it will be moved on another screen - * where the desired position is possible. - */ - void ensureVisible(); - -signals: - /** - * @brief This signal gets emitted whenever this panel receives a - * QEvent::LayoutRequest, i.e. "Widget layout needs to be redone.". - * The PanelPluginsModel will connect this signal to the individual - * plugins so they can realign, too. - */ - void realigned(); - /** - * @brief This signal gets emitted at the end of - * userRequestForDeletion() which in turn gets called when the user - * decides to remove a panel. This signal is used by - * LXQtPanelApplication to get notified whenever an LXQtPanel should - * be removed. - * @param self This LXQtPanel. LXQtPanelApplication will use this - * parameter to identify the LXQtPanel that should be removed. - */ - void deletedByUser(LXQtPanel *self); - /** - * @brief This signal is just a relay signal. The pluginAdded signal - * of the PanelPluginsModel (mPlugins) will be connected to this - * signal. Thereby, we can make this signal of a private member - * available as a public signal. - * Currently, this signal is used by LXQtPanelApplication which - * will further re-emit this signal. - */ - void pluginAdded(); - /** - * @brief This signal is just a relay signal. The pluginRemoved signal - * of the PanelPluginsModel (mPlugins) will be connected to this - * signal. Thereby, we can make this signal of a private member - * available as a public signal. - * Currently, this signal is used by LXQtPanelApplication which - * will further re-emit this signal. - */ - void pluginRemoved(); - -protected: - /** - * @brief Overrides QObject::event(QEvent * e). Some functions of - * the panel will be triggered by these events, e.g. showing/hiding - * the panel or showing the context menu. - * @param event The event that was received. - * @return "QObject::event(QEvent *e) should return true if the event e - * was recognized and processed." This is done by passing the event to - * QFrame::event(QEvent *e) at the end. - */ - bool event(QEvent *event) override; - /** - * @brief Overrides QWidget::showEvent(QShowEvent * event). This - * method is called when a widget (in this case: the LXQtPanel) is - * shown. The call could happen before and after the widget is shown. - * This method is just overridden to get notified when the LXQtPanel - * will be shown. Then, LXQtPanel will call realign(). - * @param event The QShowEvent sent by Qt. - */ - void showEvent(QShowEvent *event) override; - -public slots: - /** - * @brief Shows the ConfigPanelDialog and shows the "Config Panel" - * page, i.e. calls showConfigPanelPage(). If the dialog does not - * exist yet, it will be created before. - * - * The "Configure Panel" button in the context menu of the panel will - * be connected to this slot so this method gets called whenever the - * user clicks that button. - * - * Furthermore, this method will be called by LXQtPanelApplication - * when a new plugin gets added (the LXQtPanel instances are handled - * by LXQtPanelApplication). That is why this method/slot has to be - * public. - */ - void showConfigDialog(); - -private slots: - /** - * @brief Shows the ConfigPanelDialog and shows the "Config Plugins" - * page, i.e. calls showConfigPluginsPage(). If the dialog does not - * exist yet, it will be created before. - * - * The "Manage Widgets" button in the context menu of the panel will - * be connected to this slot so this method gets called whenever the - * user clicks that button. - */ - void showAddPluginDialog(); - /** - * @brief Recalculates the geometry of the panel and reserves the - * window manager strut, i.e. it calls setPanelGeometry() and - * updateWmStrut(). - * Two signals will be connected to this slot: - * 1. QDesktopWidget::workAreaResized(int screen) which will be emitted - * when the work area available (on screen) changes. - * 2. LXQt::Application::themeChanged(), i.e. when the user changes - * the theme. - */ - void realign(); - /** - * @brief Moves a plugin in PanelPluginsModel, i.e. calls - * PanelPluginsModel::movePlugin(Plugin * plugin, QString const & nameAfter). - * LXQtPanelLayout::pluginMoved() will be connected to this slot so - * it gets called whenever a plugin was moved in the layout by the user. - * @param plug - */ - void pluginMoved(Plugin * plug); - /** - * @brief Removes this panel's entries from the config file and emits - * the deletedByUser signal. - * The "Remove Panel" button in the panel's contex menu will - * be connected to this slot, so this method will be called whenever - * the user clicks "Remove Panel". - */ - void userRequestForDeletion(); - -private: - /** - * @brief The LXQtPanelLayout of this panel. All the Plugins will be added - * to the UI via this layout. - */ - LXQtPanelLayout* mLayout; - /** - * @brief The LXQt::Settings instance as retrieved from - * LXQtPanelApplication. - */ - LXQt::Settings *mSettings; - /** - * @brief The background widget for the panel. This background widget will - * have the background color or the background image if any of these is - * set. This background widget will have the LXQtPanelLayout mLayout which - * will in turn contain all the Plugins. - */ - QFrame *LXQtPanelWidget; - /** - * @brief The name of the panel which will also be used as an identifier - * for config files. - */ - QString mConfigGroup; - /** - * @brief Pointer to the PanelPluginsModel which will store all the Plugins - * that are loaded. - */ - QScopedPointer mPlugins; - /** - * @brief object for storing info if some standalone window is shown - * (for preventing hide) - */ - QScopedPointer mStandaloneWindows; - - /** - * @brief Returns the screen index of a screen on which this panel could - * be placed at the given position. If possible, the current screen index - * is preserved. So, if the panel can be placed on the current screen, the - * index of that screen will be returned. - * @param position position at which the panel should be placed. - * @return The current screen index if the panel can be placed on the - * current screen or the screen index of a screen that it can be placed on. - * - * \sa canPlacedOn(), mScreenNum, mActualScreenNum. - */ - int findAvailableScreen(LXQtPanel::Position position); - /** - * @brief Update the window manager struts _NET_WM_PARTIAL_STRUT and - * _NET_WM_STRUT for this widget. "The purpose of struts is to reserve - * space at the borders of the desktop. This is very useful for a - * docking area, a taskbar or a panel, for instance. The Window Manager - * should take this reserved area into account when constraining window - * positions - maximized windows, for example, should not cover that - * area." - * \sa http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#NETWMSTRUT - */ - void updateWmStrut(); - - /** - * @brief Loads the plugins, i.e. creates a new PanelPluginsModel. - * Connects the signals and slots and adds all the plugins to the - * layout. - */ - void loadPlugins(); - - /** - * @brief Calculates and sets the geometry (i.e. the position and the size - * on the screen) of the panel. Considers alignment, position, if the panel - * is hidden and if its geometry should be set with animation. - * \param animate flag if showing/hiding the panel should be animated. - */ - void setPanelGeometry(bool animate = false); - /** - * @brief Sets the contents margins of the panel according to its position - * and hiddenness. All margins are zero for visible panels. - */ - void setMargins(); - /** - * @brief Calculates the height of the panel if it is horizontal or the - * width if the panel is vertical. Considers if the panel is hidden and - * ensures that the result is at least PANEL_MINIMUM_SIZE. - * @return The height/width of the panel. - */ - int getReserveDimension(); - - /** - * @brief Stores the size of the panel, i.e. the height of a horizontal - * panel or the width of a vertical panel in pixels. If the panel is - * hidden (which is achieved by making the panel very thin), this value - * is unchanged. So this value stores the size of the non-hidden panel. - * - * \sa panelSize(), setPanelSize(). - */ - int mPanelSize; - /** - * @brief Stores the edge length of the panel icons in pixels. - * - * \sa ILXQtPanel::iconSize(), setIconSize(). - */ - int mIconSize; - /** - * @brief Stores the number of lines/rows of the panel. - * - * \sa ILXQtPanel::lineCount(), setLineCount(). - */ - int mLineCount; - - /** - * @brief Stores the length of the panel, i.e. the width of a horizontal - * panel or the height of a vertical panel. The unit of this value is - * determined by mLengthInPercents. - * - * \sa mLengthInPercents - */ - int mLength; - /** - * @brief Stores if mLength is stored in pixels or relative to the - * screen size in percents. If true, the length is stored in percents, - * otherwise in pixels. - * - * \sa mLength - */ - bool mLengthInPercents; - - /** - * @brief Stores how this panel is aligned. The meaning of this value - * differs for horizontal and vertical panels. - * - * \sa Alignment. - */ - Alignment mAlignment; - - /** - * @brief Stores the position where the panel is shown - */ - ILXQtPanel::Position mPosition; - /** - * @brief Returns the index of the screen on which this panel should be - * shown. This is the user configured value which can differ from the - * screen that the panel is actually shown on. If the panel can not be - * shown on the configured screen, LXQtPanel will determine another - * screen. The screen that the panel is actually shown on is stored in - * mActualScreenNum. - * - * @return The index of the screen on which this panel should be shown. - * - * \sa mActualScreenNum, canPlacedOn(), findAvailableScreen(). - */ - int mScreenNum; - /** - * @brief screen that the panel is currently shown at (this could - * differ from mScreenNum). - * - * \sa mScreenNum, canPlacedOn(), findAvailableScreen(). - */ - int mActualScreenNum; - /** - * @brief QTimer for delayed saving of changed settings. In many cases, - * instead of storing changes to disk immediately we start this timer. - * If this timer times out, we store the changes to disk. This has the - * advantage that we can store a couple of changes with only one write to - * disk. - * - * \sa saveSettings() - */ - QTimer mDelaySave; - /** - * @brief Stores if the panel is hidable, i.e. if the panel will be - * hidden after the cursor has left the panel area. - * - * \sa mHidden, mHideTimer, showPanel(), hidePanel(), hidePanelWork() - */ - bool mHidable; - /** - * @brief Stores if the panel is currently hidden. - * - * \sa mHidable, mHideTimer, showPanel(), hidePanel(), hidePanelWork() - */ - bool mHidden; - /** - * @brief QTimer for hiding the panel. When the cursor leaves the panel - * area, this timer will be started. After this timer has timed out, the - * panel will actually be hidden. - * - * \sa mHidable, mHidden, showPanel(), hidePanel(), hidePanelWork() - */ - QTimer mHideTimer; - /** - * @brief Stores the duration of auto-hide animation. - * - * \sa mHidden, mHideTimer, showPanel(), hidePanel(), hidePanelWork() - */ - int mAnimationTime; - /** - * @brief The timer used for showing an auto-hiding panel wih delay. - * - * \sa showPanel() - */ - QTimer mShowDelayTimer; - - QColor mFontColor; //!< Font color that is used in the style sheet. - QColor mBackgroundColor; //!< Background color that is used in the style sheet. - QString mBackgroundImage; //!< Background image that is used in the style sheet. - /** - * @brief Determines the opacity of the background color. The value - * should be in the range from 0 to 100. This will not affect the opacity - * of a background image. - */ - int mOpacity; - /*! - * \brief Flag if the panel should reserve the space under it as not usable - * for "normal" windows. Usable for not 100% wide/hight or hiddable panels, - * if user wants maximized windows go under the panel. - * - * \sa updateWmStrut() - */ - bool mReserveSpace; - - /** - * @brief Pointer to the current ConfigPanelDialog if there is any. Make - * sure to test this pointer for validity because it is lazily loaded. - */ - QPointer mConfigDialog; - - /** - * @brief The animation used for showing/hiding an auto-hiding panel. - */ - QPropertyAnimation *mAnimation; - - /** - * @brief Flag for providing the configuration options in panel's context menu - */ - bool mLockPanel; - - /** - * @brief Updates the style sheet for the panel. First, the stylesheet is - * created from the preferences. Then, it is set via - * QWidget::setStyleSheet(). - */ - void updateStyleSheet(); - - // settings should be kept private for security - LXQt::Settings *settings() const { return mSettings; } -}; - - -#endif // LXQTPANEL_H diff --git a/panel/lxqtpanelapplication.cpp b/panel/lxqtpanelapplication.cpp deleted file mode 100644 index 8625126..0000000 --- a/panel/lxqtpanelapplication.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtpanelapplication.h" -#include "lxqtpanelapplication_p.h" -#include "lxqtpanel.h" -#include "config/configpaneldialog.h" -#include -#include -#include -#include -#include -#include - -LXQtPanelApplicationPrivate::LXQtPanelApplicationPrivate(LXQtPanelApplication *q) - : mSettings(0), - q_ptr(q) -{ -} - - -ILXQtPanel::Position LXQtPanelApplicationPrivate::computeNewPanelPosition(const LXQtPanel *p, const int screenNum) -{ - Q_Q(LXQtPanelApplication); - QVector screenPositions(4, false); // false means not occupied - - for (int i = 0; i < q->mPanels.size(); ++i) { - if (p != q->mPanels.at(i)) { - // We are not the newly added one - if (screenNum == q->mPanels.at(i)->screenNum()) { // Panels on the same screen - int p = static_cast (q->mPanels.at(i)->position()); - screenPositions[p] = true; // occupied - } - } - } - - int availablePosition = 0; - - for (int i = 0; i < 4; ++i) { // Bottom, Top, Left, Right - if (!screenPositions[i]) { - availablePosition = i; - break; - } - } - - return static_cast (availablePosition); -} - -LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv) - : LXQt::Application(argc, argv, true), - d_ptr(new LXQtPanelApplicationPrivate(this)) - -{ - Q_D(LXQtPanelApplication); - - QCoreApplication::setApplicationName(QLatin1String("lxqt-panel")); - const QString VERINFO = QStringLiteral(LXQT_PANEL_VERSION - "\nliblxqt " LXQT_VERSION - "\nQt " QT_VERSION_STR); - - QCoreApplication::setApplicationVersion(VERINFO); - - QCommandLineParser parser; - parser.setApplicationDescription(QLatin1String("LXQt Panel")); - parser.addHelpOption(); - parser.addVersionOption(); - - QCommandLineOption configFileOption(QStringList() - << QLatin1String("c") << QLatin1String("config") << QLatin1String("configfile"), - QCoreApplication::translate("main", "Use alternate configuration file."), - QCoreApplication::translate("main", "Configuration file")); - parser.addOption(configFileOption); - - parser.process(*this); - - const QString configFile = parser.value(configFileOption); - - if (configFile.isEmpty()) - d->mSettings = new LXQt::Settings(QLatin1String("panel"), this); - else - d->mSettings = new LXQt::Settings(configFile, QSettings::IniFormat, this); - - // This is a workaround for Qt 5 bug #40681. - Q_FOREACH(QScreen* screen, screens()) - { - connect(screen, &QScreen::destroyed, this, &LXQtPanelApplication::screenDestroyed); - } - connect(this, &QGuiApplication::screenAdded, this, &LXQtPanelApplication::handleScreenAdded); - connect(this, &QCoreApplication::aboutToQuit, this, &LXQtPanelApplication::cleanup); - - - QStringList panels = d->mSettings->value("panels").toStringList(); - - if (panels.isEmpty()) - { - panels << "panel1"; - } - - Q_FOREACH(QString i, panels) - { - addPanel(i); - } -} - -LXQtPanelApplication::~LXQtPanelApplication() -{ - delete d_ptr; -} - -void LXQtPanelApplication::cleanup() -{ - qDeleteAll(mPanels); -} - -void LXQtPanelApplication::addNewPanel() -{ - Q_D(LXQtPanelApplication); - - QString name("panel_" + QUuid::createUuid().toString()); - - LXQtPanel *p = addPanel(name); - int screenNum = p->screenNum(); - ILXQtPanel::Position newPanelPosition = d->computeNewPanelPosition(p, screenNum); - p->setPosition(screenNum, newPanelPosition, true); - QStringList panels = d->mSettings->value("panels").toStringList(); - panels << name; - d->mSettings->setValue("panels", panels); - - // Poupup the configuration dialog to allow user configuration right away - p->showConfigDialog(); -} - -LXQtPanel* LXQtPanelApplication::addPanel(const QString& name) -{ - Q_D(LXQtPanelApplication); - - LXQtPanel *panel = new LXQtPanel(name, d->mSettings); - mPanels << panel; - - // reemit signals - connect(panel, &LXQtPanel::deletedByUser, this, &LXQtPanelApplication::removePanel); - connect(panel, &LXQtPanel::pluginAdded, this, &LXQtPanelApplication::pluginAdded); - connect(panel, &LXQtPanel::pluginRemoved, this, &LXQtPanelApplication::pluginRemoved); - - return panel; -} - -void LXQtPanelApplication::handleScreenAdded(QScreen* newScreen) -{ - // qDebug() << "LXQtPanelApplication::handleScreenAdded" << newScreen; - connect(newScreen, &QScreen::destroyed, this, &LXQtPanelApplication::screenDestroyed); -} - -void LXQtPanelApplication::reloadPanelsAsNeeded() -{ - Q_D(LXQtPanelApplication); - - // NOTE by PCMan: This is a workaround for Qt 5 bug #40681. - // Here we try to re-create the missing panels which are deleted in - // LXQtPanelApplication::screenDestroyed(). - - // qDebug() << "LXQtPanelApplication::reloadPanelsAsNeeded()"; - QStringList names = d->mSettings->value("panels").toStringList(); - Q_FOREACH(const QString& name, names) - { - bool found = false; - Q_FOREACH(LXQtPanel* panel, mPanels) - { - if(panel->name() == name) - { - found = true; - break; - } - } - if(!found) - { - // the panel is found in the config file but does not exist, create it. - qDebug() << "Workaround Qt 5 bug #40681: re-create panel:" << name; - addPanel(name); - } - } - qApp->setQuitOnLastWindowClosed(true); -} - -void LXQtPanelApplication::screenDestroyed(QObject* screenObj) -{ - // NOTE by PCMan: This is a workaround for Qt 5 bug #40681. - // With this very dirty workaround, we can fix lxde/lxde-qt bug #204, #205, and #206. - // Qt 5 has two new regression bugs which breaks lxqt-panel in a multihead environment. - // #40681: Regression bug: QWidget::winId() returns old value and QEvent::WinIdChange event is not emitted sometimes. (multihead setup) - // #40791: Regression: QPlatformWindow, QWindow, and QWidget::winId() are out of sync. - // Explanations for the workaround: - // Internally, Qt mantains a list of QScreens and update it when XRandR configuration changes. - // When the user turn off an monitor with xrandr --output --off, this will destroy the QScreen - // object which represent the output. If the QScreen being destroyed contains our panel widget, - // Qt will call QWindow::setScreen(0) on the internal windowHandle() of our panel widget to move it - // to the primary screen. However, moving a window to a different screen is more than just changing - // its position. With XRandR, all screens are actually part of the same virtual desktop. However, - // this is not the case in other setups, such as Xinerama and moving a window to another screen is - // not possible unless you destroy the widget and create it again for a new screen. - // Therefore, Qt destroy the widget and re-create it when moving our panel to a new screen. - // Unfortunately, destroying the window also destroy the child windows embedded into it, - // using XEMBED such as the tray icons. (#206) - // Second, when the window is re-created, the winId of the QWidget is changed, but Qt failed to - // generate QEvent::WinIdChange event so we have no way to know that. We have to set - // some X11 window properties using the native winId() to make it a dock, but this stop working - // because we cannot get the correct winId(), so this causes #204 and #205. - // - // The workaround is very simple. Just completely destroy the panel before Qt has a chance to do - // QWindow::setScreen() for it. Later, we reload the panel ourselves. So this can bypassing the Qt bugs. - QScreen* screen = static_cast(screenObj); - bool reloadNeeded = false; - qApp->setQuitOnLastWindowClosed(false); - Q_FOREACH(LXQtPanel* panel, mPanels) - { - QWindow* panelWindow = panel->windowHandle(); - if(panelWindow && panelWindow->screen() == screen) - { - // the screen containing the panel is destroyed - // delete and then re-create the panel ourselves - QString name = panel->name(); - panel->saveSettings(false); - delete panel; // delete the panel, so Qt does not have a chance to set a new screen to it. - mPanels.removeAll(panel); - reloadNeeded = true; - qDebug() << "Workaround Qt 5 bug #40681: delete panel:" << name; - } - } - if(reloadNeeded) - QTimer::singleShot(1000, this, SLOT(reloadPanelsAsNeeded())); - else - qApp->setQuitOnLastWindowClosed(true); -} - -void LXQtPanelApplication::removePanel(LXQtPanel* panel) -{ - Q_D(LXQtPanelApplication); - Q_ASSERT(mPanels.contains(panel)); - - mPanels.removeAll(panel); - - QStringList panels = d->mSettings->value("panels").toStringList(); - panels.removeAll(panel->name()); - d->mSettings->setValue("panels", panels); - - panel->deleteLater(); -} - -bool LXQtPanelApplication::isPluginSingletonAndRunnig(QString const & pluginId) const -{ - for (auto const & panel : mPanels) - if (panel->isPluginSingletonAndRunnig(pluginId)) - return true; - - return false; -} diff --git a/panel/lxqtpanelapplication.h b/panel/lxqtpanelapplication.h deleted file mode 100644 index 728538c..0000000 --- a/panel/lxqtpanelapplication.h +++ /dev/null @@ -1,183 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTPANELAPPLICATION_H -#define LXQTPANELAPPLICATION_H - -#include -#include "ilxqtpanelplugin.h" - -class QScreen; - -class LXQtPanel; -class LXQtPanelApplicationPrivate; - -/*! - * \brief The LXQtPanelApplication class inherits from LXQt::Application and - * is therefore the QApplication that we will create and execute in our - * main()-function. - * - * LXQtPanelApplication itself is not a visible panel, rather it is only - * the container which holds the visible panels. These visible panels are - * LXQtPanel objects which are stored in mPanels. This approach enables us - * to have more than one panel (for example one panel at the top and one - * panel at the bottom of the screen) without additional effort. - */ -class LXQtPanelApplication : public LXQt::Application -{ - Q_OBJECT -public: - /*! - * \brief Creates a new LXQtPanelApplication with the given command line - * arguments. Performs the following steps: - * 1. Initializes the LXQt::Application, sets application name and version. - * 2. Handles command line arguments. Currently, the only cmdline argument - * is -c = -config = -configfile which chooses a different config file - * for the LXQt::Settings. - * 3. Creates the LXQt::Settings. - * 4. Connects QCoreApplication::aboutToQuit to cleanup(). - * 5. Calls addPanel() for each panel found in the config file. If there is - * none, adds a new panel. - * \param argc - * \param argv - */ - explicit LXQtPanelApplication(int& argc, char** argv); - ~LXQtPanelApplication(); - - /*! - * \brief Determines the number of LXQtPanel objects - * \return the current number of LXQtPanel objects - */ - int count() { return mPanels.count(); } - - /*! - * \brief Checks if a given Plugin is running and has the - * ILXQtPanelPlugin::SingleInstance flag set. As Plugins are added to - * LXQtPanel instances, this method only iterates over these LXQtPanel - * instances and lets them check the conditions. - * \param pluginId Plugin Identifier which is the basename of the .desktop - * file that specifies the plugin. - * \return true if the Plugin is running and has the - * ILXQtPanelPlugin::SingleInstance flag set, false otherwise. - */ - bool isPluginSingletonAndRunnig(QString const & pluginId) const; - -public slots: - /*! - * \brief Adds a new LXQtPanel which consists of the following steps: - * 1. Create id/name. - * 2. Create the LXQtPanel: call addPanel(name). - * 3. Update the config file (add the new panel id to the list of panels). - * 4. Show the panel configuration dialog so that the user can add plugins. - * - * This method will create a new LXQtPanel with a new name and add this - * to the config file. So this should only be used while the application - * is running and the user decides to add a new panel. At application - * startup, addPanel() should be used instead. - * - * \note This slot will be used from the LXQtPanel right-click menu. As we - * can only add new panels from a visible panel, we should never run - * lxqt-panel without an LXQtPanel. Without a panel, we have just an - * invisible application. - */ - void addNewPanel(); - -signals: - /*! - * \brief Signal that re-emits the signal pluginAdded() from LXQtPanel. - */ - void pluginAdded(); - /*! - * \brief Signal that re-emits the signal pluginRemoved() from LXQtPanel. - */ - void pluginRemoved(); - -private: - /*! - * \brief Holds all the instances of LXQtPanel. - */ - QList mPanels; - /*! - * \brief Creates a new LXQtPanel with the given name and connects the - * appropriate signals and slots. - * This method can be used at application startup. - * \param name Name of the LXQtPanel as it is used in the config file. - * \return The newly created LXQtPanel. - */ - LXQtPanel* addPanel(const QString &name); - -private slots: - /*! - * \brief Removes the given LXQtPanel which consists of the following - * steps: - * 1. Remove the panel from mPanels. - * 2. Remove the panel from the config file. - * 3. Schedule the QObject for deletion: QObject::deleteLater(). - * \param panel LXQtPanel instance that should be removed. - */ - void removePanel(LXQtPanel* panel); - - /*! - * \brief Connects the QScreen::destroyed signal of a new screen to - * the screenDestroyed() slot so that we can handle this screens' - * destruction as soon as it happens. - * \param newScreen The QScreen that was created and added. - */ - void handleScreenAdded(QScreen* newScreen); - /*! - * \brief Handles screen destruction. This is a workaround for a Qt bug. - * For further information, see the implementation notes. - * \param screenObj The QScreen that was destroyed. - */ - void screenDestroyed(QObject* screenObj); - /*! - * \brief Reloads the panels. This is the second part of the workaround - * mentioned above. - */ - void reloadPanelsAsNeeded(); - /*! - * \brief Deletes all LXQtPanel instances that are stored in mPanels. - */ - void cleanup(); - -private: - /*! - * \brief mSettings is the LXQt::Settings object that is used for the - * current instance of lxqt-panel. Normally, this refers to the config file - * $HOME/.config/lxqt/panel.conf (on Unix systems). This behaviour can be - * changed with the -c command line option. - */ - - LXQtPanelApplicationPrivate *const d_ptr; - - Q_DECLARE_PRIVATE(LXQtPanelApplication) - Q_DISABLE_COPY(LXQtPanelApplication) -}; - - -#endif // LXQTPANELAPPLICATION_H diff --git a/panel/lxqtpanelapplication_p.h b/panel/lxqtpanelapplication_p.h deleted file mode 100644 index 4dd2618..0000000 --- a/panel/lxqtpanelapplication_p.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * LXQt - a lightweight, Qt based, desktop toolset - * Copyright (C) 2016 Luís Pereira - * - * 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 - */ - -#ifndef LXQTPANELAPPLICATION_P_H -#define LXQTPANELAPPLICATION_P_H - -#include "lxqtpanelapplication.h" - -namespace LXQt { -class Settings; -} - -class LXQtPanelApplicationPrivate { - Q_DECLARE_PUBLIC(LXQtPanelApplication) -public: - - LXQtPanelApplicationPrivate(LXQtPanelApplication *q); - ~LXQtPanelApplicationPrivate() {}; - - LXQt::Settings *mSettings; - - ILXQtPanel::Position computeNewPanelPosition(const LXQtPanel *p, const int screenNum); - -private: - LXQtPanelApplication *const q_ptr; -}; - -#endif // LXQTPANELAPPLICATION_P_H diff --git a/panel/lxqtpanelglobals.h b/panel/lxqtpanelglobals.h deleted file mode 100644 index 36da6a7..0000000 --- a/panel/lxqtpanelglobals.h +++ /dev/null @@ -1,39 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxde.org/ - * - * Copyright: 2013 LXDE-Qt team - * Authors: - * Hong Jen Yee (PCMan) - * - * 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 __LXQT_PANEL_GLOBALS_H__ -#define __LXQT_PANEL_GLOBALS_H__ - -#include - -#ifdef COMPILE_LXQT_PANEL -#define LXQT_PANEL_API Q_DECL_EXPORT -#else -#define LXQT_PANEL_API Q_DECL_IMPORT -#endif - -#endif // __LXQT_PANEL_GLOBALS_H__ diff --git a/panel/lxqtpanellayout.cpp b/panel/lxqtpanellayout.cpp deleted file mode 100644 index add12d2..0000000 --- a/panel/lxqtpanellayout.cpp +++ /dev/null @@ -1,1059 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtpanellayout.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "plugin.h" -#include "lxqtpanellimits.h" -#include "ilxqtpanelplugin.h" -#include "lxqtpanel.h" -#include "pluginmoveprocessor.h" -#include -#include - -#define ANIMATION_DURATION 250 - -class ItemMoveAnimation : public QVariantAnimation -{ -public: - ItemMoveAnimation(QLayoutItem *item) : - mItem(item) - { - setEasingCurve(QEasingCurve::OutBack); - setDuration(ANIMATION_DURATION); - } - - void updateCurrentValue(const QVariant ¤t) - { - mItem->setGeometry(current.toRect()); - } - -private: - QLayoutItem* mItem; - -}; - - -struct LayoutItemInfo -{ - LayoutItemInfo(QLayoutItem *layoutItem=0); - QLayoutItem *item; - QRect geometry; - bool separate; - bool expandable; -}; - - -LayoutItemInfo::LayoutItemInfo(QLayoutItem *layoutItem): - item(layoutItem), - separate(false), - expandable(false) -{ - if (!item) - return; - - Plugin *p = qobject_cast(item->widget()); - if (p) - { - separate = p->isSeparate(); - expandable = p->isExpandable(); - return; - } -} - - - -/************************************************ - This is logical plugins grid, it's same for - horizontal and vertical panel. Plugins keeps as: - - <---LineCount--> - + ---+----+----+ - | P1 | P2 | P3 | - +----+----+----+ - | P4 | P5 | | - +----+----+----+ - ... - +----+----+----+ - | PN | | | - +----+----+----+ - ************************************************/ -class LayoutItemGrid -{ -public: - explicit LayoutItemGrid(); - ~LayoutItemGrid(); - - void addItem(QLayoutItem *item); - int count() const { return mItems.count(); } - QLayoutItem *itemAt(int index) const { return mItems[index]; } - QLayoutItem *takeAt(int index); - - - const LayoutItemInfo &itemInfo(int row, int col) const; - LayoutItemInfo &itemInfo(int row, int col); - - void update(); - - int lineSize() const { return mLineSize; } - void setLineSize(int value); - - int colCount() const { return mColCount; } - void setColCount(int value); - - int usedColCount() const { return mUsedColCount; } - - int rowCount() const { return mRowCount; } - - void invalidate() { mValid = false; } - bool isValid() const { return mValid; } - - QSize sizeHint() const { return mSizeHint; } - - bool horiz() const { return mHoriz; } - void setHoriz(bool value); - - void clear(); - void rebuild(); - - bool isExpandable() const { return mExpandable; } - int expandableSize() const { return mExpandableSize; } - - void moveItem(int from, int to); - -private: - QVector mInfoItems; - int mColCount; - int mUsedColCount; - int mRowCount; - bool mValid; - int mExpandableSize; - int mLineSize; - - QSize mSizeHint; - QSize mMinSize; - bool mHoriz; - - int mNextRow; - int mNextCol; - bool mExpandable; - QList mItems; - - void doAddToGrid(QLayoutItem *item); -}; - - -/************************************************ - - ************************************************/ -LayoutItemGrid::LayoutItemGrid() -{ - mLineSize = 0; - mHoriz = true; - clear(); -} - -LayoutItemGrid::~LayoutItemGrid() -{ - qDeleteAll(mItems); -} - - -/************************************************ - - ************************************************/ -void LayoutItemGrid::clear() -{ - mRowCount = 0; - mNextRow = 0; - mNextCol = 0; - mInfoItems.resize(0); - mValid = false; - mExpandable = false; - mExpandableSize = 0; - mUsedColCount = 0; - mSizeHint = QSize(0,0); - mMinSize = QSize(0,0); -} - - -/************************************************ - - ************************************************/ -void LayoutItemGrid::rebuild() -{ - clear(); - - foreach(QLayoutItem *item, mItems) - { - doAddToGrid(item); - } -} - - -/************************************************ - - ************************************************/ -void LayoutItemGrid::addItem(QLayoutItem *item) -{ - doAddToGrid(item); - mItems.append(item); -} - - -/************************************************ - - ************************************************/ -void LayoutItemGrid::doAddToGrid(QLayoutItem *item) -{ - LayoutItemInfo info(item); - - if (info.separate && mNextCol > 0) - { - mNextCol = 0; - mNextRow++; - } - - int cnt = (mNextRow + 1 ) * mColCount; - if (mInfoItems.count() <= cnt) - mInfoItems.resize(cnt); - - int idx = mNextRow * mColCount + mNextCol; - mInfoItems[idx] = info; - mUsedColCount = qMax(mUsedColCount, mNextCol + 1); - mExpandable = mExpandable || info.expandable; - mRowCount = qMax(mRowCount, mNextRow+1); - - if (info.separate || mNextCol >= mColCount-1) - { - mNextRow++; - mNextCol = 0; - } - else - { - mNextCol++; - } - - invalidate(); -} - - -/************************************************ - - ************************************************/ -QLayoutItem *LayoutItemGrid::takeAt(int index) -{ - QLayoutItem *item = mItems.takeAt(index); - rebuild(); - return item; -} - - -/************************************************ - - ************************************************/ -void LayoutItemGrid::moveItem(int from, int to) -{ - mItems.move(from, to); - rebuild(); -} - - -/************************************************ - - ************************************************/ -const LayoutItemInfo &LayoutItemGrid::itemInfo(int row, int col) const -{ - return mInfoItems[row * mColCount + col]; -} - - -/************************************************ - - ************************************************/ -LayoutItemInfo &LayoutItemGrid::itemInfo(int row, int col) -{ - return mInfoItems[row * mColCount + col]; -} - - -/************************************************ - - ************************************************/ -void LayoutItemGrid::update() -{ - mExpandableSize = 0; - mSizeHint = QSize(0,0); - - if (mHoriz) - { - mSizeHint.setHeight(mLineSize * mColCount); - int x = 0; - for (int r=0; rsizeHint(); - info.geometry = QRect(QPoint(x,y), sz); - y += sz.height(); - rw = qMax(rw, sz.width()); - } - x += rw; - - if (itemInfo(r, 0).expandable) - mExpandableSize += rw; - - mSizeHint.setWidth(x); - mSizeHint.rheight() = qMax(mSizeHint.rheight(), y); - } - } - else - { - mSizeHint.setWidth(mLineSize * mColCount); - int y = 0; - for (int r=0; rsizeHint(); - info.geometry = QRect(QPoint(x,y), sz); - x += sz.width(); - rh = qMax(rh, sz.height()); - } - y += rh; - - if (itemInfo(r, 0).expandable) - mExpandableSize += rh; - - mSizeHint.setHeight(y); - mSizeHint.rwidth() = qMax(mSizeHint.rwidth(), x); - } - } - - mValid = true; -} - - -/************************************************ - - ************************************************/ -void LayoutItemGrid::setLineSize(int value) -{ - mLineSize = qMax(1, value); - invalidate(); -} - - -/************************************************ - - ************************************************/ -void LayoutItemGrid::setColCount(int value) -{ - mColCount = qMax(1, value); - rebuild(); -} - -/************************************************ - - ************************************************/ -void LayoutItemGrid::setHoriz(bool value) -{ - mHoriz = value; - invalidate(); -} - - - -/************************************************ - - ************************************************/ -LXQtPanelLayout::LXQtPanelLayout(QWidget *parent) : - QLayout(parent), - mLeftGrid(new LayoutItemGrid()), - mRightGrid(new LayoutItemGrid()), - mPosition(ILXQtPanel::PositionBottom), - mAnimate(false) -{ - setContentsMargins(0, 0, 0, 0); -} - - -/************************************************ - - ************************************************/ -LXQtPanelLayout::~LXQtPanelLayout() -{ - delete mLeftGrid; - delete mRightGrid; -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::addItem(QLayoutItem *item) -{ - LayoutItemGrid *grid = mRightGrid; - - Plugin *p = qobject_cast(item->widget()); - if (p && p->alignment() == Plugin::AlignLeft) - grid = mLeftGrid; - - grid->addItem(item); -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::globalIndexToLocal(int index, LayoutItemGrid **grid, int *gridIndex) -{ - if (index < mLeftGrid->count()) - { - *grid = mLeftGrid; - *gridIndex = index; - return; - } - - *grid = mRightGrid; - *gridIndex = index - mLeftGrid->count(); -} - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::globalIndexToLocal(int index, LayoutItemGrid **grid, int *gridIndex) const -{ - if (index < mLeftGrid->count()) - { - *grid = mLeftGrid; - *gridIndex = index; - return; - } - - *grid = mRightGrid; - *gridIndex = index - mLeftGrid->count(); -} - - -/************************************************ - - ************************************************/ -QLayoutItem *LXQtPanelLayout::itemAt(int index) const -{ - if (index < 0 || index >= count()) - return 0; - - LayoutItemGrid *grid=0; - int idx=0; - globalIndexToLocal(index, &grid, &idx); - - return grid->itemAt(idx); -} - - -/************************************************ - - ************************************************/ -QLayoutItem *LXQtPanelLayout::takeAt(int index) -{ - if (index < 0 || index >= count()) - return 0; - - LayoutItemGrid *grid=0; - int idx=0; - globalIndexToLocal(index, &grid, &idx); - - return grid->takeAt(idx); -} - - -/************************************************ - - ************************************************/ -int LXQtPanelLayout::count() const -{ - return mLeftGrid->count() + mRightGrid->count(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::moveItem(int from, int to, bool withAnimation) -{ - if (from != to) - { - LayoutItemGrid *fromGrid=0; - int fromIdx=0; - globalIndexToLocal(from, &fromGrid, &fromIdx); - - LayoutItemGrid *toGrid=0; - int toIdx=0; - globalIndexToLocal(to, &toGrid, &toIdx); - - if (fromGrid == toGrid) - { - fromGrid->moveItem(fromIdx, toIdx); - } - else - { - QLayoutItem *item = fromGrid->takeAt(fromIdx); - toGrid->addItem(item); - //recalculate position because we removed from one and put to another grid - LayoutItemGrid *toGridAux=0; - globalIndexToLocal(to, &toGridAux, &toIdx); - Q_ASSERT(toGrid == toGridAux); //grid must be the same (if not something is wrong with our logic) - toGrid->moveItem(toGridAux->count()-1, toIdx); - } - } - - mAnimate = withAnimation; - invalidate(); -} - - -/************************************************ - - ************************************************/ -QSize LXQtPanelLayout::sizeHint() const -{ - if (!mLeftGrid->isValid()) - mLeftGrid->update(); - - if (!mRightGrid->isValid()) - mRightGrid->update(); - - QSize ls = mLeftGrid->sizeHint(); - QSize rs = mRightGrid->sizeHint(); - - if (isHorizontal()) - { - return QSize(ls.width() + rs.width(), - qMax(ls.height(), rs.height())); - } - else - { - return QSize(qMax(ls.width(), rs.width()), - ls.height() + rs.height()); - } -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::setGeometry(const QRect &geometry) -{ - if (!mLeftGrid->isValid()) - mLeftGrid->update(); - - if (!mRightGrid->isValid()) - mRightGrid->update(); - - QRect my_geometry{geometry}; - my_geometry -= contentsMargins(); - if (count()) - { - if (isHorizontal()) - setGeometryHoriz(my_geometry); - else - setGeometryVert(my_geometry); - } - - mAnimate = false; - QLayout::setGeometry(my_geometry); -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::setItemGeometry(QLayoutItem *item, const QRect &geometry, bool withAnimation) -{ - Plugin *plugin = qobject_cast(item->widget()); - if (withAnimation && plugin) - { - ItemMoveAnimation* animation = new ItemMoveAnimation(item); - animation->setStartValue(item->geometry()); - animation->setEndValue(geometry); - animation->start(animation->DeleteWhenStopped); - } - else - { - item->setGeometry(geometry); - } -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::setGeometryHoriz(const QRect &geometry) -{ - const bool visual_h_reversed = parentWidget() && parentWidget()->isRightToLeft(); - // Calc expFactor for expandable plugins like TaskBar. - double expFactor; - { - int expWidth = mLeftGrid->expandableSize() + mRightGrid->expandableSize(); - int nonExpWidth = mLeftGrid->sizeHint().width() - mLeftGrid->expandableSize() + - mRightGrid->sizeHint().width() - mRightGrid->expandableSize(); - expFactor = expWidth ? ((1.0 * geometry.width() - nonExpWidth) / expWidth) : 1; - } - - // Calc baselines for plugins like button. - QVector baseLines(qMax(mLeftGrid->colCount(), mRightGrid->colCount())); - const int bh = geometry.height() / baseLines.count(); - const int base_center = bh >> 1; - const int height_remain = 0 < bh ? geometry.height() % baseLines.size() : 0; - { - int base = geometry.top(); - for (auto i = baseLines.begin(), i_e = baseLines.end(); i_e != i; ++i, base += bh) - { - *i = base; - } - } - -#if 0 - qDebug() << "** LXQtPanelLayout::setGeometryHoriz **************"; - qDebug() << "geometry: " << geometry; - - qDebug() << "Left grid"; - qDebug() << " cols:" << mLeftGrid->colCount() << " rows:" << mLeftGrid->rowCount(); - qDebug() << " usedCols" << mLeftGrid->usedColCount(); - - qDebug() << "Right grid"; - qDebug() << " cols:" << mRightGrid->colCount() << " rows:" << mRightGrid->rowCount(); - qDebug() << " usedCols" << mRightGrid->usedColCount(); -#endif - - - // Left aligned plugins. - int left=geometry.left(); - for (int r=0; rrowCount(); ++r) - { - int rw = 0; - int remain = height_remain; - for (int c=0; cusedColCount(); ++c) - { - const LayoutItemInfo &info = mLeftGrid->itemInfo(r, c); - if (info.item) - { - QRect rect; - if (info.separate) - { - rect.setLeft(left); - rect.setTop(geometry.top()); - rect.setHeight(geometry.height()); - - if (info.expandable) - rect.setWidth(info.geometry.width() * expFactor); - else - rect.setWidth(info.geometry.width()); - } - else - { - int height = bh + (0 < remain-- ? 1 : 0); - if (!info.item->expandingDirections().testFlag(Qt::Orientation::Vertical)) - height = qMin(info.geometry.height(), height); - height = qMin(geometry.height(), height); - rect.setHeight(height); - rect.setWidth(qMin(info.geometry.width(), geometry.width())); - if (height < bh) - rect.moveCenter(QPoint(0, baseLines[c] + base_center)); - else - rect.moveTop(baseLines[c]); - rect.moveLeft(left); - } - - rw = qMax(rw, rect.width()); - if (visual_h_reversed) - rect.moveLeft(geometry.left() + geometry.right() - rect.x() - rect.width() + 1); - setItemGeometry(info.item, rect, mAnimate); - } - } - left += rw; - } - - // Right aligned plugins. - int right=geometry.right(); - for (int r=mRightGrid->rowCount()-1; r>=0; --r) - { - int rw = 0; - int remain = height_remain; - for (int c=0; cusedColCount(); ++c) - { - const LayoutItemInfo &info = mRightGrid->itemInfo(r, c); - if (info.item) - { - QRect rect; - if (info.separate) - { - rect.setTop(geometry.top()); - rect.setHeight(geometry.height()); - - if (info.expandable) - rect.setWidth(info.geometry.width() * expFactor); - else - rect.setWidth(info.geometry.width()); - - rect.moveRight(right); - } - else - { - int height = bh + (0 < remain-- ? 1 : 0); - if (!info.item->expandingDirections().testFlag(Qt::Orientation::Vertical)) - height = qMin(info.geometry.height(), height); - height = qMin(geometry.height(), height); - rect.setHeight(height); - rect.setWidth(qMin(info.geometry.width(), geometry.width())); - if (height < bh) - rect.moveCenter(QPoint(0, baseLines[c] + base_center)); - else - rect.moveTop(baseLines[c]); - rect.moveRight(right); - } - - rw = qMax(rw, rect.width()); - if (visual_h_reversed) - rect.moveLeft(geometry.left() + geometry.right() - rect.x() - rect.width() + 1); - setItemGeometry(info.item, rect, mAnimate); - } - } - right -= rw; - } -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::setGeometryVert(const QRect &geometry) -{ - const bool visual_h_reversed = parentWidget() && parentWidget()->isRightToLeft(); - // Calc expFactor for expandable plugins like TaskBar. - double expFactor; - { - int expHeight = mLeftGrid->expandableSize() + mRightGrid->expandableSize(); - int nonExpHeight = mLeftGrid->sizeHint().height() - mLeftGrid->expandableSize() + - mRightGrid->sizeHint().height() - mRightGrid->expandableSize(); - expFactor = expHeight ? ((1.0 * geometry.height() - nonExpHeight) / expHeight) : 1; - } - - // Calc baselines for plugins like button. - QVector baseLines(qMax(mLeftGrid->colCount(), mRightGrid->colCount())); - const int bw = geometry.width() / baseLines.count(); - const int base_center = bw >> 1; - const int width_remain = 0 < bw ? geometry.width() % baseLines.size() : 0; - { - int base = geometry.left(); - for (auto i = baseLines.begin(), i_e = baseLines.end(); i_e != i; ++i, base += bw) - { - *i = base; - } - } - -#if 0 - qDebug() << "** LXQtPanelLayout::setGeometryVert **************"; - qDebug() << "geometry: " << geometry; - - qDebug() << "Left grid"; - qDebug() << " cols:" << mLeftGrid->colCount() << " rows:" << mLeftGrid->rowCount(); - qDebug() << " usedCols" << mLeftGrid->usedColCount(); - - qDebug() << "Right grid"; - qDebug() << " cols:" << mRightGrid->colCount() << " rows:" << mRightGrid->rowCount(); - qDebug() << " usedCols" << mRightGrid->usedColCount(); -#endif - - // Top aligned plugins. - int top=geometry.top(); - for (int r=0; rrowCount(); ++r) - { - int rh = 0; - int remain = width_remain; - for (int c=0; cusedColCount(); ++c) - { - const LayoutItemInfo &info = mLeftGrid->itemInfo(r, c); - if (info.item) - { - QRect rect; - if (info.separate) - { - rect.moveTop(top); - rect.setLeft(geometry.left()); - rect.setWidth(geometry.width()); - - if (info.expandable) - rect.setHeight(info.geometry.height() * expFactor); - else - rect.setHeight(info.geometry.height()); - } - else - { - rect.setHeight(qMin(info.geometry.height(), geometry.height())); - int width = bw + (0 < remain-- ? 1 : 0); - if (!info.item->expandingDirections().testFlag(Qt::Orientation::Horizontal)) - width = qMin(info.geometry.width(), width); - width = qMin(geometry.width(), width); - rect.setWidth(width); - if (width < bw) - rect.moveCenter(QPoint(baseLines[c] + base_center, 0)); - else - rect.moveLeft(baseLines[c]); - rect.moveTop(top); - } - - rh = qMax(rh, rect.height()); - if (visual_h_reversed) - rect.moveLeft(geometry.left() + geometry.right() - rect.x() - rect.width() + 1); - setItemGeometry(info.item, rect, mAnimate); - } - } - top += rh; - } - - - // Bottom aligned plugins. - int bottom=geometry.bottom(); - for (int r=mRightGrid->rowCount()-1; r>=0; --r) - { - int rh = 0; - int remain = width_remain; - for (int c=0; cusedColCount(); ++c) - { - const LayoutItemInfo &info = mRightGrid->itemInfo(r, c); - if (info.item) - { - QRect rect; - if (info.separate) - { - rect.setLeft(geometry.left()); - rect.setWidth(geometry.width()); - - if (info.expandable) - rect.setHeight(info.geometry.height() * expFactor); - else - rect.setHeight(info.geometry.height()); - rect.moveBottom(bottom); - } - else - { - rect.setHeight(qMin(info.geometry.height(), geometry.height())); - int width = bw + (0 < remain-- ? 1 : 0); - if (!info.item->expandingDirections().testFlag(Qt::Orientation::Horizontal)) - width = qMin(info.geometry.width(), width); - width = qMin(geometry.width(), width); - rect.setWidth(width); - if (width < bw) - rect.moveCenter(QPoint(baseLines[c] + base_center, 0)); - else - rect.moveLeft(baseLines[c]); - rect.moveBottom(bottom); - } - - rh = qMax(rh, rect.height()); - if (visual_h_reversed) - rect.moveLeft(geometry.left() + geometry.right() - rect.x() - rect.width() + 1); - setItemGeometry(info.item, rect, mAnimate); - } - } - bottom -= rh; - } -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::invalidate() -{ - mLeftGrid->invalidate(); - mRightGrid->invalidate(); - mMinPluginSize = QSize(); - QLayout::invalidate(); -} - - -/************************************************ - - ************************************************/ -int LXQtPanelLayout::lineCount() const -{ - return mLeftGrid->colCount(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::setLineCount(int value) -{ - mLeftGrid->setColCount(value); - mRightGrid->setColCount(value); - invalidate(); -} - - -/************************************************ - - ************************************************/ -int LXQtPanelLayout::lineSize() const -{ - return mLeftGrid->lineSize(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::setLineSize(int value) -{ - mLeftGrid->setLineSize(value); - mRightGrid->setLineSize(value); - invalidate(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::setPosition(ILXQtPanel::Position value) -{ - mPosition = value; - mLeftGrid->setHoriz(isHorizontal()); - mRightGrid->setHoriz(isHorizontal()); -} - - -/************************************************ - - ************************************************/ -bool LXQtPanelLayout::isHorizontal() const -{ - return mPosition == ILXQtPanel::PositionTop || - mPosition == ILXQtPanel::PositionBottom; -} - - -/************************************************ - - ************************************************/ -bool LXQtPanelLayout::itemIsSeparate(QLayoutItem *item) -{ - if (!item) - return true; - - Plugin *p = qobject_cast(item->widget()); - if (!p) - return true; - - return p->isSeparate(); -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::startMovePlugin() -{ - Plugin *plugin = qobject_cast(sender()); - if (plugin) - { - // We have not memoryleaks there. - // The processor will be automatically deleted when stopped. - PluginMoveProcessor *moveProcessor = new PluginMoveProcessor(this, plugin); - moveProcessor->start(); - connect(moveProcessor, SIGNAL(finished()), this, SLOT(finishMovePlugin())); - } -} - - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::finishMovePlugin() -{ - PluginMoveProcessor *moveProcessor = qobject_cast(sender()); - if (moveProcessor) - { - Plugin *plugin = moveProcessor->plugin(); - int n = indexOf(plugin); - plugin->setAlignment(ncount() ? Plugin::AlignLeft : Plugin::AlignRight); - emit pluginMoved(plugin); - } -} - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::moveUpPlugin(Plugin * plugin) -{ - const int i = indexOf(plugin); - if (0 < i) - moveItem(i, i - 1, true); -} - -/************************************************ - - ************************************************/ -void LXQtPanelLayout::addPlugin(Plugin * plugin) -{ - connect(plugin, &Plugin::startMove, this, &LXQtPanelLayout::startMovePlugin); - - const int prev_count = count(); - addWidget(plugin); - - //check actual position - const int pos = indexOf(plugin); - if (prev_count > pos) - moveItem(pos, prev_count, false); -} diff --git a/panel/lxqtpanellayout.h b/panel/lxqtpanellayout.h deleted file mode 100644 index 91ad572..0000000 --- a/panel/lxqtpanellayout.h +++ /dev/null @@ -1,102 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTPANELLAYOUT_H -#define LXQTPANELLAYOUT_H - -#include -#include -#include -#include -#include "ilxqtpanel.h" -#include "lxqtpanelglobals.h" - -class MoveInfo; -class QMouseEvent; -class QEvent; - -class Plugin; -class LayoutItemGrid; - -class LXQT_PANEL_API LXQtPanelLayout : public QLayout -{ - Q_OBJECT -public: - explicit LXQtPanelLayout(QWidget *parent); - ~LXQtPanelLayout(); - - void addItem(QLayoutItem *item); - QLayoutItem *itemAt(int index) const; - QLayoutItem *takeAt(int index); - int count() const; - void moveItem(int from, int to, bool withAnimation=false); - - QSize sizeHint() const; - //QSize minimumSize() const; - void setGeometry(const QRect &geometry); - - bool isHorizontal() const; - - void invalidate(); - - int lineCount() const; - void setLineCount(int value); - - int lineSize() const; - void setLineSize(int value); - - ILXQtPanel::Position position() const { return mPosition; } - void setPosition(ILXQtPanel::Position value); - - static bool itemIsSeparate(QLayoutItem *item); -signals: - void pluginMoved(Plugin * plugin); - -public slots: - void startMovePlugin(); - void finishMovePlugin(); - void moveUpPlugin(Plugin * plugin); - void addPlugin(Plugin * plugin); - -private: - mutable QSize mMinPluginSize; - LayoutItemGrid *mLeftGrid; - LayoutItemGrid *mRightGrid; - ILXQtPanel::Position mPosition; - bool mAnimate; - - - void setGeometryHoriz(const QRect &geometry); - void setGeometryVert(const QRect &geometry); - void globalIndexToLocal(int index, LayoutItemGrid **grid, int *gridIndex); - void globalIndexToLocal(int index, LayoutItemGrid **grid, int *gridIndex) const; - - void setItemGeometry(QLayoutItem *item, const QRect &geometry, bool withAnimation); -}; - -#endif // LXQTPANELLAYOUT_H diff --git a/panel/lxqtpanellimits.h b/panel/lxqtpanellimits.h deleted file mode 100644 index b0ab3a5..0000000 --- a/panel/lxqtpanellimits.h +++ /dev/null @@ -1,47 +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: - * Luís Pereira - * - * 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 LXQTPANELLIMITS_H -#define LXQTPANELLIMITS_H - -#define PANEL_DEFAULT_SIZE 32 -#define PANEL_MINIMUM_SIZE 16 -#define PANEL_MAXIMUM_SIZE 200 -#define PANEL_HIDE_SIZE 4 - -#define PANEL_DEFAULT_ICON_SIZE 22 -#define PANEL_DEFAULT_LINE_COUNT 1 - -#define PANEL_DEFAULT_BACKGROUND_COLOR "#CCCCCC" - -#define PANEL_HIDE_DELAY 500 -#define PANEL_HIDE_FIRST_TIME (5000 - PANEL_HIDE_DELAY) - -#define PANEL_SHOW_DELAY 0 - -#define SETTINGS_SAVE_DELAY 3000 -#endif // LXQTPANELLIMITS_H diff --git a/panel/lxqtpanelpluginconfigdialog.cpp b/panel/lxqtpanelpluginconfigdialog.cpp deleted file mode 100644 index 5d9a437..0000000 --- a/panel/lxqtpanelpluginconfigdialog.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtpanelpluginconfigdialog.h" - - -#include -#include -#include -#include -/************************************************ - - ************************************************/ -LXQtPanelPluginConfigDialog::LXQtPanelPluginConfigDialog(PluginSettings &settings, QWidget *parent) : - QDialog(parent), - mSettings(settings) -{ -} - - -/************************************************ - - ************************************************/ -LXQtPanelPluginConfigDialog::~LXQtPanelPluginConfigDialog() -{ -} - - -/************************************************ - - ************************************************/ -PluginSettings& LXQtPanelPluginConfigDialog::settings() const -{ - return mSettings; -} - - - -/************************************************ - - ************************************************/ -void LXQtPanelPluginConfigDialog::dialogButtonsAction(QAbstractButton *btn) -{ - QDialogButtonBox *box = qobject_cast(btn->parent()); - - if (box && box->buttonRole(btn) == QDialogButtonBox::ResetRole) - { - mSettings.loadFromCache(); - loadSettings(); - } - else - { - close(); - } -} - - -/************************************************ - - ************************************************/ -void LXQtPanelPluginConfigDialog::setComboboxIndexByData(QComboBox *comboBox, const QVariant &data, int defaultIndex) const -{ - int index = comboBox ->findData(data); - if (index < 0) - index = defaultIndex; - - comboBox->setCurrentIndex(index); -} diff --git a/panel/lxqtpanelpluginconfigdialog.h b/panel/lxqtpanelpluginconfigdialog.h deleted file mode 100644 index c869d75..0000000 --- a/panel/lxqtpanelpluginconfigdialog.h +++ /dev/null @@ -1,64 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTPANELPLUGINCONFIGDIALOG_H -#define LXQTPANELPLUGINCONFIGDIALOG_H - -#include -#include -#include "lxqtpanelglobals.h" -#include "pluginsettings.h" - -class QComboBox; - -class LXQT_PANEL_API LXQtPanelPluginConfigDialog : public QDialog -{ - Q_OBJECT -public: - explicit LXQtPanelPluginConfigDialog(PluginSettings &settings, QWidget *parent = nullptr); - explicit LXQtPanelPluginConfigDialog(PluginSettings *settings, QWidget *parent = nullptr) : LXQtPanelPluginConfigDialog(*settings, parent) {} - virtual ~LXQtPanelPluginConfigDialog(); - - PluginSettings &settings() const; - -protected slots: - /* - Saves settings in conf file. - */ - virtual void loadSettings() = 0; - virtual void dialogButtonsAction(QAbstractButton *btn); - -protected: - void setComboboxIndexByData(QComboBox *comboBox, const QVariant &data, int defaultIndex = 0) const; - -private: - PluginSettings &mSettings; - -}; - -#endif // LXQTPANELPLUGINCONFIGDIALOG_H diff --git a/panel/main.cpp b/panel/main.cpp deleted file mode 100644 index 4bbb2e4..0000000 --- a/panel/main.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtpanelapplication.h" - -/*! The lxqt-panel is the panel of LXDE-Qt. - Usage: lxqt-panel [CONFIG_ID] - CONFIG_ID Section name in config file ~/.config/lxqt-panel/panel.conf - (default main) - */ - -int main(int argc, char *argv[]) -{ - LXQtPanelApplication app(argc, argv); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - return app.exec(); -} diff --git a/panel/man/lxqt-panel.1 b/panel/man/lxqt-panel.1 deleted file mode 100644 index 3b7435e..0000000 --- a/panel/man/lxqt-panel.1 +++ /dev/null @@ -1,35 +0,0 @@ -.TH lxqt-panel "1" "2015-11-05" "LXQt 0.10.0" "LXQt Desktop Panel Module" -.SH NAME -lxqt-panel \- Desktop panel for \fBLXQt\fR: The Lightweight Qt Desktop Environment -.SH SYNOPSIS -.B lxqt-panel -.br -.SH DESCRIPTION -This module adds a panel, with optional plugins, to the desktop. -.SH BEHAVIOR -The panel can be run independently of \fBLXQt\fR, autostarted at logon, and have -multiple instances. A horizontal bottom panel shows by default on the desktop, -but the alignment, size, autohide, transparency (requires compositor), and other -attributes are user configurable. -.P -The panel is comprised of plugins which provide a visual widget; like the menu, -clock, or volume. They can be added or removed in the panel Widget settings. -.P -Several plugins are loaded by default; the desktop menu and windows workspaces -are also managed here. -.SH CONFIGURATIONS -Right-click over any plugin to reach the panel Configure settings option, or -that of each respective plugin. -.SH "REPORTING BUGS" -Report bugs to https://github.com/LXDE/LXQt/issues -.SH "SEE ALSO" -.\" any module must refer to the session application, for module overview and initiation -\fBstartlxqt.1\fR LXQt session initialization and launch script (e.g. in \fB.xinitrc\fR) -.P -\fBlxqt-session.1\fR LXQt \fIoverview\fR and complete session environment -.P -\fBlxqt-config-session.1\fR LXQt default and autostart applications settings, -plus environment settings -.P -\fBlxqt-config.1\fR LXQt settings Configuration Center interface -.P diff --git a/panel/panelpluginsmodel.cpp b/panel/panelpluginsmodel.cpp deleted file mode 100644 index 62db4c0..0000000 --- a/panel/panelpluginsmodel.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * - * 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 "panelpluginsmodel.h" -#include "plugin.h" -#include "ilxqtpanelplugin.h" -#include "lxqtpanel.h" -#include "lxqtpanelapplication.h" -#include -#include -#include - -#include - -PanelPluginsModel::PanelPluginsModel(LXQtPanel * panel, - QString const & namesKey, - QStringList const & desktopDirs, - QObject * parent/* = nullptr*/) - : QAbstractListModel{parent}, - mNamesKey(namesKey), - mPanel(panel) -{ - loadPlugins(desktopDirs); -} - -PanelPluginsModel::~PanelPluginsModel() -{ - qDeleteAll(plugins()); -} - -int PanelPluginsModel::rowCount(const QModelIndex & parent/* = QModelIndex()*/) const -{ - return QModelIndex() == parent ? mPlugins.size() : 0; -} - - -QVariant PanelPluginsModel::data(const QModelIndex & index, int role/* = Qt::DisplayRole*/) const -{ - Q_ASSERT(QModelIndex() == index.parent() - && 0 == index.column() - && mPlugins.size() > index.row() - ); - - pluginslist_t::const_reference plugin = mPlugins[index.row()]; - QVariant ret; - switch (role) - { - case Qt::DisplayRole: - if (plugin.second.isNull()) - ret = QString("Unknown (%1)").arg(plugin.first); - else - ret = QString("%1 (%2)").arg(plugin.second->name(), plugin.first); - break; - case Qt::DecorationRole: - if (plugin.second.isNull()) - ret = XdgIcon::fromTheme("preferences-plugin"); - else - ret = plugin.second->desktopFile().icon(XdgIcon::fromTheme("preferences-plugin")); - break; - case Qt::UserRole: - ret = QVariant::fromValue(const_cast(plugin.second.data())); - break; - } - return ret; -} - -Qt::ItemFlags PanelPluginsModel::flags(const QModelIndex & index) const -{ - return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemNeverHasChildren; -} - -QStringList PanelPluginsModel::pluginNames() const -{ - QStringList names; - for (auto const & p : mPlugins) - names.append(p.first); - return names; -} - -QList PanelPluginsModel::plugins() const -{ - QList plugins; - for (auto const & p : mPlugins) - if (!p.second.isNull()) - plugins.append(p.second.data()); - return plugins; -} - -Plugin* PanelPluginsModel::pluginByName(QString name) const -{ - for (auto const & p : mPlugins) - if (p.first == name) - return p.second.data(); - return nullptr; -} - -Plugin const * PanelPluginsModel::pluginByID(QString id) const -{ - for (auto const & p : mPlugins) - { - Plugin *plugin = p.second.data(); - if (plugin && plugin->desktopFile().id() == id) - return plugin; - } - return nullptr; -} - -void PanelPluginsModel::addPlugin(const LXQt::PluginInfo &desktopFile) -{ - if (dynamic_cast(qApp)->isPluginSingletonAndRunnig(desktopFile.id())) - return; - - QString name = findNewPluginSettingsGroup(desktopFile.id()); - - QPointer plugin = loadPlugin(desktopFile, name); - if (plugin.isNull()) - return; - - beginInsertRows(QModelIndex(), mPlugins.size(), mPlugins.size()); - mPlugins.append({name, plugin}); - endInsertRows(); - mPanel->settings()->setValue(mNamesKey, pluginNames()); - emit pluginAdded(plugin.data()); -} - -void PanelPluginsModel::removePlugin(pluginslist_t::iterator plugin) -{ - if (mPlugins.end() != plugin) - { - mPanel->settings()->remove(plugin->first); - Plugin * p = plugin->second.data(); - const int row = plugin - mPlugins.begin(); - beginRemoveRows(QModelIndex(), row, row); - mPlugins.erase(plugin); - endRemoveRows(); - emit pluginRemoved(p); // p can be nullptr - mPanel->settings()->setValue(mNamesKey, pluginNames()); - if (nullptr != p) - p->deleteLater(); - } -} - -void PanelPluginsModel::removePlugin() -{ - Plugin * p = qobject_cast(sender()); - auto plugin = std::find_if(mPlugins.begin(), mPlugins.end(), - [p] (pluginslist_t::const_reference obj) { return p == obj.second; }); - removePlugin(std::move(plugin)); -} - -void PanelPluginsModel::movePlugin(Plugin * plugin, QString const & nameAfter) -{ - //merge list of plugins (try to preserve original position) - //subtract mPlugin.begin() from the found Plugins to get the model index - const int from = - std::find_if(mPlugins.begin(), mPlugins.end(), [plugin] (pluginslist_t::const_reference obj) { return plugin == obj.second.data(); }) - - mPlugins.begin(); - const int to = - std::find_if(mPlugins.begin(), mPlugins.end(), [nameAfter] (pluginslist_t::const_reference obj) { return nameAfter == obj.first; }) - - mPlugins.begin(); - /* 'from' is the current position of the Plugin to be moved ("moved Plugin"), - * 'to' is the position of the Plugin behind the one that is being moved - * ("behind Plugin"). There are several cases to distinguish: - * 1. from > to: The moved Plugin had been behind the behind Plugin before - * and is moved to the front of the behind Plugin. The moved Plugin will - * be inserted at position 'to', the behind Plugin and all the following - * Plugins (until the former position of the moved Plugin) will increment - * their indexes. - * 2. from < to: The moved Plugin had already been located before the - * behind Plugin. In this case, the move operation only reorders the - * Plugins before the behind Plugin. All the Plugins between the moved - * Plugin and the behind Plugin will decrement their index. Therefore, the - * movedPlugin will not be at position 'to' but rather on position 'to-1'. - * 3. from == to: This does not make sense, we catch this case to prevent - * errors. - * 4. from == to-1: The moved Plugin has not moved because it had already - * been located in front of the behind Plugin. - */ - const int to_plugins = from < to ? to - 1 : to; - - if (from != to && from != to_plugins) - { - /* Although the new position of the moved Plugin will be 'to-1' if - * from < to, we insert 'to' here. This is exactly how it is done - * in the Qt documentation. - */ - beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); - // For the QList::move method, use the right position - mPlugins.move(from, to_plugins); - endMoveRows(); - emit pluginMoved(plugin); - mPanel->settings()->setValue(mNamesKey, pluginNames()); - } -} - -void PanelPluginsModel::loadPlugins(QStringList const & desktopDirs) -{ - QStringList plugin_names = mPanel->settings()->value(mNamesKey).toStringList(); - -#ifdef DEBUG_PLUGIN_LOADTIME - QElapsedTimer timer; - timer.start(); - qint64 lastTime = 0; -#endif - for (auto const & name : plugin_names) - { - pluginslist_t::iterator i = mPlugins.insert(mPlugins.end(), {name, nullptr}); - QString type = mPanel->settings()->value(name + "/type").toString(); - if (type.isEmpty()) - { - qWarning() << QString("Section \"%1\" not found in %2.").arg(name, mPanel->settings()->fileName()); - continue; - } -#ifdef WITH_SCREENSAVER_FALLBACK - if (QStringLiteral("screensaver") == type) - { - //plugin-screensaver was dropped - //convert settings to plugin-quicklaunch - const QString & lock_desktop = QStringLiteral(LXQT_LOCK_DESKTOP); - qWarning().noquote() << "Found deprecated plugin of type 'screensaver', migrating to 'quicklaunch' with '" << lock_desktop << '\''; - type = QStringLiteral("quicklaunch"); - LXQt::Settings * settings = mPanel->settings(); - settings->beginGroup(name); - settings->remove(QString{});//remove all existing keys - settings->setValue(QStringLiteral("type"), type); - settings->beginWriteArray(QStringLiteral("apps"), 1); - settings->setArrayIndex(0); - settings->setValue(QStringLiteral("desktop"), lock_desktop); - settings->endArray(); - settings->endGroup(); - } -#endif - - LXQt::PluginInfoList list = LXQt::PluginInfo::search(desktopDirs, "LXQtPanel/Plugin", QString("%1.desktop").arg(type)); - if( !list.count()) - { - qWarning() << QString("Plugin \"%1\" not found.").arg(type); - continue; - } - - i->second = loadPlugin(list.first(), name); -#ifdef DEBUG_PLUGIN_LOADTIME - qDebug() << "load plugin" << type << "takes" << (timer.elapsed() - lastTime) << "ms"; - lastTime = timer.elapsed(); -#endif - } -} - -QPointer PanelPluginsModel::loadPlugin(LXQt::PluginInfo const & desktopFile, QString const & settingsGroup) -{ - std::unique_ptr plugin(new Plugin(desktopFile, mPanel->settings(), settingsGroup, mPanel)); - if (plugin->isLoaded()) - { - connect(mPanel, &LXQtPanel::realigned, plugin.get(), &Plugin::realign); - connect(plugin.get(), &Plugin::remove, - this, static_cast(&PanelPluginsModel::removePlugin)); - return plugin.release(); - } - - return nullptr; -} - -QString PanelPluginsModel::findNewPluginSettingsGroup(const QString &pluginType) const -{ - QStringList groups = mPanel->settings()->childGroups(); - groups.sort(); - - // Generate new section name - QString pluginName = QString("%1").arg(pluginType); - - if (!groups.contains(pluginName)) - return pluginName; - else - { - for (int i = 2; true; ++i) - { - pluginName = QString("%1%2").arg(pluginType).arg(i); - if (!groups.contains(pluginName)) - return pluginName; - } - } -} - -bool PanelPluginsModel::isIndexValid(QModelIndex const & index) const -{ - return index.isValid() && QModelIndex() == index.parent() - && 0 == index.column() && mPlugins.size() > index.row(); -} - -void PanelPluginsModel::onMovePluginUp(QModelIndex const & index) -{ - if (!isIndexValid(index)) - return; - - const int row = index.row(); - if (0 >= row) - return; //can't move up - - beginMoveRows(QModelIndex(), row, row, QModelIndex(), row - 1); - mPlugins.swap(row - 1, row); - endMoveRows(); - pluginslist_t::const_reference moved_plugin = mPlugins[row - 1]; - pluginslist_t::const_reference prev_plugin = mPlugins[row]; - - emit pluginMoved(moved_plugin.second.data()); - //emit signal for layout only in case both plugins are loaded/displayed - if (!moved_plugin.second.isNull() && !prev_plugin.second.isNull()) - emit pluginMovedUp(moved_plugin.second.data()); - - mPanel->settings()->setValue(mNamesKey, pluginNames()); -} - -void PanelPluginsModel::onMovePluginDown(QModelIndex const & index) -{ - if (!isIndexValid(index)) - return; - - const int row = index.row(); - if (mPlugins.size() <= row + 1) - return; //can't move down - - beginMoveRows(QModelIndex(), row, row, QModelIndex(), row + 2); - mPlugins.swap(row, row + 1); - endMoveRows(); - pluginslist_t::const_reference moved_plugin = mPlugins[row + 1]; - pluginslist_t::const_reference next_plugin = mPlugins[row]; - - emit pluginMoved(moved_plugin.second.data()); - //emit signal for layout only in case both plugins are loaded/displayed - if (!moved_plugin.second.isNull() && !next_plugin.second.isNull()) - emit pluginMovedUp(next_plugin.second.data()); - - mPanel->settings()->setValue(mNamesKey, pluginNames()); -} - -void PanelPluginsModel::onConfigurePlugin(QModelIndex const & index) -{ - if (!isIndexValid(index)) - return; - - Plugin * const plugin = mPlugins[index.row()].second.data(); - if (nullptr != plugin && (ILXQtPanelPlugin::HaveConfigDialog & plugin->iPlugin()->flags())) - plugin->showConfigureDialog(); -} - -void PanelPluginsModel::onRemovePlugin(QModelIndex const & index) -{ - if (!isIndexValid(index)) - return; - - auto plugin = mPlugins.begin() + index.row(); - if (plugin->second.isNull()) - removePlugin(std::move(plugin)); - else - plugin->second->requestRemove(); -} diff --git a/panel/panelpluginsmodel.h b/panel/panelpluginsmodel.h deleted file mode 100644 index b8e78ea..0000000 --- a/panel/panelpluginsmodel.h +++ /dev/null @@ -1,341 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * - * 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 PANELPLUGINSMODEL_H -#define PANELPLUGINSMODEL_H - -#include -#include - -namespace LXQt -{ - class PluginInfo; - struct PluginData; -} - -class LXQtPanel; -class Plugin; - -/*! - * \brief The PanelPluginsModel class implements the Model part of the - * Qt Model/View architecture for the Plugins, i.e. it is the interface - * to access the Plugin data associated with this Panel. The - * PanelPluginsModel takes care for read-access as well as changes - * like adding, removing or moving Plugins. - */ -class PanelPluginsModel : public QAbstractListModel -{ - Q_OBJECT -public: - PanelPluginsModel(LXQtPanel * panel, - QString const & namesKey, - QStringList const & desktopDirs, - QObject * parent = nullptr); - ~PanelPluginsModel(); - - /*! - * \brief rowCount returns the number of Plugins. It overrides/implements - * QAbstractListModel::rowCount(). - * \param parent The parameter parent should be omitted to get the number of - * Plugins. If it is given and a valid model index, the method returns 0 - * because PanelPluginsModel is not a hierarchical model. - */ - virtual int rowCount(const QModelIndex & parent = QModelIndex()) const override; - /*! - * \brief data returns the Plugin data as defined by the Model/View - * architecture. The Plugins itself can be accessed with the role - * Qt::UserRole but they can also be accessed by the methods plugins(), - * pluginByName() and pluginByID(). This method overrides/implements - * QAbstractListModel::data(). - * \param index should be a valid model index to determine the Plugin - * that should be read. - * \param role The Qt::ItemDataRole to determine what kind of data should - * be read, can be one of the following: - * 1. Qt::DisplayRole to return a string that describes the Plugin. - * 2. Qt::DecorationRole to return an icon for the Plugin. - * 3. Qt::UserRole to return a Plugin*. - * \return The data as determined by index and role. - */ - virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override; - /*! - * \brief flags returns the item flags for the given model index. For - * all Plugins, this is the same: - * Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemNeverHasChildren. - */ - virtual Qt::ItemFlags flags(const QModelIndex & index) const override; - - /*! - * \brief pluginNames returns a list of names for all the Plugins in - * this panel. The names are not the human-readable names but the names - * that are used to identify the Plugins, e.g. in the config files. These - * names can be used in the method pluginByName() to get a corresponding - * Plugin. - * - * The plugin names are normally chosen to be equal to the - * filename of the corresponding *.desktop-file. If multiple instances - * of a single plugin-type are created, their names are created by - * appending increasing numbers, e.g. 'mainmenu' and 'mainmenu2'. - * - * \sa findNewPluginSettingsGroup - */ - QStringList pluginNames() const; - /*! - * \brief plugins returns a list of Plugins in this panel. - */ - QList plugins() const; - /*! - * \brief pluginByName gets a Plugin by its name. - * \param name is the name of the plugin as it is used in the - * config files. A list of names can be retrieved with the - * method pluginNames(). - * \return the Plugin with the given name. - * - * \sa pluginNames - */ - Plugin *pluginByName(QString name) const; - /*! - * \brief pluginByID gets a Plugin by its ID. - * \param id is the *.desktop-file-ID of the plugin which in turn is the - * QFileInfo::completeBaseName() of the desktop-file, e.g. "mainmenu". - * - * As these IDs are chosen according to the corresponding - * desktop-file, these IDs are not unique. If multiple - * instances of a single plugin-type are created, they share - * the same ID in this sense. Then, this method will return - * the first plugin of the given type. - * \return the first Plugin found with the given ID. - */ - Plugin const *pluginByID(QString id) const; - - /*! - * \brief movePlugin moves a Plugin in the underlying data. - * - * This method is useful whenever a Plugin should be moved several - * positions at once. If a Plugin should only be moved one position - * up or down, consider using onMovePluginUp or onMovePluginDown. - * - * \param plugin Plugin that has been moved - * \param nameAfter name of the Plugin that should be located after - * the moved Plugin after the move operation, so this parameter - * determines the new position of plugin. If an empty string is - * given, plugin will be moved to the end of the list. - * - * \note This method is especially useful for drag and drop reordering. - * Therefore, it will be called whenever the user moves a Plugin in - * the panel ("Move Plugin" in the context menu of the panel). - * - * \sa onMovePluginUp, onMovePluginDown - */ - void movePlugin(Plugin * plugin, QString const & nameAfter); - -signals: - /*! - * \brief pluginAdded gets emitted whenever a new Plugin is added - * to the panel. - */ - void pluginAdded(Plugin * plugin); - /*! - * \brief pluginRemoved gets emitted whenever a Plugin is removed. - * \param plugin The Plugin that was removed. This could be a nullptr. - */ - void pluginRemoved(Plugin * plugin); - /*! - * \brief pluginMoved gets emitted whenever a Plugin is moved. - * - * This signal gets emitted in movePlugin, onMovePluginUp and - * onMovePluginDown. - * - * \param plugin The Plugin that was moved. This could be a nullptr. - * - * \sa pluginMovedUp - */ - void pluginMoved(Plugin * plugin); //plugin can be nullptr in case of move of not loaded plugin - /*! - * \brief pluginMovedUp gets emitted whenever a Plugin is moved a single - * slot upwards. - * - * When a Plugin is moved a single slot upwards, this signal will be - * emitted additionally to the pluginMoved signal so that two signals - * get emitted. - * - * If a Plugin is moved downwards, that Plugin will swap places with - * the following Plugin so that the result equals moving the following - * Plugin a single slot upwards. So, whenever two adjacent Plugins - * swap their places, this signal gets emitted with the Plugin that - * moves upwards as parameter. - * - * For simplified use, only this signal is implemented. There is no - * similar pluginMovedDown-signal. - * - * This signal gets emitted from onMovePluginUp and onMovePluginDown. - * - * \param plugin The Plugin that moved a slot upwards. - * - * \sa pluginMoved - */ - void pluginMovedUp(Plugin * plugin); - -public slots: - /*! - * \brief addPlugin Adds a new Plugin to the model. - * - * \param desktopFile The PluginInfo (which inherits XdgDesktopFile) - * for the Plugin that should be added. - * - * \note AddPluginDialog::pluginSelected is connected to this slot. - */ - void addPlugin(const LXQt::PluginInfo &desktopFile); - /*! - * \brief removePlugin Removes a Plugin from the model. - * - * The Plugin to remove is identified by the QObject::sender() method - * when the slot is called. Therefore, this method should only be called - * by connecting a signal that a Plugin will emit to this slot. - * Otherwise, nothing will happen. - * - * \note Plugin::remove is connected to this slot as soon as the - * Plugin is loaded in the PanelPluginsModel. - */ - void removePlugin(); - - // slots for configuration dialog - /*! - * \brief onMovePluginUp Moves the Plugin corresponding to the given - * model index a slot upwards. - * - * \note The 'Up' button in the configuration widget is connected to this - * slot. - */ - void onMovePluginUp(QModelIndex const & index); - /*! - * \brief onMovePluginDown Moves the Plugin corresponding to the given - * model index a slot downwards. - * - * \note The 'Down' button in the configuration widget is connected to this - * slot. - */ - void onMovePluginDown(QModelIndex const & index); - /*! - * \brief onConfigurePlugin If the Plugin corresponding to the given - * model index has a config dialog (checked via the flag - * ILXQtPanelPlugin::HaveConfigDialog), this method shows - * it by calling plugin->showConfigureDialog(). - * - * \note The 'Configure' button in the configuration widget is connected to - * this slot. - */ - void onConfigurePlugin(QModelIndex const & index); - /*! - * \brief onRemovePlugin Removes the Plugin corresponding to the given - * model index from the Model. - * - * \note The 'Remove' button in the configuration widget is connected to - * this slot. - */ - void onRemovePlugin(QModelIndex const & index); - -private: - /*! - * \brief pluginslist_t is the data type used for mPlugins which stores - * all the Plugins. - * - * \sa mPlugins - */ - typedef QList > > pluginslist_t; - -private: - /*! - * \brief loadPlugins Loads all the Plugins. - * \param desktopDirs These directories are scanned for corresponding - * .desktop-files which are necessary to load the plugins. - */ - void loadPlugins(QStringList const & desktopDirs); - /*! - * \brief loadPlugin Loads a Plugin and connects signals and slots. - * \param desktopFile The desktop file that specifies how to load the - * Plugin. - * \param settingsGroup QString which specifies the settings group. This - * will only be redirected to the Plugin so that it knows how to read - * its settings. - * \return A QPointer to the Plugin that was loaded. - */ - QPointer loadPlugin(LXQt::PluginInfo const & desktopFile, QString const & settingsGroup); - /*! - * \brief findNewPluginSettingsGroup Creates a name for a new Plugin - * that is not yet present in the settings file. Whenever multiple - * instances of a single Plugin type are created, they have to be - * distinguished by this name. - * - * The first Plugin of a given type will be named like the type, e.g. - * "mainmenu". If a name is already present, this method tries to - * find a free name by appending increasing integers (starting with 2), - * e.g. "mainmenu2". If, for example, only "mainmenu2" exists because - * "mainmenu" was deleted, "mainmenu" would be returned. So, the method - * always finds the first suitable name that is not yet present in the - * settings file. - * \param pluginType Type of the Plugin. - * \return The created name for the Plugin. - */ - QString findNewPluginSettingsGroup(const QString &pluginType) const; - /*! - * \brief isIndexValid Checks if a given model index is valid for the - * underlying data (column 0, row lower than number of Plugins and - * so on). - */ - bool isIndexValid(QModelIndex const & index) const; - /*! - * \brief removePlugin Removes a given Plugin from the model. - */ - void removePlugin(pluginslist_t::iterator plugin); - - /*! - * \brief mNamesKey The key to the settings-entry that stores the - * names of the Plugins in a panel. Set upon creation, passed as - * a parameter by the panel. - */ - const QString mNamesKey; - /*! - * \brief mPlugins Stores all the Plugins. - * - * mPlugins is a QList of elements while each element corresponds to a - * single Plugin. Each element is a QPair of a QString and a QPointer - * while the QPointer points to a Plugin. - * - * To access the elements, you can use indexing or an iterator on the - * list. For each element p, p.first is the name of the Plugin as it - * is used in the configuration files, p.second.data() is the Plugin. - * - * \sa pluginslist_t - */ - pluginslist_t mPlugins; - /*! - * \brief mPanel Stores a reference to the LXQtPanel. - */ - LXQtPanel * mPanel; -}; - -Q_DECLARE_METATYPE(Plugin const *) - -#endif // PANELPLUGINSMODEL_H diff --git a/panel/plugin.cpp b/panel/plugin.cpp deleted file mode 100644 index 416a87b..0000000 --- a/panel/plugin.cpp +++ /dev/null @@ -1,517 +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: - * Alexander Sokoloff - * - * 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 "plugin.h" -#include "ilxqtpanelplugin.h" -#include "pluginsettings_p.h" -#include "lxqtpanel.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// statically linked built-in plugins -#include "../plugin-clock/lxqtclock.h" // clock -extern void * loadPluginTranslation_clock_helper; -#include "../plugin-desktopswitch/desktopswitch.h" // desktopswitch -extern void * loadPluginTranslation_desktopswitch_helper; -#include "../plugin-mainmenu/lxqtmainmenu.h" // mainmenu -extern void * loadPluginTranslation_mainmenu_helper; -#include "../plugin-quicklaunch/lxqtquicklaunchplugin.h" // quicklaunch -extern void * loadPluginTranslation_quicklaunch_helper; -#include "../plugin-showdesktop/showdesktop.h" // showdesktop -extern void * loadPluginTranslation_showdesktop_helper; -#include "../plugin-spacer/spacer.h" // spacer -extern void * loadPluginTranslation_spacer_helper; -#include "../plugin-statusnotifier/statusnotifier.h" // statusnotifier -extern void * loadPluginTranslation_statusnotifier_helper; -#include "../plugin-taskbar/lxqttaskbarplugin.h" // taskbar -extern void * loadPluginTranslation_taskbar_helper; -#include "../plugin-tray/lxqttrayplugin.h" // tray -extern void * loadPluginTranslation_tray_helper; -#include "../plugin-worldclock/lxqtworldclock.h" // worldclock -extern void * loadPluginTranslation_worldclock_helper; - -QColor Plugin::mMoveMarkerColor= QColor(255, 0, 0, 255); - -/************************************************ - - ************************************************/ -Plugin::Plugin(const LXQt::PluginInfo &desktopFile, LXQt::Settings *settings, const QString &settingsGroup, LXQtPanel *panel) : - QFrame(panel), - mDesktopFile(desktopFile), - mPluginLoader(0), - mPlugin(0), - mPluginWidget(0), - mAlignment(AlignLeft), - mPanel(panel) -{ - mSettings = PluginSettingsFactory::create(settings, settingsGroup); - - setWindowTitle(desktopFile.name()); - mName = desktopFile.name(); - - QStringList dirs; - dirs << QProcessEnvironment::systemEnvironment().value("LXQTPANEL_PLUGIN_PATH").split(":"); - dirs << PLUGIN_DIR; - - bool found = false; - if(ILXQtPanelPluginLibrary const * pluginLib = findStaticPlugin(desktopFile.id())) - { - // this is a static plugin - found = true; - loadLib(pluginLib); - } - else { - // this plugin is a dynamically loadable module - QString baseName = QString("lib%1.so").arg(desktopFile.id()); - foreach(const QString &dirName, dirs) - { - QFileInfo fi(QDir(dirName), baseName); - if (fi.exists()) - { - found = true; - if (loadModule(fi.absoluteFilePath())) - break; - } - } - } - - if (!isLoaded()) - { - if (!found) - qWarning() << QString("Plugin %1 not found in the").arg(desktopFile.id()) << dirs; - - return; - } - - setObjectName(mPlugin->themeId() + "Plugin"); - - // plugin handle for easy context menu - setProperty("NeedsHandle", mPlugin->flags().testFlag(ILXQtPanelPlugin::NeedsHandle)); - - QString s = mSettings->value("alignment").toString(); - - // Retrun default value - if (s.isEmpty()) - { - mAlignment = (mPlugin->flags().testFlag(ILXQtPanelPlugin::PreferRightAlignment)) ? - Plugin::AlignRight : - Plugin::AlignLeft; - } - else - { - mAlignment = (s.toUpper() == "RIGHT") ? - Plugin::AlignRight : - Plugin::AlignLeft; - - } - - if (mPluginWidget) - { - QGridLayout* layout = new QGridLayout(this); - layout->setSpacing(0); - layout->setContentsMargins(0, 0, 0, 0); - setLayout(layout); - layout->addWidget(mPluginWidget, 0, 0); - } - - saveSettings(); - - // delay the connection to settingsChanged to avoid conflicts - // while the plugin is still being initialized - connect(mSettings, &PluginSettings::settingsChanged, - this, &Plugin::settingsChanged); -} - - -/************************************************ - - ************************************************/ -Plugin::~Plugin() -{ - delete mPlugin; - delete mPluginLoader; - delete mSettings; -} - -void Plugin::setAlignment(Plugin::Alignment alignment) -{ - mAlignment = alignment; - saveSettings(); -} - - -/************************************************ - - ************************************************/ -namespace -{ - //helper types for static plugins storage & binary search - typedef std::unique_ptr plugin_ptr_t; - typedef std::tuple plugin_tuple_t; - - //NOTE: Please keep the plugins sorted by name while adding new plugins. - //NOTE2: we need to reference some (dummy) symbol from (autogenerated) LXQtPluginTranslationLoader.cpp - // to be not stripped (as unused/unreferenced) in static linking time - static plugin_tuple_t const static_plugins[] = { -#if defined(WITH_CLOCK_PLUGIN) - std::make_tuple(QLatin1String("clock"), plugin_ptr_t{new LXQtClockPluginLibrary}, loadPluginTranslation_clock_helper),// clock -#endif -#if defined(WITH_DESKTOPSWITCH_PLUGIN) - std::make_tuple(QLatin1String("desktopswitch"), plugin_ptr_t{new DesktopSwitchPluginLibrary}, loadPluginTranslation_desktopswitch_helper),// desktopswitch -#endif -#if defined(WITH_MAINMENU_PLUGIN) - std::make_tuple(QLatin1String("mainmenu"), plugin_ptr_t{new LXQtMainMenuPluginLibrary}, loadPluginTranslation_mainmenu_helper),// mainmenu -#endif -#if defined(WITH_QUICKLAUNCH_PLUGIN) - std::make_tuple(QLatin1String("quicklaunch"), plugin_ptr_t{new LXQtQuickLaunchPluginLibrary}, loadPluginTranslation_quicklaunch_helper),// quicklaunch -#endif -#if defined(WITH_SHOWDESKTOP_PLUGIN) - std::make_tuple(QLatin1String("showdesktop"), plugin_ptr_t{new ShowDesktopLibrary}, loadPluginTranslation_showdesktop_helper),// showdesktop -#endif -#if defined(WITH_SPACER_PLUGIN) - std::make_tuple(QLatin1String("spacer"), plugin_ptr_t{new SpacerPluginLibrary}, loadPluginTranslation_spacer_helper),// spacer -#endif -#if defined(WITH_STATUSNOTIFIER_PLUGIN) - std::make_tuple(QLatin1String("statusnotifier"), plugin_ptr_t{new StatusNotifierLibrary}, loadPluginTranslation_statusnotifier_helper),// statusnotifier -#endif -#if defined(WITH_TASKBAR_PLUGIN) - std::make_tuple(QLatin1String("taskbar"), plugin_ptr_t{new LXQtTaskBarPluginLibrary}, loadPluginTranslation_taskbar_helper),// taskbar -#endif -#if defined(WITH_TRAY_PLUGIN) - std::make_tuple(QLatin1String("tray"), plugin_ptr_t{new LXQtTrayPluginLibrary}, loadPluginTranslation_tray_helper),// tray -#endif -#if defined(WITH_WORLDCLOCK_PLUGIN) - std::make_tuple(QLatin1String("worldclock"), plugin_ptr_t{new LXQtWorldClockLibrary}, loadPluginTranslation_worldclock_helper),// worldclock -#endif - }; - static constexpr plugin_tuple_t const * const plugins_begin = static_plugins; - static constexpr plugin_tuple_t const * const plugins_end = static_plugins + sizeof (static_plugins) / sizeof (static_plugins[0]); - - struct assert_helper - { - assert_helper() - { - Q_ASSERT(std::is_sorted(plugins_begin, plugins_end - , [] (plugin_tuple_t const & p1, plugin_tuple_t const & p2) -> bool { return std::get<0>(p1) < std::get<0>(p2); })); - } - }; - static assert_helper h; -} - -ILXQtPanelPluginLibrary const * Plugin::findStaticPlugin(const QString &libraryName) -{ - // find a static plugin library by name -> binary search - plugin_tuple_t const * plugin = std::lower_bound(plugins_begin, plugins_end, libraryName - , [] (plugin_tuple_t const & plugin, QString const & name) -> bool { return std::get<0>(plugin) < name; }); - if (plugins_end != plugin && libraryName == std::get<0>(*plugin)) - return std::get<1>(*plugin).get(); - return nullptr; -} - -// load a plugin from a library -bool Plugin::loadLib(ILXQtPanelPluginLibrary const * pluginLib) -{ - ILXQtPanelPluginStartupInfo startupInfo; - startupInfo.settings = mSettings; - startupInfo.desktopFile = &mDesktopFile; - startupInfo.lxqtPanel = mPanel; - - mPlugin = pluginLib->instance(startupInfo); - if (!mPlugin) - { - qWarning() << QString("Can't load plugin \"%1\". Plugin can't build ILXQtPanelPlugin.").arg(mDesktopFile.id()); - return false; - } - - mPluginWidget = mPlugin->widget(); - if (mPluginWidget) - { - mPluginWidget->setObjectName(mPlugin->themeId()); - watchWidgets(mPluginWidget); - } - this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - return true; -} - -// load dynamic plugin from a *.so module -bool Plugin::loadModule(const QString &libraryName) -{ - mPluginLoader = new QPluginLoader(libraryName); - - if (!mPluginLoader->load()) - { - qWarning() << mPluginLoader->errorString(); - return false; - } - - QObject *obj = mPluginLoader->instance(); - if (!obj) - { - qWarning() << mPluginLoader->errorString(); - return false; - } - - ILXQtPanelPluginLibrary* pluginLib= qobject_cast(obj); - if (!pluginLib) - { - qWarning() << QString("Can't load plugin \"%1\". Plugin is not a ILXQtPanelPluginLibrary.").arg(mPluginLoader->fileName()); - delete obj; - return false; - } - return loadLib(pluginLib); -} - -/************************************************ - - ************************************************/ -void Plugin::watchWidgets(QObject * const widget) -{ - // the QWidget might not be fully constructed yet, but we can rely on the isWidgetType() - if (!widget->isWidgetType()) - return; - widget->installEventFilter(this); - // watch also children (recursive) - for (auto const & child : widget->children()) - { - watchWidgets(child); - } -} - -/************************************************ - - ************************************************/ -void Plugin::unwatchWidgets(QObject * const widget) -{ - widget->removeEventFilter(this); - // unwatch also children (recursive) - for (auto const & child : widget->children()) - { - unwatchWidgets(child); - } -} - -/************************************************ - - ************************************************/ -void Plugin::settingsChanged() -{ - mPlugin->settingsChanged(); -} - - -/************************************************ - - ************************************************/ -void Plugin::saveSettings() -{ - mSettings->setValue("alignment", (mAlignment == AlignLeft) ? "Left" : "Right"); - mSettings->setValue("type", mDesktopFile.id()); - mSettings->sync(); - -} - - -/************************************************ - - ************************************************/ -void Plugin::contextMenuEvent(QContextMenuEvent *event) -{ - mPanel->showPopupMenu(this); -} - - -/************************************************ - - ************************************************/ -void Plugin::mousePressEvent(QMouseEvent *event) -{ - switch (event->button()) - { - case Qt::LeftButton: - mPlugin->activated(ILXQtPanelPlugin::Trigger); - break; - - case Qt::MidButton: - mPlugin->activated(ILXQtPanelPlugin::MiddleClick); - break; - - default: - break; - } -} - - -/************************************************ - - ************************************************/ -void Plugin::mouseDoubleClickEvent(QMouseEvent*) -{ - mPlugin->activated(ILXQtPanelPlugin::DoubleClick); -} - - -/************************************************ - - ************************************************/ -void Plugin::showEvent(QShowEvent *) -{ - if (mPluginWidget) - mPluginWidget->adjustSize(); -} - - -/************************************************ - - ************************************************/ -QMenu *Plugin::popupMenu() const -{ - QString name = this->name().replace("&", "&&"); - QMenu* menu = new QMenu(windowTitle()); - - if (mPlugin->flags().testFlag(ILXQtPanelPlugin::HaveConfigDialog)) - { - QAction* configAction = new QAction( - XdgIcon::fromTheme(QLatin1String("preferences-other")), - tr("Configure \"%1\"").arg(name), menu); - menu->addAction(configAction); - connect(configAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog())); - } - - QAction* moveAction = new QAction(XdgIcon::fromTheme("transform-move"), tr("Move \"%1\"").arg(name), menu); - menu->addAction(moveAction); - connect(moveAction, SIGNAL(triggered()), this, SIGNAL(startMove())); - - menu->addSeparator(); - - QAction* removeAction = new QAction( - XdgIcon::fromTheme(QLatin1String("list-remove")), - tr("Remove \"%1\"").arg(name), menu); - menu->addAction(removeAction); - connect(removeAction, SIGNAL(triggered()), this, SLOT(requestRemove())); - - return menu; -} - - -/************************************************ - - ************************************************/ -bool Plugin::isSeparate() const -{ - return mPlugin->isSeparate(); -} - - -/************************************************ - - ************************************************/ -bool Plugin::isExpandable() const -{ - return mPlugin->isExpandable(); -} - - -/************************************************ - - ************************************************/ -bool Plugin::eventFilter(QObject * watched, QEvent * event) -{ - switch (event->type()) - { - case QEvent::DragLeave: - emit dragLeft(); - break; - case QEvent::ChildAdded: - watchWidgets(dynamic_cast(event)->child()); - break; - case QEvent::ChildRemoved: - unwatchWidgets(dynamic_cast(event)->child()); - break; - default: - break; - } - return false; -} - -/************************************************ - - ************************************************/ -void Plugin::realign() -{ - if (mPlugin) - mPlugin->realign(); -} - - -/************************************************ - - ************************************************/ -void Plugin::showConfigureDialog() -{ - if (!mConfigDialog) - mConfigDialog = mPlugin->configureDialog(); - - if (!mConfigDialog) - return; - - connect(this, &Plugin::destroyed, mConfigDialog.data(), &QWidget::close); - mPanel->willShowWindow(mConfigDialog); - mConfigDialog->show(); - mConfigDialog->raise(); - mConfigDialog->activateWindow(); - - WId wid = mConfigDialog->windowHandle()->winId(); - KWindowSystem::activateWindow(wid); - KWindowSystem::setOnDesktop(wid, KWindowSystem::currentDesktop()); -} - - -/************************************************ - - ************************************************/ -void Plugin::requestRemove() -{ - emit remove(); - deleteLater(); -} diff --git a/panel/plugin.h b/panel/plugin.h deleted file mode 100644 index 20c26a4..0000000 --- a/panel/plugin.h +++ /dev/null @@ -1,134 +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: - * Alexander Sokoloff - * - * 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 PLUGIN_H -#define PLUGIN_H - -#include -#include -#include -#include -#include -#include "ilxqtpanel.h" -#include "lxqtpanelglobals.h" -#include "pluginsettings.h" - -class QPluginLoader; -class QSettings; -class ILXQtPanelPlugin; -class ILXQtPanelPluginLibrary; -class LXQtPanel; -class QMenu; - - -class LXQT_PANEL_API Plugin : public QFrame -{ - Q_OBJECT - - Q_PROPERTY(QColor moveMarkerColor READ moveMarkerColor WRITE setMoveMarkerColor) -public: - enum Alignment { - AlignLeft, - AlignRight - }; - - - explicit Plugin(const LXQt::PluginInfo &desktopFile, LXQt::Settings *settings, const QString &settingsGroup, LXQtPanel *panel); - ~Plugin(); - - bool isLoaded() const { return mPlugin != 0; } - Alignment alignment() const { return mAlignment; } - void setAlignment(Alignment alignment); - - QString settingsGroup() const { return mSettings->group(); } - - void saveSettings(); - - QMenu* popupMenu() const; - const ILXQtPanelPlugin * iPlugin() const { return mPlugin; } - - const LXQt::PluginInfo desktopFile() const { return mDesktopFile; } - - bool isSeparate() const; - bool isExpandable() const; - - QWidget *widget() { return mPluginWidget; } - - QString name() const { return mName; } - - virtual bool eventFilter(QObject * watched, QEvent * event); - - // For QSS properties .................. - static QColor moveMarkerColor() { return mMoveMarkerColor; } - static void setMoveMarkerColor(QColor color) { mMoveMarkerColor = color; } - -public slots: - void realign(); - void showConfigureDialog(); - void requestRemove(); - -signals: - void startMove(); - void remove(); - /*! - * \brief Signal emitted when this widget or some of its children - * get the DragLeave event delivered. - */ - void dragLeft(); - -protected: - void contextMenuEvent(QContextMenuEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - void showEvent(QShowEvent *event); - -private: - bool loadLib(ILXQtPanelPluginLibrary const * pluginLib); - bool loadModule(const QString &libraryName); - ILXQtPanelPluginLibrary const * findStaticPlugin(const QString &libraryName); - void watchWidgets(QObject * const widget); - void unwatchWidgets(QObject * const widget); - - const LXQt::PluginInfo mDesktopFile; - QPluginLoader *mPluginLoader; - ILXQtPanelPlugin *mPlugin; - QWidget *mPluginWidget; - Alignment mAlignment; - PluginSettings *mSettings; - LXQtPanel *mPanel; - static QColor mMoveMarkerColor; - QString mName; - QPointer mConfigDialog; //!< plugin's config dialog (if any) - -private slots: - void settingsChanged(); - -}; - - -#endif // PLUGIN_H diff --git a/panel/pluginmoveprocessor.cpp b/panel/pluginmoveprocessor.cpp deleted file mode 100644 index 67c159a..0000000 --- a/panel/pluginmoveprocessor.cpp +++ /dev/null @@ -1,314 +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: - * Alexander Sokoloff - * - * 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 "pluginmoveprocessor.h" -#include "plugin.h" -#include "lxqtpanellayout.h" -#include - - -/************************************************ - - ************************************************/ -PluginMoveProcessor::PluginMoveProcessor(LXQtPanelLayout *layout, Plugin *plugin): - QWidget(plugin), - mLayout(layout), - mPlugin(plugin) -{ - mDestIndex = mLayout->indexOf(plugin); - - grabKeyboard(); -} - - -/************************************************ - - ************************************************/ -PluginMoveProcessor::~PluginMoveProcessor() -{ -} - - -/************************************************ - - ************************************************/ -void PluginMoveProcessor::start() -{ - // We have not memoryleaks there. - // The animation will be automatically deleted when stopped. - CursorAnimation *cursorAnimation = new CursorAnimation(); - connect(cursorAnimation, SIGNAL(finished()), this, SLOT(doStart())); - cursorAnimation->setEasingCurve(QEasingCurve::InOutQuad); - cursorAnimation->setDuration(150); - - cursorAnimation->setStartValue(QCursor::pos()); - cursorAnimation->setEndValue(mPlugin->mapToGlobal(mPlugin->rect().center())); - cursorAnimation->start(QAbstractAnimation::DeleteWhenStopped); -} - - -/************************************************ - - ************************************************/ -void PluginMoveProcessor::doStart() -{ - setMouseTracking(true); - show(); // Only visible widgets can grab mouse input. - grabMouse(mLayout->isHorizontal() ? Qt::SizeHorCursor : Qt::SizeVerCursor); -} - - -/************************************************ - - ************************************************/ -void PluginMoveProcessor::mouseMoveEvent(QMouseEvent *event) -{ - QPoint mouse = mLayout->parentWidget()->mapFromGlobal(event->globalPos()); - - MousePosInfo pos = itemByMousePos(mouse); - - QLayoutItem *prevItem = 0; - QLayoutItem *nextItem = 0; - if (pos.after) - { - mDestIndex = pos.index + 1; - prevItem = pos.item; - nextItem = mLayout->itemAt(pos.index + 1); - } - else - { - prevItem = mLayout->itemAt(pos.index - 1); - nextItem = pos.item; - mDestIndex = pos.index; - } - - bool plugSep = mPlugin->isSeparate(); - bool prevSep = LXQtPanelLayout::itemIsSeparate(prevItem); - bool nextSep = LXQtPanelLayout::itemIsSeparate(nextItem); - - if (!nextItem) - { - if (mLayout->isHorizontal()) - drawMark(prevItem, prevSep ? RightMark : BottomMark); - else - drawMark(prevItem, prevSep ? BottomMark : RightMark); - return; - } - - if (mLayout->lineCount() == 1) - { - if (mLayout->isHorizontal()) - drawMark(nextItem, LeftMark); - else - drawMark(nextItem, TopMark); - return; - } - - - if (!prevItem) - { - if (mLayout->isHorizontal()) - drawMark(nextItem, nextSep ? LeftMark : TopMark); - else - drawMark(nextItem, nextSep ? TopMark : LeftMark); - return; - } - - // We prefer to draw line at the top/left of next item. - // But if next item and moved plugin have different types (separate an not) and - // previous item hase same type as moved plugin we draw line at the end of previous one. - if (plugSep != nextSep && plugSep == prevSep) - { - if (mLayout->isHorizontal()) - drawMark(prevItem, prevSep ? RightMark : BottomMark); - else - drawMark(prevItem, prevSep ? BottomMark : RightMark); - } - else - { - if (mLayout->isHorizontal()) - drawMark(nextItem, nextSep ? LeftMark : TopMark); - else - drawMark(nextItem, nextSep ? TopMark : LeftMark); - } -} - - -/************************************************ - - ************************************************/ -PluginMoveProcessor::MousePosInfo PluginMoveProcessor::itemByMousePos(const QPoint mouse) const -{ - MousePosInfo ret; - - for (int i = mLayout->count()-1; i > -1; --i) - { - QLayoutItem *item = mLayout->itemAt(i); - QRect itemRect = item->geometry(); - if (mouse.x() > itemRect.left() && - mouse.y() > itemRect.top()) - { - - ret.index = i; - ret.item = item; - if (mLayout->isHorizontal()) - { - ret.after = LXQtPanelLayout::itemIsSeparate(item) ? - mouse.x() > itemRect.center().x() : - mouse.y() > itemRect.center().y() ; - } - else - { - ret.after = LXQtPanelLayout::itemIsSeparate(item) ? - mouse.y() > itemRect.center().y() : - mouse.x() > itemRect.center().x() ; - } - return ret; - } - } - - ret.index = 0; - ret.item = mLayout->itemAt(0); - ret.after = false; - return ret; -} - - -/************************************************ - - ************************************************/ -void PluginMoveProcessor::drawMark(QLayoutItem *item, MarkType markType) -{ - QWidget *widget = (item) ? item->widget() : 0; - - static QWidget *prevWidget = 0; - if (prevWidget && prevWidget != widget) - prevWidget->setStyleSheet(""); - - prevWidget = widget; - - if (!widget) - return; - - QString border1; - QString border2; - switch(markType) - { - case TopMark: - border1 = "top"; - border2 = "bottom"; - break; - - case BottomMark: - border1 = "bottom"; - border2 = "top"; - break; - - case LeftMark: - border1 = "left"; - border2 = "right"; - break; - - case RightMark: - border1 = "right"; - border2 = "left"; - break; - - } - - widget->setStyleSheet(QString("#%1 {" - "border-%2: 2px solid rgba(%4, %5, %6, %7); " - "border-%3: -2px solid; " - "background-color: transparent; }") - .arg(widget->objectName()) - .arg(border1) - .arg(border2) - .arg(Plugin::moveMarkerColor().red()) - .arg(Plugin::moveMarkerColor().green()) - .arg(Plugin::moveMarkerColor().blue()) - .arg(Plugin::moveMarkerColor().alpha()) - ); -} - - -/************************************************ - - ************************************************/ -void PluginMoveProcessor::mousePressEvent(QMouseEvent *event) -{ - event->accept(); -} - - -/************************************************ - - ************************************************/ -void PluginMoveProcessor::mouseReleaseEvent(QMouseEvent *event) -{ - event->accept(); - releaseMouse(); - setMouseTracking(false); - doFinish(false); -} - -/************************************************ - - ************************************************/ -void PluginMoveProcessor::keyPressEvent(QKeyEvent *event) -{ - if (event->key() == Qt::Key_Escape) { - doFinish(true); - return; - } - QWidget::keyPressEvent(event); -} - -/************************************************ - - ************************************************/ -void PluginMoveProcessor::doFinish(bool cancel) -{ - releaseKeyboard(); - - drawMark(0, TopMark); - - if (!cancel) - { - int currentIdx = mLayout->indexOf(mPlugin); - if (currentIdx == mDestIndex) - return; - - if (mDestIndex > currentIdx) - mDestIndex--; - - mLayout->moveItem(currentIdx, mDestIndex, true); - } - - emit finished(); - deleteLater(); -} diff --git a/panel/pluginmoveprocessor.h b/panel/pluginmoveprocessor.h deleted file mode 100644 index 2ff8bf5..0000000 --- a/panel/pluginmoveprocessor.h +++ /dev/null @@ -1,99 +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: - * Alexander Sokoloff - * - * 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 PLUGINMOVEPROCESSOR_H -#define PLUGINMOVEPROCESSOR_H - -#include -#include -#include -#include "plugin.h" -#include "lxqtpanelglobals.h" - -class LXQtPanelLayout; -class QLayoutItem; - - -class LXQT_PANEL_API PluginMoveProcessor : public QWidget -{ - Q_OBJECT -public: - explicit PluginMoveProcessor(LXQtPanelLayout *layout, Plugin *plugin); - ~PluginMoveProcessor(); - - Plugin *plugin() const { return mPlugin; } - -signals: - void finished(); - -public slots: - void start(); - -protected: - void mouseMoveEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); - -private slots: - void doStart(); - void doFinish(bool cancel); - -private: - enum MarkType - { - TopMark, - BottomMark, - LeftMark, - RightMark - }; - - struct MousePosInfo - { - int index; - QLayoutItem *item; - bool after; - }; - - LXQtPanelLayout *mLayout; - Plugin *mPlugin; - int mDestIndex; - - MousePosInfo itemByMousePos(const QPoint mouse) const; - void drawMark(QLayoutItem *item, MarkType markType); -}; - - -class LXQT_PANEL_API CursorAnimation: public QVariantAnimation -{ - Q_OBJECT -public: - void updateCurrentValue(const QVariant &value) { QCursor::setPos(value.toPoint()); } -}; - -#endif // PLUGINMOVEPROCESSOR_H diff --git a/panel/pluginsettings.cpp b/panel/pluginsettings.cpp deleted file mode 100644 index a047eb9..0000000 --- a/panel/pluginsettings.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Paulo Lieuthier - * - * 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 "pluginsettings.h" -#include "pluginsettings_p.h" -#include - -class PluginSettingsPrivate -{ -public: - PluginSettingsPrivate(LXQt::Settings* settings, const QString &group) - : mSettings(settings) - , mOldSettings(settings) - , mGroup(group) - { - } - - QString prefix() const; - inline QString fullPrefix() const - { - return mGroup + "/" + prefix(); - } - - LXQt::Settings *mSettings; - LXQt::SettingsCache mOldSettings; - QString mGroup; - QStringList mSubGroups; -}; - -QString PluginSettingsPrivate::prefix() const -{ - if (!mSubGroups.empty()) - return mSubGroups.join('/'); - return QString(); -} - -PluginSettings::PluginSettings(LXQt::Settings* settings, const QString &group, QObject *parent) - : QObject(parent) - , d_ptr(new PluginSettingsPrivate{settings, group}) -{ - Q_D(PluginSettings); - connect(d->mSettings, &LXQt::Settings::settingsChangedFromExternal, this, &PluginSettings::settingsChanged); -} - -QString PluginSettings::group() const -{ - Q_D(const PluginSettings); - return d->mGroup; -} - -PluginSettings::~PluginSettings() -{ -} - -QVariant PluginSettings::value(const QString &key, const QVariant &defaultValue) const -{ - Q_D(const PluginSettings); - d->mSettings->beginGroup(d->fullPrefix()); - QVariant value = d->mSettings->value(key, defaultValue); - d->mSettings->endGroup(); - return value; -} - -void PluginSettings::setValue(const QString &key, const QVariant &value) -{ - Q_D(PluginSettings); - d->mSettings->beginGroup(d->fullPrefix()); - d->mSettings->setValue(key, value); - d->mSettings->endGroup(); - emit settingsChanged(); -} - -void PluginSettings::remove(const QString &key) -{ - Q_D(PluginSettings); - d->mSettings->beginGroup(d->fullPrefix()); - d->mSettings->remove(key); - d->mSettings->endGroup(); - emit settingsChanged(); -} - -bool PluginSettings::contains(const QString &key) const -{ - Q_D(const PluginSettings); - d->mSettings->beginGroup(d->fullPrefix()); - bool ret = d->mSettings->contains(key); - d->mSettings->endGroup(); - return ret; -} - -QList > PluginSettings::readArray(const QString& prefix) -{ - Q_D(PluginSettings); - d->mSettings->beginGroup(d->fullPrefix()); - QList > array; - int size = d->mSettings->beginReadArray(prefix); - for (int i = 0; i < size; ++i) - { - d->mSettings->setArrayIndex(i); - QMap hash; - for (const QString &key : d->mSettings->childKeys()) - hash[key] = d->mSettings->value(key); - array << hash; - } - d->mSettings->endArray(); - d->mSettings->endGroup(); - return array; -} - -void PluginSettings::setArray(const QString &prefix, const QList > &hashList) -{ - Q_D(PluginSettings); - d->mSettings->beginGroup(d->fullPrefix()); - d->mSettings->beginWriteArray(prefix); - int size = hashList.size(); - for (int i = 0; i < size; ++i) - { - d->mSettings->setArrayIndex(i); - QMapIterator it(hashList.at(i)); - while (it.hasNext()) - { - it.next(); - d->mSettings->setValue(it.key(), it.value()); - } - } - d->mSettings->endArray(); - d->mSettings->endGroup(); - emit settingsChanged(); -} - -void PluginSettings::clear() -{ - Q_D(PluginSettings); - d->mSettings->beginGroup(d->mGroup); - d->mSettings->clear(); - d->mSettings->endGroup(); - emit settingsChanged(); -} - -void PluginSettings::sync() -{ - Q_D(PluginSettings); - d->mSettings->beginGroup(d->mGroup); - d->mSettings->sync(); - d->mOldSettings.loadFromSettings(); - d->mSettings->endGroup(); - emit settingsChanged(); -} - -QStringList PluginSettings::allKeys() const -{ - Q_D(const PluginSettings); - d->mSettings->beginGroup(d->fullPrefix()); - QStringList keys = d->mSettings->allKeys(); - d->mSettings->endGroup(); - return keys; -} - -QStringList PluginSettings::childGroups() const -{ - Q_D(const PluginSettings); - d->mSettings->beginGroup(d->fullPrefix()); - QStringList groups = d->mSettings->childGroups(); - d->mSettings->endGroup(); - return groups; -} - -void PluginSettings::beginGroup(const QString &subGroup) -{ - Q_D(PluginSettings); - d->mSubGroups.append(subGroup); -} - -void PluginSettings::endGroup() -{ - Q_D(PluginSettings); - if (!d->mSubGroups.empty()) - d->mSubGroups.removeLast(); -} - -void PluginSettings::loadFromCache() -{ - Q_D(PluginSettings); - d->mSettings->beginGroup(d->mGroup); - d->mOldSettings.loadToSettings(); - d->mSettings->endGroup(); -} - -PluginSettings* PluginSettingsFactory::create(LXQt::Settings *settings, const QString &group, QObject *parent/* = nullptr*/) -{ - return new PluginSettings{settings, group, parent}; -} diff --git a/panel/pluginsettings.h b/panel/pluginsettings.h deleted file mode 100644 index 828c1c0..0000000 --- a/panel/pluginsettings.h +++ /dev/null @@ -1,96 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Paulo Lieuthier - * - * 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 PLUGIN_SETTINGS_H -#define PLUGIN_SETTINGS_H - -#include -#include -#include -#include "lxqtpanelglobals.h" - -namespace LXQt -{ - class Settings; -} -class PluginSettingsFactory; -class PluginSettingsPrivate; - -/*! - * \brief - * Settings for particular plugin. This object/class can be used similarly as \sa QSettings. - * Object cannot be constructed direcly (it is the panel's responsibility to construct it for each plugin). - * - * - * \note - * We are relying here on so called "back linking" (calling a function defined in executable - * back from an external library)... - */ -class LXQT_PANEL_API PluginSettings : public QObject -{ - Q_OBJECT - - //for instantiation - friend class PluginSettingsFactory; - -public: - ~PluginSettings(); - - QString group() const; - - QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const; - void setValue(const QString &key, const QVariant &value); - - void remove(const QString &key); - bool contains(const QString &key) const; - - QList > readArray(const QString &prefix); - void setArray(const QString &prefix, const QList > &hashList); - - void clear(); - void sync(); - - QStringList allKeys() const; - QStringList childGroups() const; - - void beginGroup(const QString &subGroup); - void endGroup(); - - void loadFromCache(); - -signals: - void settingsChanged(); - -private: - explicit PluginSettings(LXQt::Settings *settings, const QString &group, QObject *parent = nullptr); - -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(PluginSettings) -}; - -#endif diff --git a/panel/pluginsettings_p.h b/panel/pluginsettings_p.h deleted file mode 100644 index 82e9e45..0000000 --- a/panel/pluginsettings_p.h +++ /dev/null @@ -1,39 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Paulo Lieuthier - * - * 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 PLUGIN_SETTINGS_P_H -#define PLUGIN_SETTINGS_P_H - -#include "pluginsettings.h" - -class PluginSettingsFactory -{ -public: - static PluginSettings * create(LXQt::Settings *settings, const QString &group, QObject *parent = nullptr); -}; - -#endif //PLUGIN_SETTINGS_P_H diff --git a/panel/popupmenu.cpp b/panel/popupmenu.cpp deleted file mode 100644 index d8aa3b6..0000000 --- a/panel/popupmenu.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2012 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "popupmenu.h" -#include -#include -#include -#include - -static const char POPUPMENU_TITLE[] = "POPUP_MENU_TITLE_OBJECT_NAME"; - -/************************************************ - - ************************************************/ -QAction* PopupMenu::addTitle(const QIcon &icon, const QString &text) -{ - QAction *buttonAction = new QAction(this); - QFont font = buttonAction->font(); - font.setBold(true); - buttonAction->setText(QString(text).replace("&", "&&")); - buttonAction->setFont(font); - buttonAction->setIcon(icon); - - QWidgetAction *action = new QWidgetAction(this); - action->setObjectName(POPUPMENU_TITLE); - QToolButton *titleButton = new QToolButton(this); - titleButton->installEventFilter(this); // prevent clicks on the title of the menu - titleButton->setDefaultAction(buttonAction); - titleButton->setDown(true); // prevent hover style changes in some styles - titleButton->setCheckable(true); - titleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - action->setDefaultWidget(titleButton); - - addAction(action); - return action; -} - - -/************************************************ - - ************************************************/ -QAction* PopupMenu::addTitle(const QString &text) -{ - return addTitle(QIcon(), text); -} - - -/************************************************ - - ************************************************/ -bool PopupMenu::eventFilter(QObject *object, QEvent *event) -{ - Q_UNUSED(object); - - if (event->type() == QEvent::Paint || - event->type() == QEvent::KeyPress || - event->type() == QEvent::KeyRelease - ) - { - return false; - } - - event->accept(); - return true; -} - - -/************************************************ - - ************************************************/ -void PopupMenu::keyPressEvent(QKeyEvent* e) -{ - if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down) - { - QMenu::keyPressEvent(e); - - QWidgetAction *action = qobject_cast(this->activeAction()); - QWidgetAction *firstAction = action; - - while (action && action->objectName() == POPUPMENU_TITLE) - { - this->keyPressEvent(e); - action = qobject_cast(this->activeAction()); - - if (firstAction == action) // we looped and only found titles - { - this->setActiveAction(0); - break; - } - } - - return; - } - - QMenu::keyPressEvent(e); -} - - diff --git a/panel/popupmenu.h b/panel/popupmenu.h deleted file mode 100644 index 408b913..0000000 --- a/panel/popupmenu.h +++ /dev/null @@ -1,50 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2012 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 POPUPMENU_H -#define POPUPMENU_H - -#include -#include "lxqtpanelglobals.h" - -class LXQT_PANEL_API PopupMenu: public QMenu -{ -public: - explicit PopupMenu(QWidget *parent = 0): QMenu(parent) {} - explicit PopupMenu(const QString &title, QWidget *parent = 0): QMenu(title, parent) {} - - QAction* addTitle(const QIcon &icon, const QString &text); - QAction* addTitle(const QString &text); - - bool eventFilter(QObject *object, QEvent *event); - -protected: - virtual void keyPressEvent(QKeyEvent* e); -}; - -#endif // POPUPMENU_H diff --git a/panel/resources/panel.conf b/panel/resources/panel.conf deleted file mode 100644 index b749831..0000000 --- a/panel/resources/panel.conf +++ /dev/null @@ -1,40 +0,0 @@ -panels=panel1 - -[panel1] -plugins=mainmenu,desktopswitch,quicklaunch,taskbar,tray,statusnotifier,mount,volume,clock,showdesktop -position=Bottom -desktop=0 - -[mainmenu] -type=mainmenu - -[desktopswitch] -type=desktopswitch - -[quicklaunch] -type=quicklaunch -alignment=Left - -[taskbar] -type=taskbar - -[tray] -type=tray - -[mount] -type=mount - -[worldclock] -type=worldclock - -[volume] -device=0 -type=volume - -[showdesktop] -alignment=Right -type=showdesktop - -[statusnotifier] -alignment=Right -type=statusnotifier diff --git a/panel/windownotifier.cpp b/panel/windownotifier.cpp deleted file mode 100644 index 0b41057..0000000 --- a/panel/windownotifier.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Palo Kisa - * - * 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 "windownotifier.h" -#include -#include - -void WindowNotifier::observeWindow(QWidget * w) -{ - //installing the same filter object multiple times doesn't harm - w->installEventFilter(this); -} - - -bool WindowNotifier::eventFilter(QObject * watched, QEvent * event) -{ - QWidget * widget = qobject_cast(watched); //we're observing only QWidgetw - auto it = std::lower_bound(mShownWindows.begin(), mShownWindows.end(), widget); - switch (event->type()) - { - case QEvent::Close: - watched->removeEventFilter(this); - //no break - case QEvent::Hide: - Q_ASSERT(mShownWindows.end() != it); - mShownWindows.erase(it); - if (mShownWindows.isEmpty()) - emit lastHidden(); - break; - case QEvent::Show: - { - const bool first_shown = mShownWindows.isEmpty(); - mShownWindows.insert(it, widget); //we keep the mShownWindows sorted - if (first_shown) - emit firstShown(); - } - default: - break; - } - return false; -} diff --git a/panel/windownotifier.h b/panel/windownotifier.h deleted file mode 100644 index 53f2f3f..0000000 --- a/panel/windownotifier.h +++ /dev/null @@ -1,53 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Palo Kisa - * - * 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 */ - -#if !defined(WINDOWNOTIFIER_H) -#define WINDOWNOTIFIER_H - -#include - -class QWidget; - -class WindowNotifier : public QObject -{ - Q_OBJECT -public: - using QObject::QObject; - - void observeWindow(QWidget * w); - inline bool isAnyWindowShown() const { return !mShownWindows.isEmpty(); } - - virtual bool eventFilter(QObject * watched, QEvent * event) override; -signals: - void lastHidden(); - void firstShown(); - -private: - QList mShownWindows; //!< known shown windows (sorted) -}; - -#endif diff --git a/plugin-clock/CMakeLists.txt b/plugin-clock/CMakeLists.txt deleted file mode 100644 index d044761..0000000 --- a/plugin-clock/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -set(PLUGIN "clock") - -set(HEADERS - lxqtclock.h - lxqtclockconfiguration.h - calendarpopup.h -) - -set(SOURCES - lxqtclock.cpp - lxqtclockconfiguration.cpp - calendarpopup.cpp -) - -set(UIS - lxqtclockconfiguration.ui -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-clock/calendarpopup.cpp b/plugin-clock/calendarpopup.cpp deleted file mode 100644 index 0203ecf..0000000 --- a/plugin-clock/calendarpopup.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2014 LXQt team - * Authors: - * Paulo Lieuthier - * - * 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 "calendarpopup.h" -#include -#include - -CalendarPopup::CalendarPopup(QWidget *parent): - QDialog(parent, Qt::Window | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint) -{ - setLayout(new QHBoxLayout(this)); - layout()->setMargin(1); - - cal = new QCalendarWidget(this); - layout()->addWidget(cal); - adjustSize(); -} - -CalendarPopup::~CalendarPopup() -{ -} - -void CalendarPopup::show() -{ - cal->setSelectedDate(QDate::currentDate()); - activateWindow(); - QDialog::show(); -} - -void CalendarPopup::setFirstDayOfWeek(Qt::DayOfWeek wday) -{ - cal->setFirstDayOfWeek(wday); -} diff --git a/plugin-clock/calendarpopup.h b/plugin-clock/calendarpopup.h deleted file mode 100644 index a40b89b..0000000 --- a/plugin-clock/calendarpopup.h +++ /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: 2014 LXQt team - * Authors: - * Paulo Lieuthier - * - * 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 CALENDARPOPUP_H -#define CALENDARPOPUP_H - -#include -#include - -class CalendarPopup : public QDialog -{ - Q_OBJECT - -public: - CalendarPopup(QWidget *parent = 0); - ~CalendarPopup(); - void setFirstDayOfWeek(Qt::DayOfWeek wday); - - void show(); - -private: - QCalendarWidget *cal; -}; - -#endif // CALENDARPOPUP_H diff --git a/plugin-clock/lxqtclock.cpp b/plugin-clock/lxqtclock.cpp deleted file mode 100644 index 9bfa746..0000000 --- a/plugin-clock/lxqtclock.cpp +++ /dev/null @@ -1,346 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2013 Razor team - * Authors: - * Christopher "VdoP" Regali - * Alexander Sokoloff - * Maciej Płaza - * Kuzma Shapran - * - * 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 "lxqtclock.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -static void notifyAboutDeprecation(PluginSettings * settings) -{ - // this is called only from LXQtClock c-tor...so just from main thread, no locking needed - // Note: we get/store the "dont_show" in section of particular instance of clock => this is not 100% valid - // for al possible changes of panel configuration, but we can live with this - static bool notification_done = settings->value(QLatin1String("dont_show_deprecation"), false).toBool(); - if (!notification_done) - { - LXQt::Notification * notification = new LXQt::Notification{LXQtClock::tr("Date&Time (clock) plugin is deprecated")}; - notification->setBody(LXQtClock::tr("The clock plugin is deprecated and will be removed in future version of LXQt. Consider" - " replacing it with worldclock.
")); - notification->setActions({LXQtClock::tr("don't show this again")}); - notification->setTimeout(5000); - QObject::connect(notification, &LXQt::Notification::actionActivated, settings, [notification, settings] (int actionNumber) -> void - { - if (actionNumber == 0) - settings->setValue(QLatin1String("dont_show_deprecation"), true); - notification->close(); - }); - QObject::connect(notification, &LXQt::Notification::notificationClosed, notification, &QObject::deleteLater); - notification->update(); - notification_done = true; - } -} - -/** - * @file lxqtclock.cpp - * @brief implements LXQtclock and LXQtclockgui - * @author Christopher "VdoP" Regali - * @author Kuzma Shapran - */ - -class DownscaleFontStyle : public QProxyStyle -{ - using QProxyStyle::QProxyStyle; -public: - - virtual void drawItemText(QPainter * painter, const QRect & rect, int flags - , const QPalette & pal, bool enabled, const QString & text - , QPalette::ColorRole textRole = QPalette::NoRole) const override - { - while (1 < painter->font().pointSize() - && !(rect.size() - painter->fontMetrics().boundingRect(text).size()).isValid()) - { - QFont f{painter->font()}; - f.setPointSize(f.pointSize() - 1); - painter->setFont(f); - } - return QProxyStyle::drawItemText(painter, rect, flags, pal, enabled, text, textRole); - } -}; - -/** - * @brief constructor - */ -LXQtClock::LXQtClock(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - mAutoRotate(true), - mTextStyle{new DownscaleFontStyle}, - mCurrentCharCount(0) -{ - QTimer::singleShot(0, this, [this] { notifyAboutDeprecation(settings()); }); - - mMainWidget = new QWidget(); - mRotatedWidget = new LXQt::RotatedWidget(*(new QWidget()), mMainWidget); - mContent = mRotatedWidget->content(); - mContent->setStyle(mTextStyle.data()); - mTimeLabel = new QLabel(mContent); - mDateLabel = new QLabel(mContent); - - QVBoxLayout *borderLayout = new QVBoxLayout(mMainWidget); - borderLayout->setContentsMargins(0, 0, 0, 0); - borderLayout->setSpacing(0); - borderLayout->addWidget(mRotatedWidget, 0, Qt::AlignCenter); - - mTimeLabel->setObjectName("TimeLabel"); - mDateLabel->setObjectName("DateLabel"); - - mTimeLabel->setAlignment(Qt::AlignCenter); - mDateLabel->setAlignment(Qt::AlignCenter); - - mContent->setLayout(new QVBoxLayout{mContent}); - mContent->layout()->setContentsMargins(0, 0, 0, 0); - mContent->layout()->setSpacing(0); - mContent->layout()->addWidget(mTimeLabel); - mContent->layout()->addWidget(mDateLabel); - - mClockTimer = new QTimer(this); - mClockTimer->setTimerType(Qt::PreciseTimer); - connect (mClockTimer, SIGNAL(timeout()), SLOT(updateTime())); - - mClockFormat = "hh:mm"; - - mCalendarPopup = new CalendarPopup(mContent); - - mMainWidget->installEventFilter(this); - settingsChanged(); -} - -/** - * @brief destructor - */ -LXQtClock::~LXQtClock() -{ - delete mMainWidget; -} - -QDateTime LXQtClock::currentDateTime() -{ - return QDateTime(mUseUTC ? QDateTime::currentDateTimeUtc() : QDateTime::currentDateTime()); -} - -/** - * @brief updates the time - * Color and font settings can be configured in Qt CSS - */ -void LXQtClock::updateTime() -{ - //XXX: do we need this with PreciseTimer ? - if (currentDateTime().time().msec() > 500) - restartTimer(); - - showTime(); -} - -void LXQtClock::showTime() -{ - QDateTime now{currentDateTime()}; - int new_char_count; - if (mDateOnNewLine) - { - QString new_time = QLocale::system().toString(now, mTimeFormat); - QString new_date = QLocale::system().toString(now, mDateFormat); - new_char_count = qMax(new_time.size(), new_date.size()); - mTimeLabel->setText(new_time); - mDateLabel->setText(new_date); - } - else - { - QString new_time = QLocale::system().toString(now, mClockFormat); - new_char_count = new_time.size(); - mTimeLabel->setText(new_time); - } - - //Note: if transformation (custom rendering) is enabled we need the explicit update - //(update doesn't cause superfluous paint events) - mRotatedWidget->update(); - - if (mCurrentCharCount != new_char_count) - { - mCurrentCharCount = new_char_count; - realign(); - } -} - -void LXQtClock::restartTimer() -{ - if (mClockTimer->isActive()) - mClockTimer->stop(); - int updateInterval = mClockTimer->interval(); - QDateTime now{currentDateTime()}; - int delay = updateInterval - ((now.time().msec() + now.time().second() * 1000) % updateInterval); - QTimer::singleShot(delay, Qt::PreciseTimer, mClockTimer, SLOT(start())); - QTimer::singleShot(delay, Qt::PreciseTimer, this, SLOT(updateTime())); -} - -void LXQtClock::settingsChanged() -{ - mFirstDayOfWeek = settings()->value("firstDayOfWeek", -1).toInt(); - if (-1 == mFirstDayOfWeek) - mCalendarPopup->setFirstDayOfWeek(QLocale::system().firstDayOfWeek()); - else - mCalendarPopup->setFirstDayOfWeek(static_cast(mFirstDayOfWeek)); - - mTimeFormat = settings()->value("timeFormat", QLocale::system().timeFormat(QLocale::ShortFormat).toUpper().contains("AP") ? "h:mm AP" : "HH:mm").toString(); - - mUseUTC = settings()->value("UTC", false).toBool(); - if (mUseUTC) - mTimeFormat += "' Z'"; - - mDateFormat = settings()->value("dateFormat", Qt::SystemLocaleShortDate).toString(); - - bool dateBeforeTime = (settings()->value("showDate", "no").toString().toLower() == "before"); - bool dateAfterTime = (settings()->value("showDate", "no").toString().toLower() == "after"); - mDateOnNewLine = (settings()->value("showDate", "no").toString().toLower() == "below"); - - mAutoRotate = settings()->value("autoRotate", true).toBool(); - - if (dateBeforeTime) - mClockFormat = QString("%1 %2").arg(mDateFormat).arg(mTimeFormat); - else if (dateAfterTime) - mClockFormat = QString("%1 %2").arg(mTimeFormat).arg(mDateFormat); - else - mClockFormat = mTimeFormat; - - mDateLabel->setHidden(!mDateOnNewLine); - - // mDateFormat usually does not contain time portion, but since it's possible to use custom date format - it has to be supported. [Kuzma Shapran] - int updateInterval = QString(mTimeFormat + " " + mDateFormat).replace(QRegExp("'[^']*'"),"").contains("s") ? 1000 : 60000; - - QDateTime now = currentDateTime(); - - showTime(); - - if (mClockTimer->interval() != updateInterval) - { - mClockTimer->setInterval(updateInterval); - - restartTimer(); - } -} - -void LXQtClock::realign() -{ - QSize size{QWIDGETSIZE_MAX, QWIDGETSIZE_MAX}; - Qt::Corner origin = Qt::TopLeftCorner; - if (mAutoRotate || panel()->isHorizontal()) - { - switch (panel()->position()) - { - case ILXQtPanel::PositionTop: - case ILXQtPanel::PositionBottom: - origin = Qt::TopLeftCorner; - break; - - case ILXQtPanel::PositionLeft: - origin = Qt::BottomLeftCorner; - break; - - case ILXQtPanel::PositionRight: - origin = Qt::TopRightCorner; - break; - } - - //set minwidth - QFontMetrics metrics{mTimeLabel->font()}; - //Note: using a constant string of reasonably wide characters for computing the width - // (not the current text as width of text can differ for each particular string (based on font)) - size.setWidth(metrics.boundingRect(QString{mCurrentCharCount, 'A'}).width()); - } else if (!panel()->isHorizontal()) - { - size.setWidth(panel()->globalGometry().width()); - } - - mTimeLabel->setFixedWidth(size.width()); - mDateLabel->setFixedWidth(size.width()); - - int label_height = mTimeLabel->sizeHint().height(); - size.setHeight(mDateOnNewLine ? label_height * 2 : label_height); - - const bool changed = mContent->maximumSize() != size || mRotatedWidget->origin() != origin; - - mContent->setFixedSize(size); - mRotatedWidget->setOrigin(origin); - - if (changed) - { - mRotatedWidget->adjustContentSize(); - mRotatedWidget->update(); - } -} - -void LXQtClock::activated(ActivationReason reason) -{ - if (reason != ILXQtPanelPlugin::Trigger) - return; - - if (!mCalendarPopup->isVisible()) - { - QRect pos = calculatePopupWindowPos(mCalendarPopup->size()); - mCalendarPopup->move(pos.topLeft()); - willShowWindow(mCalendarPopup); - mCalendarPopup->show(); - } - else - { - mCalendarPopup->hide(); - } -} - -QDialog * LXQtClock::configureDialog() -{ - return new LXQtClockConfiguration(settings()); -} - -bool LXQtClock::eventFilter(QObject *watched, QEvent *event) -{ - if (watched == mMainWidget) - { - if (event->type() == QEvent::ToolTip) - mMainWidget->setToolTip(QDateTime::currentDateTime().toString(Qt::DefaultLocaleLongDate)); - - return false; - } - - return false; -} diff --git a/plugin-clock/lxqtclock.h b/plugin-clock/lxqtclock.h deleted file mode 100644 index c5e16bf..0000000 --- a/plugin-clock/lxqtclock.h +++ /dev/null @@ -1,105 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2013 Razor team - * Authors: - * Christopher "VdoP" Regali - * Alexander Sokoloff - * Maciej Płaza - * Kuzma Shapran - * - * 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 LXQTCLOCK_H -#define LXQTCLOCK_H - -#include "../panel/ilxqtpanelplugin.h" -#include "lxqtclockconfiguration.h" -#include "calendarpopup.h" -#include - -#include - -class QLabel; -class QDialog; -class QTimer; -class QProxyStyle; - -class LXQtClock : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - LXQtClock(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtClock(); - - virtual Flags flags() const { return PreferRightAlignment | HaveConfigDialog ; } - QString themeId() const { return "Clock"; } - QWidget *widget() { return mMainWidget; } - QDialog *configureDialog(); - void settingsChanged(); - - void activated(ActivationReason reason); - bool isSeparate() const { return true; } - - void realign(); - -public slots: - void updateTime(); - -protected: - bool eventFilter(QObject *watched, QEvent *event); - -private: - QTimer* mClockTimer; - QWidget *mMainWidget; - QWidget *mContent; - LXQt::RotatedWidget* mRotatedWidget; - QLabel* mTimeLabel; - QLabel* mDateLabel; - QString mClockFormat; - QString mToolTipFormat; - CalendarPopup* mCalendarPopup; - QString mTimeFormat; - QString mDateFormat; - bool mDateOnNewLine; - bool mUseUTC; - int mFirstDayOfWeek; - bool mAutoRotate; - QScopedPointer mTextStyle; - int mCurrentCharCount; - - QDateTime currentDateTime(); - void showTime(); - void restartTimer(); -}; - - -class LXQtClockPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - // Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const { return new LXQtClock(startupInfo);} -}; - - -#endif diff --git a/plugin-clock/lxqtclockconfiguration.cpp b/plugin-clock/lxqtclockconfiguration.cpp deleted file mode 100644 index 6d93e28..0000000 --- a/plugin-clock/lxqtclockconfiguration.cpp +++ /dev/null @@ -1,301 +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: - * Maciej Płaza - * - * 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 "lxqtclockconfiguration.h" -#include "ui_lxqtclockconfiguration.h" - -namespace -{ - class FirstDayCombo : public QStandardItemModel - { - public: - FirstDayCombo() - { - QStandardItem* item = 0; - int row = 0; - item = new QStandardItem; - item->setData(-1, Qt::UserRole); - setItem(row, 0, item); - item = new QStandardItem; - item->setData(tr(""), Qt::DisplayRole); - setItem(row, 1, item); - ++row; - for (int wday = Qt::Monday; Qt::Sunday >= wday; ++wday, ++row) - { - item = new QStandardItem; - item->setData(wday, Qt::UserRole); - setItem(row, 0, item); - item = new QStandardItem; - item->setData(QLocale::system().dayName(wday), Qt::DisplayRole); - setItem(row, 1, item); - } - } - - int findIndex(int wday) - { - int i = rowCount() - 1; - for ( ; 0 <= i; --i) - { - if (item(i)->data(Qt::UserRole).toInt() == wday) - break; - } - return i; - } - - }; -} - -LXQtClockConfiguration::LXQtClockConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtClockConfiguration), - mOldIndex(1) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("ClockConfigurationWindow"); - ui->setupUi(this); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), SLOT(dialogButtonsAction(QAbstractButton*))); - - ui->firstDayOfWeekCB->setModel(new FirstDayCombo); - ui->firstDayOfWeekCB->setModelColumn(1); - - loadSettings(); - /* We use clicked() and activated(int) because these signals aren't emitting after programmaticaly - change of state */ - - connect(ui->dateFormatCOB, SIGNAL(activated(int)), SLOT(dateFormatActivated(int))); - - connect(ui->showSecondsCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->ampmClockCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->useUtcCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->dontShowDateRB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->showDateBeforeTimeRB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->showDateAfterTimeRB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->showDateBelowTimeRB, SIGNAL(clicked()), SLOT(saveSettings())); - - connect(ui->autorotateCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->firstDayOfWeekCB, SIGNAL(activated(int)), SLOT(saveSettings())); -} - -LXQtClockConfiguration::~LXQtClockConfiguration() -{ - delete ui; -} - -static int currentYear = QDate::currentDate().year(); - -void LXQtClockConfiguration::addDateFormat(const QString &format) -{ - if (ui->dateFormatCOB->findData(QVariant(format)) == -1) - ui->dateFormatCOB->addItem(QDate(currentYear, 1, 1).toString(format), QVariant(format)); -} - -void LXQtClockConfiguration::createDateFormats() -{ - ui->dateFormatCOB->clear(); - - QString systemDateLocale = QLocale::system().dateFormat(QLocale::ShortFormat).toUpper(); - - if (systemDateLocale.indexOf("Y") < systemDateLocale.indexOf("D")) - // Big-endian (year, month, day) -> in some Asia countires like China or Japan - { - addDateFormat("MMM d"); - addDateFormat("MMMM d"); - addDateFormat("MMM d, ddd"); - addDateFormat("MMMM d, dddd"); - addDateFormat("yyyy MMM d"); - addDateFormat("yyyy MMMM d"); - addDateFormat("yyyy MMM d, ddd"); - addDateFormat("yyyy MMMM d, dddd"); - addDateFormat("MMM dd"); - addDateFormat("MMMM dd"); - addDateFormat("MMM dd, ddd"); - addDateFormat("MMMM dd, dddd"); - addDateFormat("yyyy MMM dd"); - addDateFormat("yyyy MMMM dd"); - addDateFormat("yyyy MMM dd, ddd"); - addDateFormat("yyyy MMMM dd, dddd"); - } - else if (systemDateLocale.indexOf("M") < systemDateLocale.indexOf("D")) - // Middle-endian (month, day, year) -> USA - { - addDateFormat("MMM d"); - addDateFormat("MMMM d"); - addDateFormat("ddd, MMM d"); - addDateFormat("dddd, MMMM d"); - addDateFormat("MMM d yyyy"); - addDateFormat("MMMM d yyyy"); - addDateFormat("ddd, MMM d yyyy"); - addDateFormat("dddd, MMMM d yyyy"); - addDateFormat("MMM dd"); - addDateFormat("MMMM dd"); - addDateFormat("ddd, MMM dd"); - addDateFormat("dddd, MMMM dd"); - addDateFormat("MMM dd yyyy"); - addDateFormat("MMMM dd yyyy"); - addDateFormat("ddd, MMM dd yyyy"); - addDateFormat("dddd, MMMM dd yyyy"); - } - else - // Little-endian (day, month, year) -> most of Europe - { - addDateFormat("d MMM"); - addDateFormat("d MMMM"); - addDateFormat("ddd, d MMM"); - addDateFormat("dddd, d MMMM"); - addDateFormat("d MMM yyyy"); - addDateFormat("d MMMM yyyy"); - addDateFormat("ddd, d MMM yyyy"); - addDateFormat("dddd, d MMMM yyyy"); - addDateFormat("dd MMM"); - addDateFormat("dd MMMM"); - addDateFormat("ddd, dd MMM"); - addDateFormat("dddd, dd MMMM"); - addDateFormat("dd MMM yyyy"); - addDateFormat("dd MMMM yyyy"); - addDateFormat("ddd, dd MMM yyyy"); - addDateFormat("dddd, dd MMMM yyyy"); - } - - addDateFormat(QLocale::system().dateFormat(QLocale::ShortFormat)); - addDateFormat(QLocale::system().dateFormat(QLocale::LongFormat)); - - addDateFormat("yyyy-MM-dd"); // ISO - - if (mCustomDateFormat.isEmpty()) - ui->dateFormatCOB->addItem("Custom ...", QVariant(mCustomDateFormat)); - else - ui->dateFormatCOB->addItem(QString("Custom (%1) ...").arg(QDate(currentYear, 1, 1).toString(mCustomDateFormat)), QVariant(mCustomDateFormat)); -} - -void LXQtClockConfiguration::loadSettings() -{ - QString systemDateLocale = QLocale::system().dateFormat(QLocale::ShortFormat).toUpper(); - QString systemTimeLocale = QLocale::system().timeFormat(QLocale::ShortFormat).toUpper(); - - QString timeFormat = settings().value("timeFormat", systemTimeLocale.contains("AP") ? "h:mm AP" : "HH:mm").toString(); - - ui->showSecondsCB->setChecked(timeFormat.indexOf("ss") > -1); - - ui->ampmClockCB->setChecked(timeFormat.toUpper().indexOf("AP") > -1); - - ui->useUtcCB->setChecked(settings().value("UTC", false).toBool()); - - ui->dontShowDateRB->setChecked(true); - ui->showDateBeforeTimeRB->setChecked(settings().value("showDate", "no").toString().toLower() == "before"); - ui->showDateAfterTimeRB->setChecked(settings().value("showDate", "no").toString().toLower() == "after"); - ui->showDateBelowTimeRB->setChecked(settings().value("showDate", "no").toString().toLower() == "below"); - - mCustomDateFormat = settings().value("customDateFormat", QString()).toString(); - QString dateFormat = settings().value("dateFormat", QLocale::system().dateFormat(QLocale::ShortFormat)).toString(); - - createDateFormats(); - - if (mCustomDateFormat == dateFormat) - ui->dateFormatCOB->setCurrentIndex(ui->dateFormatCOB->count() - 1); - else - { - ui->dateFormatCOB->setCurrentIndex(ui->dateFormatCOB->findData(dateFormat)); - if (ui->dateFormatCOB->currentIndex() < 0) - ui->dateFormatCOB->setCurrentIndex(1); - } - mOldIndex = ui->dateFormatCOB->currentIndex(); - - ui->autorotateCB->setChecked(settings().value("autoRotate", true).toBool()); - ui->firstDayOfWeekCB->setCurrentIndex(dynamic_cast(*(ui->firstDayOfWeekCB->model())).findIndex(settings().value("firstDayOfWeek", -1).toInt())); -} - -void LXQtClockConfiguration::saveSettings() -{ - QString timeFormat(ui->ampmClockCB->isChecked() ? "h:mm AP" : "HH:mm"); - - if (ui->showSecondsCB->isChecked()) - timeFormat.insert(timeFormat.indexOf("mm") + 2, ":ss"); - - settings().setValue("timeFormat", timeFormat); - - settings().setValue("UTC", ui->useUtcCB->isChecked()); - - settings().setValue("showDate", - ui->showDateBeforeTimeRB->isChecked() ? "before" : - (ui->showDateAfterTimeRB->isChecked() ? "after" : - (ui->showDateBelowTimeRB->isChecked() ? "below" : "no" ))); - - settings().setValue("customDateFormat", mCustomDateFormat); - if (ui->dateFormatCOB->currentIndex() == (ui->dateFormatCOB->count() - 1)) - settings().setValue("dateFormat", mCustomDateFormat); - else - settings().setValue("dateFormat", ui->dateFormatCOB->itemData(ui->dateFormatCOB->currentIndex())); - - settings().setValue("autoRotate", ui->autorotateCB->isChecked()); - settings().setValue("firstDayOfWeek", dynamic_cast(*ui->firstDayOfWeekCB->model()).item(ui->firstDayOfWeekCB->currentIndex(), 0)->data(Qt::UserRole)); -} - -void LXQtClockConfiguration::dateFormatActivated(int index) -{ - if (index == ui->dateFormatCOB->count() - 1) - { - bool ok; - QString newCustomDateFormat = QInputDialog::getText(this, tr("Input custom date format"), tr( - "Interpreted sequences of date format are:\n" - "\n" - "d\tthe day as number without a leading zero (1 to 31)\n" - "dd\tthe day as number with a leading zero (01 to 31)\n" - "ddd\tthe abbreviated localized day name (e.g. 'Mon' to 'Sun').\n" - "dddd\tthe long localized day name (e.g. 'Monday' to 'Sunday').\n" - "M\tthe month as number without a leading zero (1-12)\n" - "MM\tthe month as number with a leading zero (01-12)\n" - "MMM\tthe abbreviated localized month name (e.g. 'Jan' to 'Dec').\n" - "MMMM\tthe long localized month name (e.g. 'January' to 'December').\n" - "yy\tthe year as two digit number (00-99)\n" - "yyyy\tthe year as four digit number\n" - "\n" - "All other input characters will be treated as text.\n" - "Any sequence of characters that are enclosed in single quotes (')\n" - "will also be treated as text and not be used as an expression.\n" - "\n" - "\n" - "Custom date format:" - ), QLineEdit::Normal, mCustomDateFormat, &ok); - if (ok) - { - mCustomDateFormat = newCustomDateFormat; - mOldIndex = index; - createDateFormats(); - } - ui->dateFormatCOB->setCurrentIndex(mOldIndex); - } - else - mOldIndex = index; - - saveSettings(); -} diff --git a/plugin-clock/lxqtclockconfiguration.h b/plugin-clock/lxqtclockconfiguration.h deleted file mode 100644 index bf3553a..0000000 --- a/plugin-clock/lxqtclockconfiguration.h +++ /dev/null @@ -1,79 +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: - * Maciej Płaza - * - * 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 LXQTCLOCKCONFIGURATION_H -#define LXQTCLOCKCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" - -#include -#include -#include -#include - -namespace Ui { - class LXQtClockConfiguration; -} - -class LXQtClockConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtClockConfiguration(PluginSettings *settings, QWidget *parent = 0); - ~LXQtClockConfiguration(); - -private: - Ui::LXQtClockConfiguration *ui; - - /* - Read settings from conf file and put data into controls. - */ - void loadSettings(); - - /* - Creates a date formats consistent with the region read from locale. - */ - void createDateFormats(); - -private slots: - /* - Saves settings in conf file. - */ - void saveSettings(); - void dateFormatActivated(int); - -private: - int mOldIndex; - QString mCustomDateFormat; - - void addDateFormat(const QString &format); -}; - -#endif // LXQTCLOCKCONFIGURATION_H diff --git a/plugin-clock/lxqtclockconfiguration.ui b/plugin-clock/lxqtclockconfiguration.ui deleted file mode 100644 index 2912ef3..0000000 --- a/plugin-clock/lxqtclockconfiguration.ui +++ /dev/null @@ -1,232 +0,0 @@ - - - LXQtClockConfiguration - - - - 0 - 0 - 330 - 447 - - - - Clock Settings - - - - - - Time - - - - - - &Show seconds - - - - - - - 12 &hour style - - - - - - - &Use UTC - - - - - - - - - - Date - - - - - - false - - - Date &format - - - dateFormatCOB - - - - - - - false - - - - - - - &Do not show date - - - true - - - - - - - Show date &before time - - - - - - - Show date &after time - - - - - - - Show date below time on new &line - - - - - - - First day of week in calendar - - - firstDayOfWeekCB - - - - - - - - - - - - - - Orientation - - - - - - Auto&rotate when the panel is vertical - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - - buttons - accepted() - LXQtClockConfiguration - accept() - - - 214 - 350 - - - 157 - 274 - - - - - buttons - rejected() - LXQtClockConfiguration - reject() - - - 214 - 350 - - - 196 - 274 - - - - - dontShowDateRB - toggled(bool) - dateFormatL - setDisabled(bool) - - - 68 - 166 - - - 63 - 267 - - - - - dontShowDateRB - toggled(bool) - dateFormatCOB - setDisabled(bool) - - - 174 - 167 - - - 239 - 275 - - - - - diff --git a/plugin-clock/resources/clock.desktop.in b/plugin-clock/resources/clock.desktop.in deleted file mode 100644 index e6e9901..0000000 --- a/plugin-clock/resources/clock.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. -Icon=preferences-system-time - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-clock/translations/clock_ar.desktop b/plugin-clock/translations/clock_ar.desktop deleted file mode 100644 index cc1b687..0000000 --- a/plugin-clock/translations/clock_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=التّاريخ والوقت -Comment[ar]=تعرض الوقت الحاليّ. فيها تقويم. diff --git a/plugin-clock/translations/clock_cs.desktop b/plugin-clock/translations/clock_cs.desktop deleted file mode 100644 index 20f6239..0000000 --- a/plugin-clock/translations/clock_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Hodiny a kalendář -Name[cs]=Hodiny diff --git a/plugin-clock/translations/clock_cs_CZ.desktop b/plugin-clock/translations/clock_cs_CZ.desktop deleted file mode 100644 index c99c1f0..0000000 --- a/plugin-clock/translations/clock_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Hodiny a kalendář -Name[cs_CZ]=Hodiny diff --git a/plugin-clock/translations/clock_da.desktop b/plugin-clock/translations/clock_da.desktop deleted file mode 100644 index 4aa5ecd..0000000 --- a/plugin-clock/translations/clock_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. -Icon=preferences-system-time - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Dato og klokkeslæt -Comment[da]=Viser den aktuelle tid. Der følger en kalender med. diff --git a/plugin-clock/translations/clock_de.desktop b/plugin-clock/translations/clock_de.desktop deleted file mode 100644 index f24f08e..0000000 --- a/plugin-clock/translations/clock_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Uhr und Kalender -Comment[de]=Zeigt die aktuelle Uhrzeit. Ein Kalender ist auch enthalten. diff --git a/plugin-clock/translations/clock_el.desktop b/plugin-clock/translations/clock_el.desktop deleted file mode 100644 index 05f41b1..0000000 --- a/plugin-clock/translations/clock_el.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[el]=Ρολόι και ημερολόγιο -Name[el]=Ρολόι diff --git a/plugin-clock/translations/clock_eo.desktop b/plugin-clock/translations/clock_eo.desktop deleted file mode 100644 index 1042ea5..0000000 --- a/plugin-clock/translations/clock_eo.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eo]=Horloĝo kaj kalendaro -Name[eo]=Horloĝo diff --git a/plugin-clock/translations/clock_es.desktop b/plugin-clock/translations/clock_es.desktop deleted file mode 100644 index bb26d1f..0000000 --- a/plugin-clock/translations/clock_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Reloj y calendario -Name[es]=Reloj diff --git a/plugin-clock/translations/clock_es_VE.desktop b/plugin-clock/translations/clock_es_VE.desktop deleted file mode 100644 index 2621c2b..0000000 --- a/plugin-clock/translations/clock_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Reloj y calendario -Name[es_VE]=Reloj diff --git a/plugin-clock/translations/clock_eu.desktop b/plugin-clock/translations/clock_eu.desktop deleted file mode 100644 index 6edd446..0000000 --- a/plugin-clock/translations/clock_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Erlojua eta egutegia -Name[eu]=Erlojua diff --git a/plugin-clock/translations/clock_fi.desktop b/plugin-clock/translations/clock_fi.desktop deleted file mode 100644 index 0035c6a..0000000 --- a/plugin-clock/translations/clock_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Kello ja kalenteri -Name[fi]=Kello diff --git a/plugin-clock/translations/clock_fr.desktop b/plugin-clock/translations/clock_fr.desktop deleted file mode 100644 index 1035f7b..0000000 --- a/plugin-clock/translations/clock_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Comment[fr]=Horloge et calendrier -Name[fr]=Horloge diff --git a/plugin-clock/translations/clock_hu.desktop b/plugin-clock/translations/clock_hu.desktop deleted file mode 100644 index be55b7c..0000000 --- a/plugin-clock/translations/clock_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=Óra és naptár -Name[hu]=Óra diff --git a/plugin-clock/translations/clock_ia.desktop b/plugin-clock/translations/clock_ia.desktop deleted file mode 100644 index 9c7df24..0000000 --- a/plugin-clock/translations/clock_ia.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Clock -Comment=Clock and calendar - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-clock/translations/clock_id_ID.desktop b/plugin-clock/translations/clock_id_ID.desktop deleted file mode 100644 index 9c7df24..0000000 --- a/plugin-clock/translations/clock_id_ID.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Clock -Comment=Clock and calendar - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-clock/translations/clock_it.desktop b/plugin-clock/translations/clock_it.desktop deleted file mode 100644 index bd40ee3..0000000 --- a/plugin-clock/translations/clock_it.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Comment[it]=Orologio e calendario -Name[it]=Orologio - diff --git a/plugin-clock/translations/clock_ja.desktop b/plugin-clock/translations/clock_ja.desktop deleted file mode 100644 index 67e702a..0000000 --- a/plugin-clock/translations/clock_ja.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ja]=時計とカレンダー -Name[ja]=時計 diff --git a/plugin-clock/translations/clock_ko.desktop b/plugin-clock/translations/clock_ko.desktop deleted file mode 100644 index 9c7df24..0000000 --- a/plugin-clock/translations/clock_ko.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Clock -Comment=Clock and calendar - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-clock/translations/clock_lt.desktop b/plugin-clock/translations/clock_lt.desktop deleted file mode 100644 index 6ccf8b1..0000000 --- a/plugin-clock/translations/clock_lt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[lt]=Laikrodis ir kalendorius -Name[lt]=Laikrodis diff --git a/plugin-clock/translations/clock_nl.desktop b/plugin-clock/translations/clock_nl.desktop deleted file mode 100644 index b041bc1..0000000 --- a/plugin-clock/translations/clock_nl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[nl]=Klok en kalender -Name[nl]=Klok diff --git a/plugin-clock/translations/clock_pl.desktop b/plugin-clock/translations/clock_pl.desktop deleted file mode 100644 index 035b3e4..0000000 --- a/plugin-clock/translations/clock_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Wyświetla obecny czas. Zawiera kalendarz. -Name[pl]=Zegar diff --git a/plugin-clock/translations/clock_pt.desktop b/plugin-clock/translations/clock_pt.desktop deleted file mode 100644 index e4a511f..0000000 --- a/plugin-clock/translations/clock_pt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[pt]=Relógio -Comment[pt]=Relógio e calendário - diff --git a/plugin-clock/translations/clock_pt_BR.desktop b/plugin-clock/translations/clock_pt_BR.desktop deleted file mode 100644 index 42aab78..0000000 --- a/plugin-clock/translations/clock_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Relógio e calendário -Name[pt_BR]=Relógio diff --git a/plugin-clock/translations/clock_ro_RO.desktop b/plugin-clock/translations/clock_ro_RO.desktop deleted file mode 100644 index d4ca3e1..0000000 --- a/plugin-clock/translations/clock_ro_RO.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Afișează ora curentă incluzând și un calendar. -Name[ro_RO]=Data și ora diff --git a/plugin-clock/translations/clock_ru.desktop b/plugin-clock/translations/clock_ru.desktop deleted file mode 100644 index c5bc1dc..0000000 --- a/plugin-clock/translations/clock_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru]=Отображение текущего времени. Поставляется с календарем. -Name[ru]=Дата и время diff --git a/plugin-clock/translations/clock_sk.desktop b/plugin-clock/translations/clock_sk.desktop deleted file mode 100644 index 9730f26..0000000 --- a/plugin-clock/translations/clock_sk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sk]=Hodiny a kalendár -Name[sk]=Hodiny diff --git a/plugin-clock/translations/clock_sl.desktop b/plugin-clock/translations/clock_sl.desktop deleted file mode 100644 index f056c30..0000000 --- a/plugin-clock/translations/clock_sl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sl]=Ura in koledar -Name[sl]=Ura diff --git a/plugin-clock/translations/clock_sr.desktop b/plugin-clock/translations/clock_sr.desktop deleted file mode 100644 index 363f64e..0000000 --- a/plugin-clock/translations/clock_sr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr]=Сат и календар -Name[sr]=Сат diff --git a/plugin-clock/translations/clock_sr@ijekavian.desktop b/plugin-clock/translations/clock_sr@ijekavian.desktop deleted file mode 100644 index 2c1f609..0000000 --- a/plugin-clock/translations/clock_sr@ijekavian.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavian]=Сат -Comment[sr@ijekavian]=Сат и календар diff --git a/plugin-clock/translations/clock_sr@ijekavianlatin.desktop b/plugin-clock/translations/clock_sr@ijekavianlatin.desktop deleted file mode 100644 index f484549..0000000 --- a/plugin-clock/translations/clock_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavianlatin]=Sat -Comment[sr@ijekavianlatin]=Sat i kalendar diff --git a/plugin-clock/translations/clock_sr@latin.desktop b/plugin-clock/translations/clock_sr@latin.desktop deleted file mode 100644 index e1fbd72..0000000 --- a/plugin-clock/translations/clock_sr@latin.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr@latin]=Sat i kalendar -Name[sr@latin]=Sat diff --git a/plugin-clock/translations/clock_th_TH.desktop b/plugin-clock/translations/clock_th_TH.desktop deleted file mode 100644 index 4ec4565..0000000 --- a/plugin-clock/translations/clock_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=นาฬิกาและปฏิทิน -Name[th_TH]=นาฬิกา diff --git a/plugin-clock/translations/clock_tr.desktop b/plugin-clock/translations/clock_tr.desktop deleted file mode 100644 index b17ccc5..0000000 --- a/plugin-clock/translations/clock_tr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[tr]=Saat ve takvim -Name[tr]=Saat diff --git a/plugin-clock/translations/clock_uk.desktop b/plugin-clock/translations/clock_uk.desktop deleted file mode 100644 index a76879c..0000000 --- a/plugin-clock/translations/clock_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Показує поточний час. Календар -Name[uk]=Дата і час diff --git a/plugin-clock/translations/clock_zh_CN.GB2312.desktop b/plugin-clock/translations/clock_zh_CN.GB2312.desktop deleted file mode 100644 index 9c7df24..0000000 --- a/plugin-clock/translations/clock_zh_CN.GB2312.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Clock -Comment=Clock and calendar - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-clock/translations/clock_zh_CN.desktop b/plugin-clock/translations/clock_zh_CN.desktop deleted file mode 100644 index f875ee0..0000000 --- a/plugin-clock/translations/clock_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=时钟和日历 -Name[zh_CN]=时钟 diff --git a/plugin-clock/translations/clock_zh_TW.desktop b/plugin-clock/translations/clock_zh_TW.desktop deleted file mode 100644 index 12bbe25..0000000 --- a/plugin-clock/translations/clock_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Date & time -Comment=Displays the current time. Comes with a calendar. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=時鐘與日曆 -Name[zh_TW]=時鐘 diff --git a/plugin-colorpicker/CMakeLists.txt b/plugin-colorpicker/CMakeLists.txt deleted file mode 100644 index 8d6484e..0000000 --- a/plugin-colorpicker/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -set(PLUGIN "colorpicker") - -set(HEADERS - colorpicker.h -) - -set(SOURCES - colorpicker.cpp -) - -set(UIS "") - -set(LIBRARIES - lxqt -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-colorpicker/colorpicker.cpp b/plugin-colorpicker/colorpicker.cpp deleted file mode 100644 index 9c12f65..0000000 --- a/plugin-colorpicker/colorpicker.cpp +++ /dev/null @@ -1,103 +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: - * Aaron Lewis - * - * 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 "colorpicker.h" -#include -#include -#include - - -ColorPicker::ColorPicker(const ILXQtPanelPluginStartupInfo &startupInfo) : - QObject(), - ILXQtPanelPlugin(startupInfo) -{ - realign(); -} - - -ColorPicker::~ColorPicker() -{ -} - - -void ColorPicker::realign() -{ - mWidget.button()->setFixedHeight(panel()->iconSize()); - mWidget.button()->setFixedWidth(panel()->iconSize()); - mWidget.lineEdit()->setFixedHeight(panel()->iconSize()); -} - - -ColorPickerWidget::ColorPickerWidget(QWidget *parent): - QFrame(parent) -{ - QFontMetrics fm (mLineEdit.font()); - mLineEdit.setFixedWidth ( 10*fm.width ("a") ); - - QHBoxLayout *layout = new QHBoxLayout(this); - setLayout(layout); - layout->addWidget (&mButton); - layout->addWidget (&mLineEdit); - - - mButton.setAutoRaise(true); - mButton.setIcon(XdgIcon::fromTheme("color-picker", "kcolorchooser")); - - mCapturing = false; - connect(&mButton, SIGNAL(clicked()), this, SLOT(captureMouse())); - -} - - -ColorPickerWidget::~ColorPickerWidget() -{ -} - - -void ColorPickerWidget::mouseReleaseEvent(QMouseEvent *event) -{ - if (!mCapturing) - return; - - WId id = QApplication::desktop()->winId(); - QPixmap pixmap = qApp->primaryScreen()->grabWindow(id, event->globalX(), event->globalY(), 1, 1); - - QImage img = pixmap.toImage(); - QColor col = QColor(img.pixel(0,0)); - - mLineEdit.setText (col.name()); - - mCapturing = false; - releaseMouse(); -} - - -void ColorPickerWidget::captureMouse() -{ - grabMouse(Qt::CrossCursor); - mCapturing = true; -} diff --git a/plugin-colorpicker/colorpicker.h b/plugin-colorpicker/colorpicker.h deleted file mode 100644 index 5815680..0000000 --- a/plugin-colorpicker/colorpicker.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: - * Aaron Lewis - * - * 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 LXQT_COLORPICKER_H -#define LXQT_COLORPICKER_H - -#include "../panel/ilxqtpanelplugin.h" -#include -#include -#include -#include -#include -#include -#include - - -class ColorPickerWidget: public QFrame -{ - Q_OBJECT -public: - ColorPickerWidget(QWidget* parent = 0); - ~ColorPickerWidget(); - - QLineEdit *lineEdit() { return &mLineEdit; } - QToolButton *button() { return &mButton; } - - -protected: - void mouseReleaseEvent(QMouseEvent *event); - -private slots: - void captureMouse(); - -private: - QLineEdit mLineEdit; - QToolButton mButton; - bool mCapturing; -}; - - -class ColorPicker : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - ColorPicker(const ILXQtPanelPluginStartupInfo &startupInfo); - ~ColorPicker(); - - virtual QWidget *widget() { return &mWidget; } - virtual QString themeId() const { return "ColorPicker"; } - - bool isSeparate() const { return true; } - - void realign(); - -private: - ColorPickerWidget mWidget; -}; - -class ColorPickerLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new ColorPicker(startupInfo); - } -}; - -#endif diff --git a/plugin-colorpicker/resources/colorpicker.desktop.in b/plugin-colorpicker/resources/colorpicker.desktop.in deleted file mode 100644 index 81e7b6e..0000000 --- a/plugin-colorpicker/resources/colorpicker.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. -Icon=color-picker - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-colorpicker/translations/colorpicker_ar.desktop b/plugin-colorpicker/translations/colorpicker_ar.desktop deleted file mode 100644 index c4794cb..0000000 --- a/plugin-colorpicker/translations/colorpicker_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=لاقط الألوان -Comment[ar]=اعرف اللون تحت المؤشّر. لمطوّري الوِبّ. diff --git a/plugin-colorpicker/translations/colorpicker_cs.desktop b/plugin-colorpicker/translations/colorpicker_cs.desktop deleted file mode 100644 index 26590ac..0000000 --- a/plugin-colorpicker/translations/colorpicker_cs.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[cs]=Dostaňte barvu pod ukazovátkem. Pro vývojáře webu. -Name[cs]=Volič barev diff --git a/plugin-colorpicker/translations/colorpicker_cs_CZ.desktop b/plugin-colorpicker/translations/colorpicker_cs_CZ.desktop deleted file mode 100644 index 5d09cb0..0000000 --- a/plugin-colorpicker/translations/colorpicker_cs_CZ.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[cs_CZ]=Dostaňte barvu pod ukazovátkem. Pro vývojáře webu. -Name[cs_CZ]=Volič barev diff --git a/plugin-colorpicker/translations/colorpicker_da.desktop b/plugin-colorpicker/translations/colorpicker_da.desktop deleted file mode 100644 index ba55070..0000000 --- a/plugin-colorpicker/translations/colorpicker_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. -Icon=color-picker - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Farvevælger -Comment[da]=Få farven under markøren. Til webudviklere. diff --git a/plugin-colorpicker/translations/colorpicker_de.desktop b/plugin-colorpicker/translations/colorpicker_de.desktop deleted file mode 100644 index cc441ce..0000000 --- a/plugin-colorpicker/translations/colorpicker_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Farbwähler -Comment[de]=Wählt Farbe unter dem Cursor. Für Webentwickler. diff --git a/plugin-colorpicker/translations/colorpicker_el.desktop b/plugin-colorpicker/translations/colorpicker_el.desktop deleted file mode 100644 index be33cc5..0000000 --- a/plugin-colorpicker/translations/colorpicker_el.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Name[el]=Επιλογέας χρωμάτων -Comment[el]=Λήψη του χρώματος κάτω από τον δρομέα. Για προγραμματιστές ιστοσελίδων. diff --git a/plugin-colorpicker/translations/colorpicker_es.desktop b/plugin-colorpicker/translations/colorpicker_es.desktop deleted file mode 100644 index 0758b57..0000000 --- a/plugin-colorpicker/translations/colorpicker_es.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[es]=Obtiene el color bajo el cursor. Para desarrolladores web. -Name[es]=Selector de color diff --git a/plugin-colorpicker/translations/colorpicker_es_VE.desktop b/plugin-colorpicker/translations/colorpicker_es_VE.desktop deleted file mode 100644 index 7e1a0a9..0000000 --- a/plugin-colorpicker/translations/colorpicker_es_VE.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[es_VE]=Toma un color de la pantalla con el cursor, para desarrolladores web. -Name[es_VE]=Recoge colores diff --git a/plugin-colorpicker/translations/colorpicker_eu.desktop b/plugin-colorpicker/translations/colorpicker_eu.desktop deleted file mode 100644 index f96a790..0000000 --- a/plugin-colorpicker/translations/colorpicker_eu.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[eu]=Eskuratu kurtsorearen azpiko kolorea. Web-garatzaileentzat. -Name[eu]=Kolore-hautatzailea diff --git a/plugin-colorpicker/translations/colorpicker_fi.desktop b/plugin-colorpicker/translations/colorpicker_fi.desktop deleted file mode 100644 index 1bbc9fe..0000000 --- a/plugin-colorpicker/translations/colorpicker_fi.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[fi]=Näyttää hiiren osoittimen alla olevan värin. -Name[fi]=Värivalitsin diff --git a/plugin-colorpicker/translations/colorpicker_fr.desktop b/plugin-colorpicker/translations/colorpicker_fr.desktop deleted file mode 100644 index 02e53b3..0000000 --- a/plugin-colorpicker/translations/colorpicker_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Sélecteur de couleur -Comment[fr]=Sélectionne la couleur existant sous le curseur. diff --git a/plugin-colorpicker/translations/colorpicker_hu.desktop b/plugin-colorpicker/translations/colorpicker_hu.desktop deleted file mode 100644 index 161f6a2..0000000 --- a/plugin-colorpicker/translations/colorpicker_hu.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[hu]=Színszippantó. Fejlesztőknek. -Name[hu]=Színválasztó diff --git a/plugin-colorpicker/translations/colorpicker_it.desktop b/plugin-colorpicker/translations/colorpicker_it.desktop deleted file mode 100644 index d4defbc..0000000 --- a/plugin-colorpicker/translations/colorpicker_it.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Comment[it]=Rileva il colore sotto il cursore. Per sviluppatori web. -Name[it]=Selettore del colore - diff --git a/plugin-colorpicker/translations/colorpicker_ja.desktop b/plugin-colorpicker/translations/colorpicker_ja.desktop deleted file mode 100644 index 479f63d..0000000 --- a/plugin-colorpicker/translations/colorpicker_ja.desktop +++ /dev/null @@ -1,5 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=カラーピッカー -Comment=カーソルの下の色を取得します。ウェブ制作者向け diff --git a/plugin-colorpicker/translations/colorpicker_lt.desktop b/plugin-colorpicker/translations/colorpicker_lt.desktop deleted file mode 100644 index 7245a19..0000000 --- a/plugin-colorpicker/translations/colorpicker_lt.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[lt]=Gauti po žymekliu esančią spalvą. Saityno plėtotojams. -Name[lt]=Spalvos parinkiklis diff --git a/plugin-colorpicker/translations/colorpicker_pl.desktop b/plugin-colorpicker/translations/colorpicker_pl.desktop deleted file mode 100644 index edf202d..0000000 --- a/plugin-colorpicker/translations/colorpicker_pl.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[pl]=Sprawdź kolor wskazany kursorem. Przeznaczony dla web developerów. -Name[pl]=Wybieracz kolorów diff --git a/plugin-colorpicker/translations/colorpicker_pt.desktop b/plugin-colorpicker/translations/colorpicker_pt.desktop deleted file mode 100644 index 71c9dda..0000000 --- a/plugin-colorpicker/translations/colorpicker_pt.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - -# Translations -Name[pt]=Seletor de cores -Comment[pt]=Obter a cor por baixo do cursor. Para programadores web. diff --git a/plugin-colorpicker/translations/colorpicker_pt_BR.desktop b/plugin-colorpicker/translations/colorpicker_pt_BR.desktop deleted file mode 100644 index b3b4041..0000000 --- a/plugin-colorpicker/translations/colorpicker_pt_BR.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[pt_BR]=Obter a cor sob o cursor. Para desenvolvedores web. -Name[pt_BR]=Seletor de cores diff --git a/plugin-colorpicker/translations/colorpicker_ro_RO.desktop b/plugin-colorpicker/translations/colorpicker_ro_RO.desktop deleted file mode 100644 index 5ac3e64..0000000 --- a/plugin-colorpicker/translations/colorpicker_ro_RO.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[ro_RO]=Obține culoarea de sub cursor. Pentru dezvoltatori web. diff --git a/plugin-colorpicker/translations/colorpicker_ru.desktop b/plugin-colorpicker/translations/colorpicker_ru.desktop deleted file mode 100644 index d20ecb6..0000000 --- a/plugin-colorpicker/translations/colorpicker_ru.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[ru]=Получить цвет под курсором мыши. Для веб-разработчиков. -Name[ru]=Цветовая палитра \ No newline at end of file diff --git a/plugin-colorpicker/translations/colorpicker_th_TH.desktop b/plugin-colorpicker/translations/colorpicker_th_TH.desktop deleted file mode 100644 index d25b733..0000000 --- a/plugin-colorpicker/translations/colorpicker_th_TH.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[th_TH]=นำค่าสีที่อยู่ใต้เคอร์เซอร์ขึ้นมา สำหรับนักพัฒนาเว็บ -Name[th_TH]=ตัวเลือกค่าสี diff --git a/plugin-colorpicker/translations/colorpicker_uk.desktop b/plugin-colorpicker/translations/colorpicker_uk.desktop deleted file mode 100644 index 62e8dc7..0000000 --- a/plugin-colorpicker/translations/colorpicker_uk.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[uk]=Бере колір під курсором. Для web-розробників. -Name[uk]=Селектор кольору diff --git a/plugin-colorpicker/translations/colorpicker_zh_CN.desktop b/plugin-colorpicker/translations/colorpicker_zh_CN.desktop deleted file mode 100644 index 3818ab5..0000000 --- a/plugin-colorpicker/translations/colorpicker_zh_CN.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[zh_CN]=为网络开发者获取鼠标下的颜色。 -Name[zh_CN]=颜色拾取器 diff --git a/plugin-colorpicker/translations/colorpicker_zh_TW.desktop b/plugin-colorpicker/translations/colorpicker_zh_TW.desktop deleted file mode 100644 index eabf497..0000000 --- a/plugin-colorpicker/translations/colorpicker_zh_TW.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Color picker -Comment=Get the color under the cursor. For web developers. - - -# Translations -Comment[zh_TW]=取得由標下的顏色。網頁開發者推荐使用。 -Name[zh_TW]=取得顏色 diff --git a/plugin-cpuload/CMakeLists.txt b/plugin-cpuload/CMakeLists.txt deleted file mode 100644 index 4017b67..0000000 --- a/plugin-cpuload/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -set(PLUGIN "cpuload") - -set(HEADERS - lxqtcpuloadplugin.h - lxqtcpuload.h - lxqtcpuloadconfiguration.h -) - -set(SOURCES - lxqtcpuloadplugin.cpp - lxqtcpuload.cpp - lxqtcpuloadconfiguration.cpp -) - -set(UIS - lxqtcpuloadconfiguration.ui -) - -set(LIBRARIES ${STATGRAB_LIB}) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-cpuload/lxqtcpuload.cpp b/plugin-cpuload/lxqtcpuload.cpp deleted file mode 100644 index cad546d..0000000 --- a/plugin-cpuload/lxqtcpuload.cpp +++ /dev/null @@ -1,211 +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: - * Alexander Sokoloff - * - * 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 "lxqtcpuload.h" -#include "../panel/ilxqtpanelplugin.h" -#include "../panel/pluginsettings.h" -#include -#include -#include -#include - -extern "C" { -#include -} - -#ifdef __sg_public -// since libstatgrab 0.90 this macro is defined, so we use it for version check -#define STATGRAB_NEWER_THAN_0_90 1 -#endif - -#define BAR_ORIENT_BOTTOMUP "bottomUp" -#define BAR_ORIENT_TOPDOWN "topDown" -#define BAR_ORIENT_LEFTRIGHT "leftRight" -#define BAR_ORIENT_RIGHTLEFT "rightLeft" - - -LXQtCpuLoad::LXQtCpuLoad(ILXQtPanelPlugin* plugin, QWidget* parent): - QFrame(parent), - mPlugin(plugin), - m_showText(false), - m_barWidth(20), - m_barOrientation(TopDownBar), - m_timerID(-1) -{ - setObjectName("LXQtCpuLoad"); - - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setSpacing(0); - layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(&m_stuff); - - /* Initialise statgrab */ -#ifdef STATGRAB_NEWER_THAN_0_90 - sg_init(0); -#else - sg_init(); -#endif - - /* Drop setuid/setgid privileges. */ - if (sg_drop_privileges() != 0) { - perror("Error. Failed to drop privileges"); - } - - m_font.setPointSizeF(8); - - settingsChanged(); -} - -LXQtCpuLoad::~LXQtCpuLoad() -{ -} - -void LXQtCpuLoad::setSizes() -{ - if (m_barOrientation == RightToLeftBar || m_barOrientation == LeftToRightBar) - { - m_stuff.setFixedHeight(m_barWidth); - m_stuff.setMinimumWidth(24); - } - else - { - m_stuff.setFixedWidth(m_barWidth); - m_stuff.setMinimumHeight(24); - } -} - -void LXQtCpuLoad::resizeEvent(QResizeEvent *) -{ - setSizes(); - update(); -} - - -double LXQtCpuLoad::getLoadCpu() const -{ -#ifdef STATGRAB_NEWER_THAN_0_90 - size_t count; - sg_cpu_percents* cur = sg_get_cpu_percents(&count); -#else - sg_cpu_percents* cur = sg_get_cpu_percents(); -#endif - return (cur->user + cur->kernel + cur->nice); -} - -void LXQtCpuLoad::timerEvent(QTimerEvent *event) -{ - double avg = getLoadCpu(); - if ( qAbs(m_avg-avg)>1 ) - { - m_avg = avg; - setToolTip(tr("CPU load %1%").arg(m_avg)); - update(); - } -} - -void LXQtCpuLoad::paintEvent ( QPaintEvent * ) -{ - QPainter p(this); - QPen pen; - pen.setWidth(2); - p.setPen(pen); - p.setRenderHint(QPainter::Antialiasing, true); - - p.setFont(m_font); - QRectF r = rect(); - - QRectF r1; - QLinearGradient shade(0,0,1,1); - if (m_barOrientation == RightToLeftBar || m_barOrientation == LeftToRightBar) - { - float vo = (r.height() - static_cast(m_barWidth))/2.0; - float ho = r.width()*(1-m_avg*0.01); - - if (m_barOrientation == RightToLeftBar) - { - r1.setRect(r.left()+ho, r.top()+vo, r.width()-ho, r.height()-2*vo ); - } - else // LeftToRightBar - { - r1.setRect(r.left(), r.top()+vo, r.width()-ho, r.height()-2*vo ); - } - shade.setFinalStop(0, r1.height()); - } - else // BottomUpBar || TopDownBar - { - float vo = r.height()*(1-m_avg*0.01); - float ho = (r.width() - static_cast(m_barWidth) )/2.0; - - if (m_barOrientation == TopDownBar) - { - r1.setRect(r.left()+ho, r.top(), r.width()-2*ho, r.height()-vo ); - } - else // BottomUpBar - { - r1.setRect(r.left()+ho, r.top()+vo, r.width()-2*ho, r.height()-vo ); - } - shade.setFinalStop(r1.width(), 0); - } - - shade.setSpread(QLinearGradient::ReflectSpread); - shade.setColorAt(0, QColor(0, 196, 0, 128)); - shade.setColorAt(0.5, QColor(0, 128, 0, 255) ); - shade.setColorAt(1, QColor(0, 196, 0 , 128)); - - p.fillRect(r1, shade); - - if (m_showText) - { - p.setPen(fontColor); - p.drawText(rect(), Qt::AlignCenter, QString::number(m_avg)); - } -} - - -void LXQtCpuLoad::settingsChanged() -{ - if (m_timerID != -1) - killTimer(m_timerID); - - m_showText = mPlugin->settings()->value("showText", false).toBool(); - m_barWidth = mPlugin->settings()->value("barWidth", 20).toInt(); - m_updateInterval = mPlugin->settings()->value("updateInterval", 1000).toInt(); - - QString barOrientation = mPlugin->settings()->value("barOrientation", BAR_ORIENT_BOTTOMUP).toString(); - if (barOrientation == BAR_ORIENT_RIGHTLEFT) - m_barOrientation = RightToLeftBar; - else if (barOrientation == BAR_ORIENT_LEFTRIGHT) - m_barOrientation = LeftToRightBar; - else if (barOrientation == BAR_ORIENT_TOPDOWN) - m_barOrientation = TopDownBar; - else - m_barOrientation = BottomUpBar; - - m_timerID = startTimer(m_updateInterval); - setSizes(); - update(); -} diff --git a/plugin-cpuload/lxqtcpuload.h b/plugin-cpuload/lxqtcpuload.h deleted file mode 100644 index 7f65da3..0000000 --- a/plugin-cpuload/lxqtcpuload.h +++ /dev/null @@ -1,89 +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: - * Alexander Sokoloff - * - * 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 LXQTCPULOAD_H -#define LXQTCPULOAD_H -#include - -class ILXQtPanelPlugin; - -class LXQtCpuLoad: public QFrame -{ - Q_OBJECT - - Q_PROPERTY(QColor fontColor READ getFontColor WRITE setFontColor) - -public: - /** - Describes orientation of cpu load bar - **/ - enum BarOrientation { - BottomUpBar, //! Bar begins at bottom and grows up - TopDownBar, //! Bar begins at top and grows down - RightToLeftBar, //! Bar begins at right edge and grows to the left - LeftToRightBar //! Bar begins at left edge and grows to the right - }; - - LXQtCpuLoad(ILXQtPanelPlugin *plugin, QWidget* parent = 0); - ~LXQtCpuLoad(); - - - void settingsChanged(); - - void setFontColor(QColor value) { fontColor = value; } - QColor getFontColor() const { return fontColor; } - -protected: - void virtual timerEvent(QTimerEvent *event); - void virtual paintEvent ( QPaintEvent * event ); - void virtual resizeEvent(QResizeEvent *); - -private: - double getLoadCpu() const; - void setSizes(); - - ILXQtPanelPlugin *mPlugin; - QWidget m_stuff; - - //! average load - int m_avg; - - bool m_showText; - int m_barWidth; - BarOrientation m_barOrientation; - int m_updateInterval; - int m_timerID; - - QFont m_font; - - QColor fontColor; -}; - - -#endif // LXQTCPULOAD_H - - diff --git a/plugin-cpuload/lxqtcpuloadconfiguration.cpp b/plugin-cpuload/lxqtcpuloadconfiguration.cpp deleted file mode 100644 index 8e320e0..0000000 --- a/plugin-cpuload/lxqtcpuloadconfiguration.cpp +++ /dev/null @@ -1,112 +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: - * Maciej Płaza - * - * 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 "lxqtcpuloadconfiguration.h" -#include "ui_lxqtcpuloadconfiguration.h" - -#define BAR_ORIENT_BOTTOMUP "bottomUp" -#define BAR_ORIENT_TOPDOWN "topDown" -#define BAR_ORIENT_LEFTRIGHT "leftRight" -#define BAR_ORIENT_RIGHTLEFT "rightLeft" - -LXQtCpuLoadConfiguration::LXQtCpuLoadConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtCpuLoadConfiguration) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("CpuLoadConfigurationWindow"); - ui->setupUi(this); - - fillBarOrientations(); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), - this, SLOT(dialogButtonsAction(QAbstractButton*))); - - loadSettings(); - - connect(ui->showTextCB, SIGNAL(toggled(bool)), - this, SLOT(showTextChanged(bool))); - connect(ui->barWidthSB, SIGNAL(valueChanged(int)), - this, SLOT(barWidthChanged(int))); - connect(ui->updateIntervalSpinBox, SIGNAL(valueChanged(double)), - this, SLOT(updateIntervalChanged(double))); - connect(ui->barOrientationCOB, SIGNAL(currentIndexChanged(int)), - this, SLOT(barOrientationChanged(int))); -} - -LXQtCpuLoadConfiguration::~LXQtCpuLoadConfiguration() -{ - delete ui; -} - -void LXQtCpuLoadConfiguration::fillBarOrientations() -{ - ui->barOrientationCOB->addItem(trUtf8("Bottom up"), BAR_ORIENT_BOTTOMUP); - ui->barOrientationCOB->addItem(trUtf8("Top down"), BAR_ORIENT_TOPDOWN); - ui->barOrientationCOB->addItem(trUtf8("Left to right"), BAR_ORIENT_LEFTRIGHT); - ui->barOrientationCOB->addItem(trUtf8("Right to left"), BAR_ORIENT_RIGHTLEFT); -} - -void LXQtCpuLoadConfiguration::loadSettings() -{ - ui->showTextCB->setChecked(settings().value("showText", false).toBool()); - ui->barWidthSB->setValue(settings().value("barWidth", 20).toInt()); - ui->updateIntervalSpinBox->setValue(settings().value("updateInterval", 1000).toInt() / 1000.0); - - int boIndex = ui->barOrientationCOB->findData( - settings().value("barOrientation", BAR_ORIENT_BOTTOMUP)); - boIndex = (boIndex < 0) ? 1 : boIndex; - ui->barOrientationCOB->setCurrentIndex(boIndex); - -// QString menuFile = settings().value("menu_file", "").toString(); -// if (menuFile.isEmpty()) -// { -// menuFile = XdgMenu::getMenuFileName(); -// } -// ui->menuFilePathLE->setText(menuFile); -// ui->shortcutEd->setKeySequence(settings().value("shortcut", "Alt+F1").toString()); -} - -void LXQtCpuLoadConfiguration::showTextChanged(bool value) -{ - settings().setValue("showText", value); -} - -void LXQtCpuLoadConfiguration::barWidthChanged(int value) -{ - settings().setValue("barWidth", value); -} - -void LXQtCpuLoadConfiguration::updateIntervalChanged(double value) -{ - settings().setValue("updateInterval", value*1000); -} - -void LXQtCpuLoadConfiguration::barOrientationChanged(int index) -{ - settings().setValue("barOrientation", ui->barOrientationCOB->itemData(index).toString()); -} diff --git a/plugin-cpuload/lxqtcpuloadconfiguration.h b/plugin-cpuload/lxqtcpuloadconfiguration.h deleted file mode 100644 index 0aadebb..0000000 --- a/plugin-cpuload/lxqtcpuloadconfiguration.h +++ /dev/null @@ -1,70 +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: - * Maciej Płaza - * - * 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 LXQTCPULOADCONFIGURATION_H -#define LXQTCPULOADCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" - -class QSettings; -class QAbstractButton; - -namespace Ui { - class LXQtCpuLoadConfiguration; -} - -class LXQtCpuLoadConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtCpuLoadConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~LXQtCpuLoadConfiguration(); - -private: - Ui::LXQtCpuLoadConfiguration *ui; - - /* - Fills Bar orientation combobox - */ - void fillBarOrientations(); - -private slots: - /* - Saves settings in conf file. - */ - void loadSettings(); - void showTextChanged(bool value); - void barWidthChanged(int value); - void updateIntervalChanged(double value); - void barOrientationChanged(int index); - -}; - -#endif // LXQTCPULOADCONFIGURATION_H diff --git a/plugin-cpuload/lxqtcpuloadconfiguration.ui b/plugin-cpuload/lxqtcpuloadconfiguration.ui deleted file mode 100644 index 0c9037d..0000000 --- a/plugin-cpuload/lxqtcpuloadconfiguration.ui +++ /dev/null @@ -1,128 +0,0 @@ - - - LXQtCpuLoadConfiguration - - - - 0 - 0 - 285 - 191 - - - - CPU Load Settings - - - - - - General - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - false - - - - - - Show text - - - - - - - Update interval: - - - - - - - sec - - - 1 - - - 0.500000000000000 - - - 10000.000000000000000 - - - 0.500000000000000 - - - 1.000000000000000 - - - - - - - Bar orientation: - - - - - - - - - - Bar width: - - - - - - - 4 - - - 2048 - - - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 41 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - diff --git a/plugin-cpuload/lxqtcpuloadplugin.cpp b/plugin-cpuload/lxqtcpuloadplugin.cpp deleted file mode 100644 index 5777637..0000000 --- a/plugin-cpuload/lxqtcpuloadplugin.cpp +++ /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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtcpuloadplugin.h" -#include "lxqtcpuload.h" -#include "lxqtcpuloadconfiguration.h" - -#include - -LXQtCpuLoadPlugin::LXQtCpuLoadPlugin(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo) -{ - mWidget = new QWidget(); - mContent = new LXQtCpuLoad(this, mWidget); - QVBoxLayout *layout = new QVBoxLayout(mWidget); - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(0); - layout->addWidget(mContent); - layout->setStretchFactor(mContent, 1); -} - -LXQtCpuLoadPlugin::~LXQtCpuLoadPlugin() -{ - delete mWidget; -} - -QWidget *LXQtCpuLoadPlugin::widget() -{ - return mWidget; -} - -QDialog *LXQtCpuLoadPlugin::configureDialog() -{ - return new LXQtCpuLoadConfiguration(settings()); -} - -void LXQtCpuLoadPlugin::settingsChanged() -{ - mContent->settingsChanged(); -} diff --git a/plugin-cpuload/lxqtcpuloadplugin.h b/plugin-cpuload/lxqtcpuloadplugin.h deleted file mode 100644 index 66c03cd..0000000 --- a/plugin-cpuload/lxqtcpuloadplugin.h +++ /dev/null @@ -1,73 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTCPULOADPLUGIN_H -#define LXQTCPULOADPLUGIN_H - - -#include "../panel/ilxqtpanelplugin.h" -#include -class LXQtCpuLoad; - -class LXQtCpuLoadPlugin: public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - explicit LXQtCpuLoadPlugin(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtCpuLoadPlugin(); - - virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog; } - virtual QWidget *widget(); - virtual QString themeId() const { return "CpuLoad"; } - - bool isSeparate() const { return true; } - QDialog *configureDialog(); - -protected: - virtual void settingsChanged(); - -private: - QWidget *mWidget; - LXQtCpuLoad *mContent; -}; - - -class LXQtCpuLoadPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new LXQtCpuLoadPlugin(startupInfo); - } -}; - - -#endif // LXQTCPULOADPLUGIN_H diff --git a/plugin-cpuload/resources/cpuload.desktop.in b/plugin-cpuload/resources/cpuload.desktop.in deleted file mode 100644 index 4f385d0..0000000 --- a/plugin-cpuload/resources/cpuload.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=CPU monitor -Comment=Displays the current CPU load. -Icon=cpu - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-cpuload/translations/cpuload_ar.desktop b/plugin-cpuload/translations/cpuload_ar.desktop deleted file mode 100644 index 66c912b..0000000 --- a/plugin-cpuload/translations/cpuload_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=مرقاب المعالج -Comment[ar]=تعرض حمل المعالج الحاليّ. diff --git a/plugin-cpuload/translations/cpuload_cs.desktop b/plugin-cpuload/translations/cpuload_cs.desktop deleted file mode 100644 index 0fa73c4..0000000 --- a/plugin-cpuload/translations/cpuload_cs.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[cs]=Sledování zatížení procesoru -Name[cs]=Zatížení procesoru diff --git a/plugin-cpuload/translations/cpuload_cs_CZ.desktop b/plugin-cpuload/translations/cpuload_cs_CZ.desktop deleted file mode 100644 index e071ccc..0000000 --- a/plugin-cpuload/translations/cpuload_cs_CZ.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[cs_CZ]=Sledování zatížení procesoru -Name[cs_CZ]=Zatížení procesoru diff --git a/plugin-cpuload/translations/cpuload_da.desktop b/plugin-cpuload/translations/cpuload_da.desktop deleted file mode 100644 index 6c0f7e7..0000000 --- a/plugin-cpuload/translations/cpuload_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Cpu monitor -Comment=Displays the current CPU load. -Icon=cpu - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=CPU-overvågning -Comment[da]=Viser det aktuelle CPU-forbrug. diff --git a/plugin-cpuload/translations/cpuload_de.desktop b/plugin-cpuload/translations/cpuload_de.desktop deleted file mode 100644 index 11579ac..0000000 --- a/plugin-cpuload/translations/cpuload_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Prozessorauslastung -Comment[de]=Prozessorlast-Monitor diff --git a/plugin-cpuload/translations/cpuload_el.desktop b/plugin-cpuload/translations/cpuload_el.desktop deleted file mode 100644 index 3173b2f..0000000 --- a/plugin-cpuload/translations/cpuload_el.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Name[el]=Επόπτης του επεξεργαστή -Comment[el]=Εμφανίζει το φορτίο του επεξεργαστή. - diff --git a/plugin-cpuload/translations/cpuload_eo.desktop b/plugin-cpuload/translations/cpuload_eo.desktop deleted file mode 100644 index d06038b..0000000 --- a/plugin-cpuload/translations/cpuload_eo.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[eo]=Monitorado de CPU-ŝarĝo -Name[eo]=CPU-ŝarĝo diff --git a/plugin-cpuload/translations/cpuload_es.desktop b/plugin-cpuload/translations/cpuload_es.desktop deleted file mode 100644 index 231a3dc..0000000 --- a/plugin-cpuload/translations/cpuload_es.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[es]=Monitor de carga de CPU -Name[es]=Carga de CPU diff --git a/plugin-cpuload/translations/cpuload_es_VE.desktop b/plugin-cpuload/translations/cpuload_es_VE.desktop deleted file mode 100644 index 7e39924..0000000 --- a/plugin-cpuload/translations/cpuload_es_VE.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[es_VE]=Monitor de carga del CPU -Name[es_VE]=Carga del CPU diff --git a/plugin-cpuload/translations/cpuload_eu.desktop b/plugin-cpuload/translations/cpuload_eu.desktop deleted file mode 100644 index f919877..0000000 --- a/plugin-cpuload/translations/cpuload_eu.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[eu]=PUZaren uneko karga bistaratzen du. -Name[eu]=PUZaren monitorea diff --git a/plugin-cpuload/translations/cpuload_fi.desktop b/plugin-cpuload/translations/cpuload_fi.desktop deleted file mode 100644 index 7229d2c..0000000 --- a/plugin-cpuload/translations/cpuload_fi.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[fi]=Suorittimen kuormituksen seuranta -Name[fi]=Suorittimen kuormitus diff --git a/plugin-cpuload/translations/cpuload_fr.desktop b/plugin-cpuload/translations/cpuload_fr.desktop deleted file mode 100644 index 27d7912..0000000 --- a/plugin-cpuload/translations/cpuload_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Charge du processeur -Comment[fr]=Affichage de la charge du processeur diff --git a/plugin-cpuload/translations/cpuload_hu.desktop b/plugin-cpuload/translations/cpuload_hu.desktop deleted file mode 100644 index f6238a8..0000000 --- a/plugin-cpuload/translations/cpuload_hu.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[hu]=Megjeleníti a processzorterhelést. -Name[hu]=CPU-figyelő diff --git a/plugin-cpuload/translations/cpuload_it.desktop b/plugin-cpuload/translations/cpuload_it.desktop deleted file mode 100644 index 49724a6..0000000 --- a/plugin-cpuload/translations/cpuload_it.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Comment[it]=Monitor del carico del processore -Name[it]=Carico del processore - diff --git a/plugin-cpuload/translations/cpuload_ja.desktop b/plugin-cpuload/translations/cpuload_ja.desktop deleted file mode 100644 index 8020cb1..0000000 --- a/plugin-cpuload/translations/cpuload_ja.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=CPU monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[ja]=現在のCPUの負荷を表示します -Name[ja]=CPUモニター diff --git a/plugin-cpuload/translations/cpuload_lt.desktop b/plugin-cpuload/translations/cpuload_lt.desktop deleted file mode 100644 index e52b80c..0000000 --- a/plugin-cpuload/translations/cpuload_lt.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[lt]=Procesoriaus stebėtojas -Name[lt]=Procesoriaus apkrova diff --git a/plugin-cpuload/translations/cpuload_nl.desktop b/plugin-cpuload/translations/cpuload_nl.desktop deleted file mode 100644 index 37626e7..0000000 --- a/plugin-cpuload/translations/cpuload_nl.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[nl]=CPU belasting monitor -Name[nl]=Cpu belasting diff --git a/plugin-cpuload/translations/cpuload_pl.desktop b/plugin-cpuload/translations/cpuload_pl.desktop deleted file mode 100644 index 14dd5bf..0000000 --- a/plugin-cpuload/translations/cpuload_pl.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[pl]=Wyświetla obecne obciążenie CPU -Name[pl]=Obciążenie CPU diff --git a/plugin-cpuload/translations/cpuload_pt.desktop b/plugin-cpuload/translations/cpuload_pt.desktop deleted file mode 100644 index f8feafa..0000000 --- a/plugin-cpuload/translations/cpuload_pt.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Cpu monitor -Comment=Displays the current CPU load. - -# Translations -Name[pt]=Carga do CPU -Comment[pt]=Monitor de carga do CPU diff --git a/plugin-cpuload/translations/cpuload_pt_BR.desktop b/plugin-cpuload/translations/cpuload_pt_BR.desktop deleted file mode 100644 index 66eeb28..0000000 --- a/plugin-cpuload/translations/cpuload_pt_BR.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[pt_BR]=Monitor de carga da CPU -Name[pt_BR]=Carga da CPU diff --git a/plugin-cpuload/translations/cpuload_ro_RO.desktop b/plugin-cpuload/translations/cpuload_ro_RO.desktop deleted file mode 100644 index c8f69b9..0000000 --- a/plugin-cpuload/translations/cpuload_ro_RO.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[ro_RO]=Monitor de încărcare a procesorului -Name[ro_RO]=Afișează gradul de încărcare al procesorului diff --git a/plugin-cpuload/translations/cpuload_ru.desktop b/plugin-cpuload/translations/cpuload_ru.desktop deleted file mode 100644 index c4b2e65..0000000 --- a/plugin-cpuload/translations/cpuload_ru.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[ru]=Отображает текущую загрузку процессора. -Name[ru]=Монитор загрузки процессора - diff --git a/plugin-cpuload/translations/cpuload_sl.desktop b/plugin-cpuload/translations/cpuload_sl.desktop deleted file mode 100644 index 15da826..0000000 --- a/plugin-cpuload/translations/cpuload_sl.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[sl]=Nadzornik obremenitve CPE -Name[sl]=Obremenitev CPE diff --git a/plugin-cpuload/translations/cpuload_th_TH.desktop b/plugin-cpuload/translations/cpuload_th_TH.desktop deleted file mode 100644 index 1d17711..0000000 --- a/plugin-cpuload/translations/cpuload_th_TH.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[th_TH]=เฝ้าสังเกตการทำงานซีพียู -Name[th_TH]=การทำงานซีพียู diff --git a/plugin-cpuload/translations/cpuload_tr.desktop b/plugin-cpuload/translations/cpuload_tr.desktop deleted file mode 100644 index 202a3e9..0000000 --- a/plugin-cpuload/translations/cpuload_tr.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[tr]=İşlemci Yükü izleyici -Name[tr]=İşlemci Yükü diff --git a/plugin-cpuload/translations/cpuload_uk.desktop b/plugin-cpuload/translations/cpuload_uk.desktop deleted file mode 100644 index 9ee5a7a..0000000 --- a/plugin-cpuload/translations/cpuload_uk.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[uk]=Показує поточне навантаження CPU. -Name[uk]=Монітор CPU diff --git a/plugin-cpuload/translations/cpuload_zh_CN.desktop b/plugin-cpuload/translations/cpuload_zh_CN.desktop deleted file mode 100644 index 568090d..0000000 --- a/plugin-cpuload/translations/cpuload_zh_CN.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[zh_CN]=CPU 负载监视器 -Name[zh_CN]=CPU 负载 diff --git a/plugin-cpuload/translations/cpuload_zh_TW.desktop b/plugin-cpuload/translations/cpuload_zh_TW.desktop deleted file mode 100644 index 5f3af52..0000000 --- a/plugin-cpuload/translations/cpuload_zh_TW.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Cpu monitor -Comment=Displays the current CPU load. - - - - -# Translations -Comment[zh_TW]=CPU使用監視器 -Name[zh_TW]=CPU使用 diff --git a/plugin-desktopswitch/CMakeLists.txt b/plugin-desktopswitch/CMakeLists.txt deleted file mode 100644 index 6f3b792..0000000 --- a/plugin-desktopswitch/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(PLUGIN "desktopswitch") - -set(HEADERS - desktopswitch.h - desktopswitchbutton.h - desktopswitchconfiguration.h -) - -set(SOURCES - desktopswitch.cpp - desktopswitchbutton.cpp - desktopswitchconfiguration.cpp -) - -set(UIS - desktopswitchconfiguration.ui -) - - -set(LIBRARIES ${LIBRARIES} lxqt lxqt-globalkeys) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-desktopswitch/desktopswitch.cpp b/plugin-desktopswitch/desktopswitch.cpp deleted file mode 100644 index f97a8ef..0000000 --- a/plugin-desktopswitch/desktopswitch.cpp +++ /dev/null @@ -1,298 +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: - * Petr Vanek - * - * 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 - -#include "desktopswitch.h" -#include "desktopswitchbutton.h" -#include "desktopswitchconfiguration.h" - -static const QString DEFAULT_SHORTCUT_TEMPLATE("Control+F%1"); - -DesktopSwitch::DesktopSwitch(const ILXQtPanelPluginStartupInfo &startupInfo) : - QObject(), - ILXQtPanelPlugin(startupInfo), - m_pSignalMapper(new QSignalMapper(this)), - m_desktopCount(KWindowSystem::numberOfDesktops()), - mRows(-1), - mDesktops(new NETRootInfo(QX11Info::connection(), NET::NumberOfDesktops | NET::CurrentDesktop | NET::DesktopNames, NET::WM2DesktopLayout)), - mLabelType(static_cast(-1)) -{ - m_buttons = new QButtonGroup(this); - connect (m_pSignalMapper, SIGNAL(mapped(int)), this, SLOT(setDesktop(int))); - - mLayout = new LXQt::GridLayout(&mWidget); - mWidget.setLayout(mLayout); - - settingsChanged(); - - onCurrentDesktopChanged(KWindowSystem::currentDesktop()); - QTimer::singleShot(0, this, SLOT(registerShortcuts())); - - connect(m_buttons, SIGNAL(buttonClicked(int)), this, SLOT(setDesktop(int))); - - connect(KWindowSystem::self(), SIGNAL(numberOfDesktopsChanged(int)), SLOT(onNumberOfDesktopsChanged(int))); - connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), SLOT(onCurrentDesktopChanged(int))); - connect(KWindowSystem::self(), SIGNAL(desktopNamesChanged()), SLOT(onDesktopNamesChanged())); - - connect(KWindowSystem::self(), static_cast(&KWindowSystem::windowChanged), - this, &DesktopSwitch::onWindowChanged); -} - -void DesktopSwitch::registerShortcuts() -{ - // Register shortcuts to change desktop - GlobalKeyShortcut::Action * gshortcut; - QString path; - QString description; - for (int i = 0; i < 12; ++i) - { - path = QString("/panel/%1/desktop_%2").arg(settings()->group()).arg(i + 1); - description = tr("Switch to desktop %1").arg(i + 1); - - gshortcut = GlobalKeyShortcut::Client::instance()->addAction(QString(), path, description, this); - if (nullptr != gshortcut) - { - m_keys << gshortcut; - connect(gshortcut, &GlobalKeyShortcut::Action::registrationFinished, this, &DesktopSwitch::shortcutRegistered); - connect(gshortcut, SIGNAL(activated()), m_pSignalMapper, SLOT(map())); - m_pSignalMapper->setMapping(gshortcut, i); - } - } -} - -void DesktopSwitch::shortcutRegistered() -{ - GlobalKeyShortcut::Action * const shortcut = qobject_cast(sender()); - - disconnect(shortcut, &GlobalKeyShortcut::Action::registrationFinished, this, &DesktopSwitch::shortcutRegistered); - - const int i = m_keys.indexOf(shortcut); - Q_ASSERT(-1 != i); - - if (shortcut->shortcut().isEmpty()) - { - shortcut->changeShortcut(DEFAULT_SHORTCUT_TEMPLATE.arg(i + 1)); - } -} - -void DesktopSwitch::onWindowChanged(WId id, NET::Properties properties, NET::Properties2 properties2) -{ - if (properties.testFlag(NET::WMState) && isWindowHighlightable(id)) - { - KWindowInfo info = KWindowInfo(id, NET::WMDesktop | NET::WMState); - int desktop = info.desktop(); - if (!info.valid() || info.onAllDesktops()) - return; - else - { - DesktopSwitchButton *button = static_cast(m_buttons->button(desktop - 1)); - if(button) - button->setUrgencyHint(id, info.hasState(NET::DemandsAttention)); - } - } -} - -void DesktopSwitch::refresh() -{ - QList btns = m_buttons->buttons(); - - int i = 0; - const int current_cnt = btns.count(); - const int border = qMin(btns.count(), m_desktopCount); - //update existing buttons - for ( ; i < border; ++i) - { - ((DesktopSwitchButton*)m_buttons->button(i))->update(i, mLabelType, - KWindowSystem::desktopName(i + 1).isEmpty() ? - tr("Desktop %1").arg(i + 1) : - KWindowSystem::desktopName(i + 1)); - } - - //create new buttons (if neccessary) - QAbstractButton *b; - for ( ; i < m_desktopCount; ++i) - { - b = new DesktopSwitchButton(&mWidget, i, mLabelType, - KWindowSystem::desktopName(i+1).isEmpty() ? - tr("Desktop %1").arg(i+1) : - KWindowSystem::desktopName(i+1)); - mWidget.layout()->addWidget(b); - m_buttons->addButton(b, i); - } - - //delete unneeded buttons (if neccessary) - for ( ; i < current_cnt; ++i) - { - b = m_buttons->buttons().last(); - m_buttons->removeButton(b); - mWidget.layout()->removeWidget(b); - delete b; - } -} - -bool DesktopSwitch::isWindowHighlightable(WId window) -{ - // this method was borrowed from the taskbar plugin - QFlags ignoreList; - ignoreList |= NET::DesktopMask; - ignoreList |= NET::DockMask; - ignoreList |= NET::SplashMask; - ignoreList |= NET::ToolbarMask; - ignoreList |= NET::MenuMask; - ignoreList |= NET::PopupMenuMask; - ignoreList |= NET::NotificationMask; - - KWindowInfo info(window, NET::WMWindowType | NET::WMState, NET::WM2TransientFor); - if (!info.valid()) - return false; - - if (NET::typeMatchesMask(info.windowType(NET::AllTypesMask), ignoreList)) - return false; - - if (info.state() & NET::SkipTaskbar) - return false; - - // WM_TRANSIENT_FOR hint not set - normal window - WId transFor = info.transientFor(); - if (transFor == 0 || transFor == window || transFor == (WId) QX11Info::appRootWindow()) - return true; - - info = KWindowInfo(transFor, NET::WMWindowType); - - QFlags normalFlag; - normalFlag |= NET::NormalMask; - normalFlag |= NET::DialogMask; - normalFlag |= NET::UtilityMask; - - return !NET::typeMatchesMask(info.windowType(NET::AllTypesMask), normalFlag); -} - -DesktopSwitch::~DesktopSwitch() -{ -} - -void DesktopSwitch::setDesktop(int desktop) -{ - KWindowSystem::setCurrentDesktop(desktop + 1); -} - -void DesktopSwitch::onNumberOfDesktopsChanged(int count) -{ - qDebug() << "Desktop count changed from" << m_desktopCount << "to" << count; - m_desktopCount = count; - refresh(); -} - -void DesktopSwitch::onCurrentDesktopChanged(int current) -{ - QAbstractButton *button = m_buttons->button(current - 1); - if (button) - button->setChecked(true); -} - -void DesktopSwitch::onDesktopNamesChanged() -{ - refresh(); -} - -void DesktopSwitch::settingsChanged() -{ - int value = settings()->value("rows", 1).toInt(); - if (mRows != value) - { - mRows = value; - realign(); - } - value = settings()->value("labelType", DesktopSwitchButton::LABEL_TYPE_NUMBER).toInt(); - if (mLabelType != static_cast(value)) - { - mLabelType = static_cast(value); - refresh(); - } -} - -void DesktopSwitch::realign() -{ - int columns = static_cast(ceil(static_cast(m_desktopCount) / mRows)); - mLayout->setEnabled(false); - if (panel()->isHorizontal()) - { - mLayout->setRowCount(mRows); - mLayout->setColumnCount(0); - mDesktops->setDesktopLayout(NET::OrientationHorizontal, columns, mRows, mWidget.isRightToLeft() ? NET::DesktopLayoutCornerTopRight : NET::DesktopLayoutCornerTopLeft); - } - else - { - mLayout->setColumnCount(mRows); - mLayout->setRowCount(0); - mDesktops->setDesktopLayout(NET::OrientationHorizontal, mRows, columns, mWidget.isRightToLeft() ? NET::DesktopLayoutCornerTopRight : NET::DesktopLayoutCornerTopLeft); - } - mLayout->setEnabled(true); -} - -QDialog *DesktopSwitch::configureDialog() -{ - return new DesktopSwitchConfiguration(settings()); -} - -DesktopSwitchWidget::DesktopSwitchWidget(): - QFrame(), - m_mouseWheelThresholdCounter(0) -{ -} - -void DesktopSwitchWidget::wheelEvent(QWheelEvent *e) -{ - // Without some sort of threshold which has to be passed, scrolling is too sensitive - m_mouseWheelThresholdCounter -= e->delta(); - // If the user hasn't scrolled far enough in one direction (positive or negative): do nothing - if(abs(m_mouseWheelThresholdCounter) < 100) - return; - - int max = KWindowSystem::numberOfDesktops(); - int delta = e->delta() < 0 ? 1 : -1; - int current = KWindowSystem::currentDesktop() + delta; - - if (current > max){ - current = 1; - } - else if (current < 1) - current = max; - - m_mouseWheelThresholdCounter = 0; - KWindowSystem::setCurrentDesktop(current); -} diff --git a/plugin-desktopswitch/desktopswitch.h b/plugin-desktopswitch/desktopswitch.h deleted file mode 100644 index 0062217..0000000 --- a/plugin-desktopswitch/desktopswitch.h +++ /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: 2011 Razor team - * Authors: - * Petr Vanek - * - * 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 DESKTOPSWITCH_H -#define DESKTOPSWITCH_H - -#include "../panel/ilxqtpanelplugin.h" -#include -#include -#include - -#include "desktopswitchbutton.h" - -class QSignalMapper; -class QButtonGroup; -class NETRootInfo; -namespace LXQt { -class GridLayout; -} - -class DesktopSwitchWidget: public QFrame -{ - Q_OBJECT -public: - DesktopSwitchWidget(); - -private: - int m_mouseWheelThresholdCounter; - -protected: - void wheelEvent(QWheelEvent* e); -}; - -/** - * @brief Desktop switcher. A very simple one... - */ -class DesktopSwitch : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - DesktopSwitch(const ILXQtPanelPluginStartupInfo &startupInfo); - ~DesktopSwitch(); - - QString themeId() const { return "DesktopSwitch"; } - QWidget *widget() { return &mWidget; } - bool isSeparate() const { return true; } - void realign(); - - virtual ILXQtPanelPlugin::Flags flags() const { return HaveConfigDialog; } - QDialog *configureDialog(); - -private: - QButtonGroup * m_buttons; - QList m_keys; - QSignalMapper* m_pSignalMapper; - int m_desktopCount; - DesktopSwitchWidget mWidget; - LXQt::GridLayout *mLayout; - int mRows; - QScopedPointer mDesktops; - DesktopSwitchButton::LabelType mLabelType; - - void refresh(); - bool isWindowHighlightable(WId window); - -private slots: - void setDesktop(int desktop); - void onNumberOfDesktopsChanged(int); - void onCurrentDesktopChanged(int); - void onDesktopNamesChanged(); - virtual void settingsChanged(); - void registerShortcuts(); - void shortcutRegistered(); - void onWindowChanged(WId id, NET::Properties properties, NET::Properties2 properties2); -}; - -class DesktopSwitchPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - // Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const { return new DesktopSwitch(startupInfo);} -}; - -#endif diff --git a/plugin-desktopswitch/desktopswitchbutton.cpp b/plugin-desktopswitch/desktopswitchbutton.cpp deleted file mode 100644 index 19258ff..0000000 --- a/plugin-desktopswitch/desktopswitchbutton.cpp +++ /dev/null @@ -1,85 +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: - * Petr Vanek - * - * 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 "desktopswitchbutton.h" - -DesktopSwitchButton::DesktopSwitchButton(QWidget * parent, int index, LabelType labelType, const QString &title) - : QToolButton(parent), - mUrgencyHint(false) -{ - update(index, labelType, title); - - setCheckable(true); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); -} - -void DesktopSwitchButton::update(int index, LabelType labelType, const QString &title) -{ - switch (labelType) - { - case LABEL_TYPE_NAME: - setText(title); - break; - - // A blank space was used in NONE Label Type as it uses less space - // for each desktop button at the panel - case LABEL_TYPE_NONE: - setText(QStringLiteral(" ")); - break; - - default: // LABEL_TYPE_NUMBER - setText(QString::number(index + 1)); - } - - if (!title.isEmpty()) - { - setToolTip(title); - } -} - -void DesktopSwitchButton::setUrgencyHint(WId id, bool urgent) -{ - if (urgent) - mUrgentWIds.insert(id); - else - mUrgentWIds.remove(id); - - if (mUrgencyHint != !mUrgentWIds.empty()) - { - mUrgencyHint = !mUrgentWIds.empty(); - setProperty("urgent", mUrgencyHint); - style()->unpolish(this); - style()->polish(this); - QToolButton::update(); - } -} diff --git a/plugin-desktopswitch/desktopswitchbutton.h b/plugin-desktopswitch/desktopswitchbutton.h deleted file mode 100644 index 6d8ba26..0000000 --- a/plugin-desktopswitch/desktopswitchbutton.h +++ /dev/null @@ -1,63 +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: - * Petr Vanek - * - * 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 DESKTOPSWITCHBUTTON_H -#define DESKTOPSWITCHBUTTON_H - -#include -#include - -namespace GlobalKeyShortcut -{ -class Action; -} - -class DesktopSwitchButton : public QToolButton -{ - Q_OBJECT - -public: - enum LabelType { // Must match with combobox indexes - LABEL_TYPE_NUMBER = 0, - LABEL_TYPE_NAME = 1, - LABEL_TYPE_NONE = 2 - }; - - DesktopSwitchButton(QWidget * parent, int index, LabelType labelType, const QString &title=QString()); - void update(int index, LabelType labelType, const QString &title); - - void setUrgencyHint(WId, bool); - -private: - - // for urgency hint handling - bool mUrgencyHint; - QSet mUrgentWIds; -}; - -#endif diff --git a/plugin-desktopswitch/desktopswitchconfiguration.cpp b/plugin-desktopswitch/desktopswitchconfiguration.cpp deleted file mode 100644 index 9bc5e45..0000000 --- a/plugin-desktopswitch/desktopswitchconfiguration.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * - * 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 "desktopswitchconfiguration.h" -#include "ui_desktopswitchconfiguration.h" -#include -#include - -DesktopSwitchConfiguration::DesktopSwitchConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::DesktopSwitchConfiguration) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("DesktopSwitchConfigurationWindow"); - ui->setupUi(this); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); - - loadSettings(); - - connect(ui->rowsSB, SIGNAL(valueChanged(int)), this, SLOT(rowsChanged(int))); - connect(ui->labelTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(labelTypeChanged(int))); - - loadDesktopsNames(); -} - -DesktopSwitchConfiguration::~DesktopSwitchConfiguration() -{ - delete ui; -} - -void DesktopSwitchConfiguration::loadSettings() -{ - ui->rowsSB->setValue(settings().value("rows", 1).toInt()); - ui->labelTypeCB->setCurrentIndex(settings().value("labelType", 0).toInt()); -} - -void DesktopSwitchConfiguration::loadDesktopsNames() -{ - int n = KWindowSystem::numberOfDesktops(); - for (int i = 1; i <= n; i++) - { - QLineEdit *edit = new QLineEdit(KWindowSystem::desktopName(i), this); - ((QFormLayout *) ui->namesGroupBox->layout())->addRow(QString("Desktop %1:").arg(i), edit); - - // C++11 rocks! - QTimer *timer = new QTimer(this); - timer->setInterval(400); - timer->setSingleShot(true); - connect(timer, &QTimer::timeout, [=] { KWindowSystem::setDesktopName(i, edit->text()); }); - connect(edit, &QLineEdit::textEdited, [=] { timer->start(); }); - } -} - -void DesktopSwitchConfiguration::rowsChanged(int value) -{ - settings().setValue("rows", value); -} - -void DesktopSwitchConfiguration::labelTypeChanged(int type) -{ - settings().setValue("labelType", type); -} - diff --git a/plugin-desktopswitch/desktopswitchconfiguration.h b/plugin-desktopswitch/desktopswitchconfiguration.h deleted file mode 100644 index 7fe06dd..0000000 --- a/plugin-desktopswitch/desktopswitchconfiguration.h +++ /dev/null @@ -1,64 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * - * 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 DESKTOPSWITCHCERCONFIGURATION_H -#define DESKTOPSWITCHCERCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" - -#include -#include - -class QAbstractButton; - -namespace Ui { - class DesktopSwitchConfiguration; -} - -class DesktopSwitchConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit DesktopSwitchConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~DesktopSwitchConfiguration(); - -private: - Ui::DesktopSwitchConfiguration *ui; - -private slots: - /* - Saves settings in conf file. - */ - void loadSettings(); - void loadDesktopsNames(); - void rowsChanged(int value); - void labelTypeChanged(int type); -}; - -#endif // DESKTOPSWITCHCERCONFIGURATION_H diff --git a/plugin-desktopswitch/desktopswitchconfiguration.ui b/plugin-desktopswitch/desktopswitchconfiguration.ui deleted file mode 100644 index a1751c1..0000000 --- a/plugin-desktopswitch/desktopswitchconfiguration.ui +++ /dev/null @@ -1,94 +0,0 @@ - - - DesktopSwitchConfiguration - - - - 0 - 0 - 213 - 207 - - - - DesktopSwitch settings - - - - - - Appearance - - - - - - 1 - - - 40 - - - 1 - - - - - - - Desktop labels: - - - - - - - Number of rows: - - - - - - - - Numbers - - - - - Names - - - - - None - - - - - - - - - - - Desktop names - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - diff --git a/plugin-desktopswitch/resources/desktopswitch.desktop.in b/plugin-desktopswitch/resources/desktopswitch.desktop.in deleted file mode 100644 index 8e11770..0000000 --- a/plugin-desktopswitch/resources/desktopswitch.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. -Icon=user-desktop - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-desktopswitch/translations/desktopswitch_ar.desktop b/plugin-desktopswitch/translations/desktopswitch_ar.desktop deleted file mode 100644 index 8491ad6..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=مبدّل سطح المكتب -Comment[ar]=تسمح بالتّبديل السهل بين أسطح المكتب الوهميّة. diff --git a/plugin-desktopswitch/translations/desktopswitch_cs.desktop b/plugin-desktopswitch/translations/desktopswitch_cs.desktop deleted file mode 100644 index dae3285..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Povolit přepínání virtuálních ploch -Name[cs]=Přepínání ploch diff --git a/plugin-desktopswitch/translations/desktopswitch_cs_CZ.desktop b/plugin-desktopswitch/translations/desktopswitch_cs_CZ.desktop deleted file mode 100644 index e5e8b37..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Povolit přepínání virtuálních pracovních ploch -Name[cs_CZ]=Přepínání pracovních ploch diff --git a/plugin-desktopswitch/translations/desktopswitch_da.desktop b/plugin-desktopswitch/translations/desktopswitch_da.desktop deleted file mode 100644 index 77f70d0..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. -Icon=user-desktop - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Skrivebordsskifter -Comment[da]=Giver mulighed for nemt at skifte mellem virtuelle skriveborde. diff --git a/plugin-desktopswitch/translations/desktopswitch_de.desktop b/plugin-desktopswitch/translations/desktopswitch_de.desktop deleted file mode 100644 index d914d52..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Arbeitsflächenumschalter -Comment[de]=Zwischen den virtuellen Arbeitsflächen umschalten diff --git a/plugin-desktopswitch/translations/desktopswitch_el.desktop b/plugin-desktopswitch/translations/desktopswitch_el.desktop deleted file mode 100644 index c3973af..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_el.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Name[el]=Εναλλαγή επιφάνειας εργασίας -Comment[el]=Επιτρέπει την εναλλαγή των εικονικών επιφανειών εργασίας. diff --git a/plugin-desktopswitch/translations/desktopswitch_eo.desktop b/plugin-desktopswitch/translations/desktopswitch_eo.desktop deleted file mode 100644 index d8108f5..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_eo.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eo]=Permesi ŝaltadon de virtualaj labortabloj -Name[eo]=Ŝalto de labortabloj diff --git a/plugin-desktopswitch/translations/desktopswitch_es.desktop b/plugin-desktopswitch/translations/desktopswitch_es.desktop deleted file mode 100644 index 700e9db..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Permite cambiar entre escritorios virtuales -Name[es]=Cambiador de escritorios diff --git a/plugin-desktopswitch/translations/desktopswitch_es_VE.desktop b/plugin-desktopswitch/translations/desktopswitch_es_VE.desktop deleted file mode 100644 index 329245c..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Permitir cambiar a escritorios virtuales -Name[es_VE]=Cambiador de Escritorios diff --git a/plugin-desktopswitch/translations/desktopswitch_eu.desktop b/plugin-desktopswitch/translations/desktopswitch_eu.desktop deleted file mode 100644 index 8265173..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Mahaigain birtualen artean modu errazean aldatzeko aukera eskaintzen du. -Name[eu]=Mahaigain-aldatzailea diff --git a/plugin-desktopswitch/translations/desktopswitch_fi.desktop b/plugin-desktopswitch/translations/desktopswitch_fi.desktop deleted file mode 100644 index a3b0d6f..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Vaihda virtuaalisten työpöytien välillä -Name[fi]=Työpöydän vaihtaja diff --git a/plugin-desktopswitch/translations/desktopswitch_fr.desktop b/plugin-desktopswitch/translations/desktopswitch_fr.desktop deleted file mode 100644 index 3484d40..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Comment[fr]=permettre un basculement aisé entre les bureaux virtuels -Name[fr]=Changeur de bureau diff --git a/plugin-desktopswitch/translations/desktopswitch_hu.desktop b/plugin-desktopswitch/translations/desktopswitch_hu.desktop deleted file mode 100644 index 2791311..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=Lehetővé teszi a virtuális asztalok közötti váltást -Name[hu]=Aszatlváltó diff --git a/plugin-desktopswitch/translations/desktopswitch_ia.desktop b/plugin-desktopswitch/translations/desktopswitch_ia.desktop deleted file mode 100644 index 5e1ad5e..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_ia.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktopswitch -Comment=Allow to switch virtual desktops - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-desktopswitch/translations/desktopswitch_id_ID.desktop b/plugin-desktopswitch/translations/desktopswitch_id_ID.desktop deleted file mode 100644 index 5e1ad5e..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_id_ID.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktopswitch -Comment=Allow to switch virtual desktops - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-desktopswitch/translations/desktopswitch_it.desktop b/plugin-desktopswitch/translations/desktopswitch_it.desktop deleted file mode 100644 index 1e252b4..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[it]=Permette di passare ad altri desktop virtuali -Name[it]=Cambia desktop diff --git a/plugin-desktopswitch/translations/desktopswitch_ja.desktop b/plugin-desktopswitch/translations/desktopswitch_ja.desktop deleted file mode 100644 index 312b9de..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_ja.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ja]=仮想デスクトップの切り替えを可能にします -Name[ja]=デスクトップ切り替え diff --git a/plugin-desktopswitch/translations/desktopswitch_ko.desktop b/plugin-desktopswitch/translations/desktopswitch_ko.desktop deleted file mode 100644 index 5e1ad5e..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_ko.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktopswitch -Comment=Allow to switch virtual desktops - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-desktopswitch/translations/desktopswitch_lt.desktop b/plugin-desktopswitch/translations/desktopswitch_lt.desktop deleted file mode 100644 index ca2912f..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_lt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[lt]=Leidžia lengvai perjunginėti virtualius darbalaukius -Name[lt]=Darbalaukių perjungiklis diff --git a/plugin-desktopswitch/translations/desktopswitch_nl.desktop b/plugin-desktopswitch/translations/desktopswitch_nl.desktop deleted file mode 100644 index bc059d2..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_nl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[nl]=Wisselen tussen virtuele-bureaubladen toestaan -Name[nl]=Wissel bureaublad diff --git a/plugin-desktopswitch/translations/desktopswitch_pl.desktop b/plugin-desktopswitch/translations/desktopswitch_pl.desktop deleted file mode 100644 index 653316e..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Pozwala na proste przełączanie pomiędzy wirtualnymi pulpitami -Name[pl]=Obszary robocze diff --git a/plugin-desktopswitch/translations/desktopswitch_pt.desktop b/plugin-desktopswitch/translations/desktopswitch_pt.desktop deleted file mode 100644 index 04796f5..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_pt.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[pt]=Alternador de áreas de trabalho -Comment[pt]=Permite trocar entre as áreas de trabalho diff --git a/plugin-desktopswitch/translations/desktopswitch_pt_BR.desktop b/plugin-desktopswitch/translations/desktopswitch_pt_BR.desktop deleted file mode 100644 index a7201f1..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Permite alternar áreas de trabalho virtuais -Name[pt_BR]=Alternador de área de trabalho diff --git a/plugin-desktopswitch/translations/desktopswitch_ro_RO.desktop b/plugin-desktopswitch/translations/desktopswitch_ro_RO.desktop deleted file mode 100644 index 24b39d6..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_ro_RO.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Permite comutarea între ecranele virtuale -Name[ro_RO]=Comutare ecrane virtuale diff --git a/plugin-desktopswitch/translations/desktopswitch_ru.desktop b/plugin-desktopswitch/translations/desktopswitch_ru.desktop deleted file mode 100644 index c095d3e..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru]=Позволяет легко переключаться между виртуальными рабочими столами. -Name[ru]=Переключение рабочих столов diff --git a/plugin-desktopswitch/translations/desktopswitch_sk.desktop b/plugin-desktopswitch/translations/desktopswitch_sk.desktop deleted file mode 100644 index 95bc8ff..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_sk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sk]=Umožňuje prepínanie medzi virtuálnymi plochami -Name[sk]=Prepínač plôch diff --git a/plugin-desktopswitch/translations/desktopswitch_sl.desktop b/plugin-desktopswitch/translations/desktopswitch_sl.desktop deleted file mode 100644 index 669b1b8..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_sl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sl]=Omogoča preklop med navideznimi namizji -Name[sl]=Desktopswitch diff --git a/plugin-desktopswitch/translations/desktopswitch_sr.desktop b/plugin-desktopswitch/translations/desktopswitch_sr.desktop deleted file mode 100644 index 8b82d42..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_sr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr]=Пребацујте виртуелне површи -Name[sr]=Пребацивач површи diff --git a/plugin-desktopswitch/translations/desktopswitch_sr@ijekavian.desktop b/plugin-desktopswitch/translations/desktopswitch_sr@ijekavian.desktop deleted file mode 100644 index 8ba6d4c..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_sr@ijekavian.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavian]=Пребацивач површи -Comment[sr@ijekavian]=Пребацујте виртуелне површи diff --git a/plugin-desktopswitch/translations/desktopswitch_sr@ijekavianlatin.desktop b/plugin-desktopswitch/translations/desktopswitch_sr@ijekavianlatin.desktop deleted file mode 100644 index 9e20fb5..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavianlatin]=Prebacivač površi -Comment[sr@ijekavianlatin]=Prebacujte virtuelne površi diff --git a/plugin-desktopswitch/translations/desktopswitch_sr@latin.desktop b/plugin-desktopswitch/translations/desktopswitch_sr@latin.desktop deleted file mode 100644 index f06dc00..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_sr@latin.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr@latin]=Prebacujte virtuelne površi -Name[sr@latin]=Prebacivač površi diff --git a/plugin-desktopswitch/translations/desktopswitch_th_TH.desktop b/plugin-desktopswitch/translations/desktopswitch_th_TH.desktop deleted file mode 100644 index d632d0e..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=อนุญาตให้ทำการสลับพื้นโต๊ะ -Name[th_TH]=สลับพื้นโต๊ะ diff --git a/plugin-desktopswitch/translations/desktopswitch_tr.desktop b/plugin-desktopswitch/translations/desktopswitch_tr.desktop deleted file mode 100644 index 483cc28..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_tr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[tr]=Sanal masaüstleri arasında geçiş yapın -Name[tr]=Masaüstü değiştirici diff --git a/plugin-desktopswitch/translations/desktopswitch_uk.desktop b/plugin-desktopswitch/translations/desktopswitch_uk.desktop deleted file mode 100644 index 732d396..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Дозволяє легко перемикатися між віртуальними стільницями -Name[uk]=Перемикач стільниць diff --git a/plugin-desktopswitch/translations/desktopswitch_zh_CN.GB2312.desktop b/plugin-desktopswitch/translations/desktopswitch_zh_CN.GB2312.desktop deleted file mode 100644 index 5e1ad5e..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_zh_CN.GB2312.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktopswitch -Comment=Allow to switch virtual desktops - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-desktopswitch/translations/desktopswitch_zh_CN.desktop b/plugin-desktopswitch/translations/desktopswitch_zh_CN.desktop deleted file mode 100644 index 6354d4d..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=在虚拟桌面间切换 -Name[zh_CN]=桌面切换 diff --git a/plugin-desktopswitch/translations/desktopswitch_zh_TW.desktop b/plugin-desktopswitch/translations/desktopswitch_zh_TW.desktop deleted file mode 100644 index a8b6d9c..0000000 --- a/plugin-desktopswitch/translations/desktopswitch_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Desktop switcher -Comment=Allows easy switching between virtual desktops. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=允許切換虛擬桌面 -Name[zh_TW]=桌面切換 diff --git a/plugin-directorymenu/CMakeLists.txt b/plugin-directorymenu/CMakeLists.txt deleted file mode 100644 index 319b02d..0000000 --- a/plugin-directorymenu/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -set(PLUGIN "directorymenu") - -set(HEADERS - directorymenu.h - directorymenuconfiguration.h -) - -set(SOURCES - directorymenu.cpp - directorymenuconfiguration.cpp -) - -set(UIS - directorymenuconfiguration.ui -) - -set(LIBRARIES - ${LIBRARIES} - Qt5Xdg -) - -include ("../cmake/BuildPlugin.cmake") -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-directorymenu/directorymenu.cpp b/plugin-directorymenu/directorymenu.cpp deleted file mode 100644 index de75efe..0000000 --- a/plugin-directorymenu/directorymenu.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Daniel Drzisga - * - * 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 diinstributed 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 "directorymenu.h" -#include -#include -#include -#include -#include - -#include - -DirectoryMenu::DirectoryMenu(const ILXQtPanelPluginStartupInfo &startupInfo) : - QObject(), - ILXQtPanelPlugin(startupInfo), - mMenu(0), - mDefaultIcon(XdgIcon::fromTheme("folder")) -{ - mOpenDirectorySignalMapper = new QSignalMapper(this); - mMenuSignalMapper = new QSignalMapper(this); - - mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mButton.setAutoRaise(true); - mButton.setIcon(XdgIcon::fromTheme("folder")); - - connect(&mButton, SIGNAL(clicked()), this, SLOT(showMenu())); - connect(mOpenDirectorySignalMapper, SIGNAL(mapped(QString)), this, SLOT(openDirectory(QString))); - connect(mMenuSignalMapper, SIGNAL(mapped(QString)), this, SLOT(addMenu(QString))); - - settingsChanged(); -} - -DirectoryMenu::~DirectoryMenu() -{ - if(mMenu) - { - delete mMenu; - mMenu = 0; - } -} - -void DirectoryMenu::showMenu() -{ - if(mBaseDirectory.exists()) - { - buildMenu(mBaseDirectory.absolutePath()); - } - else - { - buildMenu(QDir::homePath()); - } - - willShowWindow(mMenu); - // Just using Qt`s activateWindow() won't work on some WMs like Kwin. - // Solution is to execute menu 1ms later using timer - mMenu->popup(calculatePopupWindowPos(mMenu->sizeHint()).topLeft()); -} - -void DirectoryMenu::buildMenu(const QString& path) -{ - if(mMenu) - { - delete mMenu; - mMenu = 0; - } - - mPathStrings.clear(); - - mMenu = new QMenu(); - - addActions(mMenu, path); -} - -void DirectoryMenu::openDirectory(const QString& path) -{ - QDesktopServices::openUrl(QUrl("file://" + QDir::toNativeSeparators(path))); -} - -void DirectoryMenu::addMenu(QString path) -{ - QSignalMapper* sender = (QSignalMapper* )QObject::sender(); - QMenu* parentMenu = (QMenu*) sender->mapping(path); - - if(parentMenu->isEmpty()) - { - addActions(parentMenu, path); - } -} - -void DirectoryMenu::addActions(QMenu* menu, const QString& path) -{ - mPathStrings.push_back(path); - - QAction* openDirectoryAction = menu->addAction(XdgIcon::fromTheme("folder"), tr("Open")); - connect(openDirectoryAction, SIGNAL(triggered()), mOpenDirectorySignalMapper, SLOT(map())); - mOpenDirectorySignalMapper->setMapping(openDirectoryAction, mPathStrings.back()); - - menu->addSeparator(); - - QDir dir(path); - QFileInfoList list = dir.entryInfoList(); - - foreach (const QFileInfo& entry, list) - { - if(entry.isDir() && !entry.isHidden()) - { - mPathStrings.push_back(entry.fileName()); - - QMenu* subMenu = menu->addMenu(XdgIcon::fromTheme("folder"), mPathStrings.back()); - - connect(subMenu, SIGNAL(aboutToShow()), mMenuSignalMapper, SLOT(map())); - mMenuSignalMapper->setMapping(subMenu, entry.absoluteFilePath()); - } - } -} - -QDialog* DirectoryMenu::configureDialog() -{ - return new DirectoryMenuConfiguration(settings()); -} - -void DirectoryMenu::settingsChanged() -{ - mBaseDirectory.setPath(settings()->value("baseDirectory", QDir::homePath()).toString()); - - QString iconPath = settings()->value("icon", QString()).toString(); - QIcon icon = QIcon(iconPath); - - if(!icon.isNull()) - { - QIcon buttonIcon = QIcon(icon); - if(!buttonIcon.pixmap(QSize(24,24)).isNull()) - { - mButton.setIcon(buttonIcon); - return; - } - } - - mButton.setIcon(mDefaultIcon); -} diff --git a/plugin-directorymenu/directorymenu.h b/plugin-directorymenu/directorymenu.h deleted file mode 100644 index 7e4a18f..0000000 --- a/plugin-directorymenu/directorymenu.h +++ /dev/null @@ -1,94 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Daniel Drzisga - * - * 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 DIRECTORYMENU_H -#define DIRECTORYMENU_H - -#include "../panel/ilxqtpanelplugin.h" - #include "directorymenuconfiguration.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -class DirectoryMenu : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT - -public: - DirectoryMenu(const ILXQtPanelPluginStartupInfo &startupInfo); - ~DirectoryMenu(); - - virtual QWidget *widget() { return &mButton; } - virtual QString themeId() const { return "DirectoryMenu"; } - virtual ILXQtPanelPlugin::Flags flags() const { return HaveConfigDialog; } - QDialog *configureDialog(); - void settingsChanged(); - -private slots: - void showMenu(); - void openDirectory(const QString& path); - void addMenu(QString path); - -protected slots: - void buildMenu(const QString& path); - -private: - void addActions(QMenu* menu, const QString& path); - - QToolButton mButton; - QMenu *mMenu; - QSignalMapper *mOpenDirectorySignalMapper; - QSignalMapper *mMenuSignalMapper; - - QDir mBaseDirectory; - QIcon mDefaultIcon; - std::vector mPathStrings; -}; - -class DirectoryMenuLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new DirectoryMenu(startupInfo); - } -}; - - -#endif - diff --git a/plugin-directorymenu/directorymenuconfiguration.cpp b/plugin-directorymenu/directorymenuconfiguration.cpp deleted file mode 100644 index 833eb52..0000000 --- a/plugin-directorymenu/directorymenuconfiguration.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Daniel Drzisga - * - * 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 "directorymenuconfiguration.h" -#include "ui_directorymenuconfiguration.h" - - -DirectoryMenuConfiguration::DirectoryMenuConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::DirectoryMenuConfiguration), - mBaseDirectory(QDir::homePath()), - mDefaultIcon(XdgIcon::fromTheme("folder")) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("DirectoryMenuConfigurationWindow"); - ui->setupUi(this); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), SLOT(dialogButtonsAction(QAbstractButton*))); - - loadSettings(); - ui->baseDirectoryB->setIcon(mDefaultIcon); - - connect(ui->baseDirectoryB, SIGNAL(clicked()), SLOT(showDirectoryDialog())); - connect(ui->iconB, SIGNAL(clicked()), SLOT(showIconDialog())); -} - -DirectoryMenuConfiguration::~DirectoryMenuConfiguration() -{ - delete ui; -} - -void DirectoryMenuConfiguration::loadSettings() -{ - mBaseDirectory.setPath(settings().value("baseDirectory", QDir::homePath()).toString()); - ui->baseDirectoryB->setText(mBaseDirectory.dirName()); - - mIcon = settings().value("icon", QString()).toString(); - if(!mIcon.isNull()) - { - QIcon buttonIcon = QIcon(mIcon); - if(!buttonIcon.pixmap(QSize(24,24)).isNull()) - { - ui->iconB->setIcon(buttonIcon); - return; - } - } - - ui->iconB->setIcon(mDefaultIcon); -} - -void DirectoryMenuConfiguration::saveSettings() -{ - settings().setValue("baseDirectory", mBaseDirectory.absolutePath()); - settings().setValue("icon", mIcon); -} - -void DirectoryMenuConfiguration::showDirectoryDialog() -{ - QFileDialog d(this, tr("Choose Base Directory"), mBaseDirectory.absolutePath()); - d.setFileMode(QFileDialog::Directory); - d.setOptions(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - d.setWindowModality(Qt::WindowModal); - - if(d.exec() && !d.selectedFiles().isEmpty()) - { - mBaseDirectory.setPath(d.selectedFiles().front()); - ui->baseDirectoryB->setText(mBaseDirectory.dirName()); - - saveSettings(); - } -} - -void DirectoryMenuConfiguration::showIconDialog() -{ - QFileDialog d(this, tr("Choose Icon"), QDir::homePath(), tr("Icons (*.png *.xpm *.jpg)")); - d.setWindowModality(Qt::WindowModal); - - if(d.exec() && !d.selectedFiles().isEmpty()) - { - QIcon newIcon = QIcon(d.selectedFiles().front()); - - if(newIcon.pixmap(QSize(24,24)).isNull()) - { - QMessageBox::warning(this, tr("Directory Menu"), tr("An error occurred while loading the icon.")); - return; - } - - ui->iconB->setIcon(newIcon); - mIcon = d.selectedFiles().front(); - saveSettings(); - } -} diff --git a/plugin-directorymenu/directorymenuconfiguration.h b/plugin-directorymenu/directorymenuconfiguration.h deleted file mode 100644 index e2936ea..0000000 --- a/plugin-directorymenu/directorymenuconfiguration.h +++ /dev/null @@ -1,76 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Daniel Drzisga - * - * 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 DIRECTORYMENUCONFIGURATION_H -#define DIRECTORYMENUCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" - -#include -#include -#include -#include -#include - -namespace Ui { - class DirectoryMenuConfiguration; -} - -class DirectoryMenuConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit DirectoryMenuConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~DirectoryMenuConfiguration(); - -private: - Ui::DirectoryMenuConfiguration *ui; - QDir mBaseDirectory; - QString mIcon; - QIcon mDefaultIcon; - - /* - Read settings from conf file and put data into controls. - */ - void loadSettings(); - -private slots: - /* - Saves settings in conf file. - */ - void saveSettings(); - void showDirectoryDialog(); - void showIconDialog(); - -private: -}; - -#endif // DIRECTORYMENUCONFIGURATION_H diff --git a/plugin-directorymenu/directorymenuconfiguration.ui b/plugin-directorymenu/directorymenuconfiguration.ui deleted file mode 100644 index 6a592d2..0000000 --- a/plugin-directorymenu/directorymenuconfiguration.ui +++ /dev/null @@ -1,113 +0,0 @@ - - - DirectoryMenuConfiguration - - - - 0 - 0 - 342 - 168 - - - - Directory Menu Settings - - - - - - Appearance - - - - - - Base directory: - - - - - - - - 0 - 0 - - - - BaseDirectoryName - - - - - - - Icon: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - - buttons - accepted() - DirectoryMenuConfiguration - accept() - - - 214 - 350 - - - 157 - 274 - - - - - buttons - rejected() - DirectoryMenuConfiguration - reject() - - - 214 - 350 - - - 196 - 274 - - - - - diff --git a/plugin-directorymenu/resources/directorymenu.desktop.in b/plugin-directorymenu/resources/directorymenu.desktop.in deleted file mode 100644 index 704c623..0000000 --- a/plugin-directorymenu/resources/directorymenu.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Directory Menu -Comment=Displays a menu showing the contents of a directory -Icon=folder - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-directorymenu/translations/directorymenu_ar.desktop b/plugin-directorymenu/translations/directorymenu_ar.desktop deleted file mode 100644 index 013e114..0000000 --- a/plugin-directorymenu/translations/directorymenu_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=قائمة الأدلّة -Comment[ar]=تعرض قائمة تظهر محتويات الدّليل diff --git a/plugin-directorymenu/translations/directorymenu_da.desktop b/plugin-directorymenu/translations/directorymenu_da.desktop deleted file mode 100644 index 92d8abb..0000000 --- a/plugin-directorymenu/translations/directorymenu_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Directory Menu -Comment=Displays a menu showing the contents of a directory -Icon=folder - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Mappemenu -Comment[da]=Viser en menu med indholdet af en mappe \ No newline at end of file diff --git a/plugin-directorymenu/translations/directorymenu_de.desktop b/plugin-directorymenu/translations/directorymenu_de.desktop deleted file mode 100644 index 4edd17a..0000000 --- a/plugin-directorymenu/translations/directorymenu_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Ordnermenü -Comment[de]=Zeigt ein Menü mit dem Inhalt eines Ordners an diff --git a/plugin-directorymenu/translations/directorymenu_el.desktop b/plugin-directorymenu/translations/directorymenu_el.desktop deleted file mode 100644 index 9899fc6..0000000 --- a/plugin-directorymenu/translations/directorymenu_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Μενού καταλόγου -Comment[el]=Εμφανίζει ένα μενού με τα περιεχόμενα ενός καταλόγου diff --git a/plugin-directorymenu/translations/directorymenu_fr.desktop b/plugin-directorymenu/translations/directorymenu_fr.desktop deleted file mode 100644 index 5e6ae8b..0000000 --- a/plugin-directorymenu/translations/directorymenu_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Menu de répertoire -Comment[fr]=Affiche un menu avec le contenu d'un répertoire diff --git a/plugin-directorymenu/translations/directorymenu_hu.desktop b/plugin-directorymenu/translations/directorymenu_hu.desktop deleted file mode 100644 index 9dd6666..0000000 --- a/plugin-directorymenu/translations/directorymenu_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Directory Menu -Comment=Displays a menu showing the contents of a directory - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=Egy könyvtár tartalmát mutató menü -Name[hu]=Könyvtármenü diff --git a/plugin-directorymenu/translations/directorymenu_it.desktop b/plugin-directorymenu/translations/directorymenu_it.desktop deleted file mode 100644 index 56c1537..0000000 --- a/plugin-directorymenu/translations/directorymenu_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Menu cartella -Comment[it]=Mostra il contenuto di una cartella diff --git a/plugin-directorymenu/translations/directorymenu_lt.desktop b/plugin-directorymenu/translations/directorymenu_lt.desktop deleted file mode 100644 index 26496a0..0000000 --- a/plugin-directorymenu/translations/directorymenu_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Katalogų meniu -Comment[lt]=Rodo meniu, kuriame rodomas katalogų turinys diff --git a/plugin-directorymenu/translations/directorymenu_pl.desktop b/plugin-directorymenu/translations/directorymenu_pl.desktop deleted file mode 100644 index 39c6168..0000000 --- a/plugin-directorymenu/translations/directorymenu_pl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[pl]=Menu katalogów -Comment[pl]=Wyświetla menu z zawartością katalogów diff --git a/plugin-directorymenu/translations/directorymenu_pt.desktop b/plugin-directorymenu/translations/directorymenu_pt.desktop deleted file mode 100644 index 9055055..0000000 --- a/plugin-directorymenu/translations/directorymenu_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Name[pt]=Menu de diretórios -Comment[pt]=Mostra um menu com o conteúdo do diretório diff --git a/plugin-directorymenu/translations/directorymenu_ru.desktop b/plugin-directorymenu/translations/directorymenu_ru.desktop deleted file mode 100644 index 0ee5c98..0000000 --- a/plugin-directorymenu/translations/directorymenu_ru.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ru]=Меню папки -Comment[ru]=Показывает меню, отображающее содержимое папки diff --git a/plugin-dom/CMakeLists.txt b/plugin-dom/CMakeLists.txt deleted file mode 100644 index 8bddcb9..0000000 --- a/plugin-dom/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -set(PLUGIN "dom") - -set(HEADERS - domplugin.h - treewindow.h - domtreeitem.h -) - -set(SOURCES - domplugin.cpp - treewindow.cpp - domtreeitem.cpp -) - -set(UIS - treewindow.ui -) - -set(RESOURCES - resources.qrc -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-dom/domplugin.cpp b/plugin-dom/domplugin.cpp deleted file mode 100644 index 4526b35..0000000 --- a/plugin-dom/domplugin.cpp +++ /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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "domplugin.h" -#include "treewindow.h" -#include -#include - - -DomPlugin::DomPlugin(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo) -{ - mButton.setAutoRaise(true); - mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mButton.setIcon(XdgIcon::fromTheme("preferences-plugin")); - connect(&mButton, SIGNAL(clicked()), this, SLOT(showDialog())); -} - - -void DomPlugin::showDialog() -{ - TreeWindow *dialog = mButton.findChild(); - - if (dialog == 0) - { - dialog = new TreeWindow(&mButton); - dialog->setAttribute(Qt::WA_DeleteOnClose); - } - - willShowWindow(dialog); - dialog->show(); - dialog->activateWindow(); -} diff --git a/plugin-dom/domplugin.h b/plugin-dom/domplugin.h deleted file mode 100644 index 3418d67..0000000 --- a/plugin-dom/domplugin.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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 DOMPLUGIN_H -#define DOMPLUGIN_H - -#include "../panel/ilxqtpanelplugin.h" -#include - - -class DomPlugin: public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - DomPlugin(const ILXQtPanelPluginStartupInfo &startupInfo); - - virtual QWidget *widget() { return &mButton; } - virtual QString themeId() const { return "Dom"; } - virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment; } - -private slots: - void showDialog(); - -private: - QToolButton mButton; - -}; - -class DomPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new DomPlugin(startupInfo); - } -}; - -#endif // DOMPLUGIN_H diff --git a/plugin-dom/domtreeitem.cpp b/plugin-dom/domtreeitem.cpp deleted file mode 100644 index 1782be3..0000000 --- a/plugin-dom/domtreeitem.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "domtreeitem.h" -#include -#include -#include -#include - - -DomTreeItem::DomTreeItem(QTreeWidget *view, QWidget *widget): - QTreeWidgetItem(view), - mWidget(widget) -{ - init(); - mWidget->installEventFilter(this); - connect(mWidget, SIGNAL(destroyed()), this, SLOT(widgetDestroyed())); -} - - -DomTreeItem::DomTreeItem(QTreeWidgetItem *parent, QWidget *widget): - QTreeWidgetItem(parent), - mWidget(widget) -{ - init(); - mWidget->installEventFilter(this); - connect(mWidget, SIGNAL(destroyed()), this, SLOT(widgetDestroyed())); -} - - -void DomTreeItem::init() -{ - QStringList hierarcy = widgetClassHierarcy(); - - for (int i=0; iobjectName(); - setText(0, QString("%1 (%2)%3").arg( - name , - widgetClassName(), - text)); - setText(1, hierarcy.join(" :: ")); - - fill(); -} - - -void DomTreeItem::fill() -{ - QList widgets = mWidget->findChildren(); - - foreach (QWidget *w, widgets) - { - if (w->parentWidget() != mWidget) - continue; - - new DomTreeItem(this, w); - } -} - - -bool DomTreeItem::eventFilter(QObject *watched, QEvent *event) -{ - if (watched == mWidget && - event->type() == QEvent::ChildPolished) - { - QChildEvent *ce = static_cast(event); - QWidget *w = qobject_cast(ce->child()); - if (w) - { - for (int i=0; i(child(i)); - if (ci->widget() == w) - ci->deleteLater(); - } - - new DomTreeItem(this, w); - } - } - - return QObject::eventFilter(watched, event); -} - - -QString DomTreeItem::widgetObjectName() const -{ - return mWidget->objectName(); -} - - -QString DomTreeItem::widgetText() const -{ - QToolButton *toolButton = qobject_cast(mWidget); - if (toolButton) - return toolButton->text(); - - return ""; -} - - -QString DomTreeItem::widgetClassName() const -{ - return mWidget->metaObject()->className(); -} - - -QStringList DomTreeItem::widgetClassHierarcy() const -{ - QStringList hierarcy; - const QMetaObject *m = mWidget->metaObject(); - while (m) - { - hierarcy << m->className(); - m = m->superClass(); - } - return hierarcy; -} - - -void DomTreeItem::widgetDestroyed() -{ - deleteLater(); -} diff --git a/plugin-dom/domtreeitem.h b/plugin-dom/domtreeitem.h deleted file mode 100644 index 3a2f8ec..0000000 --- a/plugin-dom/domtreeitem.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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 DOMTREEITEM_H -#define DOMTREEITEM_H - -#include -#include - - -class DomTreeItem: public QObject, public QTreeWidgetItem -{ - Q_OBJECT -public: - explicit DomTreeItem(QTreeWidget *view, QWidget *widget); - explicit DomTreeItem(QTreeWidgetItem *parent, QWidget *widget); - bool eventFilter(QObject *watched, QEvent *event); - - QString widgetObjectName() const; - QString widgetText() const; - QString widgetClassName() const; - QStringList widgetClassHierarcy() const; - QWidget *widget() const { return mWidget; } - -private slots: - void widgetDestroyed(); - -private: - QWidget *mWidget; - void init(); - void fill(); -}; - -#endif // DOMTREEITEM_H diff --git a/plugin-dom/images/widgets/calendarwidget.png b/plugin-dom/images/widgets/calendarwidget.png deleted file mode 100644 index 26737b8..0000000 Binary files a/plugin-dom/images/widgets/calendarwidget.png and /dev/null differ diff --git a/plugin-dom/images/widgets/checkbox.png b/plugin-dom/images/widgets/checkbox.png deleted file mode 100644 index ab6f53e..0000000 Binary files a/plugin-dom/images/widgets/checkbox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/columnview.png b/plugin-dom/images/widgets/columnview.png deleted file mode 100644 index 4132ee6..0000000 Binary files a/plugin-dom/images/widgets/columnview.png and /dev/null differ diff --git a/plugin-dom/images/widgets/combobox.png b/plugin-dom/images/widgets/combobox.png deleted file mode 100644 index bf3ed79..0000000 Binary files a/plugin-dom/images/widgets/combobox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/commandlinkbutton.png b/plugin-dom/images/widgets/commandlinkbutton.png deleted file mode 100644 index 6bbd84a..0000000 Binary files a/plugin-dom/images/widgets/commandlinkbutton.png and /dev/null differ diff --git a/plugin-dom/images/widgets/dateedit.png b/plugin-dom/images/widgets/dateedit.png deleted file mode 100644 index 6827fa7..0000000 Binary files a/plugin-dom/images/widgets/dateedit.png and /dev/null differ diff --git a/plugin-dom/images/widgets/datetimeedit.png b/plugin-dom/images/widgets/datetimeedit.png deleted file mode 100644 index 7d8e6fe..0000000 Binary files a/plugin-dom/images/widgets/datetimeedit.png and /dev/null differ diff --git a/plugin-dom/images/widgets/dial.png b/plugin-dom/images/widgets/dial.png deleted file mode 100644 index 050d1db..0000000 Binary files a/plugin-dom/images/widgets/dial.png and /dev/null differ diff --git a/plugin-dom/images/widgets/dialogbuttonbox.png b/plugin-dom/images/widgets/dialogbuttonbox.png deleted file mode 100644 index b1f89fb..0000000 Binary files a/plugin-dom/images/widgets/dialogbuttonbox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/dockwidget.png b/plugin-dom/images/widgets/dockwidget.png deleted file mode 100644 index 9eee04f..0000000 Binary files a/plugin-dom/images/widgets/dockwidget.png and /dev/null differ diff --git a/plugin-dom/images/widgets/doublespinbox.png b/plugin-dom/images/widgets/doublespinbox.png deleted file mode 100644 index 5686ac8..0000000 Binary files a/plugin-dom/images/widgets/doublespinbox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/fontcombobox.png b/plugin-dom/images/widgets/fontcombobox.png deleted file mode 100644 index 6848f15..0000000 Binary files a/plugin-dom/images/widgets/fontcombobox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/frame.png b/plugin-dom/images/widgets/frame.png deleted file mode 100644 index 68f5da0..0000000 Binary files a/plugin-dom/images/widgets/frame.png and /dev/null differ diff --git a/plugin-dom/images/widgets/graphicsview.png b/plugin-dom/images/widgets/graphicsview.png deleted file mode 100644 index 93fe760..0000000 Binary files a/plugin-dom/images/widgets/graphicsview.png and /dev/null differ diff --git a/plugin-dom/images/widgets/groupbox.png b/plugin-dom/images/widgets/groupbox.png deleted file mode 100644 index 4025b4d..0000000 Binary files a/plugin-dom/images/widgets/groupbox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/groupboxcollapsible.png b/plugin-dom/images/widgets/groupboxcollapsible.png deleted file mode 100644 index 62fd1ad..0000000 Binary files a/plugin-dom/images/widgets/groupboxcollapsible.png and /dev/null differ diff --git a/plugin-dom/images/widgets/hscrollbar.png b/plugin-dom/images/widgets/hscrollbar.png deleted file mode 100644 index 466c58d..0000000 Binary files a/plugin-dom/images/widgets/hscrollbar.png and /dev/null differ diff --git a/plugin-dom/images/widgets/hslider.png b/plugin-dom/images/widgets/hslider.png deleted file mode 100644 index 525bd1c..0000000 Binary files a/plugin-dom/images/widgets/hslider.png and /dev/null differ diff --git a/plugin-dom/images/widgets/hsplit.png b/plugin-dom/images/widgets/hsplit.png deleted file mode 100644 index 1ea8f2a..0000000 Binary files a/plugin-dom/images/widgets/hsplit.png and /dev/null differ diff --git a/plugin-dom/images/widgets/label.png b/plugin-dom/images/widgets/label.png deleted file mode 100644 index 5d7d7b4..0000000 Binary files a/plugin-dom/images/widgets/label.png and /dev/null differ diff --git a/plugin-dom/images/widgets/lcdnumber.png b/plugin-dom/images/widgets/lcdnumber.png deleted file mode 100644 index c3cac18..0000000 Binary files a/plugin-dom/images/widgets/lcdnumber.png and /dev/null differ diff --git a/plugin-dom/images/widgets/line.png b/plugin-dom/images/widgets/line.png deleted file mode 100644 index 5c64dfb..0000000 Binary files a/plugin-dom/images/widgets/line.png and /dev/null differ diff --git a/plugin-dom/images/widgets/lineedit.png b/plugin-dom/images/widgets/lineedit.png deleted file mode 100644 index 75fc890..0000000 Binary files a/plugin-dom/images/widgets/lineedit.png and /dev/null differ diff --git a/plugin-dom/images/widgets/listbox.png b/plugin-dom/images/widgets/listbox.png deleted file mode 100644 index 367e67f..0000000 Binary files a/plugin-dom/images/widgets/listbox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/listview.png b/plugin-dom/images/widgets/listview.png deleted file mode 100644 index d1308d5..0000000 Binary files a/plugin-dom/images/widgets/listview.png and /dev/null differ diff --git a/plugin-dom/images/widgets/mdiarea.png b/plugin-dom/images/widgets/mdiarea.png deleted file mode 100644 index 7783dd5..0000000 Binary files a/plugin-dom/images/widgets/mdiarea.png and /dev/null differ diff --git a/plugin-dom/images/widgets/plaintextedit.png b/plugin-dom/images/widgets/plaintextedit.png deleted file mode 100644 index 077bf16..0000000 Binary files a/plugin-dom/images/widgets/plaintextedit.png and /dev/null differ diff --git a/plugin-dom/images/widgets/plugin.png b/plugin-dom/images/widgets/plugin.png deleted file mode 100644 index 1d23b91..0000000 Binary files a/plugin-dom/images/widgets/plugin.png and /dev/null differ diff --git a/plugin-dom/images/widgets/progress.png b/plugin-dom/images/widgets/progress.png deleted file mode 100644 index 44ae094..0000000 Binary files a/plugin-dom/images/widgets/progress.png and /dev/null differ diff --git a/plugin-dom/images/widgets/pushbutton.png b/plugin-dom/images/widgets/pushbutton.png deleted file mode 100644 index 61f779c..0000000 Binary files a/plugin-dom/images/widgets/pushbutton.png and /dev/null differ diff --git a/plugin-dom/images/widgets/radiobutton.png b/plugin-dom/images/widgets/radiobutton.png deleted file mode 100644 index 10c1d8c..0000000 Binary files a/plugin-dom/images/widgets/radiobutton.png and /dev/null differ diff --git a/plugin-dom/images/widgets/scrollarea.png b/plugin-dom/images/widgets/scrollarea.png deleted file mode 100644 index 651ea24..0000000 Binary files a/plugin-dom/images/widgets/scrollarea.png and /dev/null differ diff --git a/plugin-dom/images/widgets/spacer.png b/plugin-dom/images/widgets/spacer.png deleted file mode 100644 index 8a0931b..0000000 Binary files a/plugin-dom/images/widgets/spacer.png and /dev/null differ diff --git a/plugin-dom/images/widgets/spinbox.png b/plugin-dom/images/widgets/spinbox.png deleted file mode 100644 index cdd9fe1..0000000 Binary files a/plugin-dom/images/widgets/spinbox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/tabbar.png b/plugin-dom/images/widgets/tabbar.png deleted file mode 100644 index d5d3783..0000000 Binary files a/plugin-dom/images/widgets/tabbar.png and /dev/null differ diff --git a/plugin-dom/images/widgets/table.png b/plugin-dom/images/widgets/table.png deleted file mode 100644 index 4bbd9c2..0000000 Binary files a/plugin-dom/images/widgets/table.png and /dev/null differ diff --git a/plugin-dom/images/widgets/tabwidget.png b/plugin-dom/images/widgets/tabwidget.png deleted file mode 100644 index 1254bb6..0000000 Binary files a/plugin-dom/images/widgets/tabwidget.png and /dev/null differ diff --git a/plugin-dom/images/widgets/textedit.png b/plugin-dom/images/widgets/textedit.png deleted file mode 100644 index 32e897d..0000000 Binary files a/plugin-dom/images/widgets/textedit.png and /dev/null differ diff --git a/plugin-dom/images/widgets/timeedit.png b/plugin-dom/images/widgets/timeedit.png deleted file mode 100644 index c66d91b..0000000 Binary files a/plugin-dom/images/widgets/timeedit.png and /dev/null differ diff --git a/plugin-dom/images/widgets/toolbox.png b/plugin-dom/images/widgets/toolbox.png deleted file mode 100644 index 2ab71dc..0000000 Binary files a/plugin-dom/images/widgets/toolbox.png and /dev/null differ diff --git a/plugin-dom/images/widgets/toolbutton.png b/plugin-dom/images/widgets/toolbutton.png deleted file mode 100644 index 0bff069..0000000 Binary files a/plugin-dom/images/widgets/toolbutton.png and /dev/null differ diff --git a/plugin-dom/images/widgets/vline.png b/plugin-dom/images/widgets/vline.png deleted file mode 100644 index 35a7300..0000000 Binary files a/plugin-dom/images/widgets/vline.png and /dev/null differ diff --git a/plugin-dom/images/widgets/vscrollbar.png b/plugin-dom/images/widgets/vscrollbar.png deleted file mode 100644 index 28b7c40..0000000 Binary files a/plugin-dom/images/widgets/vscrollbar.png and /dev/null differ diff --git a/plugin-dom/images/widgets/vslider.png b/plugin-dom/images/widgets/vslider.png deleted file mode 100644 index 59f06ba..0000000 Binary files a/plugin-dom/images/widgets/vslider.png and /dev/null differ diff --git a/plugin-dom/images/widgets/vspacer.png b/plugin-dom/images/widgets/vspacer.png deleted file mode 100644 index ce5e8bd..0000000 Binary files a/plugin-dom/images/widgets/vspacer.png and /dev/null differ diff --git a/plugin-dom/images/widgets/widget.png b/plugin-dom/images/widgets/widget.png deleted file mode 100644 index 1cf960e..0000000 Binary files a/plugin-dom/images/widgets/widget.png and /dev/null differ diff --git a/plugin-dom/images/widgets/widgetstack.png b/plugin-dom/images/widgets/widgetstack.png deleted file mode 100644 index 2c6964e..0000000 Binary files a/plugin-dom/images/widgets/widgetstack.png and /dev/null differ diff --git a/plugin-dom/images/widgets/wizard.png b/plugin-dom/images/widgets/wizard.png deleted file mode 100644 index 7c0e107..0000000 Binary files a/plugin-dom/images/widgets/wizard.png and /dev/null differ diff --git a/plugin-dom/resources.qrc b/plugin-dom/resources.qrc deleted file mode 100644 index 7680eb3..0000000 --- a/plugin-dom/resources.qrc +++ /dev/null @@ -1,53 +0,0 @@ - - - images/widgets/plugin.png - images/widgets/calendarwidget.png - images/widgets/checkbox.png - images/widgets/columnview.png - images/widgets/combobox.png - images/widgets/commandlinkbutton.png - images/widgets/dateedit.png - images/widgets/datetimeedit.png - images/widgets/dialogbuttonbox.png - images/widgets/dial.png - images/widgets/dockwidget.png - images/widgets/doublespinbox.png - images/widgets/fontcombobox.png - images/widgets/frame.png - images/widgets/graphicsview.png - images/widgets/groupboxcollapsible.png - images/widgets/groupbox.png - images/widgets/hscrollbar.png - images/widgets/hslider.png - images/widgets/hsplit.png - images/widgets/label.png - images/widgets/lcdnumber.png - images/widgets/lineedit.png - images/widgets/line.png - images/widgets/listbox.png - images/widgets/listview.png - images/widgets/mdiarea.png - images/widgets/plaintextedit.png - images/widgets/plugin.png - images/widgets/progress.png - images/widgets/pushbutton.png - images/widgets/radiobutton.png - images/widgets/scrollarea.png - images/widgets/spacer.png - images/widgets/spinbox.png - images/widgets/tabbar.png - images/widgets/table.png - images/widgets/tabwidget.png - images/widgets/textedit.png - images/widgets/timeedit.png - images/widgets/toolbox.png - images/widgets/toolbutton.png - images/widgets/vline.png - images/widgets/vscrollbar.png - images/widgets/vslider.png - images/widgets/vspacer.png - images/widgets/widget.png - images/widgets/widgetstack.png - images/widgets/wizard.png - - diff --git a/plugin-dom/resources/dom.desktop.in b/plugin-dom/resources/dom.desktop.in deleted file mode 100644 index 006159a..0000000 --- a/plugin-dom/resources/dom.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Panel DOM tree -Comment=Show a DOM tree of the LXQt panel. -Icon=view-web-browser-dom-tree - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-dom/translations/dom_ar.desktop b/plugin-dom/translations/dom_ar.desktop deleted file mode 100644 index 2e997f6..0000000 --- a/plugin-dom/translations/dom_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=شجرة DOM للّوحة -Comment[ar]=تُظهر شجرة DOM للوحة لكسكيوت. diff --git a/plugin-dom/translations/dom_da.desktop b/plugin-dom/translations/dom_da.desktop deleted file mode 100644 index 69df085..0000000 --- a/plugin-dom/translations/dom_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Panel DOM tree -Comment=Show a DOM tree of the LXQt panel. -Icon=view-web-browser-dom-tree - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Panel DOM-træ -Comment[da]=Vis et DOM-træ af LXQt-panelet. \ No newline at end of file diff --git a/plugin-dom/translations/dom_de.desktop b/plugin-dom/translations/dom_de.desktop deleted file mode 100644 index 52f901f..0000000 --- a/plugin-dom/translations/dom_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Leiste DOM-Baum -Comment[de]=Zeigt einen DOM-Baum der LXQt-Leiste. diff --git a/plugin-dom/translations/dom_el.desktop b/plugin-dom/translations/dom_el.desktop deleted file mode 100644 index 9ba3477..0000000 --- a/plugin-dom/translations/dom_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Δέντρο πίνακα DOM -Comment[el]=Εμφάνιση ενός δέντρου DOM του πίνακα LXQt. diff --git a/plugin-dom/translations/dom_fr.desktop b/plugin-dom/translations/dom_fr.desktop deleted file mode 100644 index 577eeb4..0000000 --- a/plugin-dom/translations/dom_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Arborescence DOM dans le tableau de bord -Comment[fr]=Affiche une arborescence DOM dans le tableau de bord. diff --git a/plugin-dom/translations/dom_hu.desktop b/plugin-dom/translations/dom_hu.desktop deleted file mode 100644 index a199de9..0000000 --- a/plugin-dom/translations/dom_hu.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Name[hu]=Panel DOM fa -Comment[hu]=DOM faszerkezet az LXQt panelen diff --git a/plugin-dom/translations/dom_ja.desktop b/plugin-dom/translations/dom_ja.desktop deleted file mode 100644 index 08478c6..0000000 --- a/plugin-dom/translations/dom_ja.desktop +++ /dev/null @@ -1,5 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name[ja]=パネルのDOMツリー -Comment[ja]=LXQtパネルのDOMツリーを表示する diff --git a/plugin-dom/translations/dom_lt.desktop b/plugin-dom/translations/dom_lt.desktop deleted file mode 100644 index 2babc26..0000000 --- a/plugin-dom/translations/dom_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Skydelio DOM medis -Comment[lt]=Rodyti LXQt skydelio DOM medį. diff --git a/plugin-dom/translations/dom_pl.desktop b/plugin-dom/translations/dom_pl.desktop deleted file mode 100644 index b97984e..0000000 --- a/plugin-dom/translations/dom_pl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[pl]=Drzewo DOM panelu -Comment[pl]=Wyświetla drzewo DOM panelu LXQt. diff --git a/plugin-dom/translations/dom_pt.desktop b/plugin-dom/translations/dom_pt.desktop deleted file mode 100644 index 2e21519..0000000 --- a/plugin-dom/translations/dom_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Name[pt]=Árvore do painel DOM -Comment[pt]=Mostra a árvore DOM do painel do LXQt. diff --git a/plugin-dom/translations/dom_ru.desktop b/plugin-dom/translations/dom_ru.desktop deleted file mode 100644 index 5e3a56d..0000000 --- a/plugin-dom/translations/dom_ru.desktop +++ /dev/null @@ -1,5 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name[ru]=Дерево DOM панели. -Comment[ru]=Показать дерево DOM панели LXQt. diff --git a/plugin-dom/treewindow.cpp b/plugin-dom/treewindow.cpp deleted file mode 100644 index 78426b9..0000000 --- a/plugin-dom/treewindow.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "treewindow.h" -#include "ui_treewindow.h" -#include "domtreeitem.h" -#include -#include -#include - -#define PROP_OBJECT_NAME 0 -#define PROP_CLASS_NAME 1 -#define PROP_TEXT 2 -#define PROP_CLASS_HIERARCY 3 - - -TreeWindow::TreeWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::TreeWindow) -{ - mRootWidget = this; - while (mRootWidget->parentWidget()) - mRootWidget = mRootWidget->parentWidget(); - - ui->setupUi(this); - - ui->tree->setStyleSheet( - "QTreeView::item { " - "padding: 2px;" - "}" - ); - - initPropertiesView(); - - QList widgets = mRootWidget->findChildren(); - - ui->tree->setRootIsDecorated(false); - - DomTreeItem *item = new DomTreeItem(ui->tree, mRootWidget); - ui->tree->expandItem(item); - ui->tree->resizeColumnToContents(0); - - - connect(ui->tree, SIGNAL(itemSelectionChanged()), this, SLOT(updatePropertiesView())); - item->setSelected(true); - - QHeaderView* h = new QHeaderView(Qt::Horizontal); - h->setStretchLastSection(true); - ui->allPropertiesView->setHorizontalHeader(h); - connect(h, &QHeaderView::sectionDoubleClicked, this, &TreeWindow::sectionDoubleClickedSlot); -} - - -TreeWindow::~TreeWindow() -{ - delete ui; -} - - -void TreeWindow::initPropertiesView() -{ - ui->propertiesView->viewport()->setAutoFillBackground(false); - - ui->propertiesView->setRowCount(4); - ui->propertiesView->setColumnCount(2); - - QTableWidgetItem *item; - item = new QTableWidgetItem("Object name"); - ui->propertiesView->setItem(PROP_OBJECT_NAME, 0, item); - ui->propertiesView->setItem(PROP_OBJECT_NAME, 1, new QTableWidgetItem()); - - item = new QTableWidgetItem("Class name"); - ui->propertiesView->setItem(PROP_CLASS_NAME, 0, item); - ui->propertiesView->setItem(PROP_CLASS_NAME, 1, new QTableWidgetItem()); - - item = new QTableWidgetItem("Text"); - ui->propertiesView->setItem(PROP_TEXT, 0, item); - ui->propertiesView->setItem(PROP_TEXT, 1, new QTableWidgetItem()); - - item = new QTableWidgetItem("Class hierarcy"); - ui->propertiesView->setItem(PROP_CLASS_HIERARCY, 0, item); - ui->propertiesView->setItem(PROP_CLASS_HIERARCY, 1, new QTableWidgetItem()); - - -} - - -void TreeWindow::updatePropertiesView() -{ - if (ui->tree->selectedItems().isEmpty()) - { - clearPropertiesView(); - return; - } - - QTreeWidgetItem *item = ui->tree->selectedItems().first(); - if (!item) - { - clearPropertiesView(); - return; - } - - DomTreeItem *treeItem = static_cast(item); - - ui->propertiesView->item(PROP_OBJECT_NAME, 1)->setText(treeItem->widgetObjectName()); - ui->propertiesView->item(PROP_CLASS_NAME, 1)->setText(treeItem->widgetClassName()); - ui->propertiesView->item(PROP_TEXT, 1)->setText(treeItem->widgetText()); - ui->propertiesView->item(PROP_CLASS_HIERARCY, 1)->setText(treeItem->widgetClassHierarcy().join(" :: ")); - - QString s; - QDebug out(&s); - QMetaObject const * const m = treeItem->widget()->metaObject(); - const int curr_cnt = ui->allPropertiesView->rowCount(); - ui->allPropertiesView->setRowCount(m->propertyCount()); - for (int i = 0, cnt = m->propertyCount(); cnt > i; ++i) - { - if (curr_cnt <= i) - { - ui->allPropertiesView->setItem(i, 0, new QTableWidgetItem); - ui->allPropertiesView->setItem(i, 1, new QTableWidgetItem); - ui->allPropertiesView->setItem(i, 2, new QTableWidgetItem); - } - QMetaProperty const & prop = m->property(i); - ui->allPropertiesView->item(i, 0)->setText(prop.name()); - ui->allPropertiesView->item(i, 1)->setText(prop.typeName()); - s.clear(); - out << prop.read(treeItem->widget()); - ui->allPropertiesView->item(i, 2)->setText(s); - } - for (int i = m->propertyCount(); curr_cnt > i; ++i) - ui->allPropertiesView->removeRow(i); -} - - -void TreeWindow::clearPropertiesView() -{ - for (int i=0; ipropertiesView->rowCount(); ++i) - ui->propertiesView->item(i, 1)->setText(""); - for (int i = ui->allPropertiesView->rowCount(); 0 <= i; --i) - ui->allPropertiesView->removeRow(i); - ui->allPropertiesView->setRowCount(0); -} - -void TreeWindow::sectionDoubleClickedSlot(int column) -{ - ui->allPropertiesView->sortByColumn(column, Qt::AscendingOrder); -} diff --git a/plugin-dom/treewindow.h b/plugin-dom/treewindow.h deleted file mode 100644 index e4c9f91..0000000 --- a/plugin-dom/treewindow.h +++ /dev/null @@ -1,64 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 TREEWINDOW_H -#define TREEWINDOW_H - -#include -#include - - -class QTreeWidgetItem; -class QTreeWidget; -class QEvent; - -namespace Ui { -class TreeWindow; -} - - -class TreeWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit TreeWindow(QWidget *parent = 0); - ~TreeWindow(); - -private slots: - void updatePropertiesView(); - void clearPropertiesView(); - void sectionDoubleClickedSlot(int column); - -private: - Ui::TreeWindow *ui; - QWidget *mRootWidget; - - void initPropertiesView(); -}; - -#endif // TREEWINDOW_H diff --git a/plugin-dom/treewindow.ui b/plugin-dom/treewindow.ui deleted file mode 100644 index 042dda1..0000000 --- a/plugin-dom/treewindow.ui +++ /dev/null @@ -1,132 +0,0 @@ - - - TreeWindow - - - - 0 - 0 - 800 - 424 - - - - Panel DOM tree - - - - - - - Qt::Horizontal - - - - - 1 - 0 - - - - - Name - - - - - - - 1 - 0 - - - - - - - QFrame::NoFrame - - - Qt::DotLine - - - - 1 - 0 - - - - true - - - - Property - - - - - Value - - - - - - - - All properties - - - - 0 - 0 - - - - - - - - QFrame::NoFrame - - - Qt::DotLine - - - - Property - - - - - Type - - - - - String value - - - - - - - - - - - - - - - 0 - 0 - 601 - 21 - - - - - - - - diff --git a/plugin-kbindicator/CMakeLists.txt b/plugin-kbindicator/CMakeLists.txt deleted file mode 100644 index e5a27e8..0000000 --- a/plugin-kbindicator/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -set(PLUGIN "kbindicator") - -set(HEADERS - src/kbdstate.h - src/settings.h - src/content.h - src/kbdlayout.h - src/kbdinfo.h - src/kbdkeeper.h - src/kbdwatcher.h - src/controls.h - src/kbdstateconfig.h -) - -set(SOURCES - kbindicator-plugin.cpp - src/kbdstate.cpp - src/settings.cpp - src/content.cpp - src/kbdkeeper.cpp - src/kbdwatcher.cpp - src/kbdstateconfig.cpp -) - -set(UIS - src/kbdstateconfig.ui -) - -set(LIBRARIES -) - -find_package(XCB REQUIRED COMPONENTS xkbcommon-x11 xkbcommon xcb xcb-xkb) -find_package(Qt5 REQUIRED COMPONENTS X11Extras Xml) - -include_directories(${XCB_INCLUDE_DIRS}) - -set(HEADERS - ${HEADERS} - src/x11/kbdlayout.h -) - -set(SOURCES - ${SOURCES} - src/x11/kbdlayout.cpp -) - -set(LIBRARIES - ${LIBRARIES} - ${XCB_LIBRARIES} - Qt5::Xml -) - -add_definitions(-DX11_ENABLED) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-kbindicator/kbindicator-plugin.cpp b/plugin-kbindicator/kbindicator-plugin.cpp deleted file mode 100644 index b4a4038..0000000 --- a/plugin-kbindicator/kbindicator-plugin.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * 2007 Dmitriy Zhukov - * - * 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 "src/kbdstate.h" -#include "../panel/ilxqtpanelplugin.h" - -class LXQtKbIndicatorPlugin: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - virtual ~LXQtKbIndicatorPlugin() - {} - - virtual ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - // Currently only X11 supported - if (!QX11Info::connection()) { - qWarning() << "Currently kbindicator plugin supports X11 only. Skipping."; - return nullptr; - } - return new KbdState(startupInfo); - } -}; - -#include "kbindicator-plugin.moc" diff --git a/plugin-kbindicator/resources/kbindicator.desktop.in b/plugin-kbindicator/resources/kbindicator.desktop.in deleted file mode 100644 index 2e3682d..0000000 --- a/plugin-kbindicator/resources/kbindicator.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Keyboard state indicator -Comment=Keyboard state indicator and switcher plugin. -Icon=input-keyboard - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-kbindicator/src/content.cpp b/plugin-kbindicator/src/content.cpp deleted file mode 100644 index 12bf29a..0000000 --- a/plugin-kbindicator/src/content.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 "kbdstate.h" -#include "content.h" - -Content::Content(bool layoutEnabled): - QWidget(), - m_layoutEnabled(layoutEnabled) -{ - QBoxLayout *box = new QBoxLayout(QBoxLayout::LeftToRight); - box->setContentsMargins(0, 0, 0, 0); - box->setSpacing(0); - setLayout(box); - - m_capsLock = new QLabel(tr("C", "Label for CapsLock indicator")); - m_capsLock->setObjectName("CapsLockLabel"); - m_capsLock->setAlignment(Qt::AlignCenter); - m_capsLock->setToolTip(tr("CapsLock", "Tooltip for CapsLock indicator")); - m_capsLock->installEventFilter(this); - layout()->addWidget(m_capsLock); - - m_numLock = new QLabel(tr("N", "Label for NumLock indicator")); - m_numLock->setObjectName("NumLockLabel"); - m_numLock->setToolTip(tr("NumLock", "Tooltip for NumLock indicator")); - m_numLock->setAlignment(Qt::AlignCenter); - m_numLock->installEventFilter(this); - layout()->addWidget(m_numLock); - - m_scrollLock = new QLabel(tr("S", "Label for ScrollLock indicator")); - m_scrollLock->setObjectName("ScrollLockLabel"); - m_scrollLock->setToolTip(tr("ScrollLock", "Tooltip for ScrollLock indicator")); - m_scrollLock->setAlignment(Qt::AlignCenter); - m_scrollLock->installEventFilter(this); - layout()->addWidget(m_scrollLock); - - m_layout = new QLabel; - m_layout->setObjectName("LayoutLabel"); - m_layout->setAlignment(Qt::AlignCenter); - m_layout->installEventFilter(this); - layout()->addWidget(m_layout); - m_layout->setEnabled(false); -} - -Content::~Content() -{} - -bool Content::setup() -{ - m_capsLock->setVisible(Settings::instance().showCapLock()); - m_numLock->setVisible(Settings::instance().showNumLock()); - m_scrollLock->setVisible(Settings::instance().showScrollLock()); - m_layout->setVisible(m_layoutEnabled && Settings::instance().showLayout()); - return true; -} - -void Content::layoutChanged(const QString & sym, const QString & name, const QString & variant) -{ - m_layout->setText(sym.toUpper()); - QString txt = QString("\ - \ - \ -
%1: %3
%2: %4
").arg(tr("Layout")).arg(tr("Variant")).arg(name).arg(variant); - m_layout->setToolTip(txt); -} - -void Content::modifierStateChanged(Controls mod, bool active) -{ - setEnabled(mod, active); -} - - -void Content::setEnabled(Controls cnt, bool enabled) -{ - widget(cnt)->setEnabled(enabled); -} - -QWidget* Content::widget(Controls cnt) const -{ - switch(cnt){ - case Caps: return m_capsLock; - case Num: return m_numLock; - case Scroll: return m_scrollLock; - case Layout: return m_layout; - } - return 0; -} - -bool Content::eventFilter(QObject *object, QEvent *event) -{ - if (event->type() == QEvent::QEvent::MouseButtonRelease) - { - if (object == m_capsLock) - emit controlClicked(Controls::Caps); - else if (object == m_numLock) - emit controlClicked(Controls::Num); - else if (object == m_scrollLock) - emit controlClicked(Controls::Scroll); - else if(object == m_layout){ - emit controlClicked(Controls::Layout); - } - return true; - } - - return QObject::eventFilter(object, event); -} - -void Content::showHorizontal() -{ - qobject_cast(layout())->setDirection(QBoxLayout::LeftToRight); -} - -void Content::showVertical() -{ - qobject_cast(layout())->setDirection(QBoxLayout::TopToBottom); -} diff --git a/plugin-kbindicator/src/content.h b/plugin-kbindicator/src/content.h deleted file mode 100644 index 37aee23..0000000 --- a/plugin-kbindicator/src/content.h +++ /dev/null @@ -1,64 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _CONTENT_H_ -#define _CONTENT_H_ - -#include -#include "controls.h" - -class QLabel; - -class Content : public QWidget -{ - Q_OBJECT -public: - Content(bool layoutEnabled); - ~Content(); - -public: - void setEnabled(Controls cnt, bool enabled); - QWidget* widget(Controls cnt) const; - bool setup(); - - virtual bool eventFilter(QObject *object, QEvent *event); - - void showHorizontal(); - void showVertical(); -public slots: - void layoutChanged(const QString & sym, const QString & name, const QString & variant); - void modifierStateChanged(Controls mod, bool active); -signals: - void controlClicked(Controls cnt); -private: - bool m_layoutEnabled; - QLabel *m_capsLock; - QLabel *m_numLock; - QLabel *m_scrollLock; - QLabel *m_layout; -}; - -#endif diff --git a/plugin-kbindicator/src/controls.h b/plugin-kbindicator/src/controls.h deleted file mode 100644 index 3732661..0000000 --- a/plugin-kbindicator/src/controls.h +++ /dev/null @@ -1,37 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _CONTROLS_H_ -#define _CONTROLS_H_ - -enum Controls { - Caps, - Num, - Scroll, - Layout -}; - -#endif diff --git a/plugin-kbindicator/src/kbdinfo.h b/plugin-kbindicator/src/kbdinfo.h deleted file mode 100644 index 4465b59..0000000 --- a/plugin-kbindicator/src/kbdinfo.h +++ /dev/null @@ -1,78 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _KBDINFO_H_ -#define _KBDINFO_H_ - -#include -#include - -class KbdInfo -{ -public: - KbdInfo() - {} - - struct Info - { - QString sym; - QString name; - QString variant; - }; - -public: - const QString & currentSym() const - { return m_keyboardInfo[m_current].sym; } - - const QString & currentName() const - { return m_keyboardInfo[m_current].name; } - - const QString & currentVariant() const - { return m_keyboardInfo[m_current].variant; } - - int currentGroup() const - { return m_current; } - - void setCurrentGroup(int group) - { m_current = group; } - - uint size() const - { return m_keyboardInfo.size(); } - - const Info & current() const - { return m_keyboardInfo[m_current]; } - - void clear() - { m_keyboardInfo.clear(); } - - void append(const Info & info) - { m_keyboardInfo.append(info); } -private: - QList m_keyboardInfo; - int m_current = 0; -}; - -#endif diff --git a/plugin-kbindicator/src/kbdkeeper.cpp b/plugin-kbindicator/src/kbdkeeper.cpp deleted file mode 100644 index 1a30cc1..0000000 --- a/plugin-kbindicator/src/kbdkeeper.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 "kbdkeeper.h" - -//-------------------------------------------------------------------------------------------------- - -KbdKeeper::KbdKeeper(const KbdLayout & layout, KeeperType type): - m_layout(layout), - m_type(type) -{ - m_layout.readKbdInfo(m_info); -} - -KbdKeeper::~KbdKeeper() -{} - -bool KbdKeeper::setup() -{ - connect(&m_layout, SIGNAL(keyboardChanged()), SLOT(keyboardChanged())); - connect(&m_layout, SIGNAL(layoutChanged(uint)), SLOT(layoutChanged(uint))); - connect(&m_layout, SIGNAL(checkState()), SLOT(checkState())); - - return true; -} - -void KbdKeeper::keyboardChanged() -{ - m_layout.readKbdInfo(m_info); - emit changed(); -} - -void KbdKeeper::layoutChanged(uint group) -{ - m_info.setCurrentGroup(group); - emit changed(); -} - -void KbdKeeper::checkState() -{} - -void KbdKeeper::switchToNext() -{ - uint index = m_info.currentGroup(); - if (index < m_info.size() - 1) - ++index; - else - index = 0; - - switchToGroup(index); -} - -void KbdKeeper::switchToGroup(uint group) -{ - m_layout.lockGroup(group); - emit changed(); -} - -//-------------------------------------------------------------------------------------------------- - -WinKbdKeeper::WinKbdKeeper(const KbdLayout & layout): - KbdKeeper(layout, KeeperType::Window) -{} - -WinKbdKeeper::~WinKbdKeeper() -{} - -void WinKbdKeeper::layoutChanged(uint group) -{ - WId win = KWindowSystem::activeWindow(); - - if (m_active == win){ - m_mapping[win] = group; - m_info.setCurrentGroup(group); - } else { - if (!m_mapping.contains(win)) - m_mapping.insert(win, 0); - m_layout.lockGroup(m_mapping[win]); - m_active = win; - m_info.setCurrentGroup(m_mapping[win]); - } - emit changed(); -} - -void WinKbdKeeper::checkState() -{ - WId win = KWindowSystem::activeWindow(); - - if (!m_mapping.contains(win)) - m_mapping.insert(win, 0); - m_layout.lockGroup(m_mapping[win]); - m_active = win; - m_info.setCurrentGroup(m_mapping[win]); - emit changed(); -} - -void WinKbdKeeper::switchToGroup(uint group) -{ - WId win = KWindowSystem::activeWindow(); - m_mapping[win] = group; - m_layout.lockGroup(group); - m_info.setCurrentGroup(group); - emit changed(); -} - - -//-------------------------------------------------------------------------------------------------- - -AppKbdKeeper::AppKbdKeeper(const KbdLayout & layout): - KbdKeeper(layout, KeeperType::Window) -{} - -AppKbdKeeper::~AppKbdKeeper() -{} - -void AppKbdKeeper::layoutChanged(uint group) -{ - KWindowInfo info = KWindowInfo(KWindowSystem::activeWindow(), 0, NET::WM2WindowClass); - QString app = info.windowClassName(); - - if (m_active == app){ - m_mapping[app] = group; - m_info.setCurrentGroup(group); - } else { - if (!m_mapping.contains(app)) - m_mapping.insert(app, 0); - - m_layout.lockGroup(m_mapping[app]); - m_active = app; - m_info.setCurrentGroup(m_mapping[app]); - } - emit changed(); -} - -void AppKbdKeeper::checkState() -{ - KWindowInfo info = KWindowInfo(KWindowSystem::activeWindow(), 0, NET::WM2WindowClass); - QString app = info.windowClassName(); - - if (!m_mapping.contains(app)) - m_mapping.insert(app, 0); - - m_layout.lockGroup(m_mapping[app]); - m_active = app; - m_info.setCurrentGroup(m_mapping[app]); - emit changed(); -} - - -void AppKbdKeeper::switchToGroup(uint group) -{ - KWindowInfo info = KWindowInfo(KWindowSystem::activeWindow(), 0, NET::WM2WindowClass); - QString app = info.windowClassName(); - - m_mapping[app] = group; - m_layout.lockGroup(group); - m_info.setCurrentGroup(group); - emit changed(); -} diff --git a/plugin-kbindicator/src/kbdkeeper.h b/plugin-kbindicator/src/kbdkeeper.h deleted file mode 100644 index 0cadce0..0000000 --- a/plugin-kbindicator/src/kbdkeeper.h +++ /dev/null @@ -1,106 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _KBDKEEPER_H_ -#define _KBDKEEPER_H_ - -#include -#include -#include "kbdlayout.h" -#include "kbdinfo.h" -#include "settings.h" - -//-------------------------------------------------------------------------------------------------- - -class KbdKeeper: public QObject -{ - Q_OBJECT -public: - KbdKeeper(const KbdLayout & layout, KeeperType type = KeeperType::Global); - virtual ~KbdKeeper(); - virtual bool setup(); - - const QString & sym() const - { return m_info.currentSym(); } - - const QString & name() const - { return m_info.currentName(); } - - const QString & variant() const - { return m_info.currentVariant(); } - - KeeperType type() const - { return m_type; } - - void switchToNext(); - virtual void switchToGroup(uint group); -protected slots: - virtual void keyboardChanged(); - virtual void layoutChanged(uint group); - virtual void checkState(); -signals: - void changed(); -protected: - const KbdLayout & m_layout; - KbdInfo m_info; - KeeperType m_type; -}; - -//-------------------------------------------------------------------------------------------------- - -class WinKbdKeeper: public KbdKeeper -{ - Q_OBJECT -public: - WinKbdKeeper(const KbdLayout & layout); - virtual ~WinKbdKeeper(); - virtual void switchToGroup(uint group); -protected slots: - virtual void layoutChanged(uint group); - virtual void checkState(); -private: - QHash m_mapping; - WId m_active; -}; - -//-------------------------------------------------------------------------------------------------- - -class AppKbdKeeper: public KbdKeeper -{ - Q_OBJECT -public: - AppKbdKeeper(const KbdLayout & layout); - virtual ~AppKbdKeeper(); - virtual void switchToGroup(uint group); -protected slots: - virtual void layoutChanged(uint group); - virtual void checkState(); -private: - QHash m_mapping; - QString m_active; -}; - -#endif diff --git a/plugin-kbindicator/src/kbdlayout.h b/plugin-kbindicator/src/kbdlayout.h deleted file mode 100644 index 1b9ef24..0000000 --- a/plugin-kbindicator/src/kbdlayout.h +++ /dev/null @@ -1,35 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _KBDLAYOUT_H_ -#define _KBDLAYOUT_H_ - -#ifdef X11_ENABLED -#include "x11/kbdlayout.h" -typedef X11Kbd KbdLayout; -#endif - -#endif diff --git a/plugin-kbindicator/src/kbdstate.cpp b/plugin-kbindicator/src/kbdstate.cpp deleted file mode 100644 index b72a0e7..0000000 --- a/plugin-kbindicator/src/kbdstate.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 "kbdstate.h" -#include "kbdkeeper.h" -#include "kbdstateconfig.h" -#include - -KbdState::KbdState(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - m_content(m_watcher.isLayoutEnabled()) -{ - Settings::instance().init(settings()); - - connect(&m_content, &Content::controlClicked, &m_watcher, &KbdWatcher::controlClicked); - connect(&m_watcher, &KbdWatcher::layoutChanged, &m_content, &Content::layoutChanged); - connect(&m_watcher, &KbdWatcher::modifierStateChanged, &m_content, &Content::modifierStateChanged); - - settingsChanged(); -} - -KbdState::~KbdState() -{} - -void KbdState::settingsChanged() -{ - m_content.setup(); - m_watcher.setup(); -} - -QDialog *KbdState::configureDialog() -{ - return new KbdStateConfig(&m_content); -} - -void KbdState::realign() -{ - if (panel()->isHorizontal()){ - m_content.setMinimumSize(0, panel()->iconSize()); - m_content.showHorizontal(); - } else { - m_content.setMinimumSize(panel()->iconSize(), 0); - m_content.showVertical(); - } -} diff --git a/plugin-kbindicator/src/kbdstate.h b/plugin-kbindicator/src/kbdstate.h deleted file mode 100644 index e2a5375..0000000 --- a/plugin-kbindicator/src/kbdstate.h +++ /dev/null @@ -1,75 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _KDBSTATE_H_ -#define _KDBSTATE_H_ - -#include "../panel/ilxqtpanelplugin.h" -#include "settings.h" -#include "content.h" -#include "kbdwatcher.h" - -class QLabel; - -class KbdState : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - KbdState(const ILXQtPanelPluginStartupInfo &startupInfo); - virtual ~KbdState(); - - virtual QString themeId() const - { return "KbIndicator"; } - - virtual ILXQtPanelPlugin::Flags flags() const - { return PreferRightAlignment | HaveConfigDialog; } - - virtual bool isSeparate() const - { return false; } - - virtual QWidget *widget() - { return &m_content; } - - QDialog *configureDialog(); - virtual void realign(); - - const Settings & prefs() const - { return m_settings; } - - Settings & prefs() - { return m_settings; } - -protected slots: - virtual void settingsChanged(); - -private: - Settings m_settings; - KbdWatcher m_watcher; - Content m_content; -}; - - -#endif diff --git a/plugin-kbindicator/src/kbdstateconfig.cpp b/plugin-kbindicator/src/kbdstateconfig.cpp deleted file mode 100644 index de05ba6..0000000 --- a/plugin-kbindicator/src/kbdstateconfig.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 "kbdstateconfig.h" -#include "ui_kbdstateconfig.h" -#include "settings.h" - -KbdStateConfig::KbdStateConfig(QWidget *parent) : - QDialog(parent), - m_ui(new Ui::KbdStateConfig) -{ - setAttribute(Qt::WA_DeleteOnClose); - m_ui->setupUi(this); - - connect(m_ui->showCaps, &QCheckBox::clicked, this, &KbdStateConfig::save); - connect(m_ui->showNum, &QCheckBox::clicked, this, &KbdStateConfig::save); - connect(m_ui->showScroll, &QCheckBox::clicked, this, &KbdStateConfig::save); - connect(m_ui->showLayout, &QGroupBox::clicked, this, &KbdStateConfig::save); - - connect(m_ui->modes, static_cast(&QButtonGroup::buttonClicked), - [this](int){ - KbdStateConfig::save(); - } - ); - - connect(m_ui->btns, &QDialogButtonBox::clicked, [this](QAbstractButton *btn){ - if (m_ui->btns->buttonRole(btn) == QDialogButtonBox::ResetRole){ - Settings::instance().restore(); - load(); - } - }); - - connect(m_ui->configureLayouts, &QPushButton::clicked, this, &KbdStateConfig::configureLayouts); - - load(); -} - -KbdStateConfig::~KbdStateConfig() -{ - delete m_ui; -} - -void KbdStateConfig::load() -{ - Settings & sets = Settings::instance(); - - m_ui->showCaps->setChecked(sets.showCapLock()); - m_ui->showNum->setChecked(sets.showNumLock()); - m_ui->showScroll->setChecked(sets.showScrollLock()); - m_ui->showLayout->setChecked(sets.showLayout()); - - switch(sets.keeperType()){ - case KeeperType::Global: - m_ui->switchGlobal->setChecked(true); - break; - case KeeperType::Window: - m_ui->switchWindow->setChecked(true); - break; - case KeeperType::Application: - m_ui->switchApplication->setChecked(true); - break; - } -} - -void KbdStateConfig::save() -{ - Settings & sets = Settings::instance(); - - sets.setShowCapLock(m_ui->showCaps->isChecked()); - sets.setShowNumLock(m_ui->showNum->isChecked()); - sets.setShowScrollLock(m_ui->showScroll->isChecked()); - sets.setShowLayout(m_ui->showLayout->isChecked()); - - if (m_ui->switchGlobal->isChecked()) - sets.setKeeperType(KeeperType::Global); - if (m_ui->switchWindow->isChecked()) - sets.setKeeperType(KeeperType::Window); - if (m_ui->switchApplication->isChecked()) - sets.setKeeperType(KeeperType::Application); -} - -void KbdStateConfig::configureLayouts() -{ - QProcess::startDetached(QLatin1String("lxqt-config-input")); -} diff --git a/plugin-kbindicator/src/kbdstateconfig.h b/plugin-kbindicator/src/kbdstateconfig.h deleted file mode 100644 index 3f63ac9..0000000 --- a/plugin-kbindicator/src/kbdstateconfig.h +++ /dev/null @@ -1,52 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _KBDSTATECONFIG_H_ -#define _KBDSTATECONFIG_H_ - -#include - -namespace Ui { -class KbdStateConfig; -} - -class KbdStateConfig : public QDialog -{ - Q_OBJECT - -public: - explicit KbdStateConfig(QWidget *parent = 0); - ~KbdStateConfig(); -private: - void save(); - void load(); - - void configureLayouts(); -private: - Ui::KbdStateConfig *m_ui; -}; - -#endif diff --git a/plugin-kbindicator/src/kbdstateconfig.ui b/plugin-kbindicator/src/kbdstateconfig.ui deleted file mode 100644 index b3ff636..0000000 --- a/plugin-kbindicator/src/kbdstateconfig.ui +++ /dev/null @@ -1,169 +0,0 @@ - - - KbdStateConfig - - - - 0 - 0 - 249 - 354 - - - - Keyboard state settings - - - - - - Lock Indicators - - - - - - Show Caps Lock - - - - - - - Show Num Lock - - - - - - - Show Scroll Lock - - - - - - - - - - Keyboard Layout Indicator - - - true - - - false - - - - - - Switching policy - - - - - - - Global - - - modes - - - - - - - Window - - - modes - - - - - - - Application - - - modes - - - - - - - - - - Configure layouts - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - - btns - accepted() - KbdStateConfig - accept() - - - 248 - 254 - - - 157 - 274 - - - - - btns - rejected() - KbdStateConfig - reject() - - - 316 - 260 - - - 286 - 274 - - - - - - - - diff --git a/plugin-kbindicator/src/kbdwatcher.cpp b/plugin-kbindicator/src/kbdwatcher.cpp deleted file mode 100644 index 2400c97..0000000 --- a/plugin-kbindicator/src/kbdwatcher.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 "kbdwatcher.h" - -KbdWatcher::KbdWatcher() -{ - connect(&m_layout, SIGNAL(modifierChanged(Controls,bool)), SIGNAL(modifierStateChanged(Controls,bool))); - m_layout.init(); -} - -void KbdWatcher::setup() -{ - emit modifierStateChanged(Controls::Caps, m_layout.isModifierLocked(Controls::Caps)); - emit modifierStateChanged(Controls::Num, m_layout.isModifierLocked(Controls::Num)); - emit modifierStateChanged(Controls::Scroll, m_layout.isModifierLocked(Controls::Scroll)); - - if (!m_keeper || m_keeper->type() != Settings::instance().keeperType()){ - createKeeper(Settings::instance().keeperType()); - } -} - -void KbdWatcher::createKeeper(KeeperType type) -{ - switch(type) - { - case KeeperType::Global: - m_keeper.reset(new KbdKeeper(m_layout)); - break; - case KeeperType::Window: - m_keeper.reset(new WinKbdKeeper(m_layout)); - break; - case KeeperType::Application: - m_keeper.reset(new AppKbdKeeper(m_layout)); - break; - } - - connect(m_keeper.data(), SIGNAL(changed()), this, SLOT(keeperChanged())); - - m_keeper->setup(); - keeperChanged(); -} - -void KbdWatcher::keeperChanged() -{ - emit layoutChanged(m_keeper->sym(), m_keeper->name(), m_keeper->variant()); -} - -void KbdWatcher::controlClicked(Controls cnt) -{ - switch(cnt){ - case Controls::Layout: - m_keeper->switchToNext(); - break; - default: - m_layout.lockModifier(cnt, !m_layout.isModifierLocked(cnt)); - break; - } - -} diff --git a/plugin-kbindicator/src/kbdwatcher.h b/plugin-kbindicator/src/kbdwatcher.h deleted file mode 100644 index f8252bd..0000000 --- a/plugin-kbindicator/src/kbdwatcher.h +++ /dev/null @@ -1,64 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _KBDWATCHER_H_ -#define _KBDWATCHER_H_ - -#include "kbdlayout.h" -#include "controls.h" -#include "kbdkeeper.h" - -class KbdKeeper; - -class KbdWatcher: public QObject -{ - Q_OBJECT -public: - KbdWatcher(); - - void setup(); - const KbdLayout & kbdLayout() const - { return m_layout; } - - bool isLayoutEnabled() const - { return m_layout.isEnabled(); } -public slots: - void controlClicked(Controls cnt); -signals: - void layoutChanged(const QString & sym, const QString & name, const QString & variant); - void modifierStateChanged(Controls mod, bool active); - -private: - void createKeeper(KeeperType type); -private slots: - void keeperChanged(); - -private: - KbdLayout m_layout; - QScopedPointer m_keeper; -}; - -#endif diff --git a/plugin-kbindicator/src/settings.cpp b/plugin-kbindicator/src/settings.cpp deleted file mode 100644 index e662120..0000000 --- a/plugin-kbindicator/src/settings.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 "settings.h" - -Settings::Settings() -{} - -Settings &Settings::instance() -{ - static Settings _instance; - return _instance; -} - -void Settings::init(PluginSettings *settings) -{ - m_settings = settings; -} - -bool Settings::showCapLock() const -{ return m_settings->value("show_caps_lock", true).toBool(); } - -bool Settings::showNumLock() const -{ return m_settings->value("show_num_lock", true).toBool(); } - -bool Settings::showScrollLock() const -{ return m_settings->value("show_scroll_lock", true).toBool(); } - -bool Settings::showLayout() const -{ return m_settings->value("show_layout", true).toBool(); } - -void Settings::setShowCapLock(bool show) -{ m_settings->setValue("show_caps_lock", show); } - -void Settings::setShowNumLock(bool show) -{ m_settings->setValue("show_num_lock", show); } - -void Settings::setShowScrollLock(bool show) -{ m_settings->setValue("show_scroll_lock", show); } - -void Settings::setShowLayout(bool show) -{ m_settings->setValue("show_layout", show); } - -KeeperType Settings::keeperType() const -{ - QString type = m_settings->value("keeper_type", "global").toString(); - if(type == "global") - return KeeperType::Global; - if(type == "window") - return KeeperType::Window; - if(type == "application") - return KeeperType::Application; - return KeeperType::Application; -} - -void Settings::setKeeperType(KeeperType type) const -{ - switch (type) { - case KeeperType::Global: - m_settings->setValue("keeper_type", "global"); - break; - case KeeperType::Window: - m_settings->setValue("keeper_type", "window"); - break; - case KeeperType::Application: - m_settings->setValue("keeper_type", "application"); - break; - } -} - -void Settings::restore() -{ m_settings->loadFromCache(); } diff --git a/plugin-kbindicator/src/settings.h b/plugin-kbindicator/src/settings.h deleted file mode 100644 index e985556..0000000 --- a/plugin-kbindicator/src/settings.h +++ /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: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _SETTINGS_H_ -#define _SETTINGS_H_ - -#include "../panel/pluginsettings.h" - -enum class KeeperType -{ - Global, - Window, - Application -}; - -class Settings -{ - -public: - Settings(); - static Settings &instance(); - - void init(PluginSettings *settings); - -public: - bool showCapLock() const; - bool showNumLock() const; - bool showScrollLock() const; - bool showLayout() const; - KeeperType keeperType() const; - void restore(); - -public: - void setShowCapLock(bool show); - void setShowNumLock(bool show); - void setShowScrollLock(bool show); - void setShowLayout(bool show); - void setKeeperType(KeeperType type) const; - -private: - PluginSettings *m_settings; -}; - -#endif diff --git a/plugin-kbindicator/src/x11/kbdlayout.cpp b/plugin-kbindicator/src/x11/kbdlayout.cpp deleted file mode 100644 index 883df07..0000000 --- a/plugin-kbindicator/src/x11/kbdlayout.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 "kbdlayout.h" - -#include -#include - -// Note: We need to override "explicit" as this is a C++ keyword. But it is -// used as variable name in xkb.h. This is causing a failure in C++ compile -// time. -// Similar bug here: https://bugs.freedesktop.org/show_bug.cgi?id=74080 -#define explicit _explicit -#include -#undef explicit - -#include "../kbdinfo.h" -#include "../controls.h" - -namespace pimpl { - -struct LangInfo -{ - QString name; - QString syn; - QString variant; -}; - -class X11Kbd: public QAbstractNativeEventFilter -{ -public: - X11Kbd(::X11Kbd *pub): - m_pub(pub) - {} - - bool init() - { - m_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); - m_connection = xcb_connect(0, 0); - - if (!m_connection || xcb_connection_has_error(m_connection)){ - qWarning() << "Couldn't connect to X server: error code" - << (m_connection ? xcb_connection_has_error(m_connection) : -1); - return false; - } - - xkb_x11_setup_xkb_extension(m_connection, - XKB_X11_MIN_MAJOR_XKB_VERSION, - XKB_X11_MIN_MINOR_XKB_VERSION, - XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS, - NULL, NULL, &m_eventType, NULL - ); - - m_deviceId = xkb_x11_get_core_keyboard_device_id(m_connection); - qApp->installNativeEventFilter(this); - - readState(); - return true; - } - - virtual ~X11Kbd() - { - xkb_state_unref(m_state); - xkb_keymap_unref(m_keymap); - xcb_disconnect(m_connection); - xkb_context_unref(m_context); - } - - bool isEnabled() const - { return true; } - - virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) - { - if (eventType != "xcb_generic_event_t") - return false; - - xcb_generic_event_t *event = static_cast(message); - if ((event->response_type & ~0x80) == m_eventType){ - xcb_xkb_state_notify_event_t *sevent = reinterpret_cast(event); - switch(sevent->xkbType){ - case XCB_XKB_STATE_NOTIFY: - xkb_state_update_mask(m_state, - sevent->baseMods, - sevent->latchedMods, - sevent->lockedMods, - sevent->baseGroup, - sevent->latchedGroup, - sevent->lockedGroup - ); - - if(sevent->changed & XCB_XKB_STATE_PART_GROUP_STATE){ - emit m_pub->layoutChanged(sevent->group); - return true; - } - - if(sevent->changed & XCB_XKB_STATE_PART_MODIFIER_LOCK){ - for(Controls cnt: m_modifiers.keys()){ - bool oldState = m_modifiers[cnt]; - bool newState = xkb_state_led_name_is_active(m_state, modName(cnt)); - if(oldState != newState){ - m_modifiers[cnt] = newState; - emit m_pub->modifierChanged(cnt, newState); - } - } - } - break; - case XCB_XKB_NEW_KEYBOARD_NOTIFY: - readState(); - break; - } - } - - emit m_pub->checkState(); - - return false; - } - - void readKbdInfo(KbdInfo & info) const - { - info.clear(); - xkb_layout_index_t count = xkb_keymap_num_layouts(m_keymap); - for(xkb_layout_index_t i = 0; i < count; ++i){ - QString name = xkb_keymap_layout_get_name(m_keymap, i); - const LangInfo & linfo = names(name); - info.append({linfo.syn, linfo.name, linfo.variant}); - if (xkb_state_layout_index_is_active(m_state, i, XKB_STATE_LAYOUT_EFFECTIVE)) - info.setCurrentGroup(i); - } - } - - void lockGroup(uint group) - { - xcb_void_cookie_t cookie = xcb_xkb_latch_lock_state(m_connection, m_deviceId, 0, 0, 1, group, 0, 0, 0); - xcb_generic_error_t *error = xcb_request_check(m_connection, cookie); - if (error){ - qWarning() << "Lock group error: " << error->error_code; - } - } - - void lockModifier(Controls cnt, bool locked) - { - quint8 mask = fetchMask(cnt); - quint8 curMask = locked ? mask : 0; - xcb_void_cookie_t cookie = xcb_xkb_latch_lock_state(m_connection, m_deviceId, mask, curMask, 0, 0, 0, 0, 0); - xcb_generic_error_t *error = xcb_request_check(m_connection, cookie); - if (error){ - qWarning() << "Lock group error: " << error->error_code; - } - } - - bool isModifierLocked(Controls cnt) const - { return m_modifiers[cnt]; } - -private: - quint8 fetchMask(Controls cnt) const - { - static QHash masks; - if (masks.contains(cnt)) - return masks[cnt]; - - xkb_mod_index_t index = xkb_keymap_led_get_index(m_keymap, modName(cnt)); - - xcb_generic_error_t *error = 0; - quint8 mask = 0; - - xcb_xkb_get_indicator_map_cookie_t cookie = xcb_xkb_get_indicator_map(m_connection, m_deviceId, 1 << index); - xcb_xkb_get_indicator_map_reply_t *reply = xcb_xkb_get_indicator_map_reply(m_connection, cookie, &error); - - - if (!reply || error){ - qWarning() << "Cannot fetch mask " << error->error_code; - return mask; - } - - xcb_xkb_indicator_map_t *map = xcb_xkb_get_indicator_map_maps(reply); - - mask = map->mods; - masks[cnt] = mask; - - free(reply); - return mask; - } - - const char * modName(Controls cnt) const - { - switch(cnt){ - case Controls::Caps: - return XKB_LED_NAME_CAPS; - case Controls::Num: - return XKB_LED_NAME_NUM; - case Controls::Scroll: - return XKB_LED_NAME_SCROLL; - default: - return 0; - } - } - - void readState() - { - if (m_keymap) - xkb_keymap_unref(m_keymap); - m_keymap = xkb_x11_keymap_new_from_device(m_context, m_connection, m_deviceId, (xkb_keymap_compile_flags)0); - - if (m_state) - xkb_state_unref(m_state); - m_state = xkb_x11_state_new_from_device(m_keymap, m_connection, m_deviceId); - - for(Controls cnt: m_modifiers.keys()){ - m_modifiers[cnt] = xkb_state_led_name_is_active(m_state, modName(cnt)); - } - emit m_pub->keyboardChanged(); - } - - const LangInfo & names(const QString & langName) const - { - static LangInfo def{"Unknown", "??", "None"}; - static QHash names; - if (names.empty()){ - if(QFile::exists("/usr/share/X11/xkb/rules/evdev.xml")){ - QDomDocument doc; - - QFile file("/usr/share/X11/xkb/rules/evdev.xml"); - if (file.open(QIODevice::ReadOnly)){ - if (doc.setContent(&file)) { - QDomElement docElem = doc.documentElement(); - - auto layout= docElem.firstChildElement("layoutList"); - for(int i = 0; i < layout.childNodes().count(); ++i){ - auto conf = layout.childNodes().at(i).firstChildElement("configItem"); - names.insert( - conf.firstChildElement("description").firstChild().toText().data(),{ - conf.firstChildElement("description").firstChild().toText().data(), - conf.firstChildElement("name").firstChild().toText().data(), - "None" - } - ); - auto variants = layout.childNodes().at(i).firstChildElement("variantList"); - for(int j = 0; j < variants.childNodes().count(); ++j){ - auto var = variants.childNodes().at(j).firstChildElement("configItem"); - names.insert( - var.firstChildElement("description").firstChild().toText().data(), { - conf.firstChildElement("description").firstChild().toText().data(), - conf.firstChildElement("name").firstChild().toText().data(), - var.firstChildElement("name").firstChild().toText().data() - } - ); - } - } - } - file.close(); - } - } - } - if (names.contains(langName)) - return names[langName]; - return def; - } - -private: - struct xkb_context *m_context = 0; - xcb_connection_t *m_connection = 0; - int32_t m_deviceId; - uint8_t m_eventType; - xkb_state *m_state = 0; - xkb_keymap *m_keymap = 0; - ::X11Kbd *m_pub; - QHash m_modifiers = { - {Controls::Caps, false}, - {Controls::Num, false}, - {Controls::Scroll, false}, - }; -}; - -} - -X11Kbd::X11Kbd(): - m_priv(new pimpl::X11Kbd(this)) -{} - -X11Kbd::~X11Kbd() -{} - -bool X11Kbd::init() -{ return m_priv->init(); } - -bool X11Kbd::isEnabled() const -{ return true; } - -void X11Kbd::readKbdInfo(KbdInfo & info) const -{ m_priv->readKbdInfo(info); } - -void X11Kbd::lockGroup(uint layId) const -{ m_priv->lockGroup(layId); } - -void X11Kbd::lockModifier(Controls cnt, bool locked) -{ m_priv->lockModifier(cnt, locked); } - -bool X11Kbd::isModifierLocked(Controls cnt) const -{ return m_priv->isModifierLocked(cnt); } diff --git a/plugin-kbindicator/src/x11/kbdlayout.h b/plugin-kbindicator/src/x11/kbdlayout.h deleted file mode 100644 index aa92e0c..0000000 --- a/plugin-kbindicator/src/x11/kbdlayout.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: 2015 LXQt team - * Authors: - * Dmitriy Zhukov - * - * 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 _X11KBD_H_ -#define _X11KBD_H_ - -#include -#include "../controls.h" - -class KbdInfo; - -namespace pimpl -{ class X11Kbd; } - -class X11Kbd: public QObject -{ - Q_OBJECT -public: - X11Kbd(); - virtual ~X11Kbd(); - - bool init(); - bool isEnabled() const; - void readKbdInfo(KbdInfo & info) const; - void lockGroup(uint layId) const; - void lockModifier(Controls cnt, bool locked); - bool isModifierLocked(Controls cnt) const; -signals: - void layoutChanged(uint layId); - void modifierChanged(Controls cnt, bool locked); - void checkState(); - void keyboardChanged(); -private: - QScopedPointer m_priv; -}; - -#endif diff --git a/plugin-kbindicator/translations/kbindicator_ar.desktop b/plugin-kbindicator/translations/kbindicator_ar.desktop deleted file mode 100644 index 6454edc..0000000 --- a/plugin-kbindicator/translations/kbindicator_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=مؤشّر حالة لوحة المفاتيح -Comment[ar]=ملحقة لمؤشّر حالة لوحة المفاتيح وتبديل اللغات. diff --git a/plugin-kbindicator/translations/kbindicator_da.desktop b/plugin-kbindicator/translations/kbindicator_da.desktop deleted file mode 100644 index 3b93c3b..0000000 --- a/plugin-kbindicator/translations/kbindicator_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Keyboard state indicator -Comment=Keyboard state indicator and switcher plugin. -Icon=input-keyboard - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Tastaturtilstand-indikator -Comment[da]=Tastaturtilstand-indikator og -skifter-plugin. \ No newline at end of file diff --git a/plugin-kbindicator/translations/kbindicator_de.desktop b/plugin-kbindicator/translations/kbindicator_de.desktop deleted file mode 100644 index 6852c6b..0000000 --- a/plugin-kbindicator/translations/kbindicator_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Tastatur-LED-Anzeige -Comment[de]=Plugin zum Anzeigen der Tastatur-LEDs und Umschalten des Layouts. diff --git a/plugin-kbindicator/translations/kbindicator_el.desktop b/plugin-kbindicator/translations/kbindicator_el.desktop deleted file mode 100644 index 3b46b26..0000000 --- a/plugin-kbindicator/translations/kbindicator_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Ένδειξη κατάστασης πληκτρολογίου -Comment[el]=Πρόσθετο ένδειξης της κατάστασης του πληκτρολογίου και εναλλαγής. diff --git a/plugin-kbindicator/translations/kbindicator_fr.desktop b/plugin-kbindicator/translations/kbindicator_fr.desktop deleted file mode 100644 index 2938081..0000000 --- a/plugin-kbindicator/translations/kbindicator_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Indicateurs de l'état du clavier -Comment[fr]=Greffon pour l'affichage de l'état du clavier et pour le basculement entre les dispositions. diff --git a/plugin-kbindicator/translations/kbindicator_hu.desktop b/plugin-kbindicator/translations/kbindicator_hu.desktop deleted file mode 100644 index d83fa0c..0000000 --- a/plugin-kbindicator/translations/kbindicator_hu.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[hu]=Billentyűállapot-kijelző -Comment[hu]=Bővítmény a billentyűállapot kijelzésére és a kiosztás megváltoztatására. diff --git a/plugin-kbindicator/translations/kbindicator_it.desktop b/plugin-kbindicator/translations/kbindicator_it.desktop deleted file mode 100644 index 577adc6..0000000 --- a/plugin-kbindicator/translations/kbindicator_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Disposizione della tastiera -Comment[it]=Mostra lo stato e la mappatura della tastiera diff --git a/plugin-kbindicator/translations/kbindicator_ja.desktop b/plugin-kbindicator/translations/kbindicator_ja.desktop deleted file mode 100644 index 4ad41d9..0000000 --- a/plugin-kbindicator/translations/kbindicator_ja.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LxQtPanel/Plugin -Name[ja]=キーボードインジケーター -Comment[ja]=キーボードインジケーターのプラグイン - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-kbindicator/translations/kbindicator_lt.desktop b/plugin-kbindicator/translations/kbindicator_lt.desktop deleted file mode 100644 index ef1893a..0000000 --- a/plugin-kbindicator/translations/kbindicator_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Klaviatūros būsenos indikatorius -Comment[lt]=Klaviatūros būsenos ir išdėstymų perjungimo įskiepis. diff --git a/plugin-kbindicator/translations/kbindicator_pl.desktop b/plugin-kbindicator/translations/kbindicator_pl.desktop deleted file mode 100644 index a0584dc..0000000 --- a/plugin-kbindicator/translations/kbindicator_pl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[pl]=Wskaźnik stanu klawiatury -Comment[pl]=Wskaźnik i przełącznik stanu klawiatury. diff --git a/plugin-kbindicator/translations/kbindicator_pt.desktop b/plugin-kbindicator/translations/kbindicator_pt.desktop deleted file mode 100644 index d15b8a1..0000000 --- a/plugin-kbindicator/translations/kbindicator_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -#Translations -Name[pt]=Indicador de teclado -Comment[pt]=Plugin indicador do teclado diff --git a/plugin-kbindicator/translations/kbindicator_ru.desktop b/plugin-kbindicator/translations/kbindicator_ru.desktop deleted file mode 100644 index 9a18877..0000000 --- a/plugin-kbindicator/translations/kbindicator_ru.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ru]=Индикатор раскладки клавиатуры -Comment[ru]=Индикатор и плагин переключения раскладки клавиатуры. diff --git a/plugin-mainmenu/CMakeLists.txt b/plugin-mainmenu/CMakeLists.txt deleted file mode 100644 index 7219fd6..0000000 --- a/plugin-mainmenu/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -set(PLUGIN "mainmenu") - -set(HEADERS - actionview.h - lxqtmainmenu.h - menustyle.h - lxqtmainmenuconfiguration.h -) - -set(SOURCES - actionview.cpp - lxqtmainmenu.cpp - menustyle.cpp - lxqtmainmenuconfiguration.cpp -) - -set(UIS - lxqtmainmenuconfiguration.ui -) - - -# optionally use libmenu-cache to generate the application menu -if(NOT WITHOUT_MENU_CACHE) - find_package(MenuCache "0.3.3") -endif() - -set(LIBRARIES - lxqt - lxqt-globalkeys - lxqt-globalkeys-ui -) - -if(MENUCACHE_FOUND) - list(APPEND SOURCES xdgcachedmenu.cpp) - list(APPEND MOCS xdgcachedmenu.h) - - include_directories(${MENUCACHE_INCLUDE_DIRS}) - list(APPEND LIBRARIES ${MENUCACHE_LIBRARIES}) - add_definitions(-DHAVE_MENU_CACHE=1) - -endif() - - -set(QT_USE_QTXML 1) -set(QT_USE_QTDBUS 1) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-mainmenu/actionview.cpp b/plugin-mainmenu/actionview.cpp deleted file mode 100644 index de9ae55..0000000 --- a/plugin-mainmenu/actionview.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2016 LXQt team - * Authors: - * Palo Kisa - * - * 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 "actionview.h" -#ifdef HAVE_MENU_CACHE - #include "xdgcachedmenu.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace -{ - class SingleActivateStyle : public QProxyStyle - { - public: - using QProxyStyle::QProxyStyle; - virtual int styleHint(StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0) const override - { - if(hint == QStyle::SH_ItemView_ActivateItemOnSingleClick) - return 1; - return QProxyStyle::styleHint(hint, option, widget, returnData); - - } - }; - - class DelayedIconDelegate : public QStyledItemDelegate - { - public: - DelayedIconDelegate(QObject * parent = nullptr) - : QStyledItemDelegate(parent) - , mMaxItemWidth(300) - { - } - - void setMaxItemWidth(int max) - { - mMaxItemWidth = max; - } - - virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override - { - //the XdgCachedMenuAction does load the icon upon showing its menu -#ifdef HAVE_MENU_CACHE - QIcon icon = index.data(Qt::DecorationRole).value(); - if (icon.isNull()) - { - XdgCachedMenuAction * cached_action = qobject_cast(qvariant_cast(index.data(ActionView::ActionRole))); - Q_ASSERT(nullptr != cached_action); - cached_action->updateIcon(); - const_cast(index.model())->setData(index, cached_action->icon(), Qt::DecorationRole); - } -#endif - QSize s = QStyledItemDelegate::sizeHint(option, index); - s.setWidth(qMin(mMaxItemWidth, s.width())); - return s; - } - private: - int mMaxItemWidth; - }; - -} - -ActionView::ActionView(QWidget * parent /*= nullptr*/) - : QListView(parent) - , mModel{new QStandardItemModel{this}} - , mProxy{new QSortFilterProxyModel{this}} - , mMaxItemsToShow(10) -{ - setEditTriggers(QAbstractItemView::NoEditTriggers); - setSizeAdjustPolicy(AdjustToContents); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setSelectionBehavior(SelectRows); - setSelectionMode(SingleSelection); - - SingleActivateStyle * s = new SingleActivateStyle; - s->setParent(this); - setStyle(s); - mProxy->setSourceModel(mModel); - mProxy->setDynamicSortFilter(true); - mProxy->setFilterRole(FilterRole); - mProxy->setFilterCaseSensitivity(Qt::CaseInsensitive); - mProxy->sort(0); - { - QScopedPointer guard{selectionModel()}; - setModel(mProxy); - } - { - QScopedPointer guard{itemDelegate()}; - setItemDelegate(new DelayedIconDelegate{this}); - } - connect(this, &QAbstractItemView::activated, this, &ActionView::onActivated); -} - -void ActionView::ActionView::clear() -{ - for (int i = mModel->rowCount() - 1; i >= 0; --i) - { - mModel->removeRow(i); - } -} - -void ActionView::addAction(QAction * action) -{ - QStandardItem * item = new QStandardItem; - item->setData(QVariant::fromValue(action), ActionRole); - item->setFont(action->font()); - //Note: XdgCachedMenuAction has delayed icon loading... we are loading the icon - //in QStyledItemDelegate:sizeHint if necessary - item->setIcon(action->icon()); - item->setText(action->text()); - item->setToolTip(action->toolTip()); - QString all = action->text(); - all += '\n'; - all += action->toolTip(); - item->setData(all, FilterRole); - - mModel->appendRow(item); - connect(action, &QObject::destroyed, this, &ActionView::onActionDestroyed); -} - -bool ActionView::existsAction(QAction const * action) const -{ - bool exists = false; - for (int row = mModel->rowCount() - 1; 0 <= row; --row) - { - const QModelIndex index = mModel->index(row, 0); - if (action->text() == mModel->data(index, Qt::DisplayRole) - && action->toolTip() == mModel->data(index, Qt::ToolTipRole) - ) - { - exists = true; - break; - } - - } - return exists; -} - -void ActionView::fillActions(QMenu * menu) -{ - clear(); - fillActionsRecursive(menu); -} - -void ActionView::setFilter(QString const & filter) -{ - mProxy->setFilterFixedString(filter); - const int count = mProxy->rowCount(); - if (0 < count) - { - if (count > mMaxItemsToShow) - { - setCurrentIndex(mProxy->index(mMaxItemsToShow - 1, 0)); - verticalScrollBar()->triggerAction(QScrollBar::SliderToMinimum); - } else - { - setCurrentIndex(mProxy->index(count - 1, 0)); - } - } -} - -void ActionView::setMaxItemsToShow(int max) -{ - mMaxItemsToShow = max; -} - -void ActionView::setMaxItemWidth(int max) -{ - dynamic_cast(itemDelegate())->setMaxItemWidth(max); -} - -void ActionView::activateCurrent() -{ - QModelIndex const index = currentIndex(); - if (index.isValid()) - emit activated(index); -} - -QSize ActionView::viewportSizeHint() const -{ - const int count = mProxy->rowCount(); - QSize s{0, 0}; - if (0 < count) - { - const bool scrollable = mMaxItemsToShow < count; - s.setWidth(sizeHintForColumn(0) + (scrollable ? verticalScrollBar()->sizeHint().width() : 0)); - s.setHeight(sizeHintForRow(0) * (scrollable ? mMaxItemsToShow : count)); - } - return s; -} - -QSize ActionView::minimumSizeHint() const -{ - return QSize{0, 0}; -} - -void ActionView::onActivated(QModelIndex const & index) -{ - QAction * action = qvariant_cast(model()->data(index, ActionRole)); - Q_ASSERT(nullptr != action); - action->trigger(); -} - -void ActionView::onActionDestroyed() -{ - QObject * const action = sender(); - Q_ASSERT(nullptr != action); - for (int i = mModel->rowCount() - 1; 0 <= i; --i) - { - QStandardItem * item = mModel->item(i); - if (action == item->data(ActionRole).value()) - { - mModel->removeRow(i); - break; - } - } -} - -void ActionView::fillActionsRecursive(QMenu * menu) -{ - for (auto const & action : menu->actions()) - { - if (QMenu * sub_menu = action->menu()) - { - fillActionsRecursive(sub_menu); //recursion - } else if (nullptr == qobject_cast(action) - && !action->isSeparator()) - { - //real menu action -> app - if (!existsAction(action)) - addAction(action); - } - } -} - diff --git a/plugin-mainmenu/actionview.h b/plugin-mainmenu/actionview.h deleted file mode 100644 index b86bc2f..0000000 --- a/plugin-mainmenu/actionview.h +++ /dev/null @@ -1,95 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2016 LXQt team - * Authors: - * Palo Kisa - * - * 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 */ - -#if !defined(ACTION_VIEW_H) -#define ACTION_VIEW_H - -#include - -class QStandardItemModel; -class QSortFilterProxyModel; - -class ActionView : public QListView -{ - Q_OBJECT -public: - enum Role - { - ActionRole = Qt::UserRole - , FilterRole = ActionRole + 1 - }; - -public: - ActionView(QWidget * parent = nullptr); - - /*! \brief Remove all items from model - */ - void clear(); - /*! \brief Add action proxy to the underlying model - */ - void addAction(QAction * action); - /*! \brief Check if action already exists in the view/model. - * - * \note The equality is evaluated just on text() & toolTip() - */ - bool existsAction(QAction const * action) const; - /*! \brief Fill the view with all actions from \param menu - */ - void fillActions(QMenu * menu); - /*! \brief Sets the filter for entries to be presented - */ - void setFilter(QString const & filter); - /*! \brief Set the maximum number of items/results to show - */ - void setMaxItemsToShow(int max); - /*! \brief Set the maximum width of item to show - */ - void setMaxItemWidth(int max); - -public slots: - /*! \brief Trigger action on currently active item - */ - void activateCurrent(); - -protected: - virtual QSize viewportSizeHint() const override; - virtual QSize minimumSizeHint() const override; - -private slots: - void onActivated(QModelIndex const & index); - void onActionDestroyed(); - -private: - void fillActionsRecursive(QMenu * menu); - -private: - QStandardItemModel * mModel; - QSortFilterProxyModel * mProxy; - int mMaxItemsToShow; -}; - -#endif //ACTION_VIEW_H diff --git a/plugin-mainmenu/lxqtmainmenu.cpp b/plugin-mainmenu/lxqtmainmenu.cpp deleted file mode 100644 index 487ed8f..0000000 --- a/plugin-mainmenu/lxqtmainmenu.cpp +++ /dev/null @@ -1,551 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtmainmenu.h" -#include "lxqtmainmenuconfiguration.h" -#include "../panel/lxqtpanel.h" -#include "actionview.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for find_if() -#include -#include - -#include - -#ifdef HAVE_MENU_CACHE -#include "xdgcachedmenu.h" -#endif - -#define DEFAULT_SHORTCUT "Alt+F1" - -LXQtMainMenu::LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - mMenu(0), - mShortcut(0), - mSearchEditAction{new QWidgetAction{this}}, - mSearchViewAction{new QWidgetAction{this}}, - mMakeDirtyAction{new QAction{this}}, - mFilterMenu(true), - mFilterShow(true), - mFilterClear(false), - mFilterShowHideMenu(true), - mHeavyMenuChanges(false) -{ -#ifdef HAVE_MENU_CACHE - mMenuCache = NULL; - mMenuCacheNotify = 0; -#endif - - mDelayedPopup.setSingleShot(true); - mDelayedPopup.setInterval(200); - connect(&mDelayedPopup, &QTimer::timeout, this, &LXQtMainMenu::showHideMenu); - mHideTimer.setSingleShot(true); - mHideTimer.setInterval(250); - - mButton.setAutoRaise(true); - mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); - //Notes: - //1. installing event filter to parent widget to avoid infinite loop - // (while setting icon we also need to set the style) - //2. delaying of installEventFilter because in c-tor mButton has no parent widget - // (parent is assigned in panel's logic after widget() call) - QTimer::singleShot(0, [this] { Q_ASSERT(mButton.parentWidget()); mButton.parentWidget()->installEventFilter(this); }); - - connect(&mButton, &QToolButton::clicked, this, &LXQtMainMenu::showHideMenu); - - mSearchView = new ActionView; - mSearchView->setVisible(false); - connect(mSearchView, &QAbstractItemView::activated, this, &LXQtMainMenu::showHideMenu); - mSearchViewAction->setDefaultWidget(mSearchView); - mSearchEdit = new QLineEdit; - mSearchEdit->setClearButtonEnabled(true); - mSearchEdit->setPlaceholderText(LXQtMainMenu::tr("Search...")); - connect(mSearchEdit, &QLineEdit::textChanged, this, &LXQtMainMenu::searchTextChanged); - connect(mSearchEdit, &QLineEdit::returnPressed, mSearchView, &ActionView::activateCurrent); - mSearchEditAction->setDefaultWidget(mSearchEdit); - QTimer::singleShot(0, [this] { settingsChanged(); }); - - mShortcut = GlobalKeyShortcut::Client::instance()->addAction(QString{}, QString("/panel/%1/show_hide").arg(settings()->group()), LXQtMainMenu::tr("Show/hide main menu"), this); - if (mShortcut) - { - connect(mShortcut, &GlobalKeyShortcut::Action::registrationFinished, [this] { - if (mShortcut->shortcut().isEmpty()) - mShortcut->changeShortcut(DEFAULT_SHORTCUT); - }); - connect(mShortcut, &GlobalKeyShortcut::Action::activated, [this] { - if (!mHideTimer.isActive()) - // Delay this a little -- if we don't do this, search field - // won't be able to capture focus - // See and - // - mDelayedPopup.start(); - }); - } -} - - -/************************************************ - - ************************************************/ -LXQtMainMenu::~LXQtMainMenu() -{ - mButton.parentWidget()->removeEventFilter(this); - if (mMenu) - { - mMenu->removeAction(mSearchEditAction); - mMenu->removeAction(mSearchViewAction); - delete mMenu; - } -#ifdef HAVE_MENU_CACHE - if(mMenuCache) - { - menu_cache_remove_reload_notify(mMenuCache, mMenuCacheNotify); - menu_cache_unref(mMenuCache); - } -#endif -} - - -/************************************************ - - ************************************************/ -void LXQtMainMenu::showHideMenu() -{ - if (mMenu && mMenu->isVisible()) - mMenu->hide(); - else - showMenu(); -} - -/************************************************ - - ************************************************/ -void LXQtMainMenu::showMenu() -{ - if (!mMenu) - return; - - willShowWindow(mMenu); - // Just using Qt`s activateWindow() won't work on some WMs like Kwin. - // Solution is to execute menu 1ms later using timer - mMenu->popup(calculatePopupWindowPos(mMenu->sizeHint()).topLeft()); - if (mFilterMenu || mFilterShow) - { - if (mFilterClear && !mSearchEdit->text().isEmpty()) - { - mSearchEdit->setText(QString{}); - } - //Note: part of the workadound for https://bugreports.qt.io/browse/QTBUG-52021 - mSearchEdit->setReadOnly(false); - //the setReadOnly also changes the cursor, override it back to normal - mSearchEdit->unsetCursor(); - mSearchEdit->setFocus(); - } -} - -#ifdef HAVE_MENU_CACHE -// static -void LXQtMainMenu::menuCacheReloadNotify(MenuCache* cache, gpointer user_data) -{ - reinterpret_cast(user_data)->buildMenu(); -} -#endif - -/************************************************ - - ************************************************/ -void LXQtMainMenu::settingsChanged() -{ - setButtonIcon(); - if (settings()->value("showText", false).toBool()) - { - mButton.setText(settings()->value("text", "Start").toString()); - mButton.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - } - else - { - mButton.setText(""); - mButton.setToolButtonStyle(Qt::ToolButtonIconOnly); - } - - mLogDir = settings()->value("log_dir", "").toString(); - - QString menu_file = settings()->value("menu_file", "").toString(); - if (menu_file.isEmpty()) - menu_file = XdgMenu::getMenuFileName(); - - if (mMenuFile != menu_file) - { - mMenuFile = menu_file; -#ifdef HAVE_MENU_CACHE - menu_cache_init(0); - if(mMenuCache) - { - menu_cache_remove_reload_notify(mMenuCache, mMenuCacheNotify); - menu_cache_unref(mMenuCache); - } - mMenuCache = menu_cache_lookup(mMenuFile.toLocal8Bit()); - if (MenuCacheDir * root = menu_cache_dup_root_dir(mMenuCache)) - { - menu_cache_item_unref(MENU_CACHE_ITEM(root)); - buildMenu(); - } - mMenuCacheNotify = menu_cache_add_reload_notify(mMenuCache, (MenuCacheReloadNotify)menuCacheReloadNotify, this); -#else - mXdgMenu.setEnvironments(QStringList() << "X-LXQT" << "LXQt"); - mXdgMenu.setLogDir(mLogDir); - - bool res = mXdgMenu.read(mMenuFile); - connect(&mXdgMenu, SIGNAL(changed()), this, SLOT(buildMenu())); - if (res) - { - QTimer::singleShot(1000, this, SLOT(buildMenu())); - } - else - { - QMessageBox::warning(0, "Parse error", mXdgMenu.errorString()); - return; - } -#endif - } - - setMenuFontSize(); - - //clear the search to not leaving the menu in wrong state - mSearchEdit->setText(QString{}); - mFilterMenu = settings()->value("filterMenu", true).toBool(); - mFilterShow = settings()->value("filterShow", true).toBool(); - mFilterClear = settings()->value("filterClear", false).toBool(); - mFilterShowHideMenu = settings()->value("filterShowHideMenu", true).toBool(); - if (mMenu) - { - mSearchEdit->setVisible(mFilterMenu || mFilterShow); - mSearchEditAction->setVisible(mFilterMenu || mFilterShow); - } - mSearchView->setMaxItemsToShow(settings()->value("filterShowMaxItems", 10).toInt()); - mSearchView->setMaxItemWidth(settings()->value("filterShowMaxWidth", 300).toInt()); - - realign(); -} - -static bool filterMenu(QMenu * menu, QString const & filter) -{ - bool has_visible = false; - for (auto const & action : menu->actions()) - { - if (QMenu * sub_menu = action->menu()) - { - action->setVisible(filterMenu(sub_menu, filter)/*recursion*/); - has_visible |= action->isVisible(); - } else if (nullptr != qobject_cast(action)) - { - //our searching widget - has_visible = true; - } else if (!action->isSeparator()) - { - //real menu action -> app - action->setVisible(filter.isEmpty() || action->text().contains(filter, Qt::CaseInsensitive) || action->toolTip().contains(filter, Qt::CaseInsensitive)); - has_visible |= action->isVisible(); - } - } - return has_visible; -} - -static void showHideMenuEntries(QMenu * menu, bool show) -{ - //show/hide the top menu entries - for (auto const & action : menu->actions()) - { - if (nullptr == qobject_cast(action)) - { - action->setVisible(show); - } - } -} - -static void setTranslucentMenus(QMenu * menu) -{ - menu->setAttribute(Qt::WA_TranslucentBackground); - for (auto const & action : menu->actions()) - { - if (QMenu * sub_menu = action->menu()) - { - setTranslucentMenus(sub_menu); - } - } -} - -/************************************************ - - ************************************************/ -void LXQtMainMenu::searchTextChanged(QString const & text) -{ - if (mFilterShow) - { - mHeavyMenuChanges = true; - const bool shown = !text.isEmpty(); - if (mFilterShowHideMenu) - showHideMenuEntries(mMenu, !shown); - if (shown) - mSearchView->setFilter(text); - mSearchView->setVisible(shown); - mSearchViewAction->setVisible(shown); - //TODO: how to force the menu to recalculate it's size in a more elegant way? - mMenu->addAction(mMakeDirtyAction); - mMenu->removeAction(mMakeDirtyAction); - mHeavyMenuChanges = false; - } - if (mFilterMenu && !(mFilterShow && mFilterShowHideMenu)) - filterMenu(mMenu, text); - -} - -/************************************************ - - ************************************************/ -void LXQtMainMenu::setSearchFocus(QAction *action) -{ - if (mFilterMenu || mFilterShow) - { - if(action == mSearchEditAction) - mSearchEdit->setFocus(); - else - mSearchEdit->clearFocus(); - } -} - -static void menuInstallEventFilter(QMenu * menu, QObject * watcher) -{ - for (auto const & action : const_cast const &&>(menu->actions())) - { - if (action->menu()) - menuInstallEventFilter(action->menu(), watcher); // recursion - } - menu->installEventFilter(watcher); -} - -/************************************************ - - ************************************************/ -void LXQtMainMenu::buildMenu() -{ - if(mMenu) - { - mMenu->removeAction(mSearchEditAction); - mMenu->removeAction(mSearchViewAction); - delete mMenu; - } -#ifdef HAVE_MENU_CACHE - mMenu = new XdgCachedMenu(mMenuCache, &mButton); -#else - mMenu = new XdgMenuWidget(mXdgMenu, "", &mButton); -#endif - mMenu->setObjectName("TopLevelMainMenu"); - setTranslucentMenus(mMenu); - // Note: the QWidget::ensurePolished() workarounds problem with transparent - // QLineEdit (mSearchEditAction) in menu with Breeze style - // https://bugs.kde.org/show_bug.cgi?id=368048 - mMenu->ensurePolished(); - mMenu->setStyle(&mTopMenuStyle); - - mMenu->addSeparator(); - - menuInstallEventFilter(mMenu, this); - connect(mMenu, &QMenu::aboutToHide, &mHideTimer, static_cast(&QTimer::start)); - connect(mMenu, &QMenu::aboutToShow, &mHideTimer, &QTimer::stop); - - mMenu->addSeparator(); - mMenu->addAction(mSearchViewAction); - mMenu->addAction(mSearchEditAction); - connect(mMenu, &QMenu::hovered, this, &LXQtMainMenu::setSearchFocus); - //Note: setting readOnly to true to avoid wake-ups upon the Qt's internal "blink" cursor timer - //(if the readOnly is not set, the "blink" timer is active also in case the menu is not shown -> - //QWidgetLineControl::updateNeeded is performed w/o any need) - //https://bugreports.qt.io/browse/QTBUG-52021 - connect(mMenu, &QMenu::aboutToHide, [this] { mSearchEdit->setReadOnly(true); }); - mSearchEdit->setVisible(mFilterMenu || mFilterShow); - mSearchEditAction->setVisible(mFilterMenu || mFilterShow); - mSearchView->fillActions(mMenu); - - searchTextChanged(mSearchEdit->text()); - setMenuFontSize(); -} - -/************************************************ - - ************************************************/ -void LXQtMainMenu::setMenuFontSize() -{ - if (!mMenu) - return; - - QFont menuFont = mButton.font(); - if(settings()->value("customFont", false).toBool()) - { - menuFont = mMenu->font(); - menuFont.setPointSize(settings()->value("customFontSize").toInt()); - } - - if (mMenu->font() != menuFont) - { - mMenu->setFont(menuFont); - QList subMenuList = mMenu->findChildren(); - foreach (QMenu* subMenu, subMenuList) - { - subMenu->setFont(menuFont); - } - mSearchEdit->setFont(menuFont); - mSearchView->setFont(menuFont); - } - - //icon size the same as the font height - const int icon_size = QFontMetrics(menuFont).height(); - mTopMenuStyle.setIconSize(icon_size); - mSearchView->setIconSize(QSize{icon_size, icon_size}); -} - - -/************************************************ - - ************************************************/ -void LXQtMainMenu::setButtonIcon() -{ - if (settings()->value("ownIcon", false).toBool()) - { - mButton.setStyleSheet(QString("#MainMenu { qproperty-icon: url(%1); }") - .arg(settings()->value(QLatin1String("icon"), QLatin1String(LXQT_GRAPHICS_DIR"/helix.svg")).toString())); - } else - { - mButton.setStyleSheet(QString()); - } -} - - -/************************************************ - - ************************************************/ -QDialog *LXQtMainMenu::configureDialog() -{ - return new LXQtMainMenuConfiguration(settings(), mShortcut, DEFAULT_SHORTCUT); -} -/************************************************ - - ************************************************/ - -// functor used to match a QAction by prefix -struct MatchAction -{ - MatchAction(QString key):key_(key) {} - bool operator()(QAction* action) { return action->text().startsWith(key_, Qt::CaseInsensitive); } - QString key_; -}; - -bool LXQtMainMenu::eventFilter(QObject *obj, QEvent *event) -{ - if(obj == mButton.parentWidget()) - { - // the application is given a new QStyle - if(event->type() == QEvent::StyleChange) - { - setMenuFontSize(); - setButtonIcon(); - } - } - else if(QMenu* menu = qobject_cast(obj)) - { - if(event->type() == QEvent::KeyPress) - { - // if our shortcut key is pressed while the menu is open, close the menu - QKeyEvent* keyEvent = static_cast(event); - if (keyEvent->modifiers() & ~Qt::ShiftModifier) - { - mHideTimer.start(); - mMenu->hide(); // close the app menu - return true; - } - else // go to the menu item which starts with the pressed key if there is an active action. - { - QString key = keyEvent->text(); - if(key.isEmpty()) - return false; - QAction* action = menu->activeAction(); - if(action !=0) { - QList actions = menu->actions(); - QList::iterator it = qFind(actions.begin(), actions.end(), action); - it = std::find_if(it + 1, actions.end(), MatchAction(key)); - if(it == actions.end()) - it = std::find_if(actions.begin(), it, MatchAction(key)); - if(it != actions.end()) - menu->setActiveAction(*it); - } - } - } - - if (obj == mMenu) - { - if (event->type() == QEvent::Resize) - { - QResizeEvent * e = dynamic_cast(event); - if (e->oldSize().isValid() && e->oldSize() != e->size()) - { - mMenu->move(calculatePopupWindowPos(e->size()).topLeft()); - } - } else if (event->type() == QEvent::KeyPress) - { - QKeyEvent * e = dynamic_cast(event); - if (Qt::Key_Escape == e->key()) - { - if (!mSearchEdit->text().isEmpty()) - { - mSearchEdit->setText(QString{}); - //filter out this to not close the menu - return true; - } - } - } else if (QEvent::ActionChanged == event->type() - || QEvent::ActionAdded == event->type()) - { - //filter this if we are performing heavy changes to reduce flicker - if (mHeavyMenuChanges) - return true; - } - } - } - return false; -} - -#undef DEFAULT_SHORTCUT diff --git a/plugin-mainmenu/lxqtmainmenu.h b/plugin-mainmenu/lxqtmainmenu.h deleted file mode 100644 index 0b149c5..0000000 --- a/plugin-mainmenu/lxqtmainmenu.h +++ /dev/null @@ -1,137 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQT_MAINMENU_H -#define LXQT_MAINMENU_H - -#include "../panel/ilxqtpanelplugin.h" -#include - -#ifdef HAVE_MENU_CACHE -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include "menustyle.h" - - -class QMenu; -class QWidgetAction; -class QLineEdit; -class ActionView; -class LXQtBar; - -namespace LXQt { -class PowerManager; -class ScreenSaver; -} - -namespace GlobalKeyShortcut -{ -class Action; -} - -class LXQtMainMenu : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtMainMenu(); - - QString themeId() const { return "MainMenu"; } - virtual ILXQtPanelPlugin::Flags flags() const { return HaveConfigDialog ; } - - QWidget *widget() { return &mButton; } - QDialog *configureDialog(); - - bool isSeparate() const { return true; } - -protected: - bool eventFilter(QObject *obj, QEvent *event); - -private: - void setMenuFontSize(); - void setButtonIcon(); - -private: - QToolButton mButton; - QString mLogDir; - QMenu* mMenu; - GlobalKeyShortcut::Action *mShortcut; - MenuStyle mTopMenuStyle; - QWidgetAction * mSearchEditAction; - QLineEdit * mSearchEdit; - QWidgetAction * mSearchViewAction; - ActionView * mSearchView; - QAction * mMakeDirtyAction; - bool mFilterMenu; //!< searching should perform hiding nonmatching items in menu - bool mFilterShow; //!< searching should list matching items in top menu - bool mFilterClear; //!< search field should be cleared upon showing the menu - bool mFilterShowHideMenu; //!< while searching all (original) menu entries should be hidden - bool mHeavyMenuChanges; //!< flag for filtering some mMenu events while heavy changes are performed - -#ifdef HAVE_MENU_CACHE - MenuCache* mMenuCache; - MenuCacheNotifyId mMenuCacheNotify; - static void menuCacheReloadNotify(MenuCache* cache, gpointer user_data); -#else - XdgMenu mXdgMenu; -#endif - - QTimer mDelayedPopup; - QTimer mHideTimer; - QString mMenuFile; - -protected slots: - - virtual void settingsChanged(); - void buildMenu(); - -private slots: - void showMenu(); - void showHideMenu(); - void searchTextChanged(QString const & text); - void setSearchFocus(QAction *action); -}; - -class LXQtMainMenuPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - // Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const { return new LXQtMainMenu(startupInfo);} -}; - -#endif diff --git a/plugin-mainmenu/lxqtmainmenuconfiguration.cpp b/plugin-mainmenu/lxqtmainmenuconfiguration.cpp deleted file mode 100644 index b5c5f00..0000000 --- a/plugin-mainmenu/lxqtmainmenuconfiguration.cpp +++ /dev/null @@ -1,214 +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: - * Maciej Płaza - * - * 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 "lxqtmainmenuconfiguration.h" -#include "ui_lxqtmainmenuconfiguration.h" -#include -#include -#include -#include - -#include - -LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(PluginSettings *settings, GlobalKeyShortcut::Action * shortcut, const QString &defaultShortcut, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtMainMenuConfiguration), - mDefaultShortcut(defaultShortcut), - mShortcut(shortcut) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("MainMenuConfigurationWindow"); - ui->setupUi(this); - - QIcon folder{XdgIcon::fromTheme("folder")}; - ui->chooseMenuFilePB->setIcon(folder); - ui->iconPB->setIcon(folder); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); - - loadSettings(); - - connect(ui->showTextCB, SIGNAL(toggled(bool)), this, SLOT(showTextChanged(bool))); - connect(ui->textLE, SIGNAL(textEdited(QString)), this, SLOT(textButtonChanged(QString))); - connect(ui->chooseMenuFilePB, SIGNAL(clicked()), this, SLOT(chooseMenuFile())); - connect(ui->menuFilePathLE, &QLineEdit::textChanged, [&] (QString const & file) - { - this->settings().setValue(QLatin1String("menu_file"), file); - }); - connect(ui->iconCB, &QCheckBox::toggled, [this] (bool value) { this->settings().setValue("ownIcon", value); }); - connect(ui->iconPB, &QAbstractButton::clicked, this, &LXQtMainMenuConfiguration::chooseIcon); - connect(ui->iconLE, &QLineEdit::textChanged, [&] (QString const & path) - { - this->settings().setValue(QLatin1String("icon"), path); - }); - - connect(ui->shortcutEd, SIGNAL(shortcutGrabbed(QString)), this, SLOT(shortcutChanged(QString))); - connect(ui->shortcutEd->addMenuAction(tr("Reset")), SIGNAL(triggered()), this, SLOT(shortcutReset())); - - connect(ui->customFontCB, SIGNAL(toggled(bool)), this, SLOT(customFontChanged(bool))); - connect(ui->customFontSizeSB, SIGNAL(valueChanged(int)), this, SLOT(customFontSizeChanged(int))); - - connect(mShortcut, &GlobalKeyShortcut::Action::shortcutChanged, this, &LXQtMainMenuConfiguration::globalShortcutChanged); - - connect(ui->filterMenuCB, &QCheckBox::toggled, [this] (bool enabled) - { - ui->filterClearCB->setEnabled(enabled || ui->filterShowCB->isChecked()); - this->settings().setValue("filterMenu", enabled); - }); - connect(ui->filterShowCB, &QCheckBox::toggled, [this] (bool enabled) - { - ui->filterClearCB->setEnabled(enabled || ui->filterMenuCB->isChecked()); - this->settings().setValue("filterShow", enabled); - }); - connect(ui->filterShowMaxItemsSB, static_cast(&QSpinBox::valueChanged), [this] (int value) - { - this->settings().setValue("filterShowMaxItems", value); - }); - connect(ui->filterShowMaxWidthSB, static_cast(&QSpinBox::valueChanged), [this] (int value) - { - this->settings().setValue("filterShowMaxWidth", value); - }); - connect(ui->filterShowHideMenuCB, &QCheckBox::toggled, [this] (bool enabled) - { - this->settings().setValue("filterShowHideMenu", enabled); - }); - connect(ui->filterClearCB, &QCheckBox::toggled, [this] (bool enabled) - { - this->settings().setValue("filterClear", enabled); - }); -} - -LXQtMainMenuConfiguration::~LXQtMainMenuConfiguration() -{ - delete ui; -} - -void LXQtMainMenuConfiguration::loadSettings() -{ - ui->iconCB->setChecked(settings().value("ownIcon", false).toBool()); - ui->iconLE->setText(settings().value("icon", QLatin1String(LXQT_GRAPHICS_DIR"/helix.svg")).toString()); - ui->showTextCB->setChecked(settings().value("showText", false).toBool()); - ui->textLE->setText(settings().value("text", "").toString()); - - QString menuFile = settings().value("menu_file", "").toString(); - if (menuFile.isEmpty()) - { - menuFile = XdgMenu::getMenuFileName(); - } - ui->menuFilePathLE->setText(menuFile); - ui->shortcutEd->setText(nullptr != mShortcut ? mShortcut->shortcut() : mDefaultShortcut); - - ui->customFontCB->setChecked(settings().value("customFont", false).toBool()); - LXQt::Settings lxqtSettings("lxqt"); //load system font size as init value - QFont systemFont; - lxqtSettings.beginGroup(QLatin1String("Qt")); - systemFont.fromString(lxqtSettings.value("font", this->font()).toString()); - lxqtSettings.endGroup(); - ui->customFontSizeSB->setValue(settings().value("customFontSize", systemFont.pointSize()).toInt()); - const bool filter_menu = settings().value("filterMenu", true).toBool(); - ui->filterMenuCB->setChecked(filter_menu); - const bool filter_show = settings().value("filterShow", true).toBool(); - ui->filterShowCB->setChecked(filter_show); - ui->filterShowMaxItemsL->setEnabled(filter_show); - ui->filterShowMaxItemsSB->setEnabled(filter_show); - ui->filterShowMaxItemsSB->setValue(settings().value("filterShowMaxItems", 10).toInt()); - ui->filterShowMaxWidthL->setEnabled(filter_show); - ui->filterShowMaxWidthSB->setEnabled(filter_show); - ui->filterShowMaxWidthSB->setValue(settings().value("filterShowMaxWidth", 300).toInt()); - ui->filterShowHideMenuCB->setEnabled(filter_show); - ui->filterShowHideMenuCB->setChecked(settings().value("filterShowHideMenu", true).toBool()); - ui->filterClearCB->setChecked(settings().value("filterClear", false).toBool()); - ui->filterClearCB->setEnabled(filter_menu || filter_show); -} - - -void LXQtMainMenuConfiguration::textButtonChanged(const QString &value) -{ - settings().setValue("text", value); -} - -void LXQtMainMenuConfiguration::showTextChanged(bool value) -{ - settings().setValue("showText", value); -} - -void LXQtMainMenuConfiguration::chooseIcon() -{ - QFileInfo f{ui->iconLE->text()}; - QDir dir = f.dir(); - QFileDialog *d = new QFileDialog(this, - tr("Choose icon file"), - !f.filePath().isEmpty() && dir.exists() ? dir.path() : QLatin1String(LXQT_GRAPHICS_DIR), - tr("Images (*.svg *.png)")); - d->setWindowModality(Qt::WindowModal); - d->setAttribute(Qt::WA_DeleteOnClose); - connect(d, &QFileDialog::fileSelected, [&] (const QString &icon) { - ui->iconLE->setText(icon); - }); - d->show(); -} - -void LXQtMainMenuConfiguration::chooseMenuFile() -{ - QFileDialog *d = new QFileDialog(this, - tr("Choose menu file"), - QLatin1String("/etc/xdg/menus"), - tr("Menu files (*.menu)")); - d->setWindowModality(Qt::WindowModal); - d->setAttribute(Qt::WA_DeleteOnClose); - connect(d, &QFileDialog::fileSelected, [&] (const QString &file) { - ui->menuFilePathLE->setText(file); - }); - d->show(); -} - -void LXQtMainMenuConfiguration::globalShortcutChanged(const QString &/*oldShortcut*/, const QString &newShortcut) -{ - ui->shortcutEd->setText(newShortcut); -} - -void LXQtMainMenuConfiguration::shortcutChanged(const QString &value) -{ - if (mShortcut) - mShortcut->changeShortcut(value); -} - -void LXQtMainMenuConfiguration::shortcutReset() -{ - shortcutChanged(mDefaultShortcut); -} - -void LXQtMainMenuConfiguration::customFontChanged(bool value) -{ - settings().setValue("customFont", value); -} - -void LXQtMainMenuConfiguration::customFontSizeChanged(int value) -{ - settings().setValue("customFontSize", value); -} diff --git a/plugin-mainmenu/lxqtmainmenuconfiguration.h b/plugin-mainmenu/lxqtmainmenuconfiguration.h deleted file mode 100644 index 550c1a3..0000000 --- a/plugin-mainmenu/lxqtmainmenuconfiguration.h +++ /dev/null @@ -1,77 +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: - * Maciej Płaza - * - * 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 LXQTMAINMENUCONFIGURATION_H -#define LXQTMAINMENUCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" - -class QAbstractButton; - -namespace Ui { - class LXQtMainMenuConfiguration; -} - -namespace GlobalKeyShortcut { - class Action; -} - -class LXQtMainMenuConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtMainMenuConfiguration(PluginSettings *settings, - GlobalKeyShortcut::Action *shortcut, - const QString &defaultShortcut, - QWidget *parent = nullptr); - ~LXQtMainMenuConfiguration(); - -private: - Ui::LXQtMainMenuConfiguration *ui; - QString mDefaultShortcut; - GlobalKeyShortcut::Action * mShortcut; - -private slots: - void globalShortcutChanged(const QString &oldShortcut, const QString &newShortcut); - void shortcutChanged(const QString &value); - /* - Saves settings in conf file. - */ - void loadSettings(); - void textButtonChanged(const QString &value); - void showTextChanged(bool value); - void chooseIcon(); - void chooseMenuFile(); - void shortcutReset(); - void customFontChanged(bool value); - void customFontSizeChanged(int value); -}; - -#endif // LXQTMAINMENUCONFIGURATION_H diff --git a/plugin-mainmenu/lxqtmainmenuconfiguration.ui b/plugin-mainmenu/lxqtmainmenuconfiguration.ui deleted file mode 100644 index 3ab261f..0000000 --- a/plugin-mainmenu/lxqtmainmenuconfiguration.ui +++ /dev/null @@ -1,403 +0,0 @@ - - - LXQtMainMenuConfiguration - - - - 0 - 0 - 481 - 501 - - - - Main Menu settings - - - - - - General - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - false - - - - - - Icon: - - - - - - - false - - - - - - - false - - - - - - - - - - Button text: - - - - - - - false - - - - - - - true - - - Custom font size: - - - - - - - false - - - pt - - - 1 - - - 11 - - - - - - - - - - true - - - Menu file - - - - - - Menu file: - - - - - - - - - - - - - - - - Keyboard Shortcut - - - - - - - 200 - 0 - - - - - - - - - - - Click the button to record shortcut: - - - - - - - - - - Search - - - - - - max. item width: - - - - - - - Show matching entries: - - - - - - - 20 - - - - - - - Maximum visible items: - - - - - - - Filter menu entries - - - - - - - px - - - 40 - - - 1000 - - - - - - - Hide menu entries while searching - - - - - - - Clear search upon showing menu - - - - - - - - - - Qt::Vertical - - - - 20 - 41 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - ShortcutSelector - QToolButton -
LXQtGlobalKeysUi/ShortcutSelector
-
-
- - - - customFontCB - toggled(bool) - customFontSizeSB - setEnabled(bool) - - - 60 - 249 - - - 280 - 277 - - - - - showTextCB - toggled(bool) - textLE - setEnabled(bool) - - - 239 - 39 - - - 313 - 68 - - - - - iconCB - toggled(bool) - iconLE - setEnabled(bool) - - - 91 - 53 - - - 284 - 53 - - - - - iconCB - toggled(bool) - iconPB - setEnabled(bool) - - - 91 - 53 - - - 431 - 53 - - - - - filterShowCB - toggled(bool) - filterShowMaxItemsSB - setEnabled(bool) - - - 172 - 374 - - - 393 - 374 - - - - - filterShowCB - toggled(bool) - filterShowMaxItemsL - setEnabled(bool) - - - 111 - 374 - - - 269 - 374 - - - - - filterShowCB - toggled(bool) - filterShowMaxWidthSB - setEnabled(bool) - - - 111 - 352 - - - 396 - 378 - - - - - filterShowCB - toggled(bool) - filterShowMaxWidthL - setEnabled(bool) - - - 111 - 352 - - - 269 - 378 - - - - - filterShowCB - toggled(bool) - filterShowHideMenuCB - setEnabled(bool) - - - 110 - 374 - - - 332 - 437 - - - - -
diff --git a/plugin-mainmenu/menustyle.cpp b/plugin-mainmenu/menustyle.cpp deleted file mode 100644 index 6c660f5..0000000 --- a/plugin-mainmenu/menustyle.cpp +++ /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: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "menustyle.h" -#include - - -/************************************************ - - ************************************************/ -MenuStyle::MenuStyle(): - QProxyStyle() -{ - mIconSize = 16; -} - - -/************************************************ - - ************************************************/ -int MenuStyle::pixelMetric(PixelMetric metric, const QStyleOption * option, const QWidget * widget) const -{ - if (metric == QProxyStyle::PM_SmallIconSize) - return mIconSize; - - return QProxyStyle::pixelMetric(metric, option, widget); -} - -/************************************************ - - ************************************************/ -int MenuStyle::styleHint(StyleHint hint, const QStyleOption * option, const QWidget* widget, QStyleHintReturn* returnData) const -{ - // By default, the popup menu will be closed when Alt key - // is pressed. If SH_MenuBar_AltKeyNavigation style hint returns - // false, this behavior can be supressed so let's do it. - if(hint == QStyle::SH_MenuBar_AltKeyNavigation) - return 0; - return QProxyStyle::styleHint(hint, option, widget, returnData); -} - diff --git a/plugin-mainmenu/menustyle.h b/plugin-mainmenu/menustyle.h deleted file mode 100644 index 116dd20..0000000 --- a/plugin-mainmenu/menustyle.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: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 MENUSTYLE_H -#define MENUSTYLE_H - -#include - -class MenuStyle : public QProxyStyle -{ - Q_OBJECT -public: - explicit MenuStyle(); - int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const; - int styleHint(StyleHint hint, const QStyleOption* option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData = 0) const; - int iconSize() const { return mIconSize; } - void setIconSize(int value) { mIconSize = value; } - -private: - int mIconSize; -}; - -#endif // MENUSTYLE_H diff --git a/plugin-mainmenu/resources/mainmenu.desktop.in b/plugin-mainmenu/resources/mainmenu.desktop.in deleted file mode 100644 index 4b92573..0000000 --- a/plugin-mainmenu/resources/mainmenu.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. -Icon=start-here-lxqt - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-mainmenu/translations/mainmenu_ar.desktop b/plugin-mainmenu/translations/mainmenu_ar.desktop deleted file mode 100644 index 51de7fa..0000000 --- a/plugin-mainmenu/translations/mainmenu_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[ar]=قائمة لكلّ تطبيقاتك -Name[ar]=قائمة التّطبيقات diff --git a/plugin-mainmenu/translations/mainmenu_cs.desktop b/plugin-mainmenu/translations/mainmenu_cs.desktop deleted file mode 100644 index e43bdbf..0000000 --- a/plugin-mainmenu/translations/mainmenu_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Hlavní nabídka -Name[cs]=Nabídka diff --git a/plugin-mainmenu/translations/mainmenu_cs_CZ.desktop b/plugin-mainmenu/translations/mainmenu_cs_CZ.desktop deleted file mode 100644 index ece8099..0000000 --- a/plugin-mainmenu/translations/mainmenu_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Spouštěč programů založený na nabídce -Name[cs_CZ]=Nabídka programů diff --git a/plugin-mainmenu/translations/mainmenu_da.desktop b/plugin-mainmenu/translations/mainmenu_da.desktop deleted file mode 100644 index cc265a5..0000000 --- a/plugin-mainmenu/translations/mainmenu_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. -Icon=start-here-lxqt - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Programmenu -Comment[da]=En menu med alle dine programmer. diff --git a/plugin-mainmenu/translations/mainmenu_de.desktop b/plugin-mainmenu/translations/mainmenu_de.desktop deleted file mode 100644 index eaf499e..0000000 --- a/plugin-mainmenu/translations/mainmenu_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Anwendungsmenü -Comment[de]=Menübasierter Anwendungsstarter diff --git a/plugin-mainmenu/translations/mainmenu_el.desktop b/plugin-mainmenu/translations/mainmenu_el.desktop deleted file mode 100644 index 0bce6e8..0000000 --- a/plugin-mainmenu/translations/mainmenu_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Μενού εφαρμογών -Comment[el]=Ένα μενού για όλες σας τις εφαρμογές. diff --git a/plugin-mainmenu/translations/mainmenu_eo.desktop b/plugin-mainmenu/translations/mainmenu_eo.desktop deleted file mode 100644 index 5fbf826..0000000 --- a/plugin-mainmenu/translations/mainmenu_eo.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eo]=Lanĉilo de aplikaĵoj baziĝita sur menuo -Name[eo]=Menuo de aplikaĵoj diff --git a/plugin-mainmenu/translations/mainmenu_es.desktop b/plugin-mainmenu/translations/mainmenu_es.desktop deleted file mode 100644 index bc143cd..0000000 --- a/plugin-mainmenu/translations/mainmenu_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Lanzador de aplicaciones con menú -Name[es]=Menu de Aplicaciones diff --git a/plugin-mainmenu/translations/mainmenu_es_VE.desktop b/plugin-mainmenu/translations/mainmenu_es_VE.desktop deleted file mode 100644 index 12fe635..0000000 --- a/plugin-mainmenu/translations/mainmenu_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Menu para lanzar las aplicaciones instaladas graficas -Name[es_VE]=Menu de aplicaciones diff --git a/plugin-mainmenu/translations/mainmenu_eu.desktop b/plugin-mainmenu/translations/mainmenu_eu.desktop deleted file mode 100644 index 8baa72e..0000000 --- a/plugin-mainmenu/translations/mainmenu_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Menu bidezko aplikazio-abiarazlea -Name[eu]=Aplikazio menua diff --git a/plugin-mainmenu/translations/mainmenu_fi.desktop b/plugin-mainmenu/translations/mainmenu_fi.desktop deleted file mode 100644 index 1bf40d5..0000000 --- a/plugin-mainmenu/translations/mainmenu_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Valikkopohjainen sovelluskäynnistin -Name[fi]=Sovellusvalikko diff --git a/plugin-mainmenu/translations/mainmenu_fr.desktop b/plugin-mainmenu/translations/mainmenu_fr.desktop deleted file mode 100644 index a85376e..0000000 --- a/plugin-mainmenu/translations/mainmenu_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Comment[fr]=Lanceur d'application sous forme de menu -Name[fr]=Menu d'application diff --git a/plugin-mainmenu/translations/mainmenu_hu.desktop b/plugin-mainmenu/translations/mainmenu_hu.desktop deleted file mode 100644 index fe0daea..0000000 --- a/plugin-mainmenu/translations/mainmenu_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=Alkalmazásindító alapú menü -Name[hu]=Alkalmazásmenü diff --git a/plugin-mainmenu/translations/mainmenu_ia.desktop b/plugin-mainmenu/translations/mainmenu_ia.desktop deleted file mode 100644 index 5421ebe..0000000 --- a/plugin-mainmenu/translations/mainmenu_ia.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=Menu based application launcher - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-mainmenu/translations/mainmenu_id_ID.desktop b/plugin-mainmenu/translations/mainmenu_id_ID.desktop deleted file mode 100644 index 758bb75..0000000 --- a/plugin-mainmenu/translations/mainmenu_id_ID.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[id_ID]=Peluncur aplikasi berbasis menu -Name[id_ID]=Menu aplikasi diff --git a/plugin-mainmenu/translations/mainmenu_it.desktop b/plugin-mainmenu/translations/mainmenu_it.desktop deleted file mode 100644 index b267d06..0000000 --- a/plugin-mainmenu/translations/mainmenu_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[it]=Avviatore delle applicazioni basato su menù -Name[it]=Menu delle applicazioni diff --git a/plugin-mainmenu/translations/mainmenu_ja.desktop b/plugin-mainmenu/translations/mainmenu_ja.desktop deleted file mode 100644 index 4fe7bfc..0000000 --- a/plugin-mainmenu/translations/mainmenu_ja.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ja]=アプリケーションランチャーを元にしたメニューです -Name[ja]=アプリケーションメニュー diff --git a/plugin-mainmenu/translations/mainmenu_ko.desktop b/plugin-mainmenu/translations/mainmenu_ko.desktop deleted file mode 100644 index 5421ebe..0000000 --- a/plugin-mainmenu/translations/mainmenu_ko.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=Menu based application launcher - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-mainmenu/translations/mainmenu_lt.desktop b/plugin-mainmenu/translations/mainmenu_lt.desktop deleted file mode 100644 index e670d7d..0000000 --- a/plugin-mainmenu/translations/mainmenu_lt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[lt]=Programų paleidimo meniu -Name[lt]=Programų meniu diff --git a/plugin-mainmenu/translations/mainmenu_nl.desktop b/plugin-mainmenu/translations/mainmenu_nl.desktop deleted file mode 100644 index 8cddce9..0000000 --- a/plugin-mainmenu/translations/mainmenu_nl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[nl]=Menu-gebasseerde applicatie starter -Name[nl]=Applicatie menu diff --git a/plugin-mainmenu/translations/mainmenu_pl.desktop b/plugin-mainmenu/translations/mainmenu_pl.desktop deleted file mode 100644 index 1cc748b..0000000 --- a/plugin-mainmenu/translations/mainmenu_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Menu pozwalające na uruchomienie i wyszukiwanie wszystkich aplikacji. -Name[pl]=Menu diff --git a/plugin-mainmenu/translations/mainmenu_pt.desktop b/plugin-mainmenu/translations/mainmenu_pt.desktop deleted file mode 100644 index 12b1fd7..0000000 --- a/plugin-mainmenu/translations/mainmenu_pt.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[pt]=Menu de aplicações -Comment[pt]=Lançador de aplicações baseado no menu diff --git a/plugin-mainmenu/translations/mainmenu_pt_BR.desktop b/plugin-mainmenu/translations/mainmenu_pt_BR.desktop deleted file mode 100644 index e24fa9e..0000000 --- a/plugin-mainmenu/translations/mainmenu_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Lançador de aplicativos baseado em menu -Name[pt_BR]=Menu de aplicativos diff --git a/plugin-mainmenu/translations/mainmenu_ro_RO.desktop b/plugin-mainmenu/translations/mainmenu_ro_RO.desktop deleted file mode 100644 index 6a118ad..0000000 --- a/plugin-mainmenu/translations/mainmenu_ro_RO.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Lansator de aplicații bazat pe meniuri -Name[ro_RO]=Meniu aplicații diff --git a/plugin-mainmenu/translations/mainmenu_ru.desktop b/plugin-mainmenu/translations/mainmenu_ru.desktop deleted file mode 100644 index c37e322..0000000 --- a/plugin-mainmenu/translations/mainmenu_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru]=Меню всех ваших программ. -Name[ru]=Меню приложений diff --git a/plugin-mainmenu/translations/mainmenu_sk.desktop b/plugin-mainmenu/translations/mainmenu_sk.desktop deleted file mode 100644 index 2d87f61..0000000 --- a/plugin-mainmenu/translations/mainmenu_sk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sk]=Spúšťanie aplikácií z menu -Name[sk]=Menu aplikácií diff --git a/plugin-mainmenu/translations/mainmenu_sl.desktop b/plugin-mainmenu/translations/mainmenu_sl.desktop deleted file mode 100644 index ef5229f..0000000 --- a/plugin-mainmenu/translations/mainmenu_sl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sl]=Zaganjalnik programov, temelječ na meniju -Name[sl]=Programski meni diff --git a/plugin-mainmenu/translations/mainmenu_sr.desktop b/plugin-mainmenu/translations/mainmenu_sr.desktop deleted file mode 100644 index 175a234..0000000 --- a/plugin-mainmenu/translations/mainmenu_sr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr]=Мени покретача програма -Name[sr]=Мени програма diff --git a/plugin-mainmenu/translations/mainmenu_sr@ijekavian.desktop b/plugin-mainmenu/translations/mainmenu_sr@ijekavian.desktop deleted file mode 100644 index b90d1f6..0000000 --- a/plugin-mainmenu/translations/mainmenu_sr@ijekavian.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavian]=Мени програма -Comment[sr@ijekavian]=Мени покретача програма diff --git a/plugin-mainmenu/translations/mainmenu_sr@ijekavianlatin.desktop b/plugin-mainmenu/translations/mainmenu_sr@ijekavianlatin.desktop deleted file mode 100644 index 72d4aff..0000000 --- a/plugin-mainmenu/translations/mainmenu_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavianlatin]=Meni programa -Comment[sr@ijekavianlatin]=Meni pokretača programa diff --git a/plugin-mainmenu/translations/mainmenu_sr@latin.desktop b/plugin-mainmenu/translations/mainmenu_sr@latin.desktop deleted file mode 100644 index 78d7553..0000000 --- a/plugin-mainmenu/translations/mainmenu_sr@latin.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr@latin]=Meni pokretača programa -Name[sr@latin]=Meni programa diff --git a/plugin-mainmenu/translations/mainmenu_th_TH.desktop b/plugin-mainmenu/translations/mainmenu_th_TH.desktop deleted file mode 100644 index 3a8876c..0000000 --- a/plugin-mainmenu/translations/mainmenu_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=ปุ่มเรียกโปรแกรมพื้นฐานทางเมนู -Name[th_TH]=เมนูโปรแกรม diff --git a/plugin-mainmenu/translations/mainmenu_tr.desktop b/plugin-mainmenu/translations/mainmenu_tr.desktop deleted file mode 100644 index 7ec5611..0000000 --- a/plugin-mainmenu/translations/mainmenu_tr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[tr]=Menü temelli uygulama çalıştırıcı -Name[tr]=Uygulama menüsü diff --git a/plugin-mainmenu/translations/mainmenu_uk.desktop b/plugin-mainmenu/translations/mainmenu_uk.desktop deleted file mode 100644 index 06d54ab..0000000 --- a/plugin-mainmenu/translations/mainmenu_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Меню з усіма програмами. -Name[uk]=Меню програм diff --git a/plugin-mainmenu/translations/mainmenu_zh_CN.GB2312.desktop b/plugin-mainmenu/translations/mainmenu_zh_CN.GB2312.desktop deleted file mode 100644 index 5421ebe..0000000 --- a/plugin-mainmenu/translations/mainmenu_zh_CN.GB2312.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=Menu based application launcher - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-mainmenu/translations/mainmenu_zh_CN.desktop b/plugin-mainmenu/translations/mainmenu_zh_CN.desktop deleted file mode 100644 index 16fba31..0000000 --- a/plugin-mainmenu/translations/mainmenu_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=基于菜单的程序启动器 -Name[zh_CN]=程序菜单 diff --git a/plugin-mainmenu/translations/mainmenu_zh_TW.desktop b/plugin-mainmenu/translations/mainmenu_zh_TW.desktop deleted file mode 100644 index f654597..0000000 --- a/plugin-mainmenu/translations/mainmenu_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Application menu -Comment=A menu of all your applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=以選單方式呈現的應用程式啟動器 -Name[zh_TW]=應用程式選單 diff --git a/plugin-mainmenu/xdgcachedmenu.cpp b/plugin-mainmenu/xdgcachedmenu.cpp deleted file mode 100644 index 864c63d..0000000 --- a/plugin-mainmenu/xdgcachedmenu.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - * - * Copyright (C) 2013 - * - * 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 - * - */ - -#include "xdgcachedmenu.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -XdgCachedMenuAction::XdgCachedMenuAction(MenuCacheItem* item, QObject* parent): - QAction{parent} - , iconName_{QString::fromUtf8(menu_cache_item_get_icon(item))} -{ - QString title = QString::fromUtf8(menu_cache_item_get_name(item)); - title = title.replace('&', QLatin1String("&&")); // & is reserved for mnemonics - setText(title); - // Only set tooltips for app items - if(menu_cache_item_get_type(item) == MENU_CACHE_TYPE_APP) - { - QString comment = QString::fromUtf8(menu_cache_item_get_comment(item)); - setToolTip(comment); - } - if (char * file_path = menu_cache_item_get_file_path(item)) - { - filePath_ = QString::fromUtf8(file_path); - g_free(file_path); - } -} - -void XdgCachedMenuAction::updateIcon() -{ - if(icon().isNull()) - { - QIcon icon = XdgIcon::fromTheme(iconName_, QIcon::fromTheme("unknown")); - setIcon(icon); - } -} - -XdgCachedMenu::XdgCachedMenu(QWidget* parent): QMenu(parent) -{ - connect(this, SIGNAL(aboutToShow()), SLOT(onAboutToShow())); -} - -XdgCachedMenu::XdgCachedMenu(MenuCache* menuCache, QWidget* parent): QMenu(parent) -{ - // qDebug() << "CREATE MENU FROM CACHE" << menuCache; - MenuCacheDir* dir = menu_cache_dup_root_dir(menuCache); - - // get current desktop name or fallback to LXQt - const QByteArray xdgDesktop = qgetenv("XDG_CURRENT_DESKTOP"); - const QByteArray desktop = xdgDesktop.isEmpty() ? "LXQt:X-LXQt" : xdgDesktop; - menu_cache_desktop_ = menu_cache_get_desktop_env_flag(menuCache, desktop.constData()); - - addMenuItems(this, dir); - menu_cache_item_unref(MENU_CACHE_ITEM(dir)); - connect(this, SIGNAL(aboutToShow()), SLOT(onAboutToShow())); -} - -XdgCachedMenu::~XdgCachedMenu() -{ -} - -void XdgCachedMenu::addMenuItems(QMenu* menu, MenuCacheDir* dir) -{ - GSList* list = menu_cache_dir_list_children(dir); - for(GSList * l = list; l; l = l->next) - { - MenuCacheItem* item = (MenuCacheItem*)l->data; - MenuCacheType type = menu_cache_item_get_type(item); - - if(type == MENU_CACHE_TYPE_SEP) - { - menu->addSeparator(); - continue; - } - else - { - bool appVisible = type == MENU_CACHE_TYPE_APP - && menu_cache_app_get_is_visible(MENU_CACHE_APP(item), - menu_cache_desktop_); - bool dirVisible = type == MENU_CACHE_TYPE_DIR - && menu_cache_dir_is_visible(MENU_CACHE_DIR(item)); - - if(!appVisible && !dirVisible) - continue; - - XdgCachedMenuAction* action = new XdgCachedMenuAction(item, menu); - menu->addAction(action); - - if(type == MENU_CACHE_TYPE_APP) - connect(action, SIGNAL(triggered(bool)), SLOT(onItemTrigerred())); - else if(type == MENU_CACHE_TYPE_DIR) - { - XdgCachedMenu* submenu = new XdgCachedMenu(menu); - action->setMenu(submenu); - addMenuItems(submenu, MENU_CACHE_DIR(item)); - } - } - menu_cache_item_unref(item); - } - if (list) - g_slist_free(list); -} - -void XdgCachedMenu::onItemTrigerred() -{ - XdgCachedMenuAction* action = static_cast(sender()); - XdgDesktopFile df; - df.load(action->filePath()); - df.startDetached(); -} - -// taken from libqtxdg: XdgMenuWidget -bool XdgCachedMenu::event(QEvent* event) -{ - if (event->type() == QEvent::MouseButtonPress) - { - QMouseEvent *e = static_cast(event); - if (e->button() == Qt::LeftButton) - mDragStartPosition = e->pos(); - } - - else if (event->type() == QEvent::MouseMove) - { - QMouseEvent *e = static_cast(event); - handleMouseMoveEvent(e); - } - - else if(event->type() == QEvent::ToolTip) - { - QHelpEvent* helpEvent = static_cast(event); - QAction* action = actionAt(helpEvent->pos()); - if(action && action->menu() == NULL) - QToolTip::showText(helpEvent->globalPos(), action->toolTip(), this); - } - - return QMenu::event(event); -} - -// taken from libqtxdg: XdgMenuWidget -void XdgCachedMenu::handleMouseMoveEvent(QMouseEvent *event) -{ - if (!(event->buttons() & Qt::LeftButton)) - return; - - if ((event->pos() - mDragStartPosition).manhattanLength() < QApplication::startDragDistance()) - return; - - XdgCachedMenuAction *a = qobject_cast(actionAt(mDragStartPosition)); - if (!a) - return; - - QList urls; - urls << QUrl(QString("file://%1").arg(a->filePath())); - - QMimeData *mimeData = new QMimeData(); - mimeData->setUrls(urls); - - QDrag *drag = new QDrag(this); - drag->setMimeData(mimeData); - drag->exec(Qt::CopyAction | Qt::LinkAction); -} - -void XdgCachedMenu::onAboutToShow() -{ - Q_FOREACH(QAction* action, actions()) - { - if(action->inherits("XdgCachedMenuAction")) - { - static_cast(action)->updateIcon(); - - // this seems to cause some incorrect menu behaviour. - // qApp->processEvents(); - } - } -} diff --git a/plugin-mainmenu/xdgcachedmenu.h b/plugin-mainmenu/xdgcachedmenu.h deleted file mode 100644 index b9f953d..0000000 --- a/plugin-mainmenu/xdgcachedmenu.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * - * Copyright (C) 2013 - * - * 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 - * - */ - -#ifndef XDGCACHEDMENU_H -#define XDGCACHEDMENU_H - -#include -#include - -class QEvent; -class QMouseEvent; - -class XdgCachedMenu : public QMenu -{ - Q_OBJECT -public: - XdgCachedMenu(QWidget* parent = NULL); - XdgCachedMenu(MenuCache* menuCache, QWidget* parent); - virtual ~XdgCachedMenu(); - -protected: - bool event(QEvent* event); - -private: - void addMenuItems(QMenu* menu, MenuCacheDir* dir); - void handleMouseMoveEvent(QMouseEvent *event); - -private Q_SLOTS: - void onItemTrigerred(); - void onAboutToShow(); - -private: - QPoint mDragStartPosition; - guint32 menu_cache_desktop_; -}; - -class XdgCachedMenuAction: public QAction -{ - Q_OBJECT -public: - explicit XdgCachedMenuAction(MenuCacheItem* item, QObject* parent = 0); - inline const QString & filePath() const { return filePath_; } - - void updateIcon(); - -private: - QString iconName_; - QString filePath_; -}; - - -#endif // XDGCACHEDMENU_H diff --git a/plugin-mount/CMakeLists.txt b/plugin-mount/CMakeLists.txt deleted file mode 100644 index e9e2211..0000000 --- a/plugin-mount/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -set(PLUGIN "mount") - -set(HEADERS - lxqtmountplugin.h - configuration.h - button.h - menudiskitem.h - popup.h - actions/deviceaction.h - actions/deviceaction_info.h - actions/deviceaction_menu.h - actions/deviceaction_nothing.h -) - -set(SOURCES - lxqtmountplugin.cpp - configuration.cpp - button.cpp - menudiskitem.cpp - popup.cpp - actions/deviceaction.cpp - actions/deviceaction_info.cpp - actions/deviceaction_menu.cpp - actions/deviceaction_nothing.cpp -) - -set(UIS - configuration.ui -) - -find_package(KF5Solid REQUIRED) -set(LIBRARIES Qt5Xdg KF5::Solid) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-mount/actions/deviceaction.cpp b/plugin-mount/actions/deviceaction.cpp deleted file mode 100644 index 2efc780..0000000 --- a/plugin-mount/actions/deviceaction.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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "deviceaction.h" -#include "deviceaction_info.h" -#include "deviceaction_menu.h" -#include "deviceaction_nothing.h" -#include "../menudiskitem.h" -#include "../lxqtmountplugin.h" - -#include - -#define ACT_NOTHING "nothing" -#define ACT_INFO "showInfo" -#define ACT_MENU "showMenu" - -#define ACT_NOTHING_UPPER QString(ACT_NOTHING).toUpper() -#define ACT_INFO_UPPER QString(ACT_INFO).toUpper() -#define ACT_MENU_UPPER QString(ACT_MENU).toUpper() - -DeviceAction::DeviceAction(LXQtMountPlugin *plugin, QObject *parent): - mPlugin(plugin) -{ -} - -DeviceAction::~DeviceAction() -{ -} - -DeviceAction *DeviceAction::create(ActionId id, LXQtMountPlugin *plugin, QObject *parent) -{ - switch (id) - { - case ActionNothing: - return new DeviceActionNothing(plugin, parent); - - case ActionInfo: - return new DeviceActionInfo(plugin, parent); - - case ActionMenu: - return new DeviceActionMenu(plugin, parent); - } - - return 0; -} - -QString DeviceAction::actionIdToString(DeviceAction::ActionId id) -{ - switch (id) - { - case ActionNothing: return ACT_NOTHING; - case ActionInfo: return ACT_INFO; - case ActionMenu: return ACT_MENU; - } - - return ACT_INFO; -} - -void DeviceAction::onDeviceAdded(Solid::Device device) -{ - doDeviceAdded(device); -} - -void DeviceAction::onDeviceRemoved(Solid::Device device) -{ - doDeviceRemoved(device); -} - -DeviceAction::ActionId DeviceAction::stringToActionId(const QString &string, ActionId defaultValue) -{ - QString s = string.toUpper(); - if (s == ACT_NOTHING_UPPER) return ActionNothing; - if (s == ACT_INFO_UPPER) return ActionInfo; - if (s == ACT_MENU_UPPER) return ActionMenu; - - return defaultValue; -} diff --git a/plugin-mount/actions/deviceaction.h b/plugin-mount/actions/deviceaction.h deleted file mode 100644 index 8d414e3..0000000 --- a/plugin-mount/actions/deviceaction.h +++ /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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQT_PLUGIN_MOUNT_DEVICEACTION_H -#define LXQT_PLUGIN_MOUNT_DEVICEACTION_H - -#include -#include -#include - -class LXQtMountPlugin; - -class DeviceAction: public QObject -{ - Q_OBJECT - -public: - enum ActionId - { - ActionNothing, - ActionInfo, - ActionMenu - }; - - virtual ~DeviceAction(); - virtual ActionId Type() const throw () = 0; - - static DeviceAction *create(ActionId id, LXQtMountPlugin *plugin, QObject *parent = 0); - static ActionId stringToActionId(const QString &string, ActionId defaultValue); - static QString actionIdToString(ActionId id); - -public slots: - void onDeviceAdded(Solid::Device device); - void onDeviceRemoved(Solid::Device device); - -protected: - explicit DeviceAction(LXQtMountPlugin *plugin, QObject *parent = 0); - virtual void doDeviceAdded(Solid::Device device) = 0; - virtual void doDeviceRemoved(Solid::Device device) = 0; - - LXQtMountPlugin *mPlugin; -}; - -#endif // DEVICEACTION_H diff --git a/plugin-mount/actions/deviceaction_info.cpp b/plugin-mount/actions/deviceaction_info.cpp deleted file mode 100644 index d8040dd..0000000 --- a/plugin-mount/actions/deviceaction_info.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "../lxqtmountplugin.h" -#include "deviceaction_info.h" - -#include - -DeviceActionInfo::DeviceActionInfo(LXQtMountPlugin *plugin, QObject *parent): - DeviceAction(plugin, parent) -{ -} - -void DeviceActionInfo::doDeviceAdded(Solid::Device device) -{ - showMessage(tr("The device \"%1\" is connected.").arg(device.description())); -} - -void DeviceActionInfo::doDeviceRemoved(Solid::Device device) -{ - showMessage(tr("The device \"%1\" is removed.").arg(device.description())); -} - -void DeviceActionInfo::showMessage(const QString &text) -{ - LXQt::Notification::notify(tr("Removable media/devices manager"), text, mPlugin->icon().name()); -} diff --git a/plugin-mount/actions/deviceaction_info.h b/plugin-mount/actions/deviceaction_info.h deleted file mode 100644 index 0e500a9..0000000 --- a/plugin-mount/actions/deviceaction_info.h +++ /dev/null @@ -1,53 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQT_PLUGIN_MOUNT_DEVICEACTION_INFO_H -#define LXQT_PLUGIN_MOUNT_DEVICEACTION_INFO_H - -#include "deviceaction.h" - -#include -#include - -class Popup; - -class DeviceActionInfo : public DeviceAction -{ - Q_OBJECT -public: - explicit DeviceActionInfo(LXQtMountPlugin *plugin, QObject *parent = 0); - virtual ActionId Type() const throw () { return ActionInfo; } - -protected: - void doDeviceAdded(Solid::Device device); - void doDeviceRemoved(Solid::Device device); - -private: - void showMessage(const QString &text); -}; - -#endif // DEVICEACTION_INFO_H diff --git a/plugin-mount/actions/deviceaction_menu.cpp b/plugin-mount/actions/deviceaction_menu.cpp deleted file mode 100644 index 1357d56..0000000 --- a/plugin-mount/actions/deviceaction_menu.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "deviceaction_menu.h" -#include "../lxqtmountplugin.h" -#include "../popup.h" - -DeviceActionMenu::DeviceActionMenu(LXQtMountPlugin *plugin, QObject *parent): - DeviceAction(plugin, parent) -{ - mPopup = plugin->popup(); - - mHideTimer.setSingleShot(true); - mHideTimer.setInterval(5000); - connect(&mHideTimer, &QTimer::timeout, mPopup, &Popup::hide); -} - -void DeviceActionMenu::doDeviceAdded(Solid::Device device) -{ - mHideTimer.start(); - mPopup->show(); -} - -void DeviceActionMenu::doDeviceRemoved(Solid::Device device) -{ -} diff --git a/plugin-mount/actions/deviceaction_menu.h b/plugin-mount/actions/deviceaction_menu.h deleted file mode 100644 index 86ea7dd..0000000 --- a/plugin-mount/actions/deviceaction_menu.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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQT_PLUGIN_MOUNT_DEVICEACTION_MENU_H -#define LXQT_PLUGIN_MOUNT_DEVICEACTION_MENU_H - -#include "deviceaction.h" - -#include -#include - -class Popup; - -class DeviceActionMenu : public DeviceAction -{ - Q_OBJECT -public: - explicit DeviceActionMenu(LXQtMountPlugin *plugin, QObject *parent = 0); - virtual ActionId Type() const throw () { return ActionMenu; } - -protected: - void doDeviceAdded(Solid::Device device); - void doDeviceRemoved(Solid::Device device); - -private: - Popup *mPopup; - QTimer mHideTimer; -}; - -#endif // DEVICEACTIONMENU_H diff --git a/plugin-mount/actions/deviceaction_nothing.cpp b/plugin-mount/actions/deviceaction_nothing.cpp deleted file mode 100644 index 3c47625..0000000 --- a/plugin-mount/actions/deviceaction_nothing.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "deviceaction_nothing.h" - -DeviceActionNothing::DeviceActionNothing(LXQtMountPlugin *plugin, QObject *parent): - DeviceAction(plugin, parent) -{ -} - -void DeviceActionNothing::doDeviceAdded(Solid::Device device) -{ -} - -void DeviceActionNothing::doDeviceRemoved(Solid::Device device) -{ -} diff --git a/plugin-mount/actions/deviceaction_nothing.h b/plugin-mount/actions/deviceaction_nothing.h deleted file mode 100644 index 37aee1a..0000000 --- a/plugin-mount/actions/deviceaction_nothing.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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQT_PLUGIN_MOUNT_DEVICEACTION_NOTHING_H -#define LXQT_PLUGIN_MOUNT_DEVICEACTION_NOTHING_H - -#include "deviceaction.h" -#include - -class DeviceActionNothing : public DeviceAction -{ - Q_OBJECT - -public: - explicit DeviceActionNothing(LXQtMountPlugin *plugin, QObject *parent = 0); - virtual ActionId Type() const throw () { return ActionNothing; }; - -protected: - void doDeviceAdded(Solid::Device device); - void doDeviceRemoved(Solid::Device device); -}; - -#endif // DEVICEACTIONNOTHING_H diff --git a/plugin-mount/button.cpp b/plugin-mount/button.cpp deleted file mode 100644 index bae833b..0000000 --- a/plugin-mount/button.cpp +++ /dev/null @@ -1,45 +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: - * Petr Vanek - * Alexander Sokoloff - * - * 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 "button.h" -#include - -Button::Button(QWidget * parent) : - QToolButton(parent) -{ - //Note: don't use the QStringLiteral here as it is causing a SEGFAULT in static finalization time - //(the string is released upon our *.so removal, but the reference is still in held in libqtxdg...) - setIcon(XdgIcon::fromTheme(QLatin1String("drive-removable-media"))); - setToolTip(tr("Removable media/devices manager")); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setAutoRaise(true); -} - -Button::~Button() -{ -} diff --git a/plugin-mount/button.h b/plugin-mount/button.h deleted file mode 100644 index 2628cbc..0000000 --- a/plugin-mount/button.h +++ /dev/null @@ -1,43 +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: - * Petr Vanek - * Alexander Sokoloff - * - * 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 LXQT_PLUGIN_MOUNT_BUTTON_H -#define LXQT_PLUGIN_MOUNT_BUTTON_H - -#include - - -class Button : public QToolButton -{ - Q_OBJECT -public: - Button(QWidget *parent = 0); - ~Button(); -}; - -#endif diff --git a/plugin-mount/configuration.cpp b/plugin-mount/configuration.cpp deleted file mode 100644 index a2cd35f..0000000 --- a/plugin-mount/configuration.cpp +++ /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: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "configuration.h" -#include "ui_configuration.h" - -#include -#include - -Configuration::Configuration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::Configuration) -{ - ui->setupUi(this); - ui->devAddedCombo->addItem(tr("Popup menu"), QLatin1String(ACT_SHOW_MENU)); - ui->devAddedCombo->addItem(tr("Show info"), QLatin1String(ACT_SHOW_INFO)); - ui->devAddedCombo->addItem(tr("Do nothing"), QLatin1String(ACT_NOTHING)); - - loadSettings(); - connect(ui->devAddedCombo, static_cast(&QComboBox::currentIndexChanged), - this, &Configuration::devAddedChanged); - connect(ui->buttons, &QDialogButtonBox::clicked, this, &Configuration::dialogButtonsAction); -} - -Configuration::~Configuration() -{ - delete ui; -} - -void Configuration::loadSettings() -{ - QVariant value = settings().value(QLatin1String(CFG_KEY_ACTION), QLatin1String(ACT_SHOW_INFO)); - setComboboxIndexByData(ui->devAddedCombo, value, 1); -} - -void Configuration::devAddedChanged(int index) -{ - QString s = ui->devAddedCombo->itemData(index).toString(); - settings().setValue(QLatin1String(CFG_KEY_ACTION), s); -} diff --git a/plugin-mount/configuration.h b/plugin-mount/configuration.h deleted file mode 100644 index 903288f..0000000 --- a/plugin-mount/configuration.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: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQT_PLUGIN_MOUNT_CONFIGURATION_H -#define LXQT_PLUGIN_MOUNT_CONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" - -#define CFG_KEY_ACTION "newDeviceAction" -#define ACT_SHOW_MENU "showMenu" -#define ACT_SHOW_INFO "showInfo" -#define ACT_NOTHING "nothing" - -namespace Ui { - class Configuration; -} - -class Configuration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit Configuration(PluginSettings *settings, QWidget *parent = 0); - ~Configuration(); - -protected slots: - virtual void loadSettings(); - void devAddedChanged(int index); - -private: - Ui::Configuration *ui; -}; - -#endif // LXQTMOUNTCONFIGURATION_H diff --git a/plugin-mount/configuration.ui b/plugin-mount/configuration.ui deleted file mode 100644 index 2deef8c..0000000 --- a/plugin-mount/configuration.ui +++ /dev/null @@ -1,96 +0,0 @@ - - - Configuration - - - - 0 - 0 - 407 - 129 - - - - Removable Media Settings - - - - - - Behaviour - - - - - - When a device is connected : - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 41 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - - buttons - accepted() - Configuration - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttons - rejected() - Configuration - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/plugin-mount/lxqtmountplugin.cpp b/plugin-mount/lxqtmountplugin.cpp deleted file mode 100644 index 4158825..0000000 --- a/plugin-mount/lxqtmountplugin.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: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * 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 "lxqtmountplugin.h" -#include "configuration.h" - -#include - -LXQtMountPlugin::LXQtMountPlugin(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - mPopup(nullptr), - mDeviceAction(nullptr) -{ - mButton = new Button; - mPopup = new Popup(this); - - connect(mButton, &QToolButton::clicked, mPopup, &Popup::showHide); - connect(mPopup, &Popup::visibilityChanged, mButton, &QToolButton::setDown); - // Note: postpone creation of the mDeviceAction to not fire it in startup time - QTimer::singleShot(0, this, &LXQtMountPlugin::settingsChanged); -} - -LXQtMountPlugin::~LXQtMountPlugin() -{ - delete mButton; - delete mPopup; -} - -QDialog *LXQtMountPlugin::configureDialog() -{ - if (mPopup) - mPopup->hide(); - - Configuration *configWindow = new Configuration(settings()); - configWindow->setAttribute(Qt::WA_DeleteOnClose, true); - return configWindow; -} - -void LXQtMountPlugin::realign() -{ - //nothing to do -} - -void LXQtMountPlugin::settingsChanged() -{ - QString s = settings()->value(QLatin1String(CFG_KEY_ACTION)).toString(); - DeviceAction::ActionId actionId = DeviceAction::stringToActionId(s, DeviceAction::ActionMenu); - - if (mDeviceAction == nullptr || mDeviceAction->Type() != actionId) - { - delete mDeviceAction; - mDeviceAction = DeviceAction::create(actionId, this); - - connect(mPopup, &Popup::deviceAdded, mDeviceAction, &DeviceAction::onDeviceAdded); - connect(mPopup, &Popup::deviceRemoved, mDeviceAction, &DeviceAction::onDeviceRemoved); - } - -} diff --git a/plugin-mount/lxqtmountplugin.h b/plugin-mount/lxqtmountplugin.h deleted file mode 100644 index 08a102e..0000000 --- a/plugin-mount/lxqtmountplugin.h +++ /dev/null @@ -1,84 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * 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 LXQTMOUNTPLUGIN_H -#define LXQTMOUNTPLUGIN_H - -#include "../panel/ilxqtpanelplugin.h" -#include "../panel/lxqtpanel.h" -#include "button.h" -#include "popup.h" -#include "actions/deviceaction.h" - -#include - -/*! -\author Petr Vanek -*/ - -class LXQtMountPlugin : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT - -public: - LXQtMountPlugin(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtMountPlugin(); - - virtual QWidget *widget() { return mButton; } - virtual QString themeId() const { return QLatin1String("LXQtMount"); } - virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog; } - - Popup *popup() { return mPopup; } - QIcon icon() { return mButton->icon(); }; - QDialog *configureDialog(); - -public slots: - void realign(); - -protected slots: - virtual void settingsChanged(); - -private: - Button *mButton; - Popup *mPopup; - DeviceAction *mDeviceAction; -}; - -class LXQtMountPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) - -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new LXQtMountPlugin(startupInfo); - } -}; - -#endif diff --git a/plugin-mount/menudiskitem.cpp b/plugin-mount/menudiskitem.cpp deleted file mode 100644 index 783ebf1..0000000 --- a/plugin-mount/menudiskitem.cpp +++ /dev/null @@ -1,181 +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: - * Petr Vanek - * - * 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 "menudiskitem.h" -#include "popup.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -MenuDiskItem::MenuDiskItem(Solid::Device device, Popup *popup): - QFrame(popup), - mPopup(popup), - mDevice(device), - mDiskButton(nullptr), - mEjectButton(nullptr), - mDiskButtonClicked(false), - mEjectButtonClicked(false) -{ - Solid::StorageAccess * const iface = device.as(); - Q_ASSERT(nullptr != iface); - - mDiskButton = new QToolButton(this); - mDiskButton->setObjectName("DiskButton"); - mDiskButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - mDiskButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); - connect(mDiskButton, &QToolButton::clicked, this, &MenuDiskItem::diskButtonClicked); - - mEjectButton = new QToolButton(this); - mEjectButton->setObjectName("EjectButton"); - mEjectButton->setIcon(XdgIcon::fromTheme("media-eject")); - connect(mEjectButton, &QToolButton::clicked, this, &MenuDiskItem::ejectButtonClicked); - - QHBoxLayout *layout = new QHBoxLayout(this); - layout->addWidget(mDiskButton); - layout->addWidget(mEjectButton); - layout->setMargin(0); - layout->setSpacing(0); - setLayout(layout); - - connect(iface, &Solid::StorageAccess::setupDone, this, &MenuDiskItem::onMounted); - connect(iface, &Solid::StorageAccess::teardownDone, this, &MenuDiskItem::onUnmounted); - connect(iface, &Solid::StorageAccess::accessibilityChanged, [this] (bool accessible, QString const &) { - updateMountStatus(); - }); - - updateMountStatus(); -} - -MenuDiskItem::~MenuDiskItem() -{ -} - -void MenuDiskItem::setMountStatus(bool mounted) -{ - mEjectButton->setEnabled(mounted); -} - -void MenuDiskItem::updateMountStatus() -{ - //Note: don't use the QStringLiteral here as it is causing a SEGFAULT in static finalization time - //(the string is released upon our *.so removal, but the reference is still in held in libqtxdg...) - static const QIcon icon = XdgIcon::fromTheme(mDevice.icon(), QLatin1String("drive-removable-media")); - - if (mDevice.isValid()) - { - mDiskButton->setIcon(icon); - mDiskButton->setText(mDevice.description()); - - setMountStatus(mDevice.as()->isAccessible() || !opticalParent().udi().isEmpty()); - } - else - emit invalid(mDevice.udi()); -} - -Solid::Device MenuDiskItem::opticalParent() const -{ - Solid::Device it; - if (mDevice.isValid()) - { - it = mDevice; - // search for parent drive - for (; !it.udi().isEmpty(); it = it.parent()) - if (it.is()) - break; - } - return it; -} - -void MenuDiskItem::diskButtonClicked() -{ - mDiskButtonClicked = true; - Solid::StorageAccess* di = mDevice.as(); - if (!di->isAccessible()) - di->setup(); - else - onMounted(Solid::NoError, QString(), mDevice.udi()); - - mPopup->hide(); -} - -void MenuDiskItem::ejectButtonClicked() -{ - mEjectButtonClicked = true; - Solid::StorageAccess* di = mDevice.as(); - if (di->isAccessible()) - di->teardown(); - else - onUnmounted(Solid::NoError, QString(), mDevice.udi()); - - mPopup->hide(); -} - -void MenuDiskItem::onMounted(Solid::ErrorType error, QVariant resultData, const QString &udi) -{ - if (mDiskButtonClicked) - { - mDiskButtonClicked = false; - - if (Solid::NoError == error) - QDesktopServices::openUrl(QUrl(mDevice.as()->filePath())); - else - { - QString errorMsg = tr("Mounting of \"%1\" failed: %2"); - errorMsg = errorMsg.arg(mDevice.description()).arg(resultData.toString()); - LXQt::Notification::notify(tr("Removable media/devices manager"), errorMsg, mDevice.icon()); - } - } -} - -void MenuDiskItem::onUnmounted(Solid::ErrorType error, QVariant resultData, const QString &udi) -{ - if (mEjectButtonClicked) - { - mEjectButtonClicked = false; - - if (Solid::NoError == error) - { - Solid::Device opt_parent = opticalParent(); - if (!opt_parent.udi().isEmpty()) - opt_parent.as()->eject(); - } - else - { - QString errorMsg = tr("Unmounting of \"%1\" failed: %2"); - errorMsg = errorMsg.arg(mDevice.description()).arg(resultData.toString()); - LXQt::Notification::notify(tr("Removable media/devices manager"), errorMsg, mDevice.icon()); - } - } -} diff --git a/plugin-mount/menudiskitem.h b/plugin-mount/menudiskitem.h deleted file mode 100644 index ccd26e7..0000000 --- a/plugin-mount/menudiskitem.h +++ /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: - * Petr Vanek - * - * 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 LXQT_PLUGIN_MOUNT_MENUDISKITEM_H -#define LXQT_PLUGIN_MOUNT_MENUDISKITEM_H - -#include -#include -#include -#include - -class Popup; - -class MenuDiskItem : public QFrame -{ - Q_OBJECT - -public: - explicit MenuDiskItem(Solid::Device device, Popup *popup); - ~MenuDiskItem(); - - QString deviceUdi() const { return mDevice.udi(); } - void setMountStatus(bool mounted); - -private: - void updateMountStatus(); - Solid::Device opticalParent() const; - -signals: - void invalid(QString const & udi); - -private slots: - void diskButtonClicked(); - void ejectButtonClicked(); - - void onMounted(Solid::ErrorType error, - QVariant resultData, - const QString &udi); - void onUnmounted(Solid::ErrorType error, - QVariant resultData, - const QString &udi); - -private: - Popup *mPopup; - Solid::Device mDevice; - QToolButton *mDiskButton; - QToolButton *mEjectButton; - bool mDiskButtonClicked; - bool mEjectButtonClicked; -}; - -#endif // MENUDISKITEM_H diff --git a/plugin-mount/popup.cpp b/plugin-mount/popup.cpp deleted file mode 100644 index 0de6dd4..0000000 --- a/plugin-mount/popup.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2011-2013 Razor team - * Authors: - * Petr Vanek - * Alexander Sokoloff - * - * 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 "popup.h" -#include "../panel/ilxqtpanelplugin.h" - -#include -#include -#include -#include -#include -#include - -// Paulo: I'm not sure what this is for -static bool hasRemovableParent(Solid::Device device) -{ - // qDebug() << "acess:" << device.udi(); - for ( ; !device.udi().isEmpty(); device = device.parent()) - { - Solid::StorageDrive* drive = device.as(); - if (drive && drive->isRemovable()) - { - // qDebug() << "removable parent drive:" << device.udi(); - return true; - } - } - return false; -} - -Popup::Popup(ILXQtPanelPlugin * plugin, QWidget* parent): - QDialog(parent, Qt::Window | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint), - mPlugin(plugin), - mPlaceholder(nullptr), - mDisplayCount(0) -{ - setObjectName("LXQtMountPopup"); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setLayout(new QVBoxLayout(this)); - layout()->setMargin(0); - - setAttribute(Qt::WA_AlwaysShowToolTips); - - mPlaceholder = new QLabel(tr("No devices are available"), this); - mPlaceholder->setObjectName("NoDiskLabel"); - layout()->addWidget(mPlaceholder); - - //Perform the potential long time operation after object construction - //Note: can't use QTimer::singleShot with lambda in pre QT 5.4 code - QTimer * aux_timer = new QTimer; - connect(aux_timer, &QTimer::timeout, [this, aux_timer] - { - delete aux_timer; //cleanup - for (Solid::Device device : Solid::Device::listFromType(Solid::DeviceInterface::StorageAccess)) - if (hasRemovableParent(device)) - addItem(device); - }); - aux_timer->setSingleShot(true); - aux_timer->start(0); - - connect(Solid::DeviceNotifier::instance(), &Solid::DeviceNotifier::deviceAdded, - this, &Popup::onDeviceAdded); - connect(Solid::DeviceNotifier::instance(), &Solid::DeviceNotifier::deviceRemoved, - this, &Popup::onDeviceRemoved); -} - -void Popup::showHide() -{ - if (isHidden()) - { - mPlugin->willShowWindow(this); - show(); - } else - close(); -} - -void Popup::onDeviceAdded(QString const & udi) -{ - Solid::Device device(udi); - if (device.is() && hasRemovableParent(device)) - addItem(device); -} - -void Popup::onDeviceRemoved(QString const & udi) -{ - MenuDiskItem* item = nullptr; - const int size = layout()->count() - 1; - for (int i = size; 0 <= i; --i) - { - QWidget *w = layout()->itemAt(i)->widget(); - if (w == mPlaceholder) - continue; - - MenuDiskItem *it = static_cast(w); - if (udi == it->deviceUdi()) - { - item = it; - break; - } - } - - if (item != nullptr) - { - layout()->removeWidget(item); - item->deleteLater(); - - --mDisplayCount; - if (mDisplayCount == 0) - mPlaceholder->show(); - - emit deviceRemoved(Solid::Device{udi}); - } -} - -void Popup::showEvent(QShowEvent *event) -{ - mPlaceholder->setVisible(mDisplayCount == 0); - realign(); - setFocus(); - activateWindow(); - QWidget::showEvent(event); - emit visibilityChanged(true); -} - -void Popup::hideEvent(QHideEvent *event) -{ - QWidget::hideEvent(event); - emit visibilityChanged(false); -} - -void Popup::addItem(Solid::Device device) -{ - MenuDiskItem *item = new MenuDiskItem(device, this); - connect(item, &MenuDiskItem::invalid, this, &Popup::onDeviceRemoved); - item->setVisible(true); - layout()->addWidget(item); - - mDisplayCount++; - if (mDisplayCount != 0) - mPlaceholder->hide(); - - if (isVisible()) - realign(); - - emit deviceAdded(device); -} - -void Popup::realign() -{ - adjustSize(); - setGeometry(mPlugin->calculatePopupWindowPos(sizeHint())); -} diff --git a/plugin-mount/popup.h b/plugin-mount/popup.h deleted file mode 100644 index 53a4659..0000000 --- a/plugin-mount/popup.h +++ /dev/null @@ -1,80 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2011-2013 Razor team - * Authors: - * Petr Vanek - * Alexander Sokoloff - * - * 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 LXQT_PLUGIN_MOUNT_POPUP_H -#define LXQT_PLUGIN_MOUNT_POPUP_H - -#include "menudiskitem.h" - -#include -#include -#include - -class ILXQtPanelPlugin; - -class Popup: public QDialog -{ - Q_OBJECT - -public: - explicit Popup(ILXQtPanelPlugin * plugin, QWidget* parent = 0); - void realign(); - -public slots: - void showHide(); - -private slots: - void onDeviceAdded(QString const & udi); - void onDeviceRemoved(QString const & udi); - -signals: - void visibilityChanged(bool visible); - /*! - * \brief Signal emitted when new device added into the popup - * (device which we are interested in) - */ - void deviceAdded(Solid::Device device); - /*! - * \brief Signal emitted when device is removed from the popup - * (device which we are interested in) - */ - void deviceRemoved(Solid::Device device); - -protected: - void showEvent(QShowEvent *event); - void hideEvent(QHideEvent *event); - -private: - ILXQtPanelPlugin * mPlugin; - QLabel *mPlaceholder; - int mDisplayCount; - - void addItem(Solid::Device device); -}; - -#endif // POPUP_H diff --git a/plugin-mount/resources/mount.desktop.in b/plugin-mount/resources/mount.desktop.in deleted file mode 100644 index ec49ace..0000000 --- a/plugin-mount/resources/mount.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. -Icon=drive-removable-media - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-mount/translations/mount_ar.desktop b/plugin-mount/translations/mount_ar.desktop deleted file mode 100644 index b9c8ce3..0000000 --- a/plugin-mount/translations/mount_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[ar]=لضمّ أو إزالة ضمّ أصابع USB أو الأجهزة البصريّة. -Name[ar]=الوسائط المنفصلة diff --git a/plugin-mount/translations/mount_cs.desktop b/plugin-mount/translations/mount_cs.desktop deleted file mode 100644 index add3eb8..0000000 --- a/plugin-mount/translations/mount_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Správa odstranitelných zařízení (USB, CD, DVD, ...) -Name[cs]=Správce zařízení diff --git a/plugin-mount/translations/mount_cs_CZ.desktop b/plugin-mount/translations/mount_cs_CZ.desktop deleted file mode 100644 index ac24ad9..0000000 --- a/plugin-mount/translations/mount_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Zacházení s odstranitelnými médii (USB, CD, DVD, ...) -Name[cs_CZ]=Odstranitelná média diff --git a/plugin-mount/translations/mount_da.desktop b/plugin-mount/translations/mount_da.desktop deleted file mode 100644 index ca3910d..0000000 --- a/plugin-mount/translations/mount_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. -Icon=drive-removable-media - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Flytbare medier -Comment[da]=Nem montering og afmontering af USB- og optiske drev. diff --git a/plugin-mount/translations/mount_de.desktop b/plugin-mount/translations/mount_de.desktop deleted file mode 100644 index 71a2208..0000000 --- a/plugin-mount/translations/mount_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Wechseldatenträger -Comment[de]=Wechseldatenträgerverwaltung (USB, CD, DVD, ...) diff --git a/plugin-mount/translations/mount_el.desktop b/plugin-mount/translations/mount_el.desktop deleted file mode 100644 index 62e5c53..0000000 --- a/plugin-mount/translations/mount_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Αφαιρούμενα μέσα -Comment[el]=Εύκολη προσάρτηση και αποπροσάρτηση USB και οπτικών δίσκων. diff --git a/plugin-mount/translations/mount_eo.desktop b/plugin-mount/translations/mount_eo.desktop deleted file mode 100644 index 66673da..0000000 --- a/plugin-mount/translations/mount_eo.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eo]=Traktilo de demeteblaj aparatoj (USB, KD, DVD, ...) -Name[eo]=Demetebla datumportilo diff --git a/plugin-mount/translations/mount_es.desktop b/plugin-mount/translations/mount_es.desktop deleted file mode 100644 index 7e5eb0e..0000000 --- a/plugin-mount/translations/mount_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Manejador de dispositivos desmontables (USB, CD, DVD, ...) -Name[es]=Dispositivos desmontables diff --git a/plugin-mount/translations/mount_es_VE.desktop b/plugin-mount/translations/mount_es_VE.desktop deleted file mode 100644 index b949a81..0000000 --- a/plugin-mount/translations/mount_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Manejador de dispositivos removibles (USB, DVD, CAM, ..) -Name[es_VE]=Dispositivos diff --git a/plugin-mount/translations/mount_eu.desktop b/plugin-mount/translations/mount_eu.desktop deleted file mode 100644 index bbee4d4..0000000 --- a/plugin-mount/translations/mount_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Gailu aldagarrien maneiatzailea (USB, CD, DVD, ...) -Name[eu]=Gailu aldagarria diff --git a/plugin-mount/translations/mount_fi.desktop b/plugin-mount/translations/mount_fi.desktop deleted file mode 100644 index 1910620..0000000 --- a/plugin-mount/translations/mount_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Irrotettavien laitteiden ja medioiden käsittelijä (USB, CD, DVD...) -Name[fi]=Irrotettavat laitteet ja mediat diff --git a/plugin-mount/translations/mount_fr.desktop b/plugin-mount/translations/mount_fr.desktop deleted file mode 100644 index e0bd9cb..0000000 --- a/plugin-mount/translations/mount_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Comment[fr]=Gestionnaire de médias amovibles (USB, CD, DVD, ...) -Name[fr]=Média amovible diff --git a/plugin-mount/translations/mount_hu.desktop b/plugin-mount/translations/mount_hu.desktop deleted file mode 100644 index faade54..0000000 --- a/plugin-mount/translations/mount_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=Cserélhetőeszköz-kezelő (USB, CD, DVD, …) -Name[hu]=Cserélhető eszköz diff --git a/plugin-mount/translations/mount_ia.desktop b/plugin-mount/translations/mount_ia.desktop deleted file mode 100644 index ccdf022..0000000 --- a/plugin-mount/translations/mount_ia.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Removable media handler (USB, CD, DVD, ...) - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-mount/translations/mount_id_ID.desktop b/plugin-mount/translations/mount_id_ID.desktop deleted file mode 100644 index ccdf022..0000000 --- a/plugin-mount/translations/mount_id_ID.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Removable media handler (USB, CD, DVD, ...) - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-mount/translations/mount_it.desktop b/plugin-mount/translations/mount_it.desktop deleted file mode 100644 index eb4e9d8..0000000 --- a/plugin-mount/translations/mount_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Dispositivi rimovibili -Comment[it]=Gestore dei dispositivi rimovibili (USB, CD, DVD, ...) diff --git a/plugin-mount/translations/mount_ja.desktop b/plugin-mount/translations/mount_ja.desktop deleted file mode 100644 index 9338558..0000000 --- a/plugin-mount/translations/mount_ja.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ja]=USBや光学ドライブのマウントやアンマウントを容易にします -Name[ja]=リムーバルメディア diff --git a/plugin-mount/translations/mount_ko.desktop b/plugin-mount/translations/mount_ko.desktop deleted file mode 100644 index ccdf022..0000000 --- a/plugin-mount/translations/mount_ko.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Removable media handler (USB, CD, DVD, ...) - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-mount/translations/mount_lt.desktop b/plugin-mount/translations/mount_lt.desktop deleted file mode 100644 index aa68375..0000000 --- a/plugin-mount/translations/mount_lt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[lt]=Lengvas USB ir optinių diskų prijungimas ir atjungimas. -Name[lt]=Keičiamosios laikmenos diff --git a/plugin-mount/translations/mount_nl.desktop b/plugin-mount/translations/mount_nl.desktop deleted file mode 100644 index 596ee07..0000000 --- a/plugin-mount/translations/mount_nl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[nl]=Verwijderbare media beheerder (USB, CD, DVD, ...) -Name[nl]=Verwijderbare media diff --git a/plugin-mount/translations/mount_pl.desktop b/plugin-mount/translations/mount_pl.desktop deleted file mode 100644 index e5eba0e..0000000 --- a/plugin-mount/translations/mount_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Menedżer urządzeń wymiennych -Name[pl]=Menedżer urządzeń diff --git a/plugin-mount/translations/mount_pt.desktop b/plugin-mount/translations/mount_pt.desktop deleted file mode 100644 index 87c8c17..0000000 --- a/plugin-mount/translations/mount_pt.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[pt]=Discos amovíveis -Comment[pt]=Montar e desmontar discos óticos e unidades USB. diff --git a/plugin-mount/translations/mount_pt_BR.desktop b/plugin-mount/translations/mount_pt_BR.desktop deleted file mode 100644 index 3d5a7e4..0000000 --- a/plugin-mount/translations/mount_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Manipulador de mídia removível (USB, CD, DVD, ...) -Name[pt_BR]=Mídia removível diff --git a/plugin-mount/translations/mount_ro_RO.desktop b/plugin-mount/translations/mount_ro_RO.desktop deleted file mode 100644 index 8ded4ad..0000000 --- a/plugin-mount/translations/mount_ro_RO.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Administrator de dispozitive detașabile (USB, CD, DVD, ...) -Name[ro_RO]=Dispozitive detașabile diff --git a/plugin-mount/translations/mount_ru.desktop b/plugin-mount/translations/mount_ru.desktop deleted file mode 100644 index 5137520..0000000 --- a/plugin-mount/translations/mount_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru_RU]=Простое подключение и отключение USB и оптических приводов. -Name[ru_RU]=Съёмные устройства diff --git a/plugin-mount/translations/mount_sk.desktop b/plugin-mount/translations/mount_sk.desktop deleted file mode 100644 index 41e68cb..0000000 --- a/plugin-mount/translations/mount_sk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sk]=Práca s prenosnými médiami (USB, CD, DVD, ...) -Name[sk]=Prenosné médiá diff --git a/plugin-mount/translations/mount_sl.desktop b/plugin-mount/translations/mount_sl.desktop deleted file mode 100644 index cc0e64b..0000000 --- a/plugin-mount/translations/mount_sl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sl]=Upravljalnik odstranljivih nosilcev (USB, CD, DVD, ...) -Name[sl]=Odstranljivi nosilci diff --git a/plugin-mount/translations/mount_sr.desktop b/plugin-mount/translations/mount_sr.desktop deleted file mode 100644 index 417f5f5..0000000 --- a/plugin-mount/translations/mount_sr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr]=Руковаоц уклоњивим медијима (УСБ, ЦД, ДВД...) -Name[sr]=Уклоњиви медији diff --git a/plugin-mount/translations/mount_sr@ijekavian.desktop b/plugin-mount/translations/mount_sr@ijekavian.desktop deleted file mode 100644 index 93c2944..0000000 --- a/plugin-mount/translations/mount_sr@ijekavian.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavian]=Уклоњиви медији -Comment[sr@ijekavian]=Руковаоц уклоњивим медијима (УСБ, ЦД, ДВД...) diff --git a/plugin-mount/translations/mount_sr@ijekavianlatin.desktop b/plugin-mount/translations/mount_sr@ijekavianlatin.desktop deleted file mode 100644 index 8fa702c..0000000 --- a/plugin-mount/translations/mount_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavianlatin]=Uklonjivi mediji -Comment[sr@ijekavianlatin]=Rukovaoc uklonjivim medijima (USB, CD, DVD...) diff --git a/plugin-mount/translations/mount_sr@latin.desktop b/plugin-mount/translations/mount_sr@latin.desktop deleted file mode 100644 index c0a4b50..0000000 --- a/plugin-mount/translations/mount_sr@latin.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr@latin]=Rukovaoc uklonjivim medijima (USB, CD, DVD...) -Name[sr@latin]=Uklonjivi mediji diff --git a/plugin-mount/translations/mount_th_TH.desktop b/plugin-mount/translations/mount_th_TH.desktop deleted file mode 100644 index 6e6bf93..0000000 --- a/plugin-mount/translations/mount_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=ตัวจัดการสื่อที่สามารถถอดเสียบได้ (USB, CD, DVD, ...) -Name[th_TH]=สื่อที่สามารถถอดเสียบได้ diff --git a/plugin-mount/translations/mount_tr.desktop b/plugin-mount/translations/mount_tr.desktop deleted file mode 100644 index c878a04..0000000 --- a/plugin-mount/translations/mount_tr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[tr]=Çıkarılabilir aygıt yöneticisi (USB, CD, DVD, ...) -Name[tr]=Çıkarılabilir aygıt diff --git a/plugin-mount/translations/mount_uk.desktop b/plugin-mount/translations/mount_uk.desktop deleted file mode 100644 index 3946918..0000000 --- a/plugin-mount/translations/mount_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Легке керування знімними носіями (USB, CD, DVD тощо) -Name[uk]=Знімні носії diff --git a/plugin-mount/translations/mount_zh_CN.GB2312.desktop b/plugin-mount/translations/mount_zh_CN.GB2312.desktop deleted file mode 100644 index ccdf022..0000000 --- a/plugin-mount/translations/mount_zh_CN.GB2312.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Removable media handler (USB, CD, DVD, ...) - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-mount/translations/mount_zh_CN.desktop b/plugin-mount/translations/mount_zh_CN.desktop deleted file mode 100644 index bf240b6..0000000 --- a/plugin-mount/translations/mount_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=移动存储处理(USB, CD, DVD, ...) -Name[zh_CN]=移动存储 diff --git a/plugin-mount/translations/mount_zh_TW.desktop b/plugin-mount/translations/mount_zh_TW.desktop deleted file mode 100644 index 53ef555..0000000 --- a/plugin-mount/translations/mount_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Removable media -Comment=Easy mounting and unmounting of USB and optical drives. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=可卸除式裝置管理(USB、光碟...) -Name[zh_TW]=可卸除式裝置 diff --git a/plugin-networkmonitor/CMakeLists.txt b/plugin-networkmonitor/CMakeLists.txt deleted file mode 100644 index f83b32f..0000000 --- a/plugin-networkmonitor/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -set(PLUGIN "networkmonitor") - -set(HEADERS - lxqtnetworkmonitorplugin.h - lxqtnetworkmonitor.h - lxqtnetworkmonitorconfiguration.h -) - -set(SOURCES - lxqtnetworkmonitorplugin.cpp - lxqtnetworkmonitor.cpp - lxqtnetworkmonitorconfiguration.cpp -) - -set(UIS - lxqtnetworkmonitorconfiguration.ui -) - -set(RESOURCES - resources.qrc -) - -set(LIBRARIES ${STATGRAB_LIB}) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-networkmonitor/images/knemo-modem-error.png b/plugin-networkmonitor/images/knemo-modem-error.png deleted file mode 100644 index 8d49723..0000000 Binary files a/plugin-networkmonitor/images/knemo-modem-error.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-modem-idle.png b/plugin-networkmonitor/images/knemo-modem-idle.png deleted file mode 100644 index 0287aef..0000000 Binary files a/plugin-networkmonitor/images/knemo-modem-idle.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-modem-offline.png b/plugin-networkmonitor/images/knemo-modem-offline.png deleted file mode 100644 index f93afc3..0000000 Binary files a/plugin-networkmonitor/images/knemo-modem-offline.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-modem-receive.png b/plugin-networkmonitor/images/knemo-modem-receive.png deleted file mode 100644 index cc3bcc6..0000000 Binary files a/plugin-networkmonitor/images/knemo-modem-receive.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-modem-transmit-receive.png b/plugin-networkmonitor/images/knemo-modem-transmit-receive.png deleted file mode 100644 index 40a1480..0000000 Binary files a/plugin-networkmonitor/images/knemo-modem-transmit-receive.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-modem-transmit.png b/plugin-networkmonitor/images/knemo-modem-transmit.png deleted file mode 100644 index 92752fa..0000000 Binary files a/plugin-networkmonitor/images/knemo-modem-transmit.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-monitor-error.png b/plugin-networkmonitor/images/knemo-monitor-error.png deleted file mode 100644 index 926cd9c..0000000 Binary files a/plugin-networkmonitor/images/knemo-monitor-error.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-monitor-idle.png b/plugin-networkmonitor/images/knemo-monitor-idle.png deleted file mode 100644 index aabf851..0000000 Binary files a/plugin-networkmonitor/images/knemo-monitor-idle.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-monitor-offline.png b/plugin-networkmonitor/images/knemo-monitor-offline.png deleted file mode 100644 index ec0d60f..0000000 Binary files a/plugin-networkmonitor/images/knemo-monitor-offline.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-monitor-receive.png b/plugin-networkmonitor/images/knemo-monitor-receive.png deleted file mode 100644 index 391f9ee..0000000 Binary files a/plugin-networkmonitor/images/knemo-monitor-receive.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-monitor-transmit-receive.png b/plugin-networkmonitor/images/knemo-monitor-transmit-receive.png deleted file mode 100644 index 221cbe5..0000000 Binary files a/plugin-networkmonitor/images/knemo-monitor-transmit-receive.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-monitor-transmit.png b/plugin-networkmonitor/images/knemo-monitor-transmit.png deleted file mode 100644 index b23ea99..0000000 Binary files a/plugin-networkmonitor/images/knemo-monitor-transmit.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-network-error.png b/plugin-networkmonitor/images/knemo-network-error.png deleted file mode 100644 index 4135687..0000000 Binary files a/plugin-networkmonitor/images/knemo-network-error.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-network-idle.png b/plugin-networkmonitor/images/knemo-network-idle.png deleted file mode 100644 index 6fb9882..0000000 Binary files a/plugin-networkmonitor/images/knemo-network-idle.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-network-offline.png b/plugin-networkmonitor/images/knemo-network-offline.png deleted file mode 100644 index 90a2d69..0000000 Binary files a/plugin-networkmonitor/images/knemo-network-offline.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-network-receive.png b/plugin-networkmonitor/images/knemo-network-receive.png deleted file mode 100644 index 013199d..0000000 Binary files a/plugin-networkmonitor/images/knemo-network-receive.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-network-transmit-receive.png b/plugin-networkmonitor/images/knemo-network-transmit-receive.png deleted file mode 100644 index 3b3c4d2..0000000 Binary files a/plugin-networkmonitor/images/knemo-network-transmit-receive.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-network-transmit.png b/plugin-networkmonitor/images/knemo-network-transmit.png deleted file mode 100644 index cf991f3..0000000 Binary files a/plugin-networkmonitor/images/knemo-network-transmit.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-wireless-error.png b/plugin-networkmonitor/images/knemo-wireless-error.png deleted file mode 100644 index 98f1c4b..0000000 Binary files a/plugin-networkmonitor/images/knemo-wireless-error.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-wireless-idle.png b/plugin-networkmonitor/images/knemo-wireless-idle.png deleted file mode 100644 index bc1d79a..0000000 Binary files a/plugin-networkmonitor/images/knemo-wireless-idle.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-wireless-offline.png b/plugin-networkmonitor/images/knemo-wireless-offline.png deleted file mode 100644 index 6791d49..0000000 Binary files a/plugin-networkmonitor/images/knemo-wireless-offline.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-wireless-receive.png b/plugin-networkmonitor/images/knemo-wireless-receive.png deleted file mode 100644 index ff0f2d6..0000000 Binary files a/plugin-networkmonitor/images/knemo-wireless-receive.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-wireless-transmit-receive.png b/plugin-networkmonitor/images/knemo-wireless-transmit-receive.png deleted file mode 100644 index eedd9dd..0000000 Binary files a/plugin-networkmonitor/images/knemo-wireless-transmit-receive.png and /dev/null differ diff --git a/plugin-networkmonitor/images/knemo-wireless-transmit.png b/plugin-networkmonitor/images/knemo-wireless-transmit.png deleted file mode 100644 index 864ec59..0000000 Binary files a/plugin-networkmonitor/images/knemo-wireless-transmit.png and /dev/null differ diff --git a/plugin-networkmonitor/lxqtnetworkmonitor.cpp b/plugin-networkmonitor/lxqtnetworkmonitor.cpp deleted file mode 100644 index 494a7a1..0000000 --- a/plugin-networkmonitor/lxqtnetworkmonitor.cpp +++ /dev/null @@ -1,216 +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: - * Alexander Sokoloff - * - * 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 "lxqtnetworkmonitor.h" -#include "lxqtnetworkmonitorconfiguration.h" -#include "../panel/ilxqtpanelplugin.h" - -#include -#include -#include -#include -#include - -extern "C" { -#include -} - -#ifdef __sg_public -// since libstatgrab 0.90 this macro is defined, so we use it for version check -#define STATGRAB_NEWER_THAN_0_90 1 -#endif - -LXQtNetworkMonitor::LXQtNetworkMonitor(ILXQtPanelPlugin *plugin, QWidget* parent): - QFrame(parent), - mPlugin(plugin) -{ - QHBoxLayout *layout = new QHBoxLayout(this); - layout->addWidget(&m_stuff); - setLayout(layout); - /* Initialise statgrab */ -#ifdef STATGRAB_NEWER_THAN_0_90 - sg_init(0); -#else - sg_init(); -#endif - - m_iconList << "modem" << "monitor" - << "network" << "wireless"; - - startTimer(800); - - settingsChanged(); -} - -LXQtNetworkMonitor::~LXQtNetworkMonitor() -{ -} - -void LXQtNetworkMonitor::resizeEvent(QResizeEvent *) -{ - m_stuff.setMinimumWidth(m_pic.width() + 2); - m_stuff.setMinimumHeight(m_pic.height() + 2); - - update(); -} - - -void LXQtNetworkMonitor::timerEvent(QTimerEvent *event) -{ - bool matched = false; - -#ifdef STATGRAB_NEWER_THAN_0_90 - size_t num_network_stats; - size_t x; -#else - int num_network_stats; - int x; -#endif - sg_network_io_stats *network_stats = sg_get_network_io_stats_diff(&num_network_stats); - - for (x = 0; x < num_network_stats; x++) - { - if (m_interface == QString::fromLocal8Bit(network_stats->interface_name)) - { - if (network_stats->rx != 0 && network_stats->tx != 0) - { - m_pic.load(iconName("transmit-receive")); - } - else if (network_stats->rx != 0 && network_stats->tx == 0) - { - m_pic.load(iconName("receive")); - } - else if (network_stats->rx == 0 && network_stats->tx != 0) - { - m_pic.load(iconName("transmit")); - } - else - { - m_pic.load(iconName("idle")); - } - - matched = true; - - break; - } - - network_stats++; - } - - if (!matched) - { - m_pic.load(iconName("error")); - } - - update(); -} - -void LXQtNetworkMonitor::paintEvent(QPaintEvent *) -{ - QPainter p(this); - - QRectF r = rect(); - - int leftOffset = (r.width() - m_pic.width() + 2) / 2; - int topOffset = (r.height() - m_pic.height() + 2) / 2; - - p.drawPixmap(leftOffset, topOffset, m_pic); -} - -bool LXQtNetworkMonitor::event(QEvent *event) -{ - if (event->type() == QEvent::ToolTip) - { -#ifdef STATGRAB_NEWER_THAN_0_90 - size_t num_network_stats; - size_t x; -#else - int num_network_stats; - int x; -#endif - sg_network_io_stats *network_stats = sg_get_network_io_stats(&num_network_stats); - - for (x = 0; x < num_network_stats; x++) - { - if (m_interface == QString::fromLocal8Bit(network_stats->interface_name)) - { - setToolTip(tr("Network interface %1").arg(m_interface) + "
" - + tr("Transmitted %1").arg(convertUnits(network_stats->tx)) + "
" - + tr("Received %1").arg(convertUnits(network_stats->rx)) - ); - } - network_stats++; - } - } - return QFrame::event(event); -} - -//void LXQtNetworkMonitor::showConfigureDialog() -//{ -// LXQtNetworkMonitorConfiguration *confWindow = -// this->findChild("LXQtNetworkMonitorConfigurationWindow"); - -// if (!confWindow) -// { -// confWindow = new LXQtNetworkMonitorConfiguration(settings(), this); -// } - -// confWindow->show(); -// confWindow->raise(); -// confWindow->activateWindow(); -//} - -void LXQtNetworkMonitor::settingsChanged() -{ - m_iconIndex = mPlugin->settings()->value("icon", 1).toInt(); - m_interface = mPlugin->settings()->value("interface").toString(); - if (m_interface.isEmpty()) - { -#ifdef STATGRAB_NEWER_THAN_0_90 - size_t count; -#else - int count; -#endif - sg_network_iface_stats* stats = sg_get_network_iface_stats(&count); - if (count > 0) - m_interface = QString(stats[0].interface_name); - } - - m_pic.load(iconName("error")); -} - -QString LXQtNetworkMonitor::convertUnits(double num) -{ - QString unit = tr("B"); - QStringList units = QStringList(tr("KiB")) << tr("MiB") << tr("GiB") << tr("TiB") << tr("PiB"); - for (QStringListIterator iter(units); num >= 1024 && iter.hasNext();) - { - num /= 1024; - unit = iter.next(); - } - return QString::number(num, 'f', 2) + " " + unit; -} diff --git a/plugin-networkmonitor/lxqtnetworkmonitor.h b/plugin-networkmonitor/lxqtnetworkmonitor.h deleted file mode 100644 index e80a37b..0000000 --- a/plugin-networkmonitor/lxqtnetworkmonitor.h +++ /dev/null @@ -1,74 +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: - * Alexander Sokoloff - * - * 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 LXQTNETWORKMONITOR_H -#define LXQTNETWORKMONITOR_H -#include - -class ILXQtPanelPlugin; - -/*! - TODO: How to define cable is not connected? - */ -class LXQtNetworkMonitor: public QFrame -{ - Q_OBJECT -public: - LXQtNetworkMonitor(ILXQtPanelPlugin *plugin, QWidget* parent = 0); - ~LXQtNetworkMonitor(); - virtual void settingsChanged(); - -protected: - void virtual timerEvent(QTimerEvent *event); - void virtual paintEvent(QPaintEvent * event); - void virtual resizeEvent(QResizeEvent *); - bool virtual event(QEvent *event); - - -private: - static QString convertUnits(double num); - QString iconName(const QString& state) const - { - return QString(":/images/knemo-%1-%2.png") - .arg(m_iconList[m_iconIndex], state); - } - - QWidget m_stuff; - - QStringList m_iconList; - - int m_iconIndex; - - QString m_interface; - QPixmap m_pic; - ILXQtPanelPlugin *mPlugin; -}; - - -#endif // LXQTNETWORKMONITOR_H - - diff --git a/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.cpp b/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.cpp deleted file mode 100644 index e106732..0000000 --- a/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.cpp +++ /dev/null @@ -1,84 +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: - * Maciej Płaza - * - * 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 "lxqtnetworkmonitorconfiguration.h" -#include "ui_lxqtnetworkmonitorconfiguration.h" - -extern "C" { -#include -} - -#ifdef __sg_public -// since libstatgrab 0.90 this macro is defined, so we use it for version check -#define STATGRAB_NEWER_THAN_0_90 1 -#endif - -LXQtNetworkMonitorConfiguration::LXQtNetworkMonitorConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtNetworkMonitorConfiguration) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("NetworkMonitorConfigurationWindow"); - ui->setupUi(this); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); - connect(ui->iconCB, SIGNAL(currentIndexChanged(int)), SLOT(saveSettings())); - connect(ui->interfaceCB, SIGNAL(currentIndexChanged(int)), SLOT(saveSettings())); - - loadSettings(); -} - -LXQtNetworkMonitorConfiguration::~LXQtNetworkMonitorConfiguration() -{ - delete ui; -} - -void LXQtNetworkMonitorConfiguration::saveSettings() -{ - settings().setValue("icon", ui->iconCB->currentIndex()); - settings().setValue("interface", ui->interfaceCB->currentText()); -} - -void LXQtNetworkMonitorConfiguration::loadSettings() -{ - ui->iconCB->setCurrentIndex(settings().value("icon", 1).toInt()); - - int count; -#ifdef STATGRAB_NEWER_THAN_0_90 - size_t ret_count; - sg_network_iface_stats* stats = sg_get_network_iface_stats(&ret_count); - count = (int)ret_count; -#else - sg_network_iface_stats* stats = sg_get_network_iface_stats(&count); -#endif - for (int ix = 0; ix < count; ix++) - ui->interfaceCB->addItem(stats[ix].interface_name); - - QString interface = settings().value("interface").toString(); - ui->interfaceCB->setCurrentIndex(qMax(qMin(0, count - 1), ui->interfaceCB->findText(interface))); -} diff --git a/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.h b/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.h deleted file mode 100644 index 9dcc072..0000000 --- a/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.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: 2011 Razor team - * Authors: - * Maciej Płaza - * - * 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 LXQTNETWORKMONITORCONFIGURATION_H -#define LXQTNETWORKMONITORCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" - -class QAbstractButton; - -namespace Ui -{ -class LXQtNetworkMonitorConfiguration; -} - -class LXQtNetworkMonitorConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtNetworkMonitorConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~LXQtNetworkMonitorConfiguration(); - -private: - Ui::LXQtNetworkMonitorConfiguration *ui; - -private slots: - /* - Saves settings in conf file. - */ - void saveSettings(); - void loadSettings(); -}; - -#endif // LXQTNETWORKMONITORCONFIGURATION_H diff --git a/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.ui b/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.ui deleted file mode 100644 index 1aecb5d..0000000 --- a/plugin-networkmonitor/lxqtnetworkmonitorconfiguration.ui +++ /dev/null @@ -1,131 +0,0 @@ - - - LXQtNetworkMonitorConfiguration - - - - 0 - 0 - 285 - 191 - - - - Network Monitor settings - - - - - - General - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - false - - - - - - Interface - - - - - - - - 0 - 0 - - - - true - - - - - - - - Modem - - - - :/images/knemo-modem-idle.png:/images/knemo-modem-idle.png - - - - - Monitor - - - - :/images/knemo-monitor-idle.png:/images/knemo-monitor-idle.png - - - - - Network - - - - :/images/knemo-network-idle.png:/images/knemo-network-idle.png - - - - - Wireless - - - - :/images/knemo-wireless-idle.png:/images/knemo-wireless-idle.png - - - - - - - - Icon - - - - - - - - - - Qt::Vertical - - - - 20 - 41 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - - - diff --git a/plugin-networkmonitor/lxqtnetworkmonitorplugin.cpp b/plugin-networkmonitor/lxqtnetworkmonitorplugin.cpp deleted file mode 100644 index cd8bae7..0000000 --- a/plugin-networkmonitor/lxqtnetworkmonitorplugin.cpp +++ /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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtnetworkmonitorplugin.h" -#include "lxqtnetworkmonitor.h" -#include "lxqtnetworkmonitorconfiguration.h" - -LXQtNetworkMonitorPlugin::LXQtNetworkMonitorPlugin(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - mWidget(new LXQtNetworkMonitor(this)) -{ -} - -LXQtNetworkMonitorPlugin::~LXQtNetworkMonitorPlugin() -{ - delete mWidget; -} - -QWidget *LXQtNetworkMonitorPlugin::widget() -{ - return mWidget; -} - -QDialog *LXQtNetworkMonitorPlugin::configureDialog() -{ - return new LXQtNetworkMonitorConfiguration(settings()); -} - -void LXQtNetworkMonitorPlugin::settingsChanged() -{ - mWidget->settingsChanged(); -} diff --git a/plugin-networkmonitor/lxqtnetworkmonitorplugin.h b/plugin-networkmonitor/lxqtnetworkmonitorplugin.h deleted file mode 100644 index 0c2b2d1..0000000 --- a/plugin-networkmonitor/lxqtnetworkmonitorplugin.h +++ /dev/null @@ -1,72 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTNETWORKMONITORPLUGIN_H -#define LXQTNETWORKMONITORPLUGIN_H - - -#include "../panel/ilxqtpanelplugin.h" -#include -class LXQtNetworkMonitor; - -class LXQtNetworkMonitorPlugin: public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - explicit LXQtNetworkMonitorPlugin(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtNetworkMonitorPlugin(); - - virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog; } - virtual QWidget *widget(); - virtual QString themeId() const { return "NetworkMonitor"; } - - bool isSeparate() const { return false; } - QDialog *configureDialog(); - -protected: - virtual void settingsChanged(); - -private: - LXQtNetworkMonitor *mWidget; -}; - - -class LXQtNetworkMonitorPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new LXQtNetworkMonitorPlugin(startupInfo); - } -}; - - -#endif // LXQTNETWORKMONITORPLUGIN_H diff --git a/plugin-networkmonitor/resources.qrc b/plugin-networkmonitor/resources.qrc deleted file mode 100644 index 4d19407..0000000 --- a/plugin-networkmonitor/resources.qrc +++ /dev/null @@ -1,28 +0,0 @@ - - - images/knemo-modem-error.png - images/knemo-modem-idle.png - images/knemo-modem-offline.png - images/knemo-modem-receive.png - images/knemo-modem-transmit-receive.png - images/knemo-modem-transmit.png - images/knemo-monitor-error.png - images/knemo-monitor-idle.png - images/knemo-monitor-offline.png - images/knemo-monitor-receive.png - images/knemo-monitor-transmit-receive.png - images/knemo-monitor-transmit.png - images/knemo-network-error.png - images/knemo-network-idle.png - images/knemo-network-offline.png - images/knemo-network-receive.png - images/knemo-network-transmit-receive.png - images/knemo-network-transmit.png - images/knemo-wireless-error.png - images/knemo-wireless-idle.png - images/knemo-wireless-offline.png - images/knemo-wireless-receive.png - images/knemo-wireless-transmit-receive.png - images/knemo-wireless-transmit.png - - diff --git a/plugin-networkmonitor/resources/networkmonitor.desktop.in b/plugin-networkmonitor/resources/networkmonitor.desktop.in deleted file mode 100644 index 81b9fde..0000000 --- a/plugin-networkmonitor/resources/networkmonitor.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Network monitor -Comment=Displays network status and activity. -#Icon=network-transmit-receive -Icon=network-wired - diff --git a/plugin-networkmonitor/translations/networkmonitor_ar.desktop b/plugin-networkmonitor/translations/networkmonitor_ar.desktop deleted file mode 100644 index 7cb4515..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=مرقاب الشّبكة -Comment[ar]=تعرض حالة الشّبكة ونشاطها diff --git a/plugin-networkmonitor/translations/networkmonitor_cs.desktop b/plugin-networkmonitor/translations/networkmonitor_cs.desktop deleted file mode 100644 index b8228d5..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_cs.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Name[cs]=Monitor sítě -Comment[cs]=Zobrazuje stav a aktivity sítě diff --git a/plugin-networkmonitor/translations/networkmonitor_da.desktop b/plugin-networkmonitor/translations/networkmonitor_da.desktop deleted file mode 100644 index cf8eb2f..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_da.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Network monitor -Comment=Displays network status and activity. -#Icon=network-transmit-receive -Icon=network-wired - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Netværksovervågning -Comment[da]=Netværksovervågning diff --git a/plugin-networkmonitor/translations/networkmonitor_de.desktop b/plugin-networkmonitor/translations/networkmonitor_de.desktop deleted file mode 100644 index ba549f3..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Netzwerkmonitor -Comment[de]=Informationen zu Status und Aktivität des Netzwerks diff --git a/plugin-networkmonitor/translations/networkmonitor_el.desktop b/plugin-networkmonitor/translations/networkmonitor_el.desktop deleted file mode 100644 index 538dd4f..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Επόπτης δικτύου -Comment[el]=Εμφάνιση της κατάστασης και της δραστηριότητας του δικτύου diff --git a/plugin-networkmonitor/translations/networkmonitor_eo.desktop b/plugin-networkmonitor/translations/networkmonitor_eo.desktop deleted file mode 100644 index edd4983..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_eo.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - -# Translations -Name[eo]=Ret-observilo -Comment[eo]=Elmontras ret-staton kaj -aktivecon diff --git a/plugin-networkmonitor/translations/networkmonitor_es.desktop b/plugin-networkmonitor/translations/networkmonitor_es.desktop deleted file mode 100644 index 7430bda..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_es.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[es]=Despliega el estado y actividades de la red. -Name[es]=Monitor de redes diff --git a/plugin-networkmonitor/translations/networkmonitor_eu.desktop b/plugin-networkmonitor/translations/networkmonitor_eu.desktop deleted file mode 100644 index ab57315..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_eu.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[eu]=Bistaratu sarearen egoera eta aktibitatea -Name[eu]=Sarearen monitorea diff --git a/plugin-networkmonitor/translations/networkmonitor_fi.desktop b/plugin-networkmonitor/translations/networkmonitor_fi.desktop deleted file mode 100644 index 667954c..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_fi.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[fi]=Verkkoseuranta -Name[fi]=Verkkoseuranta diff --git a/plugin-networkmonitor/translations/networkmonitor_fr.desktop b/plugin-networkmonitor/translations/networkmonitor_fr.desktop deleted file mode 100644 index f5c957c..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Name[fr]=Moniteur Réseau -Comment[fr]=Affiche le statut et l'activité du réseau diff --git a/plugin-networkmonitor/translations/networkmonitor_hu.desktop b/plugin-networkmonitor/translations/networkmonitor_hu.desktop deleted file mode 100644 index a74c0ec..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_hu.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - -# Translations -Name[hu]=Alkalmazásindító alapú menü -Comment[hu]=Alkalmazásmenü diff --git a/plugin-networkmonitor/translations/networkmonitor_it.desktop b/plugin-networkmonitor/translations/networkmonitor_it.desktop deleted file mode 100644 index a6d6af8..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_it.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - -# Translations -Name[it]=Monitor di rete -Comment[it]=Mostra stato e attività della rete diff --git a/plugin-networkmonitor/translations/networkmonitor_ja.desktop b/plugin-networkmonitor/translations/networkmonitor_ja.desktop deleted file mode 100644 index 7558a03..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_ja.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[ja]=ネットワークの状態や動作状況を表示します -Name[ja]=ネットワークモニター diff --git a/plugin-networkmonitor/translations/networkmonitor_lt.desktop b/plugin-networkmonitor/translations/networkmonitor_lt.desktop deleted file mode 100644 index 351d67e..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Tinklo prižiūryklė -Comment[lt]=Rodo tinklo būseną ir veiklą diff --git a/plugin-networkmonitor/translations/networkmonitor_nl.desktop b/plugin-networkmonitor/translations/networkmonitor_nl.desktop deleted file mode 100644 index 2617d4d..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_nl.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - -# Translations -Name[nl]=Netwerkmonitor -Comment[nl]=Toont netwerkstatus en -activiteit diff --git a/plugin-networkmonitor/translations/networkmonitor_pl.desktop b/plugin-networkmonitor/translations/networkmonitor_pl.desktop deleted file mode 100644 index f7fb15b..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_pl.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - -# Translations -Name[pl]=Monitorowanie sieci -Comment[pl]=Wyświetla stan i aktywność sieci. diff --git a/plugin-networkmonitor/translations/networkmonitor_pt.desktop b/plugin-networkmonitor/translations/networkmonitor_pt.desktop deleted file mode 100644 index df69b40..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_pt.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Network monitor -Comment=Displays network status and activity. - -# Translations -Name[pt]=Monitor de rede -Comment[pt]=Mostrar estado e atividade da rede diff --git a/plugin-networkmonitor/translations/networkmonitor_pt_BR.desktop b/plugin-networkmonitor/translations/networkmonitor_pt_BR.desktop deleted file mode 100644 index a53db5f..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_pt_BR.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - -# Translations -Name[pt_BR]=Monitor de Rede -Comment[pt_BR]=Mostra atividade e estado da rede diff --git a/plugin-networkmonitor/translations/networkmonitor_ro_RO.desktop b/plugin-networkmonitor/translations/networkmonitor_ro_RO.desktop deleted file mode 100644 index eeb6084..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_ro_RO.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[ro_RO]=Afisează starea și activitatea rețelei -Name[ro_RO]=Monitor rețea diff --git a/plugin-networkmonitor/translations/networkmonitor_ru.desktop b/plugin-networkmonitor/translations/networkmonitor_ru.desktop deleted file mode 100644 index e9086f3..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_ru.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[ru]=Отображает сетевой статус и активность. -Name[ru]=Сетевой Монитор \ No newline at end of file diff --git a/plugin-networkmonitor/translations/networkmonitor_sr@latin.desktop b/plugin-networkmonitor/translations/networkmonitor_sr@latin.desktop deleted file mode 100644 index 6f95355..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_sr@latin.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[sr@latin]=Automatsko suspendovanje -Name[sr@latin]=Meni pokretača programa diff --git a/plugin-networkmonitor/translations/networkmonitor_th_TH.desktop b/plugin-networkmonitor/translations/networkmonitor_th_TH.desktop deleted file mode 100644 index 793eb60..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_th_TH.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[th_TH]=เฝ้าสังเกตเครือข่าย -Name[th_TH]=เฝ้าสังเกตเครือข่าย diff --git a/plugin-networkmonitor/translations/networkmonitor_tr.desktop b/plugin-networkmonitor/translations/networkmonitor_tr.desktop deleted file mode 100644 index f49dbf8..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_tr.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - -# Translations -Name[tr]=Ağ izleme -Comment[tr]=Ağ iletişimi izleme ve yönetme diff --git a/plugin-networkmonitor/translations/networkmonitor_uk.desktop b/plugin-networkmonitor/translations/networkmonitor_uk.desktop deleted file mode 100644 index b1b696b..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_uk.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[uk]=Показує стан та активність мережі. -Name[uk]=Монітор мережі diff --git a/plugin-networkmonitor/translations/networkmonitor_zh_CN.desktop b/plugin-networkmonitor/translations/networkmonitor_zh_CN.desktop deleted file mode 100644 index 2539f68..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_zh_CN.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - - - -# Translations -Comment[zh_CN]=qxkb -Name[zh_CN]=屏幕记事本 diff --git a/plugin-networkmonitor/translations/networkmonitor_zh_TW.desktop b/plugin-networkmonitor/translations/networkmonitor_zh_TW.desktop deleted file mode 100644 index cbe8e4e..0000000 --- a/plugin-networkmonitor/translations/networkmonitor_zh_TW.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin - -Name=Network monitor -Comment=Displays network status and activity. - - -# Translations -Comment[zh_TW]=網路監視器 -Name[zh_TW]=顯示網路狀態和活動 diff --git a/plugin-quicklaunch/CMakeLists.txt b/plugin-quicklaunch/CMakeLists.txt deleted file mode 100644 index dd48bcf..0000000 --- a/plugin-quicklaunch/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -set(PLUGIN "quicklaunch") - -set(HEADERS - lxqtquicklaunchplugin.h - lxqtquicklaunch.h - quicklaunchbutton.h - quicklaunchaction.h -) - -set(SOURCES - lxqtquicklaunchplugin.cpp - lxqtquicklaunch.cpp - quicklaunchbutton.cpp - quicklaunchaction.cpp -) - -set(LIBRARIES - Qt5Xdg -) - -include_directories( - ${LXQT_INCLUDE_DIRS} - "${CMAKE_CURRENT_SOURCE_DIR}/../panel" -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-quicklaunch/lxqtquicklaunch.cpp b/plugin-quicklaunch/lxqtquicklaunch.cpp deleted file mode 100644 index 6709b64..0000000 --- a/plugin-quicklaunch/lxqtquicklaunch.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2012 Razor team - * Authors: - * Petr Vanek - * Kuzma Shapran - * - * 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 "lxqtquicklaunch.h" -#include "quicklaunchbutton.h" -#include "quicklaunchaction.h" -#include "../panel/ilxqtpanelplugin.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../panel/pluginsettings.h" - - -LXQtQuickLaunch::LXQtQuickLaunch(ILXQtPanelPlugin *plugin, QWidget* parent) : - QFrame(parent), - mPlugin(plugin), - mPlaceHolder(0) -{ - setAcceptDrops(true); - - mLayout = new LXQt::GridLayout(this); - setLayout(mLayout); - - QString desktop; - QString file; - QString execname; - QString exec; - QString icon; - for (const QMap &app : mPlugin->settings()->readArray("apps")) - { - desktop = app.value("desktop", "").toString(); - file = app.value("file", "").toString(); - if (!desktop.isEmpty()) - { - XdgDesktopFile xdg; - if (!xdg.load(desktop)) - { - qDebug() << "XdgDesktopFile" << desktop << "is not valid"; - continue; - } - if (!xdg.isSuitable()) - { - qDebug() << "XdgDesktopFile" << desktop << "is not applicable"; - continue; - } - - addButton(new QuickLaunchAction(&xdg, this)); - } - else if (! file.isEmpty()) - { - addButton(new QuickLaunchAction(file, this)); - } - else - { - execname = app.value("name", "").toString(); - exec = app.value("exec", "").toString(); - icon = app.value("icon", "").toString(); - if (icon.isNull()) - { - qDebug() << "Icon" << icon << "is not valid (isNull). Skipped."; - continue; - } - addButton(new QuickLaunchAction(execname, exec, icon, this)); - } - } // for - - if (mLayout->isEmpty()) - showPlaceHolder(); - - realign(); -} - - -LXQtQuickLaunch::~LXQtQuickLaunch() -{ -} - - -int LXQtQuickLaunch::indexOfButton(QuickLaunchButton* button) const -{ - return mLayout->indexOf(button); -} - - -int LXQtQuickLaunch::countOfButtons() const -{ - return mLayout->count(); -} - - -void LXQtQuickLaunch::realign() -{ - mLayout->setEnabled(false); - ILXQtPanel *panel = mPlugin->panel(); - - if (mPlaceHolder) - { - mLayout->setColumnCount(1); - mLayout->setRowCount(1); - } - else - { - if (panel->isHorizontal()) - { - mLayout->setRowCount(panel->lineCount()); - mLayout->setColumnCount(0); - } - else - { - mLayout->setColumnCount(panel->lineCount()); - mLayout->setRowCount(0); - } - } - mLayout->setEnabled(true); -} - - -void LXQtQuickLaunch::addButton(QuickLaunchAction* action) -{ - mLayout->setEnabled(false); - QuickLaunchButton* btn = new QuickLaunchButton(action, mPlugin, this); - mLayout->addWidget(btn); - - connect(btn, SIGNAL(switchButtons(QuickLaunchButton*,QuickLaunchButton*)), this, SLOT(switchButtons(QuickLaunchButton*,QuickLaunchButton*))); - connect(btn, SIGNAL(buttonDeleted()), this, SLOT(buttonDeleted())); - connect(btn, SIGNAL(movedLeft()), this, SLOT(buttonMoveLeft())); - connect(btn, SIGNAL(movedRight()), this, SLOT(buttonMoveRight())); - - mLayout->removeWidget(mPlaceHolder); - delete mPlaceHolder; - mPlaceHolder = 0; - mLayout->setEnabled(true); - realign(); -} - - -void LXQtQuickLaunch::dragEnterEvent(QDragEnterEvent *e) -{ - // Getting URL from mainmenu... - if (e->mimeData()->hasUrls()) - { - e->acceptProposedAction(); - return; - } - - if (e->source() && e->source()->parent() == this) - { - e->acceptProposedAction(); - } -} - - -void LXQtQuickLaunch::dropEvent(QDropEvent *e) -{ - const QMimeData *mime = e->mimeData(); - - foreach (const QUrl &url, mime->urls().toSet()) - { - QString fileName(url.isLocalFile() ? url.toLocalFile() : url.url()); - QFileInfo fi(fileName); - XdgDesktopFile xdg; - - if (xdg.load(fileName)) - { - if (xdg.isSuitable()) - addButton(new QuickLaunchAction(&xdg, this)); - } - else if (fi.exists() && fi.isExecutable() && !fi.isDir()) - { - addButton(new QuickLaunchAction(fileName, fileName, "", this)); - } - else if (fi.exists()) - { - addButton(new QuickLaunchAction(fileName, this)); - } - else - { - qWarning() << "XdgDesktopFile" << fileName << "is not valid"; - QMessageBox::information(this, tr("Drop Error"), - tr("File/URL '%1' cannot be embedded into QuickLaunch for now").arg(fileName) - ); - } - } - saveSettings(); -} - -void LXQtQuickLaunch::switchButtons(QuickLaunchButton *button1, QuickLaunchButton *button2) -{ - if (button1 == button2) - return; - - int n1 = mLayout->indexOf(button1); - int n2 = mLayout->indexOf(button2); - - int l = qMin(n1, n2); - int m = qMax(n1, n2); - - mLayout->moveItem(l, m); - mLayout->moveItem(m-1, l); - saveSettings(); -} - - -void LXQtQuickLaunch::buttonDeleted() -{ - QuickLaunchButton *btn = qobject_cast(sender()); - if (!btn) - return; - - mLayout->removeWidget(btn); - btn->deleteLater(); - saveSettings(); - - if (mLayout->isEmpty()) - showPlaceHolder(); - - realign(); -} - - -void LXQtQuickLaunch::buttonMoveLeft() -{ - QuickLaunchButton *btn = qobject_cast(sender()); - if (!btn) - return; - - int index = indexOfButton(btn); - if (index > 0) - { - mLayout->moveItem(index, index - 1); - saveSettings(); - } -} - - -void LXQtQuickLaunch::buttonMoveRight() -{ - QuickLaunchButton *btn1 = qobject_cast(sender()); - if (!btn1) - return; - - int index = indexOfButton(btn1); - if (index < countOfButtons() - 1) - { - mLayout->moveItem(index, index + 1); - saveSettings(); - } -} - - -void LXQtQuickLaunch::saveSettings() -{ - PluginSettings *settings = mPlugin->settings(); - settings->remove("apps"); - - QList > hashList; - int size = mLayout->count(); - for (int j = 0; j < size; ++j) - { - QuickLaunchButton *b = qobject_cast(mLayout->itemAt(j)->widget()); - if (!b) - continue; - - // convert QHash to QMap - QMap map; - QHashIterator it(b->settingsMap()); - while (it.hasNext()) - { - it.next(); - map[it.key()] = it.value(); - } - hashList << map; - } - - settings->setArray("apps", hashList); -} - - -void LXQtQuickLaunch::showPlaceHolder() -{ - if (!mPlaceHolder) - { - mPlaceHolder = new QLabel(this); - mPlaceHolder->setAlignment(Qt::AlignCenter); - mPlaceHolder->setObjectName("QuickLaunchPlaceHolder"); - mPlaceHolder->setText(tr("Drop application\nicons here")); - } - - mLayout->addWidget(mPlaceHolder); -} diff --git a/plugin-quicklaunch/lxqtquicklaunch.h b/plugin-quicklaunch/lxqtquicklaunch.h deleted file mode 100644 index 274255f..0000000 --- a/plugin-quicklaunch/lxqtquicklaunch.h +++ /dev/null @@ -1,85 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2012 Razor team - * Authors: - * Petr Vanek - * Kuzma Shapran - * - * 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 LXQTQUICKLAUNCH_H -#define LXQTQUICKLAUNCH_H - -#include "../panel/lxqtpanel.h" -#include -#include - - -class XdgDesktopFile; -class QuickLaunchAction; -class QDragEnterEvent; -class QuickLaunchButton; -class QSettings; -class QLabel; - -namespace LXQt { -class GridLayout; -} - - -/*! \brief Loader for "quick launcher" icons in the panel. -\author Petr Vanek -*/ -class LXQtQuickLaunch : public QFrame -{ - Q_OBJECT - -public: - LXQtQuickLaunch(ILXQtPanelPlugin *plugin, QWidget* parent = 0); - ~LXQtQuickLaunch(); - - int indexOfButton(QuickLaunchButton* button) const; - int countOfButtons() const; - - void realign(); - -private: - LXQt::GridLayout *mLayout; - ILXQtPanelPlugin *mPlugin; - QLabel *mPlaceHolder; - - void dragEnterEvent(QDragEnterEvent *e); - void dropEvent(QDropEvent *e); - - void saveSettings(); - void showPlaceHolder(); - -private slots: - void addButton(QuickLaunchAction* action); - void switchButtons(QuickLaunchButton *button1, QuickLaunchButton *button2); - void buttonDeleted(); - void buttonMoveLeft(); - void buttonMoveRight(); -}; - -#endif diff --git a/plugin-quicklaunch/lxqtquicklaunchplugin.cpp b/plugin-quicklaunch/lxqtquicklaunchplugin.cpp deleted file mode 100644 index 043da2f..0000000 --- a/plugin-quicklaunch/lxqtquicklaunchplugin.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtquicklaunchplugin.h" -#include "lxqtquicklaunch.h" - - -LXQtQuickLaunchPlugin::LXQtQuickLaunchPlugin(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - mWidget(new LXQtQuickLaunch(this)) -{ -} - -LXQtQuickLaunchPlugin::~LXQtQuickLaunchPlugin() -{ - delete mWidget; -} - -QWidget *LXQtQuickLaunchPlugin::widget() -{ - return mWidget; -} - -void LXQtQuickLaunchPlugin::realign() -{ - mWidget->realign(); -} diff --git a/plugin-quicklaunch/lxqtquicklaunchplugin.h b/plugin-quicklaunch/lxqtquicklaunchplugin.h deleted file mode 100644 index 133418e..0000000 --- a/plugin-quicklaunch/lxqtquicklaunchplugin.h +++ /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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTQUICKLAUNCHPLUGIN_H -#define LXQTQUICKLAUNCHPLUGIN_H - -#include "../panel/ilxqtpanelplugin.h" -#include - - -class LXQtQuickLaunch; - -class LXQtQuickLaunchPlugin: public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - explicit LXQtQuickLaunchPlugin(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtQuickLaunchPlugin(); - - virtual QWidget *widget(); - virtual QString themeId() const { return "QuickLaunch"; } - virtual Flags flags() const { return NeedsHandle; } - - void realign(); - - bool isSeparate() const { return true; } - -private: - LXQtQuickLaunch *mWidget; -}; - - -class LXQtQuickLaunchPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - // Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new LXQtQuickLaunchPlugin(startupInfo); - } -}; -#endif // LXQTQUICKLAUNCHPLUGIN_H diff --git a/plugin-quicklaunch/quicklaunchaction.cpp b/plugin-quicklaunch/quicklaunchaction.cpp deleted file mode 100644 index aa03f47..0000000 --- a/plugin-quicklaunch/quicklaunchaction.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * 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 "quicklaunchaction.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -QuickLaunchAction::QuickLaunchAction(const QString & name, - const QString & exec, - const QString & icon, - QWidget * parent) - : QAction(name, parent), - m_valid(true) -{ - m_type = ActionLegacy; - - m_settingsMap["name"] = name; - m_settingsMap["exec"] = exec; - m_settingsMap["icon"] = icon; - - if (icon == "" || icon.isNull()) - setIcon(XdgIcon::defaultApplicationIcon()); - else - setIcon(QIcon(icon)); - - setData(exec); - connect(this, &QAction::triggered, this, [this] { execAction(); }); -} - -QuickLaunchAction::QuickLaunchAction(const XdgDesktopFile * xdg, - QWidget * parent) - : QAction(parent), - m_valid(true) -{ - m_type = ActionXdg; - - m_settingsMap["desktop"] = xdg->fileName(); - - QString title(xdg->localizedValue("Name").toString()); - QString gn(xdg->localizedValue("GenericName").toString()); - if (!gn.isEmpty()) - title += " (" + gn + ")"; - setText(title); - - setIcon(xdg->icon(XdgIcon::defaultApplicationIcon())); - - setData(xdg->fileName()); - connect(this, &QAction::triggered, this, [this] { execAction(); }); - - // populate the additional actions - for (auto const & action : const_cast(xdg->actions())) - { - QAction * act = new QAction{xdg->actionIcon(action), xdg->actionName(action), this}; - act->setData(action); - connect(act, &QAction::triggered, [this, act] { execAction(act->data().toString()); }); - m_addtitionalActions.push_back(act); - } -} - -QuickLaunchAction::QuickLaunchAction(const QString & fileName, QWidget * parent) - : QAction(parent), - m_valid(true) -{ - m_type = ActionFile; - setText(fileName); - setData(fileName); - - m_settingsMap["file"] = fileName; - - QFileInfo fi(fileName); - if (fi.isDir()) - { - QFileIconProvider ip; - setIcon(ip.icon(fi)); - } - else - { - QMimeDatabase db; - XdgMimeType mi(db.mimeTypeForFile(fi)); - setIcon(mi.icon()); - } - - connect(this, &QAction::triggered, this, [this] { execAction(); }); -} - -void QuickLaunchAction::execAction(QString additionalAction) -{ - QString exec(data().toString()); - qDebug() << "execAction" << exec; - switch (m_type) - { - case ActionLegacy: - QProcess::startDetached(exec); - break; - case ActionXdg: - { - XdgDesktopFile xdg; - if(xdg.load(exec)) - { - if (additionalAction.isEmpty()) - xdg.startDetached(); - else - xdg.actionActivate(additionalAction, QStringList{}); - } - break; - } - case ActionFile: - QDesktopServices::openUrl(QUrl(exec)); - break; - } -} diff --git a/plugin-quicklaunch/quicklaunchaction.h b/plugin-quicklaunch/quicklaunchaction.h deleted file mode 100644 index 662c392..0000000 --- a/plugin-quicklaunch/quicklaunchaction.h +++ /dev/null @@ -1,87 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * 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 QUICKLAUNCHACTION_H -#define QUICKLAUNCHACTION_H - -#include - - -class XdgDesktopFile; - - -/*! \brief Special action representation for LXQtQuickLaunch plugin. -It supports XDG desktop files or "legacy" launching of specified apps. -All process management is handled internally. -\author Petr Vanek -*/ -class QuickLaunchAction : public QAction -{ - Q_OBJECT - -public: - /*! Constructor for "legacy" launchers. - \warning The XDG way is preferred this is only for older or non-standard apps - \param name a name to display in tooltip - \param exec a executable with path - \param icon a valid QIcon - */ - QuickLaunchAction(const QString & name, - const QString & exec, - const QString & icon, - QWidget * parent); - /*! Constructor for XDG desktop handlers. - */ - QuickLaunchAction(const XdgDesktopFile * xdg, QWidget * parent); - /*! Constructor for regular files - */ - QuickLaunchAction(const QString & fileName, QWidget * parent); - - //! Returns true if the action is valid (contains all required properties). - bool isValid() { return m_valid; } - - QHash settingsMap() { return m_settingsMap; } - - /*! Returns list of additional actions to present for user (in menu). - * Currently there are only "Addtitional application actions" for the ActionXdg type - * (the [Desktop Action %s] in .desktop files) - */ - QList addtitionalActions() const { return m_addtitionalActions; } - -public slots: - void execAction(QString additionalAction = QString{}); - -private: - enum ActionType { ActionLegacy, ActionXdg, ActionFile }; - ActionType m_type; - QString m_data; - bool m_valid; - QHash m_settingsMap; - QList m_addtitionalActions; -}; - -#endif diff --git a/plugin-quicklaunch/quicklaunchbutton.cpp b/plugin-quicklaunch/quicklaunchbutton.cpp deleted file mode 100644 index 6b6644b..0000000 --- a/plugin-quicklaunch/quicklaunchbutton.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * 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 "quicklaunchbutton.h" -#include "lxqtquicklaunch.h" -#include "../panel/ilxqtpanelplugin.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#define MIMETYPE "x-lxqt/quicklaunch-button" - - -QuickLaunchButton::QuickLaunchButton(QuickLaunchAction * act, ILXQtPanelPlugin * plugin, QWidget * parent) - : QToolButton(parent), - mAct(act), - mPlugin(plugin) -{ - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setAcceptDrops(true); - setAutoRaise(true); - - setDefaultAction(mAct); - mAct->setParent(this); - - mMoveLeftAct = new QAction(XdgIcon::fromTheme("go-previous"), tr("Move left"), this); - connect(mMoveLeftAct, SIGNAL(triggered()), this, SIGNAL(movedLeft())); - - mMoveRightAct = new QAction(XdgIcon::fromTheme("go-next"), tr("Move right"), this); - connect(mMoveRightAct, SIGNAL(triggered()), this, SIGNAL(movedRight())); - - - mDeleteAct = new QAction(XdgIcon::fromTheme("dialog-close"), tr("Remove from quicklaunch"), this); - connect(mDeleteAct, SIGNAL(triggered()), this, SLOT(selfRemove())); - addAction(mDeleteAct); - mMenu = new QMenu(this); - mMenu->addAction(mAct); - mMenu->addActions(mAct->addtitionalActions()); - mMenu->addSeparator(); - mMenu->addAction(mMoveLeftAct); - mMenu->addAction(mMoveRightAct); - mMenu->addSeparator(); - mMenu->addAction(mDeleteAct); - - - setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), - this, SLOT(this_customContextMenuRequested(const QPoint&))); -} - - -QuickLaunchButton::~QuickLaunchButton() -{ - //m_act->deleteLater(); -} - - -QHash QuickLaunchButton::settingsMap() -{ - Q_ASSERT(mAct); - return mAct->settingsMap(); -} - - -void QuickLaunchButton::this_customContextMenuRequested(const QPoint & pos) -{ - LXQtQuickLaunch *panel = qobject_cast(parent()); - - mMoveLeftAct->setEnabled( panel && panel->indexOfButton(this) > 0); - mMoveRightAct->setEnabled(panel && panel->indexOfButton(this) < panel->countOfButtons() - 1); - mPlugin->willShowWindow(mMenu); - mMenu->popup(mPlugin->panel()->calculatePopupWindowPos(mapToGlobal({0, 0}), mMenu->sizeHint()).topLeft()); -} - - -void QuickLaunchButton::selfRemove() -{ - emit buttonDeleted(); -} - - -void QuickLaunchButton::paintEvent(QPaintEvent *) -{ - // Do not paint that ugly "has menu" arrow - QStylePainter p(this); - QStyleOptionToolButton opt; - initStyleOption(&opt); - opt.features &= (~ QStyleOptionToolButton::HasMenu); - p.drawComplexControl(QStyle::CC_ToolButton, opt); -} - - -void QuickLaunchButton::mousePressEvent(QMouseEvent *e) -{ - if (e->button() == Qt::LeftButton && e->modifiers() == Qt::ControlModifier) - { - mDragStart = e->pos(); - return; - } - - QToolButton::mousePressEvent(e); -} - - -void QuickLaunchButton::mouseMoveEvent(QMouseEvent *e) -{ - if (!(e->buttons() & Qt::LeftButton)) - { - return; - } - - if ((e->pos() - mDragStart).manhattanLength() < QApplication::startDragDistance()) - { - return; - } - - if (e->modifiers() != Qt::ControlModifier) - { - return; - } - - QDrag *drag = new QDrag(this); - ButtonMimeData *mimeData = new ButtonMimeData(); - mimeData->setButton(this); - drag->setMimeData(mimeData); - - drag->exec(Qt::MoveAction); - - // Icon was droped outside the panel, remove button - if (!drag->target()) - { - selfRemove(); - } -} - - -void QuickLaunchButton::dragMoveEvent(QDragMoveEvent * e) -{ - if (e->mimeData()->hasFormat(MIMETYPE)) - e->acceptProposedAction(); - else - e->ignore(); -} - - -void QuickLaunchButton::dragEnterEvent(QDragEnterEvent *e) -{ - const ButtonMimeData *mimeData = qobject_cast(e->mimeData()); - if (mimeData && mimeData->button()) - { - emit switchButtons(mimeData->button(), this); - } -} diff --git a/plugin-quicklaunch/quicklaunchbutton.h b/plugin-quicklaunch/quicklaunchbutton.h deleted file mode 100644 index 5d79133..0000000 --- a/plugin-quicklaunch/quicklaunchbutton.h +++ /dev/null @@ -1,94 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2012 Razor team - * Authors: - * Petr Vanek - * Kuzma Shapran - * - * 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 LXQTQUICKLAUNCHBUTTON_H -#define LXQTQUICKLAUNCHBUTTON_H - -#include "quicklaunchaction.h" -#include -#include - -class ILXQtPanelPlugin; - -class QuickLaunchButton : public QToolButton -{ - Q_OBJECT - -public: - QuickLaunchButton(QuickLaunchAction * act, ILXQtPanelPlugin * plugin, QWidget* parent = 0); - ~QuickLaunchButton(); - - QHash settingsMap(); - -signals: - void buttonDeleted(); - void switchButtons(QuickLaunchButton *from, QuickLaunchButton *to); - void movedLeft(); - void movedRight(); - -protected: - //! Disable that annoying small arrow when there is a menu - virtual void paintEvent(QPaintEvent *); - void mousePressEvent(QMouseEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void dragEnterEvent(QDragEnterEvent *e); - void dragMoveEvent(QDragMoveEvent * e); - -private: - QuickLaunchAction *mAct; - ILXQtPanelPlugin * mPlugin; - QAction *mDeleteAct; - QAction *mMoveLeftAct; - QAction *mMoveRightAct; - QMenu *mMenu; - QPoint mDragStart; - -private slots: - void this_customContextMenuRequested(const QPoint & pos); - void selfRemove(); -}; - - -class ButtonMimeData: public QMimeData -{ - Q_OBJECT -public: - ButtonMimeData(): - QMimeData(), - mButton(0) - { - } - - QuickLaunchButton *button() const { return mButton; } - void setButton(QuickLaunchButton *button) { mButton = button; } -private: - QuickLaunchButton *mButton; -}; - -#endif diff --git a/plugin-quicklaunch/resources/quicklaunch.desktop.in b/plugin-quicklaunch/resources/quicklaunch.desktop.in deleted file mode 100644 index 4ecc0a0..0000000 --- a/plugin-quicklaunch/resources/quicklaunch.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. -Icon=quickopen - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-quicklaunch/translations/quicklaunch_ar.desktop b/plugin-quicklaunch/translations/quicklaunch_ar.desktop deleted file mode 100644 index cf870b1..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[ar]=نفاذ مباشر لتطبيقاتك المفضّلة. -Name[ar]=إطلاق سريع diff --git a/plugin-quicklaunch/translations/quicklaunch_cs.desktop b/plugin-quicklaunch/translations/quicklaunch_cs.desktop deleted file mode 100644 index 8832686..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Spouštěte své oblíbené programy -Name[cs]=Rychlé spouštění diff --git a/plugin-quicklaunch/translations/quicklaunch_cs_CZ.desktop b/plugin-quicklaunch/translations/quicklaunch_cs_CZ.desktop deleted file mode 100644 index 016641b..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Spusťte své oblíbené programy -Name[cs_CZ]=Rychlé spuštění diff --git a/plugin-quicklaunch/translations/quicklaunch_da.desktop b/plugin-quicklaunch/translations/quicklaunch_da.desktop deleted file mode 100644 index b2ce385..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. -Icon=quickopen - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Hurtigstart -Comment[da]=Nem adgang til dine favoritprogrammer. diff --git a/plugin-quicklaunch/translations/quicklaunch_de.desktop b/plugin-quicklaunch/translations/quicklaunch_de.desktop deleted file mode 100644 index 1cfaefd..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Schnellstarter -Comment[de]=Starten Sie Ihre Lieblingsanwendungen diff --git a/plugin-quicklaunch/translations/quicklaunch_el.desktop b/plugin-quicklaunch/translations/quicklaunch_el.desktop deleted file mode 100644 index fcb7155..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Γρήγορη εκκίνηση -Comment[el]=Εύκολη πρόσβαση στις αγαπημένες σας εφαρμογές diff --git a/plugin-quicklaunch/translations/quicklaunch_eo.desktop b/plugin-quicklaunch/translations/quicklaunch_eo.desktop deleted file mode 100644 index ca19b48..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_eo.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eo]=Lanĉu viajn preferatajn aplikaĵojn -Name[eo]=Rapidlanĉo diff --git a/plugin-quicklaunch/translations/quicklaunch_es.desktop b/plugin-quicklaunch/translations/quicklaunch_es.desktop deleted file mode 100644 index 57421ef..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Lanze sus aplicaciones favoritas -Name[es]=Lanzador rápido diff --git a/plugin-quicklaunch/translations/quicklaunch_es_VE.desktop b/plugin-quicklaunch/translations/quicklaunch_es_VE.desktop deleted file mode 100644 index 090c778..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Iconos lanzadores de tus aplicaciones favoritas -Name[es_VE]=Lanzadores diff --git a/plugin-quicklaunch/translations/quicklaunch_eu.desktop b/plugin-quicklaunch/translations/quicklaunch_eu.desktop deleted file mode 100644 index 5dd9f7f..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Zure gogoko aplikazioetarako sarbide erraza -Name[eu]=Abio azkarra diff --git a/plugin-quicklaunch/translations/quicklaunch_fi.desktop b/plugin-quicklaunch/translations/quicklaunch_fi.desktop deleted file mode 100644 index 1df3c33..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Käynnistä suosikkisovelluksesi -Name[fi]=Pikakäynnistys diff --git a/plugin-quicklaunch/translations/quicklaunch_fr.desktop b/plugin-quicklaunch/translations/quicklaunch_fr.desktop deleted file mode 100644 index 1ca1fcf..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Comment[fr]=Lancer votre application favorite -Name[fr]=Lancement rapide diff --git a/plugin-quicklaunch/translations/quicklaunch_hu.desktop b/plugin-quicklaunch/translations/quicklaunch_hu.desktop deleted file mode 100644 index 45c0c17..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=A kedvenc alkalmazásainak indítása -Name[hu]=Gyorsindító diff --git a/plugin-quicklaunch/translations/quicklaunch_ia.desktop b/plugin-quicklaunch/translations/quicklaunch_ia.desktop deleted file mode 100644 index 0f0ec1d..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_ia.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quicklaunch -Comment=Launch your favorite Applications - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-quicklaunch/translations/quicklaunch_id_ID.desktop b/plugin-quicklaunch/translations/quicklaunch_id_ID.desktop deleted file mode 100644 index 63ffd48..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_id_ID.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[id_ID]=Luncurkan aplikasi favorit anda -Name[id_ID]=Quicklaunch diff --git a/plugin-quicklaunch/translations/quicklaunch_it.desktop b/plugin-quicklaunch/translations/quicklaunch_it.desktop deleted file mode 100644 index 466988d..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_it.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Comment[it]=Avvia le applicazioni preferite -Name[it]=Avvio rapido - diff --git a/plugin-quicklaunch/translations/quicklaunch_ja.desktop b/plugin-quicklaunch/translations/quicklaunch_ja.desktop deleted file mode 100644 index 13a1a98..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_ja.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ja]=お気に入りのアプリケーションの起動を容易にします -Name[ja]=クイック起動 diff --git a/plugin-quicklaunch/translations/quicklaunch_ko.desktop b/plugin-quicklaunch/translations/quicklaunch_ko.desktop deleted file mode 100644 index 0f0ec1d..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_ko.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quicklaunch -Comment=Launch your favorite Applications - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-quicklaunch/translations/quicklaunch_lt.desktop b/plugin-quicklaunch/translations/quicklaunch_lt.desktop deleted file mode 100644 index cd44313..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_lt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[lt]=Lengva prieiga prie jūsų mėgstamų programų -Name[lt]=Spartusis paleidimas diff --git a/plugin-quicklaunch/translations/quicklaunch_nl.desktop b/plugin-quicklaunch/translations/quicklaunch_nl.desktop deleted file mode 100644 index 5b5d933..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_nl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[nl]=Uw favoriete programma's starten -Name[nl]=Snelstarter diff --git a/plugin-quicklaunch/translations/quicklaunch_pl.desktop b/plugin-quicklaunch/translations/quicklaunch_pl.desktop deleted file mode 100644 index 687ec81..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Szybki dostęp do Twoich ulubionych aplikacji. -Name[pl]=Szybkie uruchamianie diff --git a/plugin-quicklaunch/translations/quicklaunch_pt.desktop b/plugin-quicklaunch/translations/quicklaunch_pt.desktop deleted file mode 100644 index 3c5c243..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_pt.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[pt]=Inicio rápido -Comment[pt]=Acesso rápido as suas aplicações preferidas. diff --git a/plugin-quicklaunch/translations/quicklaunch_pt_BR.desktop b/plugin-quicklaunch/translations/quicklaunch_pt_BR.desktop deleted file mode 100644 index 8f0a0d3..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Lance seus aplicativos favoritos -Name[pt_BR]=Lançador rápido diff --git a/plugin-quicklaunch/translations/quicklaunch_ro_RO.desktop b/plugin-quicklaunch/translations/quicklaunch_ro_RO.desktop deleted file mode 100644 index 7021f76..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_ro_RO.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Lansează aplicațiile favorite diff --git a/plugin-quicklaunch/translations/quicklaunch_ru.desktop b/plugin-quicklaunch/translations/quicklaunch_ru.desktop deleted file mode 100644 index 6d99881..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru]=Простой доступ к вашим любимым приложениям. -Name[ru]=Быстрый запуск \ No newline at end of file diff --git a/plugin-quicklaunch/translations/quicklaunch_sk.desktop b/plugin-quicklaunch/translations/quicklaunch_sk.desktop deleted file mode 100644 index d33399e..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_sk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sk]=Spúšťanie vašich obľúbených aplikácií -Name[sk]=Rýchle spustenie diff --git a/plugin-quicklaunch/translations/quicklaunch_sl.desktop b/plugin-quicklaunch/translations/quicklaunch_sl.desktop deleted file mode 100644 index 2fc78dd..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_sl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sl]=Zaženite svoje priljubljene programe -Name[sl]=Hitri zagon diff --git a/plugin-quicklaunch/translations/quicklaunch_sr.desktop b/plugin-quicklaunch/translations/quicklaunch_sr.desktop deleted file mode 100644 index 3be634d..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_sr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr]=Покреће ваше омиљене програме -Name[sr]=Брзо покретање diff --git a/plugin-quicklaunch/translations/quicklaunch_sr@ijekavian.desktop b/plugin-quicklaunch/translations/quicklaunch_sr@ijekavian.desktop deleted file mode 100644 index b3965db..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_sr@ijekavian.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavian]=Брзо покретање -Comment[sr@ijekavian]=Покреће ваше омиљене програме diff --git a/plugin-quicklaunch/translations/quicklaunch_sr@ijekavianlatin.desktop b/plugin-quicklaunch/translations/quicklaunch_sr@ijekavianlatin.desktop deleted file mode 100644 index ec3f6f9..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavianlatin]=Brzo pokretanje -Comment[sr@ijekavianlatin]=Pokreće vaše omiljene programe diff --git a/plugin-quicklaunch/translations/quicklaunch_sr@latin.desktop b/plugin-quicklaunch/translations/quicklaunch_sr@latin.desktop deleted file mode 100644 index 02c4cbb..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_sr@latin.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr@latin]=Pokreće vaše omiljene programe -Name[sr@latin]=Brzo pokretanje diff --git a/plugin-quicklaunch/translations/quicklaunch_th_TH.desktop b/plugin-quicklaunch/translations/quicklaunch_th_TH.desktop deleted file mode 100644 index 44f4976..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=เรียกใช้งานโปรแกรมที่ชื่นชอบของคุณ -Name[th_TH]=ตัวเรียกโปรแกรมด่วน diff --git a/plugin-quicklaunch/translations/quicklaunch_tr.desktop b/plugin-quicklaunch/translations/quicklaunch_tr.desktop deleted file mode 100644 index fe7eb67..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_tr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[tr]=Sık kullanılan uygulamalarınızı çalıştırın -Name[tr]=Hızlı çalıştırıcı diff --git a/plugin-quicklaunch/translations/quicklaunch_uk.desktop b/plugin-quicklaunch/translations/quicklaunch_uk.desktop deleted file mode 100644 index efbc3ec..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Простіше запускайте улюблені програми -Name[uk]=Швидкий запуск diff --git a/plugin-quicklaunch/translations/quicklaunch_zh_CN.GB2312.desktop b/plugin-quicklaunch/translations/quicklaunch_zh_CN.GB2312.desktop deleted file mode 100644 index 0f0ec1d..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_zh_CN.GB2312.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quicklaunch -Comment=Launch your favorite Applications - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-quicklaunch/translations/quicklaunch_zh_CN.desktop b/plugin-quicklaunch/translations/quicklaunch_zh_CN.desktop deleted file mode 100644 index 91e2ded..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=启动常用程序 -Name[zh_CN]=快速启动 diff --git a/plugin-quicklaunch/translations/quicklaunch_zh_TW.desktop b/plugin-quicklaunch/translations/quicklaunch_zh_TW.desktop deleted file mode 100644 index b144cf8..0000000 --- a/plugin-quicklaunch/translations/quicklaunch_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Quick launch -Comment=Easy access to your favourite applications. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=啟動您最愛的應用程式 -Name[zh_TW]=快速啟動 diff --git a/plugin-sensors/CMakeLists.txt b/plugin-sensors/CMakeLists.txt deleted file mode 100644 index a7f7956..0000000 --- a/plugin-sensors/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -set(PLUGIN "sensors") - -set(HEADERS - lxqtsensorsplugin.h - chip.h - feature.h - lxqtsensors.h - lxqtsensorsconfiguration.h - sensors.h -) - -set(SOURCES - lxqtsensorsplugin.cpp - chip.cpp - feature.cpp - lxqtsensors.cpp - lxqtsensorsconfiguration.cpp - sensors.cpp -) - -set(UIS - lxqtsensorsconfiguration.ui -) - -set(LIBRARIES ${SENSORS_LIB}) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-sensors/chip.cpp b/plugin-sensors/chip.cpp deleted file mode 100644 index 09379f9..0000000 --- a/plugin-sensors/chip.cpp +++ /dev/null @@ -1,63 +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: - * Łukasz Twarduś - * - * 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 "chip.h" -#include - - -Chip::Chip(const sensors_chip_name* sensorsChipName) - : mSensorsChipName(sensorsChipName) -{ - const int BUF_SIZE = 256; - char buf[BUF_SIZE]; - if (sensors_snprintf_chip_name(buf, BUF_SIZE, mSensorsChipName) > 0) - { - mName = QString::fromLatin1(buf); - } - - qDebug() << "Detected chip:" << mName; - - const sensors_feature* feature; - int featureNr = 0; - - while ((feature = sensors_get_features(mSensorsChipName, &featureNr))) - { - mFeatures.push_back(Feature(mSensorsChipName, feature)); - } -} - - -const QString& Chip::getName() const -{ - return mName; -} - - -const QList& Chip::getFeatures() const -{ - return mFeatures; -} diff --git a/plugin-sensors/chip.h b/plugin-sensors/chip.h deleted file mode 100644 index 2993e95..0000000 --- a/plugin-sensors/chip.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: - * Łukasz Twarduś - * - * 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 CHIP_H -#define CHIP_H - -#include "feature.h" -#include "sensors.h" -#include -#include - - -/** - * @brief Chip class is providing RAII-style for lm_sensors library - */ - -class Chip -{ -public: - Chip(const sensors_chip_name*); - const QString& getName() const; - const QList& getFeatures() const; - -private: - // Do not try to change these chip names, as they point to internal structures of lm_sensors! - const sensors_chip_name* mSensorsChipName; - - // "Printable" chip name - QString mName; - - QList mFeatures; -}; - -#endif // CHIP_H diff --git a/plugin-sensors/feature.cpp b/plugin-sensors/feature.cpp deleted file mode 100644 index 169f253..0000000 --- a/plugin-sensors/feature.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: 2012 Razor team - * Authors: - * Łukasz Twarduś - * - * 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 "feature.h" -#include - - -Feature::Feature(const sensors_chip_name* sensorsChipName, const sensors_feature* sensorsFeature) - : mSensorsChipName(sensorsChipName), - mSensorsFeature(sensorsFeature) -{ - char *featureLabel = NULL; - - if ((featureLabel = sensors_get_label(mSensorsChipName, mSensorsFeature))) - { - mLabel = featureLabel; - free(featureLabel); - } - - qDebug() << "Detected feature:" << QString::fromLatin1(sensorsFeature->name) - << "(" << mLabel << ")"; -} - - -const QString& Feature::getLabel() const -{ - return mLabel; -} - - -double Feature::getValue(sensors_subfeature_type subfeature_type) const -{ - double result = 0; - - const sensors_subfeature *subfeature; - - // Find feature - subfeature = sensors_get_subfeature(mSensorsChipName, mSensorsFeature, subfeature_type); - - if (subfeature) - { - sensors_get_value(mSensorsChipName, subfeature->number, &result); - } - - return result; -} - - -sensors_feature_type Feature::getType() const -{ - return mSensorsFeature->type; -} diff --git a/plugin-sensors/feature.h b/plugin-sensors/feature.h deleted file mode 100644 index 1f6c620..0000000 --- a/plugin-sensors/feature.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: - * Łukasz Twarduś - * - * 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 FEATURE_H -#define FEATURE_H - -#include -#include -#include - - -/** - * @brief Feature class is providing RAII-style for lm_sensors library - */ - -class Feature -{ -public: - Feature(const sensors_chip_name*, const sensors_feature*); - const QString& getName() const; - const QString& getLabel() const; - double getValue(sensors_subfeature_type) const; - sensors_feature_type getType() const; -private: - // Do not try to change these chip names, as they point to internal structures of lm_sensors! - const sensors_chip_name* mSensorsChipName; - - const sensors_feature* mSensorsFeature; - - // "Printable" feature label - QString mLabel; - - QList mSubFeatures; -}; - -#endif // CHIP_H diff --git a/plugin-sensors/lxqtsensors.cpp b/plugin-sensors/lxqtsensors.cpp deleted file mode 100644 index 2dc9506..0000000 --- a/plugin-sensors/lxqtsensors.cpp +++ /dev/null @@ -1,456 +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: - * Łukasz Twarduś - * - * 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 "lxqtsensors.h" -#include "lxqtsensorsconfiguration.h" -#include "../panel/ilxqtpanelplugin.h" -#include "../panel/ilxqtpanel.h" -#include -#include -#include -#include - -static constexpr double DEFAULT_MAX = 200; // 200 Celsius - -LXQtSensors::LXQtSensors(ILXQtPanelPlugin *plugin, QWidget* parent): - QFrame(parent), - mPlugin(plugin), - mSettings(plugin->settings()) -{ - - mDetectedChips = mSensors.getDetectedChips(); - - /** - * We have all needed data to initialize default settings, we have to do it here as later - * we are using them. - */ - initDefaultSettings(); - - // Add GUI elements - ProgressBar* pg = NULL; - - mLayout = new QBoxLayout(QBoxLayout::LeftToRight, this); - mLayout->setSpacing(0); - mLayout->setContentsMargins(0, 0, 0, 0); - - QString chipFeatureLabel; - - mSettings->beginGroup("chips"); - - for (int i = 0; i < mDetectedChips.size(); ++i) - { - mSettings->beginGroup(mDetectedChips[i].getName()); - const QList& features = mDetectedChips[i].getFeatures(); - - for (int j = 0; j < features.size(); ++j) - { - if (features[j].getType() == SENSORS_FEATURE_TEMP) - { - chipFeatureLabel = features[j].getLabel(); - mSettings->beginGroup(chipFeatureLabel); - - pg = new ProgressBar(this); - pg->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - - // Hide progress bar if it is not enabled - if (!mSettings->value("enabled").toBool()) - { - pg->hide(); - } - - pg->setToolTip(chipFeatureLabel); - pg->setTextVisible(false); - - QPalette pal = pg->palette(); - QColor color(mSettings->value("color").toString()); - pal.setColor(QPalette::Active, QPalette::Highlight, color); - pal.setColor(QPalette::Inactive, QPalette::Highlight, color); - pg->setPalette(pal); - - mTemperatureProgressBars.push_back(pg); - mLayout->addWidget(pg); - - mSettings->endGroup(); - } - } - mSettings->endGroup(); - } - - mSettings->endGroup(); - - // Fit plugin to current panel - realign(); - - // Updated sensors readings to display actual values at start - updateSensorReadings(); - - // Run timer that will be updating sensor readings - connect(&mUpdateSensorReadingsTimer, SIGNAL(timeout()), this, SLOT(updateSensorReadings())); - mUpdateSensorReadingsTimer.start(mSettings->value("updateInterval").toInt() * 1000); - - // Run timer that will be showin warning - mWarningAboutHighTemperatureTimer.setInterval(500); - connect(&mWarningAboutHighTemperatureTimer, SIGNAL(timeout()), this, - SLOT(warningAboutHighTemperature())); - if (mSettings->value("warningAboutHighTemperature").toBool()) - { - mWarningAboutHighTemperatureTimer.start(); - } -} - - -LXQtSensors::~LXQtSensors() -{ -} - - -void LXQtSensors::updateSensorReadings() -{ - QString tooltip; - - double critTemp = 0; - double maxTemp = 0; - double minTemp = 0; - double curTemp = 0; - bool highTemperature = false; - - // Iterator for temperature progress bars - QList::iterator temperatureProgressBarsIt = - mTemperatureProgressBars.begin(); - const bool use_fahrenheit = mSettings->value("useFahrenheitScale").toBool(); - const bool warn_high = mSettings->value("warningAboutHighTemperature").toBool(); - const double default_max = use_fahrenheit ? celsiusToFahrenheit(DEFAULT_MAX) : DEFAULT_MAX; - - for (int i = 0; i < mDetectedChips.size(); ++i) - { - const QList& features = mDetectedChips[i].getFeatures(); - - for (int j = 0; j < features.size(); ++j) - { - if (features[j].getType() == SENSORS_FEATURE_TEMP) - { - tooltip = features[j].getLabel() + " (" + QChar(0x00B0); - - critTemp = features[j].getValue(SENSORS_SUBFEATURE_TEMP_CRIT); - maxTemp = features[j].getValue(SENSORS_SUBFEATURE_TEMP_MAX); - minTemp = features[j].getValue(SENSORS_SUBFEATURE_TEMP_MIN); - curTemp = features[j].getValue(SENSORS_SUBFEATURE_TEMP_INPUT); - - double temp_to_check = maxTemp == 0.0 ? critTemp : maxTemp; - - // Check if temperature is too high - if (temp_to_check != 0.0 && curTemp >= temp_to_check) - { - if (warn_high) - { - // Add current progress bar to the "warning container" - mHighTemperatureProgressBars.insert(*temperatureProgressBarsIt); - } - - highTemperature = true; - } - else - { - mHighTemperatureProgressBars.remove(*temperatureProgressBarsIt); - - highTemperature = false; - } - - if (use_fahrenheit) - { - critTemp = celsiusToFahrenheit(critTemp); - maxTemp = celsiusToFahrenheit(maxTemp); - minTemp = celsiusToFahrenheit(minTemp); - curTemp = celsiusToFahrenheit(curTemp); - - tooltip += "F)"; - } - else - { - tooltip += "C)"; - } - - - // Set maximum temperature - (*temperatureProgressBarsIt)->setMaximum(critTemp == 0.0 ? default_max : critTemp); - // Set minimum temperature - (*temperatureProgressBarsIt)->setMinimum(minTemp); - // Set current temperature - (*temperatureProgressBarsIt)->setValue(curTemp); - - tooltip += "

Crit: "; - tooltip += QString::number((*temperatureProgressBarsIt)->maximum()); - tooltip += "
Max: "; - tooltip += QString::number(int(maxTemp)); - tooltip += "
Cur: "; - - // Mark high temperature in the tooltip - if (highTemperature) - { - tooltip += ""; - tooltip += QString::number((*temperatureProgressBarsIt)->value()); - tooltip += " !"; - } - else - { - tooltip += QString::number((*temperatureProgressBarsIt)->value()); - } - - tooltip += "
Min: "; - tooltip += QString::number((*temperatureProgressBarsIt)->minimum()); - (*temperatureProgressBarsIt)->setToolTip(tooltip); - - // Go to the next temperature progress bar - ++temperatureProgressBarsIt; - } - } - } - - update(); -} - - -void LXQtSensors::warningAboutHighTemperature() -{ - // Iterator for temperature progress bars - QSet::iterator temperatureProgressBarsIt = - mHighTemperatureProgressBars.begin(); - - int curValue; - int maxValue; - - for (; temperatureProgressBarsIt != mHighTemperatureProgressBars.end(); - ++temperatureProgressBarsIt) - { - curValue = (*temperatureProgressBarsIt)->value(); - maxValue = (*temperatureProgressBarsIt)->maximum(); - - if (maxValue > curValue) - { - (*temperatureProgressBarsIt)->setValue(maxValue); - } - else - { - (*temperatureProgressBarsIt)->setValue((*temperatureProgressBarsIt)->minimum()); - } - - } - update(); -} - - -void LXQtSensors::settingsChanged() -{ - mUpdateSensorReadingsTimer.setInterval(mSettings->value("updateInterval").toInt() * 1000); - - // Iterator for temperature progress bars - QList::iterator temperatureProgressBarsIt = - mTemperatureProgressBars.begin(); - - mSettings->beginGroup("chips"); - - for (int i = 0; i < mDetectedChips.size(); ++i) - { - mSettings->beginGroup(mDetectedChips[i].getName()); - const QList& features = mDetectedChips[i].getFeatures(); - - for (int j = 0; j < features.size(); ++j) - { - if (features[j].getType() == SENSORS_FEATURE_TEMP) - { - mSettings->beginGroup(features[j].getLabel()); - - if (mSettings->value("enabled").toBool()) - { - (*temperatureProgressBarsIt)->show(); - } - else - { - (*temperatureProgressBarsIt)->hide(); - } - - QPalette pal = (*temperatureProgressBarsIt)->palette(); - QColor color(mSettings->value("color").toString()); - pal.setColor(QPalette::Active, QPalette::Highlight, color); - pal.setColor(QPalette::Inactive, QPalette::Highlight, color); - (*temperatureProgressBarsIt)->setPalette(pal); - - mSettings->endGroup(); - - // Go to the next temperature progress bar - ++temperatureProgressBarsIt; - } - } - - mSettings->endGroup(); - } - - mSettings->endGroup(); - - - if (mSettings->value("warningAboutHighTemperature").toBool()) - { - // Update sensors readings to get the list of high temperature progress bars - updateSensorReadings(); - - if (!mWarningAboutHighTemperatureTimer.isActive()) - mWarningAboutHighTemperatureTimer.start(); - } - else if (mWarningAboutHighTemperatureTimer.isActive()) - { - mWarningAboutHighTemperatureTimer.stop(); - - // Update sensors readings to set progress bar values to "normal" height - updateSensorReadings(); - } - - realign(); - update(); -} - - -void LXQtSensors::realign() -{ - // Default values for LXQtPanel::PositionBottom or LXQtPanel::PositionTop - Qt::Orientation cur_orient = Qt::Vertical; - Qt::LayoutDirection cur_layout_dir = Qt::LeftToRight; - - if (mPlugin->panel()->isHorizontal()) - { - mLayout->setDirection(QBoxLayout::LeftToRight); - } - else - { - mLayout->setDirection(QBoxLayout::TopToBottom); - } - - switch (mPlugin->panel()->position()) - { - case ILXQtPanel::PositionLeft: - cur_orient = Qt::Horizontal; - break; - - case ILXQtPanel::PositionRight: - cur_orient = Qt::Horizontal; - cur_layout_dir = Qt::RightToLeft; - break; - - default: - break; - } - - for (int i = 0; i < mTemperatureProgressBars.size(); ++i) - { - mTemperatureProgressBars[i]->setOrientation(cur_orient); - mTemperatureProgressBars[i]->setLayoutDirection(cur_layout_dir); - - if (mPlugin->panel()->isHorizontal()) - { - mTemperatureProgressBars[i]->setFixedWidth(mPlugin->settings()->value("tempBarWidth").toInt()); - mTemperatureProgressBars[i]->setFixedHeight(QWIDGETSIZE_MAX); - } - else - { - mTemperatureProgressBars[i]->setFixedHeight(mPlugin->settings()->value("tempBarWidth").toInt()); - mTemperatureProgressBars[i]->setFixedWidth(QWIDGETSIZE_MAX); - } - } -} - - -double LXQtSensors::celsiusToFahrenheit(double celsius) -{ - // Fahrenheit = 32 * (9/5) * Celsius - return 32 + 1.8 * celsius; -} - - -void LXQtSensors::initDefaultSettings() -{ - if (!mSettings->contains("updateInterval")) - { - mSettings->setValue("updateInterval", 1); - } - - if (!mSettings->contains("tempBarWidth")) - { - mSettings->setValue("tempBarWidth", 8); - } - - if (!mSettings->contains("useFahrenheitScale")) - { - mSettings->setValue("useFahrenheitScale", false); - } - - mSettings->beginGroup("chips"); - - // Initialize default sensors settings - for (int i = 0; i < mDetectedChips.size(); ++i) - { - mSettings->beginGroup(mDetectedChips[i].getName()); - const QList& features = mDetectedChips[i].getFeatures(); - - for (int j = 0; j < features.size(); ++j) - { - if (features[j].getType() == SENSORS_FEATURE_TEMP) - { - mSettings->beginGroup(features[j].getLabel()); - if (!mSettings->contains("enabled")) - { - mSettings->setValue("enabled", true); - } - - if (!mSettings->contains("color")) - { - // This is the default from QtDesigner - mSettings->setValue("color", QColor(qRgb(98, 140, 178)).name()); - } - mSettings->endGroup(); - } - } - mSettings->endGroup(); - } - - mSettings->endGroup(); - - if (!mSettings->contains("warningAboutHighTemperature")) - { - mSettings->setValue("warningAboutHighTemperature", true); - } -} - - -ProgressBar::ProgressBar(QWidget *parent): - QProgressBar(parent) -{ -} - - -QSize ProgressBar::sizeHint() const -{ - return QSize(20, 20); -} diff --git a/plugin-sensors/lxqtsensors.h b/plugin-sensors/lxqtsensors.h deleted file mode 100644 index ad8cac9..0000000 --- a/plugin-sensors/lxqtsensors.h +++ /dev/null @@ -1,82 +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: - * Łukasz Twarduś - * - * 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 LXQTSENSORS_H -#define LXQTSENSORS_H - -#include "sensors.h" -#include "../panel/pluginsettings.h" -#include -#include -#include -#include - - -class ProgressBar: public QProgressBar -{ - Q_OBJECT -public: - ProgressBar(QWidget *parent = 0); - - QSize sizeHint() const; -}; - - -class QSettings; -class ILXQtPanelPlugin; -class QBoxLayout; - -class LXQtSensors : public QFrame -{ - Q_OBJECT -public: - LXQtSensors(ILXQtPanelPlugin *plugin, QWidget* parent = 0); - ~LXQtSensors(); - - void settingsChanged(); - void realign(); -public slots: - void updateSensorReadings(); - void warningAboutHighTemperature(); - -private: - ILXQtPanelPlugin *mPlugin; - QBoxLayout *mLayout; - QTimer mUpdateSensorReadingsTimer; - QTimer mWarningAboutHighTemperatureTimer; - Sensors mSensors; - QList mDetectedChips; - QList mTemperatureProgressBars; - // With set we can handle updates in very easy way :) - QSet mHighTemperatureProgressBars; - double celsiusToFahrenheit(double celsius); - void initDefaultSettings(); - PluginSettings *mSettings; -}; - - -#endif // LXQTSENSORS_H diff --git a/plugin-sensors/lxqtsensorsconfiguration.cpp b/plugin-sensors/lxqtsensorsconfiguration.cpp deleted file mode 100644 index aa32b1e..0000000 --- a/plugin-sensors/lxqtsensorsconfiguration.cpp +++ /dev/null @@ -1,235 +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: - * Łukasz Twarduś - * - * 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 "lxqtsensorsconfiguration.h" -#include "ui_lxqtsensorsconfiguration.h" -#include -#include -#include -#include -#include - - -LXQtSensorsConfiguration::LXQtSensorsConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtSensorsConfiguration) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("SensorsConfigurationWindow"); - ui->setupUi(this); - - // We load settings here cause we have to set up dynamic widgets - loadSettings(); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); - connect(ui->updateIntervalSB, SIGNAL(valueChanged(int)), this, SLOT(saveSettings())); - connect(ui->tempBarWidthSB, SIGNAL(valueChanged(int)), this, SLOT(saveSettings())); - connect(ui->detectedChipsCB, SIGNAL(activated(int)), this, SLOT(detectedChipSelected(int))); - connect(ui->celsiusTempScaleRB, SIGNAL(toggled(bool)), this, SLOT(saveSettings())); - // We don't need signal from the other radio box as celsiusTempScaleRB will send one - //connect(ui->fahrenheitTempScaleRB, SIGNAL(toggled(bool)), this, SLOT(saveSettings())); - connect(ui->warningAboutHighTemperatureChB, SIGNAL(toggled(bool)), this, SLOT(saveSettings())); - - /** - * Signals for enable/disable and bar color change are set in the loadSettings method because - * we are creating them dynamically. - */ -} - - -LXQtSensorsConfiguration::~LXQtSensorsConfiguration() -{ - delete ui; -} - - -void LXQtSensorsConfiguration::loadSettings() -{ - ui->updateIntervalSB->setValue(settings().value("updateInterval").toInt()); - ui->tempBarWidthSB->setValue(settings().value("tempBarWidth").toInt()); - - if (settings().value("useFahrenheitScale").toBool()) - { - ui->fahrenheitTempScaleRB->setChecked(true); - } - - // In case of reloading settings we have to clear GUI elements - ui->detectedChipsCB->clear(); - - settings().beginGroup("chips"); - QStringList chipNames = settings().childGroups(); - - for (int i = 0; i < chipNames.size(); ++i) - { - ui->detectedChipsCB->addItem(chipNames[i]); - } - settings().endGroup(); - - // Load feature for the first chip if exist - if (chipNames.size() > 0) - { - detectedChipSelected(0); - } - - ui->warningAboutHighTemperatureChB->setChecked( - settings().value("warningAboutHighTemperature").toBool()); -} - - -void LXQtSensorsConfiguration::saveSettings() -{ - settings().setValue("updateInterval", ui->updateIntervalSB->value()); - settings().setValue("tempBarWidth", ui->tempBarWidthSB->value()); - - if (ui->fahrenheitTempScaleRB->isChecked()) - { - settings().setValue("useFahrenheitScale", true); - } - else - { - settings().setValue("useFahrenheitScale", false); - } - - settings().beginGroup("chips"); - QStringList chipNames = settings().childGroups(); - - if (chipNames.size()) - { - QStringList chipFeatureLabels; - QPushButton* colorButton = NULL; - QCheckBox* enabledCheckbox = NULL; - - settings().beginGroup(chipNames[ui->detectedChipsCB->currentIndex()]); - - chipFeatureLabels = settings().childGroups(); - for (int j = 0; j < chipFeatureLabels.size(); ++j) - { - settings().beginGroup(chipFeatureLabels[j]); - - enabledCheckbox = qobject_cast(ui->chipFeaturesT->cellWidget(j, 0)); - // We know what we are doing so we don't have to check if enabledCheckbox == 0 - settings().setValue("enabled", enabledCheckbox->isChecked()); - - colorButton = qobject_cast(ui->chipFeaturesT->cellWidget(j, 2)); - // We know what we are doing so we don't have to check if colorButton == 0 - settings().setValue( - "color", - colorButton->palette().color(QPalette::Normal, QPalette::Button).name()); - - settings().endGroup(); - } - settings().endGroup(); - - } - settings().endGroup(); - - settings().setValue("warningAboutHighTemperature", - ui->warningAboutHighTemperatureChB->isChecked()); -} - -void LXQtSensorsConfiguration::changeProgressBarColor() -{ - QAbstractButton* btn = qobject_cast(sender()); - - if (btn) - { - QPalette pal = btn->palette(); - QColor color = QColorDialog::getColor(pal.color(QPalette::Normal, QPalette::Button), this); - - if (color.isValid()) - { - pal.setColor(QPalette::Normal, QPalette::Button, color); - btn->setPalette(pal); - saveSettings(); - } - } - else - { - qDebug() << "LXQtSensorsConfiguration::changeProgressBarColor():" << "invalid button cast"; - } -} - - -void LXQtSensorsConfiguration::detectedChipSelected(int index) -{ - settings().beginGroup("chips"); - QStringList chipNames = settings().childGroups(); - QStringList chipFeatureLabels; - QPushButton* colorButton = NULL; - QCheckBox* enabledCheckbox = NULL; - QTableWidgetItem *chipFeatureLabel = NULL; - - if (index < chipNames.size()) - { - qDebug() << "Selected chip: " << ui->detectedChipsCB->currentText(); - - // In case of reloading settings we have to clear GUI elements - ui->chipFeaturesT->setRowCount(0); - - // Add detected chips and features - QStringList chipFeaturesLabels; - chipFeaturesLabels << tr("Enabled") << tr("Label") << tr("Color"); - ui->chipFeaturesT->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); - ui->chipFeaturesT->setHorizontalHeaderLabels(chipFeaturesLabels); - - settings().beginGroup(chipNames[index]); - chipFeatureLabels = settings().childGroups(); - for (int j = 0; j < chipFeatureLabels.size(); ++j) - { - settings().beginGroup(chipFeatureLabels[j]); - - ui->chipFeaturesT->insertRow(j); - - enabledCheckbox = new QCheckBox(ui->chipFeaturesT); - enabledCheckbox->setChecked(settings().value("enabled").toBool()); - // Connect here after the setChecked call because we don't want to send signal - connect(enabledCheckbox, SIGNAL(stateChanged(int)), this, SLOT(saveSettings())); - ui->chipFeaturesT->setCellWidget(j, 0, enabledCheckbox); - - chipFeatureLabel = new QTableWidgetItem(chipFeatureLabels[j]); - chipFeatureLabel->setFlags(Qt::ItemIsEnabled); - ui->chipFeaturesT->setItem(j, 1, chipFeatureLabel); - - colorButton = new QPushButton(ui->chipFeaturesT); - connect(colorButton, SIGNAL(clicked()), this, SLOT(changeProgressBarColor())); - QPalette pal = colorButton->palette(); - pal.setColor(QPalette::Normal, QPalette::Button, - QColor(settings().value("color").toString())); - colorButton->setPalette(pal); - ui->chipFeaturesT->setCellWidget(j, 2, colorButton); - - settings().endGroup(); - } - settings().endGroup(); - } - else - { - qDebug() << "Invalid chip index: " << index; - } - - settings().endGroup(); -} diff --git a/plugin-sensors/lxqtsensorsconfiguration.h b/plugin-sensors/lxqtsensorsconfiguration.h deleted file mode 100644 index 7c649cb..0000000 --- a/plugin-sensors/lxqtsensorsconfiguration.h +++ /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: 2011 Razor team - * Authors: - * Maciej Płaza - * - * 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 LXQTSENSORSCONFIGURATION_H -#define LXQTSENSORSCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" -#include -#include -#include -#include - -namespace Ui { - class LXQtSensorsConfiguration; -} - -class LXQtSensorsConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtSensorsConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~LXQtSensorsConfiguration(); - -private: - Ui::LXQtSensorsConfiguration *ui; - - /* - Read settings from conf file and put data into controls. - */ - void loadSettings(); - -private slots: - /* - Saves settings in conf file. - */ - void saveSettings(); - void changeProgressBarColor(); - void detectedChipSelected(int index); -}; - -#endif // LXQTSENSORSCONFIGURATION_H diff --git a/plugin-sensors/lxqtsensorsconfiguration.ui b/plugin-sensors/lxqtsensorsconfiguration.ui deleted file mode 100644 index 5241ed2..0000000 --- a/plugin-sensors/lxqtsensorsconfiguration.ui +++ /dev/null @@ -1,240 +0,0 @@ - - - LXQtSensorsConfiguration - - - - 0 - 0 - 271 - 284 - - - - Sensors Settings - - - - - - QTabWidget::Rounded - - - 0 - - - true - - - - Common - - - - - - - 0 - 0 - - - - Update interval (seconds) - - - - - - - Temperature bar width - - - - - - - true - - - - - - - - - - - - - - - 1 - - - 300 - - - - - - - 1 - - - 8 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Temperature scale - - - - - - Celsius - - - true - - - - - - - Fahrenheit - - - - - fahrenheitTempScaleRB - celsiusTempScaleRB - - - - - - Blink progress bars when the temperature is too high - - - Qt::LeftToRight - - - Warning about high temperature - - - true - - - false - - - - - - - - Sensors - - - - - - -1 - - - true - - - - - - - Detected chips: - - - - - - - Chip features: - - - - - - - 3 - - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - - buttons - accepted() - LXQtSensorsConfiguration - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttons - rejected() - LXQtSensorsConfiguration - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/plugin-sensors/lxqtsensorsplugin.cpp b/plugin-sensors/lxqtsensorsplugin.cpp deleted file mode 100644 index fb6c895..0000000 --- a/plugin-sensors/lxqtsensorsplugin.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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtsensorsplugin.h" -#include "lxqtsensors.h" -#include "lxqtsensorsconfiguration.h" - - -LXQtSensorsPlugin::LXQtSensorsPlugin(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - mWidget(new LXQtSensors(this)) -{ -} - - -LXQtSensorsPlugin::~LXQtSensorsPlugin() -{ - delete mWidget; -} - - -QWidget *LXQtSensorsPlugin::widget() -{ - return mWidget; -} - - -QDialog *LXQtSensorsPlugin::configureDialog() -{ - return new LXQtSensorsConfiguration(settings()); -} - - -void LXQtSensorsPlugin::realign() -{ - mWidget->realign(); -} - - -void LXQtSensorsPlugin::settingsChanged() -{ - mWidget->settingsChanged(); -} diff --git a/plugin-sensors/lxqtsensorsplugin.h b/plugin-sensors/lxqtsensorsplugin.h deleted file mode 100644 index 60d58b8..0000000 --- a/plugin-sensors/lxqtsensorsplugin.h +++ /dev/null @@ -1,74 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTSENSORSPLUGIN_H -#define LXQTSENSORSPLUGIN_H - -#include "../panel/ilxqtpanelplugin.h" -#include - - -class LXQtSensors; - -class LXQtSensorsPlugin: public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - explicit LXQtSensorsPlugin(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtSensorsPlugin(); - - virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog; } - virtual QWidget *widget(); - virtual QString themeId() const { return "Sensors"; } - - bool isSeparate() const { return true; } - QDialog *configureDialog(); - - void realign(); - -protected: - virtual void settingsChanged(); - -private: - LXQtSensors *mWidget; -}; - - -class LXQtSensorsPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new LXQtSensorsPlugin(startupInfo); - } -}; - -#endif // LXQTSENSORSPLUGIN_H diff --git a/plugin-sensors/resources/sensors.desktop.in b/plugin-sensors/resources/sensors.desktop.in deleted file mode 100644 index 89f46a6..0000000 --- a/plugin-sensors/resources/sensors.desktop.in +++ /dev/null @@ -1,5 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. diff --git a/plugin-sensors/sensors.cpp b/plugin-sensors/sensors.cpp deleted file mode 100644 index a4c0a09..0000000 --- a/plugin-sensors/sensors.cpp +++ /dev/null @@ -1,78 +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: - * Łukasz Twarduś - * - * 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 "sensors.h" -#include - - -QList Sensors::mDetectedChips = QList(); -int Sensors::mInstanceCounter = 0; -bool Sensors::mSensorsInitialized = false; - - -Sensors::Sensors() -{ - // Increase instance counter - ++mInstanceCounter; - - if (!mSensorsInitialized && sensors_init(NULL) == 0) - { - // Sensors initialized - mSensorsInitialized = true; - - sensors_chip_name const * chipName; - int chipNr = 0; - while ((chipName = sensors_get_detected_chips(NULL, &chipNr)) != NULL) - { - mDetectedChips.push_back(chipName); - } - - qDebug() << "lm_sensors library initialized"; - } -} - - -Sensors::~Sensors() -{ - // Decrease instance counter - --mInstanceCounter; - - if (mInstanceCounter == 0 && mSensorsInitialized) - { - mDetectedChips.clear(); - mSensorsInitialized = false; - sensors_cleanup(); - - qDebug() << "lm_sensors library cleanup"; - } -} - - -const QList& Sensors::getDetectedChips() const -{ - return mDetectedChips; -} diff --git a/plugin-sensors/sensors.h b/plugin-sensors/sensors.h deleted file mode 100644 index 43cd502..0000000 --- a/plugin-sensors/sensors.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: - * Łukasz Twarduś - * - * 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 SENSORS_H -#define SENSORS_H - -#include "chip.h" -#include -#include - - -class Chip; - -/** - * @brief Sensors class is providing RAII-style for lm_sensors library - */ - -class Sensors -{ -public: - Sensors(); - ~Sensors(); - const QList& getDetectedChips() const; - -private: - static QList mDetectedChips; - - /** - * lm_sensors library can be initialized only once so this will tell us when to init - * and when to clean up. - */ - static int mInstanceCounter; - static bool mSensorsInitialized; -}; - -#endif // SENSORS_H diff --git a/plugin-sensors/translations/sensors_ar.desktop b/plugin-sensors/translations/sensors_ar.desktop deleted file mode 100644 index 24d0a53..0000000 --- a/plugin-sensors/translations/sensors_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=مجسّات -Comment[ar]=تعرض قراءات من مجسّات العتاد. diff --git a/plugin-sensors/translations/sensors_ca.desktop b/plugin-sensors/translations/sensors_ca.desktop deleted file mode 100644 index d947714..0000000 --- a/plugin-sensors/translations/sensors_ca.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[ca]=Sensors -Comment[ca]=Veure dades provinents dels sensors (actualment lm_sensors) diff --git a/plugin-sensors/translations/sensors_cs.desktop b/plugin-sensors/translations/sensors_cs.desktop deleted file mode 100644 index 5e4dfcf..0000000 --- a/plugin-sensors/translations/sensors_cs.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[cs]=Čidla -Comment[cs]=Zobrazit odečty z hardwarových čidel (nyní lm_sensors) diff --git a/plugin-sensors/translations/sensors_cs_CZ.desktop b/plugin-sensors/translations/sensors_cs_CZ.desktop deleted file mode 100644 index 18e443b..0000000 --- a/plugin-sensors/translations/sensors_cs_CZ.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[cs_CZ]=Čidla -Comment[cs_CZ]=Zobrazit odečty z hardwarových čidel (nyní lm_sensors) diff --git a/plugin-sensors/translations/sensors_da.desktop b/plugin-sensors/translations/sensors_da.desktop deleted file mode 100644 index d51180c..0000000 --- a/plugin-sensors/translations/sensors_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Sensorer -Comment[da]=Vis målinger fra hardware-sensorer. diff --git a/plugin-sensors/translations/sensors_de.desktop b/plugin-sensors/translations/sensors_de.desktop deleted file mode 100644 index f71d2a6..0000000 --- a/plugin-sensors/translations/sensors_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Sensoren -Comment[de]=Messwerte der Hardware-Sensoren anzeigen. diff --git a/plugin-sensors/translations/sensors_el.desktop b/plugin-sensors/translations/sensors_el.desktop deleted file mode 100644 index e22bdc4..0000000 --- a/plugin-sensors/translations/sensors_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Αισθητήρες -Comment[el]=Προβολή ενδείξεων των αισθητήρων υλικού. diff --git a/plugin-sensors/translations/sensors_eo.desktop b/plugin-sensors/translations/sensors_eo.desktop deleted file mode 100644 index fa44479..0000000 --- a/plugin-sensors/translations/sensors_eo.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[eo]=Sentiloj -Comment[eo]=Vidi legojn de sentiloj (aktuale lm_sensors) diff --git a/plugin-sensors/translations/sensors_es.desktop b/plugin-sensors/translations/sensors_es.desktop deleted file mode 100644 index 2713065..0000000 --- a/plugin-sensors/translations/sensors_es.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[es]=Sensores -Comment[es]=Ver las lecturas de los sensores de harware (Actualmente lm_sensors) diff --git a/plugin-sensors/translations/sensors_es_VE.desktop b/plugin-sensors/translations/sensors_es_VE.desktop deleted file mode 100644 index eabbc9a..0000000 --- a/plugin-sensors/translations/sensors_es_VE.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[es_VE]=Sensores -Comment[es_VE]=Ver las lecturas desde los sensores (actualmente lm_sensors) diff --git a/plugin-sensors/translations/sensors_eu.desktop b/plugin-sensors/translations/sensors_eu.desktop deleted file mode 100644 index ad2a8bd..0000000 --- a/plugin-sensors/translations/sensors_eu.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[eu]=Sentsoreak -Comment[eu]=Ikusi hardware-sentsoreen irakurketak (unean lm_sensors) diff --git a/plugin-sensors/translations/sensors_fi.desktop b/plugin-sensors/translations/sensors_fi.desktop deleted file mode 100644 index c7f1958..0000000 --- a/plugin-sensors/translations/sensors_fi.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[fi]=Sensorit -Comment[fi]=Katso laitteistosensorien tuottamia lukuja (tällä hetkellä lm_sensors) diff --git a/plugin-sensors/translations/sensors_fr.desktop b/plugin-sensors/translations/sensors_fr.desktop deleted file mode 100644 index 74b1d71..0000000 --- a/plugin-sensors/translations/sensors_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Name[fr]=Capteurs -Comment[fr]=Voir les mesures effectuées par les capteurs diff --git a/plugin-sensors/translations/sensors_hu.desktop b/plugin-sensors/translations/sensors_hu.desktop deleted file mode 100644 index c5b9d62..0000000 --- a/plugin-sensors/translations/sensors_hu.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[hu]=Érzékelők -Comment[hu]=Megjeleníti a gépbe épített érzékelők értékeit. diff --git a/plugin-sensors/translations/sensors_it.desktop b/plugin-sensors/translations/sensors_it.desktop deleted file mode 100644 index f7f2e8d..0000000 --- a/plugin-sensors/translations/sensors_it.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[it]=Sensori -Comment[it]=Visualizza i valori rilevati dai sensori hardware (attualmente lm_sensors) - diff --git a/plugin-sensors/translations/sensors_ja.desktop b/plugin-sensors/translations/sensors_ja.desktop deleted file mode 100644 index 8a6a2a3..0000000 --- a/plugin-sensors/translations/sensors_ja.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[ja]=センサー -Comment[ja]=ハードウェアセンサからの測定値を表示します diff --git a/plugin-sensors/translations/sensors_lt.desktop b/plugin-sensors/translations/sensors_lt.desktop deleted file mode 100644 index f19ba0d..0000000 --- a/plugin-sensors/translations/sensors_lt.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[lt]=Jutikliai -Comment[lt]=Rodo aparatinės įrangos jutiklių duomenis. diff --git a/plugin-sensors/translations/sensors_nl.desktop b/plugin-sensors/translations/sensors_nl.desktop deleted file mode 100644 index c6e2c24..0000000 --- a/plugin-sensors/translations/sensors_nl.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[nl]=Sensoren -Comment[nl]=Bekijk metingen van hardware sensoren (op dit moment lm_sensors) diff --git a/plugin-sensors/translations/sensors_pl.desktop b/plugin-sensors/translations/sensors_pl.desktop deleted file mode 100644 index fd1b290..0000000 --- a/plugin-sensors/translations/sensors_pl.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[pl]=Czujniki -Comment[pl]=Wyświetla wskazania z czujników sprzętowych. diff --git a/plugin-sensors/translations/sensors_pt.desktop b/plugin-sensors/translations/sensors_pt.desktop deleted file mode 100644 index ab865a2..0000000 --- a/plugin-sensors/translations/sensors_pt.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - -# Translations -Name[pt]=Sensores -Comment[pt]=Consultar as leituras dos sensores. diff --git a/plugin-sensors/translations/sensors_pt_BR.desktop b/plugin-sensors/translations/sensors_pt_BR.desktop deleted file mode 100644 index 3b87da0..0000000 --- a/plugin-sensors/translations/sensors_pt_BR.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[pt_BR]=Sensores -Comment[pt_BR]=Visualizar as leituras dos sensores de hardware (atualmente do lm_sensors) diff --git a/plugin-sensors/translations/sensors_ro_RO.desktop b/plugin-sensors/translations/sensors_ro_RO.desktop deleted file mode 100644 index 9ce9441..0000000 --- a/plugin-sensors/translations/sensors_ro_RO.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[ro_RO]=Senzori -Comment[ro_RO]=Vizualizează citirile senzorilor hardware (momentan lm_sensors) diff --git a/plugin-sensors/translations/sensors_ru.desktop b/plugin-sensors/translations/sensors_ru.desktop deleted file mode 100644 index 2d9b986..0000000 --- a/plugin-sensors/translations/sensors_ru.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[ru]=Сенсоры -Comment[ru]=Посмотреть данные с аппаратных сенсоров. \ No newline at end of file diff --git a/plugin-sensors/translations/sensors_sl.desktop b/plugin-sensors/translations/sensors_sl.desktop deleted file mode 100644 index dfcf55f..0000000 --- a/plugin-sensors/translations/sensors_sl.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[sl]=Senzorji -Comment[sl]=Oglejte si meritve senzorjev za strojno opremo (trenutno lm_sensors) diff --git a/plugin-sensors/translations/sensors_th_TH.desktop b/plugin-sensors/translations/sensors_th_TH.desktop deleted file mode 100644 index b2bd9c1..0000000 --- a/plugin-sensors/translations/sensors_th_TH.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[th_TH]=ตัวตรวจจับ -Comment[th_TH]=ดูข้อมูลที่ตัวตรวจจับฮาร์ดแวร์อ่านได้ (lm_sensors โดยปัจจุบัน) diff --git a/plugin-sensors/translations/sensors_tr.desktop b/plugin-sensors/translations/sensors_tr.desktop deleted file mode 100644 index 7f3b371..0000000 --- a/plugin-sensors/translations/sensors_tr.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[tr]=Algılayıcılar -Comment[tr]=Donanım algılayıcılarının okudukları değerleri görüntüleyin (şimdilik lm_sensors) diff --git a/plugin-sensors/translations/sensors_uk.desktop b/plugin-sensors/translations/sensors_uk.desktop deleted file mode 100644 index 4d5763f..0000000 --- a/plugin-sensors/translations/sensors_uk.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[uk]=Сенсори -Comment[uk]=Показати дані апаратних сенсорів (lm_sensors) diff --git a/plugin-sensors/translations/sensors_zh_CN.desktop b/plugin-sensors/translations/sensors_zh_CN.desktop deleted file mode 100644 index 547140a..0000000 --- a/plugin-sensors/translations/sensors_zh_CN.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[zh_CN]=传感器 -Comment[zh_CN]=查看硬件传感器数据(当前是 lm_sensors) diff --git a/plugin-sensors/translations/sensors_zh_TW.desktop b/plugin-sensors/translations/sensors_zh_TW.desktop deleted file mode 100644 index 63b2056..0000000 --- a/plugin-sensors/translations/sensors_zh_TW.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Sensors -Comment=View readings from hardware sensors. - - -# Translations -Name[zh_TW]=感應器 -Comment[zh_TW]=從硬體感應器中檢視(現在為 lm_sensors) diff --git a/plugin-showdesktop/CMakeLists.txt b/plugin-showdesktop/CMakeLists.txt deleted file mode 100644 index bf69d2b..0000000 --- a/plugin-showdesktop/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -set(PLUGIN "showdesktop") - -set(HEADERS - showdesktop.h -) - -set(SOURCES - showdesktop.cpp -) - -set(LIBRARIES - ${LIBRARIES} - lxqt-globalkeys - Qt5Xdg -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-showdesktop/resources/showdesktop.desktop.in b/plugin-showdesktop/resources/showdesktop.desktop.in deleted file mode 100644 index c59915d..0000000 --- a/plugin-showdesktop/resources/showdesktop.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop -Icon=user-desktop - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-showdesktop/showdesktop.cpp b/plugin-showdesktop/showdesktop.cpp deleted file mode 100644 index 7eb816c..0000000 --- a/plugin-showdesktop/showdesktop.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: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * 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 "showdesktop.h" -#include "../panel/pluginsettings.h" - -#define DEFAULT_SHORTCUT "Control+Alt+D" - -ShowDesktop::ShowDesktop(const ILXQtPanelPluginStartupInfo &startupInfo) : - QObject(), - ILXQtPanelPlugin(startupInfo) -{ - m_key = GlobalKeyShortcut::Client::instance()->addAction(QString(), QString("/panel/%1/show_hide").arg(settings()->group()), tr("Show desktop"), this); - if (m_key) - { - connect(m_key, &GlobalKeyShortcut::Action::registrationFinished, this, &ShowDesktop::shortcutRegistered); - connect(m_key, SIGNAL(activated()), this, SLOT(toggleShowingDesktop())); - } - - QAction * act = new QAction(XdgIcon::fromTheme("user-desktop"), tr("Show Desktop"), this); - connect(act, SIGNAL(triggered()), this, SLOT(toggleShowingDesktop())); - - mButton.setDefaultAction(act); - mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mButton.setAutoRaise(true); -} - -void ShowDesktop::shortcutRegistered() -{ - if (m_key->shortcut().isEmpty()) - { - m_key->changeShortcut(DEFAULT_SHORTCUT); - if (m_key->shortcut().isEmpty()) - { - LXQt::Notification::notify(tr("Show Desktop: Global shortcut '%1' cannot be registered").arg(DEFAULT_SHORTCUT)); - } - } -} - -void ShowDesktop::toggleShowingDesktop() -{ - KWindowSystem::setShowingDesktop(!KWindowSystem::showingDesktop()); -} - -#undef DEFAULT_SHORTCUT diff --git a/plugin-showdesktop/showdesktop.h b/plugin-showdesktop/showdesktop.h deleted file mode 100644 index 4d5c4b4..0000000 --- a/plugin-showdesktop/showdesktop.h +++ /dev/null @@ -1,75 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * 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 SHOWDESKTOP_H -#define SHOWDESKTOP_H - -#include "../panel/ilxqtpanelplugin.h" -#include - - -namespace GlobalKeyShortcut -{ -class Action; -} - -class ShowDesktop : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT - -public: - ShowDesktop(const ILXQtPanelPluginStartupInfo &startupInfo); - - virtual QWidget *widget() { return &mButton; } - virtual QString themeId() const { return "ShowDesktop"; } -private: - GlobalKeyShortcut::Action * m_key; - -private slots: - void toggleShowingDesktop(); - void shortcutRegistered(); - -private: - QToolButton mButton; -}; - -class ShowDesktopLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - // Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new ShowDesktop(startupInfo); - } -}; - - -#endif - diff --git a/plugin-showdesktop/translations/showdesktop_ar.desktop b/plugin-showdesktop/translations/showdesktop_ar.desktop deleted file mode 100644 index 6b9e22c..0000000 --- a/plugin-showdesktop/translations/showdesktop_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[ar]=تصغّر كلّ النّوافذ وتُظهر سطح المكتب -Name[ar]=أظهر سطح المكتب diff --git a/plugin-showdesktop/translations/showdesktop_cs.desktop b/plugin-showdesktop/translations/showdesktop_cs.desktop deleted file mode 100644 index 8f93895..0000000 --- a/plugin-showdesktop/translations/showdesktop_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Zmenšit všechna okna a ukázat plochu -Name[cs]=Ukázat plochu diff --git a/plugin-showdesktop/translations/showdesktop_cs_CZ.desktop b/plugin-showdesktop/translations/showdesktop_cs_CZ.desktop deleted file mode 100644 index 0c01bea..0000000 --- a/plugin-showdesktop/translations/showdesktop_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Zmenšit všechna okna a ukázat pracovní plochu -Name[cs_CZ]=Ukázat pracovní plochu diff --git a/plugin-showdesktop/translations/showdesktop_da.desktop b/plugin-showdesktop/translations/showdesktop_da.desktop deleted file mode 100644 index 1140883..0000000 --- a/plugin-showdesktop/translations/showdesktop_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop -Icon=user-desktop - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Vis skrivebord -Comment[da]=Minimer alle vinduer og vis skrivebordet diff --git a/plugin-showdesktop/translations/showdesktop_de.desktop b/plugin-showdesktop/translations/showdesktop_de.desktop deleted file mode 100644 index b79fdc3..0000000 --- a/plugin-showdesktop/translations/showdesktop_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Arbeitsfläche anzeigen -Comment[de]=Alle Fenster minimieren und die Arbeitsfläche anzeigen diff --git a/plugin-showdesktop/translations/showdesktop_el.desktop b/plugin-showdesktop/translations/showdesktop_el.desktop deleted file mode 100644 index a6418db..0000000 --- a/plugin-showdesktop/translations/showdesktop_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Εμφάνιση επιφάνειας εργασίας -Comment[el]=Ελαχιστοποίηση όλων των παραθύρων και εμφάνιση της επιφάνειας εργασίας diff --git a/plugin-showdesktop/translations/showdesktop_eo.desktop b/plugin-showdesktop/translations/showdesktop_eo.desktop deleted file mode 100644 index 35ac778..0000000 --- a/plugin-showdesktop/translations/showdesktop_eo.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eo]=Malmaksimigi ĉiujn fenestrojn kaj montri la labortablon -Name[eo]=Montri labortablon diff --git a/plugin-showdesktop/translations/showdesktop_es.desktop b/plugin-showdesktop/translations/showdesktop_es.desktop deleted file mode 100644 index 288be02..0000000 --- a/plugin-showdesktop/translations/showdesktop_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Minimiza todas las ventanas y muestra el escritorio -Name[es]=Mostrar escritorio diff --git a/plugin-showdesktop/translations/showdesktop_es_VE.desktop b/plugin-showdesktop/translations/showdesktop_es_VE.desktop deleted file mode 100644 index 708afc2..0000000 --- a/plugin-showdesktop/translations/showdesktop_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Minimiza todas las ventanas de todos los escritorios -Name[es_VE]=Mostrar Escritorio diff --git a/plugin-showdesktop/translations/showdesktop_eu.desktop b/plugin-showdesktop/translations/showdesktop_eu.desktop deleted file mode 100644 index 1950855..0000000 --- a/plugin-showdesktop/translations/showdesktop_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Minimizatu leiho guztiak eta erakutsi mahaigaina -Name[eu]=Erakutsi mahaigaina diff --git a/plugin-showdesktop/translations/showdesktop_fi.desktop b/plugin-showdesktop/translations/showdesktop_fi.desktop deleted file mode 100644 index cf32c16..0000000 --- a/plugin-showdesktop/translations/showdesktop_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Pienennä kaikki ikkunat ja näytä työpöytä -Name[fi]=Näytä työpöytä diff --git a/plugin-showdesktop/translations/showdesktop_fr.desktop b/plugin-showdesktop/translations/showdesktop_fr.desktop deleted file mode 100644 index 4f48d7b..0000000 --- a/plugin-showdesktop/translations/showdesktop_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Comment[fr]=Minimiser toutes les fenêtres et montrer le bureau -Name[fr]=Montrer le bureau diff --git a/plugin-showdesktop/translations/showdesktop_hu.desktop b/plugin-showdesktop/translations/showdesktop_hu.desktop deleted file mode 100644 index e1c0e11..0000000 --- a/plugin-showdesktop/translations/showdesktop_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=Minimalizálja az összes ablakot és megjeleníti az asztalt -Name[hu]=Az asztal megjelenítése diff --git a/plugin-showdesktop/translations/showdesktop_ia.desktop b/plugin-showdesktop/translations/showdesktop_ia.desktop deleted file mode 100644 index cce7114..0000000 --- a/plugin-showdesktop/translations/showdesktop_ia.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show Desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-showdesktop/translations/showdesktop_id_ID.desktop b/plugin-showdesktop/translations/showdesktop_id_ID.desktop deleted file mode 100644 index 2a3103f..0000000 --- a/plugin-showdesktop/translations/showdesktop_id_ID.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[id_ID]=Kecilkan seluruh jendela dan tampilkan desktop -Name[id_ID]=Tampilkan Desktop diff --git a/plugin-showdesktop/translations/showdesktop_it.desktop b/plugin-showdesktop/translations/showdesktop_it.desktop deleted file mode 100644 index 976fdb9..0000000 --- a/plugin-showdesktop/translations/showdesktop_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[it]=Minimizza tutte le finestre e mostra la scrivania -Name[it]=Mostra scrivania diff --git a/plugin-showdesktop/translations/showdesktop_ja.desktop b/plugin-showdesktop/translations/showdesktop_ja.desktop deleted file mode 100644 index 540c43b..0000000 --- a/plugin-showdesktop/translations/showdesktop_ja.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ja]=全ウィンドウ最小化やデスクトップ表示を可能にします -Name[ja]=デスクトップ表示 diff --git a/plugin-showdesktop/translations/showdesktop_ko.desktop b/plugin-showdesktop/translations/showdesktop_ko.desktop deleted file mode 100644 index cce7114..0000000 --- a/plugin-showdesktop/translations/showdesktop_ko.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show Desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-showdesktop/translations/showdesktop_lt.desktop b/plugin-showdesktop/translations/showdesktop_lt.desktop deleted file mode 100644 index 50332d3..0000000 --- a/plugin-showdesktop/translations/showdesktop_lt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[lt]=Suskleidžia visus langus ir rodo darbalaukį -Name[lt]=Darbalaukio rodymas diff --git a/plugin-showdesktop/translations/showdesktop_nl.desktop b/plugin-showdesktop/translations/showdesktop_nl.desktop deleted file mode 100644 index b10904f..0000000 --- a/plugin-showdesktop/translations/showdesktop_nl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[nl]=Minimaliseer alle vensters en toon het bureaublad -Name[nl]=Toon Bureaublad diff --git a/plugin-showdesktop/translations/showdesktop_pl.desktop b/plugin-showdesktop/translations/showdesktop_pl.desktop deleted file mode 100644 index 6b1f111..0000000 --- a/plugin-showdesktop/translations/showdesktop_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Minimalizuje wszystkie okna i pokazuje pulpit -Name[pl]=Pokaż pulpit diff --git a/plugin-showdesktop/translations/showdesktop_pt.desktop b/plugin-showdesktop/translations/showdesktop_pt.desktop deleted file mode 100644 index 95a6ba1..0000000 --- a/plugin-showdesktop/translations/showdesktop_pt.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[pt]=Mostrar área de trabalho -Comment[pt]=Minimizar janelas e mostrar a área de trabalho diff --git a/plugin-showdesktop/translations/showdesktop_pt_BR.desktop b/plugin-showdesktop/translations/showdesktop_pt_BR.desktop deleted file mode 100644 index 9f922c5..0000000 --- a/plugin-showdesktop/translations/showdesktop_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Minimizar todas as janelas e exibir a área de trabalho -Name[pt_BR]=Exibir a área de trabalho diff --git a/plugin-showdesktop/translations/showdesktop_ro_RO.desktop b/plugin-showdesktop/translations/showdesktop_ro_RO.desktop deleted file mode 100644 index b8ffbb7..0000000 --- a/plugin-showdesktop/translations/showdesktop_ro_RO.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Minimizează toate ferestrele și arată desktopul -Name[ro_RO]=Arată desktopul diff --git a/plugin-showdesktop/translations/showdesktop_ru.desktop b/plugin-showdesktop/translations/showdesktop_ru.desktop deleted file mode 100644 index 99485f3..0000000 --- a/plugin-showdesktop/translations/showdesktop_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru]=Свернуть все окна и показать рабочий стол. -Name[ru]=Показать рабочий стол \ No newline at end of file diff --git a/plugin-showdesktop/translations/showdesktop_sk.desktop b/plugin-showdesktop/translations/showdesktop_sk.desktop deleted file mode 100644 index a783421..0000000 --- a/plugin-showdesktop/translations/showdesktop_sk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sk]=Minimalizuje všetky okná a zobrazí plochu -Name[sk]=Zobraziť plochu diff --git a/plugin-showdesktop/translations/showdesktop_sl.desktop b/plugin-showdesktop/translations/showdesktop_sl.desktop deleted file mode 100644 index dd1d9b4..0000000 --- a/plugin-showdesktop/translations/showdesktop_sl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sl]=Pomanjšajte vsa okna, da se pokaže namizje -Name[sl]=Pokaži namizje diff --git a/plugin-showdesktop/translations/showdesktop_sr.desktop b/plugin-showdesktop/translations/showdesktop_sr.desktop deleted file mode 100644 index 6f79038..0000000 --- a/plugin-showdesktop/translations/showdesktop_sr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr]=Минимизуј све прозоре и прикажи радну површ -Name[sr]=Приказ површи diff --git a/plugin-showdesktop/translations/showdesktop_sr@ijekavian.desktop b/plugin-showdesktop/translations/showdesktop_sr@ijekavian.desktop deleted file mode 100644 index d54cd34..0000000 --- a/plugin-showdesktop/translations/showdesktop_sr@ijekavian.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavian]=Приказ површи -Comment[sr@ijekavian]=Минимизуј све прозоре и прикажи радну површ diff --git a/plugin-showdesktop/translations/showdesktop_sr@ijekavianlatin.desktop b/plugin-showdesktop/translations/showdesktop_sr@ijekavianlatin.desktop deleted file mode 100644 index 35b79e0..0000000 --- a/plugin-showdesktop/translations/showdesktop_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavianlatin]=Prikaz površi -Comment[sr@ijekavianlatin]=Minimizuj sve prozore i prikaži radnu površ diff --git a/plugin-showdesktop/translations/showdesktop_sr@latin.desktop b/plugin-showdesktop/translations/showdesktop_sr@latin.desktop deleted file mode 100644 index 5bd74d8..0000000 --- a/plugin-showdesktop/translations/showdesktop_sr@latin.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr@latin]=Minimizuj sve prozore i prikaži radnu površ -Name[sr@latin]=Prikaz površi diff --git a/plugin-showdesktop/translations/showdesktop_th_TH.desktop b/plugin-showdesktop/translations/showdesktop_th_TH.desktop deleted file mode 100644 index a379732..0000000 --- a/plugin-showdesktop/translations/showdesktop_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=ย่อเก็บหน้าต่างทั้งหมดและแสดงพื้นโต๊ะ -Name[th_TH]=แสดงพื้นโต๊ะ diff --git a/plugin-showdesktop/translations/showdesktop_tr.desktop b/plugin-showdesktop/translations/showdesktop_tr.desktop deleted file mode 100644 index 76c0cfb..0000000 --- a/plugin-showdesktop/translations/showdesktop_tr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[tr]=Tüm pencereleri küçült ve masaüstünü göster -Name[tr]=Masaüstünü Göster diff --git a/plugin-showdesktop/translations/showdesktop_uk.desktop b/plugin-showdesktop/translations/showdesktop_uk.desktop deleted file mode 100644 index aec8624..0000000 --- a/plugin-showdesktop/translations/showdesktop_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Згорнути всі вікна та показати стільницю -Name[uk]=Показати стільницю diff --git a/plugin-showdesktop/translations/showdesktop_zh_CN.GB2312.desktop b/plugin-showdesktop/translations/showdesktop_zh_CN.GB2312.desktop deleted file mode 100644 index cce7114..0000000 --- a/plugin-showdesktop/translations/showdesktop_zh_CN.GB2312.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show Desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-showdesktop/translations/showdesktop_zh_CN.desktop b/plugin-showdesktop/translations/showdesktop_zh_CN.desktop deleted file mode 100644 index 94fb58a..0000000 --- a/plugin-showdesktop/translations/showdesktop_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=最小化所有窗口并显示桌面 -Name[zh_CN]=显示桌面 diff --git a/plugin-showdesktop/translations/showdesktop_zh_TW.desktop b/plugin-showdesktop/translations/showdesktop_zh_TW.desktop deleted file mode 100644 index 80ff942..0000000 --- a/plugin-showdesktop/translations/showdesktop_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Show desktop -Comment=Minimize all windows and show the desktop - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=將所有視窗縮到最小並顯示桌面 -Name[zh_TW]=顯示桌面 diff --git a/plugin-spacer/CMakeLists.txt b/plugin-spacer/CMakeLists.txt deleted file mode 100644 index 27cf663..0000000 --- a/plugin-spacer/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -set(PLUGIN "spacer") - -set(HEADERS - spacer.h - spacerconfiguration.h -) - -set(SOURCES - spacer.cpp - spacerconfiguration.cpp -) - -set(UIS - spacerconfiguration.ui -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-spacer/resources/spacer.desktop.in b/plugin-spacer/resources/spacer.desktop.in deleted file mode 100644 index 711bb68..0000000 --- a/plugin-spacer/resources/spacer.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Spacer -Comment=Space between widgets -Icon=bookmark-new - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-spacer/spacer.cpp b/plugin-spacer/spacer.cpp deleted file mode 100644 index 2f5d163..0000000 --- a/plugin-spacer/spacer.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * - * 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 "spacer.h" -#include "spacerconfiguration.h" -#include - -void SpacerWidget::setType(QString const & type) -{ - if (type != mType) - { - mType = type; - QEvent e{QEvent::ThemeChange}; - QApplication::sendEvent(this, &e); - } -} - -void SpacerWidget::setOrientation(QString const & orientation) -{ - if (orientation != mOrientation) - { - mOrientation = orientation; - QEvent e{QEvent::ThemeChange}; - QApplication::sendEvent(this, &e); - } -} - -/************************************************ - - ************************************************/ -Spacer::Spacer(const ILXQtPanelPluginStartupInfo &startupInfo) : - QObject() - , ILXQtPanelPlugin(startupInfo) - , mSize(8) -{ - settingsChanged(); -} - -/************************************************ - - ************************************************/ -void Spacer::settingsChanged() -{ - mSize = settings()->value("size", 8).toInt(); - mSpacer.setType(settings()->value("spaceType", SpacerConfiguration::msTypes[0]).toString()); - setSizes(); -} - -/************************************************ - - ************************************************/ -QDialog *Spacer::configureDialog() -{ - return new SpacerConfiguration(settings()); -} - -/************************************************ - - ************************************************/ -void Spacer::setSizes() -{ - if (panel()->isHorizontal()) - { - mSpacer.setOrientation("horizontal"); - mSpacer.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); - mSpacer.setFixedWidth(mSize); - mSpacer.setMinimumHeight(0); - mSpacer.setMaximumHeight(QWIDGETSIZE_MAX); - } - else - { - mSpacer.setOrientation("vertical"); - mSpacer.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - mSpacer.setFixedHeight(mSize); - mSpacer.setMinimumWidth(0); - mSpacer.setMaximumWidth(QWIDGETSIZE_MAX); - } -} - -/************************************************ - - ************************************************/ -void Spacer::realign() -{ - setSizes(); -} diff --git a/plugin-spacer/spacer.h b/plugin-spacer/spacer.h deleted file mode 100644 index a104cb9..0000000 --- a/plugin-spacer/spacer.h +++ /dev/null @@ -1,91 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * - * 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 SPACER_H -#define SPACER_H - -#include "../panel/ilxqtpanelplugin.h" -#include - - -class SpacerWidget : public QFrame -{ - Q_OBJECT - - Q_PROPERTY(QString type READ getType) - Q_PROPERTY(QString orientation READ getOrientation) - -public: - const QString& getType() const throw () { return mType; } - void setType(QString const & type); - const QString& getOrientation() const throw () { return mOrientation; } - void setOrientation(QString const & orientation); - -private: - QString mType; - QString mOrientation; -}; - -class Spacer : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT - -public: - Spacer(const ILXQtPanelPluginStartupInfo &startupInfo); - - virtual QWidget *widget() { return &mSpacer; } - virtual QString themeId() const { return "Spacer"; } - - bool isSeparate() const { return true; } - - virtual ILXQtPanelPlugin::Flags flags() const { return HaveConfigDialog; } - QDialog *configureDialog(); - - virtual void realign(); - -private slots: - virtual void settingsChanged(); - -private: - void setSizes(); - -private: - SpacerWidget mSpacer; - int mSize; -}; - -class SpacerPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - // Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const { return new Spacer(startupInfo);} -}; - -#endif - diff --git a/plugin-spacer/spacerconfiguration.cpp b/plugin-spacer/spacerconfiguration.cpp deleted file mode 100644 index b5fb013..0000000 --- a/plugin-spacer/spacerconfiguration.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * - * 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 "spacerconfiguration.h" -#include "ui_spacerconfiguration.h" - - -//Note: strings can't actually be translated here (in static initialization time) -// the QT_TR_NOOP here is just for qt translate tools to get the strings for translation -const QStringList SpacerConfiguration::msTypes = { - QLatin1String(QT_TR_NOOP("lined")) - , QLatin1String(QT_TR_NOOP("dotted")) - , QLatin1String(QT_TR_NOOP("invisible")) -}; - -SpacerConfiguration::SpacerConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::SpacerConfiguration) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("SpacerConfigurationWindow"); - ui->setupUi(this); - - //Note: translation is needed here in runtime (translator is attached already) - for (auto const & type : msTypes) - ui->typeCB->addItem(tr(type.toStdString().c_str()), type); - - loadSettings(); - - connect(ui->sizeSB, static_cast(&QSpinBox::valueChanged), this, &SpacerConfiguration::sizeChanged); - connect(ui->typeCB, static_cast(&QComboBox::currentIndexChanged), this, &SpacerConfiguration::typeChanged); -} - -SpacerConfiguration::~SpacerConfiguration() -{ - delete ui; -} - -void SpacerConfiguration::loadSettings() -{ - ui->sizeSB->setValue(settings().value("size", 8).toInt()); - ui->typeCB->setCurrentIndex(ui->typeCB->findData(settings().value("spaceType", msTypes[0]).toString())); -} - -void SpacerConfiguration::sizeChanged(int value) -{ - settings().setValue("size", value); -} - -void SpacerConfiguration::typeChanged(int index) -{ - settings().setValue("spaceType", ui->typeCB->itemData(index, Qt::UserRole)); -} diff --git a/plugin-spacer/spacerconfiguration.h b/plugin-spacer/spacerconfiguration.h deleted file mode 100644 index 70b3055..0000000 --- a/plugin-spacer/spacerconfiguration.h +++ /dev/null @@ -1,63 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * - * 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 SPACERCONFIGURATION_H -#define SPACERCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" - -class QAbstractButton; - -namespace Ui { - class SpacerConfiguration; -} - -class SpacerConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit SpacerConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~SpacerConfiguration(); - -public: - static const QStringList msTypes; - -private: - Ui::SpacerConfiguration *ui; - -private slots: - /* - Saves settings in conf file. - */ - void loadSettings(); - void sizeChanged(int value); - void typeChanged(int index); -}; - -#endif // SPACERCONFIGURATION_H diff --git a/plugin-spacer/spacerconfiguration.ui b/plugin-spacer/spacerconfiguration.ui deleted file mode 100644 index 1ed809f..0000000 --- a/plugin-spacer/spacerconfiguration.ui +++ /dev/null @@ -1,70 +0,0 @@ - - - SpacerConfiguration - - - - 0 - 0 - - - - Spacer Settings - - - - - - Space width: - - - - - - - 4 - - - 2048 - - - 8 - - - - - - - Space type: - - - - - - - false - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - buttons - clicked(QAbstractButton*) - SpacerConfiguration - close() - - - diff --git a/plugin-spacer/translations/spacer_ar.desktop b/plugin-spacer/translations/spacer_ar.desktop deleted file mode 100644 index f874936..0000000 --- a/plugin-spacer/translations/spacer_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=مُباعد -Comment[ar]=مساحة بين الودجات diff --git a/plugin-spacer/translations/spacer_da.desktop b/plugin-spacer/translations/spacer_da.desktop deleted file mode 100644 index 0293f01..0000000 --- a/plugin-spacer/translations/spacer_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Spacer -Comment=Space between widgets -Icon=bookmark-new - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Mellemrum -Comment[da]=Mellemrum mellem widgets diff --git a/plugin-spacer/translations/spacer_de.desktop b/plugin-spacer/translations/spacer_de.desktop deleted file mode 100644 index c58ea1e..0000000 --- a/plugin-spacer/translations/spacer_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Spacer -Comment[de]=Stellt den Abstand zwischen den Widgets ein diff --git a/plugin-spacer/translations/spacer_el.desktop b/plugin-spacer/translations/spacer_el.desktop deleted file mode 100644 index 40f0c9d..0000000 --- a/plugin-spacer/translations/spacer_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Διάστημα -Comment[el]=Διάστημα μεταξύ των γραφικών συστατικών diff --git a/plugin-spacer/translations/spacer_fr.desktop b/plugin-spacer/translations/spacer_fr.desktop deleted file mode 100644 index 0998119..0000000 --- a/plugin-spacer/translations/spacer_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Espaceur -Comment[fr]=Fixe un espacement entre les widgets diff --git a/plugin-spacer/translations/spacer_hu.desktop b/plugin-spacer/translations/spacer_hu.desktop deleted file mode 100644 index 0f5d07a..0000000 --- a/plugin-spacer/translations/spacer_hu.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[hu]=Távtartó -Comment[hu]=Elemek közötti távolságtartó diff --git a/plugin-spacer/translations/spacer_it.desktop b/plugin-spacer/translations/spacer_it.desktop deleted file mode 100644 index 59e099a..0000000 --- a/plugin-spacer/translations/spacer_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Spaziatore -Comment[it]=Aggiunge uno spazio fra gli elementi diff --git a/plugin-spacer/translations/spacer_lt.desktop b/plugin-spacer/translations/spacer_lt.desktop deleted file mode 100644 index 33a9e14..0000000 --- a/plugin-spacer/translations/spacer_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Tarpiklis -Comment[lt]=Tarpas tarp valdiklių diff --git a/plugin-spacer/translations/spacer_pl.desktop b/plugin-spacer/translations/spacer_pl.desktop deleted file mode 100644 index 2eb1649..0000000 --- a/plugin-spacer/translations/spacer_pl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[pl]=Odstęp -Comment[pl]=Odstęp między elementami diff --git a/plugin-spacer/translations/spacer_pt.desktop b/plugin-spacer/translations/spacer_pt.desktop deleted file mode 100644 index 599947a..0000000 --- a/plugin-spacer/translations/spacer_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Name[pt]=Espaçamento -Comment[pt]=Espaço entre os widgets diff --git a/plugin-spacer/translations/spacer_ru.desktop b/plugin-spacer/translations/spacer_ru.desktop deleted file mode 100644 index 966c4d8..0000000 --- a/plugin-spacer/translations/spacer_ru.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ru]=Разделитель -Comment[ru]=Промежуток между виджетами diff --git a/plugin-statusnotifier/CMakeLists.txt b/plugin-statusnotifier/CMakeLists.txt deleted file mode 100644 index a3ed684..0000000 --- a/plugin-statusnotifier/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -set(PLUGIN "statusnotifier") - - -find_package(dbusmenu-qt5 REQUIRED) - -set(HEADERS - statusnotifier.h - dbustypes.h - statusnotifierbutton.h - statusnotifieriteminterface.h - statusnotifierwatcher.h - statusnotifierwidget.h - sniasync.h -) - -set(SOURCES - statusnotifier.cpp - dbustypes.cpp - statusnotifierbutton.cpp - statusnotifieriteminterface.cpp - statusnotifierwatcher.cpp - statusnotifierwidget.cpp - sniasync.cpp -) - -qt5_add_dbus_adaptor(SOURCES - org.kde.StatusNotifierItem.xml - statusnotifieriteminterface.h - StatusNotifierItemInterface -) - -set(LIBRARIES - dbusmenu-qt5 -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-statusnotifier/dbustypes.cpp b/plugin-statusnotifier/dbustypes.cpp deleted file mode 100644 index 758bfed..0000000 --- a/plugin-statusnotifier/dbustypes.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 "dbustypes.h" - -// Marshall the IconPixmap data into a D-Bus argument -QDBusArgument &operator<<(QDBusArgument &argument, const IconPixmap &icon) -{ - argument.beginStructure(); - argument << icon.width; - argument << icon.height; - argument << icon.bytes; - argument.endStructure(); - return argument; -} - -// Retrieve the ImageStruct data from the D-Bus argument -const QDBusArgument &operator>>(const QDBusArgument &argument, IconPixmap &icon) -{ - argument.beginStructure(); - argument >> icon.width; - argument >> icon.height; - argument >> icon.bytes; - argument.endStructure(); - return argument; -} - -// Marshall the ToolTip data into a D-Bus argument -QDBusArgument &operator<<(QDBusArgument &argument, const ToolTip &toolTip) -{ - argument.beginStructure(); - argument << toolTip.iconName; - argument << toolTip.iconPixmap; - argument << toolTip.title; - argument << toolTip.description; - argument.endStructure(); - return argument; -} - -// Retrieve the ToolTip data from the D-Bus argument -const QDBusArgument &operator>>(const QDBusArgument &argument, ToolTip &toolTip) -{ - argument.beginStructure(); - argument >> toolTip.iconName; - argument >> toolTip.iconPixmap; - argument >> toolTip.title; - argument >> toolTip.description; - argument.endStructure(); - return argument; -} diff --git a/plugin-statusnotifier/dbustypes.h b/plugin-statusnotifier/dbustypes.h deleted file mode 100644 index c3bce21..0000000 --- a/plugin-statusnotifier/dbustypes.h +++ /dev/null @@ -1,58 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 - -#ifndef DBUSTYPES_H -#define DBUSTYPES_H - -struct IconPixmap { - int width; - int height; - QByteArray bytes; -}; - -typedef QList IconPixmapList; - -struct ToolTip { - QString iconName; - QList iconPixmap; - QString title; - QString description; -}; - -QDBusArgument &operator<<(QDBusArgument &argument, const IconPixmap &icon); -const QDBusArgument &operator>>(const QDBusArgument &argument, IconPixmap &icon); - -QDBusArgument &operator<<(QDBusArgument &argument, const ToolTip &toolTip); -const QDBusArgument &operator>>(const QDBusArgument &argument, ToolTip &toolTip); - -Q_DECLARE_METATYPE(IconPixmap) -Q_DECLARE_METATYPE(ToolTip) - -#endif // DBUSTYPES_H diff --git a/plugin-statusnotifier/org.kde.StatusNotifierItem.xml b/plugin-statusnotifier/org.kde.StatusNotifierItem.xml deleted file mode 100644 index 0a563c5..0000000 --- a/plugin-statusnotifier/org.kde.StatusNotifierItem.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugin-statusnotifier/resources/statusnotifier.desktop.in b/plugin-statusnotifier/resources/statusnotifier.desktop.in deleted file mode 100644 index 7302dc6..0000000 --- a/plugin-statusnotifier/resources/statusnotifier.desktop.in +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Status Notifier Plugin -Comment=Status Notifier Plugin -Icon=go-bottom diff --git a/plugin-statusnotifier/sniasync.cpp b/plugin-statusnotifier/sniasync.cpp deleted file mode 100644 index a20172a..0000000 --- a/plugin-statusnotifier/sniasync.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Palo Kisa - * - * 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 "sniasync.h" - -SniAsync::SniAsync(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent/* = 0*/) - : QObject(parent) - , mSni{service, path, connection} -{ - //forward StatusNotifierItem signals - connect(&mSni, &org::kde::StatusNotifierItem::NewAttentionIcon, this, &SniAsync::NewAttentionIcon); - connect(&mSni, &org::kde::StatusNotifierItem::NewIcon, this, &SniAsync::NewIcon); - connect(&mSni, &org::kde::StatusNotifierItem::NewOverlayIcon, this, &SniAsync::NewOverlayIcon); - connect(&mSni, &org::kde::StatusNotifierItem::NewStatus, this, &SniAsync::NewStatus); - connect(&mSni, &org::kde::StatusNotifierItem::NewTitle, this, &SniAsync::NewTitle); - connect(&mSni, &org::kde::StatusNotifierItem::NewToolTip, this, &SniAsync::NewToolTip); -} - -QDBusPendingReply SniAsync::asyncPropGet(QString const & property) -{ - QDBusMessage msg = QDBusMessage::createMethodCall(mSni.service(), mSni.path(), QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Get")); - msg << mSni.interface() << property; - return mSni.connection().asyncCall(msg); -} diff --git a/plugin-statusnotifier/sniasync.h b/plugin-statusnotifier/sniasync.h deleted file mode 100644 index 13152c4..0000000 --- a/plugin-statusnotifier/sniasync.h +++ /dev/null @@ -1,116 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Palo Kisa - * - * 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 */ - -#if !defined(SNIASYNC_H) -#define SNIASYNC_H - -#include -#include "statusnotifieriteminterface.h" - -template -struct remove_class_type { using type = void; }; // bluff -template -struct remove_class_type { using type = R(ArgTypes...); }; -template -struct remove_class_type { using type = R(ArgTypes...); }; - -template -class call_sig_helper -{ - template - static decltype(&L1::operator()) test(int); - template - static void test(...); //bluff -public: - using type = decltype(test(0)); -}; -template -struct call_signature : public remove_class_type::type> {}; -template -struct call_signature { using type = R (ArgTypes...); }; -template -struct call_signature { using type = R (ArgTypes...); }; -template -struct call_signature { using type = R (ArgTypes...); }; -template -struct call_signature { using type = R(ArgTypes...); }; - -template struct is_valid_signature : public std::false_type {}; -template -struct is_valid_signature : public std::true_type {}; - -class SniAsync : public QObject -{ - Q_OBJECT -public: - SniAsync(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); - - template - inline void propertyGetAsync(QString const &name, F finished) - { - static_assert(is_valid_signature::type>::value, "need callable (lambda, *function, callable obj) (Arg) -> void"); - connect(new QDBusPendingCallWatcher{asyncPropGet(name), this}, - &QDBusPendingCallWatcher::finished, - [this, finished, name] (QDBusPendingCallWatcher * call) - { - QDBusPendingReply reply = *call; - if (reply.isError()) - qDebug() << "Error on DBus request:" << reply.error(); - finished(qdbus_cast::type>::argument_type>(reply.value())); - call->deleteLater(); - } - ); - } - - //exposed methods from org::kde::StatusNotifierItem - inline QString service() const { return mSni.service(); } - -public slots: - //Forwarded slots from org::kde::StatusNotifierItem - inline QDBusPendingReply<> Activate(int x, int y) { return mSni.Activate(x, y); } - inline QDBusPendingReply<> ContextMenu(int x, int y) { return mSni.ContextMenu(x, y); } - inline QDBusPendingReply<> Scroll(int delta, const QString &orientation) { return mSni.Scroll(delta, orientation); } - inline QDBusPendingReply<> SecondaryActivate(int x, int y) { return mSni.SecondaryActivate(x, y); } - -signals: - //Forwarded signals from org::kde::StatusNotifierItem - void NewAttentionIcon(); - void NewIcon(); - void NewOverlayIcon(); - void NewStatus(const QString &status); - void NewTitle(); - void NewToolTip(); - -private: - QDBusPendingReply asyncPropGet(QString const & property); - -private: - org::kde::StatusNotifierItem mSni; - -}; - -#endif diff --git a/plugin-statusnotifier/statusnotifier.cpp b/plugin-statusnotifier/statusnotifier.cpp deleted file mode 100644 index 1c5bcd3..0000000 --- a/plugin-statusnotifier/statusnotifier.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 "statusnotifier.h" - -StatusNotifier::StatusNotifier(const ILXQtPanelPluginStartupInfo &startupInfo) : - QObject(), - ILXQtPanelPlugin(startupInfo) -{ - m_widget = new StatusNotifierWidget(this); -} - -void StatusNotifier::realign() -{ - m_widget->realign(); -} diff --git a/plugin-statusnotifier/statusnotifier.h b/plugin-statusnotifier/statusnotifier.h deleted file mode 100644 index 7692192..0000000 --- a/plugin-statusnotifier/statusnotifier.h +++ /dev/null @@ -1,63 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 STATUSNOTIFIER_PLUGIN_H -#define STATUSNOTIFIER_PLUGIN_H - -#include "../panel/ilxqtpanelplugin.h" -#include "statusnotifierwidget.h" - -class StatusNotifier : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - StatusNotifier(const ILXQtPanelPluginStartupInfo &startupInfo); - - bool isSeparate() const { return true; } - void realign(); - QString themeId() const { return "StatusNotifier"; } - virtual Flags flags() const { return SingleInstance | NeedsHandle; } - QWidget *widget() { return m_widget; } - -private: - StatusNotifierWidget *m_widget; -}; - -class StatusNotifierLibrary : public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT -// Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new StatusNotifier(startupInfo); - } -}; - -#endif // STATUSNOTIFIER_PLUGIN_H diff --git a/plugin-statusnotifier/statusnotifierbutton.cpp b/plugin-statusnotifier/statusnotifierbutton.cpp deleted file mode 100644 index 5cc894b..0000000 --- a/plugin-statusnotifier/statusnotifierbutton.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 "statusnotifierbutton.h" - -#include -#include -#include -#include "../panel/ilxqtpanelplugin.h" -#include "sniasync.h" -#include - -namespace -{ - /*! \brief specialized DBusMenuImporter to correctly create actions' icons based - * on name - */ - class MenuImporter : public DBusMenuImporter - { - public: - using DBusMenuImporter::DBusMenuImporter; - - protected: - virtual QIcon iconForName(const QString & name) override - { - return XdgIcon::fromTheme(name); - } - }; -} - -StatusNotifierButton::StatusNotifierButton(QString service, QString objectPath, ILXQtPanelPlugin* plugin, QWidget *parent) - : QToolButton(parent), - mMenu(nullptr), - mStatus(Passive), - mFallbackIcon(QIcon::fromTheme("application-x-executable")), - mPlugin(plugin) -{ - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setAutoRaise(true); - interface = new SniAsync(service, objectPath, QDBusConnection::sessionBus(), this); - - connect(interface, &SniAsync::NewIcon, this, &StatusNotifierButton::newIcon); - connect(interface, &SniAsync::NewOverlayIcon, this, &StatusNotifierButton::newOverlayIcon); - connect(interface, &SniAsync::NewAttentionIcon, this, &StatusNotifierButton::newAttentionIcon); - connect(interface, &SniAsync::NewToolTip, this, &StatusNotifierButton::newToolTip); - connect(interface, &SniAsync::NewStatus, this, &StatusNotifierButton::newStatus); - - interface->propertyGetAsync(QLatin1String("Menu"), [this] (QDBusObjectPath path) { - if (!path.path().isEmpty()) - { - mMenu = (new MenuImporter{interface->service(), path.path(), this})->menu(); - mMenu->setObjectName(QLatin1String("StatusNotifierMenu")); - } - }); - - interface->propertyGetAsync(QLatin1String("Status"), [this] (QString status) { - newStatus(status); - }); - - interface->propertyGetAsync(QLatin1String("IconThemePath"), [this] (QString value) { - mThemePath = value; - //do the logic of icons after we've got the theme path - refetchIcon(Active); - refetchIcon(Passive); - refetchIcon(NeedsAttention); - }); - - newToolTip(); -} - -StatusNotifierButton::~StatusNotifierButton() -{ - delete interface; -} - -void StatusNotifierButton::newIcon() -{ - refetchIcon(Passive); -} - -void StatusNotifierButton::newOverlayIcon() -{ - refetchIcon(Active); -} - -void StatusNotifierButton::newAttentionIcon() -{ - refetchIcon(NeedsAttention); -} - -void StatusNotifierButton::refetchIcon(Status status) -{ - QString nameProperty, pixmapProperty; - if (status == Active) - { - nameProperty = QLatin1String("OverlayIconName"); - pixmapProperty = QLatin1String("OverlayIconPixmap"); - } - else if (status == NeedsAttention) - { - nameProperty = QLatin1String("AttentionIconName"); - pixmapProperty = QLatin1String("AttentionIconPixmap"); - } - else // status == Passive - { - nameProperty = QLatin1String("IconName"); - pixmapProperty = QLatin1String("IconPixmap"); - } - - interface->propertyGetAsync(nameProperty, [this, status, pixmapProperty] (QString iconName) { - QIcon nextIcon; - if (!iconName.isEmpty()) - { - if (QIcon::hasThemeIcon(iconName)) - nextIcon = QIcon::fromTheme(iconName); - else - { - QDir themeDir(mThemePath); - if (themeDir.exists()) - { - if (themeDir.exists(iconName + ".png")) - nextIcon.addFile(themeDir.filePath(iconName + ".png")); - - if (themeDir.cd("hicolor") || (themeDir.cd("icons") && themeDir.cd("hicolor"))) - { - const QStringList sizes = themeDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot); - foreach (const QString &dir, sizes) - { - const QStringList dirs = QDir(themeDir.filePath(dir)).entryList(QDir::AllDirs | QDir::NoDotAndDotDot); - foreach (const QString &innerDir, dirs) - { - QString file = themeDir.absolutePath() + "/" + dir + "/" + innerDir + "/" + iconName + ".png"; - if (QFile::exists(file)) - nextIcon.addFile(file); - } - } - } - } - } - - switch (status) - { - case Active: - mOverlayIcon = nextIcon; - break; - case NeedsAttention: - mAttentionIcon = nextIcon; - break; - case Passive: - mIcon = nextIcon; - break; - } - - resetIcon(); - } - else - { - interface->propertyGetAsync(pixmapProperty, [this, status, pixmapProperty] (IconPixmapList iconPixmaps) { - if (iconPixmaps.empty()) - return; - - QIcon nextIcon; - - for (IconPixmap iconPixmap: iconPixmaps) - { - if (!iconPixmap.bytes.isNull()) - { - QImage image((uchar*) iconPixmap.bytes.data(), iconPixmap.width, - iconPixmap.height, QImage::Format_ARGB32); - - const uchar *end = image.constBits() + image.byteCount(); - uchar *dest = reinterpret_cast(iconPixmap.bytes.data()); - for (const uchar *src = image.constBits(); src < end; src += 4, dest += 4) - qToUnaligned(qToBigEndian(qFromUnaligned(src)), dest); - - nextIcon.addPixmap(QPixmap::fromImage(image)); - } - } - - switch (status) - { - case Active: - mOverlayIcon = nextIcon; - break; - case NeedsAttention: - mAttentionIcon = nextIcon; - break; - case Passive: - mIcon = nextIcon; - break; - } - - resetIcon(); - }); - } - }); -} - -void StatusNotifierButton::newToolTip() -{ - interface->propertyGetAsync(QLatin1String("ToolTip"), [this] (ToolTip tooltip) { - QString toolTipTitle = tooltip.title; - if (!toolTipTitle.isEmpty()) - setToolTip(toolTipTitle); - else - interface->propertyGetAsync(QLatin1String("Title"), [this] (QString title) { - // we should get here only in case the ToolTip.title was empty - if (!title.isEmpty()) - setToolTip(title); - }); - }); -} - -void StatusNotifierButton::newStatus(QString status) -{ - Status newStatus; - if (status == QLatin1String("Passive")) - newStatus = Passive; - else if (status == QLatin1String("Active")) - newStatus = Active; - else - newStatus = NeedsAttention; - - if (mStatus == newStatus) - return; - - mStatus = newStatus; - resetIcon(); -} - -void StatusNotifierButton::contextMenuEvent(QContextMenuEvent* event) -{ - //XXX: avoid showing of parent's context menu, we are (optionaly) providing context menu on mouseReleaseEvent - //QWidget::contextMenuEvent(event); -} - -void StatusNotifierButton::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - interface->Activate(QCursor::pos().x(), QCursor::pos().y()); - else if (event->button() == Qt::MidButton) - interface->SecondaryActivate(QCursor::pos().x(), QCursor::pos().y()); - else if (Qt::RightButton == event->button()) - { - if (mMenu) - { - mPlugin->willShowWindow(mMenu); - mMenu->popup(mPlugin->panel()->calculatePopupWindowPos(QCursor::pos(), mMenu->sizeHint()).topLeft()); - } else - interface->ContextMenu(QCursor::pos().x(), QCursor::pos().y()); - } - - QToolButton::mouseReleaseEvent(event); -} - -void StatusNotifierButton::wheelEvent(QWheelEvent *event) -{ - interface->Scroll(event->delta(), "vertical"); -} - -void StatusNotifierButton::resetIcon() -{ - if (mStatus == Active && !mOverlayIcon.isNull()) - setIcon(mOverlayIcon); - else if (mStatus == NeedsAttention && !mAttentionIcon.isNull()) - setIcon(mAttentionIcon); - else if (!mIcon.isNull()) // mStatus == Passive - setIcon(mIcon); - else if (!mOverlayIcon.isNull()) - setIcon(mOverlayIcon); - else if (!mAttentionIcon.isNull()) - setIcon(mAttentionIcon); - else - setIcon(mFallbackIcon); -} diff --git a/plugin-statusnotifier/statusnotifierbutton.h b/plugin-statusnotifier/statusnotifierbutton.h deleted file mode 100644 index 4dbca30..0000000 --- a/plugin-statusnotifier/statusnotifierbutton.h +++ /dev/null @@ -1,92 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 STATUSNOTIFIERBUTTON_H -#define STATUSNOTIFIERBUTTON_H - -#include -#include -#include -#include -#include -#include -#include - -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) -template inline T qFromUnaligned(const uchar *src) -{ - T dest; - const size_t size = sizeof(T); - memcpy(&dest, src, size); - return dest; -} -#endif - -class ILXQtPanelPlugin; -class SniAsync; - -class StatusNotifierButton : public QToolButton -{ - Q_OBJECT - -public: - StatusNotifierButton(QString service, QString objectPath, ILXQtPanelPlugin* plugin, QWidget *parent = 0); - ~StatusNotifierButton(); - - enum Status - { - Passive, Active, NeedsAttention - }; - -public slots: - void newIcon(); - void newAttentionIcon(); - void newOverlayIcon(); - void newToolTip(); - void newStatus(QString status); - -private: - SniAsync *interface; - QMenu *mMenu; - Status mStatus; - - QString mThemePath; - QIcon mIcon, mOverlayIcon, mAttentionIcon, mFallbackIcon; - - ILXQtPanelPlugin* mPlugin; - -protected: - void contextMenuEvent(QContextMenuEvent * event); - void mouseReleaseEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); - - void refetchIcon(Status status); - void resetIcon(); -}; - -#endif // STATUSNOTIFIERBUTTON_H diff --git a/plugin-statusnotifier/statusnotifieriteminterface.cpp b/plugin-statusnotifier/statusnotifieriteminterface.cpp deleted file mode 100644 index 8c388eb..0000000 --- a/plugin-statusnotifier/statusnotifieriteminterface.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 */ - -/* - * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c StatusNotifierItemInterface -p statusnotifieriteminterface -i dbustypes.h dbus-ifaces/org.kde.StatusNotifierItem.xml - * - * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. - * - * This is an auto-generated file. - * This file may have been hand-edited. Look for HAND-EDIT comments - * before re-generating it. - */ - -#include "statusnotifieriteminterface.h" - -/* - * Implementation of interface class StatusNotifierItemInterface - */ - -StatusNotifierItemInterface::StatusNotifierItemInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) - : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) -{ -} - -StatusNotifierItemInterface::~StatusNotifierItemInterface() -{ -} - diff --git a/plugin-statusnotifier/statusnotifieriteminterface.h b/plugin-statusnotifier/statusnotifieriteminterface.h deleted file mode 100644 index 4e1435f..0000000 --- a/plugin-statusnotifier/statusnotifieriteminterface.h +++ /dev/null @@ -1,174 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 */ - -/* - * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c StatusNotifierItemInterface -p statusnotifieriteminterface -i dbustypes.h dbus-ifaces/org.kde.StatusNotifierItem.xml - * - * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. - * - * This is an auto-generated file. - * Do not edit! All changes made to it will be lost. - */ - -#ifndef STATUSNOTIFIERITEMINTERFACE_H -#define STATUSNOTIFIERITEMINTERFACE_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include "dbustypes.h" - -/* - * Proxy class for interface org.kde.StatusNotifierItem - */ -class StatusNotifierItemInterface: public QDBusAbstractInterface -{ - Q_OBJECT -public: - static inline const char *staticInterfaceName() - { return "org.kde.StatusNotifierItem"; } - -public: - StatusNotifierItemInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); - - ~StatusNotifierItemInterface(); - - Q_PROPERTY(QString AttentionIconName READ attentionIconName) - inline QString attentionIconName() const - { return qvariant_cast< QString >(property("AttentionIconName")); } - - Q_PROPERTY(IconPixmapList AttentionIconPixmap READ attentionIconPixmap) - inline IconPixmapList attentionIconPixmap() const - { return qvariant_cast< IconPixmapList >(property("AttentionIconPixmap")); } - - Q_PROPERTY(QString AttentionMovieName READ attentionMovieName) - inline QString attentionMovieName() const - { return qvariant_cast< QString >(property("AttentionMovieName")); } - - Q_PROPERTY(QString Category READ category) - inline QString category() const - { return qvariant_cast< QString >(property("Category")); } - - Q_PROPERTY(QString IconName READ iconName) - inline QString iconName() const - { return qvariant_cast< QString >(property("IconName")); } - - Q_PROPERTY(IconPixmapList IconPixmap READ iconPixmap) - inline IconPixmapList iconPixmap() const - { return qvariant_cast< IconPixmapList >(property("IconPixmap")); } - - Q_PROPERTY(QString IconThemePath READ iconThemePath) - inline QString iconThemePath() const - { return qvariant_cast< QString >(property("IconThemePath")); } - - Q_PROPERTY(QString Id READ id) - inline QString id() const - { return qvariant_cast< QString >(property("Id")); } - - Q_PROPERTY(bool ItemIsMenu READ itemIsMenu) - inline bool itemIsMenu() const - { return qvariant_cast< bool >(property("ItemIsMenu")); } - - Q_PROPERTY(QDBusObjectPath Menu READ menu) - inline QDBusObjectPath menu() const - { return qvariant_cast< QDBusObjectPath >(property("Menu")); } - - Q_PROPERTY(QString OverlayIconName READ overlayIconName) - inline QString overlayIconName() const - { return qvariant_cast< QString >(property("OverlayIconName")); } - - Q_PROPERTY(IconPixmapList OverlayIconPixmap READ overlayIconPixmap) - inline IconPixmapList overlayIconPixmap() const - { return qvariant_cast< IconPixmapList >(property("OverlayIconPixmap")); } - - Q_PROPERTY(QString Status READ status) - inline QString status() const - { return qvariant_cast< QString >(property("Status")); } - - Q_PROPERTY(QString Title READ title) - inline QString title() const - { return qvariant_cast< QString >(property("Title")); } - - Q_PROPERTY(ToolTip ToolTip READ toolTip) - inline ToolTip toolTip() const - { return qvariant_cast< ToolTip >(property("ToolTip")); } - - Q_PROPERTY(int WindowId READ windowId) - inline int windowId() const - { return qvariant_cast< int >(property("WindowId")); } - -public Q_SLOTS: // METHODS - inline QDBusPendingReply<> Activate(int x, int y) - { - QList argumentList; - argumentList << QVariant::fromValue(x) << QVariant::fromValue(y); - return asyncCallWithArgumentList(QLatin1String("Activate"), argumentList); - } - - inline QDBusPendingReply<> ContextMenu(int x, int y) - { - QList argumentList; - argumentList << QVariant::fromValue(x) << QVariant::fromValue(y); - return asyncCallWithArgumentList(QLatin1String("ContextMenu"), argumentList); - } - - inline QDBusPendingReply<> Scroll(int delta, const QString &orientation) - { - QList argumentList; - argumentList << QVariant::fromValue(delta) << QVariant::fromValue(orientation); - return asyncCallWithArgumentList(QLatin1String("Scroll"), argumentList); - } - - inline QDBusPendingReply<> SecondaryActivate(int x, int y) - { - QList argumentList; - argumentList << QVariant::fromValue(x) << QVariant::fromValue(y); - return asyncCallWithArgumentList(QLatin1String("SecondaryActivate"), argumentList); - } - -Q_SIGNALS: // SIGNALS - void NewAttentionIcon(); - void NewIcon(); - void NewOverlayIcon(); - void NewStatus(const QString &status); - void NewTitle(); - void NewToolTip(); -}; - -namespace org { - namespace kde { - typedef ::StatusNotifierItemInterface StatusNotifierItem; - } -} -#endif diff --git a/plugin-statusnotifier/statusnotifierwatcher.cpp b/plugin-statusnotifier/statusnotifierwatcher.cpp deleted file mode 100644 index f23cd4e..0000000 --- a/plugin-statusnotifier/statusnotifierwatcher.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 "statusnotifierwatcher.h" -#include -#include - -StatusNotifierWatcher::StatusNotifierWatcher(QObject *parent) : QObject(parent) -{ - qRegisterMetaType("IconPixmap"); - qDBusRegisterMetaType(); - qRegisterMetaType("IconPixmapList"); - qDBusRegisterMetaType(); - qRegisterMetaType("ToolTip"); - qDBusRegisterMetaType(); - - QDBusConnection dbus = QDBusConnection::sessionBus(); - if (!dbus.registerService("org.kde.StatusNotifierWatcher")) - qDebug() << QDBusConnection::sessionBus().lastError().message(); - if (!dbus.registerObject("/StatusNotifierWatcher", this, QDBusConnection::ExportScriptableContents)) - qDebug() << QDBusConnection::sessionBus().lastError().message(); - - mWatcher = new QDBusServiceWatcher(this); - mWatcher->setConnection(dbus); - mWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); - - connect(mWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &StatusNotifierWatcher::serviceUnregistered); -} - -StatusNotifierWatcher::~StatusNotifierWatcher() -{ - QDBusConnection::sessionBus().unregisterService("org.kde.StatusNotifierWatcher"); -} - -void StatusNotifierWatcher::RegisterStatusNotifierItem(const QString &serviceOrPath) -{ - QString service = serviceOrPath; - QString path = "/StatusNotifierItem"; - - // workaround for sni-qt - if (service.startsWith('/')) - { - path = service; - service = message().service(); - } - - QString notifierItemId = service + path; - - if (QDBusConnection::sessionBus().interface()->isServiceRegistered(service).value() - && !mServices.contains(notifierItemId)) - { - mServices << notifierItemId; - mWatcher->addWatchedService(service); - emit StatusNotifierItemRegistered(notifierItemId); - } -} - -void StatusNotifierWatcher::RegisterStatusNotifierHost(const QString &service) -{ - if (!mHosts.contains(service)) - { - mHosts.append(service); - mWatcher->addWatchedService(service); - } -} - -void StatusNotifierWatcher::serviceUnregistered(const QString &service) -{ - qDebug() << "Service" << service << "unregistered"; - - mWatcher->removeWatchedService(service); - - if (mHosts.contains(service)) - { - mHosts.removeAll(service); - return; - } - - QString match = service + '/'; - QStringList::Iterator it = mServices.begin(); - while (it != mServices.end()) - { - if (it->startsWith(match)) - { - QString name = *it; - it = mServices.erase(it); - emit StatusNotifierItemUnregistered(name); - } - else - ++it; - } -} diff --git a/plugin-statusnotifier/statusnotifierwatcher.h b/plugin-statusnotifier/statusnotifierwatcher.h deleted file mode 100644 index c322eca..0000000 --- a/plugin-statusnotifier/statusnotifierwatcher.h +++ /dev/null @@ -1,73 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 STATUSNOTIFIERWATCHER_H -#define STATUSNOTIFIERWATCHER_H - -#include -#include -#include -#include -#include - -#include "dbustypes.h" - -class StatusNotifierWatcher : public QObject, protected QDBusContext -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.StatusNotifierWatcher") - Q_SCRIPTABLE Q_PROPERTY(bool IsStatusNotifierHostRegistered READ isStatusNotifierHostRegistered) - Q_SCRIPTABLE Q_PROPERTY(int ProtocolVersion READ protocolVersion) - Q_SCRIPTABLE Q_PROPERTY(QStringList RegisteredStatusNotifierItems READ RegisteredStatusNotifierItems) - -public: - explicit StatusNotifierWatcher(QObject *parent = 0); - ~StatusNotifierWatcher(); - - bool isStatusNotifierHostRegistered() { return mHosts.count() > 0; } - int protocolVersion() const { return 0; } - QStringList RegisteredStatusNotifierItems() const { return mServices; } - -signals: - Q_SCRIPTABLE void StatusNotifierItemRegistered(const QString &service); - Q_SCRIPTABLE void StatusNotifierItemUnregistered(const QString &service); - Q_SCRIPTABLE void StatusNotifierHostRegistered(); - -public slots: - Q_SCRIPTABLE void RegisterStatusNotifierItem(const QString &serviceOrPath); - Q_SCRIPTABLE void RegisterStatusNotifierHost(const QString &service); - - void serviceUnregistered(const QString &service); - -private: - QStringList mServices; - QStringList mHosts; - QDBusServiceWatcher *mWatcher; -}; - -#endif // STATUSNOTIFIERWATCHER_H diff --git a/plugin-statusnotifier/statusnotifierwidget.cpp b/plugin-statusnotifier/statusnotifierwidget.cpp deleted file mode 100644 index 50bf5fb..0000000 --- a/plugin-statusnotifier/statusnotifierwidget.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 "statusnotifierwidget.h" -#include -#include -#include "../panel/ilxqtpanelplugin.h" - -StatusNotifierWidget::StatusNotifierWidget(ILXQtPanelPlugin *plugin, QWidget *parent) : - QWidget(parent), - mPlugin(plugin) -{ - QString dbusName = QString("org.kde.StatusNotifierHost-%1-%2").arg(QApplication::applicationPid()).arg(1); - if (!QDBusConnection::sessionBus().registerService(dbusName)) - qDebug() << QDBusConnection::sessionBus().lastError().message(); - - mWatcher = new StatusNotifierWatcher; - mWatcher->RegisterStatusNotifierHost(dbusName); - - connect(mWatcher, &StatusNotifierWatcher::StatusNotifierItemRegistered, - this, &StatusNotifierWidget::itemAdded); - connect(mWatcher, &StatusNotifierWatcher::StatusNotifierItemUnregistered, - this, &StatusNotifierWidget::itemRemoved); - - setLayout(new LXQt::GridLayout(this)); - realign(); - - qDebug() << mWatcher->RegisteredStatusNotifierItems(); - -} - -StatusNotifierWidget::~StatusNotifierWidget() -{ - delete mWatcher; -} - -void StatusNotifierWidget::itemAdded(QString serviceAndPath) -{ - int slash = serviceAndPath.indexOf('/'); - QString serv = serviceAndPath.left(slash); - QString path = serviceAndPath.mid(slash); - StatusNotifierButton *button = new StatusNotifierButton(serv, path, mPlugin, this); - - mServices.insert(serviceAndPath, button); - layout()->addWidget(button); - button->show(); -} - -void StatusNotifierWidget::itemRemoved(const QString &serviceAndPath) -{ - StatusNotifierButton *button = mServices.value(serviceAndPath, NULL); - if (button) - { - button->deleteLater(); - layout()->removeWidget(button); - } -} - -void StatusNotifierWidget::realign() -{ - LXQt::GridLayout *layout = qobject_cast(this->layout()); - layout->setEnabled(false); - - ILXQtPanel *panel = mPlugin->panel(); - if (panel->isHorizontal()) - { - layout->setRowCount(panel->lineCount()); - layout->setColumnCount(0); - } - else - { - layout->setColumnCount(panel->lineCount()); - layout->setRowCount(0); - } - - layout->setEnabled(true); -} diff --git a/plugin-statusnotifier/statusnotifierwidget.h b/plugin-statusnotifier/statusnotifierwidget.h deleted file mode 100644 index f98a833..0000000 --- a/plugin-statusnotifier/statusnotifierwidget.h +++ /dev/null @@ -1,62 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2015 LXQt team - * Authors: - * Balázs Béla - * Paulo Lieuthier - * - * 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 STATUSNOTIFIERWIDGET_H -#define STATUSNOTIFIERWIDGET_H - -#include - -#include - -#include "statusnotifierbutton.h" -#include "statusnotifierwatcher.h" - -class StatusNotifierWidget : public QWidget -{ - Q_OBJECT - -public: - StatusNotifierWidget(ILXQtPanelPlugin *plugin, QWidget *parent = 0); - ~StatusNotifierWidget(); - -signals: - -public slots: - void itemAdded(QString serviceAndPath); - void itemRemoved(const QString &serviceAndPath); - - void realign(); - -private: - ILXQtPanelPlugin *mPlugin; - StatusNotifierWatcher *mWatcher; - - QHash mServices; -}; - -#endif // STATUSNOTIFIERWIDGET_H diff --git a/plugin-statusnotifier/translations/statusnotifier_ar.desktop b/plugin-statusnotifier/translations/statusnotifier_ar.desktop deleted file mode 100644 index ac44a71..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=ملحقة لمُخطر الحالة -Comment[ar]=ملحقة لمُخطر الحالة diff --git a/plugin-statusnotifier/translations/statusnotifier_da.desktop b/plugin-statusnotifier/translations/statusnotifier_da.desktop deleted file mode 100644 index 4bbb474..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_da.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Status Notifier Plugin -Comment=Status Notifier Plugin -Icon=go-bottom - -# Translations -Name[da]=Statusnotifikator-plugin -Comment[da]=Statusnotifikator-plugin \ No newline at end of file diff --git a/plugin-statusnotifier/translations/statusnotifier_de.desktop b/plugin-statusnotifier/translations/statusnotifier_de.desktop deleted file mode 100644 index 6f367a0..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Statusbenachrichtigungen -Comment[de]=Plugin für Statusbenachrichtigungen diff --git a/plugin-statusnotifier/translations/statusnotifier_el.desktop b/plugin-statusnotifier/translations/statusnotifier_el.desktop deleted file mode 100644 index 111b2c4..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_el.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[el]=Πρόσθετο ειδοποίησης κατάστασης -Comment[el]=Πρόσθετο ειδοποίησης κατάστασης - diff --git a/plugin-statusnotifier/translations/statusnotifier_fr.desktop b/plugin-statusnotifier/translations/statusnotifier_fr.desktop deleted file mode 100644 index e256bcd..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Information du statut -Comment[fr]=Greffon d'information du statut diff --git a/plugin-statusnotifier/translations/statusnotifier_hu.desktop b/plugin-statusnotifier/translations/statusnotifier_hu.desktop deleted file mode 100644 index 0d6e64c..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_hu.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[hu]=Állapotjelzés -Comment[hu]=Álapotértesítő bővítmény diff --git a/plugin-statusnotifier/translations/statusnotifier_it.desktop b/plugin-statusnotifier/translations/statusnotifier_it.desktop deleted file mode 100644 index bcdee8f..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Notificatore -Comment[it]=Mostra lo status delle applicazioni diff --git a/plugin-statusnotifier/translations/statusnotifier_lt.desktop b/plugin-statusnotifier/translations/statusnotifier_lt.desktop deleted file mode 100644 index 05b8081..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Pranešimų įskiepis -Comment[lt]=Pranešimų įskiepis diff --git a/plugin-statusnotifier/translations/statusnotifier_pl.desktop b/plugin-statusnotifier/translations/statusnotifier_pl.desktop deleted file mode 100644 index c41011a..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_pl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[pl]=Wtyczka powiadomień o stanie -Comment[pl]=Wtyczka powiadomień o stanie diff --git a/plugin-statusnotifier/translations/statusnotifier_pt.desktop b/plugin-statusnotifier/translations/statusnotifier_pt.desktop deleted file mode 100644 index 9e65b1e..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Name[pt]=Plugin Status Notifier -Comment[pt]=Um plugin para notificar sobre o estado diff --git a/plugin-statusnotifier/translations/statusnotifier_ru.desktop b/plugin-statusnotifier/translations/statusnotifier_ru.desktop deleted file mode 100644 index 3b3766b..0000000 --- a/plugin-statusnotifier/translations/statusnotifier_ru.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ru]=Плагин уведомлений -Comment[ru]=Плагин уведомлений diff --git a/plugin-sysstat/CMakeLists.txt b/plugin-sysstat/CMakeLists.txt deleted file mode 100644 index 6cb28e6..0000000 --- a/plugin-sysstat/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -set(PLUGIN "sysstat") - -find_package(SysStat-Qt5 REQUIRED) - -set(HEADERS - lxqtsysstat.h - lxqtsysstatconfiguration.h - lxqtsysstatcolours.h - lxqtsysstatutils.h -) - -set(SOURCES - lxqtsysstat.cpp - lxqtsysstatconfiguration.cpp - lxqtsysstatcolours.cpp - lxqtsysstatutils.cpp -) - -set(UIS - lxqtsysstatconfiguration.ui - lxqtsysstatcolours.ui -) - -set(LIBRARIES sysstat-qt5) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-sysstat/lxqtsysstat.cpp b/plugin-sysstat/lxqtsysstat.cpp deleted file mode 100644 index a0bc7d7..0000000 --- a/plugin-sysstat/lxqtsysstat.cpp +++ /dev/null @@ -1,627 +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: - * Kuzma Shapran - * - * 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 "lxqtsysstat.h" -#include "lxqtsysstatutils.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -LXQtSysStat::LXQtSysStat(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - mWidget(new QWidget()), - mFakeTitle(new LXQtSysStatTitle(mWidget)), - mContent(new LXQtSysStatContent(this, mWidget)) -{ - QVBoxLayout *borderLayout = new QVBoxLayout(mWidget); - borderLayout->setContentsMargins(0, 0, 0, 0); - borderLayout->setSpacing(0); - borderLayout->addWidget(mContent); - borderLayout->setStretchFactor(mContent, 1); - - mContent->setMinimumSize(2, 2); - - // qproperty of font type doesn't work with qss, so fake QLabel is used instead - connect(mFakeTitle, SIGNAL(fontChanged(QFont)), mContent, SLOT(setTitleFont(QFont))); - - // has to be postponed to update the size first - QTimer::singleShot(0, this, SLOT(lateInit())); -} - -LXQtSysStat::~LXQtSysStat() -{ - delete mWidget; -} - -void LXQtSysStat::lateInit() -{ - settingsChanged(); - mContent->setTitleFont(mFakeTitle->font()); - mSize = mContent->size(); -} - -QDialog *LXQtSysStat::configureDialog() -{ - return new LXQtSysStatConfiguration(settings(), mWidget); -} - -void LXQtSysStat::realign() -{ - QSize newSize = mContent->size(); - if (mSize != newSize) - { - mContent->reset(); - mSize = newSize; - } -} - -void LXQtSysStat::settingsChanged() -{ - mContent->updateSettings(settings()); -} - -LXQtSysStatTitle::LXQtSysStatTitle(QWidget *parent): - QLabel(parent) -{ - -} - -LXQtSysStatTitle::~LXQtSysStatTitle() -{ - -} - -bool LXQtSysStatTitle::event(QEvent *e) -{ - if (e->type() == QEvent::FontChange) - emit fontChanged(font()); - - return QLabel::event(e); -} - -LXQtSysStatContent::LXQtSysStatContent(ILXQtPanelPlugin *plugin, QWidget *parent): - QWidget(parent), - mPlugin(plugin), - mStat(NULL), - mUpdateInterval(0), - mMinimalSize(0), - mTitleFontPixelHeight(0), - mUseThemeColours(true), - mHistoryOffset(0) -{ - setObjectName("SysStat_Graph"); -} - -LXQtSysStatContent::~LXQtSysStatContent() -{ -} - - -// I don't like macros very much, but writing dozen similar functions is much much worse. - -#undef QSS_GET_COLOUR -#define QSS_GET_COLOUR(GETNAME) \ -QColor LXQtSysStatContent::GETNAME##Colour() const \ -{ \ - return mThemeColours.GETNAME##Colour; \ -} - -#undef QSS_COLOUR -#define QSS_COLOUR(GETNAME, SETNAME) \ -QSS_GET_COLOUR(GETNAME) \ -void LXQtSysStatContent::SETNAME##Colour(QColor value) \ -{ \ - mThemeColours.GETNAME##Colour = value; \ - if (mUseThemeColours) \ - mColours.GETNAME##Colour = mThemeColours.GETNAME##Colour; \ -} - -#undef QSS_NET_COLOUR -#define QSS_NET_COLOUR(GETNAME, SETNAME) \ -QSS_GET_COLOUR(GETNAME) \ -void LXQtSysStatContent::SETNAME##Colour(QColor value) \ -{ \ - mThemeColours.GETNAME##Colour = value; \ - if (mUseThemeColours) \ - { \ - mColours.GETNAME##Colour = mThemeColours.GETNAME##Colour; \ - mixNetColours(); \ - } \ -} - -QSS_COLOUR(grid, setGrid) -QSS_COLOUR(title, setTitle) -QSS_COLOUR(cpuSystem, setCpuSystem) -QSS_COLOUR(cpuUser, setCpuUser) -QSS_COLOUR(cpuNice, setCpuNice) -QSS_COLOUR(cpuOther, setCpuOther) -QSS_COLOUR(frequency, setFrequency) -QSS_COLOUR(memApps, setMemApps) -QSS_COLOUR(memBuffers,setMemBuffers) -QSS_COLOUR(memCached, setMemCached) -QSS_COLOUR(swapUsed, setSwapUsed) - -QSS_NET_COLOUR(netReceived, setNetReceived) -QSS_NET_COLOUR(netTransmitted, setNetTransmitted) - -#undef QSS_NET_COLOUR -#undef QSS_COLOUR -#undef QSS_GET_COLOUR - -void LXQtSysStatContent::mixNetColours() -{ - QColor netReceivedColour_hsv = mColours.netReceivedColour.toHsv(); - QColor netTransmittedColour_hsv = mColours.netTransmittedColour.toHsv(); - qreal hue = (netReceivedColour_hsv.hueF() + netTransmittedColour_hsv.hueF()) / 2; - if (qAbs(netReceivedColour_hsv.hueF() - netTransmittedColour_hsv.hueF()) > 0.5) - hue += 0.5; - mNetBothColour.setHsvF( - hue, - (netReceivedColour_hsv.saturationF() + netTransmittedColour_hsv.saturationF()) / 2, - (netReceivedColour_hsv.valueF() + netTransmittedColour_hsv.valueF() ) / 2 ); -} - -void LXQtSysStatContent::setTitleFont(QFont value) -{ - mTitleFont = value; - updateTitleFontPixelHeight(); - - update(); -} - -void LXQtSysStatContent::updateTitleFontPixelHeight() -{ - if (mTitleLabel.isEmpty()) - mTitleFontPixelHeight = 0; - else - { - QFontMetrics fm(mTitleFont); - mTitleFontPixelHeight = fm.height() - 1; - } -} - -void LXQtSysStatContent::updateSettings(const PluginSettings *settings) -{ - double old_updateInterval = mUpdateInterval; - int old_minimalSize = mMinimalSize; - QString old_dataType = mDataType; - QString old_dataSource = mDataSource; - bool old_useFrequency = mUseFrequency; - bool old_logarithmicScale = mLogarithmicScale; - int old_logScaleSteps = mLogScaleSteps; - - mUseThemeColours = settings->value("graph/useThemeColours", true).toBool(); - mUpdateInterval = settings->value("graph/updateInterval", 1.0).toDouble(); - mMinimalSize = settings->value("graph/minimalSize", 30).toInt(); - - mGridLines = settings->value("grid/lines", 1).toInt(); - - mTitleLabel = settings->value("title/label", QString()).toString(); - - // default to CPU monitoring - mDataType = settings->value("data/type", LXQtSysStatConfiguration::msStatTypes[0]).toString(); - - mDataSource = settings->value("data/source", QString("cpu")).toString(); - - mUseFrequency = settings->value("cpu/useFrequency", true).toBool(); - - mNetMaximumSpeed = PluginSysStat::netSpeedFromString(settings->value("net/maximumSpeed", "1 MB/s").toString()); - mLogarithmicScale = settings->value("net/logarithmicScale", true).toBool(); - - mLogScaleSteps = settings->value("net/logarithmicScaleSteps", 4).toInt(); - mLogScaleMax = static_cast(static_cast(1) << mLogScaleSteps); - - mNetRealMaximumSpeed = static_cast(static_cast(1) << mNetMaximumSpeed); - - - mSettingsColours.gridColour = QColor(settings->value("grid/colour", "#c0c0c0").toString()); - - mSettingsColours.titleColour = QColor(settings->value("title/colour", "#ffffff").toString()); - - mSettingsColours.cpuSystemColour = QColor(settings->value("cpu/systemColour", "#800000").toString()); - mSettingsColours.cpuUserColour = QColor(settings->value("cpu/userColour", "#000080").toString()); - mSettingsColours.cpuNiceColour = QColor(settings->value("cpu/niceColour", "#008000").toString()); - mSettingsColours.cpuOtherColour = QColor(settings->value("cpu/otherColour", "#808000").toString()); - mSettingsColours.frequencyColour = QColor(settings->value("cpu/frequencyColour", "#808080").toString()); - - mSettingsColours.memAppsColour = QColor(settings->value("mem/appsColour", "#000080").toString()); - mSettingsColours.memBuffersColour = QColor(settings->value("mem/buffersColour", "#008000").toString()); - mSettingsColours.memCachedColour = QColor(settings->value("mem/cachedColour", "#808000").toString()); - mSettingsColours.swapUsedColour = QColor(settings->value("mem/swapColour", "#800000").toString()); - - mSettingsColours.netReceivedColour = QColor(settings->value("net/receivedColour", "#000080").toString()); - mSettingsColours.netTransmittedColour = QColor(settings->value("net/transmittedColour", "#808000").toString()); - - - if (mUseThemeColours) - mColours = mThemeColours; - else - mColours = mSettingsColours; - - mixNetColours(); - - updateTitleFontPixelHeight(); - - - bool minimalSizeChanged = old_minimalSize != mMinimalSize; - bool updateIntervalChanged = old_updateInterval != mUpdateInterval; - bool dataTypeChanged = old_dataType != mDataType; - bool dataSourceChanged = old_dataSource != mDataSource; - bool useFrequencyChanged = old_useFrequency != mUseFrequency; - bool logScaleStepsChanged = old_logScaleSteps != mLogScaleSteps; - bool logarithmicScaleChanged = old_logarithmicScale != mLogarithmicScale; - - bool needReconnecting = dataTypeChanged || dataSourceChanged || useFrequencyChanged; - bool needTimerRestarting = needReconnecting || updateIntervalChanged; - bool needFullReset = needTimerRestarting || minimalSizeChanged || logScaleStepsChanged || logarithmicScaleChanged; - - - if (mStat) - { - if (needTimerRestarting) - mStat->stopUpdating(); - - if (needReconnecting) - mStat->disconnect(this); - } - - if (dataTypeChanged) - { - if (mStat) - { - mStat->deleteLater(); - mStat = nullptr; - } - - if (mDataType == "CPU") - mStat = new SysStat::CpuStat(this); - else if (mDataType == "Memory") - mStat = new SysStat::MemStat(this); - else if (mDataType == "Network") - mStat = new SysStat::NetStat(this); - } - - if (mStat) - { - if (needReconnecting) - { - if (mDataType == "CPU") - { - if (mUseFrequency) - { - qobject_cast(mStat)->setMonitoring(SysStat::CpuStat::LoadAndFrequency); - connect(qobject_cast(mStat), SIGNAL(update(float, float, float, float, float, uint)), this, SLOT(cpuUpdate(float, float, float, float, float, uint))); - } - else - { - qobject_cast(mStat)->setMonitoring(SysStat::CpuStat::LoadOnly); - connect(qobject_cast(mStat), SIGNAL(update(float, float, float, float)), this, SLOT(cpuUpdate(float, float, float, float))); - } - } - else if (mDataType == "Memory") - { - if (mDataSource == "memory") - connect(qobject_cast(mStat), SIGNAL(memoryUpdate(float, float, float)), this, SLOT(memoryUpdate(float, float, float))); - else - connect(qobject_cast(mStat), SIGNAL(swapUpdate(float)), this, SLOT(swapUpdate(float))); - } - else if (mDataType == "Network") - { - connect(qobject_cast(mStat), SIGNAL(update(unsigned, unsigned)), this, SLOT(networkUpdate(unsigned, unsigned))); - } - - mStat->setMonitoredSource(mDataSource); - } - - if (needTimerRestarting) - mStat->setUpdateInterval(static_cast(mUpdateInterval * 1000.0)); - } - - if (needFullReset) - reset(); - else - update(); -} - -void LXQtSysStatContent::resizeEvent(QResizeEvent * /*event*/) -{ - reset(); -} - -void LXQtSysStatContent::reset() -{ - setMinimumSize(mPlugin->panel()->isHorizontal() ? mMinimalSize : 2, - mPlugin->panel()->isHorizontal() ? 2 : mMinimalSize); - - mHistoryOffset = 0; - mHistoryImage = QImage(width(), 100, QImage::Format_ARGB32); - mHistoryImage.fill(Qt::transparent); - update(); -} - -template -T clamp(const T &value, const T &min, const T &max) -{ - return qMin(qMax(value, min), max); -} - -// QPainter.drawLine with pen set to Qt::transparent doesn't clear anything -void LXQtSysStatContent::clearLine() -{ - QRgb bg = QColor(Qt::transparent).rgba(); - for (int i = 0; i < 100; ++i) - reinterpret_cast(mHistoryImage.scanLine(i))[mHistoryOffset] = bg; -} - -void LXQtSysStatContent::cpuUpdate(float user, float nice, float system, float other, float frequencyRate, uint) -{ - int y_system = static_cast(system * 100.0 * frequencyRate); - int y_user = static_cast(user * 100.0 * frequencyRate); - int y_nice = static_cast(nice * 100.0 * frequencyRate); - int y_other = static_cast(other * 100.0 * frequencyRate); - int y_freq = static_cast( 100.0 * frequencyRate); - - toolTipInfo(tr("system: %1%
user: %2%
nice: %3%
other: %4%
freq: %5%", "CPU tooltip information") - .arg(y_system).arg(y_user).arg(y_nice).arg(y_other).arg(y_freq)); - - y_system = clamp(y_system, 0, 99); - y_user = clamp(y_user + y_system, 0, 99); - y_nice = clamp(y_nice + y_user , 0, 99); - y_other = clamp(y_other, 0, 99); - y_freq = clamp(y_freq, 0, 99); - - clearLine(); - QPainter painter(&mHistoryImage); - if (y_system != 0) - { - painter.setPen(mColours.cpuSystemColour); - painter.drawLine(mHistoryOffset, y_system, mHistoryOffset, 0); - } - if (y_user != y_system) - { - painter.setPen(mColours.cpuUserColour); - painter.drawLine(mHistoryOffset, y_user, mHistoryOffset, y_system); - } - if (y_nice != y_user) - { - painter.setPen(mColours.cpuNiceColour); - painter.drawLine(mHistoryOffset, y_nice, mHistoryOffset, y_user); - } - if (y_other != y_nice) - { - painter.setPen(mColours.cpuOtherColour); - painter.drawLine(mHistoryOffset, y_other, mHistoryOffset, y_nice); - } - if (y_freq != y_other) - { - painter.setPen(mColours.frequencyColour); - painter.drawLine(mHistoryOffset, y_freq, mHistoryOffset, y_other); - } - - mHistoryOffset = (mHistoryOffset + 1) % width(); - - update(0, mTitleFontPixelHeight, width(), height() - mTitleFontPixelHeight); -} - -void LXQtSysStatContent::cpuUpdate(float user, float nice, float system, float other) -{ - int y_system = static_cast(system * 100.0); - int y_user = static_cast(user * 100.0); - int y_nice = static_cast(nice * 100.0); - int y_other = static_cast(other * 100.0); - - toolTipInfo(tr("system: %1%
user: %2%
nice: %3%
other: %4%
freq: n/a", "CPU tooltip information") - .arg(y_system).arg(y_user).arg(y_nice).arg(y_other)); - - y_system = clamp(y_system, 0, 99); - y_user = clamp(y_user + y_system, 0, 99); - y_nice = clamp(y_nice + y_user, 0, 99); - y_other = clamp(y_other + y_nice, 0, 99); - - clearLine(); - QPainter painter(&mHistoryImage); - if (y_system != 0) - { - painter.setPen(mColours.cpuSystemColour); - painter.drawLine(mHistoryOffset, y_system, mHistoryOffset, 0); - } - if (y_user != y_system) - { - painter.setPen(mColours.cpuUserColour); - painter.drawLine(mHistoryOffset, y_user, mHistoryOffset, y_system); - } - if (y_nice != y_user) - { - painter.setPen(mColours.cpuNiceColour); - painter.drawLine(mHistoryOffset, y_nice, mHistoryOffset, y_user); - } - if (y_other != y_nice) - { - painter.setPen(mColours.cpuOtherColour); - painter.drawLine(mHistoryOffset, y_other, mHistoryOffset, y_nice); - } - - mHistoryOffset = (mHistoryOffset + 1) % width(); - - update(0, mTitleFontPixelHeight, width(), height() - mTitleFontPixelHeight); -} - -void LXQtSysStatContent::memoryUpdate(float apps, float buffers, float cached) -{ - int y_apps = static_cast(apps * 100.0); - int y_buffers = static_cast(buffers * 100.0); - int y_cached = static_cast(cached * 100.0); - - toolTipInfo(tr("apps: %1%
buffers: %2%
cached: %3%", "Memory tooltip information") - .arg(y_apps).arg(y_buffers).arg(y_cached)); - - y_apps = clamp(y_apps, 0, 99); - y_buffers = clamp(y_buffers + y_apps, 0, 99); - y_cached = clamp(y_cached + y_buffers, 0, 99); - - clearLine(); - QPainter painter(&mHistoryImage); - if (y_apps != 0) - { - painter.setPen(mColours.memAppsColour); - painter.drawLine(mHistoryOffset, y_apps, mHistoryOffset, 0); - } - if (y_buffers != y_apps) - { - painter.setPen(mColours.memBuffersColour); - painter.drawLine(mHistoryOffset, y_buffers, mHistoryOffset, y_apps); - } - if (y_cached != y_buffers) - { - painter.setPen(mColours.memCachedColour); - painter.drawLine(mHistoryOffset, y_cached, mHistoryOffset, y_buffers); - } - - mHistoryOffset = (mHistoryOffset + 1) % width(); - - update(0, mTitleFontPixelHeight, width(), height() - mTitleFontPixelHeight); -} - -void LXQtSysStatContent::swapUpdate(float used) -{ - int y_used = static_cast(used * 100.0); - - toolTipInfo(tr("used: %1%", "Swap tooltip information").arg(y_used)); - - y_used = clamp(y_used, 0, 99); - - clearLine(); - QPainter painter(&mHistoryImage); - if (y_used != 0) - { - painter.setPen(mColours.swapUsedColour); - painter.drawLine(mHistoryOffset, y_used, mHistoryOffset, 0); - } - - mHistoryOffset = (mHistoryOffset + 1) % width(); - - update(0, mTitleFontPixelHeight, width(), height() - mTitleFontPixelHeight); -} - -void LXQtSysStatContent::networkUpdate(unsigned received, unsigned transmitted) -{ - qreal min_value = qMin(qMax(static_cast(qMin(received, transmitted)) / mNetRealMaximumSpeed, static_cast(0.0)), static_cast(1.0)); - qreal max_value = qMin(qMax(static_cast(qMax(received, transmitted)) / mNetRealMaximumSpeed, static_cast(0.0)), static_cast(1.0)); - if (mLogarithmicScale) - { - min_value = qLn(min_value * (mLogScaleMax - 1.0) + 1.0) / qLn(2.0) / static_cast(mLogScaleSteps); - max_value = qLn(max_value * (mLogScaleMax - 1.0) + 1.0) / qLn(2.0) / static_cast(mLogScaleSteps); - } - - int y_min_value = static_cast(min_value * 100.0); - int y_max_value = static_cast(max_value * 100.0); - - toolTipInfo(tr("min: %1%
max: %2%", "Network tooltip information").arg(y_min_value).arg(y_max_value)); - - y_min_value = clamp(y_min_value, 0, 99); - y_max_value = clamp(y_max_value + y_min_value, 0, 99); - - clearLine(); - QPainter painter(&mHistoryImage); - if (y_min_value != 0) - { - painter.setPen(mNetBothColour); - painter.drawLine(mHistoryOffset, y_min_value, mHistoryOffset, 0); - } - if (y_max_value != y_min_value) - { - painter.setPen((received > transmitted) ? mColours.netReceivedColour : mColours.netTransmittedColour); - painter.drawLine(mHistoryOffset, y_max_value, mHistoryOffset, y_min_value); - } - - mHistoryOffset = (mHistoryOffset + 1) % width(); - - update(0, mTitleFontPixelHeight, width(), height() - mTitleFontPixelHeight); -} - -void LXQtSysStatContent::paintEvent(QPaintEvent *event) -{ - QPainter p(this); - - qreal graphTop = 0; - qreal graphHeight = height(); - - bool hasTitle = !mTitleLabel.isEmpty(); - - if (hasTitle) - { - graphTop = mTitleFontPixelHeight; - graphHeight -= graphTop; - - if (event->region().intersects(QRect(0, 0, width(), graphTop))) - { - p.setPen(mColours.titleColour); - p.setFont(mTitleFont); - p.drawText(QRectF(0, 0, width(), graphTop), Qt::AlignHCenter | Qt::AlignVCenter, mTitleLabel); - } - } - - if (graphHeight < 1) - graphHeight = 1; - - p.scale(1.0, -1.0); - - p.drawImage(QRect(0, -height(), width() - mHistoryOffset, graphHeight), mHistoryImage, QRect(mHistoryOffset, 0, width() - mHistoryOffset, 100)); - if (mHistoryOffset) - p.drawImage(QRect(width() - mHistoryOffset, -height(), mHistoryOffset, graphHeight), mHistoryImage, QRect(0, 0, mHistoryOffset, 100)); - - p.resetTransform(); - - p.setRenderHint(QPainter::Antialiasing); - - p.setPen(mColours.gridColour); - qreal w = static_cast(width()); - if (hasTitle) - p.drawLine(QPointF(0.0, graphTop + 0.5), QPointF(w, graphTop + 0.5)); // 0.5 looks better with antialiasing - for (int l = 0; l < mGridLines; ++l) - { - qreal y = graphTop + static_cast(l + 1) * graphHeight / (static_cast(mGridLines + 1)); - p.drawLine(QPointF(0.0, y), QPointF(w, y)); - } -} - -void LXQtSysStatContent::toolTipInfo(QString const & tooltip) -{ - setToolTip(QString("%1(%2)
%3") - .arg(QCoreApplication::translate("LXQtSysStatConfiguration", mDataType.toStdString().c_str())) - .arg(QCoreApplication::translate("LXQtSysStatConfiguration", mDataSource.toStdString().c_str())) - .arg(tooltip)); -} diff --git a/plugin-sysstat/lxqtsysstat.h b/plugin-sysstat/lxqtsysstat.h deleted file mode 100644 index 7e91bde..0000000 --- a/plugin-sysstat/lxqtsysstat.h +++ /dev/null @@ -1,227 +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: - * Kuzma Shapran - * - * 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 LXQTPANELSYSSTAT_H -#define LXQTPANELSYSSTAT_H - -#include "../panel/ilxqtpanelplugin.h" -#include "lxqtsysstatconfiguration.h" - -#include - - -class LXQtSysStatTitle; -class LXQtSysStatContent; -class LXQtPanel; - -namespace SysStat { - class BaseStat; -} - -class LXQtSysStat : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - LXQtSysStat(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtSysStat(); - - virtual QWidget *widget() { return mWidget; } - virtual QString themeId() const { return "SysStat"; } - virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog; } - virtual bool isSeparate() const { return true; } - - QDialog *configureDialog(); - - void realign(); - -protected slots: - virtual void lateInit(); - virtual void settingsChanged(); - -private: - QWidget *mWidget; - LXQtSysStatTitle *mFakeTitle; - LXQtSysStatContent *mContent; - QSize mSize; -}; - -class LXQtSysStatTitle : public QLabel -{ - Q_OBJECT -public: - LXQtSysStatTitle(QWidget *parent = NULL); - ~LXQtSysStatTitle(); - -protected: - bool event(QEvent *e); - -signals: - void fontChanged(QFont); -}; - -class LXQtSysStatContent : public QWidget -{ - Q_OBJECT - - Q_PROPERTY(QColor gridColor READ gridColour WRITE setGridColour) - Q_PROPERTY(QColor titleColor READ titleColour WRITE setTitleColour) - Q_PROPERTY(QColor cpuSystemColor READ cpuSystemColour WRITE setCpuSystemColour) - Q_PROPERTY(QColor cpuUserColor READ cpuUserColour WRITE setCpuUserColour) - Q_PROPERTY(QColor cpuNiceColor READ cpuNiceColour WRITE setCpuNiceColour) - Q_PROPERTY(QColor cpuOtherColor READ cpuOtherColour WRITE setCpuOtherColour) - Q_PROPERTY(QColor frequencyColor READ frequencyColour WRITE setFrequencyColour) - Q_PROPERTY(QColor memAppsColor READ memAppsColour WRITE setMemAppsColour) - Q_PROPERTY(QColor memBuffersColor READ memBuffersColour WRITE setMemBuffersColour) - Q_PROPERTY(QColor memCachedColor READ memCachedColour WRITE setMemCachedColour) - Q_PROPERTY(QColor swapUsedColor READ swapUsedColour WRITE setSwapUsedColour) - Q_PROPERTY(QColor netReceivedColor READ netReceivedColour WRITE setNetReceivedColour) - Q_PROPERTY(QColor netTransmittedColor READ netTransmittedColour WRITE setNetTransmittedColour) - -public: - LXQtSysStatContent(ILXQtPanelPlugin *plugin, QWidget *parent = NULL); - ~LXQtSysStatContent(); - - void updateSettings(const PluginSettings *); - -#undef QSS_COLOUR -#define QSS_COLOUR(GETNAME, SETNAME) \ - QColor GETNAME##Colour() const; \ - void SETNAME##Colour(QColor value); - - QSS_COLOUR(grid, setGrid) - QSS_COLOUR(title, setTitle) - QSS_COLOUR(cpuSystem, setCpuSystem) - QSS_COLOUR(cpuUser, setCpuUser) - QSS_COLOUR(cpuNice, setCpuNice) - QSS_COLOUR(cpuOther, setCpuOther) - QSS_COLOUR(frequency, setFrequency) - QSS_COLOUR(memApps, setMemApps) - QSS_COLOUR(memBuffers, setMemBuffers) - QSS_COLOUR(memCached, setMemCached) - QSS_COLOUR(swapUsed, setSwapUsed) - QSS_COLOUR(netReceived, setNetReceived) - QSS_COLOUR(netTransmitted, setNetTransmitted) - -#undef QSS_COLOUR - -public slots: - void setTitleFont(QFont value); - void reset(); - -protected: - void paintEvent(QPaintEvent *); - void resizeEvent(QResizeEvent *); - -protected slots: - void cpuUpdate(float user, float nice, float system, float other, float frequencyRate, uint frequency); - void cpuUpdate(float user, float nice, float system, float other); - void memoryUpdate(float apps, float buffers, float cached); - void swapUpdate(float used); - void networkUpdate(unsigned received, unsigned transmitted); - -private: - void toolTipInfo(QString const & tooltip); - -private: - ILXQtPanelPlugin *mPlugin; - - SysStat::BaseStat *mStat; - - typedef struct ColourPalette - { - QColor gridColour; - - QColor titleColour; - - QColor cpuSystemColour; - QColor cpuUserColour; - QColor cpuNiceColour; - QColor cpuOtherColour; - QColor frequencyColour; - - QColor memAppsColour; - QColor memBuffersColour; - QColor memCachedColour; - QColor swapUsedColour; - - QColor netReceivedColour; - QColor netTransmittedColour; - } ColourPalette; - - double mUpdateInterval; - int mMinimalSize; - - int mGridLines; - - QString mTitleLabel; - QFont mTitleFont; - int mTitleFontPixelHeight; - - QString mDataType; - - QString mDataSource; - - bool mUseFrequency; - - int mNetMaximumSpeed; - qreal mNetRealMaximumSpeed; - bool mLogarithmicScale; - int mLogScaleSteps; - qreal mLogScaleMax; - - - bool mUseThemeColours; - ColourPalette mThemeColours; - ColourPalette mSettingsColours; - ColourPalette mColours; - QColor mNetBothColour; - - - int mHistoryOffset; - QImage mHistoryImage; - - - void clearLine(); - - void mixNetColours(); - void updateTitleFontPixelHeight(); -}; - - -class LXQtSysStatLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new LXQtSysStat(startupInfo); - } -}; - -#endif // LXQTPANELSYSSTAT_H diff --git a/plugin-sysstat/lxqtsysstatcolours.cpp b/plugin-sysstat/lxqtsysstatcolours.cpp deleted file mode 100644 index 74db132..0000000 --- a/plugin-sysstat/lxqtsysstatcolours.cpp +++ /dev/null @@ -1,188 +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: - * Kuzma Shapran - * - * 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 "lxqtsysstatcolours.h" -#include "ui_lxqtsysstatcolours.h" - -#include -#include - - -LXQtSysStatColours::LXQtSysStatColours(QWidget *parent) : - QDialog(parent), - ui(new Ui::LXQtSysStatColours), - mSelectColourMapper(new QSignalMapper(this)) -{ - setWindowModality(Qt::WindowModal); - ui->setupUi(this); - - mDefaultColours["grid"] = QColor("#808080"); - mDefaultColours["title"] = QColor("#000000"); - - mDefaultColours["cpuSystem"] = QColor("#800000"); - mDefaultColours["cpuUser"] = QColor("#000080"); - mDefaultColours["cpuNice"] = QColor("#008000"); - mDefaultColours["cpuOther"] = QColor("#808000"); - mDefaultColours["cpuFrequency"] = QColor("#808080"); - - mDefaultColours["memApps"] = QColor("#000080"); - mDefaultColours["memBuffers"] = QColor("#008000"); - mDefaultColours["memCached"] = QColor("#808000"); - mDefaultColours["memSwap"] = QColor("#800000"); - - mDefaultColours["netReceived"] = QColor("#000080"); - mDefaultColours["netTransmitted"] = QColor("#808000"); - - -#undef CONNECT_SELECT_COLOUR -#define CONNECT_SELECT_COLOUR(VAR) \ - connect(ui-> VAR ## B, SIGNAL(clicked()), mSelectColourMapper, SLOT(map())); \ - mSelectColourMapper->setMapping(ui-> VAR ## B, QString( #VAR )); \ - mShowColourMap[QString( #VAR )] = ui-> VAR ## B; - - CONNECT_SELECT_COLOUR(grid) - CONNECT_SELECT_COLOUR(title) - CONNECT_SELECT_COLOUR(cpuSystem) - CONNECT_SELECT_COLOUR(cpuUser) - CONNECT_SELECT_COLOUR(cpuNice) - CONNECT_SELECT_COLOUR(cpuOther) - CONNECT_SELECT_COLOUR(cpuFrequency) - CONNECT_SELECT_COLOUR(memApps) - CONNECT_SELECT_COLOUR(memBuffers) - CONNECT_SELECT_COLOUR(memCached) - CONNECT_SELECT_COLOUR(memSwap) - CONNECT_SELECT_COLOUR(netReceived) - CONNECT_SELECT_COLOUR(netTransmitted) - -#undef CONNECT_SELECT_COLOUR - - connect(mSelectColourMapper, SIGNAL(mapped(const QString &)), SLOT(selectColour(const QString &))); -} - -LXQtSysStatColours::~LXQtSysStatColours() -{ - delete ui; -} - -void LXQtSysStatColours::selectColour(const QString &name) -{ - QColor color = QColorDialog::getColor(mColours[name], this); - if (color.isValid()) - { - mColours[name] = color; - mShowColourMap[name]->setStyleSheet(QString("background-color: %1;\ncolor: %2;").arg(color.name()).arg((color.toHsl().lightnessF() > 0.5) ? "black" : "white")); - - ui->buttons->button(QDialogButtonBox::Apply)->setEnabled(true); - } -} - -void LXQtSysStatColours::setColours(const Colours &colours) -{ - mInitialColours = colours; - mColours = colours; - applyColoursToButtons(); - - ui->buttons->button(QDialogButtonBox::Apply)->setEnabled(false); -} - -void LXQtSysStatColours::applyColoursToButtons() -{ - Colours::ConstIterator M = mColours.constEnd(); - for (Colours::ConstIterator I = mColours.constBegin(); I != M; ++I) - { - const QColor &color = I.value(); - mShowColourMap[I.key()]->setStyleSheet(QString("background-color: %1;\ncolor: %2;").arg(color.name()).arg((color.toHsl().lightnessF() > 0.5) ? "black" : "white")); - } -} - -void LXQtSysStatColours::on_buttons_clicked(QAbstractButton *button) -{ - switch (ui->buttons->standardButton(button)) - { - case QDialogButtonBox::RestoreDefaults: - restoreDefaults(); - break; - - case QDialogButtonBox::Reset: - reset(); - break; - - case QDialogButtonBox::Ok: - apply(); - accept(); - break; - - case QDialogButtonBox::Apply: - apply(); - break; - - case QDialogButtonBox::Cancel: - reset(); - reject(); - break; - - default:; - } -} - -void LXQtSysStatColours::restoreDefaults() -{ - bool wereTheSame = mColours == mDefaultColours; - - mColours = mDefaultColours; - applyColoursToButtons(); - - ui->buttons->button(QDialogButtonBox::Apply)->setEnabled(!wereTheSame); -} - -void LXQtSysStatColours::reset() -{ - bool wereTheSame = mColours == mInitialColours; - - mColours = mInitialColours; - applyColoursToButtons(); - - ui->buttons->button(QDialogButtonBox::Apply)->setEnabled(!wereTheSame); -} - -void LXQtSysStatColours::apply() -{ - emit coloursChanged(); - - ui->buttons->button(QDialogButtonBox::Apply)->setEnabled(false); -} - -LXQtSysStatColours::Colours LXQtSysStatColours::colours() const -{ - return mColours; -} - -LXQtSysStatColours::Colours LXQtSysStatColours::defaultColours() const -{ - return mDefaultColours; -} diff --git a/plugin-sysstat/lxqtsysstatcolours.h b/plugin-sysstat/lxqtsysstatcolours.h deleted file mode 100644 index ffdfd2c..0000000 --- a/plugin-sysstat/lxqtsysstatcolours.h +++ /dev/null @@ -1,88 +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: - * Kuzma Shapran - * - * 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 LXQTSYSSTATCOLOURS_HPP -#define LXQTSYSSTATCOLOURS_HPP - -#include - -#include -#include -#include - - -namespace Ui { - class LXQtSysStatColours; -} - -class QSignalMapper; -class QAbstractButton; -class QPushButton; - -class LXQtSysStatColours : public QDialog -{ - Q_OBJECT - -public: - explicit LXQtSysStatColours(QWidget *parent = NULL); - ~LXQtSysStatColours(); - - typedef QMap Colours; - - void setColours(const Colours&); - - Colours colours() const; - - Colours defaultColours() const; - -signals: - void coloursChanged(); - -public slots: - void on_buttons_clicked(QAbstractButton*); - - void selectColour(const QString &); - - void restoreDefaults(); - void reset(); - void apply(); - -private: - Ui::LXQtSysStatColours *ui; - - QSignalMapper *mSelectColourMapper; - QMap mShowColourMap; - - Colours mDefaultColours; - Colours mInitialColours; - Colours mColours; - - void applyColoursToButtons(); -}; - -#endif // LXQTSYSSTATCOLOURS_HPP diff --git a/plugin-sysstat/lxqtsysstatcolours.ui b/plugin-sysstat/lxqtsysstatcolours.ui deleted file mode 100644 index 56f2a05..0000000 --- a/plugin-sysstat/lxqtsysstatcolours.ui +++ /dev/null @@ -1,340 +0,0 @@ - - - LXQtSysStatColours - - - - 0 - 0 - 519 - 328 - - - - System Statistics Colors - - - - - - - - - - Graph - - - - - - &Grid - - - gridB - - - - - - - Change ... - - - - - - - T&itle - - - titleB - - - - - - - Change ... - - - - - - - - - - CPU - - - - - - Change ... - - - - - - - &Nice - - - cpuNiceB - - - - - - - Change ... - - - - - - - Ot&her - - - cpuOtherB - - - - - - - &Frequency - - - cpuFrequencyB - - - - - - - Change ... - - - - - - - S&ystem - - - cpuSystemB - - - - - - - &User - - - cpuUserB - - - - - - - Change ... - - - - - - - Change ... - - - - - - - - - - Qt::Vertical - - - - - - - - - - - Memory - - - - - - Change ... - - - - - - - Cache&d - - - memCachedB - - - - - - - S&wap - - - memSwapB - - - - - - - Change ... - - - - - - - &Applications - - - memAppsB - - - - - - - &Buffers - - - memBuffersB - - - - - - - Change ... - - - - - - - Change ... - - - - - - - - - - Network - - - - - - &Received - - - netReceivedB - - - - - - - Change ... - - - - - - - &Transmitted - - - netTransmittedB - - - - - - - Change ... - - - - - - - - - - Qt::Vertical - - - - - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults - - - - - - - gridB - titleB - cpuSystemB - cpuUserB - cpuNiceB - cpuOtherB - cpuFrequencyB - memAppsB - memBuffersB - memCachedB - memSwapB - netReceivedB - netTransmittedB - buttons - - - - - on_buttons_clicked(QAbstractButton*) - - diff --git a/plugin-sysstat/lxqtsysstatconfiguration.cpp b/plugin-sysstat/lxqtsysstatconfiguration.cpp deleted file mode 100644 index 0e901de..0000000 --- a/plugin-sysstat/lxqtsysstatconfiguration.cpp +++ /dev/null @@ -1,256 +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: - * Kuzma Shapran - * - * 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 "lxqtsysstatconfiguration.h" -#include "ui_lxqtsysstatconfiguration.h" -#include "lxqtsysstatutils.h" -#include "lxqtsysstatcolours.h" - -#include -#include -#include - -//Note: strings can't actually be translated here (in static initialization time) -// the QT_TR_NOOP here is just for qt translate tools to get the strings for translation -const QStringList LXQtSysStatConfiguration::msStatTypes = { - QLatin1String(QT_TR_NOOP("CPU")) - , QLatin1String(QT_TR_NOOP("Memory")) - , QLatin1String(QT_TR_NOOP("Network")) -}; - -namespace -{ - //Note: workaround for making source strings translatable - // (no need to ever call this function) - void localizationWorkaround(); - auto t = localizationWorkaround;//avoid unused function warning - void localizationWorkaround() - { - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu0")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu1")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu2")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu3")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu4")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu5")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu6")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu7")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu8")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu9")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu10")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu11")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu12")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu13")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu14")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu15")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu16")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu17")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu18")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu19")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu20")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu21")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu22")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu23")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "memory")); - static_cast(QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "swap")); - static_cast(t);//avoid unused variable warning - } -} - -LXQtSysStatConfiguration::LXQtSysStatConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtSysStatConfiguration), - mStat(NULL), - mColoursDialog(NULL) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("SysStatConfigurationWindow"); - ui->setupUi(this); - - //Note: translation is needed here in runtime (translator is attached already) - for (auto const & type : msStatTypes) - ui->typeCOB->addItem(tr(type.toStdString().c_str()), type); - - loadSettings(); - - connect(ui->typeCOB, static_cast(&QComboBox::currentIndexChanged), this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->intervalSB, static_cast(&QDoubleSpinBox::valueChanged), this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->sizeSB, static_cast(&QSpinBox::valueChanged), this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->linesSB, static_cast(&QSpinBox::valueChanged), this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->titleLE, &QLineEdit::editingFinished, this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->useFrequencyCB, &QCheckBox::toggled, this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->maximumHS, &QSlider::valueChanged, this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->logarithmicCB, &QCheckBox::toggled, this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->sourceCOB, static_cast(&QComboBox::currentIndexChanged), this, &LXQtSysStatConfiguration::saveSettings); - connect(ui->useThemeColoursRB, &QRadioButton::toggled, this, &LXQtSysStatConfiguration::saveSettings); -} - -LXQtSysStatConfiguration::~LXQtSysStatConfiguration() -{ - delete ui; -} - -void LXQtSysStatConfiguration::loadSettings() -{ - ui->intervalSB->setValue(settings().value("graph/updateInterval", 1.0).toDouble()); - ui->sizeSB->setValue(settings().value("graph/minimalSize", 30).toInt()); - - ui->linesSB->setValue(settings().value("grid/lines", 1).toInt()); - - ui->titleLE->setText(settings().value("title/label", QString()).toString()); - - int typeIndex = ui->typeCOB->findData(settings().value("data/type", msStatTypes[0])); - ui->typeCOB->setCurrentIndex((typeIndex >= 0) ? typeIndex : 0); - on_typeCOB_currentIndexChanged(ui->typeCOB->currentIndex()); - - int sourceIndex = ui->sourceCOB->findData(settings().value("data/source", QString())); - ui->sourceCOB->setCurrentIndex((sourceIndex >= 0) ? sourceIndex : 0); - - ui->useFrequencyCB->setChecked(settings().value("cpu/useFrequency", true).toBool()); - ui->maximumHS->setValue(PluginSysStat::netSpeedFromString(settings().value("net/maximumSpeed", "1 MB/s").toString())); - on_maximumHS_valueChanged(ui->maximumHS->value()); - ui->logarithmicCB->setChecked(settings().value("net/logarithmicScale", true).toBool()); - ui->logScaleSB->setValue(settings().value("net/logarithmicScaleSteps", 4).toInt()); - - bool useThemeColours = settings().value("graph/useThemeColours", true).toBool(); - ui->useThemeColoursRB->setChecked(useThemeColours); - ui->useCustomColoursRB->setChecked(!useThemeColours); - ui->customColoursB->setEnabled(!useThemeColours); -} - -void LXQtSysStatConfiguration::saveSettings() -{ - settings().setValue("graph/useThemeColours", ui->useThemeColoursRB->isChecked()); - settings().setValue("graph/updateInterval", ui->intervalSB->value()); - settings().setValue("graph/minimalSize", ui->sizeSB->value()); - - settings().setValue("grid/lines", ui->linesSB->value()); - - settings().setValue("title/label", ui->titleLE->text()); - - //Note: - // need to make a realy deep copy of the msStatTypes[x] because of SEGFAULTs - // occuring in static finalization time (don't know the real reason...maybe ordering of static finalizers/destructors) - QString type = ui->typeCOB->itemData(ui->typeCOB->currentIndex(), Qt::UserRole).toString().toStdString().c_str(); - settings().setValue("data/type", type); - settings().setValue("data/source", ui->sourceCOB->itemData(ui->sourceCOB->currentIndex(), Qt::UserRole)); - - settings().setValue("cpu/useFrequency", ui->useFrequencyCB->isChecked()); - - settings().setValue("net/maximumSpeed", PluginSysStat::netSpeedToString(ui->maximumHS->value())); - settings().setValue("net/logarithmicScale", ui->logarithmicCB->isChecked()); - settings().setValue("net/logarithmicScaleSteps", ui->logScaleSB->value()); -} - -void LXQtSysStatConfiguration::on_typeCOB_currentIndexChanged(int index) -{ - if (mStat) - mStat->deleteLater(); - switch (index) - { - case 0: - mStat = new SysStat::CpuStat(this); - break; - - case 1: - mStat = new SysStat::MemStat(this); - break; - - case 2: - mStat = new SysStat::NetStat(this); - break; - } - - ui->sourceCOB->blockSignals(true); - ui->sourceCOB->clear(); - for (auto const & s : mStat->sources()) - ui->sourceCOB->addItem(tr(s.toStdString().c_str()), s); - ui->sourceCOB->blockSignals(false); - ui->sourceCOB->setCurrentIndex(0); -} - -void LXQtSysStatConfiguration::on_maximumHS_valueChanged(int value) -{ - ui->maximumValueL->setText(PluginSysStat::netSpeedToString(value)); -} - -void LXQtSysStatConfiguration::coloursChanged() -{ - const LXQtSysStatColours::Colours &colours = mColoursDialog->colours(); - - settings().setValue("grid/colour", colours["grid"].name()); - settings().setValue("title/colour", colours["title"].name()); - - settings().setValue("cpu/systemColour", colours["cpuSystem"].name()); - settings().setValue("cpu/userColour", colours["cpuUser"].name()); - settings().setValue("cpu/niceColour", colours["cpuNice"].name()); - settings().setValue("cpu/otherColour", colours["cpuOther"].name()); - settings().setValue("cpu/frequencyColour", colours["cpuFrequency"].name()); - - settings().setValue("mem/appsColour", colours["memApps"].name()); - settings().setValue("mem/buffersColour", colours["memBuffers"].name()); - settings().setValue("mem/cachedColour", colours["memCached"].name()); - settings().setValue("mem/swapColour", colours["memSwap"].name()); - - settings().setValue("net/receivedColour", colours["netReceived"].name()); - settings().setValue("net/transmittedColour", colours["netTransmitted"].name()); -} - -void LXQtSysStatConfiguration::on_customColoursB_clicked() -{ - if (!mColoursDialog) - { - mColoursDialog = new LXQtSysStatColours(this); - connect(mColoursDialog, SIGNAL(coloursChanged()), SLOT(coloursChanged())); - } - - LXQtSysStatColours::Colours colours; - - const LXQtSysStatColours::Colours &defaultColours = mColoursDialog->defaultColours(); - - colours["grid"] = QColor(settings().value("grid/colour", defaultColours["grid"] .name()).toString()); - colours["title"] = QColor(settings().value("title/colour", defaultColours["title"].name()).toString()); - - colours["cpuSystem"] = QColor(settings().value("cpu/systemColour", defaultColours["cpuSystem"] .name()).toString()); - colours["cpuUser"] = QColor(settings().value("cpu/userColour", defaultColours["cpuUser"] .name()).toString()); - colours["cpuNice"] = QColor(settings().value("cpu/niceColour", defaultColours["cpuNice"] .name()).toString()); - colours["cpuOther"] = QColor(settings().value("cpu/otherColour", defaultColours["cpuOther"] .name()).toString()); - colours["cpuFrequency"] = QColor(settings().value("cpu/frequencyColour", defaultColours["cpuFrequency"].name()).toString()); - - colours["memApps"] = QColor(settings().value("mem/appsColour", defaultColours["memApps"] .name()).toString()); - colours["memBuffers"] = QColor(settings().value("mem/buffersColour", defaultColours["memBuffers"].name()).toString()); - colours["memCached"] = QColor(settings().value("mem/cachedColour", defaultColours["memCached"] .name()).toString()); - colours["memSwap"] = QColor(settings().value("mem/swapColour", defaultColours["memSwap"] .name()).toString()); - - colours["netReceived"] = QColor(settings().value("net/receivedColour", defaultColours["netReceived"] .name()).toString()); - colours["netTransmitted"] = QColor(settings().value("net/transmittedColour", defaultColours["netTransmitted"].name()).toString()); - - mColoursDialog->setColours(colours); - - mColoursDialog->exec(); -} diff --git a/plugin-sysstat/lxqtsysstatconfiguration.h b/plugin-sysstat/lxqtsysstatconfiguration.h deleted file mode 100644 index 3b0e959..0000000 --- a/plugin-sysstat/lxqtsysstatconfiguration.h +++ /dev/null @@ -1,79 +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: - * Kuzma Shapran - * - * 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 LXQTSYSSTATCONFIGURATION_H -#define LXQTSYSSTATCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" -#include -#include - -namespace Ui { - class LXQtSysStatConfiguration; -} - -namespace SysStat { - class BaseStat; -} - -class LXQtSysStatColours; - -class LXQtSysStatConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtSysStatConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~LXQtSysStatConfiguration(); - -public slots: - void saveSettings(); - - void on_typeCOB_currentIndexChanged(int); - void on_maximumHS_valueChanged(int); - void on_customColoursB_clicked(); - - void coloursChanged(); - -public: - static const QStringList msStatTypes; - -signals: - void maximumNetSpeedChanged(QString); - -private: - Ui::LXQtSysStatConfiguration *ui; - - SysStat::BaseStat *mStat; - LXQtSysStatColours *mColoursDialog; - - void loadSettings(); -}; - -#endif // LXQTSYSSTATCONFIGURATION_H diff --git a/plugin-sysstat/lxqtsysstatconfiguration.ui b/plugin-sysstat/lxqtsysstatconfiguration.ui deleted file mode 100644 index f6863e9..0000000 --- a/plugin-sysstat/lxqtsysstatconfiguration.ui +++ /dev/null @@ -1,461 +0,0 @@ - - - LXQtSysStatConfiguration - - - - 0 - 0 - 399 - 438 - - - - System Statistics Settings - - - - - - - - Graph - - - - 4 - - - 4 - - - - - &Minimal size - - - sizeSB - - - - - - - Update &interval - - - intervalSB - - - - - - - &Title - - - titleLE - - - - - - - &Grid lines - - - linesSB - - - - - - - - - - - - - <html><head/><body><p>Minimal width if the panel is horizontal.</p><p>Minimal height is the panel is vertical.</p></body></html> - - - px - - - 2 - - - 500 - - - 30 - - - - - - - s - - - 1 - - - 0.100000000000000 - - - 60.000000000000000 - - - 0.250000000000000 - - - 1.000000000000000 - - - - - - - - - - Data - - - - 4 - - - 4 - - - - - 0 - - - - - 0 - - - 0 - - - - - Use &frequency - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - 0 - - - 0 - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - 0 - - - 0 - - - - - 4 - - - - - Ma&ximum - - - maximumHS - - - - - - - 4 - - - - - XXX KBs - - - - - - - 39 - - - Qt::Horizontal - - - - - - - - - Lo&garithmic scale - - - - - - - steps - - - 1 - - - 64 - - - 4 - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - - - - - &Source - - - sourceCOB - - - - - - - T&ype - - - typeCOB - - - - - - - - - - - - - Colours - - - - 4 - - - 5 - - - 4 - - - - - Use t&heme colours - - - true - - - - - - - Use c&ustom colours - - - - - - - Custom colour ... - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - intervalSB - sizeSB - linesSB - titleLE - typeCOB - sourceCOB - useFrequencyCB - maximumHS - logarithmicCB - logScaleSB - useThemeColoursRB - useCustomColoursRB - customColoursB - buttons - - - - - buttons - accepted() - LXQtSysStatConfiguration - accept() - - - 95 - 433 - - - 97 - 295 - - - - - buttons - rejected() - LXQtSysStatConfiguration - reject() - - - 76 - 433 - - - 62 - 296 - - - - - typeCOB - currentIndexChanged(int) - dataSW - setCurrentIndex(int) - - - 386 - 203 - - - 342 - 264 - - - - - useCustomColoursRB - toggled(bool) - customColoursB - setEnabled(bool) - - - 132 - 366 - - - 240 - 365 - - - - - diff --git a/plugin-sysstat/lxqtsysstatutils.cpp b/plugin-sysstat/lxqtsysstatutils.cpp deleted file mode 100644 index 2c7cd1c..0000000 --- a/plugin-sysstat/lxqtsysstatutils.cpp +++ /dev/null @@ -1,74 +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: - * Kuzma Shapran - * - * 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 "lxqtsysstatutils.h" - - -namespace PluginSysStat -{ - -QString netSpeedToString(int value) -{ - QString prefix; - static const char prefixes[] = "kMG"; - if (value / 10) - prefix = QChar(prefixes[value / 10 - 1]); - - return QString("%1 %2B/s").arg(1 << (value % 10)).arg(prefix); -} - -int netSpeedFromString(QString value) -{ - QRegExp re("^(\\d+) ([kMG])B/s$"); - if (re.exactMatch(value)) - { - int shift = 0; - switch (re.cap(2)[0].toLatin1()) - { - case 'k': - shift = 10; - break; - - case 'M': - shift = 20; - break; - - case 'G': - shift = 30; - break; - } - - return qCeil(qLn(re.cap(1).toInt()) / qLn(2.)) + shift; - } - - return 0; -} - -} diff --git a/plugin-sysstat/lxqtsysstatutils.h b/plugin-sysstat/lxqtsysstatutils.h deleted file mode 100644 index 889b696..0000000 --- a/plugin-sysstat/lxqtsysstatutils.h +++ /dev/null @@ -1,41 +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: - * Kuzma Shapran - * - * 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 LXQTSYSSTATUTILS_HPP -#define LXQTSYSSTATUTILS_HPP - -#include - -namespace PluginSysStat -{ - -QString netSpeedToString(int value); -int netSpeedFromString(QString value); - -} - -#endif // LXQTSYSSTATUTILS_HPP diff --git a/plugin-sysstat/resources/sysstat.desktop.in b/plugin-sysstat/resources/sysstat.desktop.in deleted file mode 100644 index 874c81e..0000000 --- a/plugin-sysstat/resources/sysstat.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System Statistics -Comment=System Statistics plugin. -Icon=utilities-system-monitor - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-sysstat/translations/sysstat_ar.desktop b/plugin-sysstat/translations/sysstat_ar.desktop deleted file mode 100644 index 2e1bb0d..0000000 --- a/plugin-sysstat/translations/sysstat_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=إحصائيّات النّظام -Comment[ar]=ملحقة لإحصائيّات النّظام. diff --git a/plugin-sysstat/translations/sysstat_da.desktop b/plugin-sysstat/translations/sysstat_da.desktop deleted file mode 100644 index afd6b53..0000000 --- a/plugin-sysstat/translations/sysstat_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System Statistics -Comment=System Statistics plugin. -Icon=utilities-system-monitor - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Systemstatistik -Comment[da]=Systemstatistik-plugin. \ No newline at end of file diff --git a/plugin-sysstat/translations/sysstat_de.desktop b/plugin-sysstat/translations/sysstat_de.desktop deleted file mode 100644 index b11a9a4..0000000 --- a/plugin-sysstat/translations/sysstat_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Systemstatistiken -Comment[de]=Plugin zum Anzeigen von Systemstatistiken diff --git a/plugin-sysstat/translations/sysstat_el.desktop b/plugin-sysstat/translations/sysstat_el.desktop deleted file mode 100644 index 23d4211..0000000 --- a/plugin-sysstat/translations/sysstat_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Στατιστικά συστήματος -Comment[el]=Πρόσθετο στατιστικών του συστήματος. diff --git a/plugin-sysstat/translations/sysstat_fr.desktop b/plugin-sysstat/translations/sysstat_fr.desktop deleted file mode 100644 index 817502e..0000000 --- a/plugin-sysstat/translations/sysstat_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Statistiques du système -Comment[fr]=Greffon d'affichage des statistiques du système diff --git a/plugin-sysstat/translations/sysstat_hu.desktop b/plugin-sysstat/translations/sysstat_hu.desktop deleted file mode 100644 index bc246d3..0000000 --- a/plugin-sysstat/translations/sysstat_hu.desktop +++ /dev/null @@ -1,3 +0,0 @@ -#TRANSLATIONS -Name[hu]=Rendszerstatisztika -Comment[hu]=Infó a rendszerállapotról diff --git a/plugin-sysstat/translations/sysstat_it.desktop b/plugin-sysstat/translations/sysstat_it.desktop deleted file mode 100644 index d878dab..0000000 --- a/plugin-sysstat/translations/sysstat_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Statistiche del sistema -Comment[it]=Mostra statistiche configurabili del sistema diff --git a/plugin-sysstat/translations/sysstat_ja.desktop b/plugin-sysstat/translations/sysstat_ja.desktop deleted file mode 100644 index 410d8f7..0000000 --- a/plugin-sysstat/translations/sysstat_ja.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name[ja]=システム統計 -Comment[ja]=システム統計のプラグイン - -#TRANSLATIONS_DIR=../translations - diff --git a/plugin-sysstat/translations/sysstat_lt.desktop b/plugin-sysstat/translations/sysstat_lt.desktop deleted file mode 100644 index 8c938be..0000000 --- a/plugin-sysstat/translations/sysstat_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Sistemos statistika -Comment[lt]=Sistemos statistikos įskiepis. diff --git a/plugin-sysstat/translations/sysstat_pl.desktop b/plugin-sysstat/translations/sysstat_pl.desktop deleted file mode 100644 index 6b9e777..0000000 --- a/plugin-sysstat/translations/sysstat_pl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[pl]=Statystyki systemowe -Comment[pl]=Wtyczka statystyk systemu. diff --git a/plugin-sysstat/translations/sysstat_pt.desktop b/plugin-sysstat/translations/sysstat_pt.desktop deleted file mode 100644 index e78968e..0000000 --- a/plugin-sysstat/translations/sysstat_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -#TRANSLATIONS -Name[pt]=Estatísticas do sistema -Comment[pt]=Mostra as estatísticas do sistema diff --git a/plugin-sysstat/translations/sysstat_ru.desktop b/plugin-sysstat/translations/sysstat_ru.desktop deleted file mode 100644 index c8e02e8..0000000 --- a/plugin-sysstat/translations/sysstat_ru.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name[ru]=Системная статистика -Comment[ru]=Плагин системной статистики. - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-taskbar/CMakeLists.txt b/plugin-taskbar/CMakeLists.txt deleted file mode 100644 index 4f7b34d..0000000 --- a/plugin-taskbar/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -set(PLUGIN "taskbar") - -set(HEADERS - lxqttaskbar.h - lxqttaskbutton.h - lxqttaskbarconfiguration.h - lxqttaskbarplugin.h - lxqttaskgroup.h - lxqtgrouppopup.h -) - -set(SOURCES - lxqttaskbar.cpp - lxqttaskbutton.cpp - lxqttaskbarconfiguration.cpp - lxqttaskbarplugin.cpp - lxqttaskgroup.cpp - lxqtgrouppopup.cpp -) - -set(UIS - lxqttaskbarconfiguration.ui -) - -set(LIBRARIES - lxqt - lxqt-globalkeys - Qt5Xdg -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-taskbar/lxqtgrouppopup.cpp b/plugin-taskbar/lxqtgrouppopup.cpp deleted file mode 100644 index c518149..0000000 --- a/plugin-taskbar/lxqtgrouppopup.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Alexander Sokoloff - * Maciej Płaza - * Kuzma Shapran - * - * 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 "lxqtgrouppopup.h" -#include -#include -#include -#include -#include -#include -#include - -/************************************************ - this class is just a container of window buttons - the main purpose is showing window buttons in - vertical layout and drag&drop feature inside - group - ************************************************/ -LXQtGroupPopup::LXQtGroupPopup(LXQtTaskGroup *group): - QFrame(group), - mGroup(group) -{ - Q_ASSERT(group); - setAcceptDrops(true); - setWindowFlags(Qt::FramelessWindowHint | Qt::ToolTip); - setAttribute(Qt::WA_AlwaysShowToolTips); - setAttribute(Qt::WA_TranslucentBackground); - - setLayout(new QVBoxLayout); - layout()->setSpacing(3); - layout()->setMargin(3); - - connect(&mCloseTimer, &QTimer::timeout, this, &LXQtGroupPopup::closeTimerSlot); - mCloseTimer.setSingleShot(true); - mCloseTimer.setInterval(400); -} - -LXQtGroupPopup::~LXQtGroupPopup() -{ -} - -void LXQtGroupPopup::dropEvent(QDropEvent *event) -{ - qlonglong temp; - QDataStream stream(event->mimeData()->data(LXQtTaskButton::mimeDataFormat())); - stream >> temp; - WId window = (WId) temp; - - LXQtTaskButton *button = nullptr; - int oldIndex(0); - // get current position of the button being dragged - for (int i = 0; i < layout()->count(); i++) - { - LXQtTaskButton *b = qobject_cast(layout()->itemAt(i)->widget()); - if (b && b->windowId() == window) - { - button = b; - oldIndex = i; - break; - } - } - - if (button == nullptr) - return; - - int newIndex = -1; - // find the new position to place it in - for (int i = 0; i < oldIndex && newIndex == -1; i++) - { - QWidget *w = layout()->itemAt(i)->widget(); - if (w && w->pos().y() + w->height() / 2 > event->pos().y()) - newIndex = i; - } - const int size = layout()->count(); - for (int i = size - 1; i > oldIndex && newIndex == -1; i--) - { - QWidget *w = layout()->itemAt(i)->widget(); - if (w && w->pos().y() + w->height() / 2 < event->pos().y()) - newIndex = i; - } - - if (newIndex == -1 || newIndex == oldIndex) - return; - - QVBoxLayout * l = qobject_cast(layout()); - l->takeAt(oldIndex); - l->insertWidget(newIndex, button); - l->invalidate(); - -} - -void LXQtGroupPopup::dragEnterEvent(QDragEnterEvent *event) -{ - event->accept(); - QWidget::dragEnterEvent(event); -} - -void LXQtGroupPopup::dragLeaveEvent(QDragLeaveEvent *event) -{ - hide(false/*not fast*/); - QFrame::dragLeaveEvent(event); -} - -/************************************************ - * - ************************************************/ -void LXQtGroupPopup::leaveEvent(QEvent *event) -{ - mCloseTimer.start(); -} - -/************************************************ - * - ************************************************/ -void LXQtGroupPopup::enterEvent(QEvent *event) -{ - mCloseTimer.stop(); -} - -void LXQtGroupPopup::paintEvent(QPaintEvent *event) -{ - QPainter p(this); - QStyleOption opt; - opt.initFrom(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); -} - -void LXQtGroupPopup::hide(bool fast) -{ - if (fast) - close(); - else - mCloseTimer.start(); -} - -void LXQtGroupPopup::show() -{ - mCloseTimer.stop(); - QFrame::show(); -} - -void LXQtGroupPopup::closeTimerSlot() -{ - bool button_has_dnd_hover = false; - QLayout* l = layout(); - for (int i = 0; l->count() > i; ++i) - { - LXQtTaskButton const * const button = dynamic_cast(l->itemAt(i)->widget()); - if (0 != button && button->hasDragAndDropHover()) - { - button_has_dnd_hover = true; - break; - } - } - if (!button_has_dnd_hover) - close(); -} diff --git a/plugin-taskbar/lxqtgrouppopup.h b/plugin-taskbar/lxqtgrouppopup.h deleted file mode 100644 index 5dbfd22..0000000 --- a/plugin-taskbar/lxqtgrouppopup.h +++ /dev/null @@ -1,79 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Alexander Sokoloff - * Maciej Płaza - * Kuzma Shapran - * - * 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 LXQTTASKPOPUP_H -#define LXQTTASKPOPUP_H - -#include -#include -#include -#include -#include - -#include "lxqttaskbutton.h" -#include "lxqttaskgroup.h" -#include "lxqttaskbar.h" - -class LXQtGroupPopup: public QFrame -{ - Q_OBJECT - -public: - LXQtGroupPopup(LXQtTaskGroup *group); - ~LXQtGroupPopup(); - - void hide(bool fast = false); - void show(); - - // Layout - int indexOf(LXQtTaskButton *button) { return layout()->indexOf(button); } - int count() { return layout()->count(); } - QLayoutItem * itemAt(int i) { return layout()->itemAt(i); } - int spacing() { return layout()->spacing(); } - void addButton(LXQtTaskButton* button) { layout()->addWidget(button); } - void removeWidget(QWidget *button) { layout()->removeWidget(button); } - -protected: - void dragEnterEvent(QDragEnterEvent * event); - void dragLeaveEvent(QDragLeaveEvent *event); - void dropEvent(QDropEvent * event); - void leaveEvent(QEvent * event); - void enterEvent(QEvent * event); - void paintEvent(QPaintEvent * event); - - void closeTimerSlot(); - -private: - LXQtTaskGroup *mGroup; - QTimer mCloseTimer; -}; - -#endif // LXQTTASKPOPUP_H diff --git a/plugin-taskbar/lxqttaskbar.cpp b/plugin-taskbar/lxqttaskbar.cpp deleted file mode 100644 index 344bea9..0000000 --- a/plugin-taskbar/lxqttaskbar.cpp +++ /dev/null @@ -1,689 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Alexander Sokoloff - * Maciej Płaza - * Kuzma Shapran - * - * 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 -#include -#include - -#include -#include -#include - -#include "lxqttaskbar.h" -#include "lxqttaskgroup.h" - -using namespace LXQt; - -/************************************************ - -************************************************/ -LXQtTaskBar::LXQtTaskBar(ILXQtPanelPlugin *plugin, QWidget *parent) : - QFrame(parent), - mSignalMapper(new QSignalMapper(this)), - mButtonStyle(Qt::ToolButtonTextBesideIcon), - mCloseOnMiddleClick(true), - mRaiseOnCurrentDesktop(true), - mShowOnlyOneDesktopTasks(false), - mShowDesktopNum(0), - mShowOnlyCurrentScreenTasks(false), - mShowOnlyMinimizedTasks(false), - mAutoRotate(true), - mShowGroupOnHover(true), - mIconByClass(false), - mCycleOnWheelScroll(true), - mPlugin(plugin), - mPlaceHolder(new QWidget(this)), - mStyle(new LeftAlignedTextStyle()) -{ - setStyle(mStyle); - mLayout = new LXQt::GridLayout(this); - setLayout(mLayout); - mLayout->setMargin(0); - mLayout->setStretch(LXQt::GridLayout::StretchHorizontal | LXQt::GridLayout::StretchVertical); - realign(); - - mPlaceHolder->setMinimumSize(1, 1); - mPlaceHolder->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); - mPlaceHolder->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); - mLayout->addWidget(mPlaceHolder); - - QTimer::singleShot(0, this, SLOT(settingsChanged())); - setAcceptDrops(true); - - connect(mSignalMapper, static_cast(&QSignalMapper::mapped), this, &LXQtTaskBar::activateTask); - QTimer::singleShot(0, this, &LXQtTaskBar::registerShortcuts); - - connect(KWindowSystem::self(), SIGNAL(stackingOrderChanged()), SLOT(refreshTaskList())); - connect(KWindowSystem::self(), static_cast(&KWindowSystem::windowChanged) - , this, &LXQtTaskBar::onWindowChanged); - connect(KWindowSystem::self(), &KWindowSystem::windowAdded, this, &LXQtTaskBar::onWindowAdded); - connect(KWindowSystem::self(), &KWindowSystem::windowRemoved, this, &LXQtTaskBar::onWindowRemoved); -} - -/************************************************ - - ************************************************/ -LXQtTaskBar::~LXQtTaskBar() -{ - delete mStyle; -} - -/************************************************ - - ************************************************/ -bool LXQtTaskBar::acceptWindow(WId window) const -{ - QFlags ignoreList; - ignoreList |= NET::DesktopMask; - ignoreList |= NET::DockMask; - ignoreList |= NET::SplashMask; - ignoreList |= NET::ToolbarMask; - ignoreList |= NET::MenuMask; - ignoreList |= NET::PopupMenuMask; - ignoreList |= NET::NotificationMask; - - KWindowInfo info(window, NET::WMWindowType | NET::WMState, NET::WM2TransientFor); - if (!info.valid()) - return false; - - if (NET::typeMatchesMask(info.windowType(NET::AllTypesMask), ignoreList)) - return false; - - if (info.state() & NET::SkipTaskbar) - return false; - - // WM_TRANSIENT_FOR hint not set - normal window - WId transFor = info.transientFor(); - if (transFor == 0 || transFor == window || transFor == (WId) QX11Info::appRootWindow()) - return true; - - info = KWindowInfo(transFor, NET::WMWindowType); - - QFlags normalFlag; - normalFlag |= NET::NormalMask; - normalFlag |= NET::DialogMask; - normalFlag |= NET::UtilityMask; - - return !NET::typeMatchesMask(info.windowType(NET::AllTypesMask), normalFlag); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::dragEnterEvent(QDragEnterEvent* event) -{ - if (event->mimeData()->hasFormat(LXQtTaskGroup::mimeDataFormat())) - { - event->acceptProposedAction(); - buttonMove(nullptr, qobject_cast(event->source()), event->pos()); - } else - event->ignore(); - QWidget::dragEnterEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::dragMoveEvent(QDragMoveEvent * event) -{ - //we don't get any dragMoveEvents if dragEnter wasn't accepted - buttonMove(nullptr, qobject_cast(event->source()), event->pos()); - QWidget::dragMoveEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::buttonMove(LXQtTaskGroup * dst, LXQtTaskGroup * src, QPoint const & pos) -{ - int src_index; - if (!src || -1 == (src_index = mLayout->indexOf(src))) - { - qDebug() << "Dropped invalid"; - return; - } - - const int size = mLayout->count(); - Q_ASSERT(0 < size); - //dst is nullptr in case the drop occured on empty space in taskbar - int dst_index; - if (nullptr == dst) - { - //moving based on taskbar (not signaled by button) - QRect occupied = mLayout->occupiedGeometry(); - QRect last_empty_row{occupied}; - const QRect last_item_geometry = mLayout->itemAt(size - 1)->geometry(); - if (mPlugin->panel()->isHorizontal()) - { - if (isRightToLeft()) - { - last_empty_row.setTopRight(last_item_geometry.topLeft()); - } else - { - last_empty_row.setTopLeft(last_item_geometry.topRight()); - } - } else - { - if (isRightToLeft()) - { - last_empty_row.setTopRight(last_item_geometry.topRight()); - } else - { - last_empty_row.setTopLeft(last_item_geometry.topLeft()); - } - } - if (occupied.contains(pos) && !last_empty_row.contains(pos)) - return; - - dst_index = size; - } else - { - //moving based on signal from child button - dst_index = mLayout->indexOf(dst); - } - - //moving lower index to higher one => consider as the QList::move => insert(to, takeAt(from)) - if (src_index < dst_index) - { - if (size == dst_index - || src_index + 1 != dst_index) - { - --dst_index; - } else - { - //switching positions of next standing - const int tmp_index = src_index; - src_index = dst_index; - dst_index = tmp_index; - } - } - - if (dst_index == src_index - || mLayout->animatedMoveInProgress() - ) - return; - - mLayout->moveItem(src_index, dst_index, true); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::groupBecomeEmptySlot() -{ - //group now contains no buttons - clean up in hash and delete the group - LXQtTaskGroup * const group = qobject_cast(sender()); - Q_ASSERT(group); - - for (auto i = mKnownWindows.begin(); mKnownWindows.end() != i; ) - { - if (group == *i) - i = mKnownWindows.erase(i); - else - ++i; - } - mLayout->removeWidget(group); - group->deleteLater(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::addWindow(WId window) -{ - // If grouping disabled group behaves like regular button - const QString group_id = mGroupingEnabled ? KWindowInfo(window, 0, NET::WM2WindowClass).windowClassClass() : QString("%1").arg(window); - - LXQtTaskGroup *group = nullptr; - auto i_group = mKnownWindows.find(window); - if (mKnownWindows.end() != i_group) - { - if ((*i_group)->groupName() == group_id) - group = *i_group; - else - (*i_group)->onWindowRemoved(window); - } - - //check if window belongs to some existing group - if (!group && mGroupingEnabled) - { - for (auto i = mKnownWindows.cbegin(), i_e = mKnownWindows.cend(); i != i_e; ++i) - { - if ((*i)->groupName() == group_id) - { - group = *i; - break; - } - } - } - - if (!group) - { - group = new LXQtTaskGroup(group_id, window, this); - connect(group, SIGNAL(groupBecomeEmpty(QString)), this, SLOT(groupBecomeEmptySlot())); - connect(group, SIGNAL(visibilityChanged(bool)), this, SLOT(refreshPlaceholderVisibility())); - connect(group, &LXQtTaskGroup::popupShown, this, &LXQtTaskBar::popupShown); - connect(group, &LXQtTaskButton::dragging, this, [this] (QObject * dragSource, QPoint const & pos) { - buttonMove(qobject_cast(sender()), qobject_cast(dragSource), pos); - }); - - mLayout->addWidget(group); - group->setToolButtonsStyle(mButtonStyle); - } - - mKnownWindows[window] = group; - group->addWindow(window); -} - -/************************************************ - - ************************************************/ -auto LXQtTaskBar::removeWindow(windowMap_t::iterator pos) -> windowMap_t::iterator -{ - WId const window = pos.key(); - LXQtTaskGroup * const group = *pos; - auto ret = mKnownWindows.erase(pos); - group->onWindowRemoved(window); - return ret; -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::refreshTaskList() -{ - QList new_list; - // Just add new windows to groups, deleting is up to the groups - for (auto const wnd: KWindowSystem::stackingOrder()) - { - if (acceptWindow(wnd)) - { - new_list << wnd; - addWindow(wnd); - } - } - - //emulate windowRemoved if known window not reported by KWindowSystem - for (auto i = mKnownWindows.begin(), i_e = mKnownWindows.end(); i != i_e; ) - { - if (0 > new_list.indexOf(i.key())) - { - i = removeWindow(i); - } else - ++i; - } - - refreshPlaceholderVisibility(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::onWindowChanged(WId window, NET::Properties prop, NET::Properties2 prop2) -{ - auto i = mKnownWindows.find(window); - if (mKnownWindows.end() != i) - (*i)->onWindowChanged(window, prop, prop2); -} - -void LXQtTaskBar::onWindowAdded(WId window) -{ - auto const pos = mKnownWindows.find(window); - if (mKnownWindows.end() == pos && acceptWindow(window)) - addWindow(window); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::onWindowRemoved(WId window) -{ - auto const pos = mKnownWindows.find(window); - if (mKnownWindows.end() != pos) - { - removeWindow(pos); - } -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::refreshButtonRotation() -{ - bool autoRotate = mAutoRotate && (mButtonStyle != Qt::ToolButtonIconOnly); - - ILXQtPanel::Position panelPosition = mPlugin->panel()->position(); - emit buttonRotationRefreshed(autoRotate, panelPosition); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::refreshPlaceholderVisibility() -{ - // if no visible group button show placeholder widget - bool haveVisibleWindow = false; - for (auto i = mKnownWindows.cbegin(), i_e = mKnownWindows.cend(); i_e != i; ++i) - { - if ((*i)->isVisible()) - { - haveVisibleWindow = true; - break; - } - } - mPlaceHolder->setVisible(!haveVisibleWindow); - if (haveVisibleWindow) - mPlaceHolder->setFixedSize(0, 0); - else - { - mPlaceHolder->setMinimumSize(1, 1); - mPlaceHolder->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); - } - -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::setButtonStyle(Qt::ToolButtonStyle buttonStyle) -{ - const Qt::ToolButtonStyle old_style = mButtonStyle; - mButtonStyle = buttonStyle; - if (old_style != mButtonStyle) - emit buttonStyleRefreshed(mButtonStyle); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::settingsChanged() -{ - bool groupingEnabledOld = mGroupingEnabled; - bool showOnlyOneDesktopTasksOld = mShowOnlyOneDesktopTasks; - const int showDesktopNumOld = mShowDesktopNum; - bool showOnlyCurrentScreenTasksOld = mShowOnlyCurrentScreenTasks; - bool showOnlyMinimizedTasksOld = mShowOnlyMinimizedTasks; - const bool iconByClassOld = mIconByClass; - - mButtonWidth = mPlugin->settings()->value("buttonWidth", 400).toInt(); - mButtonHeight = mPlugin->settings()->value("buttonHeight", 100).toInt(); - QString s = mPlugin->settings()->value("buttonStyle").toString().toUpper(); - - if (s == "ICON") - setButtonStyle(Qt::ToolButtonIconOnly); - else if (s == "TEXT") - setButtonStyle(Qt::ToolButtonTextOnly); - else - setButtonStyle(Qt::ToolButtonTextBesideIcon); - - mShowOnlyOneDesktopTasks = mPlugin->settings()->value("showOnlyOneDesktopTasks", mShowOnlyOneDesktopTasks).toBool(); - mShowDesktopNum = mPlugin->settings()->value("showDesktopNum", mShowDesktopNum).toInt(); - mShowOnlyCurrentScreenTasks = mPlugin->settings()->value("showOnlyCurrentScreenTasks", mShowOnlyCurrentScreenTasks).toBool(); - mShowOnlyMinimizedTasks = mPlugin->settings()->value("showOnlyMinimizedTasks", mShowOnlyMinimizedTasks).toBool(); - mAutoRotate = mPlugin->settings()->value("autoRotate", true).toBool(); - mCloseOnMiddleClick = mPlugin->settings()->value("closeOnMiddleClick", true).toBool(); - mRaiseOnCurrentDesktop = mPlugin->settings()->value("raiseOnCurrentDesktop", false).toBool(); - mGroupingEnabled = mPlugin->settings()->value("groupingEnabled",true).toBool(); - mShowGroupOnHover = mPlugin->settings()->value("showGroupOnHover",true).toBool(); - mIconByClass = mPlugin->settings()->value("iconByClass", false).toBool(); - mCycleOnWheelScroll = mPlugin->settings()->value("cycleOnWheelScroll", true).toBool(); - - // Delete all groups if grouping feature toggled and start over - if (groupingEnabledOld != mGroupingEnabled) - { - for (int i = mLayout->count() - 1; 0 <= i; --i) - { - LXQtTaskGroup * group = qobject_cast(mLayout->itemAt(i)->widget()); - if (nullptr != group) - { - mLayout->takeAt(i); - group->deleteLater(); - } - } - mKnownWindows.clear(); - } - - if (showOnlyOneDesktopTasksOld != mShowOnlyOneDesktopTasks - || (mShowOnlyOneDesktopTasks && showDesktopNumOld != mShowDesktopNum) - || showOnlyCurrentScreenTasksOld != mShowOnlyCurrentScreenTasks - || showOnlyMinimizedTasksOld != mShowOnlyMinimizedTasks - ) - emit showOnlySettingChanged(); - if (iconByClassOld != mIconByClass) - emit iconByClassChanged(); - - refreshTaskList(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::realign() -{ - mLayout->setEnabled(false); - refreshButtonRotation(); - - ILXQtPanel *panel = mPlugin->panel(); - QSize maxSize = QSize(mButtonWidth, mButtonHeight); - QSize minSize = QSize(0, 0); - - bool rotated = false; - - if (panel->isHorizontal()) - { - mLayout->setRowCount(panel->lineCount()); - mLayout->setColumnCount(0); - } - else - { - mLayout->setRowCount(0); - - if (mButtonStyle == Qt::ToolButtonIconOnly) - { - // Vertical + Icons - mLayout->setColumnCount(panel->lineCount()); - } - else - { - rotated = mAutoRotate && (panel->position() == ILXQtPanel::PositionLeft || panel->position() == ILXQtPanel::PositionRight); - - // Vertical + Text - if (rotated) - { - maxSize.rwidth() = mButtonHeight; - maxSize.rheight() = mButtonWidth; - - mLayout->setColumnCount(panel->lineCount()); - } - else - { - mLayout->setColumnCount(1); - } - } - } - - mLayout->setCellMinimumSize(minSize); - mLayout->setCellMaximumSize(maxSize); - mLayout->setDirection(rotated ? LXQt::GridLayout::TopToBottom : LXQt::GridLayout::LeftToRight); - mLayout->setEnabled(true); - - //our placement on screen could have been changed - emit showOnlySettingChanged(); - emit refreshIconGeometry(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::wheelEvent(QWheelEvent* event) -{ - if (!mCycleOnWheelScroll) - return QFrame::wheelEvent(event); - - static int threshold = 0; - threshold += abs(event->delta()); - if (threshold < 300) - return QFrame::wheelEvent(event); - else - threshold = 0; - - int delta = event->delta() < 0 ? 1 : -1; - - // create temporary list of visible groups in the same order like on the layout - QList list; - LXQtTaskGroup *group = NULL; - for (int i = 0; i < mLayout->count(); i++) - { - QWidget * o = mLayout->itemAt(i)->widget(); - LXQtTaskGroup * g = qobject_cast(o); - if (!g) - continue; - - if (g->isVisible()) - list.append(g); - if (g->isChecked()) - group = g; - } - - if (list.isEmpty()) - return QFrame::wheelEvent(event); - - if (!group) - group = list.at(0); - - LXQtTaskButton *button = NULL; - - // switching between groups from temporary list in modulo addressing - while (!button) - { - button = group->getNextPrevChildButton(delta == 1, !(list.count() - 1)); - if (button) - button->raiseApplication(); - int idx = (list.indexOf(group) + delta + list.count()) % list.count(); - group = list.at(idx); - } - QFrame::wheelEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::resizeEvent(QResizeEvent* event) -{ - emit refreshIconGeometry(); - return QWidget::resizeEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::changeEvent(QEvent* event) -{ - // if current style is changed, reset the base style of the proxy style - // so we can apply the new style correctly to task buttons. - if(event->type() == QEvent::StyleChange) - mStyle->setBaseStyle(NULL); - - QFrame::changeEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskBar::registerShortcuts() -{ - // Register shortcuts to switch to the task - // mPlaceHolder is always at position 0 - // tasks are at positions 1..10 - GlobalKeyShortcut::Action * gshortcut; - QString path; - QString description; - for (int i = 1; i <= 10; ++i) - { - path = QString("/panel/%1/task_%2").arg(mPlugin->settings()->group()).arg(i); - description = tr("Activate task %1").arg(i); - - gshortcut = GlobalKeyShortcut::Client::instance()->addAction(QStringLiteral(), path, description, this); - - if (nullptr != gshortcut) - { - mKeys << gshortcut; - connect(gshortcut, &GlobalKeyShortcut::Action::registrationFinished, this, &LXQtTaskBar::shortcutRegistered); - connect(gshortcut, &GlobalKeyShortcut::Action::activated, mSignalMapper, static_cast(&QSignalMapper::map)); - mSignalMapper->setMapping(gshortcut, i); - } - } -} - -void LXQtTaskBar::shortcutRegistered() -{ - GlobalKeyShortcut::Action * const shortcut = qobject_cast(sender()); - - disconnect(shortcut, &GlobalKeyShortcut::Action::registrationFinished, this, &LXQtTaskBar::shortcutRegistered); - - const int i = mKeys.indexOf(shortcut); - Q_ASSERT(-1 != i); - - if (shortcut->shortcut().isEmpty()) - { - // Shortcuts come in order they were registered - // starting from index 0 - const int key = (i + 1) % 10; - shortcut->changeShortcut(QStringLiteral("Meta+%1").arg(key)); - } -} - -void LXQtTaskBar::activateTask(int pos) -{ - for (int i = 1; i < mLayout->count(); ++i) - { - QWidget * o = mLayout->itemAt(i)->widget(); - LXQtTaskGroup * g = qobject_cast(o); - if (g && g->isVisible()) - { - pos--; - if (pos == 0) - { - g->raiseApplication(); - break; - } - } - } -} diff --git a/plugin-taskbar/lxqttaskbar.h b/plugin-taskbar/lxqttaskbar.h deleted file mode 100644 index 5c6693c..0000000 --- a/plugin-taskbar/lxqttaskbar.h +++ /dev/null @@ -1,153 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Alexander Sokoloff - * Maciej Płaza - * Kuzma Shapran - * - * 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 LXQTTASKBAR_H -#define LXQTTASKBAR_H - -#include "../panel/ilxqtpanel.h" -#include "../panel/ilxqtpanelplugin.h" -#include "lxqttaskbarconfiguration.h" -#include "lxqttaskgroup.h" -#include "lxqttaskbutton.h" - -#include -#include -#include -#include -#include "../panel/ilxqtpanel.h" -#include -#include -#include - -class QSignalMapper; -class LXQtTaskButton; -class ElidedButtonStyle; - -namespace LXQt { -class GridLayout; -} - -class LXQtTaskBar : public QFrame -{ - Q_OBJECT - -public: - explicit LXQtTaskBar(ILXQtPanelPlugin *plugin, QWidget* parent = 0); - virtual ~LXQtTaskBar(); - - void realign(); - - Qt::ToolButtonStyle buttonStyle() const { return mButtonStyle; } - int buttonWidth() const { return mButtonWidth; } - bool closeOnMiddleClick() const { return mCloseOnMiddleClick; } - bool raiseOnCurrentDesktop() const { return mRaiseOnCurrentDesktop; } - bool isShowOnlyOneDesktopTasks() const { return mShowOnlyOneDesktopTasks; } - int showDesktopNum() const { return mShowDesktopNum; } - bool isShowOnlyCurrentScreenTasks() const { return mShowOnlyCurrentScreenTasks; } - bool isShowOnlyMinimizedTasks() const { return mShowOnlyMinimizedTasks; } - bool isAutoRotate() const { return mAutoRotate; } - bool isGroupingEnabled() const { return mGroupingEnabled; } - bool isShowGroupOnHover() const { return mShowGroupOnHover; } - bool isIconByClass() const { return mIconByClass; } - inline ILXQtPanel * panel() const { return mPlugin->panel(); } - inline ILXQtPanelPlugin * plugin() const { return mPlugin; } - -public slots: - void settingsChanged(); - -signals: - void buttonRotationRefreshed(bool autoRotate, ILXQtPanel::Position position); - void buttonStyleRefreshed(Qt::ToolButtonStyle buttonStyle); - void refreshIconGeometry(); - void showOnlySettingChanged(); - void iconByClassChanged(); - void popupShown(LXQtTaskGroup* sender); - -protected: - virtual void dragEnterEvent(QDragEnterEvent * event); - virtual void dragMoveEvent(QDragMoveEvent * event); - -private slots: - void refreshTaskList(); - void refreshButtonRotation(); - void refreshPlaceholderVisibility(); - void groupBecomeEmptySlot(); - void onWindowChanged(WId window, NET::Properties prop, NET::Properties2 prop2); - void onWindowAdded(WId window); - void onWindowRemoved(WId window); - void registerShortcuts(); - void shortcutRegistered(); - void activateTask(int pos); - -private: - typedef QMap windowMap_t; - -private: - void addWindow(WId window); - windowMap_t::iterator removeWindow(windowMap_t::iterator pos); - void buttonMove(LXQtTaskGroup * dst, LXQtTaskGroup * src, QPoint const & pos); - -private: - QMap mKnownWindows; //!< Ids of known windows (mapping to buttons/groups) - LXQt::GridLayout *mLayout; - QList mKeys; - QSignalMapper *mSignalMapper; - - // Settings - Qt::ToolButtonStyle mButtonStyle; - int mButtonWidth; - int mButtonHeight; - bool mCloseOnMiddleClick; - bool mRaiseOnCurrentDesktop; - bool mShowOnlyOneDesktopTasks; - int mShowDesktopNum; - bool mShowOnlyCurrentScreenTasks; - bool mShowOnlyMinimizedTasks; - bool mAutoRotate; - bool mGroupingEnabled; - bool mShowGroupOnHover; - bool mIconByClass; - bool mCycleOnWheelScroll; //!< flag for processing the wheelEvent - - bool acceptWindow(WId window) const; - void setButtonStyle(Qt::ToolButtonStyle buttonStyle); - - void wheelEvent(QWheelEvent* event); - void changeEvent(QEvent* event); - void resizeEvent(QResizeEvent *event); - - ILXQtPanelPlugin *mPlugin; - QWidget *mPlaceHolder; - LeftAlignedTextStyle *mStyle; -}; - -#endif // LXQTTASKBAR_H diff --git a/plugin-taskbar/lxqttaskbarconfiguration.cpp b/plugin-taskbar/lxqttaskbarconfiguration.cpp deleted file mode 100644 index b0dcde3..0000000 --- a/plugin-taskbar/lxqttaskbarconfiguration.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Maciej Płaza - * Kuzma Shapran - * - * 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 "lxqttaskbarconfiguration.h" -#include "ui_lxqttaskbarconfiguration.h" -#include - -LXQtTaskbarConfiguration::LXQtTaskbarConfiguration(PluginSettings *settings, QWidget *parent): - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtTaskbarConfiguration) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName("TaskbarConfigurationWindow"); - ui->setupUi(this); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); - - ui->buttonStyleCB->addItem(tr("Icon and text"), "IconText"); - ui->buttonStyleCB->addItem(tr("Only icon"), "Icon"); - ui->buttonStyleCB->addItem(tr("Only text"), "Text"); - - ui->showDesktopNumCB->addItem(tr("Current"), 0); - //Note: in KWindowSystem desktops are numbered from 1..N - const int desk_cnt = KWindowSystem::numberOfDesktops(); - for (int i = 1; desk_cnt >= i; ++i) - ui->showDesktopNumCB->addItem(QString("%1 - %2").arg(i).arg(KWindowSystem::desktopName(i)), i); - - loadSettings(); - - /* We use clicked() and activated(int) because these signals aren't emitting after programmaticaly - change of state */ - connect(ui->limitByDesktopCB, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(ui->limitByDesktopCB, &QCheckBox::stateChanged, ui->showDesktopNumCB, &QWidget::setEnabled); - connect(ui->showDesktopNumCB, SIGNAL(activated(int)), this, SLOT(saveSettings())); - connect(ui->limitByScreenCB, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(ui->limitByMinimizedCB, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(ui->raiseOnCurrentDesktopCB, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(ui->buttonStyleCB, SIGNAL(activated(int)), this, SLOT(saveSettings())); - connect(ui->buttonWidthSB, SIGNAL(valueChanged(int)), this, SLOT(saveSettings())); - connect(ui->buttonHeightSB, SIGNAL(valueChanged(int)), this, SLOT(saveSettings())); - connect(ui->autoRotateCB, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(ui->middleClickCB, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(ui->groupingGB, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(ui->showGroupOnHoverCB, SIGNAL(clicked()), this, SLOT(saveSettings())); - connect(ui->iconByClassCB, &QCheckBox::clicked, this, &LXQtTaskbarConfiguration::saveSettings); - connect(ui->cycleOnWheelScroll, &QCheckBox::clicked, this, &LXQtTaskbarConfiguration::saveSettings); -} - -LXQtTaskbarConfiguration::~LXQtTaskbarConfiguration() -{ - delete ui; -} - -void LXQtTaskbarConfiguration::loadSettings() -{ - const bool showOnlyOneDesktopTasks = settings().value("showOnlyOneDesktopTasks", false).toBool(); - ui->limitByDesktopCB->setChecked(showOnlyOneDesktopTasks); - ui->showDesktopNumCB->setCurrentIndex(ui->showDesktopNumCB->findData(settings().value("showDesktopNum", 0).toInt())); - ui->showDesktopNumCB->setEnabled(showOnlyOneDesktopTasks); - ui->limitByScreenCB->setChecked(settings().value("showOnlyCurrentScreenTasks", false).toBool()); - ui->limitByMinimizedCB->setChecked(settings().value("showOnlyMinimizedTasks", false).toBool()); - - ui->autoRotateCB->setChecked(settings().value("autoRotate", true).toBool()); - ui->middleClickCB->setChecked(settings().value("closeOnMiddleClick", true).toBool()); - ui->raiseOnCurrentDesktopCB->setChecked(settings().value("raiseOnCurrentDesktop", false).toBool()); - ui->buttonStyleCB->setCurrentIndex(ui->buttonStyleCB->findData(settings().value("buttonStyle", "IconText"))); - ui->buttonWidthSB->setValue(settings().value("buttonWidth", 400).toInt()); - ui->buttonHeightSB->setValue(settings().value("buttonHeight", 100).toInt()); - ui->groupingGB->setChecked(settings().value("groupingEnabled",true).toBool()); - ui->showGroupOnHoverCB->setChecked(settings().value("showGroupOnHover",true).toBool()); - ui->iconByClassCB->setChecked(settings().value("iconByClass", false).toBool()); - ui->cycleOnWheelScroll->setChecked(settings().value("cycleOnWheelScroll", true).toBool()); -} - -void LXQtTaskbarConfiguration::saveSettings() -{ - settings().setValue("showOnlyOneDesktopTasks", ui->limitByDesktopCB->isChecked()); - settings().setValue("showDesktopNum", ui->showDesktopNumCB->itemData(ui->showDesktopNumCB->currentIndex())); - settings().setValue("showOnlyCurrentScreenTasks", ui->limitByScreenCB->isChecked()); - settings().setValue("showOnlyMinimizedTasks", ui->limitByMinimizedCB->isChecked()); - settings().setValue("buttonStyle", ui->buttonStyleCB->itemData(ui->buttonStyleCB->currentIndex())); - settings().setValue("buttonWidth", ui->buttonWidthSB->value()); - settings().setValue("buttonHeight", ui->buttonHeightSB->value()); - settings().setValue("autoRotate", ui->autoRotateCB->isChecked()); - settings().setValue("closeOnMiddleClick", ui->middleClickCB->isChecked()); - settings().setValue("raiseOnCurrentDesktop", ui->raiseOnCurrentDesktopCB->isChecked()); - settings().setValue("groupingEnabled",ui->groupingGB->isChecked()); - settings().setValue("showGroupOnHover",ui->showGroupOnHoverCB->isChecked()); - settings().setValue("iconByClass",ui->iconByClassCB->isChecked()); - settings().setValue("cycleOnWheelScroll",ui->cycleOnWheelScroll->isChecked()); -} diff --git a/plugin-taskbar/lxqttaskbarconfiguration.h b/plugin-taskbar/lxqttaskbarconfiguration.h deleted file mode 100644 index ba6054f..0000000 --- a/plugin-taskbar/lxqttaskbarconfiguration.h +++ /dev/null @@ -1,59 +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: - * Maciej Płaza - * - * 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 LXQTTASKBARCONFIGURATION_H -#define LXQTTASKBARCONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" -#include - -namespace Ui { - class LXQtTaskbarConfiguration; -} - -class LXQtTaskbarConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtTaskbarConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~LXQtTaskbarConfiguration(); - -private: - Ui::LXQtTaskbarConfiguration *ui; - - /* - Read settings from conf file and put data into controls. - */ - void loadSettings(); - -private slots: - void saveSettings(); -}; - -#endif // LXQTTASKBARCONFIGURATION_H diff --git a/plugin-taskbar/lxqttaskbarconfiguration.ui b/plugin-taskbar/lxqttaskbarconfiguration.ui deleted file mode 100644 index d3439bd..0000000 --- a/plugin-taskbar/lxqttaskbarconfiguration.ui +++ /dev/null @@ -1,257 +0,0 @@ - - - LXQtTaskbarConfiguration - - - - 0 - 0 - 401 - 512 - - - - Task Manager Settings - - - - - - General - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Show only windows from desktop - - - - - - - - - - - - Show only windows from &panel's screen - - - - - - - Show only minimized windows - - - - - - - Raise minimized windows on current desktop - - - - - - - Close on middle-click - - - - - - - Cycle windows on wheel scrolling - - - - - - - - - - Window &grouping - - - true - - - - - - Show popup on mouse hover - - - - - - - - - - Appearance - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Button style - - - - - - - - - - Maximum button width - - - - - - - - 0 - 0 - - - - px - - - 1 - - - 2147483647 - - - - - - - Maximum button height - - - - - - - - 0 - 0 - - - - px - - - 1 - - - 500 - - - - - - - Auto&rotate buttons when the panel is vertical - - - - - - - Use icons by WindowClass, if available - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - - buttons - accepted() - LXQtTaskbarConfiguration - accept() - - - 262 - 496 - - - 157 - 274 - - - - - buttons - rejected() - LXQtTaskbarConfiguration - reject() - - - 330 - 496 - - - 286 - 274 - - - - - diff --git a/plugin-taskbar/lxqttaskbarplugin.cpp b/plugin-taskbar/lxqttaskbarplugin.cpp deleted file mode 100644 index 1c51d82..0000000 --- a/plugin-taskbar/lxqttaskbarplugin.cpp +++ /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: - * Alexander Sokoloff - * - * 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 "lxqttaskbarplugin.h" - -LXQtTaskBarPlugin::LXQtTaskBarPlugin(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo) - -{ - mTaskBar = new LXQtTaskBar(this); - -} - - -LXQtTaskBarPlugin::~LXQtTaskBarPlugin() -{ - delete mTaskBar; -} - -QDialog *LXQtTaskBarPlugin::configureDialog() -{ - return new LXQtTaskbarConfiguration(settings()); -} - -void LXQtTaskBarPlugin::realign() -{ - mTaskBar->realign(); -} diff --git a/plugin-taskbar/lxqttaskbarplugin.h b/plugin-taskbar/lxqttaskbarplugin.h deleted file mode 100644 index ef64421..0000000 --- a/plugin-taskbar/lxqttaskbarplugin.h +++ /dev/null @@ -1,69 +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: - * Alexander Sokoloff - * - * 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 LXQTTASKBARPLUGIN_H -#define LXQTTASKBARPLUGIN_H - -#include "../panel/ilxqtpanel.h" -#include "../panel/ilxqtpanelplugin.h" -#include "lxqttaskbar.h" -#include -class LXQtTaskBar; - -class LXQtTaskBarPlugin : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - LXQtTaskBarPlugin(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtTaskBarPlugin(); - - QString themeId() const { return "TaskBar"; } - virtual Flags flags() const { return HaveConfigDialog | NeedsHandle; } - - QWidget *widget() { return mTaskBar; } - QDialog *configureDialog(); - - void settingsChanged() { mTaskBar->settingsChanged(); } - void realign(); - - bool isSeparate() const { return true; } - bool isExpandable() const { return true; } -private: - LXQtTaskBar *mTaskBar; -}; - -class LXQtTaskBarPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - // Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const { return new LXQtTaskBarPlugin(startupInfo);} -}; - -#endif // LXQTTASKBARPLUGIN_H diff --git a/plugin-taskbar/lxqttaskbutton.cpp b/plugin-taskbar/lxqttaskbutton.cpp deleted file mode 100644 index 894343e..0000000 --- a/plugin-taskbar/lxqttaskbutton.cpp +++ /dev/null @@ -1,761 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Alexander Sokoloff - * Kuzma Shapran - * - * 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 "lxqttaskbutton.h" -#include "lxqttaskgroup.h" -#include "lxqttaskbar.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lxqttaskbutton.h" -#include "lxqttaskgroup.h" -#include "lxqttaskbar.h" - -#include -// Necessary for closeApplication() -#include -#include - -bool LXQtTaskButton::sDraggging = false; - -/************************************************ - -************************************************/ -void LeftAlignedTextStyle::drawItemText(QPainter * painter, const QRect & rect, int flags - , const QPalette & pal, bool enabled, const QString & text - , QPalette::ColorRole textRole) const -{ - QString txt = QFontMetrics(painter->font()).elidedText(text, Qt::ElideRight, rect.width()); - return QProxyStyle::drawItemText(painter, rect, (flags & ~Qt::AlignHCenter) | Qt::AlignLeft, pal, enabled, txt, textRole); -} - - -/************************************************ - -************************************************/ -LXQtTaskButton::LXQtTaskButton(const WId window, LXQtTaskBar * taskbar, QWidget *parent) : - QToolButton(parent), - mWindow(window), - mUrgencyHint(false), - mOrigin(Qt::TopLeftCorner), - mDrawPixmap(false), - mParentTaskBar(taskbar), - mPlugin(mParentTaskBar->plugin()), - mDNDTimer(new QTimer(this)) -{ - Q_ASSERT(taskbar); - - setCheckable(true); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - - setMinimumWidth(1); - setMinimumHeight(1); - setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - setAcceptDrops(true); - - updateText(); - updateIcon(); - - mDNDTimer->setSingleShot(true); - mDNDTimer->setInterval(700); - connect(mDNDTimer, SIGNAL(timeout()), this, SLOT(activateWithDraggable())); - connect(LXQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(updateIcon())); - connect(mParentTaskBar, &LXQtTaskBar::iconByClassChanged, this, &LXQtTaskButton::updateIcon); -} - -/************************************************ - -************************************************/ -LXQtTaskButton::~LXQtTaskButton() -{ -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::updateText() -{ - KWindowInfo info(mWindow, NET::WMVisibleName | NET::WMName); - QString title = info.visibleName().isEmpty() ? info.name() : info.visibleName(); - setText(title.replace("&", "&&")); - setToolTip(title); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::updateIcon() -{ - QIcon ico; - if (mParentTaskBar->isIconByClass()) - { - ico = XdgIcon::fromTheme(QString::fromUtf8(KWindowInfo{mWindow, 0, NET::WM2WindowClass}.windowClassClass()).toLower()); - } - if (ico.isNull()) - { - ico = KWindowSystem::icon(mWindow); - } - setIcon(ico.isNull() ? XdgIcon::defaultApplicationIcon() : ico); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::refreshIconGeometry(QRect const & geom) -{ - NETWinInfo info(QX11Info::connection(), - windowId(), - (WId) QX11Info::appRootWindow(), - NET::WMIconGeometry, - 0); - NETRect const curr = info.iconGeometry(); - if (curr.pos.x != geom.x() || curr.pos.y != geom.y() - || curr.size.width != geom.width() || curr.size.height != geom.height()) - { - NETRect nrect; - nrect.pos.x = geom.x(); - nrect.pos.y = geom.y(); - nrect.size.height = geom.height(); - nrect.size.width = geom.width(); - info.setIconGeometry(nrect); - } -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::dragEnterEvent(QDragEnterEvent *event) -{ - // It must be here otherwise dragLeaveEvent and dragMoveEvent won't be called - // on the other hand drop and dragmove events of parent widget won't be called - event->acceptProposedAction(); - if (event->mimeData()->hasFormat(mimeDataFormat())) - { - emit dragging(event->source(), event->pos()); - setAttribute(Qt::WA_UnderMouse, false); - } else - { - mDNDTimer->start(); - } - - QToolButton::dragEnterEvent(event); -} - -void LXQtTaskButton::dragMoveEvent(QDragMoveEvent * event) -{ - if (event->mimeData()->hasFormat(mimeDataFormat())) - { - emit dragging(event->source(), event->pos()); - setAttribute(Qt::WA_UnderMouse, false); - } -} - -void LXQtTaskButton::dragLeaveEvent(QDragLeaveEvent *event) -{ - mDNDTimer->stop(); - QToolButton::dragLeaveEvent(event); -} - -void LXQtTaskButton::dropEvent(QDropEvent *event) -{ - mDNDTimer->stop(); - if (event->mimeData()->hasFormat(mimeDataFormat())) - { - emit dropped(event->source(), event->pos()); - setAttribute(Qt::WA_UnderMouse, false); - } - QToolButton::dropEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::mousePressEvent(QMouseEvent* event) -{ - const Qt::MouseButton b = event->button(); - - if (Qt::LeftButton == b) - mDragStartPosition = event->pos(); - else if (Qt::MidButton == b && parentTaskBar()->closeOnMiddleClick()) - closeApplication(); - - QToolButton::mousePressEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::mouseReleaseEvent(QMouseEvent* event) -{ - if (event->button() == Qt::LeftButton) - { - if (isChecked()) - minimizeApplication(); - else - raiseApplication(); - } - QToolButton::mouseReleaseEvent(event); -} - -/************************************************ - - ************************************************/ -QMimeData * LXQtTaskButton::mimeData() -{ - QMimeData *mimedata = new QMimeData; - QByteArray ba; - QDataStream stream(&ba,QIODevice::WriteOnly); - stream << (qlonglong)(mWindow); - mimedata->setData(mimeDataFormat(), ba); - return mimedata; -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::mouseMoveEvent(QMouseEvent* event) -{ - if (!(event->buttons() & Qt::LeftButton)) - return; - - if ((event->pos() - mDragStartPosition).manhattanLength() < QApplication::startDragDistance()) - return; - - QDrag *drag = new QDrag(this); - drag->setMimeData(mimeData()); - QIcon ico = icon(); - QPixmap img = ico.pixmap(ico.actualSize({32, 32})); - drag->setPixmap(img); - switch (parentTaskBar()->panel()->position()) - { - case ILXQtPanel::PositionLeft: - case ILXQtPanel::PositionTop: - drag->setHotSpot({0, 0}); - break; - case ILXQtPanel::PositionRight: - case ILXQtPanel::PositionBottom: - drag->setHotSpot(img.rect().bottomRight()); - break; - } - - sDraggging = true; - drag->exec(); - - // if button is dropped out of panel (e.g. on desktop) - // it is not deleted automatically by Qt - drag->deleteLater(); - sDraggging = false; - - QAbstractButton::mouseMoveEvent(event); -} - -/************************************************ - - ************************************************/ -bool LXQtTaskButton::isApplicationHidden() const -{ - KWindowInfo info(mWindow, NET::WMState); - return (info.state() & NET::Hidden); -} - -/************************************************ - - ************************************************/ -bool LXQtTaskButton::isApplicationActive() const -{ - return KWindowSystem::activeWindow() == mWindow; -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::activateWithDraggable() -{ - // raise app in any time when there is a drag - // in progress to allow drop it into an app - raiseApplication(); - KWindowSystem::forceActiveWindow(mWindow); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::raiseApplication() -{ - KWindowInfo info(mWindow, NET::WMDesktop | NET::WMState | NET::XAWMState); - if (parentTaskBar()->raiseOnCurrentDesktop() && info.isMinimized()) - { - KWindowSystem::setOnDesktop(mWindow, KWindowSystem::currentDesktop()); - } - else - { - int winDesktop = info.desktop(); - if (KWindowSystem::currentDesktop() != winDesktop) - KWindowSystem::setCurrentDesktop(winDesktop); - } - KWindowSystem::activateWindow(mWindow); - - setUrgencyHint(false); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::minimizeApplication() -{ - KWindowSystem::minimizeWindow(mWindow); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::maximizeApplication() -{ - QAction* act = qobject_cast(sender()); - if (!act) - return; - - int state = act->data().toInt(); - switch (state) - { - case NET::MaxHoriz: - KWindowSystem::setState(mWindow, NET::MaxHoriz); - break; - - case NET::MaxVert: - KWindowSystem::setState(mWindow, NET::MaxVert); - break; - - default: - KWindowSystem::setState(mWindow, NET::Max); - break; - } - - if (!isApplicationActive()) - raiseApplication(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::deMaximizeApplication() -{ - KWindowSystem::clearState(mWindow, NET::Max); - - if (!isApplicationActive()) - raiseApplication(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::shadeApplication() -{ - KWindowSystem::setState(mWindow, NET::Shaded); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::unShadeApplication() -{ - KWindowSystem::clearState(mWindow, NET::Shaded); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::closeApplication() -{ - // FIXME: Why there is no such thing in KWindowSystem?? - NETRootInfo(QX11Info::connection(), NET::CloseWindow).closeWindowRequest(mWindow); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::setApplicationLayer() -{ - QAction* act = qobject_cast(sender()); - if (!act) - return; - - int layer = act->data().toInt(); - switch(layer) - { - case NET::KeepAbove: - KWindowSystem::clearState(mWindow, NET::KeepBelow); - KWindowSystem::setState(mWindow, NET::KeepAbove); - break; - - case NET::KeepBelow: - KWindowSystem::clearState(mWindow, NET::KeepAbove); - KWindowSystem::setState(mWindow, NET::KeepBelow); - break; - - default: - KWindowSystem::clearState(mWindow, NET::KeepBelow); - KWindowSystem::clearState(mWindow, NET::KeepAbove); - break; - } -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::moveApplicationToDesktop() -{ - QAction* act = qobject_cast(sender()); - if (!act) - return; - - bool ok; - int desk = act->data().toInt(&ok); - - if (!ok) - return; - - KWindowSystem::setOnDesktop(mWindow, desk); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::contextMenuEvent(QContextMenuEvent* event) -{ - if (event->modifiers().testFlag(Qt::ControlModifier)) - { - event->ignore(); - return; - } - - KWindowInfo info(mWindow, 0, NET::WM2AllowedActions); - unsigned long state = KWindowInfo(mWindow, NET::WMState).state(); - - QMenu * menu = new QMenu(tr("Application")); - menu->setAttribute(Qt::WA_DeleteOnClose); - QAction* a; - - /* KDE menu ******* - - + To &Desktop > - + &All Desktops - + --- - + &1 Desktop 1 - + &2 Desktop 2 - + &To Current Desktop - &Move - Re&size - + Mi&nimize - + Ma&ximize - + &Shade - Ad&vanced > - Keep &Above Others - Keep &Below Others - Fill screen - &Layer > - Always on &top - &Normal - Always on &bottom - --- - + &Close - */ - - /********** Desktop menu **********/ - int deskNum = KWindowSystem::numberOfDesktops(); - if (deskNum > 1) - { - int winDesk = KWindowInfo(mWindow, NET::WMDesktop).desktop(); - QMenu* deskMenu = menu->addMenu(tr("To &Desktop")); - - a = deskMenu->addAction(tr("&All Desktops")); - a->setData(NET::OnAllDesktops); - a->setEnabled(winDesk != NET::OnAllDesktops); - connect(a, SIGNAL(triggered(bool)), this, SLOT(moveApplicationToDesktop())); - deskMenu->addSeparator(); - - for (int i = 0; i < deskNum; ++i) - { - a = deskMenu->addAction(tr("Desktop &%1").arg(i + 1)); - a->setData(i + 1); - a->setEnabled(i + 1 != winDesk); - connect(a, SIGNAL(triggered(bool)), this, SLOT(moveApplicationToDesktop())); - } - - int curDesk = KWindowSystem::currentDesktop(); - a = menu->addAction(tr("&To Current Desktop")); - a->setData(curDesk); - a->setEnabled(curDesk != winDesk); - connect(a, SIGNAL(triggered(bool)), this, SLOT(moveApplicationToDesktop())); - } - - /********** State menu **********/ - menu->addSeparator(); - - a = menu->addAction(tr("Ma&ximize")); - a->setEnabled(info.actionSupported(NET::ActionMax) && (!(state & NET::Max) || (state & NET::Hidden))); - a->setData(NET::Max); - connect(a, SIGNAL(triggered(bool)), this, SLOT(maximizeApplication())); - - if (event->modifiers() & Qt::ShiftModifier) - { - a = menu->addAction(tr("Maximize vertically")); - a->setEnabled(info.actionSupported(NET::ActionMaxVert) && !((state & NET::MaxVert) || (state & NET::Hidden))); - a->setData(NET::MaxVert); - connect(a, SIGNAL(triggered(bool)), this, SLOT(maximizeApplication())); - - a = menu->addAction(tr("Maximize horizontally")); - a->setEnabled(info.actionSupported(NET::ActionMaxHoriz) && !((state & NET::MaxHoriz) || (state & NET::Hidden))); - a->setData(NET::MaxHoriz); - connect(a, SIGNAL(triggered(bool)), this, SLOT(maximizeApplication())); - } - - a = menu->addAction(tr("&Restore")); - a->setEnabled((state & NET::Hidden) || (state & NET::Max) || (state & NET::MaxHoriz) || (state & NET::MaxVert)); - connect(a, SIGNAL(triggered(bool)), this, SLOT(deMaximizeApplication())); - - a = menu->addAction(tr("Mi&nimize")); - a->setEnabled(info.actionSupported(NET::ActionMinimize) && !(state & NET::Hidden)); - connect(a, SIGNAL(triggered(bool)), this, SLOT(minimizeApplication())); - - if (state & NET::Shaded) - { - a = menu->addAction(tr("Roll down")); - a->setEnabled(info.actionSupported(NET::ActionShade) && !(state & NET::Hidden)); - connect(a, SIGNAL(triggered(bool)), this, SLOT(unShadeApplication())); - } - else - { - a = menu->addAction(tr("Roll up")); - a->setEnabled(info.actionSupported(NET::ActionShade) && !(state & NET::Hidden)); - connect(a, SIGNAL(triggered(bool)), this, SLOT(shadeApplication())); - } - - /********** Layer menu **********/ - menu->addSeparator(); - - QMenu* layerMenu = menu->addMenu(tr("&Layer")); - - a = layerMenu->addAction(tr("Always on &top")); - // FIXME: There is no info.actionSupported(NET::ActionKeepAbove) - a->setEnabled(!(state & NET::KeepAbove)); - a->setData(NET::KeepAbove); - connect(a, SIGNAL(triggered(bool)), this, SLOT(setApplicationLayer())); - - a = layerMenu->addAction(tr("&Normal")); - a->setEnabled((state & NET::KeepAbove) || (state & NET::KeepBelow)); - // FIXME: There is no NET::KeepNormal, so passing 0 - a->setData(0); - connect(a, SIGNAL(triggered(bool)), this, SLOT(setApplicationLayer())); - - a = layerMenu->addAction(tr("Always on &bottom")); - // FIXME: There is no info.actionSupported(NET::ActionKeepBelow) - a->setEnabled(!(state & NET::KeepBelow)); - a->setData(NET::KeepBelow); - connect(a, SIGNAL(triggered(bool)), this, SLOT(setApplicationLayer())); - - /********** Kill menu **********/ - menu->addSeparator(); - a = menu->addAction(XdgIcon::fromTheme("process-stop"), tr("&Close")); - connect(a, SIGNAL(triggered(bool)), this, SLOT(closeApplication())); - menu->setGeometry(mParentTaskBar->panel()->calculatePopupWindowPos(mapToGlobal(event->pos()), menu->sizeHint())); - mPlugin->willShowWindow(menu); - menu->show(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskButton::setUrgencyHint(bool set) -{ - if (mUrgencyHint == set) - return; - - if (!set) - KWindowSystem::demandAttention(mWindow, false); - - mUrgencyHint = set; - setProperty("urgent", set); - style()->unpolish(this); - style()->polish(this); - update(); -} - -/************************************************ - - ************************************************/ -bool LXQtTaskButton::isOnDesktop(int desktop) const -{ - return KWindowInfo(mWindow, NET::WMDesktop).isOnDesktop(desktop); -} - -bool LXQtTaskButton::isOnCurrentScreen() const -{ - return QApplication::desktop()->screenGeometry(parentTaskBar()).intersects(KWindowInfo(mWindow, NET::WMFrameExtents).frameGeometry()); -} - -bool LXQtTaskButton::isMinimized() const -{ - return KWindowInfo(mWindow,NET::WMState | NET::XAWMState).isMinimized(); -} - -Qt::Corner LXQtTaskButton::origin() const -{ - return mOrigin; -} - -void LXQtTaskButton::setOrigin(Qt::Corner newOrigin) -{ - if (mOrigin != newOrigin) - { - mOrigin = newOrigin; - update(); - } -} - -void LXQtTaskButton::setAutoRotation(bool value, ILXQtPanel::Position position) -{ - if (value) - { - switch (position) - { - case ILXQtPanel::PositionTop: - case ILXQtPanel::PositionBottom: - setOrigin(Qt::TopLeftCorner); - break; - - case ILXQtPanel::PositionLeft: - setOrigin(Qt::BottomLeftCorner); - break; - - case ILXQtPanel::PositionRight: - setOrigin(Qt::TopRightCorner); - break; - } - } - else - setOrigin(Qt::TopLeftCorner); -} - -void LXQtTaskButton::paintEvent(QPaintEvent *event) -{ - if (mOrigin == Qt::TopLeftCorner) - { - QToolButton::paintEvent(event); - return; - } - - QSize sz = size(); - QSize adjSz = sz; - QTransform transform; - QPoint originPoint; - - switch (mOrigin) - { - case Qt::TopLeftCorner: - transform.rotate(0.0); - originPoint = QPoint(0.0, 0.0); - break; - - case Qt::TopRightCorner: - transform.rotate(90.0); - originPoint = QPoint(0.0, -sz.width()); - adjSz.transpose(); - break; - - case Qt::BottomRightCorner: - transform.rotate(180.0); - originPoint = QPoint(-sz.width(), -sz.height()); - break; - - case Qt::BottomLeftCorner: - transform.rotate(270.0); - originPoint = QPoint(-sz.height(), 0.0); - adjSz.transpose(); - break; - } - - bool drawPixmapNextTime = false; - - if (!mDrawPixmap) - { - mPixmap = QPixmap(adjSz); - mPixmap.fill(QColor(0, 0, 0, 0)); - - if (adjSz != sz) - resize(adjSz); // this causes paint event to be repeated - next time we'll paint the pixmap to the widget surface. - - // copied from QToolButton::paintEvent { - QStylePainter painter(&mPixmap, this); - QStyleOptionToolButton opt; - initStyleOption(&opt); - painter.drawComplexControl(QStyle::CC_ToolButton, opt); - // } - - if (adjSz != sz) - { - resize(sz); - drawPixmapNextTime = true; - } - else - mDrawPixmap = true; // transfer the pixmap to the widget now! - } - if (mDrawPixmap) - { - QPainter painter(this); - painter.setTransform(transform); - painter.drawPixmap(originPoint, mPixmap); - - drawPixmapNextTime = false; - } - - mDrawPixmap = drawPixmapNextTime; -} - -bool LXQtTaskButton::hasDragAndDropHover() const -{ - return mDNDTimer->isActive(); -} diff --git a/plugin-taskbar/lxqttaskbutton.h b/plugin-taskbar/lxqttaskbutton.h deleted file mode 100644 index a07ffa0..0000000 --- a/plugin-taskbar/lxqttaskbutton.h +++ /dev/null @@ -1,145 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Alexander Sokoloff - * Kuzma Shapran - * - * 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 LXQTTASKBUTTON_H -#define LXQTTASKBUTTON_H - -#include -#include -#include "../panel/ilxqtpanel.h" - -class QPainter; -class QPalette; -class QMimeData; -class LXQtTaskGroup; -class LXQtTaskBar; - -class LeftAlignedTextStyle : public QProxyStyle -{ - using QProxyStyle::QProxyStyle; -public: - - virtual void drawItemText(QPainter * painter, const QRect & rect, int flags - , const QPalette & pal, bool enabled, const QString & text - , QPalette::ColorRole textRole = QPalette::NoRole) const override; -}; - - -class LXQtTaskButton : public QToolButton -{ - Q_OBJECT - - Q_PROPERTY(Qt::Corner origin READ origin WRITE setOrigin) - -public: - explicit LXQtTaskButton(const WId window, LXQtTaskBar * taskBar, QWidget *parent = 0); - virtual ~LXQtTaskButton(); - - bool isApplicationHidden() const; - bool isApplicationActive() const; - WId windowId() const { return mWindow; } - - bool hasUrgencyHint() const { return mUrgencyHint; } - void setUrgencyHint(bool set); - - bool isOnDesktop(int desktop) const; - bool isOnCurrentScreen() const; - bool isMinimized() const; - void updateText(); - - Qt::Corner origin() const; - virtual void setAutoRotation(bool value, ILXQtPanel::Position position); - - LXQtTaskBar * parentTaskBar() const {return mParentTaskBar;} - - void refreshIconGeometry(QRect const & geom); - static QString mimeDataFormat() { return QLatin1String("lxqt/lxqttaskbutton"); } - /*! \return true if this buttom received DragEnter event (and no DragLeave event yet) - * */ - bool hasDragAndDropHover() const; - -public slots: - void raiseApplication(); - void minimizeApplication(); - void maximizeApplication(); - void deMaximizeApplication(); - void shadeApplication(); - void unShadeApplication(); - void closeApplication(); - void moveApplicationToDesktop(); - void setApplicationLayer(); - - void setOrigin(Qt::Corner); - - void updateIcon(); - -protected: - virtual void dragEnterEvent(QDragEnterEvent *event); - virtual void dragMoveEvent(QDragMoveEvent * event); - virtual void dragLeaveEvent(QDragLeaveEvent *event); - virtual void dropEvent(QDropEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - virtual void contextMenuEvent(QContextMenuEvent *event); - void paintEvent(QPaintEvent *); - - void setWindowId(WId wid) {mWindow = wid;} - virtual QMimeData * mimeData(); - static bool sDraggging; - - inline ILXQtPanelPlugin * plugin() const { return mPlugin; } - -private: - WId mWindow; - bool mUrgencyHint; - QPoint mDragStartPosition; - Qt::Corner mOrigin; - QPixmap mPixmap; - bool mDrawPixmap; - LXQtTaskBar * mParentTaskBar; - ILXQtPanelPlugin * mPlugin; - - // Timer for when draggind something into a button (the button's window - // must be activated so that the use can continue dragging to the window - QTimer * mDNDTimer; - -private slots: - void activateWithDraggable(); - -signals: - void dropped(QObject * dragSource, QPoint const & pos); - void dragging(QObject * dragSource, QPoint const & pos); -}; - -typedef QHash LXQtTaskButtonHash; - -#endif // LXQTTASKBUTTON_H diff --git a/plugin-taskbar/lxqttaskgroup.cpp b/plugin-taskbar/lxqttaskgroup.cpp deleted file mode 100644 index 3efc514..0000000 --- a/plugin-taskbar/lxqttaskgroup.cpp +++ /dev/null @@ -1,662 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Alexander Sokoloff - * Maciej Płaza - * Kuzma Shapran - * - * 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 "lxqttaskgroup.h" -#include "lxqttaskbar.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/************************************************ - - ************************************************/ -LXQtTaskGroup::LXQtTaskGroup(const QString &groupName, WId window, LXQtTaskBar *parent) - : LXQtTaskButton(window, parent, parent), - mGroupName(groupName), - mPopup(new LXQtGroupPopup(this)), - mPreventPopup(false), - mSingleButton(true) -{ - Q_ASSERT(parent); - - setObjectName(groupName); - setText(groupName); - - connect(this, SIGNAL(clicked(bool)), this, SLOT(onClicked(bool))); - connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(onDesktopChanged(int))); - connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(onActiveWindowChanged(WId))); - connect(parent, &LXQtTaskBar::buttonRotationRefreshed, this, &LXQtTaskGroup::setAutoRotation); - connect(parent, &LXQtTaskBar::refreshIconGeometry, this, &LXQtTaskGroup::refreshIconsGeometry); - connect(parent, &LXQtTaskBar::buttonStyleRefreshed, this, &LXQtTaskGroup::setToolButtonsStyle); - connect(parent, &LXQtTaskBar::showOnlySettingChanged, this, &LXQtTaskGroup::refreshVisibility); - connect(parent, &LXQtTaskBar::popupShown, this, &LXQtTaskGroup::groupPopupShown); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::contextMenuEvent(QContextMenuEvent *event) -{ - setPopupVisible(false, true); - mPreventPopup = true; - if (mSingleButton) - { - LXQtTaskButton::contextMenuEvent(event); - return; - } - - QMenu * menu = new QMenu(tr("Group")); - menu->setAttribute(Qt::WA_DeleteOnClose); - QAction *a = menu->addAction(XdgIcon::fromTheme("process-stop"), tr("Close group")); - connect(a, SIGNAL(triggered()), this, SLOT(closeGroup())); - connect(menu, &QMenu::aboutToHide, [this] { - mPreventPopup = false; - }); - menu->setGeometry(plugin()->panel()->calculatePopupWindowPos(mapToGlobal(event->pos()), menu->sizeHint())); - plugin()->willShowWindow(menu); - menu->show(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::closeGroup() -{ - foreach (LXQtTaskButton * button, mButtonHash.values()) - if (button->isOnDesktop(KWindowSystem::currentDesktop())) - button->closeApplication(); -} - -/************************************************ - - ************************************************/ -LXQtTaskButton * LXQtTaskGroup::addWindow(WId id) -{ - if (mButtonHash.contains(id)) - return mButtonHash.value(id); - - LXQtTaskButton *btn = new LXQtTaskButton(id, parentTaskBar(), mPopup); - btn->setToolButtonStyle(popupButtonStyle()); - - if (btn->isApplicationActive()) - { - btn->setChecked(true); - setChecked(true); - } - - mButtonHash.insert(id, btn); - mPopup->addButton(btn); - - connect(btn, SIGNAL(clicked()), this, SLOT(onChildButtonClicked())); - refreshVisibility(); - - return btn; -} - -/************************************************ - - ************************************************/ -LXQtTaskButton * LXQtTaskGroup::checkedButton() const -{ - foreach (LXQtTaskButton* button, mButtonHash.values()) - if (button->isChecked()) - return button; - - return NULL; -} - -/************************************************ - - ************************************************/ -LXQtTaskButton * LXQtTaskGroup::getNextPrevChildButton(bool next, bool circular) -{ - LXQtTaskButton *button = checkedButton(); - int idx = mPopup->indexOf(button); - int inc = next ? 1 : -1; - idx += inc; - - // if there is no cheked button, get the first one if next equals true - // or the last one if not - if (!button) - { - idx = -1; - if (next) - { - for (int i = 0; i < mPopup->count() && idx == -1; i++) - if (mPopup->itemAt(i)->widget()->isVisibleTo(mPopup)) - idx = i; - } - else - { - for (int i = mPopup->count() - 1; i >= 0 && idx == -1; i--) - if (mPopup->itemAt(i)->widget()->isVisibleTo(mPopup)) - idx = i; - } - } - - if (circular) - idx = (idx + mButtonHash.count()) % mButtonHash.count(); - else if (mPopup->count() <= idx || idx < 0) - return NULL; - - // return the next or the previous child - QLayoutItem *item = mPopup->itemAt(idx); - if (item) - { - button = qobject_cast(item->widget()); - if (button->isVisibleTo(mPopup)) - return button; - } - - return NULL; -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::onActiveWindowChanged(WId window) -{ - LXQtTaskButton *button = mButtonHash.value(window, nullptr); - foreach (LXQtTaskButton *btn, mButtonHash.values()) - btn->setChecked(false); - - if (button) - { - button->setChecked(true); - if (button->hasUrgencyHint()) - button->setUrgencyHint(false); - } - setChecked(nullptr != button); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::onDesktopChanged(int number) -{ - refreshVisibility(); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::onWindowRemoved(WId window) -{ - if (mButtonHash.contains(window)) - { - LXQtTaskButton *button = mButtonHash.value(window); - mButtonHash.remove(window); - mPopup->removeWidget(button); - button->deleteLater(); - - if (mButtonHash.count()) - regroup(); - else - { - if (isVisible()) - emit visibilityChanged(false); - hide(); - emit groupBecomeEmpty(groupName()); - - } - } -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::onChildButtonClicked() -{ - setPopupVisible(false, true); -} - -/************************************************ - - ************************************************/ -Qt::ToolButtonStyle LXQtTaskGroup::popupButtonStyle() const -{ - // do not set icons-only style in the buttons in the group, - // as they'll be indistinguishable - const Qt::ToolButtonStyle style = toolButtonStyle(); - return style == Qt::ToolButtonIconOnly ? Qt::ToolButtonTextBesideIcon : style; -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::setToolButtonsStyle(Qt::ToolButtonStyle style) -{ - setToolButtonStyle(style); - - const Qt::ToolButtonStyle styleInPopup = popupButtonStyle(); - for (auto & button : mButtonHash) - { - button->setToolButtonStyle(styleInPopup); - } -} - -/************************************************ - - ************************************************/ -int LXQtTaskGroup::buttonsCount() const -{ - return mButtonHash.count(); -} - -/************************************************ - - ************************************************/ -int LXQtTaskGroup::visibleButtonsCount() const -{ - int i = 0; - foreach (LXQtTaskButton *btn, mButtonHash.values()) - if (btn->isVisibleTo(mPopup)) - i++; - return i; -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::draggingTimerTimeout() -{ - if (mSingleButton) - setPopupVisible(false); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::onClicked(bool) -{ - if (visibleButtonsCount() > 1) - { - setChecked(mButtonHash.contains(KWindowSystem::activeWindow())); - setPopupVisible(true); - } -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::regroup() -{ - int cont = visibleButtonsCount(); - recalculateFrameIfVisible(); - - if (cont == 1) - { - mSingleButton = true; - // Get first visible button - LXQtTaskButton * button = NULL; - foreach (LXQtTaskButton *btn, mButtonHash.values()) - { - if (btn->isVisibleTo(mPopup)) - { - button = btn; - break; - } - } - - if (button) - { - setText(button->text()); - setToolTip(button->toolTip()); - setWindowId(button->windowId()); - } - } - else if (cont == 0) - hide(); - else - { - mSingleButton = false; - QString t = QString("%1 - %2 windows").arg(mGroupName).arg(cont); - setText(t); - setToolTip(parentTaskBar()->isShowGroupOnHover() ? QString() : t); - } -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::recalculateFrameIfVisible() -{ - if (mPopup->isVisible()) - { - recalculateFrameSize(); - if (plugin()->panel()->position() == ILXQtPanel::PositionBottom) - recalculateFramePosition(); - } -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::setAutoRotation(bool value, ILXQtPanel::Position position) -{ - foreach (LXQtTaskButton *button, mButtonHash.values()) - button->setAutoRotation(false, position); - - LXQtTaskButton::setAutoRotation(value, position); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::refreshVisibility() -{ - bool will = false; - LXQtTaskBar const * taskbar = parentTaskBar(); - const int showDesktop = taskbar->showDesktopNum(); - foreach(LXQtTaskButton * btn, mButtonHash.values()) - { - bool visible = taskbar->isShowOnlyOneDesktopTasks() ? btn->isOnDesktop(0 == showDesktop ? KWindowSystem::currentDesktop() : showDesktop) : true; - visible &= taskbar->isShowOnlyCurrentScreenTasks() ? btn->isOnCurrentScreen() : true; - visible &= taskbar->isShowOnlyMinimizedTasks() ? btn->isMinimized() : true; - btn->setVisible(visible); - will |= visible; - } - - bool is = isVisible(); - setVisible(will); - regroup(); - - if (is != will) - emit visibilityChanged(will); -} - -/************************************************ - - ************************************************/ -QMimeData * LXQtTaskGroup::mimeData() -{ - QMimeData *mimedata = new QMimeData; - QByteArray byteArray; - QDataStream stream(&byteArray, QIODevice::WriteOnly); - stream << groupName(); - mimedata->setData(mimeDataFormat(), byteArray); - return mimedata; -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::setPopupVisible(bool visible, bool fast) -{ - if (visible && !mPreventPopup && !mSingleButton) - { - if (!mPopup->isVisible()) - { - // setup geometry - recalculateFrameSize(); - recalculateFramePosition(); - } - - plugin()->willShowWindow(mPopup); - mPopup->show(); - emit popupShown(this); - } - else - mPopup->hide(fast); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::refreshIconsGeometry() -{ - QRect rect = geometry(); - rect.moveTo(mapToGlobal(QPoint(0, 0))); - - if (mSingleButton) - { - refreshIconGeometry(rect); - return; - } - - foreach(LXQtTaskButton *but, mButtonHash.values()) - { - but->refreshIconGeometry(rect); - but->setIconSize(QSize(plugin()->panel()->iconSize(), plugin()->panel()->iconSize())); - } -} - -/************************************************ - - ************************************************/ -QSize LXQtTaskGroup::recalculateFrameSize() -{ - int height = recalculateFrameHeight(); - mPopup->setMaximumHeight(1000); - mPopup->setMinimumHeight(0); - - int hh = recalculateFrameWidth(); - mPopup->setMaximumWidth(hh); - mPopup->setMinimumWidth(0); - - QSize newSize(hh, height); - mPopup->resize(newSize); - - return newSize; -} - -/************************************************ - - ************************************************/ -int LXQtTaskGroup::recalculateFrameHeight() const -{ - int cont = visibleButtonsCount(); - int h = !plugin()->panel()->isHorizontal() && parentTaskBar()->isAutoRotate() ? width() : height(); - return cont * h + (cont + 1) * mPopup->spacing(); -} - -/************************************************ - - ************************************************/ -int LXQtTaskGroup::recalculateFrameWidth() const -{ - const QFontMetrics fm = fontMetrics(); - int max = 100 * fm.width (' '); // elide after the max width - int txtWidth = 0; - foreach (LXQtTaskButton *btn, mButtonHash.values()) - txtWidth = qMax(fm.width(btn->text()), txtWidth); - return iconSize().width() + qMin(txtWidth, max) + 30/* give enough room to margins and borders*/; -} - -/************************************************ - - ************************************************/ -QPoint LXQtTaskGroup::recalculateFramePosition() -{ - // Set position - int x_offset = 0, y_offset = 0; - switch (plugin()->panel()->position()) - { - case ILXQtPanel::PositionTop: - y_offset += height(); - break; - case ILXQtPanel::PositionBottom: - y_offset = -recalculateFrameHeight(); - break; - case ILXQtPanel::PositionLeft: - x_offset += width(); - break; - case ILXQtPanel::PositionRight: - x_offset = -recalculateFrameWidth(); - break; - } - - QPoint pos = mapToGlobal(QPoint(x_offset, y_offset)); - mPopup->move(pos); - - return pos; -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::leaveEvent(QEvent *event) -{ - setPopupVisible(false); - QToolButton::leaveEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::enterEvent(QEvent *event) -{ - QToolButton::enterEvent(event); - - if (sDraggging) - return; - - if (parentTaskBar()->isShowGroupOnHover()) - setPopupVisible(true); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::dragEnterEvent(QDragEnterEvent *event) -{ - // only show the popup if we aren't dragging a taskgroup - if (!event->mimeData()->hasFormat(mimeDataFormat())) - { - setPopupVisible(true); - } - LXQtTaskButton::dragEnterEvent(event); -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::dragLeaveEvent(QDragLeaveEvent *event) -{ - // if draggind something into the taskgroup or the taskgroups' popup, - // do not close the popup - if (!sDraggging) - setPopupVisible(false); - LXQtTaskButton::dragLeaveEvent(event); -} - -void LXQtTaskGroup::mouseMoveEvent(QMouseEvent* event) -{ - // if dragging the taskgroup, do not show the popup - setPopupVisible(false, true); - LXQtTaskButton::mouseMoveEvent(event); -} - -/************************************************ - - ************************************************/ -bool LXQtTaskGroup::onWindowChanged(WId window, NET::Properties prop, NET::Properties2 prop2) -{ - bool consumed{false}; - bool needsRefreshVisibility{false}; - QVector buttons; - if (mButtonHash.contains(window)) - buttons.append(mButtonHash.value(window)); - - // If group is based on that window properties must be changed also on button group - if (window == windowId()) - buttons.append(this); - - if (!buttons.isEmpty()) - { - consumed = true; - // if class is changed the window won't belong to our group any more - if (parentTaskBar()->isGroupingEnabled() && prop2.testFlag(NET::WM2WindowClass)) - { - KWindowInfo info(window, 0, NET::WM2WindowClass); - if (info.windowClassClass() != mGroupName) - { - consumed = false; - onWindowRemoved(window); - } - } - // window changed virtual desktop - if (prop.testFlag(NET::WMDesktop) || prop.testFlag(NET::WMGeometry)) - { - if (parentTaskBar()->isShowOnlyOneDesktopTasks() - || parentTaskBar()->isShowOnlyCurrentScreenTasks()) - { - needsRefreshVisibility = true; - } - } - - if (prop.testFlag(NET::WMVisibleName) || prop.testFlag(NET::WMName)) - std::for_each(buttons.begin(), buttons.end(), std::mem_fn(&LXQtTaskButton::updateText)); - - // XXX: we are setting window icon geometry -> don't need to handle NET::WMIconGeometry - // Icon of the button can be based on windowClass - if (prop.testFlag(NET::WMIcon) || prop2.testFlag(NET::WM2WindowClass)) - std::for_each(buttons.begin(), buttons.end(), std::mem_fn(&LXQtTaskButton::updateIcon)); - - if (prop.testFlag(NET::WMState)) - { - KWindowInfo info{window, NET::WMState}; - if (info.hasState(NET::SkipTaskbar)) - { - consumed = false; - onWindowRemoved(window); - } - std::for_each(buttons.begin(), buttons.end(), std::bind(&LXQtTaskButton::setUrgencyHint, std::placeholders::_1, info.hasState(NET::DemandsAttention))); - - if (parentTaskBar()->isShowOnlyMinimizedTasks()) - { - needsRefreshVisibility = true; - } - } - } - - if (needsRefreshVisibility) - refreshVisibility(); - - return consumed; -} - -/************************************************ - - ************************************************/ -void LXQtTaskGroup::groupPopupShown(LXQtTaskGroup * const sender) -{ - //close all popups (should they be visible because of close delay) - if (this != sender && isVisible()) - setPopupVisible(false, true/*fast*/); -} diff --git a/plugin-taskbar/lxqttaskgroup.h b/plugin-taskbar/lxqttaskgroup.h deleted file mode 100644 index 2609a9e..0000000 --- a/plugin-taskbar/lxqttaskgroup.h +++ /dev/null @@ -1,120 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * http://lxqt.org - * - * Copyright: 2011 Razor team - * 2014 LXQt team - * Authors: - * Alexander Sokoloff - * Maciej Płaza - * Kuzma Shapran - * - * 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 LXQTTASKGROUP_H -#define LXQTTASKGROUP_H - -#include "../panel/ilxqtpanel.h" -#include "../panel/ilxqtpanelplugin.h" -#include "lxqttaskbar.h" -#include "lxqtgrouppopup.h" -#include "lxqttaskbutton.h" -#include - -class QVBoxLayout; -class ILXQtPanelPlugin; - -class LXQtGroupPopup; -class LXQtMasterPopup; - -class LXQtTaskGroup: public LXQtTaskButton -{ - Q_OBJECT - -public: - LXQtTaskGroup(const QString & groupName, WId window, LXQtTaskBar * parent); - - QString groupName() const { return mGroupName; } - - int buttonsCount() const; - int visibleButtonsCount() const; - - LXQtTaskButton * addWindow(WId id); - LXQtTaskButton * checkedButton() const; - - // Returns the next or the previous button in the popup - // if circular is true, then it will go around the list of buttons - LXQtTaskButton * getNextPrevChildButton(bool next, bool circular); - - bool onWindowChanged(WId window, NET::Properties prop, NET::Properties2 prop2); - void setAutoRotation(bool value, ILXQtPanel::Position position); - Qt::ToolButtonStyle popupButtonStyle() const; - void setToolButtonsStyle(Qt::ToolButtonStyle style); - - void setPopupVisible(bool visible = true, bool fast = false); - -public slots: - void onWindowRemoved(WId window); - -protected: - QMimeData * mimeData(); - - void leaveEvent(QEvent * event); - void enterEvent(QEvent * event); - void dragEnterEvent(QDragEnterEvent * event); - void dragLeaveEvent(QDragLeaveEvent * event); - void contextMenuEvent(QContextMenuEvent * event); - void mouseMoveEvent(QMouseEvent * event); - int recalculateFrameHeight() const; - int recalculateFrameWidth() const; - - void draggingTimerTimeout(); - -private slots: - void onClicked(bool checked); - void onChildButtonClicked(); - void onActiveWindowChanged(WId window); - void onDesktopChanged(int number); - - void closeGroup(); - void refreshIconsGeometry(); - void refreshVisibility(); - void groupPopupShown(LXQtTaskGroup* sender); - -signals: - void groupBecomeEmpty(QString name); - void visibilityChanged(bool visible); - void popupShown(LXQtTaskGroup* sender); - -private: - QString mGroupName; - LXQtGroupPopup * mPopup; - LXQtTaskButtonHash mButtonHash; - bool mPreventPopup; - bool mSingleButton; //!< flag if this group should act as a "standard" button (no groupping or only one "shown" window in group) - - QSize recalculateFrameSize(); - QPoint recalculateFramePosition(); - void recalculateFrameIfVisible(); - void regroup(); -}; - -#endif // LXQTTASKGROUP_H diff --git a/plugin-taskbar/resources/taskbar.desktop.in b/plugin-taskbar/resources/taskbar.desktop.in deleted file mode 100644 index e92b943..0000000 --- a/plugin-taskbar/resources/taskbar.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications -Icon=window-duplicate - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-taskbar/translations/taskbar_ar.desktop b/plugin-taskbar/translations/taskbar_ar.desktop deleted file mode 100644 index 6b7def7..0000000 --- a/plugin-taskbar/translations/taskbar_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[ar]=بدّل بين التّطبيقات العاملة -Name[ar]=مدير المهامّ diff --git a/plugin-taskbar/translations/taskbar_cs.desktop b/plugin-taskbar/translations/taskbar_cs.desktop deleted file mode 100644 index bc5a0d5..0000000 --- a/plugin-taskbar/translations/taskbar_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Přepínání mezi běžícími programy -Name[cs]=Správce úkolů diff --git a/plugin-taskbar/translations/taskbar_cs_CZ.desktop b/plugin-taskbar/translations/taskbar_cs_CZ.desktop deleted file mode 100644 index cf22953..0000000 --- a/plugin-taskbar/translations/taskbar_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Přepínat mezi běžícími programy -Name[cs_CZ]=Správce úkolů diff --git a/plugin-taskbar/translations/taskbar_da.desktop b/plugin-taskbar/translations/taskbar_da.desktop deleted file mode 100644 index 9139a8a..0000000 --- a/plugin-taskbar/translations/taskbar_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications -Icon=window-duplicate - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Opgavehåndtering -Comment[da]=Skift mellem kørende programmer diff --git a/plugin-taskbar/translations/taskbar_de.desktop b/plugin-taskbar/translations/taskbar_de.desktop deleted file mode 100644 index f57f1a2..0000000 --- a/plugin-taskbar/translations/taskbar_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Anwendungsverwalter -Comment[de]=Wechsel zwischen laufenden Anwendungen diff --git a/plugin-taskbar/translations/taskbar_el.desktop b/plugin-taskbar/translations/taskbar_el.desktop deleted file mode 100644 index 30b8fbe..0000000 --- a/plugin-taskbar/translations/taskbar_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Διαχειριστής εργασιών -Comment[el]=Εναλλαγή μεταξύ των εκτελούμενων εφαρμογών diff --git a/plugin-taskbar/translations/taskbar_eo.desktop b/plugin-taskbar/translations/taskbar_eo.desktop deleted file mode 100644 index 665cfb0..0000000 --- a/plugin-taskbar/translations/taskbar_eo.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eo]=Ŝalti inter rulantaj aplikaĵoj -Name[eo]=Taskmastrumilo diff --git a/plugin-taskbar/translations/taskbar_es.desktop b/plugin-taskbar/translations/taskbar_es.desktop deleted file mode 100644 index 09a836c..0000000 --- a/plugin-taskbar/translations/taskbar_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Cambia entre aplicaciones activas -Name[es]=Administrador de tareas diff --git a/plugin-taskbar/translations/taskbar_es_VE.desktop b/plugin-taskbar/translations/taskbar_es_VE.desktop deleted file mode 100644 index 02400a0..0000000 --- a/plugin-taskbar/translations/taskbar_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Cambia entre aplicaciones o programas abiertos -Name[es_VE]=Manejador de ventanas diff --git a/plugin-taskbar/translations/taskbar_eu.desktop b/plugin-taskbar/translations/taskbar_eu.desktop deleted file mode 100644 index 5658f4e..0000000 --- a/plugin-taskbar/translations/taskbar_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Aldatu martxan dauden aplikazioen artean -Name[eu]=Ataza-kudeatzailea diff --git a/plugin-taskbar/translations/taskbar_fi.desktop b/plugin-taskbar/translations/taskbar_fi.desktop deleted file mode 100644 index be621c2..0000000 --- a/plugin-taskbar/translations/taskbar_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Vaihda käynnissä olevien sovellusten välillä -Name[fi]=Tehtävähallinta diff --git a/plugin-taskbar/translations/taskbar_fr.desktop b/plugin-taskbar/translations/taskbar_fr.desktop deleted file mode 100644 index 73527ee..0000000 --- a/plugin-taskbar/translations/taskbar_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Comment[fr]=Basculer entre des applications actives -Name[fr]=Gestionnaire des tâches diff --git a/plugin-taskbar/translations/taskbar_hu.desktop b/plugin-taskbar/translations/taskbar_hu.desktop deleted file mode 100644 index 05bc3d6..0000000 --- a/plugin-taskbar/translations/taskbar_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=Váltás a futó alkalmazások között -Name[hu]=Feladatkezelő diff --git a/plugin-taskbar/translations/taskbar_ia.desktop b/plugin-taskbar/translations/taskbar_ia.desktop deleted file mode 100644 index 1f7891d..0000000 --- a/plugin-taskbar/translations/taskbar_ia.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task Manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-taskbar/translations/taskbar_id_ID.desktop b/plugin-taskbar/translations/taskbar_id_ID.desktop deleted file mode 100644 index 1f7891d..0000000 --- a/plugin-taskbar/translations/taskbar_id_ID.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task Manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-taskbar/translations/taskbar_it.desktop b/plugin-taskbar/translations/taskbar_it.desktop deleted file mode 100644 index 03f6a44..0000000 --- a/plugin-taskbar/translations/taskbar_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Barra delle applicazioni -Comment[it]=Permette di spostarsi tra le applicazioni in esecuzione tramite pulsanti diff --git a/plugin-taskbar/translations/taskbar_ja.desktop b/plugin-taskbar/translations/taskbar_ja.desktop deleted file mode 100644 index 4b0ebaa..0000000 --- a/plugin-taskbar/translations/taskbar_ja.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ja]=実行中のアプリケーションを切り替えます -Name[ja]=タスク管理 diff --git a/plugin-taskbar/translations/taskbar_ko.desktop b/plugin-taskbar/translations/taskbar_ko.desktop deleted file mode 100644 index 1f7891d..0000000 --- a/plugin-taskbar/translations/taskbar_ko.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task Manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-taskbar/translations/taskbar_lt.desktop b/plugin-taskbar/translations/taskbar_lt.desktop deleted file mode 100644 index 5763167..0000000 --- a/plugin-taskbar/translations/taskbar_lt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[lt]=Perjungti tarp paleistų programų -Name[lt]=Užduočių tvarkytuvė diff --git a/plugin-taskbar/translations/taskbar_nl.desktop b/plugin-taskbar/translations/taskbar_nl.desktop deleted file mode 100644 index 618d01a..0000000 --- a/plugin-taskbar/translations/taskbar_nl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[nl]=Wissel tussen draaiende applicaties -Name[nl]=taak-manager diff --git a/plugin-taskbar/translations/taskbar_pl.desktop b/plugin-taskbar/translations/taskbar_pl.desktop deleted file mode 100644 index 2b17ade..0000000 --- a/plugin-taskbar/translations/taskbar_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Przełączaj pomiędzy otwartymi aplikacjami -Name[pl]=Pasek zadań diff --git a/plugin-taskbar/translations/taskbar_pt.desktop b/plugin-taskbar/translations/taskbar_pt.desktop deleted file mode 100644 index 7d03bf2..0000000 --- a/plugin-taskbar/translations/taskbar_pt.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[pt]=Gestor de tarefas -Comment[pt]=Permite trocar entre as aplicações em execução diff --git a/plugin-taskbar/translations/taskbar_pt_BR.desktop b/plugin-taskbar/translations/taskbar_pt_BR.desktop deleted file mode 100644 index e971bbe..0000000 --- a/plugin-taskbar/translations/taskbar_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Alterne entre aplicativos em execução -Name[pt_BR]=Gerenciador de tarefas diff --git a/plugin-taskbar/translations/taskbar_ro_RO.desktop b/plugin-taskbar/translations/taskbar_ro_RO.desktop deleted file mode 100644 index 9daf041..0000000 --- a/plugin-taskbar/translations/taskbar_ro_RO.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Comută între aplcațiile active diff --git a/plugin-taskbar/translations/taskbar_ru.desktop b/plugin-taskbar/translations/taskbar_ru.desktop deleted file mode 100644 index 06b02d5..0000000 --- a/plugin-taskbar/translations/taskbar_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru]=Переключиться между запущенными приложениями -Name[ru]=Панель задач \ No newline at end of file diff --git a/plugin-taskbar/translations/taskbar_sk.desktop b/plugin-taskbar/translations/taskbar_sk.desktop deleted file mode 100644 index e300777..0000000 --- a/plugin-taskbar/translations/taskbar_sk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sk]=Prepínanie medzi bežiacimi aplikáciami -Name[sk]=Správca úloh diff --git a/plugin-taskbar/translations/taskbar_sl.desktop b/plugin-taskbar/translations/taskbar_sl.desktop deleted file mode 100644 index ddd4b89..0000000 --- a/plugin-taskbar/translations/taskbar_sl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sl]=Preklapljajte med zagnanimi programi -Name[sl]=Upravljalnik opravil diff --git a/plugin-taskbar/translations/taskbar_sr.desktop b/plugin-taskbar/translations/taskbar_sr.desktop deleted file mode 100644 index 08469d4..0000000 --- a/plugin-taskbar/translations/taskbar_sr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr]=Пребацујте између програма у раду -Name[sr]=Менаџер задатака diff --git a/plugin-taskbar/translations/taskbar_sr@ijekavian.desktop b/plugin-taskbar/translations/taskbar_sr@ijekavian.desktop deleted file mode 100644 index f350dc6..0000000 --- a/plugin-taskbar/translations/taskbar_sr@ijekavian.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavian]=Менаџер задатака -Comment[sr@ijekavian]=Пребацујте између програма у раду diff --git a/plugin-taskbar/translations/taskbar_sr@ijekavianlatin.desktop b/plugin-taskbar/translations/taskbar_sr@ijekavianlatin.desktop deleted file mode 100644 index 0f165ed..0000000 --- a/plugin-taskbar/translations/taskbar_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavianlatin]=Menadžer zadataka -Comment[sr@ijekavianlatin]=Prebacujte između programa u radu diff --git a/plugin-taskbar/translations/taskbar_sr@latin.desktop b/plugin-taskbar/translations/taskbar_sr@latin.desktop deleted file mode 100644 index 894942d..0000000 --- a/plugin-taskbar/translations/taskbar_sr@latin.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr@latin]=Prebacujte između programa u radu -Name[sr@latin]=Menadžer zadataka diff --git a/plugin-taskbar/translations/taskbar_th_TH.desktop b/plugin-taskbar/translations/taskbar_th_TH.desktop deleted file mode 100644 index 1911a89..0000000 --- a/plugin-taskbar/translations/taskbar_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=สลับใช้งานระหว่างโปรแกรมที่เปิดอยู่ -Name[th_TH]=ตัวจัดการงาน diff --git a/plugin-taskbar/translations/taskbar_tr.desktop b/plugin-taskbar/translations/taskbar_tr.desktop deleted file mode 100644 index d76a76f..0000000 --- a/plugin-taskbar/translations/taskbar_tr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[tr]=Çalışan uygulamalar arasında geçiş yapın -Name[tr]=Görev Yöneticisi diff --git a/plugin-taskbar/translations/taskbar_uk.desktop b/plugin-taskbar/translations/taskbar_uk.desktop deleted file mode 100644 index a51ec79..0000000 --- a/plugin-taskbar/translations/taskbar_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Перемкнутися між запущеними вікнами -Name[uk]=Менеджер завдань diff --git a/plugin-taskbar/translations/taskbar_zh_CN.GB2312.desktop b/plugin-taskbar/translations/taskbar_zh_CN.GB2312.desktop deleted file mode 100644 index 1f7891d..0000000 --- a/plugin-taskbar/translations/taskbar_zh_CN.GB2312.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task Manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-taskbar/translations/taskbar_zh_CN.desktop b/plugin-taskbar/translations/taskbar_zh_CN.desktop deleted file mode 100644 index 37f910d..0000000 --- a/plugin-taskbar/translations/taskbar_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=在运行的程序间切换 -Name[zh_CN]=任务管理器 diff --git a/plugin-taskbar/translations/taskbar_zh_TW.desktop b/plugin-taskbar/translations/taskbar_zh_TW.desktop deleted file mode 100644 index 3519097..0000000 --- a/plugin-taskbar/translations/taskbar_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Task manager -Comment=Switch between running applications - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=在正在運行程式中切換 -Name[zh_TW]=工作管理員 diff --git a/plugin-tray/CMakeLists.txt b/plugin-tray/CMakeLists.txt deleted file mode 100644 index f914f01..0000000 --- a/plugin-tray/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -set(PLUGIN "tray") - -include(CheckLibraryExists) - -find_package(XCB REQUIRED COMPONENTS xcb xcb-util xcb-damage) -find_package(PkgConfig) - -find_package(X11 REQUIRED) -pkg_check_modules(XCOMPOSITE REQUIRED xcomposite) -pkg_check_modules(XDAMAGE REQUIRED xdamage) -pkg_check_modules(XRENDER REQUIRED xrender) - -set(HEADERS - lxqttrayplugin.h - lxqttray.h - trayicon.h - xfitman.h -) - -set(SOURCES - lxqttrayplugin.cpp - lxqttray.cpp - trayicon.cpp - xfitman.cpp -) - -set(LIBRARIES - ${X11_LIBRARIES} - ${XCOMPOSITE_LIBRARIES} - ${XDAMAGE_LIBRARIES} - ${XRENDER_LIBRARIES} - ${XCB_LIBRARIES} -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-tray/lxqttray.cpp b/plugin-tray/lxqttray.cpp deleted file mode 100644 index 0ba385a..0000000 --- a/plugin-tray/lxqttray.cpp +++ /dev/null @@ -1,400 +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: - * Alexander Sokoloff - * - * 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 */ - -/******************************************************************** - Inspired by freedesktops tint2 ;) - -*********************************************************************/ - -#include -#include -#include -#include -#include "trayicon.h" -#include "../panel/ilxqtpanel.h" -#include -#include "lxqttray.h" -#include "xfitman.h" - -#include -#include -#include -#include -#include -#include -#include - -#undef Bool // defined as int in X11/Xlib.h - -#include "../panel/ilxqtpanelplugin.h" - -#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0 -#define _NET_SYSTEM_TRAY_ORIENTATION_VERT 1 - -#define SYSTEM_TRAY_REQUEST_DOCK 0 -#define SYSTEM_TRAY_BEGIN_MESSAGE 1 -#define SYSTEM_TRAY_CANCEL_MESSAGE 2 - -#define XEMBED_EMBEDDED_NOTIFY 0 -#define XEMBED_MAPPED (1 << 0) - - -/************************************************ - - ************************************************/ -LXQtTray::LXQtTray(ILXQtPanelPlugin *plugin, QWidget *parent): - QFrame(parent), - mValid(false), - mTrayId(0), - mDamageEvent(0), - mDamageError(0), - mIconSize(TRAY_ICON_SIZE_DEFAULT, TRAY_ICON_SIZE_DEFAULT), - mPlugin(plugin), - mDisplay(QX11Info::display()) -{ - mLayout = new LXQt::GridLayout(this); - realign(); - _NET_SYSTEM_TRAY_OPCODE = XfitMan::atom("_NET_SYSTEM_TRAY_OPCODE"); - // Init the selection later just to ensure that no signals are sent until - // after construction is done and the creating object has a chance to connect. - QTimer::singleShot(0, this, SLOT(startTray())); -} - - -/************************************************ - - ************************************************/ -LXQtTray::~LXQtTray() -{ - stopTray(); -} - - -/************************************************ - - ************************************************/ -bool LXQtTray::nativeEventFilter(const QByteArray &eventType, void *message, long *) -{ - if (eventType != "xcb_generic_event_t") - return false; - - xcb_generic_event_t* event = static_cast(message); - - TrayIcon* icon; - int event_type = event->response_type & ~0x80; - - switch (event_type) - { - case ClientMessage: - clientMessageEvent(event); - break; - -// case ConfigureNotify: -// icon = findIcon(event->xconfigure.window); -// if (icon) -// icon->configureEvent(&(event->xconfigure)); -// break; - - case DestroyNotify: { - unsigned long event_window; - event_window = reinterpret_cast(event)->window; - icon = findIcon(event_window); - if (icon) - { - icon->windowDestroyed(event_window); - mIcons.removeAll(icon); - delete icon; - } - break; - } - default: - if (event_type == mDamageEvent + XDamageNotify) - { - xcb_damage_notify_event_t* dmg = reinterpret_cast(event); - icon = findIcon(dmg->drawable); - if (icon) - icon->update(); - } - break; - } - - return false; -} - - -/************************************************ - - ************************************************/ -void LXQtTray::realign() -{ - mLayout->setEnabled(false); - ILXQtPanel *panel = mPlugin->panel(); - - if (panel->isHorizontal()) - { - mLayout->setRowCount(panel->lineCount()); - mLayout->setColumnCount(0); - } - else - { - mLayout->setColumnCount(panel->lineCount()); - mLayout->setRowCount(0); - } - mLayout->setEnabled(true); -} - - -/************************************************ - - ************************************************/ -void LXQtTray::clientMessageEvent(xcb_generic_event_t *e) -{ - unsigned long opcode; - unsigned long message_type; - Window id; - xcb_client_message_event_t* event = reinterpret_cast(e); - uint32_t* data32 = event->data.data32; - message_type = event->type; - opcode = data32[1]; - if(message_type != _NET_SYSTEM_TRAY_OPCODE) - return; - - switch (opcode) - { - case SYSTEM_TRAY_REQUEST_DOCK: - id = data32[2]; - if (id) - addIcon(id); - break; - - - case SYSTEM_TRAY_BEGIN_MESSAGE: - case SYSTEM_TRAY_CANCEL_MESSAGE: - qDebug() << "we don't show balloon messages."; - break; - - - default: -// if (opcode == xfitMan().atom("_NET_SYSTEM_TRAY_MESSAGE_DATA")) -// qDebug() << "message from dockapp:" << e->data.b; -// else -// qDebug() << "SYSTEM_TRAY : unknown message type" << opcode; - break; - } -} - -/************************************************ - - ************************************************/ -TrayIcon* LXQtTray::findIcon(Window id) -{ - foreach(TrayIcon* icon, mIcons) - { - if (icon->iconId() == id || icon->windowId() == id) - return icon; - } - return 0; -} - - -/************************************************ - -************************************************/ -void LXQtTray::setIconSize(QSize iconSize) -{ - mIconSize = iconSize; - unsigned long size = qMin(mIconSize.width(), mIconSize.height()); - XChangeProperty(mDisplay, - mTrayId, - XfitMan::atom("_NET_SYSTEM_TRAY_ICON_SIZE"), - XA_CARDINAL, - 32, - PropModeReplace, - (unsigned char*)&size, - 1); -} - - -/************************************************ - -************************************************/ -VisualID LXQtTray::getVisual() -{ - VisualID visualId = 0; - Display* dsp = mDisplay; - - XVisualInfo templ; - templ.screen=QX11Info::appScreen(); - templ.depth=32; - templ.c_class=TrueColor; - - int nvi; - XVisualInfo* xvi = XGetVisualInfo(dsp, VisualScreenMask|VisualDepthMask|VisualClassMask, &templ, &nvi); - - if (xvi) - { - int i; - XRenderPictFormat* format; - for (i = 0; i < nvi; i++) - { - format = XRenderFindVisualFormat(dsp, xvi[i].visual); - if (format && - format->type == PictTypeDirect && - format->direct.alphaMask) - { - visualId = xvi[i].visualid; - break; - } - } - XFree(xvi); - } - - return visualId; -} - - -/************************************************ - freedesktop systray specification - ************************************************/ -void LXQtTray::startTray() -{ - Display* dsp = mDisplay; - Window root = QX11Info::appRootWindow(); - - QString s = QString("_NET_SYSTEM_TRAY_S%1").arg(DefaultScreen(dsp)); - Atom _NET_SYSTEM_TRAY_S = XfitMan::atom(s.toLatin1()); - - if (XGetSelectionOwner(dsp, _NET_SYSTEM_TRAY_S) != None) - { - qWarning() << "Another systray is running"; - mValid = false; - return; - } - - // init systray protocol - mTrayId = XCreateSimpleWindow(dsp, root, -1, -1, 1, 1, 0, 0, 0); - - XSetSelectionOwner(dsp, _NET_SYSTEM_TRAY_S, mTrayId, CurrentTime); - if (XGetSelectionOwner(dsp, _NET_SYSTEM_TRAY_S) != mTrayId) - { - qWarning() << "Can't get systray manager"; - stopTray(); - mValid = false; - return; - } - - int orientation = _NET_SYSTEM_TRAY_ORIENTATION_HORZ; - XChangeProperty(dsp, - mTrayId, - XfitMan::atom("_NET_SYSTEM_TRAY_ORIENTATION"), - XA_CARDINAL, - 32, - PropModeReplace, - (unsigned char *) &orientation, - 1); - - // ** Visual ******************************** - VisualID visualId = getVisual(); - if (visualId) - { - XChangeProperty(mDisplay, - mTrayId, - XfitMan::atom("_NET_SYSTEM_TRAY_VISUAL"), - XA_VISUALID, - 32, - PropModeReplace, - (unsigned char*)&visualId, - 1); - } - // ****************************************** - - setIconSize(mIconSize); - - XClientMessageEvent ev; - ev.type = ClientMessage; - ev.window = root; - ev.message_type = XfitMan::atom("MANAGER"); - ev.format = 32; - ev.data.l[0] = CurrentTime; - ev.data.l[1] = _NET_SYSTEM_TRAY_S; - ev.data.l[2] = mTrayId; - ev.data.l[3] = 0; - ev.data.l[4] = 0; - XSendEvent(dsp, root, False, StructureNotifyMask, (XEvent*)&ev); - - XDamageQueryExtension(mDisplay, &mDamageEvent, &mDamageError); - - qDebug() << "Systray started"; - mValid = true; - - qApp->installNativeEventFilter(this); -} - - -/************************************************ - - ************************************************/ -void LXQtTray::stopTray() -{ - for (auto & icon : mIcons) - disconnect(icon, &QObject::destroyed, this, &LXQtTray::onIconDestroyed); - qDeleteAll(mIcons); - if (mTrayId) - { - XDestroyWindow(mDisplay, mTrayId); - mTrayId = 0; - } - mValid = false; -} - - -/************************************************ - - ************************************************/ -void LXQtTray::onIconDestroyed(QObject * icon) -{ - //in the time QOjbect::destroyed is emitted, the child destructor - //is already finished, so the qobject_cast to child will return nullptr in all cases - mIcons.removeAll(static_cast(icon)); -} - -/************************************************ - - ************************************************/ -void LXQtTray::addIcon(Window winId) -{ - // decline to add an icon for a window we already manage - TrayIcon *icon = findIcon(winId); - if(icon) - return; - - icon = new TrayIcon(winId, mIconSize, this); - mIcons.append(icon); - mLayout->addWidget(icon); - connect(icon, &QObject::destroyed, this, &LXQtTray::onIconDestroyed); -} - diff --git a/plugin-tray/lxqttray.h b/plugin-tray/lxqttray.h deleted file mode 100644 index 9bb5714..0000000 --- a/plugin-tray/lxqttray.h +++ /dev/null @@ -1,103 +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: - * Alexander Sokoloff - * - * 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 LXQTTRAY_H -#define LXQTTRAY_H - -#include -#include -#include "../panel/ilxqtpanel.h" -#include -#include -#include -#include "fixx11h.h" - -class TrayIcon; -class QSize; - -namespace LXQt { -class GridLayout; -} - -/** - * @brief This makes our trayplugin - */ -class ILXQtPanelPlugin; - -class LXQtTray: public QFrame, QAbstractNativeEventFilter -{ - Q_OBJECT - Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) -public: - LXQtTray(ILXQtPanelPlugin *plugin, QWidget* parent = 0); - ~LXQtTray(); - - - QSize iconSize() const { return mIconSize; } - void setIconSize(QSize iconSize); - - bool nativeEventFilter(const QByteArray &eventType, void *message, long *); - - void realign(); - -signals: - void iconSizeChanged(int iconSize); - -private slots: - void startTray(); - void stopTray(); - void onIconDestroyed(QObject * icon); - -private: - VisualID getVisual(); - - void clientMessageEvent(xcb_generic_event_t *e); - - int clientMessage(WId _wid, Atom _msg, - long unsigned int data0, - long unsigned int data1 = 0, - long unsigned int data2 = 0, - long unsigned int data3 = 0, - long unsigned int data4 = 0) const; - - void addIcon(Window id); - TrayIcon* findIcon(Window trayId); - - bool mValid; - Window mTrayId; - QList mIcons; - int mDamageEvent; - int mDamageError; - QSize mIconSize; - LXQt::GridLayout *mLayout; - ILXQtPanelPlugin *mPlugin; - Atom _NET_SYSTEM_TRAY_OPCODE; - Display* mDisplay; -}; - - -#endif diff --git a/plugin-tray/lxqttrayplugin.cpp b/plugin-tray/lxqttrayplugin.cpp deleted file mode 100644 index b5db900..0000000 --- a/plugin-tray/lxqttrayplugin.cpp +++ /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: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqttrayplugin.h" -#include "lxqttray.h" - -LXQtTrayPlugin::LXQtTrayPlugin(const ILXQtPanelPluginStartupInfo &startupInfo) : - QObject(), - ILXQtPanelPlugin(startupInfo), - mWidget(new LXQtTray(this)) -{ -} - -LXQtTrayPlugin::~LXQtTrayPlugin() -{ - delete mWidget; -} - -QWidget *LXQtTrayPlugin::widget() -{ - return mWidget; -} - -void LXQtTrayPlugin::realign() -{ - mWidget->realign(); -} - - diff --git a/plugin-tray/lxqttrayplugin.h b/plugin-tray/lxqttrayplugin.h deleted file mode 100644 index 19a5008..0000000 --- a/plugin-tray/lxqttrayplugin.h +++ /dev/null @@ -1,74 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTTRAYPLUGIN_H -#define LXQTTRAYPLUGIN_H - -#include "../panel/ilxqtpanelplugin.h" -#include -#include -#include - -class LXQtTray; -class LXQtTrayPlugin : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - explicit LXQtTrayPlugin(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtTrayPlugin(); - - virtual QWidget *widget(); - virtual QString themeId() const { return "Tray"; } - virtual Flags flags() const { return PreferRightAlignment | SingleInstance | NeedsHandle; } - void realign(); - - bool isSeparate() const { return true; } - -private: - LXQtTray *mWidget; - -}; - -class LXQtTrayPluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - // Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - // Currently only X11 supported - if (!QX11Info::connection()) { - qWarning() << "Currently tray plugin supports X11 only. Skipping."; - return nullptr; - } - return new LXQtTrayPlugin(startupInfo); - } -}; - -#endif // LXQTTRAYPLUGIN_H diff --git a/plugin-tray/resources/tray.desktop.in b/plugin-tray/resources/tray.desktop.in deleted file mode 100644 index 401b5a8..0000000 --- a/plugin-tray/resources/tray.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. -Icon=go-bottom - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-tray/translations/tray_ar.desktop b/plugin-tray/translations/tray_ar.desktop deleted file mode 100644 index 019c965..0000000 --- a/plugin-tray/translations/tray_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[ar]=تعرض التّطبيقات مصغّرة إلى صينيّة النّظام. -Name[ar]=صينيّة النّظام diff --git a/plugin-tray/translations/tray_cs.desktop b/plugin-tray/translations/tray_cs.desktop deleted file mode 100644 index 4f3ae31..0000000 --- a/plugin-tray/translations/tray_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Přístup ke skrytým programům zmenšeným v oznamovací oblasti panelu -Name[cs]=Oznamovací oblast panelu diff --git a/plugin-tray/translations/tray_cs_CZ.desktop b/plugin-tray/translations/tray_cs_CZ.desktop deleted file mode 100644 index c7c8b61..0000000 --- a/plugin-tray/translations/tray_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Přistoupit k programům zmenšeným v oznamovací oblasti panelu -Name[cs_CZ]=Oznamovací oblast diff --git a/plugin-tray/translations/tray_da.desktop b/plugin-tray/translations/tray_da.desktop deleted file mode 100644 index 9716828..0000000 --- a/plugin-tray/translations/tray_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. -Icon=go-bottom - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Systembakke -Comment[da]=Vis programmer minimeret til systembakken. diff --git a/plugin-tray/translations/tray_de.desktop b/plugin-tray/translations/tray_de.desktop deleted file mode 100644 index 30e2af1..0000000 --- a/plugin-tray/translations/tray_de.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Name[de]=Benachrichtigungsfläche -Comment[de]=Benachrichtigungen von Anwendungen gem. System Tray Protocol diff --git a/plugin-tray/translations/tray_el.desktop b/plugin-tray/translations/tray_el.desktop deleted file mode 100644 index c2ed175..0000000 --- a/plugin-tray/translations/tray_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Πλαίσιο συστήματος -Comment[el]=Προβολή των ελαχιστοποιημένων εφαρμογών στο πλαίσιο συστήματος. diff --git a/plugin-tray/translations/tray_eo.desktop b/plugin-tray/translations/tray_eo.desktop deleted file mode 100644 index 2b2b0ea..0000000 --- a/plugin-tray/translations/tray_eo.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eo]=Akiri kaŝitajn aplikaĵojn malmaksimigitajn en la sistempleto -Name[eo]=Sistempleto diff --git a/plugin-tray/translations/tray_es.desktop b/plugin-tray/translations/tray_es.desktop deleted file mode 100644 index 6ba9605..0000000 --- a/plugin-tray/translations/tray_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Accede a aplicaciones ocultas minimizadas en la bandeja del sistema -Name[es]=Bandeja del sistema diff --git a/plugin-tray/translations/tray_es_VE.desktop b/plugin-tray/translations/tray_es_VE.desktop deleted file mode 100644 index 95e4bc5..0000000 --- a/plugin-tray/translations/tray_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Acceder aplicaciones minimizadas en la barra de iconos de sistema -Name[es_VE]=Barra de sistema diff --git a/plugin-tray/translations/tray_eu.desktop b/plugin-tray/translations/tray_eu.desktop deleted file mode 100644 index fb1664b..0000000 --- a/plugin-tray/translations/tray_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Bistaratu aplikazioak minimizatuta ataza-barran. -Name[eu]=Ataza-barra diff --git a/plugin-tray/translations/tray_fi.desktop b/plugin-tray/translations/tray_fi.desktop deleted file mode 100644 index 7f238fb..0000000 --- a/plugin-tray/translations/tray_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Käytä ilmoitusalueelle pienennettyjä sovelluksia -Name[fi]=Ilmoitusalue diff --git a/plugin-tray/translations/tray_fr.desktop b/plugin-tray/translations/tray_fr.desktop deleted file mode 100644 index dfb642c..0000000 --- a/plugin-tray/translations/tray_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -# Translations -Comment[fr]=Accéder aux applications cachées minimisées dans la zone de notification -Name[fr]=Zone de notification diff --git a/plugin-tray/translations/tray_hu.desktop b/plugin-tray/translations/tray_hu.desktop deleted file mode 100644 index cc16964..0000000 --- a/plugin-tray/translations/tray_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=A paneltálcára minimalizált, rejtett alkalmazások elérése -Name[hu]=Paneltálca diff --git a/plugin-tray/translations/tray_ia.desktop b/plugin-tray/translations/tray_ia.desktop deleted file mode 100644 index 1a2aaea..0000000 --- a/plugin-tray/translations/tray_ia.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Access hidden applications minimized in the system tray - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-tray/translations/tray_id_ID.desktop b/plugin-tray/translations/tray_id_ID.desktop deleted file mode 100644 index 1a2aaea..0000000 --- a/plugin-tray/translations/tray_id_ID.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Access hidden applications minimized in the system tray - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-tray/translations/tray_it.desktop b/plugin-tray/translations/tray_it.desktop deleted file mode 100644 index db0a4a2..0000000 --- a/plugin-tray/translations/tray_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Comment[it]=Accedi alle applicazioni minimizzate nel vassoio di sistema -Name[it]=Vassoio di sistema diff --git a/plugin-tray/translations/tray_ja.desktop b/plugin-tray/translations/tray_ja.desktop deleted file mode 100644 index 387c065..0000000 --- a/plugin-tray/translations/tray_ja.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ja]=システムトレイに最小化されたアプリケーションを表示します -Name[ja]=システムトレイ diff --git a/plugin-tray/translations/tray_ko.desktop b/plugin-tray/translations/tray_ko.desktop deleted file mode 100644 index 1a2aaea..0000000 --- a/plugin-tray/translations/tray_ko.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Access hidden applications minimized in the system tray - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-tray/translations/tray_lt.desktop b/plugin-tray/translations/tray_lt.desktop deleted file mode 100644 index de769e0..0000000 --- a/plugin-tray/translations/tray_lt.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[lt]=Rodyti į sistemos dėklą suskleistas programas -Name[lt]=Sistemos dėklas diff --git a/plugin-tray/translations/tray_nl.desktop b/plugin-tray/translations/tray_nl.desktop deleted file mode 100644 index 993290a..0000000 --- a/plugin-tray/translations/tray_nl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[nl]=Verborgen pictogrammen tonen -Name[nl]=Systeem vak diff --git a/plugin-tray/translations/tray_pl.desktop b/plugin-tray/translations/tray_pl.desktop deleted file mode 100644 index 34e9800..0000000 --- a/plugin-tray/translations/tray_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Wyświetla aplikacje zminimalizowane do paska zadań -Name[pl]=Zasobnik systemowy diff --git a/plugin-tray/translations/tray_pt.desktop b/plugin-tray/translations/tray_pt.desktop deleted file mode 100644 index 99ad566..0000000 --- a/plugin-tray/translations/tray_pt.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[pt]=Bandeja do sistema -Comment[pt]=Aceder às aplicações minimizadas na bandeja do sistema diff --git a/plugin-tray/translations/tray_pt_BR.desktop b/plugin-tray/translations/tray_pt_BR.desktop deleted file mode 100644 index fbd54ea..0000000 --- a/plugin-tray/translations/tray_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Acesse aplicativos ocultos minimizados na área de notificação -Name[pt_BR]=Área de notificação diff --git a/plugin-tray/translations/tray_ro_RO.desktop b/plugin-tray/translations/tray_ro_RO.desktop deleted file mode 100644 index 86753e8..0000000 --- a/plugin-tray/translations/tray_ro_RO.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Acceasți aplicații ascunse minimizate în tava sistem -Name[ro_RO]=Zonă de notificare diff --git a/plugin-tray/translations/tray_ru.desktop b/plugin-tray/translations/tray_ru.desktop deleted file mode 100644 index b36a362..0000000 --- a/plugin-tray/translations/tray_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru]=Значки программ, свернутых в системный лоток. -Name[ru]=Системный лоток \ No newline at end of file diff --git a/plugin-tray/translations/tray_sk.desktop b/plugin-tray/translations/tray_sk.desktop deleted file mode 100644 index 8819839..0000000 --- a/plugin-tray/translations/tray_sk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sk]=Prístup k skrytým aplikáciám minimalizovaným v oznamovacej oblasti -Name[sk]=Oznamovacia oblasť diff --git a/plugin-tray/translations/tray_sl.desktop b/plugin-tray/translations/tray_sl.desktop deleted file mode 100644 index 0d7b31f..0000000 --- a/plugin-tray/translations/tray_sl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sl]=Dostopajte do programov pomanjšanih v sistemsko vrstico -Name[sl]=Sistemska vrstica diff --git a/plugin-tray/translations/tray_sr.desktop b/plugin-tray/translations/tray_sr.desktop deleted file mode 100644 index bcb5095..0000000 --- a/plugin-tray/translations/tray_sr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr]=Приступ скривеним програмима минимизованим у системску касету -Name[sr]=Системска касета diff --git a/plugin-tray/translations/tray_sr@ijekavian.desktop b/plugin-tray/translations/tray_sr@ijekavian.desktop deleted file mode 100644 index 1dc3a5c..0000000 --- a/plugin-tray/translations/tray_sr@ijekavian.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavian]=Системска касета -Comment[sr@ijekavian]=Приступ скривеним програмима минимизованим у системску касету diff --git a/plugin-tray/translations/tray_sr@ijekavianlatin.desktop b/plugin-tray/translations/tray_sr@ijekavianlatin.desktop deleted file mode 100644 index cad4967..0000000 --- a/plugin-tray/translations/tray_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[sr@ijekavianlatin]=Sistemska kaseta -Comment[sr@ijekavianlatin]=Pristup skrivenim programima minimizovanim u sistemsku kasetu diff --git a/plugin-tray/translations/tray_sr@latin.desktop b/plugin-tray/translations/tray_sr@latin.desktop deleted file mode 100644 index a9c6625..0000000 --- a/plugin-tray/translations/tray_sr@latin.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[sr@latin]=Pristup skrivenim programima minimizovanim u sistemsku kasetu -Name[sr@latin]=Sistemska kaseta diff --git a/plugin-tray/translations/tray_th_TH.desktop b/plugin-tray/translations/tray_th_TH.desktop deleted file mode 100644 index 339cbab..0000000 --- a/plugin-tray/translations/tray_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=เข้าใช้งานโปรแกรมที่ย่อเก็บอยู่ในถาดระบบ -Name[th_TH]=ถาดระบบ diff --git a/plugin-tray/translations/tray_tr.desktop b/plugin-tray/translations/tray_tr.desktop deleted file mode 100644 index c90b886..0000000 --- a/plugin-tray/translations/tray_tr.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[tr]=Sistem çekmecesinde gizli uygulamalara erişin -Name[tr]=Sistem çekmecesi diff --git a/plugin-tray/translations/tray_uk.desktop b/plugin-tray/translations/tray_uk.desktop deleted file mode 100644 index bc0ad88..0000000 --- a/plugin-tray/translations/tray_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Показує програми, згорнуті до системного лотка. -Name[uk]=Системний лоток diff --git a/plugin-tray/translations/tray_zh_CN.GB2312.desktop b/plugin-tray/translations/tray_zh_CN.GB2312.desktop deleted file mode 100644 index 1a2aaea..0000000 --- a/plugin-tray/translations/tray_zh_CN.GB2312.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Access hidden applications minimized in the system tray - -#TRANSLATIONS_DIR=../translations - - -# Translations diff --git a/plugin-tray/translations/tray_zh_CN.desktop b/plugin-tray/translations/tray_zh_CN.desktop deleted file mode 100644 index 485cae3..0000000 --- a/plugin-tray/translations/tray_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=访问最小化到系统托盘的隐藏程序 -Name[zh_CN]=系统托盘 diff --git a/plugin-tray/translations/tray_zh_TW.desktop b/plugin-tray/translations/tray_zh_TW.desktop deleted file mode 100644 index 9d4b6f4..0000000 --- a/plugin-tray/translations/tray_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=System tray -Comment=Display applications minimized to the system tray. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=讀取縮小在系統列的隱藏程式 -Name[zh_TW]=系統列 diff --git a/plugin-tray/trayicon.cpp b/plugin-tray/trayicon.cpp deleted file mode 100644 index d726ad2..0000000 --- a/plugin-tray/trayicon.cpp +++ /dev/null @@ -1,394 +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: - * Alexander Sokoloff - * - * 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 */ - - -// Warning: order of those include is important. -#include -#include -#include -#include -#include -#include -#include - -#include "../panel/lxqtpanel.h" -#include "trayicon.h" -#include "xfitman.h" - -#include -#include -#include -#include -#include - -#define XEMBED_EMBEDDED_NOTIFY 0 - - -static bool xError; - -/************************************************ - -************************************************/ -int windowErrorHandler(Display *d, XErrorEvent *e) -{ - xError = true; - if (e->error_code != BadWindow) { - char str[1024]; - XGetErrorText(d, e->error_code, str, 1024); - qWarning() << "Error handler" << e->error_code - << str; - } - return 0; -} - - -/************************************************ - - ************************************************/ -TrayIcon::TrayIcon(Window iconId, QSize const & iconSize, QWidget* parent): - QFrame(parent), - mIconId(iconId), - mWindowId(0), - mIconSize(iconSize), - mDamage(0), - mDisplay(QX11Info::display()) -{ - // NOTE: - // it's a good idea to save the return value of QX11Info::display(). - // In Qt 5, this API is slower and has some limitations which can trigger crashes. - // The XDisplay value is actally stored in QScreen object of the primary screen rather than - // in a global variable. So when the parimary QScreen is being deleted and becomes invalid, - // QX11Info::display() will fail and cause crash. Storing this value improves the efficiency and - // also prevent potential crashes caused by this bug. - - setObjectName("TrayIcon"); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - // NOTE: - // see https://github.com/lxde/lxqt/issues/945 - // workaround: delayed init because of weird behaviour of some icons/windows (claws-mail) - // (upon starting the app the window for receiving clicks wasn't correctly sized - // no matter what we've done) - QTimer::singleShot(200, [this] { init(); update(); }); -} - - - -/************************************************ - - ************************************************/ -void TrayIcon::init() -{ - Display* dsp = mDisplay; - - XWindowAttributes attr; - if (! XGetWindowAttributes(dsp, mIconId, &attr)) - { - deleteLater(); - return; - } - -// qDebug() << "New tray icon ***********************************"; -// qDebug() << " * window id: " << hex << mIconId; -// qDebug() << " * window name:" << xfitMan().getName(mIconId); -// qDebug() << " * size (WxH): " << attr.width << "x" << attr.height; -// qDebug() << " * color depth:" << attr.depth; - - unsigned long mask = 0; - XSetWindowAttributes set_attr; - - Visual* visual = attr.visual; - set_attr.colormap = attr.colormap; - set_attr.background_pixel = 0; - set_attr.border_pixel = 0; - mask = CWColormap|CWBackPixel|CWBorderPixel; - - const QRect icon_geom = iconGeometry(); - mWindowId = XCreateWindow(dsp, this->winId(), icon_geom.x(), icon_geom.y(), icon_geom.width() * metric(PdmDevicePixelRatio), icon_geom.height() * metric(PdmDevicePixelRatio), - 0, attr.depth, InputOutput, visual, mask, &set_attr); - - - xError = false; - XErrorHandler old; - old = XSetErrorHandler(windowErrorHandler); - XReparentWindow(dsp, mIconId, mWindowId, 0, 0); - XSync(dsp, false); - XSetErrorHandler(old); - - if (xError) - { - qWarning() << "****************************************"; - qWarning() << "* Not icon_swallow *"; - qWarning() << "****************************************"; - XDestroyWindow(dsp, mWindowId); - mWindowId = 0; - deleteLater(); - return; - } - - - { - Atom acttype; - int actfmt; - unsigned long nbitem, bytes; - unsigned char *data = 0; - int ret; - - ret = XGetWindowProperty(dsp, mIconId, xfitMan().atom("_XEMBED_INFO"), - 0, 2, false, xfitMan().atom("_XEMBED_INFO"), - &acttype, &actfmt, &nbitem, &bytes, &data); - if (ret == Success) - { - if (data) - XFree(data); - } - else - { - qWarning() << "TrayIcon: xembed error"; - XDestroyWindow(dsp, mWindowId); - deleteLater(); - return; - } - } - - { - XEvent e; - e.xclient.type = ClientMessage; - e.xclient.serial = 0; - e.xclient.send_event = True; - e.xclient.message_type = xfitMan().atom("_XEMBED"); - e.xclient.window = mIconId; - e.xclient.format = 32; - e.xclient.data.l[0] = CurrentTime; - e.xclient.data.l[1] = XEMBED_EMBEDDED_NOTIFY; - e.xclient.data.l[2] = 0; - e.xclient.data.l[3] = mWindowId; - e.xclient.data.l[4] = 0; - XSendEvent(dsp, mIconId, false, 0xFFFFFF, &e); - } - - XSelectInput(dsp, mIconId, StructureNotifyMask); - mDamage = XDamageCreate(dsp, mIconId, XDamageReportRawRectangles); - XCompositeRedirectWindow(dsp, mWindowId, CompositeRedirectManual); - - XMapWindow(dsp, mIconId); - XMapRaised(dsp, mWindowId); - - const QSize req_size{mIconSize * metric(PdmDevicePixelRatio)}; - XResizeWindow(dsp, mIconId, req_size.width(), req_size.height()); -} - - -/************************************************ - - ************************************************/ -TrayIcon::~TrayIcon() -{ - Display* dsp = mDisplay; - XSelectInput(dsp, mIconId, NoEventMask); - - if (mDamage) - XDamageDestroy(dsp, mDamage); - - // reparent to root - xError = false; - XErrorHandler old = XSetErrorHandler(windowErrorHandler); - - XUnmapWindow(dsp, mIconId); - XReparentWindow(dsp, mIconId, QX11Info::appRootWindow(), 0, 0); - - if (mWindowId) - XDestroyWindow(dsp, mWindowId); - XSync(dsp, False); - XSetErrorHandler(old); -} - - -/************************************************ - - ************************************************/ -QSize TrayIcon::sizeHint() const -{ - QMargins margins = contentsMargins(); - return QSize(margins.left() + mIconSize.width() + margins.right(), - margins.top() + mIconSize.height() + margins.bottom() - ); -} - - -/************************************************ - - ************************************************/ -void TrayIcon::setIconSize(QSize iconSize) -{ - mIconSize = iconSize; - - const QSize req_size{mIconSize * metric(PdmDevicePixelRatio)}; - if (mWindowId) - xfitMan().resizeWindow(mWindowId, req_size.width(), req_size.height()); - - if (mIconId) - xfitMan().resizeWindow(mIconId, req_size.width(), req_size.height()); -} - - -/************************************************ - - ************************************************/ -bool TrayIcon::event(QEvent *event) -{ - if (mWindowId) - { - switch (event->type()) - { - case QEvent::Paint: - draw(static_cast(event)); - break; - - case QEvent::Move: - case QEvent::Resize: - { - QRect rect = iconGeometry(); - xfitMan().moveWindow(mWindowId, rect.left(), rect.top()); - } - break; - - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonDblClick: - event->accept(); - break; - - default: - break; - } - } - - return QFrame::event(event); -} - - -/************************************************ - - ************************************************/ -QRect TrayIcon::iconGeometry() -{ - QRect res = QRect(QPoint(0, 0), mIconSize); - - res.moveCenter(QRect(0, 0, width(), height()).center()); - return res; -} - - -/************************************************ - - ************************************************/ -void TrayIcon::draw(QPaintEvent* /*event*/) -{ - Display* dsp = mDisplay; - - XWindowAttributes attr; - if (!XGetWindowAttributes(dsp, mIconId, &attr)) - { - qWarning() << "Paint error"; - return; - } - - QImage image; - XImage* ximage = XGetImage(dsp, mIconId, 0, 0, attr.width, attr.height, AllPlanes, ZPixmap); - if(ximage) - { - image = QImage((const uchar*) ximage->data, ximage->width, ximage->height, ximage->bytes_per_line, QImage::Format_ARGB32_Premultiplied); - } - else - { - qWarning() << " * Error image is NULL"; - - XClearArea(mDisplay, (Window)winId(), 0, 0, attr.width, attr.height, False); - // for some unknown reason, XGetImage failed. try another less efficient method. - // QScreen::grabWindow uses XCopyArea() internally. - image = qApp->primaryScreen()->grabWindow(mIconId).toImage(); - } - -// qDebug() << "Paint icon **************************************"; -// qDebug() << " * XComposite: " << isXCompositeAvailable(); -// qDebug() << " * Icon geometry:" << iconGeometry(); -// qDebug() << " Icon"; -// qDebug() << " * window id: " << hex << mIconId; -// qDebug() << " * window name:" << xfitMan().getName(mIconId); -// qDebug() << " * size (WxH): " << attr.width << "x" << attr.height; -// qDebug() << " * pos (XxY): " << attr.x << attr.y; -// qDebug() << " * color depth:" << attr.depth; -// qDebug() << " XImage"; -// qDebug() << " * size (WxH): " << ximage->width << "x" << ximage->height; -// switch (ximage->format) -// { -// case XYBitmap: qDebug() << " * format: XYBitmap"; break; -// case XYPixmap: qDebug() << " * format: XYPixmap"; break; -// case ZPixmap: qDebug() << " * format: ZPixmap"; break; -// } -// qDebug() << " * color depth: " << ximage->depth; -// qDebug() << " * bits per pixel:" << ximage->bits_per_pixel; - - // Draw QImage ........................... - QPainter painter(this); - QRect iconRect = iconGeometry(); - if (image.size() != iconRect.size()) - { - image = image.scaled(iconRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); - QRect r = image.rect(); - r.moveCenter(iconRect.center()); - iconRect = r; - } -// qDebug() << " Draw rect:" << iconRect; - - painter.drawImage(iconRect, image); - - if(ximage) - XDestroyImage(ximage); -// debug << "End paint icon **********************************"; -} - - -/************************************************ - - ************************************************/ -void TrayIcon::windowDestroyed(Window w) -{ - //damage is destroyed if it's parent window was destroyed - if (mIconId == w) - mDamage = 0; -} - - -/************************************************ - - ************************************************/ -bool TrayIcon::isXCompositeAvailable() -{ - int eventBase, errorBase; - return XCompositeQueryExtension(QX11Info::display(), &eventBase, &errorBase ); -} diff --git a/plugin-tray/trayicon.h b/plugin-tray/trayicon.h deleted file mode 100644 index 15ef9ef..0000000 --- a/plugin-tray/trayicon.h +++ /dev/null @@ -1,78 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 -#include - -#define TRAY_ICON_SIZE_DEFAULT 24 - -class QWidget; -class LXQtPanel; - -class TrayIcon: public QFrame -{ - Q_OBJECT - Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) - -public: - TrayIcon(Window iconId, QSize const & iconSize, QWidget* parent); - virtual ~TrayIcon(); - - Window iconId() { return mIconId; } - Window windowId() { return mWindowId; } - void windowDestroyed(Window w); - - QSize iconSize() const { return mIconSize; } - void setIconSize(QSize iconSize); - - QSize sizeHint() const; - -protected: - bool event(QEvent *event); - void draw(QPaintEvent* event); - -private: - void init(); - QRect iconGeometry(); - Window mIconId; - Window mWindowId; - QSize mIconSize; - Damage mDamage; - Display* mDisplay; - - static bool isXCompositeAvailable(); -}; - -#endif // TRAYICON_H diff --git a/plugin-tray/xfitman.cpp b/plugin-tray/xfitman.cpp deleted file mode 100644 index af66264..0000000 --- a/plugin-tray/xfitman.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Christopher "VdoP" Regali - * Alexander Sokoloff - * - * 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 "xfitman.h" -#include -#include -#include - -/** - * @file xfitman.cpp - * @brief implements class Xfitman - * @author Christopher "VdoP" Regali - */ - -/* - S ome requests from Cli*ents include type of the Client, for example the _NET_ACTIVE_WINDOW - message. Currently the types can be 1 for normal applications, and 2 for pagers. - See http://standards.freedesktop.org/wm-spec/latest/ar01s09.html#sourceindication - */ -#define SOURCE_NORMAL 1 -#define SOURCE_PAGER 2 - -const XfitMan& xfitMan() -{ - static XfitMan instance; - return instance; -} - -/** - * @brief constructor: gets Display vars and registers us - */ -XfitMan::XfitMan() -{ - root = (Window)QX11Info::appRootWindow(); -} - -Atom XfitMan::atom(const char* atomName) -{ - static QHash hash; - if (hash.contains(atomName)) - return hash.value(atomName); - Atom atom = XInternAtom(QX11Info::display(), atomName, false); - hash[atomName] = atom; - return atom; -} - -/** - * @brief moves a window to a new position - */ - -void XfitMan::moveWindow(Window _win, int _x, int _y) const -{ - XMoveWindow(QX11Info::display(), _win, _x, _y); -} - -/************************************************ - - ************************************************/ -bool XfitMan::getWindowProperty(Window window, - Atom atom, // property - Atom reqType, // req_type - unsigned long* resultLen,// nitems_return - unsigned char** result // prop_return - ) const -{ - int format; - unsigned long type, rest; - return XGetWindowProperty(QX11Info::display(), window, atom, 0, 4096, false, - reqType, &type, &format, resultLen, &rest, - result) == Success; -} - - -/************************************************ - - ************************************************/ -bool XfitMan::getRootWindowProperty(Atom atom, // property - Atom reqType, // req_type - unsigned long* resultLen,// nitems_return - unsigned char** result // prop_return - ) const -{ - return getWindowProperty(root, atom, reqType, resultLen, result); -} - -/** - * @brief resizes a window to the given dimensions - */ -void XfitMan::resizeWindow(Window _wid, int _width, int _height) const -{ - XResizeWindow(QX11Info::display(), _wid, _width, _height); -} - -/** - * @brief gets a windowpixmap from a window - */ -bool XfitMan::getClientIcon(Window _wid, QPixmap& _pixreturn) const -{ - int format; - ulong type, nitems, extra; - ulong* data = 0; - - XGetWindowProperty(QX11Info::display(), _wid, atom("_NET_WM_ICON"), - 0, LONG_MAX, False, AnyPropertyType, - &type, &format, &nitems, &extra, - (uchar**)&data); - if (!data) - { - return false; - } - - QImage img (data[0], data[1], QImage::Format_ARGB32); - for (int i=0; iaddPixmap(QPixmap::fromImage(img)); - } - - XFree(data); - return true; -} - -/** - * @brief destructor - */ -XfitMan::~XfitMan() -{ -} - -/** - * @brief returns a windowname and sets _nameSource to the finally used Atom - */ -// i got the idea for this from taskbar-plugin of LXPanel - so credits fly out :) -QString XfitMan::getWindowTitle(Window _wid) const -{ - QString name = ""; - //first try the modern net-wm ones - unsigned long length; - unsigned char *data = NULL; - Atom utf8Atom = atom("UTF8_STRING"); - - if (getWindowProperty(_wid, atom("_NET_WM_VISIBLE_NAME"), utf8Atom, &length, &data)) - { - name = QString::fromUtf8((char*) data); - XFree(data); - - } - - if (name.isEmpty()) - { - if (getWindowProperty(_wid, atom("_NET_WM_NAME"), utf8Atom, &length, &data)) - { - name = QString::fromUtf8((char*) data); - XFree(data); - } - } - - if (name.isEmpty()) - { - if (getWindowProperty(_wid, atom("XA_WM_NAME"), XA_STRING, &length, &data)) - { - name = (char*) data; - XFree(data); - } - } - - if (name.isEmpty()) - { - Status ok = XFetchName(QX11Info::display(), _wid, (char**) &data); - name = QString((char*) data); - if (0 != ok) XFree(data); - } - - if (name.isEmpty()) - { - XTextProperty prop; - if (XGetWMName(QX11Info::display(), _wid, &prop)) - { - name = QString::fromUtf8((char*) prop.value); - XFree(prop.value); - } - } - - return name; -} - -QString XfitMan::getApplicationName(Window _wid) const -{ - XClassHint hint; - QString ret; - - if (XGetClassHint(QX11Info::display(), _wid, &hint)) - { - if (hint.res_name) - { - ret = hint.res_name; - XFree(hint.res_name); - } - if (hint.res_class) - { - XFree(hint.res_class); - } - } - - return ret; -} - -/** - * @brief sends a clientmessage to a window - */ -int XfitMan::clientMessage(Window _wid, Atom _msg, - unsigned long data0, - unsigned long data1, - unsigned long data2, - unsigned long data3, - unsigned long data4) const -{ - XClientMessageEvent msg; - msg.window = _wid; - msg.type = ClientMessage; - msg.message_type = _msg; - msg.send_event = true; - msg.display = QX11Info::display(); - msg.format = 32; - msg.data.l[0] = data0; - msg.data.l[1] = data1; - msg.data.l[2] = data2; - msg.data.l[3] = data3; - msg.data.l[4] = data4; - if (XSendEvent(QX11Info::display(), root, false, (SubstructureRedirectMask | SubstructureNotifyMask) , (XEvent *) &msg) == Success) - return EXIT_SUCCESS; - else - return EXIT_FAILURE; -} - -/** - * @brief raises windows _wid - */ -void XfitMan::raiseWindow(Window _wid) const -{ - clientMessage(_wid, atom("_NET_ACTIVE_WINDOW"), - SOURCE_PAGER); -} - -/************************************************ - - ************************************************/ -void XfitMan::closeWindow(Window _wid) const -{ - clientMessage(_wid, atom("_NET_CLOSE_WINDOW"), - 0, // Timestamp - SOURCE_PAGER); -} - -void XfitMan::setIconGeometry(Window _wid, QRect* rect) const -{ - Atom net_wm_icon_geometry = atom("_NET_WM_ICON_GEOMETRY"); - if(!rect) - XDeleteProperty(QX11Info::display(), _wid, net_wm_icon_geometry); - else - { - long data[4]; - data[0] = rect->x(); - data[1] = rect->y(); - data[2] = rect->width(); - data[3] = rect->height(); - XChangeProperty(QX11Info::display(), _wid, net_wm_icon_geometry, - XA_CARDINAL, 32, PropModeReplace, (unsigned char*)data, 4); - } -} diff --git a/plugin-tray/xfitman.h b/plugin-tray/xfitman.h deleted file mode 100644 index 4b837d1..0000000 --- a/plugin-tray/xfitman.h +++ /dev/null @@ -1,96 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Christopher "VdoP" Regali - * Alexander Sokoloff - * - * 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 LXQTXFITMAN_H -#define LXQTXFITMAN_H - -#include - -/** - * @file xfitman.h - * @author Christopher "VdoP" Regali - * @brief handles all of our xlib-calls. - */ - -/** - * @brief manages the Xlib apicalls - */ -class XfitMan -{ -public: - XfitMan(); - ~XfitMan(); - - static Atom atom(const char* atomName); - - void moveWindow(Window _win, int _x, int _y) const; - void raiseWindow(Window _wid) const; - void resizeWindow(Window _wid, int _width, int _height) const; - void closeWindow(Window _wid) const; - - bool getClientIcon(Window _wid, QPixmap& _pixreturn) const; - bool getClientIcon(Window _wid, QIcon *icon) const; - void setIconGeometry(Window _wid, QRect* rect = 0) const; - - QString getWindowTitle(Window _wid) const; - QString getApplicationName(Window _wid) const; - - int clientMessage(Window _wid, Atom _msg, - long unsigned int data0, - long unsigned int data1 = 0, - long unsigned int data2 = 0, - long unsigned int data3 = 0, - long unsigned int data4 = 0) const; - -private: - - /** \warning Do not forget to XFree(result) after data are processed! - */ - bool getWindowProperty(Window window, - Atom atom, // property - Atom reqType, // req_type - unsigned long* resultLen,// nitems_return - unsigned char** result // prop_return - ) const; - - /** \warning Do not forget to XFree(result) after data are processed! - */ - bool getRootWindowProperty(Atom atom, // property - Atom reqType, // req_type - unsigned long* resultLen,// nitems_return - unsigned char** result // prop_return - ) const; - - - Window root; //the actual root window on the used screen -}; - - -const XfitMan& xfitMan(); - -#endif // LXQTXFITMAN_H diff --git a/plugin-volume/CMakeLists.txt b/plugin-volume/CMakeLists.txt deleted file mode 100644 index 55457b1..0000000 --- a/plugin-volume/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -set(PLUGIN "volume") - -set(HEADERS - lxqtvolume.h - volumebutton.h - volumepopup.h - audiodevice.h - lxqtvolumeconfiguration.h - audioengine.h -) - -set(SOURCES - ${PROJECT_SOURCE_DIR}/panel/lxqtpanelpluginconfigdialog.cpp - lxqtvolume.cpp - volumebutton.cpp - volumepopup.cpp - audiodevice.cpp - lxqtvolumeconfiguration.cpp - audioengine.cpp - ossengine.cpp -) - -set(UIS - lxqtvolumeconfiguration.ui -) - -set(LIBRARIES - ${LIBRARIES} - lxqt-globalkeys - Qt5Xdg -) - -if(PULSEAUDIO_FOUND) - add_definitions(-DUSE_PULSEAUDIO) - include_directories(${PULSEAUDIO_INCLUDE_DIR}) - set(HEADERS ${HEADERS} pulseaudioengine.h) - set(SOURCES ${SOURCES} pulseaudioengine.cpp) - set(MOCS ${MOCS} pulseaudioengine.h) - set(LIBRARIES ${LIBRARIES} ${PULSEAUDIO_LIBRARY}) -endif() - -if(ALSA_FOUND) - add_definitions(-DUSE_ALSA) - set(HEADERS ${HEADERS} alsaengine.h alsadevice.h) - set(SOURCES ${SOURCES} alsaengine.cpp alsadevice.cpp) - set(MOCS ${MOCS} alsaengine.h alsadevice.h) - set(LIBRARIES ${LIBRARIES} ${ALSA_LIBRARIES}) -endif() - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-volume/alsadevice.cpp b/plugin-volume/alsadevice.cpp deleted file mode 100644 index 4595da1..0000000 --- a/plugin-volume/alsadevice.cpp +++ /dev/null @@ -1,70 +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: - * Johannes Zellner - * - * 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 "alsadevice.h" - -AlsaDevice::AlsaDevice(AudioDeviceType t, AudioEngine *engine, QObject *parent) : - AudioDevice(t, engine, parent), - m_mixer(0), - m_elem(0), - m_volumeMin(0), - m_volumeMax(100) -{ -} - -void AlsaDevice::setMixer(snd_mixer_t *mixer) -{ - if (m_mixer == mixer) - return; - - m_mixer = mixer; - emit mixerChanged(); -} - -void AlsaDevice::setElement(snd_mixer_elem_t *elem) -{ - if (m_elem == elem) - return; - - m_elem = elem; - emit elementChanged(); -} - -void AlsaDevice::setCardName(const QString &cardName) -{ - if (m_cardName == cardName) - return; - - m_cardName = cardName; - emit cardNameChanged(); -} - -void AlsaDevice::setVolumeMinMax(long volumeMin, long volumeMax) -{ - m_volumeMin = volumeMin; - m_volumeMax = volumeMax; -} diff --git a/plugin-volume/alsadevice.h b/plugin-volume/alsadevice.h deleted file mode 100644 index 9d535b8..0000000 --- a/plugin-volume/alsadevice.h +++ /dev/null @@ -1,69 +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: - * Johannes Zellner - * - * 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 ALSADEVICE_H -#define ALSADEVICE_H - -#include "audiodevice.h" - -#include - -#include -#include - -class AlsaDevice : public AudioDevice -{ - Q_OBJECT - -public: - AlsaDevice(AudioDeviceType t, AudioEngine *engine, QObject *parent = 0); - - snd_mixer_t *mixer() const { return m_mixer; } - snd_mixer_elem_t *element() const { return m_elem; } - const QString &cardName() const { return m_cardName; } - inline long volumeMin() const { return m_volumeMin; } - inline long volumeMax() const { return m_volumeMax; } - - void setMixer(snd_mixer_t *mixer); - void setElement(snd_mixer_elem_t *elem); - void setCardName(const QString &cardName); - void setVolumeMinMax(long volumeMin, long volumeMax); - -signals: - void mixerChanged(); - void elementChanged(); - void cardNameChanged(); - -private: - snd_mixer_t *m_mixer; - snd_mixer_elem_t *m_elem; - QString m_cardName; - long m_volumeMin; - long m_volumeMax; -}; - -#endif // ALSADEVICE_H diff --git a/plugin-volume/alsaengine.cpp b/plugin-volume/alsaengine.cpp deleted file mode 100644 index 9f2c6ba..0000000 --- a/plugin-volume/alsaengine.cpp +++ /dev/null @@ -1,222 +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: - * Johannes Zellner - * - * 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 "alsaengine.h" - -#include "alsadevice.h" - -#include -#include -#include - -AlsaEngine *AlsaEngine::m_instance = 0; - -static int alsa_elem_event_callback(snd_mixer_elem_t *elem, unsigned int mask) -{ - AlsaEngine *engine = AlsaEngine::instance(); - if (engine) - engine->updateDevice(engine->getDeviceByAlsaElem(elem)); - - return 0; -} - -static int alsa_mixer_event_callback(snd_mixer_t *mixer, unsigned int mask, snd_mixer_elem_t *elem) -{ - return 0; -} - -AlsaEngine::AlsaEngine(QObject *parent) : - AudioEngine(parent) -{ - discoverDevices(); - m_instance = this; -} - -AlsaEngine *AlsaEngine::instance() -{ - return m_instance; -} - -int AlsaEngine::volumeMax(AudioDevice *device) const -{ - AlsaDevice * alsa_dev = qobject_cast(device); - Q_ASSERT(alsa_dev); - return alsa_dev->volumeMax(); -} - -AlsaDevice *AlsaEngine::getDeviceByAlsaElem(snd_mixer_elem_t *elem) const -{ - foreach (AudioDevice *device, m_sinks) { - AlsaDevice *dev = qobject_cast(device); - if (!dev || !dev->element()) - continue; - - if (dev->element() == elem) - return dev; - } - - return 0; -} - -void AlsaEngine::commitDeviceVolume(AudioDevice *device) -{ - AlsaDevice *dev = qobject_cast(device); - if (!dev || !dev->element()) - return; - - long value = dev->volumeMin() + qRound(static_cast(dev->volume()) / 100.0 * (dev->volumeMax() - dev->volumeMin())); - snd_mixer_selem_set_playback_volume_all(dev->element(), value); -} - -void AlsaEngine::setMute(AudioDevice *device, bool state) -{ - AlsaDevice *dev = qobject_cast(device); - if (!dev || !dev->element()) - return; - - if (snd_mixer_selem_has_playback_switch(dev->element())) - snd_mixer_selem_set_playback_switch_all(dev->element(), (int)!state); - else if (state) - dev->setVolume(0); -} - -void AlsaEngine::updateDevice(AlsaDevice *device) -{ - if (!device) - return; - - long value; - snd_mixer_selem_get_playback_volume(device->element(), (snd_mixer_selem_channel_id_t)0, &value); - // qDebug() << "updateDevice:" << device->name() << value; - device->setVolumeNoCommit(qRound((static_cast(value - device->volumeMin()) * 100.0) / (device->volumeMax() - device->volumeMin()))); - - if (snd_mixer_selem_has_playback_switch(device->element())) { - int mute; - snd_mixer_selem_get_playback_switch(device->element(), (snd_mixer_selem_channel_id_t)0, &mute); - device->setMuteNoCommit(!(bool)mute); - } -} - -void AlsaEngine::driveAlsaEventHandling(int fd) -{ - snd_mixer_handle_events(m_mixerMap.value(fd)); -} - -void AlsaEngine::discoverDevices() -{ - int error; - int cardNum = -1; - const int BUFF_SIZE = 64; - - while (1) { - if ((error = snd_card_next(&cardNum)) < 0) { - qWarning("Can't get the next card number: %s\n", snd_strerror(error)); - break; - } - - if (cardNum < 0) - break; - - char str[BUFF_SIZE]; - const size_t n = snprintf(str, sizeof(str), "hw:%i", cardNum); - if (BUFF_SIZE <= n) { - qWarning("AlsaEngine::discoverDevices: Buffer too small\n"); - continue; - } - - snd_ctl_t *cardHandle; - if ((error = snd_ctl_open(&cardHandle, str, 0)) < 0) { - qWarning("Can't open card %i: %s\n", cardNum, snd_strerror(error)); - continue; - } - - snd_ctl_card_info_t *cardInfo; - snd_ctl_card_info_alloca(&cardInfo); - - QString cardName = QString::fromLatin1(snd_ctl_card_info_get_name(cardInfo)); - if (cardName.isEmpty()) - cardName = QString::fromLatin1(str); - - if ((error = snd_ctl_card_info(cardHandle, cardInfo)) < 0) { - qWarning("Can't get info for card %i: %s\n", cardNum, snd_strerror(error)); - } else { - // setup mixer and iterate over channels - snd_mixer_t *mixer = 0; - snd_mixer_open(&mixer, 0); - snd_mixer_attach(mixer, str); - snd_mixer_selem_register(mixer, NULL, NULL); - snd_mixer_load(mixer); - - // setup event handler for mixer - snd_mixer_set_callback(mixer, alsa_mixer_event_callback); - - // setup eventloop handling - struct pollfd pfd; - if (snd_mixer_poll_descriptors(mixer, &pfd, 1)) { - QSocketNotifier *notifier = new QSocketNotifier(pfd.fd, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), this, SLOT(driveAlsaEventHandling(int))); - m_mixerMap.insert(pfd.fd, mixer); - } - - snd_mixer_elem_t *mixerElem = 0; - mixerElem = snd_mixer_first_elem(mixer); - - while (mixerElem) { - // check if we have a Sink or Source - if (snd_mixer_selem_has_playback_volume(mixerElem)) { - AlsaDevice *dev = new AlsaDevice(Sink, this, this); - dev->setName(QString::fromLatin1(snd_mixer_selem_get_name(mixerElem))); - dev->setIndex(cardNum); - dev->setDescription(cardName + " - " + dev->name()); - - // set alsa specific members - dev->setCardName(QString::fromLatin1(str)); - dev->setMixer(mixer); - dev->setElement(mixerElem); - - // get & store the range - long min, max; - snd_mixer_selem_get_playback_volume_range(mixerElem, &min, &max); - dev->setVolumeMinMax(min, max); - - updateDevice(dev); - - // register event callback - snd_mixer_elem_set_callback(mixerElem, alsa_elem_event_callback); - - m_sinks.append(dev); - } - - mixerElem = snd_mixer_elem_next(mixerElem); - } - } - - snd_ctl_close(cardHandle); - } - - snd_config_update_free_global(); -} diff --git a/plugin-volume/alsaengine.h b/plugin-volume/alsaengine.h deleted file mode 100644 index 0bfeb79..0000000 --- a/plugin-volume/alsaengine.h +++ /dev/null @@ -1,70 +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: - * Johannes Zellner - * - * 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 ALSAENGINE_H -#define ALSAENGINE_H - -#include "audioengine.h" - -#include -#include -#include -#include - -#include - -class AlsaDevice; -class QSocketNotifier; - -class AlsaEngine : public AudioEngine -{ - Q_OBJECT - -public: - AlsaEngine(QObject *parent = 0); - static AlsaEngine *instance(); - - virtual const QString backendName() const { return QLatin1String("Alsa"); } - - int volumeMax(AudioDevice *device) const; - AlsaDevice *getDeviceByAlsaElem(snd_mixer_elem_t *elem) const; - -public slots: - void commitDeviceVolume(AudioDevice *device); - void setMute(AudioDevice *device, bool state); - void updateDevice(AlsaDevice *device); - -private slots: - void driveAlsaEventHandling(int fd); - -private: - void discoverDevices(); - QMap m_mixerMap; - static AlsaEngine *m_instance; -}; - -#endif // ALSAENGINE_H diff --git a/plugin-volume/audiodevice.cpp b/plugin-volume/audiodevice.cpp deleted file mode 100644 index 1882426..0000000 --- a/plugin-volume/audiodevice.cpp +++ /dev/null @@ -1,121 +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: - * Johannes Zellner - * - * 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 "audiodevice.h" -#include "audioengine.h" - -AudioDevice::AudioDevice(AudioDeviceType t, AudioEngine *engine, QObject *parent) : - QObject(parent), - m_engine(engine), - m_volume(0), - m_mute(false), - m_type(t), - m_index(0) -{ -} - -AudioDevice::~AudioDevice() -{ -} - -void AudioDevice::setName(const QString &name) -{ - if (m_name == name) - return; - - m_name = name; - emit nameChanged(m_name); -} - -void AudioDevice::setDescription(const QString &description) -{ - if (m_description == description) - return; - - m_description = description; - emit descriptionChanged(m_description); -} - -void AudioDevice::setIndex(uint index) -{ - if (m_index == index) - return; - - m_index = index; - emit indexChanged(index); -} - -// this is just for setting the internal volume -void AudioDevice::setVolumeNoCommit(int volume) -{ - if (m_engine) - volume = m_engine->volumeBounded(volume, this); - - if (m_volume == volume) - return; - - m_volume = volume; - emit volumeChanged(m_volume); -} - -void AudioDevice::toggleMute() -{ - setMute(!m_mute); -} - -void AudioDevice::setMute(bool state) -{ - if (m_mute == state) - return; - - setMuteNoCommit(state); - - if (m_engine) - m_engine->setMute(this, state); -} - -void AudioDevice::setMuteNoCommit(bool state) -{ - if (m_mute == state) - return; - - m_mute = state; - emit muteChanged(m_mute); -} - -// this performs a volume change on the device -void AudioDevice::setVolume(int volume) -{ - if (m_volume == volume) - return; - - setVolumeNoCommit(volume); - setMute(false); - - if (m_engine) - m_engine->commitDeviceVolume(this); -} diff --git a/plugin-volume/audiodevice.h b/plugin-volume/audiodevice.h deleted file mode 100644 index 8b854ae..0000000 --- a/plugin-volume/audiodevice.h +++ /dev/null @@ -1,90 +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: - * Johannes Zellner - * - * 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 AUDIODEVICE_H -#define AUDIODEVICE_H - -#include - -class AudioEngine; - -typedef enum AudioDeviceType { - Sink = 0, - Source = 1, - PulseAudioDeviceTypeLength -} AudioDeviceType; - -class AudioDevice : public QObject -{ - Q_OBJECT - Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(AudioDeviceType type READ type CONSTANT) - -public: - AudioDevice(AudioDeviceType t, AudioEngine *engine, QObject *parent = 0); - ~AudioDevice(); - - // the volume can range from 0 to 100. - int volume() const { return m_volume; } - bool mute() const { return m_mute; } - AudioDeviceType type() const { return m_type; } - const QString &name() const { return m_name; } - const QString &description() const { return m_description; } - uint index() const { return m_index; } - - void setName(const QString &name); - void setDescription(const QString &description); - void setIndex(uint index); - - AudioEngine* engine() { return m_engine; } - -public slots: - // the volume can range from 0 to 100. - void setVolume(int volume); - void setVolumeNoCommit(int volume); - void toggleMute(); - void setMute(bool state); - void setMuteNoCommit(bool state); - -signals: - void volumeChanged(int volume); - void muteChanged(bool state); - void nameChanged(const QString &name); - void descriptionChanged(const QString &description); - void indexChanged(uint index); - -private: - AudioEngine *m_engine; - int m_volume; // the volume can range from 0 to 100. - bool m_mute; - AudioDeviceType m_type; - QString m_name; - uint m_index; - QString m_description; -}; - -#endif // AUDIODEVICE_H diff --git a/plugin-volume/audioengine.cpp b/plugin-volume/audioengine.cpp deleted file mode 100644 index 6cef716..0000000 --- a/plugin-volume/audioengine.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: - * Johannes Zellner - * - * 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 "audioengine.h" - -#include "audiodevice.h" - -#include -#include - -AudioEngine::AudioEngine(QObject *parent) : - QObject(parent) -{ -} - -AudioEngine::~AudioEngine() -{ - qDeleteAll(m_sinks); - m_sinks.clear(); -} - -int AudioEngine::volumeBounded(int volume, AudioDevice* device) const -{ - int maximum = volumeMax(device); - double v = ((double) volume / 100.0) * maximum; - double bounded = qBound(0, v, maximum); - return qRound((bounded / maximum) * 100); -} - - -void AudioEngine::mute(AudioDevice *device) -{ - setMute(device, true); -} - -void AudioEngine::unmute(AudioDevice *device) -{ - setMute(device, false); -} - -void AudioEngine::setIgnoreMaxVolume(bool ignore) -{ - Q_UNUSED(ignore) -} diff --git a/plugin-volume/audioengine.h b/plugin-volume/audioengine.h deleted file mode 100644 index 5fb9ea7..0000000 --- a/plugin-volume/audioengine.h +++ /dev/null @@ -1,64 +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: - * Johannes Zellner - * - * 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 AUDIOENGINE_H -#define AUDIOENGINE_H - -#include -#include -#include - -class AudioDevice; - -class AudioEngine : public QObject -{ - Q_OBJECT - -public: - AudioEngine(QObject *parent = 0); - ~AudioEngine(); - - const QList &sinks() const { return m_sinks; } - virtual int volumeMax(AudioDevice *device) const = 0; - virtual int volumeBounded(int volume, AudioDevice *device) const; - virtual const QString backendName() const = 0; - -public slots: - virtual void commitDeviceVolume(AudioDevice *device) = 0; - virtual void setMute(AudioDevice *device, bool state) = 0; - void mute(AudioDevice *device); - void unmute(AudioDevice *device); - virtual void setIgnoreMaxVolume(bool ignore); - -signals: - void sinkListChanged(); - -protected: - QList m_sinks; -}; - -#endif // AUDIOENGINE_H diff --git a/plugin-volume/lxqtvolume.cpp b/plugin-volume/lxqtvolume.cpp deleted file mode 100644 index 05c2c6f..0000000 --- a/plugin-volume/lxqtvolume.cpp +++ /dev/null @@ -1,297 +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: - * Johannes Zellner - * - * 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 "lxqtvolume.h" - -#include "volumebutton.h" -#include "volumepopup.h" -#include "lxqtvolumeconfiguration.h" -#include "audiodevice.h" -#ifdef USE_PULSEAUDIO -#include "pulseaudioengine.h" -#endif -#ifdef USE_ALSA -#include "alsaengine.h" -#endif -#include "ossengine.h" - -#include -#include -#include -#include - -#define DEFAULT_UP_SHORTCUT "XF86AudioRaiseVolume" -#define DEFAULT_DOWN_SHORTCUT "XF86AudioLowerVolume" -#define DEFAULT_MUTE_SHORTCUT "XF86AudioMute" - -LXQtVolume::LXQtVolume(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - m_engine(0), - m_defaultSinkIndex(0), - m_defaultSink(0), - m_allwaysShowNotifications(SETTINGS_DEFAULT_ALLWAYS_SHOW_NOTIFICATIONS) -{ - m_volumeButton = new VolumeButton(this); - - m_notification = new LXQt::Notification("", this); - - m_keyVolumeUp = GlobalKeyShortcut::Client::instance()->addAction(QString(), QString("/panel/%1/up").arg(settings()->group()), tr("Increase sound volume"), this); - if (m_keyVolumeUp) - { - connect(m_keyVolumeUp, &GlobalKeyShortcut::Action::registrationFinished, this, &LXQtVolume::shortcutRegistered); - connect(m_keyVolumeUp, SIGNAL(activated()), this, SLOT(handleShortcutVolumeUp())); - } - m_keyVolumeDown = GlobalKeyShortcut::Client::instance()->addAction(QString(), QString("/panel/%1/down").arg(settings()->group()), tr("Decrease sound volume"), this); - if (m_keyVolumeDown) - { - connect(m_keyVolumeDown, &GlobalKeyShortcut::Action::registrationFinished, this, &LXQtVolume::shortcutRegistered); - connect(m_keyVolumeDown, SIGNAL(activated()), this, SLOT(handleShortcutVolumeDown())); - } - m_keyMuteToggle = GlobalKeyShortcut::Client::instance()->addAction(QString(), QString("/panel/%1/mute").arg(settings()->group()), tr("Mute/unmute sound volume"), this); - if (m_keyMuteToggle) - { - connect(m_keyMuteToggle, &GlobalKeyShortcut::Action::registrationFinished, this, &LXQtVolume::shortcutRegistered); - connect(m_keyMuteToggle, SIGNAL(activated()), this, SLOT(handleShortcutVolumeMute())); - } - - settingsChanged(); -} - -LXQtVolume::~LXQtVolume() -{ - delete m_volumeButton; -} - -void LXQtVolume::shortcutRegistered() -{ - GlobalKeyShortcut::Action * const shortcut = qobject_cast(sender()); - - QString shortcutNotRegistered; - - if (shortcut == m_keyVolumeUp) - { - disconnect(m_keyVolumeUp, &GlobalKeyShortcut::Action::registrationFinished, this, &LXQtVolume::shortcutRegistered); - - if (m_keyVolumeUp->shortcut().isEmpty()) - { - m_keyVolumeUp->changeShortcut(DEFAULT_UP_SHORTCUT); - if (m_keyVolumeUp->shortcut().isEmpty()) - { - shortcutNotRegistered = " '" DEFAULT_UP_SHORTCUT "'"; - } - } - } else if (shortcut == m_keyVolumeDown) - { - disconnect(m_keyVolumeDown, &GlobalKeyShortcut::Action::registrationFinished, this, &LXQtVolume::shortcutRegistered); - - if (m_keyVolumeDown->shortcut().isEmpty()) - { - m_keyVolumeDown->changeShortcut(DEFAULT_DOWN_SHORTCUT); - if (m_keyVolumeDown->shortcut().isEmpty()) - { - shortcutNotRegistered += " '" DEFAULT_DOWN_SHORTCUT "'"; - } - } - } else if (shortcut == m_keyMuteToggle) - { - disconnect(m_keyMuteToggle, &GlobalKeyShortcut::Action::registrationFinished, this, &LXQtVolume::shortcutRegistered); - - if (m_keyMuteToggle->shortcut().isEmpty()) - { - m_keyMuteToggle->changeShortcut(DEFAULT_MUTE_SHORTCUT); - if (m_keyMuteToggle->shortcut().isEmpty()) - { - shortcutNotRegistered += " '" DEFAULT_MUTE_SHORTCUT "'"; - } - } - } - - if(!shortcutNotRegistered.isEmpty()) - { - m_notification->setSummary(tr("Volume Control: The following shortcuts can not be registered: %1").arg(shortcutNotRegistered)); - m_notification->update(); - } - - m_notification->setTimeout(1000); - m_notification->setUrgencyHint(LXQt::Notification::UrgencyLow); -} - -void LXQtVolume::setAudioEngine(AudioEngine *engine) -{ - if (m_engine) { - if (m_engine->backendName() == engine->backendName()) - return; - - if (m_defaultSink) - { - disconnect(m_defaultSink, nullptr, this, nullptr); - disconnect(m_defaultSink, nullptr, this, nullptr); - m_defaultSink = nullptr; - } - m_volumeButton->volumePopup()->setDevice(m_defaultSink); - - disconnect(m_engine, 0, 0, 0); - delete m_engine; - m_engine = 0; - } - - m_engine = engine; - connect(m_engine, &AudioEngine::sinkListChanged, this, &LXQtVolume::handleSinkListChanged); - - handleSinkListChanged(); -} - - -void LXQtVolume::settingsChanged() -{ - m_defaultSinkIndex = settings()->value(SETTINGS_DEVICE, SETTINGS_DEFAULT_DEVICE).toInt(); - QString engineName = settings()->value(SETTINGS_AUDIO_ENGINE, SETTINGS_DEFAULT_AUDIO_ENGINE).toString(); - const bool new_engine = !m_engine || m_engine->backendName() != engineName; - if (new_engine) { -#if defined(USE_PULSEAUDIO) && defined(USE_ALSA) - if (engineName == QLatin1String("PulseAudio")) - setAudioEngine(new PulseAudioEngine(this)); - else if (engineName == QLatin1String("Alsa")) - setAudioEngine(new AlsaEngine(this)); - else // fallback to OSS - setAudioEngine(new OssEngine(this)); -#elif defined(USE_PULSEAUDIO) - if (engineName == QLatin1String("PulseAudio")) - setAudioEngine(new PulseAudioEngine(this)); - else // fallback to OSS - setAudioEngine(new OssEngine(this)); -#elif defined(USE_ALSA) - if (engineName == QLatin1String("Alsa")) - setAudioEngine(new AlsaEngine(this)); - else // fallback to OSS - setAudioEngine(new OssEngine(this)); -#else - // No other backends are available, fallback to OSS - setAudioEngine(new OssEngine(this)); -#endif - } - - m_volumeButton->setShowOnClicked(settings()->value(SETTINGS_SHOW_ON_LEFTCLICK, SETTINGS_DEFAULT_SHOW_ON_LEFTCLICK).toBool()); - m_volumeButton->setMuteOnMiddleClick(settings()->value(SETTINGS_MUTE_ON_MIDDLECLICK, SETTINGS_DEFAULT_MUTE_ON_MIDDLECLICK).toBool()); - m_volumeButton->setMixerCommand(settings()->value(SETTINGS_MIXER_COMMAND, SETTINGS_DEFAULT_MIXER_COMMAND).toString()); - m_volumeButton->volumePopup()->setSliderStep(settings()->value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt()); - m_allwaysShowNotifications = settings()->value(SETTINGS_ALLWAYS_SHOW_NOTIFICATIONS, SETTINGS_DEFAULT_ALLWAYS_SHOW_NOTIFICATIONS).toBool(); - - if (!new_engine) - handleSinkListChanged(); -} - -void LXQtVolume::handleSinkListChanged() -{ - if (m_engine) - { - if (m_engine->sinks().count() > 0) - { - m_defaultSink = m_engine->sinks().at(qBound(0, m_defaultSinkIndex, m_engine->sinks().count()-1)); - m_volumeButton->volumePopup()->setDevice(m_defaultSink); - connect(m_defaultSink, &AudioDevice::volumeChanged, this, [this] { LXQtVolume::showNotification(false); }); - connect(m_defaultSink, &AudioDevice::muteChanged, this, [this] { LXQtVolume::showNotification(false); }); - - m_engine->setIgnoreMaxVolume(settings()->value(SETTINGS_IGNORE_MAX_VOLUME, SETTINGS_DEFAULT_IGNORE_MAX_VOLUME).toBool()); - } - - if (m_configDialog) - m_configDialog->setSinkList(m_engine->sinks()); - } -} - -void LXQtVolume::handleShortcutVolumeUp() -{ - if (m_defaultSink) - { - m_defaultSink->setVolume(m_defaultSink->volume() + settings()->value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt()); - showNotification(true); - } -} - -void LXQtVolume::handleShortcutVolumeDown() -{ - if (m_defaultSink) - { - m_defaultSink->setVolume(m_defaultSink->volume() - settings()->value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt()); - showNotification(true); - } -} - -void LXQtVolume::handleShortcutVolumeMute() -{ - if (m_defaultSink) - { - m_defaultSink->toggleMute(); - showNotification(true); - } -} - -QWidget *LXQtVolume::widget() -{ - return m_volumeButton; -} - -void LXQtVolume::realign() -{ -} - -QDialog *LXQtVolume::configureDialog() -{ - if (!m_configDialog) - { - const bool oss_available = (m_engine && m_engine->backendName() == QLatin1String("Oss")) - ? m_engine->sinks().size() > 0 - : OssEngine().sinks().size() > 0; - m_configDialog = new LXQtVolumeConfiguration(settings(), oss_available); - m_configDialog->setAttribute(Qt::WA_DeleteOnClose, true); - - if (m_engine) - m_configDialog->setSinkList(m_engine->sinks()); - } - return m_configDialog; -} - -void LXQtVolume::showNotification(bool forceShow) const -{ - if (forceShow || m_allwaysShowNotifications) - { - if (Q_LIKELY(m_defaultSink)) - { - if (m_defaultSink->mute()) - m_notification->setSummary(tr("Volume: muted")); - else - m_notification->setSummary(tr("Volume: %1").arg(QString::number(m_defaultSink->volume()))); - m_notification->update(); - } - } -} - -#undef DEFAULT_UP_SHORTCUT -#undef DEFAULT_DOWN_SHORTCUT -#undef DEFAULT_MUTE_SHORTCUT diff --git a/plugin-volume/lxqtvolume.h b/plugin-volume/lxqtvolume.h deleted file mode 100644 index 2100106..0000000 --- a/plugin-volume/lxqtvolume.h +++ /dev/null @@ -1,98 +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: - * Johannes Zellner - * - * 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 LXQTVOLUME_H -#define LXQTVOLUME_H - -#include "../panel/ilxqtpanelplugin.h" -#include -#include -#include - -class VolumeButton; -class AudioEngine; -class AudioDevice; -namespace LXQt { -class Notification; -} -namespace GlobalKeyShortcut -{ -class Action; -} - -class LXQtVolumeConfiguration; - -class LXQtVolume : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - LXQtVolume(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtVolume(); - - virtual QWidget *widget(); - virtual QString themeId() const { return "Volume"; } - virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog ; } - void realign(); - QDialog *configureDialog(); - - void setAudioEngine(AudioEngine *engine); -protected slots: - virtual void settingsChanged(); - void handleSinkListChanged(); - void handleShortcutVolumeUp(); - void handleShortcutVolumeDown(); - void handleShortcutVolumeMute(); - void shortcutRegistered(); - void showNotification(bool forceShow) const; - -private: - AudioEngine *m_engine; - VolumeButton *m_volumeButton; - int m_defaultSinkIndex; - AudioDevice *m_defaultSink; - GlobalKeyShortcut::Action *m_keyVolumeUp; - GlobalKeyShortcut::Action *m_keyVolumeDown; - GlobalKeyShortcut::Action *m_keyMuteToggle; - LXQt::Notification *m_notification; - QPointer m_configDialog; - bool m_allwaysShowNotifications; -}; - - -class LXQtVolumePluginLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new LXQtVolume(startupInfo); - } -}; - -#endif // LXQTVOLUME_H diff --git a/plugin-volume/lxqtvolumeconfiguration.cpp b/plugin-volume/lxqtvolumeconfiguration.cpp deleted file mode 100644 index e70dc4a..0000000 --- a/plugin-volume/lxqtvolumeconfiguration.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 "lxqtvolumeconfiguration.h" -#include "ui_lxqtvolumeconfiguration.h" - -#include "audiodevice.h" - -#include -#include - -LXQtVolumeConfiguration::LXQtVolumeConfiguration(PluginSettings *settings, bool ossAvailable, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtVolumeConfiguration) -{ - ui->setupUi(this); - - loadSettings(); - connect(ui->devAddedCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(sinkSelectionChanged(int))); - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); - connect(ui->showOnClickCheckBox, SIGNAL(toggled(bool)), this, SLOT(showOnClickedChanged(bool))); - connect(ui->muteOnMiddleClickCheckBox, SIGNAL(toggled(bool)), this, SLOT(muteOnMiddleClickChanged(bool))); - connect(ui->mixerLineEdit, SIGNAL(textChanged(QString)), this, SLOT(mixerLineEditChanged(QString))); - connect(ui->stepSpinBox, SIGNAL(valueChanged(int)), this, SLOT(stepSpinBoxChanged(int))); - connect(ui->ignoreMaxVolumeCheckBox, SIGNAL(toggled(bool)), this, SLOT(ignoreMaxVolumeCheckBoxChanged(bool))); - connect(ui->allwaysShowNotificationsCheckBox, &QAbstractButton::toggled, this, &LXQtVolumeConfiguration::allwaysShowNotificationsCheckBoxChanged); - - - // currently, this option is only supported by the pulse audio backend - if(!ui->pulseAudioRadioButton->isChecked()) - ui->ignoreMaxVolumeCheckBox->setEnabled(false); - - if (ossAvailable) - connect(ui->ossRadioButton, SIGNAL(toggled(bool)), this, SLOT(audioEngineChanged(bool))); - else - ui->ossRadioButton->setVisible(false); -#ifdef USE_PULSEAUDIO - connect(ui->pulseAudioRadioButton, SIGNAL(toggled(bool)), this, SLOT(audioEngineChanged(bool))); -#else - ui->pulseAudioRadioButton->setVisible(false); -#endif - -#ifdef USE_ALSA - connect(ui->alsaRadioButton, SIGNAL(toggled(bool)), this, SLOT(audioEngineChanged(bool))); -#else - ui->alsaRadioButton->setVisible(false); -#endif -} - -LXQtVolumeConfiguration::~LXQtVolumeConfiguration() -{ - delete ui; -} - -void LXQtVolumeConfiguration::setSinkList(const QList sinks) -{ - // preserve the current index, as we change the list - int tmp_index = settings().value(SETTINGS_DEVICE, SETTINGS_DEFAULT_DEVICE).toInt(); - - const bool old_block = ui->devAddedCombo->blockSignals(true); - ui->devAddedCombo->clear(); - - foreach (const AudioDevice *dev, sinks) { - ui->devAddedCombo->addItem(dev->description(), dev->index()); - } - - ui->devAddedCombo->setCurrentIndex(tmp_index); - ui->devAddedCombo->blockSignals(old_block); -} - -void LXQtVolumeConfiguration::audioEngineChanged(bool checked) -{ - if (!checked) - return; - - bool canIgnoreMaxVolume = false; - if (ui->pulseAudioRadioButton->isChecked()) - { - settings().setValue(SETTINGS_AUDIO_ENGINE, "PulseAudio"); - canIgnoreMaxVolume = true; - } - else if(ui->alsaRadioButton->isChecked()) - settings().setValue(SETTINGS_AUDIO_ENGINE, "Alsa"); - else - settings().setValue(SETTINGS_AUDIO_ENGINE, "Oss"); - ui->ignoreMaxVolumeCheckBox->setEnabled(canIgnoreMaxVolume); -} - -void LXQtVolumeConfiguration::sinkSelectionChanged(int index) -{ - settings().setValue(SETTINGS_DEVICE, index >= 0 ? index : 0); -} - -void LXQtVolumeConfiguration::showOnClickedChanged(bool state) -{ - settings().setValue(SETTINGS_SHOW_ON_LEFTCLICK, state); -} - -void LXQtVolumeConfiguration::muteOnMiddleClickChanged(bool state) -{ - settings().setValue(SETTINGS_MUTE_ON_MIDDLECLICK, state); -} - -void LXQtVolumeConfiguration::mixerLineEditChanged(const QString &command) -{ - settings().setValue(SETTINGS_MIXER_COMMAND, command); -} - -void LXQtVolumeConfiguration::stepSpinBoxChanged(int step) -{ - settings().setValue(SETTINGS_STEP, step); -} - -void LXQtVolumeConfiguration::ignoreMaxVolumeCheckBoxChanged(bool state) -{ - settings().setValue(SETTINGS_IGNORE_MAX_VOLUME, state); -} - -void LXQtVolumeConfiguration::allwaysShowNotificationsCheckBoxChanged(bool state) -{ - settings().setValue(SETTINGS_ALLWAYS_SHOW_NOTIFICATIONS, state); -} - -void LXQtVolumeConfiguration::loadSettings() -{ - QString engine = settings().value(SETTINGS_AUDIO_ENGINE, SETTINGS_DEFAULT_AUDIO_ENGINE).toString().toLower(); - if (engine == "pulseaudio") - ui->pulseAudioRadioButton->setChecked(true); - else if (engine == "alsa") - ui->alsaRadioButton->setChecked(true); - else - ui->ossRadioButton->setChecked(true); - - setComboboxIndexByData(ui->devAddedCombo, settings().value(SETTINGS_DEVICE, SETTINGS_DEFAULT_DEVICE), 1); - ui->showOnClickCheckBox->setChecked(settings().value(SETTINGS_SHOW_ON_LEFTCLICK, SETTINGS_DEFAULT_SHOW_ON_LEFTCLICK).toBool()); - ui->muteOnMiddleClickCheckBox->setChecked(settings().value(SETTINGS_MUTE_ON_MIDDLECLICK, SETTINGS_DEFAULT_MUTE_ON_MIDDLECLICK).toBool()); - ui->mixerLineEdit->setText(settings().value(SETTINGS_MIXER_COMMAND, SETTINGS_DEFAULT_MIXER_COMMAND).toString()); - ui->stepSpinBox->setValue(settings().value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt()); - ui->ignoreMaxVolumeCheckBox->setChecked(settings().value(SETTINGS_IGNORE_MAX_VOLUME, SETTINGS_DEFAULT_IGNORE_MAX_VOLUME).toBool()); - ui->allwaysShowNotificationsCheckBox->setChecked(settings().value(SETTINGS_ALLWAYS_SHOW_NOTIFICATIONS, SETTINGS_DEFAULT_ALLWAYS_SHOW_NOTIFICATIONS).toBool()); -} - diff --git a/plugin-volume/lxqtvolumeconfiguration.h b/plugin-volume/lxqtvolumeconfiguration.h deleted file mode 100644 index d20e6b5..0000000 --- a/plugin-volume/lxqtvolumeconfiguration.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: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * 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 LXQTVOLUMECONFIGURATION_H -#define LXQTVOLUMECONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" - -#include - -#define SETTINGS_MIXER_COMMAND "mixerCommand" -#define SETTINGS_SHOW_ON_LEFTCLICK "showOnLeftClick" -#define SETTINGS_MUTE_ON_MIDDLECLICK "showOnMiddleClick" -#define SETTINGS_DEVICE "device" -#define SETTINGS_STEP "volumeAdjustStep" -#define SETTINGS_IGNORE_MAX_VOLUME "ignoreMaxVolume" -#define SETTINGS_AUDIO_ENGINE "audioEngine" -#define SETTINGS_ALLWAYS_SHOW_NOTIFICATIONS "allwaysShowNotifications" - -#define SETTINGS_DEFAULT_SHOW_ON_LEFTCLICK true -#define SETTINGS_DEFAULT_MUTE_ON_MIDDLECLICK true -#define SETTINGS_DEFAULT_DEVICE 0 -#define SETTINGS_DEFAULT_STEP 3 -#ifdef USE_PULSEAUDIO - #define SETTINGS_DEFAULT_MIXER_COMMAND "pavucontrol" - #define SETTINGS_DEFAULT_AUDIO_ENGINE "PulseAudio" -#elif defined(USE_ALSA) - #define SETTINGS_DEFAULT_MIXER_COMMAND "qasmixer" - #define SETTINGS_DEFAULT_AUDIO_ENGINE "Alsa" -#else - #define SETTINGS_DEFAULT_MIXER_COMMAND "" - #define SETTINGS_DEFAULT_AUDIO_ENGINE "Oss" -#endif -#define SETTINGS_DEFAULT_IGNORE_MAX_VOLUME false -#define SETTINGS_DEFAULT_IGNORE_MAX_VOLUME false -#define SETTINGS_DEFAULT_ALLWAYS_SHOW_NOTIFICATIONS false - -class AudioDevice; - -namespace Ui { - class LXQtVolumeConfiguration; -} - -class LXQtVolumeConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtVolumeConfiguration(PluginSettings *settings, bool ossAvailable, QWidget *parent = nullptr); - ~LXQtVolumeConfiguration(); - -public slots: - void setSinkList(const QList sinks); - void audioEngineChanged(bool checked); - void sinkSelectionChanged(int index); - void showOnClickedChanged(bool state); - void muteOnMiddleClickChanged(bool state); - void mixerLineEditChanged(const QString &command); - void stepSpinBoxChanged(int step); - void ignoreMaxVolumeCheckBoxChanged(bool state); - void allwaysShowNotificationsCheckBoxChanged(bool state); - -protected slots: - virtual void loadSettings(); - -private: - Ui::LXQtVolumeConfiguration *ui; -}; - -#endif // LXQTVOLUMECONFIGURATION_H diff --git a/plugin-volume/lxqtvolumeconfiguration.ui b/plugin-volume/lxqtvolumeconfiguration.ui deleted file mode 100644 index 370edb1..0000000 --- a/plugin-volume/lxqtvolumeconfiguration.ui +++ /dev/null @@ -1,174 +0,0 @@ - - - LXQtVolumeConfiguration - - - - 0 - 0 - 306 - 407 - - - - Volume Control Settings - - - - - - Device to control - - - - - - - - Alsa - - - - - - - PulseAudio - - - - - - - OSS - - - - - - - - - - - - - - - Behavior - - - - - - Mute on middle click - - - - - - - Show on mouse click - - - - - - - Allow volume beyond 100% (0dB) - - - - - - - Always notify about volume changes - - - - - - - - - - 0 - 0 - - - - Volume adjust step - - - - - - - 1 - - - - - - - - - - - - External Mixer - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - - buttons - accepted() - LXQtVolumeConfiguration - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttons - rejected() - LXQtVolumeConfiguration - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/plugin-volume/ossengine.cpp b/plugin-volume/ossengine.cpp deleted file mode 100644 index 13b6b9c..0000000 --- a/plugin-volume/ossengine.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2014 LXQt team - * Authors: - * Hong Jen Yee (PCMan) - * - * 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 "ossengine.h" -#include "audiodevice.h" -#include - -#include -#include -#include -#include -#include -#include - -#if defined(__FreeBSD__) || defined(__NetBSD__) -#include -#elif defined(__linux__) || defined(__Linux__) -#include -#else -#error "Not supported platform" -#endif - -OssEngine::OssEngine(QObject *parent) : - AudioEngine(parent), - m_mixer(-1), - m_device(NULL), - m_leftVolume(0), - m_rightVolume(0) -{ - qDebug() << "OssEngine"; - initMixer(); -} - -OssEngine::~OssEngine() -{ - if(m_mixer >= 0) - close(m_mixer); -} - -void OssEngine::initMixer() { - m_mixer = open ("/dev/mixer", O_RDWR, 0); - if (m_mixer < 0) { - qDebug() << "/dev/mixer cannot be opened"; - return; - } - qDebug() << "InitMixer:" << m_mixer; - - m_device = new AudioDevice(Sink, this); - m_device->setName("Master"); - m_device->setIndex(0); - m_device->setDescription("Master Volume"); - m_device->setMuteNoCommit(false); - updateVolume(); - - m_sinks.append(m_device); - emit sinkListChanged(); -} - -void OssEngine::updateVolume() { - if(m_mixer < 0 || !m_device) - return; - int volumes; - if(ioctl(m_mixer, MIXER_READ(SOUND_MIXER_VOLUME), &volumes) < 0) { - qDebug() << "updateVolume() failed" << errno; - } - m_leftVolume = volumes & 0xff; // left - m_rightVolume = (volumes >> 8) & 0xff; // right - qDebug() << "volume:" << m_leftVolume << m_rightVolume; - - m_device->setVolumeNoCommit(m_leftVolume); -} - -void OssEngine::setVolume(int volume) { - if(m_mixer < 0) - return; - int volumes = (volume << 8) + volume; - if(ioctl(m_mixer, MIXER_WRITE(SOUND_MIXER_VOLUME), &volumes) < 0) { - qDebug() << "setVolume() failed" << errno; - } - else { - qDebug() << "setVolume()" << volume; - } -} - -void OssEngine::commitDeviceVolume(AudioDevice *device) -{ - if (!device) - return; - setVolume(device->volume()); -} - -void OssEngine::setMute(AudioDevice *device, bool state) -{ - if(state) - setVolume(0); - else - setVolume(m_leftVolume); -} - -void OssEngine::setIgnoreMaxVolume(bool ignore) -{ - // TODO -} diff --git a/plugin-volume/ossengine.h b/plugin-volume/ossengine.h deleted file mode 100644 index d13c836..0000000 --- a/plugin-volume/ossengine.h +++ /dev/null @@ -1,70 +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: - * Johannes Zellner - * - * 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 OSSENGINE_H -#define OSSENGINE_H - -#include "audioengine.h" - -#include -#include -#include - -class AudioDevice; - -class OssEngine : public AudioEngine -{ - Q_OBJECT - -public: - OssEngine(QObject *parent = 0); - ~OssEngine(); - - virtual const QString backendName() const { return QLatin1String("Oss"); } - virtual int volumeMax(AudioDevice */*device*/) const { return 100; } - - virtual void commitDeviceVolume(AudioDevice *device); - virtual void setMute(AudioDevice *device, bool state); - virtual void setIgnoreMaxVolume(bool ignore); - -signals: - void sinkInfoChanged(AudioDevice *device); - void readyChanged(bool ready); - -private: - void initMixer(); - void updateVolume(); - void setVolume(int volume); - -private: - int m_mixer; // oss mixer fd - AudioDevice* m_device; - int m_leftVolume; - int m_rightVolume; -}; - -#endif // OSSENGINE_H diff --git a/plugin-volume/pulseaudioengine.cpp b/plugin-volume/pulseaudioengine.cpp deleted file mode 100644 index 986be05..0000000 --- a/plugin-volume/pulseaudioengine.cpp +++ /dev/null @@ -1,426 +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: - * Johannes Zellner - * - * 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 "pulseaudioengine.h" - -#include "audiodevice.h" - -#include -#include - -//#define PULSEAUDIO_ENGINE_DEBUG - -static void sinkInfoCallback(pa_context *context, const pa_sink_info *info, int isLast, void *userdata) -{ - PulseAudioEngine *pulseEngine = static_cast(userdata); - QMap stateMap; - stateMap[PA_SINK_INVALID_STATE] = "n/a"; - stateMap[PA_SINK_RUNNING] = "RUNNING"; - stateMap[PA_SINK_IDLE] = "IDLE"; - stateMap[PA_SINK_SUSPENDED] = "SUSPENDED"; - - if (isLast < 0) { - pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0); - qWarning() << QString("Failed to get sink information: %1").arg(pa_strerror(pa_context_errno(context))); - return; - } - - if (isLast) { - pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0); - return; - } - - pulseEngine->addOrUpdateSink(info); -} - -static void contextEventCallback(pa_context *context, const char *name, pa_proplist *p, void *userdata) -{ -#ifdef PULSEAUDIO_ENGINE_DEBUG - qWarning("event received %s", name); -#endif -} - -static void contextStateCallback(pa_context *context, void *userdata) -{ - PulseAudioEngine *pulseEngine = reinterpret_cast(userdata); - - // update internal state - pa_context_state_t state = pa_context_get_state(context); - pulseEngine->setContextState(state); - -#ifdef PULSEAUDIO_ENGINE_DEBUG - switch (state) { - case PA_CONTEXT_UNCONNECTED: - qWarning("context unconnected"); - break; - case PA_CONTEXT_CONNECTING: - qWarning("context connecting"); - break; - case PA_CONTEXT_AUTHORIZING: - qWarning("context authorizing"); - break; - case PA_CONTEXT_SETTING_NAME: - qWarning("context setting name"); - break; - case PA_CONTEXT_READY: - qWarning("context ready"); - break; - case PA_CONTEXT_FAILED: - qWarning("context failed"); - break; - case PA_CONTEXT_TERMINATED: - qWarning("context terminated"); - break; - default: - qWarning("we should never hit this state"); - } -#endif - - pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0); -} - -static void contextSuccessCallback(pa_context *context, int success, void *userdata) -{ - Q_UNUSED(context); - Q_UNUSED(success); - Q_UNUSED(userdata); - - PulseAudioEngine *pulseEngine = reinterpret_cast(userdata); - pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0); -} - -static void contextSubscriptionCallback(pa_context *context, pa_subscription_event_type_t t, uint32_t idx, void *userdata) -{ - PulseAudioEngine *pulseEngine = reinterpret_cast(userdata); - if (PA_SUBSCRIPTION_EVENT_REMOVE == t) - pulseEngine->removeSink(idx); - else - pulseEngine->requestSinkInfoUpdate(idx); -} - - -PulseAudioEngine::PulseAudioEngine(QObject *parent) : - AudioEngine(parent), - m_context(0), - m_contextState(PA_CONTEXT_UNCONNECTED), - m_ready(false), - m_maximumVolume(PA_VOLUME_UI_MAX) -{ - qRegisterMetaType("pa_context_state_t"); - - m_reconnectionTimer.setSingleShot(true); - m_reconnectionTimer.setInterval(100); - connect(&m_reconnectionTimer, SIGNAL(timeout()), this, SLOT(connectContext())); - - m_mainLoop = pa_threaded_mainloop_new(); - if (m_mainLoop == 0) { - qWarning("Unable to create pulseaudio mainloop"); - return; - } - - if (pa_threaded_mainloop_start(m_mainLoop) != 0) { - qWarning("Unable to start pulseaudio mainloop"); - pa_threaded_mainloop_free(m_mainLoop); - m_mainLoop = 0; - return; - } - - m_mainLoopApi = pa_threaded_mainloop_get_api(m_mainLoop); - - connect(this, SIGNAL(contextStateChanged(pa_context_state_t)), this, SLOT(handleContextStateChanged())); - - connectContext(); -} - -PulseAudioEngine::~PulseAudioEngine() -{ - if (m_context) { - pa_context_unref(m_context); - m_context = 0; - } - - if (m_mainLoop) { - pa_threaded_mainloop_free(m_mainLoop); - m_mainLoop = 0; - } -} - -void PulseAudioEngine::removeSink(uint32_t idx) -{ - auto dev_i = std::find_if(m_sinks.begin(), m_sinks.end(), [idx] (AudioDevice * dev) { return dev->index() == idx; }); - if (m_sinks.end() == dev_i) - return; - - QScopedPointer dev{*dev_i}; - m_cVolumeMap.remove(dev.data()); - m_sinks.erase(dev_i); - emit sinkListChanged(); -} - -void PulseAudioEngine::addOrUpdateSink(const pa_sink_info *info) -{ - AudioDevice *dev = 0; - bool newSink = false; - QString name = QString::fromUtf8(info->name); - - foreach (AudioDevice *device, m_sinks) { - if (device->name() == name) { - dev = device; - break; - } - } - - if (!dev) { - dev = new AudioDevice(Sink, this); - newSink = true; - } - - dev->setName(name); - dev->setIndex(info->index); - dev->setDescription(QString::fromUtf8(info->description)); - dev->setMuteNoCommit(info->mute); - - // TODO: save separately? alsa does not have it - m_cVolumeMap.insert(dev, info->volume); - - pa_volume_t v = pa_cvolume_avg(&(info->volume)); - // convert real volume to percentage - dev->setVolumeNoCommit(qRound((static_cast(v) * 100.0) / m_maximumVolume)); - - if (newSink) { - //keep the sinks sorted by index() - m_sinks.insert( - std::lower_bound(m_sinks.begin(), m_sinks.end(), dev, [] (AudioDevice const * const a, AudioDevice const * const b) { - return a->name() < b->name(); - }) - , dev - ); - emit sinkListChanged(); - } -} - -void PulseAudioEngine::requestSinkInfoUpdate(uint32_t idx) -{ - emit sinkInfoChanged(idx); -} - -void PulseAudioEngine::commitDeviceVolume(AudioDevice *device) -{ - if (!device || !m_ready) - return; - - // convert from percentage to real volume value - pa_volume_t v = ((double)device->volume() / 100.0) * m_maximumVolume; - pa_cvolume tmpVolume = m_cVolumeMap.value(device); - pa_cvolume *volume = pa_cvolume_set(&tmpVolume, tmpVolume.channels, v); - // qDebug() << "PulseAudioEngine::commitDeviceVolume" << v; - pa_threaded_mainloop_lock(m_mainLoop); - - pa_operation *operation; - if (device->type() == Sink) - operation = pa_context_set_sink_volume_by_index(m_context, device->index(), volume, contextSuccessCallback, this); - else - operation = pa_context_set_source_volume_by_index(m_context, device->index(), volume, contextSuccessCallback, this); - - while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(m_mainLoop); - pa_operation_unref(operation); - - pa_threaded_mainloop_unlock(m_mainLoop); -} - -void PulseAudioEngine::retrieveSinks() -{ - if (!m_ready) - return; - - pa_threaded_mainloop_lock(m_mainLoop); - - pa_operation *operation; - operation = pa_context_get_sink_info_list(m_context, sinkInfoCallback, this); - while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(m_mainLoop); - pa_operation_unref(operation); - - pa_threaded_mainloop_unlock(m_mainLoop); -} - -void PulseAudioEngine::setupSubscription() -{ - if (!m_ready) - return; - - connect(this, &PulseAudioEngine::sinkInfoChanged, this, &PulseAudioEngine::retrieveSinkInfo, Qt::QueuedConnection); - pa_context_set_subscribe_callback(m_context, contextSubscriptionCallback, this); - - pa_threaded_mainloop_lock(m_mainLoop); - - pa_operation *operation; - operation = pa_context_subscribe(m_context, PA_SUBSCRIPTION_MASK_SINK, contextSuccessCallback, this); - while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(m_mainLoop); - pa_operation_unref(operation); - - pa_threaded_mainloop_unlock(m_mainLoop); -} - -void PulseAudioEngine::handleContextStateChanged() -{ - if (m_contextState == PA_CONTEXT_FAILED || m_contextState == PA_CONTEXT_TERMINATED) { - qWarning("LXQt-Volume: Context connection failed or terminated lets try to reconnect"); - m_reconnectionTimer.start(); - } -} - -void PulseAudioEngine::connectContext() -{ - bool keepGoing = true; - bool ok = false; - - m_reconnectionTimer.stop(); - - if (!m_mainLoop) - return; - - pa_threaded_mainloop_lock(m_mainLoop); - - if (m_context) { - pa_context_unref(m_context); - m_context = 0; - } - - m_context = pa_context_new(m_mainLoopApi, "lxqt-volume"); - pa_context_set_state_callback(m_context, contextStateCallback, this); - pa_context_set_event_callback(m_context, contextEventCallback, this); - - if (!m_context) { - pa_threaded_mainloop_unlock(m_mainLoop); - m_reconnectionTimer.start(); - return; - } - - if (pa_context_connect(m_context, NULL, (pa_context_flags_t)0, NULL) < 0) { - pa_threaded_mainloop_unlock(m_mainLoop); - m_reconnectionTimer.start(); - return; - } - - while (keepGoing) { - switch (m_contextState) { - case PA_CONTEXT_CONNECTING: - case PA_CONTEXT_AUTHORIZING: - case PA_CONTEXT_SETTING_NAME: - break; - - case PA_CONTEXT_READY: - keepGoing = false; - ok = true; - break; - - case PA_CONTEXT_TERMINATED: - keepGoing = false; - break; - - case PA_CONTEXT_FAILED: - default: - qWarning() << QString("Connection failure: %1").arg(pa_strerror(pa_context_errno(m_context))); - keepGoing = false; - } - - if (keepGoing) - pa_threaded_mainloop_wait(m_mainLoop); - } - - pa_threaded_mainloop_unlock(m_mainLoop); - - if (ok) { - retrieveSinks(); - setupSubscription(); - } else { - m_reconnectionTimer.start(); - } -} - -void PulseAudioEngine::retrieveSinkInfo(uint32_t idx) -{ - if (!m_ready) - return; - - pa_threaded_mainloop_lock(m_mainLoop); - - pa_operation *operation; - operation = pa_context_get_sink_info_by_index(m_context, idx, sinkInfoCallback, this); - while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(m_mainLoop); - pa_operation_unref(operation); - - pa_threaded_mainloop_unlock(m_mainLoop); -} - -void PulseAudioEngine::setMute(AudioDevice *device, bool state) -{ - if (!m_ready) - return; - - pa_threaded_mainloop_lock(m_mainLoop); - - pa_operation *operation; - operation = pa_context_set_sink_mute_by_index(m_context, device->index(), state, contextSuccessCallback, this); - while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(m_mainLoop); - pa_operation_unref(operation); - - pa_threaded_mainloop_unlock(m_mainLoop); -} - -void PulseAudioEngine::setContextState(pa_context_state_t state) -{ - if (m_contextState == state) - return; - - m_contextState = state; - - // update ready member as it depends on state - if (m_ready == (m_contextState == PA_CONTEXT_READY)) - return; - - m_ready = (m_contextState == PA_CONTEXT_READY); - - emit contextStateChanged(m_contextState); - emit readyChanged(m_ready); -} - -void PulseAudioEngine::setIgnoreMaxVolume(bool ignore) -{ - if (ignore) - m_maximumVolume = PA_VOLUME_UI_MAX; - else - m_maximumVolume = pa_sw_volume_from_dB(0); -} - - - diff --git a/plugin-volume/pulseaudioengine.h b/plugin-volume/pulseaudioengine.h deleted file mode 100644 index 3d5a191..0000000 --- a/plugin-volume/pulseaudioengine.h +++ /dev/null @@ -1,99 +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: - * Johannes Zellner - * - * 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 PULSEAUDIOENGINE_H -#define PULSEAUDIOENGINE_H - -#include "audioengine.h" - -#include -#include -#include -#include - -#include - -// PA_VOLUME_UI_MAX is only supported since pulseaudio 0.9.23 -#ifndef PA_VOLUME_UI_MAX -#define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0)) -#endif - -class AudioDevice; - -class PulseAudioEngine : public AudioEngine -{ - Q_OBJECT - -public: - PulseAudioEngine(QObject *parent = 0); - ~PulseAudioEngine(); - - virtual const QString backendName() const { return QLatin1String("PulseAudio"); } - - int volumeMax(AudioDevice */*device*/) const { return m_maximumVolume; } - - void requestSinkInfoUpdate(uint32_t idx); - void removeSink(uint32_t idx); - void addOrUpdateSink(const pa_sink_info *info); - - pa_context_state_t contextState() const { return m_contextState; } - bool ready() const { return m_ready; } - pa_threaded_mainloop *mainloop() const { return m_mainLoop; } - -public slots: - void commitDeviceVolume(AudioDevice *device); - void retrieveSinkInfo(uint32_t idx); - void setMute(AudioDevice *device, bool state); - void setContextState(pa_context_state_t state); - void setIgnoreMaxVolume(bool ignore); - -signals: - void sinkInfoChanged(uint32_t idx); - void contextStateChanged(pa_context_state_t state); - void readyChanged(bool ready); - -private slots: - void handleContextStateChanged(); - void connectContext(); - -private: - void retrieveSinks(); - void setupSubscription(); - - pa_mainloop_api *m_mainLoopApi; - pa_threaded_mainloop *m_mainLoop; - pa_context *m_context; - - pa_context_state_t m_contextState; - bool m_ready; - QTimer m_reconnectionTimer; - int m_maximumVolume; - - QMap m_cVolumeMap; -}; - -#endif // PULSEAUDIOENGINE_H diff --git a/plugin-volume/resources/volume.desktop.in b/plugin-volume/resources/volume.desktop.in deleted file mode 100644 index 754289f..0000000 --- a/plugin-volume/resources/volume.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. -Icon=multimedia-volume-control - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-volume/translations/volume_ar.desktop b/plugin-volume/translations/volume_ar.desktop deleted file mode 100644 index cc73cd1..0000000 --- a/plugin-volume/translations/volume_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=تحكّم بمستوى الصّوت -Comment[ar]=تحكّم بمستوى صوت النّظام وأطلق المازج المفضّل لك. diff --git a/plugin-volume/translations/volume_cs.desktop b/plugin-volume/translations/volume_cs.desktop deleted file mode 100644 index f6cafff..0000000 --- a/plugin-volume/translations/volume_cs.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs]=Ovládejte hlasitost systému a spusťte svůj upřednostňovaný směšovač. -Name[cs]=Ovládání hlasitosti diff --git a/plugin-volume/translations/volume_cs_CZ.desktop b/plugin-volume/translations/volume_cs_CZ.desktop deleted file mode 100644 index eac2099..0000000 --- a/plugin-volume/translations/volume_cs_CZ.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[cs_CZ]=Ovládejte hlasitost systému a spusťte svůj upřednostňovaný směšovač. -Name[cs_CZ]=Ovládání hlasitosti diff --git a/plugin-volume/translations/volume_da.desktop b/plugin-volume/translations/volume_da.desktop deleted file mode 100644 index c82bb76..0000000 --- a/plugin-volume/translations/volume_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. -Icon=multimedia-volume-control - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Lydstyrkekontrol -Comment[da]=Juster systemets lydstyrke og start din foretrukne mikser. diff --git a/plugin-volume/translations/volume_de.desktop b/plugin-volume/translations/volume_de.desktop deleted file mode 100644 index 32df5d6..0000000 --- a/plugin-volume/translations/volume_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Lautstärkeeinstellung -Comment[de]=Systemlautstärke einstellen und den bevorzugten Mischer starten. diff --git a/plugin-volume/translations/volume_el.desktop b/plugin-volume/translations/volume_el.desktop deleted file mode 100644 index 06bfdd9..0000000 --- a/plugin-volume/translations/volume_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Έλεγχος έντασης ήχου -Comment[el]=Ελέγξτε την ένταση ήχου του συστήματος και εκκινήστε τον προτιμώμενο μίκτη. diff --git a/plugin-volume/translations/volume_es.desktop b/plugin-volume/translations/volume_es.desktop deleted file mode 100644 index d8af16c..0000000 --- a/plugin-volume/translations/volume_es.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es]=Controla el volumen del sistema y lanza su mezclador preferido -Name[es]=Control de volumen diff --git a/plugin-volume/translations/volume_es_VE.desktop b/plugin-volume/translations/volume_es_VE.desktop deleted file mode 100644 index c4b0b93..0000000 --- a/plugin-volume/translations/volume_es_VE.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[es_VE]=Controla el volumen del sistema y lanza el mezclador escogido referido -Name[es_VE]=Control de volumen diff --git a/plugin-volume/translations/volume_eu.desktop b/plugin-volume/translations/volume_eu.desktop deleted file mode 100644 index dcf60e3..0000000 --- a/plugin-volume/translations/volume_eu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[eu]=Kontrolatu sistemaren bolumena eta abiarazi zure gogoko nahasgailua. -Name[eu]=Bolumen-kontrola diff --git a/plugin-volume/translations/volume_fi.desktop b/plugin-volume/translations/volume_fi.desktop deleted file mode 100644 index f6207c5..0000000 --- a/plugin-volume/translations/volume_fi.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[fi]=Hallitse järjestelmän äänenvoimakkuutta, ja käynnistä suosimasi mikseri. -Name[fi]=Äänenvoimakkuuden hallinta diff --git a/plugin-volume/translations/volume_fr.desktop b/plugin-volume/translations/volume_fr.desktop deleted file mode 100644 index 38e74b2..0000000 --- a/plugin-volume/translations/volume_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Volume audio -Comment[fr]=Réglage du volume audio du système et démarrage du mixeur. diff --git a/plugin-volume/translations/volume_hu.desktop b/plugin-volume/translations/volume_hu.desktop deleted file mode 100644 index c3e4153..0000000 --- a/plugin-volume/translations/volume_hu.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[hu]=A rendszer hangerejének beállítása -Name[hu]=Hangerőszabályzó diff --git a/plugin-volume/translations/volume_it.desktop b/plugin-volume/translations/volume_it.desktop deleted file mode 100644 index 6ae7b70..0000000 --- a/plugin-volume/translations/volume_it.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[it]=Controllo del volume -Comment[it]=Controlla il volume del sistema e avvia il mixer preferito - diff --git a/plugin-volume/translations/volume_ja.desktop b/plugin-volume/translations/volume_ja.desktop deleted file mode 100644 index bf5abf9..0000000 --- a/plugin-volume/translations/volume_ja.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name[ja]=音量調節 -Comment[ja]=システムの音量を制御したり、ミキサーを起動したりします - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-volume/translations/volume_lt.desktop b/plugin-volume/translations/volume_lt.desktop deleted file mode 100644 index beb1fa0..0000000 --- a/plugin-volume/translations/volume_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Garsio reguliavimas -Comment[lt]=Reguliuoti sistemos garsį ir paleisti pageidaujamą mašiklį. diff --git a/plugin-volume/translations/volume_pl.desktop b/plugin-volume/translations/volume_pl.desktop deleted file mode 100644 index 3cb3a5c..0000000 --- a/plugin-volume/translations/volume_pl.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pl]=Dopasuj poziom dźwięku i uruchom preferowany mikser. -Name[pl]=Regulacja poziomu dźwięku diff --git a/plugin-volume/translations/volume_pt.desktop b/plugin-volume/translations/volume_pt.desktop deleted file mode 100644 index d6b6497..0000000 --- a/plugin-volume/translations/volume_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Name[pt]=Controlo de volume -Comment[pt]=Controlar o volume do sistema e abrir o gestor de som diff --git a/plugin-volume/translations/volume_pt_BR.desktop b/plugin-volume/translations/volume_pt_BR.desktop deleted file mode 100644 index e242a85..0000000 --- a/plugin-volume/translations/volume_pt_BR.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[pt_BR]=Controla o volume do sistema e lança seu mixer preferido. -Name[pt_BR]=Controle de Volume diff --git a/plugin-volume/translations/volume_ro_RO.desktop b/plugin-volume/translations/volume_ro_RO.desktop deleted file mode 100644 index 53355fc..0000000 --- a/plugin-volume/translations/volume_ro_RO.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ro_RO]=Controlează volumul sistem și lansează mixerul dvs preferat -Name[ro_RO]=Control volum diff --git a/plugin-volume/translations/volume_ru.desktop b/plugin-volume/translations/volume_ru.desktop deleted file mode 100644 index 9881f27..0000000 --- a/plugin-volume/translations/volume_ru.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[ru]=Управлять громкостью звука в системе и запустить предпочитаемый микшер. -Name[ru]=Регулятор громкости \ No newline at end of file diff --git a/plugin-volume/translations/volume_th_TH.desktop b/plugin-volume/translations/volume_th_TH.desktop deleted file mode 100644 index ddd16a1..0000000 --- a/plugin-volume/translations/volume_th_TH.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[th_TH]=ควบคุมระดับเสียงของระบบและเรียกใช้ตัวผสมที่คุณต้องการ -Name[th_TH]=ควบคุมระดับเสียง diff --git a/plugin-volume/translations/volume_uk.desktop b/plugin-volume/translations/volume_uk.desktop deleted file mode 100644 index 444e4f7..0000000 --- a/plugin-volume/translations/volume_uk.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[uk]=Регулює системну гучність та запускає ваш улюблений мікшер -Name[uk]=Регулятор гучності diff --git a/plugin-volume/translations/volume_zh_CN.desktop b/plugin-volume/translations/volume_zh_CN.desktop deleted file mode 100644 index c6b1302..0000000 --- a/plugin-volume/translations/volume_zh_CN.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_CN]=控制系统音量并启动您喜欢的混音器。 -Name[zh_CN]=音量控制 diff --git a/plugin-volume/translations/volume_zh_TW.desktop b/plugin-volume/translations/volume_zh_TW.desktop deleted file mode 100644 index 629359f..0000000 --- a/plugin-volume/translations/volume_zh_TW.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=Volume control -Comment=Control the system's volume and launch your preferred mixer. - -#TRANSLATIONS_DIR=../translations - - -# Translations -Comment[zh_TW]=控制系統音量並啟動您喜愛的音量控制器 -Name[zh_TW]=音量控制 diff --git a/plugin-volume/volumebutton.cpp b/plugin-volume/volumebutton.cpp deleted file mode 100644 index 5186023..0000000 --- a/plugin-volume/volumebutton.cpp +++ /dev/null @@ -1,174 +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: - * Johannes Zellner - * - * 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 "volumebutton.h" - -#include "volumepopup.h" -#include "audiodevice.h" - -#include -#include -#include -#include - -#include -#include "../panel/ilxqtpanel.h" -#include "../panel/ilxqtpanelplugin.h" - -VolumeButton::VolumeButton(ILXQtPanelPlugin *plugin, QWidget* parent): - QToolButton(parent), - mPlugin(plugin), - m_panel(plugin->panel()), - m_showOnClick(true), - m_muteOnMiddleClick(true) -{ - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setAutoRaise(true); - setMouseTracking(true); - // initial icon for button. It will be replaced after devices scan. - // In the worst case - no soundcard/pulse - is found it remains - // in the button but at least the button is not blank ("invisible") - handleStockIconChanged("dialog-error"); - m_volumePopup = new VolumePopup(this); - - m_popupHideTimer.setInterval(1000); - connect(this, SIGNAL(clicked()), this, SLOT(toggleVolumeSlider())); - connect(&m_popupHideTimer, SIGNAL(timeout()), this, SLOT(hideVolumeSlider())); - - connect(m_volumePopup, SIGNAL(mouseEntered()), &m_popupHideTimer, SLOT(stop())); - connect(m_volumePopup, SIGNAL(mouseLeft()), &m_popupHideTimer, SLOT(start())); - - connect(m_volumePopup, SIGNAL(launchMixer()), this, SLOT(handleMixerLaunch())); - connect(m_volumePopup, SIGNAL(stockIconChanged(QString)), this, SLOT(handleStockIconChanged(QString))); -} - -VolumeButton::~VolumeButton() -{ -} - -void VolumeButton::setShowOnClicked(bool state) -{ - if (m_showOnClick == state) - return; - - m_showOnClick = state; -} - -void VolumeButton::setMuteOnMiddleClick(bool state) -{ - m_muteOnMiddleClick = state; -} - -void VolumeButton::setMixerCommand(const QString &command) -{ - m_mixerCommand = command; -} - -void VolumeButton::enterEvent(QEvent *event) -{ - if (!m_showOnClick) - showVolumeSlider(); - - m_popupHideTimer.stop(); -} - -void VolumeButton::mouseMoveEvent(QMouseEvent *event) -{ - // moving the tooltip must be achieved by chaging the text - // (hide/show - won't work because of the internal hide delay) - QString tooltip = toolTip(); - if (!tooltip.isEmpty()) - { - *(tooltip.rbegin()) = 'X'; - QToolTip::showText(event->globalPos(), tooltip); - QToolTip::showText(event->globalPos(), toolTip()); - } - QToolButton::mouseMoveEvent(event); -} - -void VolumeButton::leaveEvent(QEvent *event) -{ - m_popupHideTimer.start(); -} - -void VolumeButton::wheelEvent(QWheelEvent *event) -{ - m_volumePopup->handleWheelEvent(event); -} - -void VolumeButton::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() == Qt::MidButton && m_muteOnMiddleClick) { - if (m_volumePopup->device()) { - m_volumePopup->device()->toggleMute(); - return; - } - } - - QToolButton::mouseReleaseEvent(event); -} - -void VolumeButton::toggleVolumeSlider() -{ - if (m_volumePopup->isVisible()) { - hideVolumeSlider(); - } else { - showVolumeSlider(); - } -} - -void VolumeButton::showVolumeSlider() -{ - - if (m_volumePopup->isVisible()) - return; - - m_popupHideTimer.stop(); - m_volumePopup->updateGeometry(); - m_volumePopup->adjustSize(); - QRect pos = mPlugin->calculatePopupWindowPos(m_volumePopup->size()); - mPlugin->willShowWindow(m_volumePopup); - m_volumePopup->openAt(pos.topLeft(), Qt::TopLeftCorner); - m_volumePopup->activateWindow(); -} - -void VolumeButton::hideVolumeSlider() -{ - // qDebug() << "hideVolumeSlider"; - m_popupHideTimer.stop(); - m_volumePopup->hide(); -} - -void VolumeButton::handleMixerLaunch() -{ - QProcess::startDetached(m_mixerCommand); -} - -void VolumeButton::handleStockIconChanged(const QString &iconName) -{ - setIcon(XdgIcon::fromTheme(iconName)); -} diff --git a/plugin-volume/volumebutton.h b/plugin-volume/volumebutton.h deleted file mode 100644 index b275e29..0000000 --- a/plugin-volume/volumebutton.h +++ /dev/null @@ -1,78 +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: - * Johannes Zellner - * - * 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 VOLUMEBUTTON_H -#define VOLUMEBUTTON_H - -#include -#include - -class VolumePopup; -class ILXQtPanel; -class LXQtVolume; -class ILXQtPanelPlugin; - -class VolumeButton : public QToolButton -{ - Q_OBJECT -public: - VolumeButton(ILXQtPanelPlugin *plugin, QWidget* parent = 0); - ~VolumeButton(); - - void setShowOnClicked(bool state); - void setMuteOnMiddleClick(bool state); - void setMixerCommand(const QString &command); - - VolumePopup *volumePopup() const { return m_volumePopup; } - -public slots: - void hideVolumeSlider(); - void showVolumeSlider(); - -protected: - void enterEvent(QEvent *event) override; - void leaveEvent(QEvent *event) override; - void wheelEvent(QWheelEvent *event) override; - void mouseReleaseEvent(QMouseEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; - -private slots: - void toggleVolumeSlider(); - void handleMixerLaunch(); - void handleStockIconChanged(const QString &iconName); - -private: - VolumePopup *m_volumePopup; - ILXQtPanelPlugin *mPlugin; - ILXQtPanel *m_panel; - QTimer m_popupHideTimer; - bool m_showOnClick; - bool m_muteOnMiddleClick; - QString m_mixerCommand; -}; - -#endif // VOLUMEBUTTON_H diff --git a/plugin-volume/volumepopup.cpp b/plugin-volume/volumepopup.cpp deleted file mode 100644 index 5294ae8..0000000 --- a/plugin-volume/volumepopup.cpp +++ /dev/null @@ -1,259 +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: - * Johannes Zellner - * - * 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 "volumepopup.h" - -#include "audiodevice.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include "audioengine.h" -#include -#include - -VolumePopup::VolumePopup(QWidget* parent): - QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint), - m_pos(0,0), - m_anchor(Qt::TopLeftCorner), - m_device(0) -{ - m_mixerButton = new QPushButton(this); - m_mixerButton->setObjectName("MixerLink"); - m_mixerButton->setMinimumWidth(1); - m_mixerButton->setToolTip(tr("Launch mixer")); - m_mixerButton->setText(tr("Mi&xer")); - m_mixerButton->setAutoDefault(false); - - m_volumeSlider = new QSlider(Qt::Vertical, this); - m_volumeSlider->setTickPosition(QSlider::TicksBothSides); - m_volumeSlider->setTickInterval(10); - // the volume slider shows 0-100 and volumes of all devices - // should be converted to percentages. - m_volumeSlider->setRange(0, 100); - m_volumeSlider->installEventFilter(this); - - m_muteToggleButton = new QPushButton(this); - m_muteToggleButton->setIcon(XdgIcon::fromTheme(QStringList() << "audio-volume-muted")); - m_muteToggleButton->setCheckable(true); - m_muteToggleButton->setAutoDefault(false); - - QVBoxLayout *l = new QVBoxLayout(this); - l->setSpacing(0); - l->setMargin(0); - - l->addWidget(m_mixerButton, 0, Qt::AlignHCenter); - l->addWidget(m_volumeSlider, 0, Qt::AlignHCenter); - l->addWidget(m_muteToggleButton, 0, Qt::AlignHCenter); - - connect(m_mixerButton, SIGNAL(released()), this, SIGNAL(launchMixer())); - connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(handleSliderValueChanged(int))); - connect(m_muteToggleButton, SIGNAL(clicked()), this, SLOT(handleMuteToggleClicked())); -} - -bool VolumePopup::event(QEvent *event) -{ - if(event->type() == QEvent::WindowDeactivate) - { - // qDebug("QEvent::WindowDeactivate"); - hide(); - } - return QDialog::event(event); -} - -bool VolumePopup::eventFilter(QObject * watched, QEvent * event) -{ - if (watched == m_volumeSlider) - { - if (event->type() == QEvent::Wheel) - { - handleWheelEvent(dynamic_cast(event)); - return true; - } - return false; - } - return QDialog::eventFilter(watched, event); -} - -void VolumePopup::enterEvent(QEvent *event) -{ - emit mouseEntered(); -} - -void VolumePopup::leaveEvent(QEvent *event) -{ - // qDebug("leaveEvent"); - emit mouseLeft(); -} - -void VolumePopup::handleSliderValueChanged(int value) -{ - if (!m_device) - return; - // qDebug("VolumePopup::handleSliderValueChanged: %d\n", value); - m_device->setVolume(value); - QTimer::singleShot(0, this, [this] { QToolTip::showText(QCursor::pos(), m_volumeSlider->toolTip()); }); -} - -void VolumePopup::handleMuteToggleClicked() -{ - if (!m_device) - return; - - m_device->toggleMute(); -} - -void VolumePopup::handleDeviceVolumeChanged(int volume) -{ - // qDebug() << "handleDeviceVolumeChanged" << "volume" << volume << "max" << max; - // calling m_volumeSlider->setValue will trigger - // handleSliderValueChanged(), which set the device volume - // again, so we have to block the signals to avoid recursive - // signal emission. - m_volumeSlider->blockSignals(true); - m_volumeSlider->setValue(volume); - m_volumeSlider->setToolTip(QString("%1%").arg(volume)); - dynamic_cast(*parent()).setToolTip(m_volumeSlider->toolTip()); //parent is the button on panel - m_volumeSlider->blockSignals(false); - - // emit volumeChanged(percent); - updateStockIcon(); -} - -void VolumePopup::handleDeviceMuteChanged(bool mute) -{ - m_muteToggleButton->setChecked(mute); - updateStockIcon(); -} - -void VolumePopup::updateStockIcon() -{ - if (!m_device) - return; - - QString iconName; - if (m_device->volume() <= 0 || m_device->mute()) - iconName = "audio-volume-muted"; - else if (m_device->volume() <= 33) - iconName = "audio-volume-low"; - else if (m_device->volume() <= 66) - iconName = "audio-volume-medium"; - else - iconName = "audio-volume-high"; - - m_muteToggleButton->setIcon(XdgIcon::fromTheme(iconName)); - emit stockIconChanged(iconName); -} - -void VolumePopup::resizeEvent(QResizeEvent *event) -{ - QWidget::resizeEvent(event); - realign(); -} - -void VolumePopup::openAt(QPoint pos, Qt::Corner anchor) -{ - m_pos = pos; - m_anchor = anchor; - realign(); - show(); -} - -void VolumePopup::handleWheelEvent(QWheelEvent *event) -{ - m_volumeSlider->setSliderPosition(m_volumeSlider->sliderPosition() - + (event->angleDelta().y() / QWheelEvent::DefaultDeltasPerStep * m_volumeSlider->singleStep())); -} - -void VolumePopup::setDevice(AudioDevice *device) -{ - if (device == m_device) - return; - - // disconnect old device - if (m_device) - disconnect(m_device); - - m_device = device; - - if (m_device) { - m_muteToggleButton->setChecked(m_device->mute()); - handleDeviceVolumeChanged(m_device->volume()); - connect(m_device, SIGNAL(volumeChanged(int)), this, SLOT(handleDeviceVolumeChanged(int))); - connect(m_device, SIGNAL(muteChanged(bool)), this, SLOT(handleDeviceMuteChanged(bool))); - } - else - updateStockIcon(); - emit deviceChanged(); -} - -void VolumePopup::setSliderStep(int step) -{ - m_volumeSlider->setSingleStep(step); - m_volumeSlider->setPageStep(step * 10); -} - -void VolumePopup::realign() -{ - QRect rect; - rect.setSize(sizeHint()); - switch (m_anchor) - { - case Qt::TopLeftCorner: - rect.moveTopLeft(m_pos); - break; - - case Qt::TopRightCorner: - rect.moveTopRight(m_pos); - break; - - case Qt::BottomLeftCorner: - rect.moveBottomLeft(m_pos); - break; - - case Qt::BottomRightCorner: - rect.moveBottomRight(m_pos); - break; - - } - - QRect screen = QApplication::desktop()->availableGeometry(m_pos); - - if (rect.right() > screen.right()) - rect.moveRight(screen.right()); - - if (rect.bottom() > screen.bottom()) - rect.moveBottom(screen.bottom()); - - move(rect.topLeft()); -} diff --git a/plugin-volume/volumepopup.h b/plugin-volume/volumepopup.h deleted file mode 100644 index ce240af..0000000 --- a/plugin-volume/volumepopup.h +++ /dev/null @@ -1,86 +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: - * Johannes Zellner - * - * 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 VOLUMEPOPUP_H -#define VOLUMEPOPUP_H - -#include - -class QSlider; -class QPushButton; -class AudioDevice; - -class VolumePopup : public QDialog -{ - Q_OBJECT -public: - VolumePopup(QWidget* parent = 0); - - void openAt(QPoint pos, Qt::Corner anchor); - void handleWheelEvent(QWheelEvent *event); - - QSlider *volumeSlider() const { return m_volumeSlider; } - - AudioDevice *device() const { return m_device; } - void setDevice(AudioDevice *device); - void setSliderStep(int step); - -signals: - void mouseEntered(); - void mouseLeft(); - - // void volumeChanged(int value); - void deviceChanged(); - void launchMixer(); - void stockIconChanged(const QString &iconName); - -protected: - void resizeEvent(QResizeEvent *event) override; - void enterEvent(QEvent *event) override; - void leaveEvent(QEvent *event) override; - bool event(QEvent * event) override; - bool eventFilter(QObject * watched, QEvent * event) override; - -private slots: - void handleSliderValueChanged(int value); - void handleMuteToggleClicked(); - void handleDeviceVolumeChanged(int volume); - void handleDeviceMuteChanged(bool mute); - -private: - void realign(); - void updateStockIcon(); - - QSlider *m_volumeSlider; - QPushButton *m_mixerButton; - QPushButton *m_muteToggleButton; - QPoint m_pos; - Qt::Corner m_anchor; - AudioDevice *m_device; -}; - -#endif // VOLUMEPOPUP_H diff --git a/plugin-worldclock/CMakeLists.txt b/plugin-worldclock/CMakeLists.txt deleted file mode 100644 index 90d10c2..0000000 --- a/plugin-worldclock/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -set(PLUGIN "worldclock") - -set(HEADERS - lxqtworldclock.h - lxqtworldclockconfiguration.h - lxqtworldclockconfigurationtimezones.h - lxqtworldclockconfigurationmanualformat.h -) - -set(SOURCES - lxqtworldclock.cpp - lxqtworldclockconfiguration.cpp - lxqtworldclockconfigurationtimezones.cpp - lxqtworldclockconfigurationmanualformat.cpp -) - -set(UIS - lxqtworldclockconfiguration.ui - lxqtworldclockconfigurationtimezones.ui - lxqtworldclockconfigurationmanualformat.ui -) - -BUILD_LXQT_PLUGIN(${PLUGIN}) diff --git a/plugin-worldclock/lxqtworldclock.cpp b/plugin-worldclock/lxqtworldclock.cpp deleted file mode 100644 index 34c3696..0000000 --- a/plugin-worldclock/lxqtworldclock.cpp +++ /dev/null @@ -1,621 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012-2013 Razor team - * 2014 LXQt team - * Authors: - * Kuzma Shapran - * - * 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 "lxqtworldclock.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -LXQtWorldClock::LXQtWorldClock(const ILXQtPanelPluginStartupInfo &startupInfo): - QObject(), - ILXQtPanelPlugin(startupInfo), - mPopup(NULL), - mTimer(new QTimer(this)), - mUpdateInterval(1), - mAutoRotate(true), - mPopupContent(NULL) -{ - mMainWidget = new QWidget(); - mContent = new ActiveLabel(); - mRotatedWidget = new LXQt::RotatedWidget(*mContent, mMainWidget); - - mRotatedWidget->setTransferWheelEvent(true); - - QVBoxLayout *borderLayout = new QVBoxLayout(mMainWidget); - borderLayout->setContentsMargins(0, 0, 0, 0); - borderLayout->setSpacing(0); - borderLayout->addWidget(mRotatedWidget, 0, Qt::AlignCenter); - - mContent->setObjectName(QLatin1String("WorldClockContent")); - - mContent->setAlignment(Qt::AlignCenter); - - settingsChanged(); - - mTimer->setTimerType(Qt::PreciseTimer); - connect(mTimer, SIGNAL(timeout()), SLOT(timeout())); - - connect(mContent, SIGNAL(wheelScrolled(int)), SLOT(wheelScrolled(int))); -} - -LXQtWorldClock::~LXQtWorldClock() -{ - delete mMainWidget; -} - -void LXQtWorldClock::timeout() -{ - if (QDateTime{}.time().msec() > 500) - restartTimer(); - updateTimeText(); -} - -void LXQtWorldClock::updateTimeText() -{ - QDateTime now = QDateTime::currentDateTime(); - QString timeZoneName = mActiveTimeZone; - if (timeZoneName == QLatin1String("local")) - timeZoneName = QString::fromLatin1(QTimeZone::systemTimeZoneId()); - QTimeZone timeZone(timeZoneName.toLatin1()); - QDateTime tzNow = now.toTimeZone(timeZone); - - bool isUpToDate(true); - if (!mShownTime.isValid()) // first time or forced update - { - isUpToDate = false; - if (mUpdateInterval < 60000) - mShownTime = tzNow.addSecs(-tzNow.time().msec()); // s - else if (mUpdateInterval < 3600000) - mShownTime = tzNow.addSecs(-tzNow.time().second()); // m - else - mShownTime = tzNow.addSecs(-tzNow.time().minute() * 60 - tzNow.time().second()); // h - } - else - { - qint64 diff = mShownTime.secsTo(tzNow); - if (mUpdateInterval < 60000) - { - if (diff < 0 || diff >= 1) - { - isUpToDate = false; - mShownTime = tzNow.addSecs(-tzNow.time().msec()); - } - } - else if (mUpdateInterval < 3600000) - { - if (diff < 0 || diff >= 60) - { - isUpToDate = false; - mShownTime = tzNow.addSecs(-tzNow.time().second()); - } - } - else if (diff < 0 || diff >= 3600) - { - isUpToDate = false; - mShownTime = tzNow.addSecs(-tzNow.time().minute() * 60 - tzNow.time().second()); - } - } - - if (!isUpToDate) - { - mContent->setText(tzNow.toString(preformat(mFormat, timeZone, tzNow))); - mRotatedWidget->update(); - updatePopupContent(); - } -} - -void LXQtWorldClock::setTimeText() -{ - mShownTime = QDateTime(); // force an update - updateTimeText(); -} - -void LXQtWorldClock::restartTimer() -{ - mTimer->stop(); - // check the time every second even if the clock doesn't show seconds - // because otherwise, the shown time might be vey wrong after resume - mTimer->setInterval(1000); - - int delay = static_cast(1000 - (static_cast(QTime::currentTime().msecsSinceStartOfDay()) % 1000)); - QTimer::singleShot(delay, Qt::PreciseTimer, this, &LXQtWorldClock::updateTimeText); - QTimer::singleShot(delay, Qt::PreciseTimer, mTimer, SLOT(start())); -} - -void LXQtWorldClock::settingsChanged() -{ - PluginSettings *_settings = settings(); - - QString oldFormat = mFormat; - - mTimeZones.clear(); - - QList > array = _settings->readArray(QLatin1String("timeZones")); - for (const auto &map : array) - { - QString timeZoneName = map.value(QLatin1String("timeZone"), QString()).toString(); - mTimeZones.append(timeZoneName); - mTimeZoneCustomNames[timeZoneName] = map.value(QLatin1String("customName"), - QString()).toString(); - } - - if (mTimeZones.isEmpty()) - mTimeZones.append(QLatin1String("local")); - - mDefaultTimeZone = _settings->value(QLatin1String("defaultTimeZone"), QString()).toString(); - if (mDefaultTimeZone.isEmpty()) - mDefaultTimeZone = mTimeZones[0]; - mActiveTimeZone = mDefaultTimeZone; - - - bool longTimeFormatSelected = false; - - QString formatType = _settings->value(QLatin1String("formatType"), QString()).toString(); - QString dateFormatType = _settings->value(QLatin1String("dateFormatType"), QString()).toString(); - bool advancedManual = _settings->value(QLatin1String("useAdvancedManualFormat"), false).toBool(); - - // backward compatibility - if (formatType == QLatin1String("custom")) - { - formatType = QLatin1String("short-timeonly"); - dateFormatType = QLatin1String("short"); - advancedManual = true; - } - else if (formatType == QLatin1String("short")) - { - formatType = QLatin1String("short-timeonly"); - dateFormatType = QLatin1String("short"); - advancedManual = false; - } - else if ((formatType == QLatin1String("full")) || - (formatType == QLatin1String("long")) || - (formatType == QLatin1String("medium"))) - { - formatType = QLatin1String("long-timeonly"); - dateFormatType = QLatin1String("long"); - advancedManual = false; - } - - if (formatType == QLatin1String("long-timeonly")) - longTimeFormatSelected = true; - - bool timeShowSeconds = _settings->value(QLatin1String("timeShowSeconds"), false).toBool(); - bool timePadHour = _settings->value(QLatin1String("timePadHour"), false).toBool(); - bool timeAMPM = _settings->value(QLatin1String("timeAMPM"), false).toBool(); - - // timezone - bool showTimezone = _settings->value(QLatin1String("showTimezone"), false).toBool() && !longTimeFormatSelected; - - QString timezonePosition = _settings->value(QLatin1String("timezonePosition"), QString()).toString(); - QString timezoneFormatType = _settings->value(QLatin1String("timezoneFormatType"), QString()).toString(); - - // date - bool showDate = _settings->value(QLatin1String("showDate"), false).toBool(); - - QString datePosition = _settings->value(QLatin1String("datePosition"), QString()).toString(); - - bool dateShowYear = _settings->value(QLatin1String("dateShowYear"), false).toBool(); - bool dateShowDoW = _settings->value(QLatin1String("dateShowDoW"), false).toBool(); - bool datePadDay = _settings->value(QLatin1String("datePadDay"), false).toBool(); - bool dateLongNames = _settings->value(QLatin1String("dateLongNames"), false).toBool(); - - // advanced - QString customFormat = _settings->value(QLatin1String("customFormat"), tr("''HH:mm:ss'
'ddd, d MMM yyyy'
'TT'
'")).toString(); - - if (advancedManual) - mFormat = customFormat; - else - { - QLocale locale = QLocale(QLocale::AnyLanguage, QLocale().country()); - - if (formatType == QLatin1String("short-timeonly")) - mFormat = locale.timeFormat(QLocale::ShortFormat); - else if (formatType == QLatin1String("long-timeonly")) - mFormat = locale.timeFormat(QLocale::LongFormat); - else // if (formatType == QLatin1String("custom-timeonly")) - mFormat = QString(QLatin1String("%1:mm%2%3")).arg(timePadHour ? QLatin1String("hh") : QLatin1String("h")).arg(timeShowSeconds ? QLatin1String(":ss") : QLatin1String("")).arg(timeAMPM ? QLatin1String(" A") : QLatin1String("")); - - if (showTimezone) - { - QString timezonePortion; - if (timezoneFormatType == QLatin1String("short")) - timezonePortion = QLatin1String("TTTT"); - else if (timezoneFormatType == QLatin1String("long")) - timezonePortion = QLatin1String("TTTTT"); - else if (timezoneFormatType == QLatin1String("offset")) - timezonePortion = QLatin1String("T"); - else if (timezoneFormatType == QLatin1String("abbreviation")) - timezonePortion = QLatin1String("TTT"); - else if (timezoneFormatType == QLatin1String("iana")) - timezonePortion = QLatin1String("TT"); - else // if (timezoneFormatType == QLatin1String("custom")) - timezonePortion = QLatin1String("TTTTTT"); - - if (timezonePosition == QLatin1String("below")) - mFormat = mFormat + QLatin1String("'
'") + timezonePortion; - else if (timezonePosition == QLatin1String("above")) - mFormat = timezonePortion + QLatin1String("'
'") + mFormat; - else if (timezonePosition == QLatin1String("before")) - mFormat = timezonePortion + QLatin1String(" ") + mFormat; - else // if (timezonePosition == QLatin1String("after")) - mFormat = mFormat + QLatin1String(" ") + timezonePortion; - } - - if (showDate) - { - QString datePortion; - if (dateFormatType == QLatin1String("short")) - datePortion = locale.dateFormat(QLocale::ShortFormat); - else if (dateFormatType == QLatin1String("long")) - datePortion = locale.dateFormat(QLocale::LongFormat); - else if (dateFormatType == QLatin1String("iso")) - datePortion = QLatin1String("yyyy-MM-dd"); - else // if (dateFormatType == QLatin1String("custom")) - { - QString datePortionOrder; - QString dateLocale = locale.dateFormat(QLocale::ShortFormat).toLower(); - int yearIndex = dateLocale.indexOf("y"); - int monthIndex = dateLocale.indexOf("m"); - int dayIndex = dateLocale.indexOf("d"); - if (yearIndex < dayIndex) - // Big-endian (year, month, day) (yyyy MMMM dd, dddd) -> in some Asia countires like China or Japan - datePortionOrder = QLatin1String("%1%2%3 %4%5%6"); - else if (monthIndex < dayIndex) - // Middle-endian (month, day, year) (dddd, MMMM dd yyyy) -> USA - datePortionOrder = QLatin1String("%6%5%3 %4%2%1"); - else - // Little-endian (day, month, year) (dddd, dd MMMM yyyy) -> most of Europe - datePortionOrder = QLatin1String("%6%5%4 %3%2%1"); - datePortion = datePortionOrder.arg(dateShowYear ? QLatin1String("yyyy") : QLatin1String("")).arg(dateShowYear ? QLatin1String(" ") : QLatin1String("")).arg(dateLongNames ? QLatin1String("MMMM") : QLatin1String("MMM")).arg(datePadDay ? QLatin1String("dd") : QLatin1String("d")).arg(dateShowDoW ? QLatin1String(", ") : QLatin1String("")).arg(dateShowDoW ? (dateLongNames ? QLatin1String("dddd") : QLatin1String("ddd")) : QLatin1String("")); - } - - if (datePosition == QLatin1String("below")) - mFormat = mFormat + QLatin1String("'
'") + datePortion; - else if (datePosition == QLatin1String("above")) - mFormat = datePortion + QLatin1String("'
'") + mFormat; - else if (datePosition == QLatin1String("before")) - mFormat = datePortion + QLatin1String(" ") + mFormat; - else // if (datePosition == QLatin1String("after")) - mFormat = mFormat + QLatin1String(" ") + datePortion; - } - } - - - if ((oldFormat != mFormat)) - { - int update_interval; - QString format = mFormat; - format.replace(QRegExp(QLatin1String("'[^']*'")), QString()); - //don't support updating on milisecond basis -> big performance hit - if (format.contains(QLatin1String("s"))) - update_interval = 1000; - else if (format.contains(QLatin1String("m"))) - update_interval = 60000; - else - update_interval = 3600000; - - if (update_interval != mUpdateInterval) - { - mUpdateInterval = update_interval; - restartTimer(); - } - } - - bool autoRotate = settings()->value(QLatin1String("autoRotate"), true).toBool(); - if (autoRotate != mAutoRotate) - { - mAutoRotate = autoRotate; - realign(); - } - - if (mPopup) - { - updatePopupContent(); - mPopup->adjustSize(); - mPopup->setGeometry(calculatePopupWindowPos(mPopup->size())); - } - - setTimeText(); -} - -QDialog *LXQtWorldClock::configureDialog() -{ - return new LXQtWorldClockConfiguration(settings()); -} - -void LXQtWorldClock::wheelScrolled(int delta) -{ - if (mTimeZones.count() > 1) - { - mActiveTimeZone = mTimeZones[(mTimeZones.indexOf(mActiveTimeZone) + ((delta > 0) ? -1 : 1) + mTimeZones.size()) % mTimeZones.size()]; - setTimeText(); - } -} - -void LXQtWorldClock::activated(ActivationReason reason) -{ - switch (reason) - { - case ILXQtPanelPlugin::Trigger: - case ILXQtPanelPlugin::MiddleClick: - break; - - default: - return; - } - - if (!mPopup) - { - mPopup = new LXQtWorldClockPopup(mContent); - connect(mPopup, SIGNAL(deactivated()), SLOT(deletePopup())); - - if (reason == ILXQtPanelPlugin::Trigger) - { - mPopup->setObjectName(QLatin1String("WorldClockCalendar")); - - mPopup->layout()->setContentsMargins(0, 0, 0, 0); - QCalendarWidget *calendarWidget = new QCalendarWidget(mPopup); - mPopup->layout()->addWidget(calendarWidget); - - QString timeZoneName = mActiveTimeZone; - if (timeZoneName == QLatin1String("local")) - timeZoneName = QString::fromLatin1(QTimeZone::systemTimeZoneId()); - - QTimeZone timeZone(timeZoneName.toLatin1()); - calendarWidget->setFirstDayOfWeek(QLocale(QLocale::AnyLanguage, timeZone.country()).firstDayOfWeek()); - calendarWidget->setSelectedDate(QDateTime::currentDateTime().toTimeZone(timeZone).date()); - } - else - { - mPopup->setObjectName(QLatin1String("WorldClockPopup")); - - mPopupContent = new QLabel(mPopup); - mPopup->layout()->addWidget(mPopupContent); - mPopupContent->setAlignment(mContent->alignment()); - - updatePopupContent(); - } - - mPopup->adjustSize(); - mPopup->setGeometry(calculatePopupWindowPos(mPopup->size())); - - willShowWindow(mPopup); - mPopup->show(); - } - else - { - deletePopup(); - } -} - -void LXQtWorldClock::deletePopup() -{ - mPopupContent = NULL; - mPopup->deleteLater(); - mPopup = NULL; -} - -QString LXQtWorldClock::formatDateTime(const QDateTime &datetime, const QString &timeZoneName) -{ - QTimeZone timeZone(timeZoneName.toLatin1()); - QDateTime tzNow = datetime.toTimeZone(timeZone); - return tzNow.toString(preformat(mFormat, timeZone, tzNow)); -} - -void LXQtWorldClock::updatePopupContent() -{ - if (mPopupContent) - { - QDateTime now = QDateTime::currentDateTime(); - QStringList allTimeZones; - bool hasTimeZone = formatHasTimeZone(mFormat); - - foreach (QString timeZoneName, mTimeZones) - { - if (timeZoneName == QLatin1String("local")) - timeZoneName = QString::fromLatin1(QTimeZone::systemTimeZoneId()); - - QString formatted = formatDateTime(now, timeZoneName); - - if (!hasTimeZone) - formatted += QLatin1String("
") + QString::fromLatin1(QTimeZone(timeZoneName.toLatin1()).id()); - - allTimeZones.append(formatted); - } - - mPopupContent->setText(allTimeZones.join(QLatin1String("
"))); - } -} - -bool LXQtWorldClock::formatHasTimeZone(QString format) -{ - format.replace(QRegExp(QLatin1String("'[^']*'")), QString()); - return format.toLower().contains(QLatin1String("t")); -} - -QString LXQtWorldClock::preformat(const QString &format, const QTimeZone &timeZone, const QDateTime &dateTime) -{ - QString result = format; - int from = 0; - for (;;) - { - int apos = result.indexOf(QLatin1Char('\''), from); - int tz = result.indexOf(QLatin1Char('T'), from); - if ((apos != -1) && (tz != -1)) - { - if (apos > tz) - apos = -1; - else - tz = -1; - } - if (apos != -1) - { - from = apos + 1; - apos = result.indexOf(QLatin1Char('\''), from); - if (apos == -1) // misformat - break; - from = apos + 1; - } - else if (tz != -1) - { - int length = 1; - for (; result[tz + length] == QLatin1Char('T'); ++length); - if (length > 6) - length = 6; - QString replacement; - switch (length) - { - case 1: - replacement = timeZone.displayName(dateTime, QTimeZone::OffsetName); - if (replacement.startsWith(QLatin1String("UTC"))) - replacement = replacement.mid(3); - break; - - case 2: - replacement = QString::fromLatin1(timeZone.id()); - break; - - case 3: - replacement = timeZone.abbreviation(dateTime); - break; - - case 4: - replacement = timeZone.displayName(dateTime, QTimeZone::ShortName); - break; - - case 5: - replacement = timeZone.displayName(dateTime, QTimeZone::LongName); - break; - - case 6: - replacement = mTimeZoneCustomNames[QString::fromLatin1(timeZone.id())]; - } - - if ((tz > 0) && (result[tz - 1] == QLatin1Char('\''))) - { - --tz; - ++length; - } - else - replacement.prepend(QLatin1Char('\'')); - - if (result[tz + length] == QLatin1Char('\'')) - ++length; - else - replacement.append(QLatin1Char('\'')); - - result.replace(tz, length, replacement); - from = tz + replacement.length(); - } - else - break; - } - return result; -} - -void LXQtWorldClock::realign() -{ - if (mAutoRotate) - switch (panel()->position()) - { - case ILXQtPanel::PositionTop: - case ILXQtPanel::PositionBottom: - mRotatedWidget->setOrigin(Qt::TopLeftCorner); - break; - - case ILXQtPanel::PositionLeft: - mRotatedWidget->setOrigin(Qt::BottomLeftCorner); - break; - - case ILXQtPanel::PositionRight: - mRotatedWidget->setOrigin(Qt::TopRightCorner); - break; - } - else - mRotatedWidget->setOrigin(Qt::TopLeftCorner); -} - -ActiveLabel::ActiveLabel(QWidget *parent) : - QLabel(parent) -{ -} - -void ActiveLabel::wheelEvent(QWheelEvent *event) -{ - emit wheelScrolled(event->delta()); - - QLabel::wheelEvent(event); -} - -void ActiveLabel::mouseReleaseEvent(QMouseEvent* event) -{ - switch (event->button()) - { - case Qt::LeftButton: - emit leftMouseButtonClicked(); - break; - - case Qt::MidButton: - emit middleMouseButtonClicked(); - break; - - default:; - } - - QLabel::mouseReleaseEvent(event); -} - -LXQtWorldClockPopup::LXQtWorldClockPopup(QWidget *parent) : - QDialog(parent, Qt::Window | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint) -{ - setLayout(new QHBoxLayout(this)); - layout()->setMargin(1); -} - -void LXQtWorldClockPopup::show() -{ - QDialog::show(); - activateWindow(); -} - -bool LXQtWorldClockPopup::event(QEvent *event) -{ - if (event->type() == QEvent::Close) - emit deactivated(); - - return QDialog::event(event); -} diff --git a/plugin-worldclock/lxqtworldclock.h b/plugin-worldclock/lxqtworldclock.h deleted file mode 100644 index 50d1073..0000000 --- a/plugin-worldclock/lxqtworldclock.h +++ /dev/null @@ -1,147 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012-2013 Razor team - * 2014 LXQt team - * Authors: - * Kuzma Shapran - * - * 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 LXQT_PANEL_WORLDCLOCK_H -#define LXQT_PANEL_WORLDCLOCK_H - -#include - -#include -#include - -#include - -#include "../panel/ilxqtpanelplugin.h" -#include "lxqtworldclockconfiguration.h" - - -class ActiveLabel; -class QTimer; -class LXQtWorldClockPopup; - - -class LXQtWorldClock : public QObject, public ILXQtPanelPlugin -{ - Q_OBJECT -public: - LXQtWorldClock(const ILXQtPanelPluginStartupInfo &startupInfo); - ~LXQtWorldClock(); - - virtual QWidget *widget() { return mMainWidget; } - virtual QString themeId() const { return QLatin1String("WorldClock"); } - virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog ; } - bool isSeparate() const { return true; } - void activated(ActivationReason reason); - - virtual void settingsChanged(); - virtual void realign(); - QDialog *configureDialog(); - -private slots: - void timeout(); - void wheelScrolled(int); - void deletePopup(); - void updateTimeText(); - -private: - QWidget *mMainWidget; - LXQt::RotatedWidget* mRotatedWidget; - ActiveLabel *mContent; - LXQtWorldClockPopup* mPopup; - - QTimer *mTimer; - int mUpdateInterval; - - QStringList mTimeZones; - QMap mTimeZoneCustomNames; - QString mDefaultTimeZone; - QString mActiveTimeZone; - QString mFormat; - - bool mAutoRotate; - QLabel *mPopupContent; - - QDateTime mShownTime; - - void restartTimer(); - - void setTimeText(); - QString formatDateTime(const QDateTime &datetime, const QString &timeZoneName); - void updatePopupContent(); - bool formatHasTimeZone(QString format); - QString preformat(const QString &format, const QTimeZone &timeZone, const QDateTime& dateTime); -}; - - -class ActiveLabel : public QLabel -{ -Q_OBJECT - -public: - explicit ActiveLabel(QWidget * = NULL); - -signals: - void wheelScrolled(int); - void leftMouseButtonClicked(); - void middleMouseButtonClicked(); - -protected: - void wheelEvent(QWheelEvent *); - void mouseReleaseEvent(QMouseEvent* event); -}; - -class LXQtWorldClockPopup : public QDialog -{ - Q_OBJECT - -public: - LXQtWorldClockPopup(QWidget *parent = 0); - - void show(); - -signals: - void deactivated(); - -protected: - virtual bool event(QEvent* ); - -}; - -class LXQtWorldClockLibrary: public QObject, public ILXQtPanelPluginLibrary -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0") - Q_INTERFACES(ILXQtPanelPluginLibrary) -public: - ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) const - { - return new LXQtWorldClock(startupInfo); - } -}; - -#endif // LXQT_PANEL_WORLDCLOCK_H diff --git a/plugin-worldclock/lxqtworldclockconfiguration.cpp b/plugin-worldclock/lxqtworldclockconfiguration.cpp deleted file mode 100644 index d0e759f..0000000 --- a/plugin-worldclock/lxqtworldclockconfiguration.cpp +++ /dev/null @@ -1,653 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * 2014 LXQt team - * Authors: - * Kuzma Shapran - * - * 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 "lxqtworldclockconfiguration.h" - -#include "ui_lxqtworldclockconfiguration.h" - -#include "lxqtworldclockconfigurationtimezones.h" -#include "lxqtworldclockconfigurationmanualformat.h" - -#include - - -LXQtWorldClockConfiguration::LXQtWorldClockConfiguration(PluginSettings *settings, QWidget *parent) : - LXQtPanelPluginConfigDialog(settings, parent), - ui(new Ui::LXQtWorldClockConfiguration), - mLockCascadeSettingChanges(false), - mConfigurationTimeZones(nullptr), - mConfigurationManualFormat(nullptr) -{ - setAttribute(Qt::WA_DeleteOnClose); - setObjectName(QLatin1String("WorldClockConfigurationWindow")); - ui->setupUi(this); - - connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); - - connect(ui->timeFormatCB, SIGNAL(currentIndexChanged(int)), SLOT(saveSettings())); - connect(ui->timeShowSecondsCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->timePadHourCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->timeAMPMCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->timezoneGB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->timezonePositionCB, SIGNAL(currentIndexChanged(int)), SLOT(saveSettings())); - connect(ui->timezoneFormatCB, SIGNAL(currentIndexChanged(int)), SLOT(saveSettings())); - connect(ui->dateGB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->datePositionCB, SIGNAL(currentIndexChanged(int)), SLOT(saveSettings())); - connect(ui->dateFormatCB, SIGNAL(currentIndexChanged(int)), SLOT(saveSettings())); - connect(ui->dateShowYearCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->dateShowDoWCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->datePadDayCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->dateLongNamesCB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->advancedManualGB, SIGNAL(clicked()), SLOT(saveSettings())); - connect(ui->customisePB, SIGNAL(clicked()), SLOT(customiseManualFormatClicked())); - - - connect(ui->timeFormatCB, SIGNAL(currentIndexChanged(int)), SLOT(timeFormatChanged(int))); - connect(ui->dateGB, SIGNAL(toggled(bool)), SLOT(dateGroupToggled(bool))); - connect(ui->dateFormatCB, SIGNAL(currentIndexChanged(int)), SLOT(dateFormatChanged(int))); - connect(ui->advancedManualGB, SIGNAL(toggled(bool)), SLOT(advancedFormatToggled(bool))); - - connect(ui->timeZonesTW, SIGNAL(itemSelectionChanged()), SLOT(updateTimeZoneButtons())); - connect(ui->addPB, SIGNAL(clicked()), SLOT(addTimeZone())); - connect(ui->removePB, SIGNAL(clicked()), SLOT(removeTimeZone())); - connect(ui->setAsDefaultPB, SIGNAL(clicked()), SLOT(setTimeZoneAsDefault())); - connect(ui->editCustomNamePB, SIGNAL(clicked()), SLOT(editTimeZoneCustomName())); - connect(ui->moveUpPB, SIGNAL(clicked()), SLOT(moveTimeZoneUp())); - connect(ui->moveDownPB, SIGNAL(clicked()), SLOT(moveTimeZoneDown())); - - connect(ui->autorotateCB, SIGNAL(clicked()), SLOT(saveSettings())); - - loadSettings(); -} - -LXQtWorldClockConfiguration::~LXQtWorldClockConfiguration() -{ - delete ui; -} - -void LXQtWorldClockConfiguration::loadSettings() -{ - mLockCascadeSettingChanges = true; - - bool longTimeFormatSelected = false; - - QString formatType = settings().value(QLatin1String("formatType"), QString()).toString(); - QString dateFormatType = settings().value(QLatin1String("dateFormatType"), QString()).toString(); - bool advancedManual = settings().value(QLatin1String("useAdvancedManualFormat"), false).toBool(); - mManualFormat = settings().value(QLatin1String("customFormat"), tr("''HH:mm:ss'
'ddd, d MMM yyyy'
'TT'
'")).toString(); - - // backward compatibility - if (formatType == QLatin1String("custom")) - { - formatType = QLatin1String("short-timeonly"); - dateFormatType = QLatin1String("short"); - advancedManual = true; - } - else if (formatType == QLatin1String("short")) - { - formatType = QLatin1String("short-timeonly"); - dateFormatType = QLatin1String("short"); - advancedManual = false; - } - else if ((formatType == QLatin1String("full")) || - (formatType == QLatin1String("long")) || - (formatType == QLatin1String("medium"))) - { - formatType = QLatin1String("long-timeonly"); - dateFormatType = QLatin1String("long"); - advancedManual = false; - } - - - if (formatType == QLatin1String("short-timeonly")) - ui->timeFormatCB->setCurrentIndex(0); - else if (formatType == QLatin1String("long-timeonly")) - { - ui->timeFormatCB->setCurrentIndex(1); - longTimeFormatSelected = true; - } - else // if (formatType == QLatin1String("custom-timeonly")) - ui->timeFormatCB->setCurrentIndex(2); - - ui->timeShowSecondsCB->setChecked(settings().value(QLatin1String("timeShowSeconds"), false).toBool() ? Qt::Checked : Qt:: Unchecked); - ui->timePadHourCB->setChecked(settings().value(QLatin1String("timePadHour"), false).toBool() ? Qt::Checked : Qt:: Unchecked); - ui->timeAMPMCB->setChecked(settings().value(QLatin1String("timeAMPM"), false).toBool() ? Qt::Checked : Qt:: Unchecked); - - bool customTimeFormatSelected = ui->timeFormatCB->currentIndex() == ui->timeFormatCB->count() - 1; - ui->timeCustomW->setEnabled(customTimeFormatSelected); - - ui->timezoneGB->setEnabled(!longTimeFormatSelected); - - // timezone - ui->timezoneGB->setChecked(settings().value(QLatin1String("showTimezone"), false).toBool() && !longTimeFormatSelected); - - QString timezonePosition = settings().value(QLatin1String("timezonePosition"), QString()).toString(); - if (timezonePosition == QLatin1String("above")) - ui->timezonePositionCB->setCurrentIndex(1); - else if (timezonePosition == QLatin1String("before")) - ui->timezonePositionCB->setCurrentIndex(2); - else if (timezonePosition == QLatin1String("after")) - ui->timezonePositionCB->setCurrentIndex(3); - else // if (timezonePosition == QLatin1String("below")) - ui->timezonePositionCB->setCurrentIndex(0); - - QString timezoneFormatType = settings().value(QLatin1String("timezoneFormatType"), QString()).toString(); - if (timezoneFormatType == QLatin1String("short")) - ui->timezoneFormatCB->setCurrentIndex(0); - else if (timezoneFormatType == QLatin1String("long")) - ui->timezoneFormatCB->setCurrentIndex(1); - else if (timezoneFormatType == QLatin1String("offset")) - ui->timezoneFormatCB->setCurrentIndex(2); - else if (timezoneFormatType == QLatin1String("abbreviation")) - ui->timezoneFormatCB->setCurrentIndex(3); - else // if (timezoneFormatType == QLatin1String("iana")) - ui->timezoneFormatCB->setCurrentIndex(4); - - // date - bool dateIsChecked = settings().value(QLatin1String("showDate"), false).toBool(); - ui->dateGB->setChecked(dateIsChecked); - - QString datePosition = settings().value(QLatin1String("datePosition"), QString()).toString(); - if (datePosition == QLatin1String("above")) - ui->datePositionCB->setCurrentIndex(1); - else if (datePosition == QLatin1String("before")) - ui->datePositionCB->setCurrentIndex(2); - else if (datePosition == QLatin1String("after")) - ui->datePositionCB->setCurrentIndex(3); - else // if (datePosition == QLatin1String("below")) - ui->datePositionCB->setCurrentIndex(0); - - if (dateFormatType == QLatin1String("short")) - ui->dateFormatCB->setCurrentIndex(0); - else if (dateFormatType == QLatin1String("long")) - ui->dateFormatCB->setCurrentIndex(1); - else if (dateFormatType == QLatin1String("iso")) - ui->dateFormatCB->setCurrentIndex(2); - else // if (dateFormatType == QLatin1String("custom")) - ui->dateFormatCB->setCurrentIndex(3); - - ui->dateShowYearCB->setChecked(settings().value(QLatin1String("dateShowYear"), false).toBool() ? Qt::Checked : Qt:: Unchecked); - ui->dateShowDoWCB->setChecked(settings().value(QLatin1String("dateShowDoW"), false).toBool() ? Qt::Checked : Qt:: Unchecked); - ui->datePadDayCB->setChecked(settings().value(QLatin1String("datePadDay"), false).toBool() ? Qt::Checked : Qt:: Unchecked); - ui->dateLongNamesCB->setChecked(settings().value(QLatin1String("dateLongNames"), false).toBool() ? Qt::Checked : Qt:: Unchecked); - - bool customDateFormatSelected = ui->dateFormatCB->currentIndex() == ui->dateFormatCB->count() - 1; - ui->dateCustomW->setEnabled(dateIsChecked && customDateFormatSelected); - - - ui->advancedManualGB->setChecked(advancedManual); - - - mDefaultTimeZone = settings().value("defaultTimeZone", QString()).toString(); - - ui->timeZonesTW->setRowCount(0); - - QList > list = settings().readArray(QLatin1String("timeZones")); - int i = 0; - for (const auto &map : list) - { - ui->timeZonesTW->setRowCount(ui->timeZonesTW->rowCount() + 1); - - QString timeZoneName = map.value(QLatin1String("timeZone"), QString()).toString(); - if (mDefaultTimeZone.isEmpty()) - mDefaultTimeZone = timeZoneName; - - ui->timeZonesTW->setItem(i, 0, new QTableWidgetItem(timeZoneName)); - ui->timeZonesTW->setItem(i, 1, new QTableWidgetItem(map.value(QLatin1String("customName"), - QString()).toString())); - - setBold(i, mDefaultTimeZone == timeZoneName); - ++i; - } - - ui->timeZonesTW->resizeColumnsToContents(); - - - ui->autorotateCB->setChecked(settings().value("autoRotate", true).toBool()); - - - mLockCascadeSettingChanges = false; -} - -void LXQtWorldClockConfiguration::saveSettings() -{ - if (mLockCascadeSettingChanges) - return; - - QString formatType; - switch (ui->timeFormatCB->currentIndex()) - { - case 0: - formatType = QLatin1String("short-timeonly"); - break; - - case 1: - formatType = QLatin1String("long-timeonly"); - break; - - case 2: - formatType = QLatin1String("custom-timeonly"); - break; - } - settings().setValue(QLatin1String("formatType"), formatType); - - settings().setValue(QLatin1String("timeShowSeconds"), ui->timeShowSecondsCB->isChecked()); - settings().setValue(QLatin1String("timePadHour"), ui->timePadHourCB->isChecked()); - settings().setValue(QLatin1String("timeAMPM"), ui->timeAMPMCB->isChecked()); - - settings().setValue(QLatin1String("showTimezone"), ui->timezoneGB->isChecked()); - - QString timezonePosition; - switch (ui->timezonePositionCB->currentIndex()) - { - case 0: - timezonePosition = QLatin1String("below"); - break; - - case 1: - timezonePosition = QLatin1String("above"); - break; - - case 2: - timezonePosition = QLatin1String("before"); - break; - - case 3: - timezonePosition = QLatin1String("after"); - break; - } - settings().setValue(QLatin1String("timezonePosition"), timezonePosition); - - QString timezoneFormatType; - switch (ui->timezoneFormatCB->currentIndex()) - { - case 0: - timezoneFormatType = QLatin1String("short"); - break; - - case 1: - timezoneFormatType = QLatin1String("long"); - break; - - case 2: - timezoneFormatType = QLatin1String("offset"); - break; - - case 3: - timezoneFormatType = QLatin1String("abbreviation"); - break; - - case 4: - timezoneFormatType = QLatin1String("iana"); - break; - } - settings().setValue(QLatin1String("timezoneFormatType"), timezoneFormatType); - - settings().setValue(QLatin1String("showDate"), ui->dateGB->isChecked()); - - QString datePosition; - switch (ui->datePositionCB->currentIndex()) - { - case 0: - datePosition = QLatin1String("below"); - break; - - case 1: - datePosition = QLatin1String("above"); - break; - - case 2: - datePosition = QLatin1String("before"); - break; - - case 3: - datePosition = QLatin1String("after"); - break; - } - settings().setValue(QLatin1String("datePosition"), datePosition); - - QString dateFormatType; - switch (ui->dateFormatCB->currentIndex()) - { - case 0: - dateFormatType = QLatin1String("short"); - break; - - case 1: - dateFormatType = QLatin1String("long"); - break; - - case 2: - dateFormatType = QLatin1String("iso"); - break; - - case 3: - dateFormatType = QLatin1String("custom"); - break; - } - settings().setValue(QLatin1String("dateFormatType"), dateFormatType); - - settings().setValue(QLatin1String("dateShowYear"), ui->dateShowYearCB->isChecked()); - settings().setValue(QLatin1String("dateShowDoW"), ui->dateShowDoWCB->isChecked()); - settings().setValue(QLatin1String("datePadDay"), ui->datePadDayCB->isChecked()); - settings().setValue(QLatin1String("dateLongNames"), ui->dateLongNamesCB->isChecked()); - - settings().setValue(QLatin1String("customFormat"), mManualFormat); - - settings().remove(QLatin1String("timeZones")); - QList > array; - int size = ui->timeZonesTW->rowCount(); - for (int i = 0; i < size; ++i) - { - QMap map; - map[QLatin1String("timeZone")] = ui->timeZonesTW->item(i, 0)->text(); - map[QLatin1String("customName")] = ui->timeZonesTW->item(i, 1)->text(); - array << map; - } - settings().setArray(QLatin1String("timeZones"), array); - - settings().setValue(QLatin1String("defaultTimeZone"), mDefaultTimeZone); - settings().setValue(QLatin1String("useAdvancedManualFormat"), ui->advancedManualGB->isChecked()); - settings().setValue(QLatin1String("autoRotate"), ui->autorotateCB->isChecked()); -} - -void LXQtWorldClockConfiguration::timeFormatChanged(int index) -{ - bool longTimeFormatSelected = index == 1; - bool customTimeFormatSelected = index == 2; - ui->timeCustomW->setEnabled(customTimeFormatSelected); - ui->timezoneGB->setEnabled(!longTimeFormatSelected); -} - -void LXQtWorldClockConfiguration::dateGroupToggled(bool dateIsChecked) -{ - bool customDateFormatSelected = ui->dateFormatCB->currentIndex() == ui->dateFormatCB->count() - 1; - ui->dateCustomW->setEnabled(dateIsChecked && customDateFormatSelected); -} - -void LXQtWorldClockConfiguration::dateFormatChanged(int index) -{ - bool customDateFormatSelected = index == ui->dateFormatCB->count() - 1; - bool dateIsChecked = ui->dateGB->isChecked(); - ui->dateCustomW->setEnabled(dateIsChecked && customDateFormatSelected); -} - -void LXQtWorldClockConfiguration::advancedFormatToggled(bool on) -{ - bool longTimeFormatSelected = ui->timeFormatCB->currentIndex() == 1; - ui->timeGB->setEnabled(!on); - ui->timezoneGB->setEnabled(!on && !longTimeFormatSelected); - ui->dateGB->setEnabled(!on); -} - -void LXQtWorldClockConfiguration::customiseManualFormatClicked() -{ - if (!mConfigurationManualFormat) - { - mConfigurationManualFormat = new LXQtWorldClockConfigurationManualFormat(this); - connect(mConfigurationManualFormat, SIGNAL(manualFormatChanged()), this, SLOT(manualFormatChanged())); - } - - mConfigurationManualFormat->setManualFormat(mManualFormat); - - QString oldManualFormat = mManualFormat; - - mManualFormat = (mConfigurationManualFormat->exec() == QDialog::Accepted) ? mConfigurationManualFormat->manualFormat() : oldManualFormat; - - saveSettings(); -} - -void LXQtWorldClockConfiguration::manualFormatChanged() -{ - mManualFormat = mConfigurationManualFormat->manualFormat(); - saveSettings(); -} - -void LXQtWorldClockConfiguration::updateTimeZoneButtons() -{ - QList selectedItems = ui->timeZonesTW->selectedItems(); - int selectedCount = selectedItems.count() / 2; - int allCount = ui->timeZonesTW->rowCount(); - - ui->removePB->setEnabled(selectedCount != 0); - bool canSetAsDefault = (selectedCount == 1); - if (canSetAsDefault) - { - if (selectedItems[0]->column() == 0) - canSetAsDefault = (selectedItems[0]->text() != mDefaultTimeZone); - else - canSetAsDefault = (selectedItems[1]->text() != mDefaultTimeZone); - } - - bool canMoveUp = false; - bool canMoveDown = false; - if ((selectedCount != 0) && (selectedCount != allCount)) - { - bool skipBottom = true; - for (int i = allCount - 1; i >= 0; --i) - { - if (ui->timeZonesTW->item(i, 0)->isSelected()) - { - if (!skipBottom) - { - canMoveDown = true; - break; - } - } - else - skipBottom = false; - } - - bool skipTop = true; - for (int i = 0; i < allCount; ++i) - { - if (ui->timeZonesTW->item(i, 0)->isSelected()) - { - if (!skipTop) - { - canMoveUp = true; - break; - } - } - else - skipTop = false; - } - } - ui->setAsDefaultPB->setEnabled(canSetAsDefault); - ui->editCustomNamePB->setEnabled(selectedCount == 1); - ui->moveUpPB->setEnabled(canMoveUp); - ui->moveDownPB->setEnabled(canMoveDown); -} - -int LXQtWorldClockConfiguration::findTimeZone(const QString& timeZone) -{ - QList items = ui->timeZonesTW->findItems(timeZone, Qt::MatchExactly); - foreach (QTableWidgetItem* item, items) - if (item->column() == 0) - return item->row(); - return -1; -} - -void LXQtWorldClockConfiguration::addTimeZone() -{ - if (!mConfigurationTimeZones) - mConfigurationTimeZones = new LXQtWorldClockConfigurationTimeZones(this); - - if (mConfigurationTimeZones->updateAndExec() == QDialog::Accepted) - { - QString timeZone = mConfigurationTimeZones->timeZone(); - if (timeZone != QString()) - { - if (findTimeZone(timeZone) == -1) - { - int row = ui->timeZonesTW->rowCount(); - ui->timeZonesTW->setRowCount(row + 1); - QTableWidgetItem *item = new QTableWidgetItem(timeZone); - ui->timeZonesTW->setItem(row, 0, item); - ui->timeZonesTW->setItem(row, 1, new QTableWidgetItem(QString())); - if (mDefaultTimeZone.isEmpty()) - setDefault(row); - } - } - } - - saveSettings(); -} - -void LXQtWorldClockConfiguration::removeTimeZone() -{ - foreach (QTableWidgetItem *item, ui->timeZonesTW->selectedItems()) - if (item->column() == 0) - { - if (item->text() == mDefaultTimeZone) - mDefaultTimeZone.clear(); - ui->timeZonesTW->removeRow(item->row()); - } - - if ((mDefaultTimeZone.isEmpty()) && ui->timeZonesTW->rowCount()) - setDefault(0); - - saveSettings(); -} - -void LXQtWorldClockConfiguration::setBold(QTableWidgetItem *item, bool value) -{ - if (item) - { - QFont font = item->font(); - font.setBold(value); - item->setFont(font); - } -} - -void LXQtWorldClockConfiguration::setBold(int row, bool value) -{ - setBold(ui->timeZonesTW->item(row, 0), value); - setBold(ui->timeZonesTW->item(row, 1), value); -} - -void LXQtWorldClockConfiguration::setDefault(int row) -{ - setBold(row, true); - mDefaultTimeZone = ui->timeZonesTW->item(row, 0)->text(); -} - -void LXQtWorldClockConfiguration::setTimeZoneAsDefault() -{ - setBold(findTimeZone(mDefaultTimeZone), false); - - setDefault(ui->timeZonesTW->selectedItems()[0]->row()); - - saveSettings(); -} - -void LXQtWorldClockConfiguration::editTimeZoneCustomName() -{ - int row = ui->timeZonesTW->selectedItems()[0]->row(); - - QString oldName = ui->timeZonesTW->item(row, 1)->text(); - - QInputDialog d(this); - d.setWindowTitle(tr("Input custom time zone name")); - d.setLabelText(tr("Custom name")); - d.setTextValue(oldName); - d.setWindowModality(Qt::WindowModal); - if (d.exec()) - { - ui->timeZonesTW->item(row, 1)->setText(d.textValue()); - - saveSettings(); - } -} - -void LXQtWorldClockConfiguration::moveTimeZoneUp() -{ - int m = ui->timeZonesTW->rowCount(); - bool skipTop = true; - for (int i = 0; i < m; ++i) - { - if (ui->timeZonesTW->item(i, 0)->isSelected()) - { - if (!skipTop) - { - QTableWidgetItem *itemP0 = ui->timeZonesTW->takeItem(i - 1, 0); - QTableWidgetItem *itemP1 = ui->timeZonesTW->takeItem(i - 1, 1); - QTableWidgetItem *itemT0 = ui->timeZonesTW->takeItem(i, 0); - QTableWidgetItem *itemT1 = ui->timeZonesTW->takeItem(i, 1); - - ui->timeZonesTW->setItem(i - 1, 0, itemT0); - ui->timeZonesTW->setItem(i - 1, 1, itemT1); - ui->timeZonesTW->setItem(i, 0, itemP0); - ui->timeZonesTW->setItem(i, 1, itemP1); - - itemT0->setSelected(true); - itemT1->setSelected(true); - itemP0->setSelected(false); - itemP1->setSelected(false); - } - } - else - skipTop = false; - } - - saveSettings(); -} - -void LXQtWorldClockConfiguration::moveTimeZoneDown() -{ - int m = ui->timeZonesTW->rowCount(); - bool skipBottom = true; - for (int i = m - 1; i >= 0; --i) - { - if (ui->timeZonesTW->item(i, 0)->isSelected()) - { - if (!skipBottom) - { - QTableWidgetItem *itemN0 = ui->timeZonesTW->takeItem(i + 1, 0); - QTableWidgetItem *itemN1 = ui->timeZonesTW->takeItem(i + 1, 1); - QTableWidgetItem *itemT0 = ui->timeZonesTW->takeItem(i, 0); - QTableWidgetItem *itemT1 = ui->timeZonesTW->takeItem(i, 1); - - ui->timeZonesTW->setItem(i + 1, 0, itemT0); - ui->timeZonesTW->setItem(i + 1, 1, itemT1); - ui->timeZonesTW->setItem(i, 0, itemN0); - ui->timeZonesTW->setItem(i, 1, itemN1); - - itemT0->setSelected(true); - itemT1->setSelected(true); - itemN0->setSelected(false); - itemN1->setSelected(false); - } - } - else - skipBottom = false; - } - - saveSettings(); -} diff --git a/plugin-worldclock/lxqtworldclockconfiguration.h b/plugin-worldclock/lxqtworldclockconfiguration.h deleted file mode 100644 index 438cb39..0000000 --- a/plugin-worldclock/lxqtworldclockconfiguration.h +++ /dev/null @@ -1,97 +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: - * Kuzma Shapran - * - * 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 LXQT_PANEL_WORLDCLOCK_CONFIGURATION_H -#define LXQT_PANEL_WORLDCLOCK_CONFIGURATION_H - -#include "../panel/lxqtpanelpluginconfigdialog.h" -#include "../panel/pluginsettings.h" -#include -#include -#include - -namespace Ui { - class LXQtWorldClockConfiguration; -} - -class LXQtWorldClockConfigurationTimeZones; -class LXQtWorldClockConfigurationManualFormat; -class QTableWidgetItem; - -class LXQtWorldClockConfiguration : public LXQtPanelPluginConfigDialog -{ - Q_OBJECT - -public: - explicit LXQtWorldClockConfiguration(PluginSettings *settings, QWidget *parent = nullptr); - ~LXQtWorldClockConfiguration(); - -public slots: - void saveSettings(); - -private: - Ui::LXQtWorldClockConfiguration *ui; - - /* - Read settings from conf file and put data into controls. - */ - void loadSettings(); - -private slots: - void timeFormatChanged(int); - void dateGroupToggled(bool); - void dateFormatChanged(int); - void advancedFormatToggled(bool); - void customiseManualFormatClicked(); - void manualFormatChanged(); - - void updateTimeZoneButtons(); - void addTimeZone(); - void removeTimeZone(); - void setTimeZoneAsDefault(); - void editTimeZoneCustomName(); - void moveTimeZoneUp(); - void moveTimeZoneDown(); - -private: - QString mDefaultTimeZone; - - bool mLockCascadeSettingChanges; - - LXQtWorldClockConfigurationTimeZones *mConfigurationTimeZones; - LXQtWorldClockConfigurationManualFormat *mConfigurationManualFormat; - - QString mManualFormat; - - void setDefault(int); - void setBold(QTableWidgetItem*, bool); - void setBold(int row, bool value); - int findTimeZone(const QString& timeZone); -}; - -#endif // LXQT_PANEL_WORLDCLOCK_CONFIGURATION_H diff --git a/plugin-worldclock/lxqtworldclockconfiguration.ui b/plugin-worldclock/lxqtworldclockconfiguration.ui deleted file mode 100644 index 3ee08fd..0000000 --- a/plugin-worldclock/lxqtworldclockconfiguration.ui +++ /dev/null @@ -1,631 +0,0 @@ - - - LXQtWorldClockConfiguration - - - - 0 - 0 - 600 - 686 - - - - World Clock Settings - - - - - - 0 - - - - Display &format - - - - - - &Time - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - F&ormat: - - - timeFormatCB - - - - - - - - Short - - - - - Long - - - - - Custom - - - - - - - - - - - false - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Sho&w seconds - - - - - - - Pad &hour with zero - - - - - - - &Use 12-hour format - - - - - - - - - - - - - T&ime zone - - - true - - - false - - - - - - &Position: - - - timezonePositionCB - - - - - - - For&mat: - - - timezoneFormatCB - - - - - - - - Below - - - - - Above - - - - - Before - - - - - After - - - - - - - - 0 - - - - Short - - - - - Long - - - - - Offset from UTC - - - - - Abbreviation - - - - - Location identifier - - - - - Custom name - - - - - - - - - - - &Date - - - true - - - false - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Po&sition: - - - datePositionCB - - - - - - - - Below - - - - - Above - - - - - Before - - - - - After - - - - - - - - Fo&rmat: - - - dateFormatCB - - - - - - - - Short - - - - - Long - - - - - ISO 8601 - - - - - Custom - - - - - - - - - - - false - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Show &year - - - - - - - Show day of wee&k - - - - - - - Pad d&ay with zero - - - - - - - &Long month and day of week names - - - - - - - - - - - - - Ad&vanced manual format - - - true - - - false - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - &Customise ... - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Time &zones - - - - - - QAbstractItemView::NoEditTriggers - - - true - - - QAbstractItemView::ExtendedSelection - - - QAbstractItemView::SelectRows - - - 2 - - - true - - - false - - - - IANA id - - - - - Custom name - - - - - - - - - - &Add ... - - - - - - - false - - - &Remove - - - - - - - false - - - Set as &default - - - - - - - false - - - &Edit custom name ... - - - - - - - false - - - Move &up - - - - - - - false - - - Move do&wn - - - - - - - Qt::Vertical - - - - 1 - 0 - - - - - - - - - - - &General - - - - - - Auto&rotate when the panel is vertical - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - tabWidget - timeFormatCB - timeShowSecondsCB - timePadHourCB - timeAMPMCB - timezoneGB - timezonePositionCB - timezoneFormatCB - dateGB - datePositionCB - dateFormatCB - dateShowYearCB - dateShowDoWCB - datePadDayCB - dateLongNamesCB - advancedManualGB - customisePB - timeZonesTW - addPB - removePB - setAsDefaultPB - editCustomNamePB - moveUpPB - moveDownPB - autorotateCB - buttons - - - - - buttons - accepted() - LXQtWorldClockConfiguration - accept() - - - 104 - 438 - - - 97 - 253 - - - - - buttons - rejected() - LXQtWorldClockConfiguration - reject() - - - 85 - 438 - - - 62 - 253 - - - - - - maximumNetSpeedChanged(QString) - on_typeCOB_currentIndexChanged(int) - on_sourceCOB_currentIndexChanged(int) - on_maximumHS_valueChanged(int) - saveSettings() - - diff --git a/plugin-worldclock/lxqtworldclockconfigurationmanualformat.cpp b/plugin-worldclock/lxqtworldclockconfigurationmanualformat.cpp deleted file mode 100644 index cc186b8..0000000 --- a/plugin-worldclock/lxqtworldclockconfigurationmanualformat.cpp +++ /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 - * 2014 LXQt team - * Authors: - * Kuzma Shapran - * - * 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 "lxqtworldclockconfigurationmanualformat.h" - -#include "ui_lxqtworldclockconfigurationmanualformat.h" - - -LXQtWorldClockConfigurationManualFormat::LXQtWorldClockConfigurationManualFormat(QWidget *parent) : - QDialog(parent), - ui(new Ui::LXQtWorldClockConfigurationManualFormat) -{ - setObjectName("WorldClockConfigurationManualFormatWindow"); - setWindowModality(Qt::WindowModal); - ui->setupUi(this); - - connect(ui->manualFormatPTE, SIGNAL(textChanged()), this, SIGNAL(manualFormatChanged())); -} - -LXQtWorldClockConfigurationManualFormat::~LXQtWorldClockConfigurationManualFormat() -{ - delete ui; -} - -void LXQtWorldClockConfigurationManualFormat::setManualFormat(const QString& text) -{ - ui->manualFormatPTE->setPlainText(text); -} - -QString LXQtWorldClockConfigurationManualFormat::manualFormat() const -{ - return ui->manualFormatPTE->toPlainText(); -} diff --git a/plugin-worldclock/lxqtworldclockconfigurationmanualformat.h b/plugin-worldclock/lxqtworldclockconfigurationmanualformat.h deleted file mode 100644 index bcfd545..0000000 --- a/plugin-worldclock/lxqtworldclockconfigurationmanualformat.h +++ /dev/null @@ -1,62 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * 2014 LXQt team - * Authors: - * Kuzma Shapran - * - * 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 LXQT_PANEL_WORLDCLOCK_CONFIGURATION_MANUAL_FORMAT_H -#define LXQT_PANEL_WORLDCLOCK_CONFIGURATION_MANUAL_FORMAT_H - -#include -#include - - -namespace Ui { - class LXQtWorldClockConfigurationManualFormat; -} - -class QTreeWidgetItem; - -class LXQtWorldClockConfigurationManualFormat : public QDialog -{ - Q_OBJECT - -public: - explicit LXQtWorldClockConfigurationManualFormat(QWidget *parent = NULL); - ~LXQtWorldClockConfigurationManualFormat(); - - void setManualFormat(const QString&); - - QString manualFormat() const; - -signals: - void manualFormatChanged(); - -private: - Ui::LXQtWorldClockConfigurationManualFormat *ui; -}; - -#endif // LXQT_PANEL_WORLDCLOCK_CONFIGURATION_MANUAL_FORMAT_H diff --git a/plugin-worldclock/lxqtworldclockconfigurationmanualformat.ui b/plugin-worldclock/lxqtworldclockconfigurationmanualformat.ui deleted file mode 100644 index 103be21..0000000 --- a/plugin-worldclock/lxqtworldclockconfigurationmanualformat.ui +++ /dev/null @@ -1,190 +0,0 @@ - - - LXQtWorldClockConfigurationManualFormat - - - - 0 - 0 - 800 - 500 - - - - World Clock Time Zones - - - - - - Qt::Vertical - - - false - - - - - 0 - 1 - - - - - 0 - 100 - - - - - - - 0 - 100 - - - - - 0 - 100 - - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 766 - 1050 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - <h1>Custom Date/Time Format Syntax</h1> -<p>A date pattern is a string of characters, where specific strings of characters are replaced with date and time data from a calendar when formatting or used to generate data for a calendar when parsing.</p> -<p>The Date Field Symbol Table below contains the characters used in patterns to show the appropriate formats for a given locale, such as yyyy for the year. Characters may be used multiple times. For example, if y is used for the year, 'yy' might produce '99', whereas 'yyyy' produces '1999'. For most numerical fields, the number of characters specifies the field width. For example, if h is the hour, 'h' might produce '5', but 'hh' produces '05'. For some characters, the count specifies whether an abbreviated or full form should be used, but may have other choices, as given below.</p> -<p>Two single quotes represents a literal single quote, either inside or outside single quotes. Text within single quotes is not interpreted in any way (except for two adjacent single quotes). Otherwise all ASCII letter from a to z and A to Z are reserved as syntax characters, and require quoting if they are to represent literal characters. In addition, certain ASCII punctuation characters may become variable in the future (eg ":" being interpreted as the time separator and '/' as a date separator, and replaced by respective locale-sensitive characters in display).<br /></p> -<table border="1" width="100%" cellpadding="4" cellspacing="0"> -<tr><th width="20%">Code</th><th>Meaning</th></tr> -<tr><td>d</td><td>the day as number without a leading zero (1 to 31)</td></tr> -<tr><td>dd</td><td>the day as number with a leading zero (01 to 31)</td></tr> -<tr><td>ddd</td><td>the abbreviated localized day name (e.g. 'Mon' to 'Sun').</td></tr> -<tr><td>dddd</td><td>the long localized day name (e.g. 'Monday' to 'Sunday</td></tr> -<tr><td>M</td><td>the month as number without a leading zero (1-12)</td></tr> -<tr><td>MM</td><td>the month as number with a leading zero (01-12)</td></tr> -<tr><td>MMM</td><td>the abbreviated localized month name (e.g. 'Jan' to 'Dec').</td></tr> -<tr><td>MMMM</td><td>the long localized month name (e.g. 'January' to 'December').</td></tr> -<tr><td>yy</td><td>the year as two digit number (00-99)</td></tr> -<tr><td>yyyy</td><td>the year as four digit number</td></tr> -<tr><td>h</td><td>the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)</td></tr> -<tr><td>hh</td><td>the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)</td></tr> -<tr><td>H</td><td>the hour without a leading zero (0 to 23, even with AM/PM display)</td></tr> -<tr><td>HH</td><td>the hour with a leading zero (00 to 23, even with AM/PM display)</td></tr> -<tr><td>m</td><td>the minute without a leading zero (0 to 59)</td></tr> -<tr><td>mm</td><td>the minute with a leading zero (00 to 59)</td></tr> -<tr><td>s</td><td>the second without a leading zero (0 to 59)</td></tr> -<tr><td>ss</td><td>the second with a leading zero (00 to 59)</td></tr> -<tr><td>z</td><td>the milliseconds without leading zeroes (0 to 999)</td></tr> -<tr><td>zzz</td><td>the milliseconds with leading zeroes (000 to 999)</td></tr> -<tr><td>AP <i>or</i> A</td><td>use AM/PM display. <b>A/AP</b> will be replaced by either "AM" or "PM".<</td></tr> -<tr><td>ap <i>or</i> a</td><td>use am/pm display. <b>a/ap</b> will be replaced by either "am" or "pm".<</td></tr> -<tr><td>t</td><td>the timezone (for example "CEST")</td></tr> -<tr><td>T</td><td>the offset from UTC</td></tr> -<tr><td>TT</td><td>the timezone IANA id</td></tr> -<tr><td>TTT</td><td>the timezone abbreviation</td></tr> -<tr><td>TTTT</td><td>the timezone short display name</td></tr> -<tr><td>TTTTT</td><td>the timezone long display name</td></tr> -<tr><td>TTTTTT</td><td>the timezone custom name. You can change it the 'Time zones' tab of the configuration window</td></tr></table> -<br /><b>Notes:</b> <ul><li>Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not enclosed within single quotes.The single quote is used to 'escape' letters. Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.</li><li>Minimal update interval is 1 second. If z or zzz is configured time is shown with the milliseconds fraction, but not updated on millisecond basis (avoiding big performance hit).</li><ul> - - - - Qt::RichText - - - true - - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - manualFormatPTE - scrollArea - buttons - - - - - buttons - accepted() - LXQtWorldClockConfigurationManualFormat - accept() - - - 95 - 490 - - - 97 - 253 - - - - - buttons - rejected() - LXQtWorldClockConfigurationManualFormat - reject() - - - 76 - 490 - - - 62 - 253 - - - - - - maximumNetSpeedChanged(QString) - on_typeCOB_currentIndexChanged(int) - on_sourceCOB_currentIndexChanged(int) - on_maximumHS_valueChanged(int) - saveSettings() - - diff --git a/plugin-worldclock/lxqtworldclockconfigurationtimezones.cpp b/plugin-worldclock/lxqtworldclockconfigurationtimezones.cpp deleted file mode 100644 index 2674983..0000000 --- a/plugin-worldclock/lxqtworldclockconfigurationtimezones.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * 2014 LXQt team - * Authors: - * Kuzma Shapran - * - * 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 "lxqtworldclockconfigurationtimezones.h" - -#include "ui_lxqtworldclockconfigurationtimezones.h" - - -LXQtWorldClockConfigurationTimeZones::LXQtWorldClockConfigurationTimeZones(QWidget *parent) : - QDialog(parent), - ui(new Ui::LXQtWorldClockConfigurationTimeZones) -{ - setObjectName("WorldClockConfigurationTimeZonesWindow"); - setWindowModality(Qt::WindowModal); - ui->setupUi(this); - - connect(ui->timeZonesTW, SIGNAL(itemSelectionChanged()), SLOT(itemSelectionChanged())); - connect(ui->timeZonesTW, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), SLOT(itemDoubleClicked(QTreeWidgetItem*,int))); -} - -LXQtWorldClockConfigurationTimeZones::~LXQtWorldClockConfigurationTimeZones() -{ - delete ui; -} - -QString LXQtWorldClockConfigurationTimeZones::timeZone() -{ - return mTimeZone; -} - -void LXQtWorldClockConfigurationTimeZones::itemSelectionChanged() -{ - QList items = ui->timeZonesTW->selectedItems(); - if (!items.empty()) - mTimeZone = items[0]->data(0, Qt::UserRole).toString(); - else - mTimeZone.clear(); -} - -void LXQtWorldClockConfigurationTimeZones::itemDoubleClicked(QTreeWidgetItem* /*item*/, int /*column*/) -{ - if (!mTimeZone.isEmpty()) - accept(); -} - -QTreeWidgetItem* LXQtWorldClockConfigurationTimeZones::makeSureParentsExist(const QStringList &parts, QMap &parentItems) -{ - if (parts.length() == 1) - return 0; - - QStringList parentParts = parts.mid(0, parts.length() - 1); - - QString parentPath = parentParts.join(QLatin1String("/")); - - QMap::Iterator I = parentItems.find(parentPath); - if (I != parentItems.end()) - return I.value(); - - QTreeWidgetItem* newItem = new QTreeWidgetItem(QStringList() << parts[parts.length() - 2]); - - QTreeWidgetItem* parentItem = makeSureParentsExist(parentParts, parentItems); - - if (!parentItem) - ui->timeZonesTW->addTopLevelItem(newItem); - else - parentItem->addChild(newItem); - - parentItems[parentPath] = newItem; - - return newItem; -} - -int LXQtWorldClockConfigurationTimeZones::updateAndExec() -{ - QDateTime now = QDateTime::currentDateTime(); - - ui->timeZonesTW->clear(); - - QMap parentItems; - - foreach(const QByteArray &ba, QTimeZone::availableTimeZoneIds()) - { - QTimeZone timeZone(ba); - QString ianaId(ba); - QStringList qStrings(QString(ba).split(QLatin1Char('/'))); - - if ((qStrings.size() == 1) && (qStrings[0].startsWith(QLatin1String("UTC")))) - qStrings.prepend(tr("UTC")); - - if (qStrings.size() == 1) - qStrings.prepend(tr("Other")); - - QTreeWidgetItem *tzItem = new QTreeWidgetItem(QStringList() << qStrings[qStrings.length() - 1] << timeZone.displayName(now) << timeZone.comment() << QLocale::countryToString(timeZone.country())); - tzItem->setData(0, Qt::UserRole, ianaId); - - makeSureParentsExist(qStrings, parentItems)->addChild(tzItem); - } - - QStringList qStrings = QStringList() << tr("Other") << QLatin1String("local"); - QTreeWidgetItem *tzItem = new QTreeWidgetItem(QStringList() << qStrings[qStrings.length() - 1] << QString() << tr("Local timezone") << QString()); - tzItem->setData(0, Qt::UserRole, qStrings[qStrings.length() - 1]); - makeSureParentsExist(qStrings, parentItems)->addChild(tzItem); - - ui->timeZonesTW->sortByColumn(0, Qt::AscendingOrder); - - return exec(); -} diff --git a/plugin-worldclock/lxqtworldclockconfigurationtimezones.h b/plugin-worldclock/lxqtworldclockconfigurationtimezones.h deleted file mode 100644 index cb5150c..0000000 --- a/plugin-worldclock/lxqtworldclockconfigurationtimezones.h +++ /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: 2012 Razor team - * 2014 LXQt team - * Authors: - * Kuzma Shapran - * - * 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 LXQT_PANEL_WORLDCLOCK_CONFIGURATION_TIMEZONES_H -#define LXQT_PANEL_WORLDCLOCK_CONFIGURATION_TIMEZONES_H - -#include -#include - - -namespace Ui { - class LXQtWorldClockConfigurationTimeZones; -} - -class QTreeWidgetItem; - -class LXQtWorldClockConfigurationTimeZones : public QDialog -{ - Q_OBJECT - -public: - explicit LXQtWorldClockConfigurationTimeZones(QWidget *parent = NULL); - ~LXQtWorldClockConfigurationTimeZones(); - - int updateAndExec(); - - QString timeZone(); - -public slots: - void itemSelectionChanged(); - void itemDoubleClicked(QTreeWidgetItem*,int); - -private: - Ui::LXQtWorldClockConfigurationTimeZones *ui; - - QString mTimeZone; - - QTreeWidgetItem* makeSureParentsExist(const QStringList &parts, QMap &parentItems); -}; - -#endif // LXQT_PANEL_WORLDCLOCK_CONFIGURATION_TIMEZONES_H diff --git a/plugin-worldclock/lxqtworldclockconfigurationtimezones.ui b/plugin-worldclock/lxqtworldclockconfigurationtimezones.ui deleted file mode 100644 index b823921..0000000 --- a/plugin-worldclock/lxqtworldclockconfigurationtimezones.ui +++ /dev/null @@ -1,111 +0,0 @@ - - - LXQtWorldClockConfigurationTimeZones - - - - 0 - 0 - 718 - 280 - - - - World Clock Time Zones - - - - - - QAbstractItemView::NoEditTriggers - - - true - - - true - - - 4 - - - 150 - - - - Time zone - - - - - Name - - - - - Comment - - - - - Country - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - timeZonesTW - buttons - - - - - buttons - accepted() - LXQtWorldClockConfigurationTimeZones - accept() - - - 86 - 244 - - - 97 - 253 - - - - - buttons - rejected() - LXQtWorldClockConfigurationTimeZones - reject() - - - 67 - 244 - - - 62 - 253 - - - - - - maximumNetSpeedChanged(QString) - on_typeCOB_currentIndexChanged(int) - on_sourceCOB_currentIndexChanged(int) - on_maximumHS_valueChanged(int) - saveSettings() - - diff --git a/plugin-worldclock/resources/worldclock.desktop.in b/plugin-worldclock/resources/worldclock.desktop.in deleted file mode 100644 index e957f5a..0000000 --- a/plugin-worldclock/resources/worldclock.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=World clock -Comment=World clock plugin. -Icon=clock - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-worldclock/translations/worldclock_ar.desktop b/plugin-worldclock/translations/worldclock_ar.desktop deleted file mode 100644 index 9e3a920..0000000 --- a/plugin-worldclock/translations/worldclock_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[ar]=ساعة العالم -Comment[ar]=ملحقة لساعة العالم. diff --git a/plugin-worldclock/translations/worldclock_da.desktop b/plugin-worldclock/translations/worldclock_da.desktop deleted file mode 100644 index 80b6c81..0000000 --- a/plugin-worldclock/translations/worldclock_da.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name=World clock -Comment=World clock plugin. -Icon=clock - -#TRANSLATIONS_DIR=../translations - -# Translations -Name[da]=Verdensur -Comment[da]=Verdensur-plugin. \ No newline at end of file diff --git a/plugin-worldclock/translations/worldclock_de.desktop b/plugin-worldclock/translations/worldclock_de.desktop deleted file mode 100644 index c4e8a1b..0000000 --- a/plugin-worldclock/translations/worldclock_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[de]=Weltzeituhr -Comment[de]=Weltzeituhr diff --git a/plugin-worldclock/translations/worldclock_el.desktop b/plugin-worldclock/translations/worldclock_el.desktop deleted file mode 100644 index 05e992b..0000000 --- a/plugin-worldclock/translations/worldclock_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[el]=Παγκόσμιο ρολόι -Comment[el]=Πρόσθετο παγκόσμιου ρολογιού diff --git a/plugin-worldclock/translations/worldclock_fr.desktop b/plugin-worldclock/translations/worldclock_fr.desktop deleted file mode 100644 index a01b50e..0000000 --- a/plugin-worldclock/translations/worldclock_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[fr]=Horloge universelle -Comment[fr]=Horloge universelle diff --git a/plugin-worldclock/translations/worldclock_hu.desktop b/plugin-worldclock/translations/worldclock_hu.desktop deleted file mode 100644 index 36fd874..0000000 --- a/plugin-worldclock/translations/worldclock_hu.desktop +++ /dev/null @@ -1,3 +0,0 @@ -#TRANSLATIONS -Name[hu]=Világóra -Comment[hu]=Világóra bővítmény diff --git a/plugin-worldclock/translations/worldclock_it.desktop b/plugin-worldclock/translations/worldclock_it.desktop deleted file mode 100644 index 21570f4..0000000 --- a/plugin-worldclock/translations/worldclock_it.desktop +++ /dev/null @@ -1,3 +0,0 @@ -#TRANSLATIONS -Name[it]=Orologio mondiale -Comment[it]=Mostra un orologio con un fuso orario diverso diff --git a/plugin-worldclock/translations/worldclock_ja.desktop b/plugin-worldclock/translations/worldclock_ja.desktop deleted file mode 100644 index a1b09d7..0000000 --- a/plugin-worldclock/translations/worldclock_ja.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name[ja]=世界時計 -Comment[ja]=世界時計のウィジェットです - -#TRANSLATIONS_DIR=../translations diff --git a/plugin-worldclock/translations/worldclock_lt.desktop b/plugin-worldclock/translations/worldclock_lt.desktop deleted file mode 100644 index b5b2996..0000000 --- a/plugin-worldclock/translations/worldclock_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[lt]=Pasaulio laikrodžiai -Comment[lt]=Pasaulio laikrodžių įskiepis. diff --git a/plugin-worldclock/translations/worldclock_pl.desktop b/plugin-worldclock/translations/worldclock_pl.desktop deleted file mode 100644 index 4bcf085..0000000 --- a/plugin-worldclock/translations/worldclock_pl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[pl]=Zegar światowy -Comment[pl]=Wtyczka zegara światowego. diff --git a/plugin-worldclock/translations/worldclock_pt.desktop b/plugin-worldclock/translations/worldclock_pt.desktop deleted file mode 100644 index de26cac..0000000 --- a/plugin-worldclock/translations/worldclock_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -#TRANSLATIONS -Name[pt]=Relógio mundial -Comment[pt]=Extra para mostrar um relógio mundial diff --git a/plugin-worldclock/translations/worldclock_ru.desktop b/plugin-worldclock/translations/worldclock_ru.desktop deleted file mode 100644 index 901f660..0000000 --- a/plugin-worldclock/translations/worldclock_ru.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=LXQtPanel/Plugin -Name[ru]=Мировое время -Comment[ru]=Плагин мирового времени. - -#TRANSLATIONS_DIR=../translations