diff --git a/AUTHORS b/AUTHORS
index a66be6d..abb6e1f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,7 +4,7 @@ Upstream Authors:
Copyright:
Copyright (c) 2010-2012 Razor team
- Copyright (c) 2012-2016 LXQt 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
index 385a068..17a2df3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,7 +1,93 @@
-lxqt-panel-0.11.1 / 2017-01-01
+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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 55e10f8..732861d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,6 +58,11 @@ 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)
@@ -266,3 +271,7 @@ endforeach()
message(STATUS "*********************************************************************")
add_subdirectory(panel)
+
+# merged from lxqt-common
+add_subdirectory(autostart)
+add_subdirectory(menu)
diff --git a/autostart/CMakeLists.txt b/autostart/CMakeLists.txt
new file mode 100644
index 0000000..1a436b8
--- /dev/null
+++ b/autostart/CMakeLists.txt
@@ -0,0 +1,17 @@
+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
new file mode 100644
index 0000000..5d6489b
--- /dev/null
+++ b/autostart/lxqt-panel.desktop.in
@@ -0,0 +1,9 @@
+[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
new file mode 100644
index 0000000..1942242
--- /dev/null
+++ b/autostart/translations/lxqt-panel_ar.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[ar]=اللوحة
diff --git a/autostart/translations/lxqt-panel_cs.desktop b/autostart/translations/lxqt-panel_cs.desktop
new file mode 100644
index 0000000..81370cd
--- /dev/null
+++ b/autostart/translations/lxqt-panel_cs.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[cs]=Panel
diff --git a/autostart/translations/lxqt-panel_cs_CZ.desktop b/autostart/translations/lxqt-panel_cs_CZ.desktop
new file mode 100644
index 0000000..a0c4f77
--- /dev/null
+++ b/autostart/translations/lxqt-panel_cs_CZ.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[cs_CZ]=Panel
diff --git a/autostart/translations/lxqt-panel_da.desktop b/autostart/translations/lxqt-panel_da.desktop
new file mode 100644
index 0000000..6621367
--- /dev/null
+++ b/autostart/translations/lxqt-panel_da.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[da]=Panel
diff --git a/autostart/translations/lxqt-panel_de.desktop b/autostart/translations/lxqt-panel_de.desktop
new file mode 100644
index 0000000..61bd964
--- /dev/null
+++ b/autostart/translations/lxqt-panel_de.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[de]=Bedienfeld
diff --git a/autostart/translations/lxqt-panel_el.desktop b/autostart/translations/lxqt-panel_el.desktop
new file mode 100644
index 0000000..6314199
--- /dev/null
+++ b/autostart/translations/lxqt-panel_el.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[el]=Πίνακας
diff --git a/autostart/translations/lxqt-panel_eo.desktop b/autostart/translations/lxqt-panel_eo.desktop
new file mode 100644
index 0000000..48dd77b
--- /dev/null
+++ b/autostart/translations/lxqt-panel_eo.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[eo]=Panelo
diff --git a/autostart/translations/lxqt-panel_es.desktop b/autostart/translations/lxqt-panel_es.desktop
new file mode 100644
index 0000000..005996f
--- /dev/null
+++ b/autostart/translations/lxqt-panel_es.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[es]=Panel
diff --git a/autostart/translations/lxqt-panel_es_VE.desktop b/autostart/translations/lxqt-panel_es_VE.desktop
new file mode 100644
index 0000000..bcfb02a
--- /dev/null
+++ b/autostart/translations/lxqt-panel_es_VE.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[es_VE]=Panel
diff --git a/autostart/translations/lxqt-panel_eu.desktop b/autostart/translations/lxqt-panel_eu.desktop
new file mode 100644
index 0000000..2727809
--- /dev/null
+++ b/autostart/translations/lxqt-panel_eu.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[eu]=Panela
diff --git a/autostart/translations/lxqt-panel_fi.desktop b/autostart/translations/lxqt-panel_fi.desktop
new file mode 100644
index 0000000..4969141
--- /dev/null
+++ b/autostart/translations/lxqt-panel_fi.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[fi]=Paneeli
diff --git a/autostart/translations/lxqt-panel_fr.desktop b/autostart/translations/lxqt-panel_fr.desktop
new file mode 100644
index 0000000..f01e11b
--- /dev/null
+++ b/autostart/translations/lxqt-panel_fr.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[fr]=Tableau de bord
diff --git a/autostart/translations/lxqt-panel_hu.desktop b/autostart/translations/lxqt-panel_hu.desktop
new file mode 100644
index 0000000..85d818a
--- /dev/null
+++ b/autostart/translations/lxqt-panel_hu.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[hu]=Panel
diff --git a/autostart/translations/lxqt-panel_hu_HU.desktop b/autostart/translations/lxqt-panel_hu_HU.desktop
new file mode 100644
index 0000000..88c74c0
--- /dev/null
+++ b/autostart/translations/lxqt-panel_hu_HU.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[hu_HU]=Panel
diff --git a/autostart/translations/lxqt-panel_ia.desktop b/autostart/translations/lxqt-panel_ia.desktop
new file mode 100644
index 0000000..c4feed9
--- /dev/null
+++ b/autostart/translations/lxqt-panel_ia.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[ia]=Panello
diff --git a/autostart/translations/lxqt-panel_it_IT.desktop b/autostart/translations/lxqt-panel_it_IT.desktop
new file mode 100644
index 0000000..a3517ea
--- /dev/null
+++ b/autostart/translations/lxqt-panel_it_IT.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[it_IT]=Pannello
diff --git a/autostart/translations/lxqt-panel_ja.desktop b/autostart/translations/lxqt-panel_ja.desktop
new file mode 100644
index 0000000..0a526a8
--- /dev/null
+++ b/autostart/translations/lxqt-panel_ja.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[ja]=パネル
diff --git a/autostart/translations/lxqt-panel_lt.desktop b/autostart/translations/lxqt-panel_lt.desktop
new file mode 100644
index 0000000..d92fe64
--- /dev/null
+++ b/autostart/translations/lxqt-panel_lt.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[lt]=Skydelis
diff --git a/autostart/translations/lxqt-panel_nl.desktop b/autostart/translations/lxqt-panel_nl.desktop
new file mode 100644
index 0000000..697ba61
--- /dev/null
+++ b/autostart/translations/lxqt-panel_nl.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[nl]=Paneel
diff --git a/autostart/translations/lxqt-panel_pl.desktop b/autostart/translations/lxqt-panel_pl.desktop
new file mode 100644
index 0000000..4947596
--- /dev/null
+++ b/autostart/translations/lxqt-panel_pl.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[pl]=Panel
diff --git a/autostart/translations/lxqt-panel_pt.desktop b/autostart/translations/lxqt-panel_pt.desktop
new file mode 100644
index 0000000..957e373
--- /dev/null
+++ b/autostart/translations/lxqt-panel_pt.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[pt]=Painel
diff --git a/autostart/translations/lxqt-panel_pt_BR.desktop b/autostart/translations/lxqt-panel_pt_BR.desktop
new file mode 100644
index 0000000..07927e9
--- /dev/null
+++ b/autostart/translations/lxqt-panel_pt_BR.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[pt_BR]=Painel
diff --git a/autostart/translations/lxqt-panel_ro_RO.desktop b/autostart/translations/lxqt-panel_ro_RO.desktop
new file mode 100644
index 0000000..a78ac35
--- /dev/null
+++ b/autostart/translations/lxqt-panel_ro_RO.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[ro_RO]=Panou
diff --git a/autostart/translations/lxqt-panel_ru.desktop b/autostart/translations/lxqt-panel_ru.desktop
new file mode 100644
index 0000000..be9e12e
--- /dev/null
+++ b/autostart/translations/lxqt-panel_ru.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[ru]=панель
diff --git a/autostart/translations/lxqt-panel_ru_RU.desktop b/autostart/translations/lxqt-panel_ru_RU.desktop
new file mode 100644
index 0000000..16f05b6
--- /dev/null
+++ b/autostart/translations/lxqt-panel_ru_RU.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[ru_RU]=Панель
diff --git a/autostart/translations/lxqt-panel_sl.desktop b/autostart/translations/lxqt-panel_sl.desktop
new file mode 100644
index 0000000..75e5358
--- /dev/null
+++ b/autostart/translations/lxqt-panel_sl.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[sl]=Pult
diff --git a/autostart/translations/lxqt-panel_th_TH.desktop b/autostart/translations/lxqt-panel_th_TH.desktop
new file mode 100644
index 0000000..b12a42b
--- /dev/null
+++ b/autostart/translations/lxqt-panel_th_TH.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[th_TH]=พาเนล
diff --git a/autostart/translations/lxqt-panel_tr.desktop b/autostart/translations/lxqt-panel_tr.desktop
new file mode 100644
index 0000000..7cb9ff1
--- /dev/null
+++ b/autostart/translations/lxqt-panel_tr.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[tr]=Panel
diff --git a/autostart/translations/lxqt-panel_uk.desktop b/autostart/translations/lxqt-panel_uk.desktop
new file mode 100644
index 0000000..f1a03b0
--- /dev/null
+++ b/autostart/translations/lxqt-panel_uk.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[uk]=Панель
diff --git a/autostart/translations/lxqt-panel_zh_CN.desktop b/autostart/translations/lxqt-panel_zh_CN.desktop
new file mode 100644
index 0000000..bbbca23
--- /dev/null
+++ b/autostart/translations/lxqt-panel_zh_CN.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[zh_CN]=面板
diff --git a/autostart/translations/lxqt-panel_zh_TW.desktop b/autostart/translations/lxqt-panel_zh_TW.desktop
new file mode 100644
index 0000000..3f12f59
--- /dev/null
+++ b/autostart/translations/lxqt-panel_zh_TW.desktop
@@ -0,0 +1,2 @@
+# Translations
+Name[zh_TW]=面板
diff --git a/menu/CMakeLists.txt b/menu/CMakeLists.txt
new file mode 100644
index 0000000..5fccba5
--- /dev/null
+++ b/menu/CMakeLists.txt
@@ -0,0 +1,21 @@
+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
new file mode 100644
index 0000000..ef2e5fb
--- /dev/null
+++ b/menu/desktop-directories/lxqt-leave.directory.in
@@ -0,0 +1,7 @@
+[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
new file mode 100644
index 0000000..32eab4f
--- /dev/null
+++ b/menu/desktop-directories/lxqt-settings.directory.in
@@ -0,0 +1,9 @@
+[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
new file mode 100644
index 0000000..2cd802d
--- /dev/null
+++ b/menu/lxqt-applications.menu
@@ -0,0 +1,237 @@
+
+
+
diff --git a/menu/translations/lxqt-leave_de.directory b/menu/translations/lxqt-leave_de.directory
new file mode 100644
index 0000000..5593674
--- /dev/null
+++ b/menu/translations/lxqt-leave_de.directory
@@ -0,0 +1,8 @@
+[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
new file mode 100644
index 0000000..9c0068c
--- /dev/null
+++ b/menu/translations/lxqt-leave_el.directory
@@ -0,0 +1 @@
+Name[el]=Έξοδος
diff --git a/menu/translations/lxqt-leave_fr.directory b/menu/translations/lxqt-leave_fr.directory
new file mode 100644
index 0000000..79b4dbe
--- /dev/null
+++ b/menu/translations/lxqt-leave_fr.directory
@@ -0,0 +1,3 @@
+[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
new file mode 100644
index 0000000..9e41bd8
--- /dev/null
+++ b/menu/translations/lxqt-leave_hu.directory
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..da74fd5
--- /dev/null
+++ b/menu/translations/lxqt-leave_it.directory
@@ -0,0 +1,2 @@
+Name[it]=Esci
+Comment[it]=Chiudere la sessione
diff --git a/menu/translations/lxqt-leave_lt.directory b/menu/translations/lxqt-leave_lt.directory
new file mode 100644
index 0000000..302ba9e
--- /dev/null
+++ b/menu/translations/lxqt-leave_lt.directory
@@ -0,0 +1,8 @@
+[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
new file mode 100644
index 0000000..360a81c
--- /dev/null
+++ b/menu/translations/lxqt-leave_pl.directory
@@ -0,0 +1,2 @@
+Name[pl]=Opuść
+Comment[pl]=Zakończ sesję
diff --git a/menu/translations/lxqt-leave_pt.directory b/menu/translations/lxqt-leave_pt.directory
new file mode 100644
index 0000000..aa7ed4a
--- /dev/null
+++ b/menu/translations/lxqt-leave_pt.directory
@@ -0,0 +1,3 @@
+[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
new file mode 100644
index 0000000..928988f
--- /dev/null
+++ b/menu/translations/lxqt-leave_ru.directory
@@ -0,0 +1,11 @@
+[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
new file mode 100644
index 0000000..9c203c7
--- /dev/null
+++ b/menu/translations/lxqt-settings_de.directory
@@ -0,0 +1 @@
+Name[de]=LXQt-Systemeinstellungen
diff --git a/menu/translations/lxqt-settings_el.directory b/menu/translations/lxqt-settings_el.directory
new file mode 100644
index 0000000..41f96db
--- /dev/null
+++ b/menu/translations/lxqt-settings_el.directory
@@ -0,0 +1,2 @@
+Name[el]=Ρυθμίσεις LXQt
+
diff --git a/menu/translations/lxqt-settings_fr.directory b/menu/translations/lxqt-settings_fr.directory
new file mode 100644
index 0000000..7f4607f
--- /dev/null
+++ b/menu/translations/lxqt-settings_fr.directory
@@ -0,0 +1 @@
+Name[fr]=LXQt-Paramétrage du système
diff --git a/menu/translations/lxqt-settings_hu.directory b/menu/translations/lxqt-settings_hu.directory
new file mode 100644
index 0000000..82b2b1d
--- /dev/null
+++ b/menu/translations/lxqt-settings_hu.directory
@@ -0,0 +1 @@
+Name[hu]=LXQt beállítása
diff --git a/menu/translations/lxqt-settings_it.directory b/menu/translations/lxqt-settings_it.directory
new file mode 100644
index 0000000..158bfaf
--- /dev/null
+++ b/menu/translations/lxqt-settings_it.directory
@@ -0,0 +1 @@
+Name[it]=Impostazioni di LXQt
diff --git a/menu/translations/lxqt-settings_lt.directory b/menu/translations/lxqt-settings_lt.directory
new file mode 100644
index 0000000..2d44ee4
--- /dev/null
+++ b/menu/translations/lxqt-settings_lt.directory
@@ -0,0 +1 @@
+Name[lt]=LXQt nustatymai
diff --git a/menu/translations/lxqt-settings_pl.directory b/menu/translations/lxqt-settings_pl.directory
new file mode 100644
index 0000000..5fb57ee
--- /dev/null
+++ b/menu/translations/lxqt-settings_pl.directory
@@ -0,0 +1 @@
+Name[pl]=Ustawienia LXQt
diff --git a/menu/translations/lxqt-settings_pt.directory b/menu/translations/lxqt-settings_pt.directory
new file mode 100644
index 0000000..38676ce
--- /dev/null
+++ b/menu/translations/lxqt-settings_pt.directory
@@ -0,0 +1,2 @@
+[Desktop Entry]
+Name=Definições do LXQt
diff --git a/menu/translations/lxqt-settings_ru.directory b/menu/translations/lxqt-settings_ru.directory
new file mode 100644
index 0000000..a090a0a
--- /dev/null
+++ b/menu/translations/lxqt-settings_ru.directory
@@ -0,0 +1,13 @@
+[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/config/configpanelwidget.cpp b/panel/config/configpanelwidget.cpp
index e41425c..84da448 100644
--- a/panel/config/configpanelwidget.cpp
+++ b/panel/config/configpanelwidget.cpp
@@ -87,6 +87,7 @@ ConfigPanelWidget::ConfigPanelWidget(LXQtPanel *panel, QWidget *parent) :
mBackgroundColor = mOldBackgroundColor;
mOldBackgroundImage = mPanel->backgroundImage();
mOldOpacity = mPanel->opacity();
+ mOldReserveSpace = mPanel->reserveSpace();
// reset configurations from file
reset();
@@ -112,6 +113,8 @@ ConfigPanelWidget::ConfigPanelWidget(LXQtPanel *panel, QWidget *parent) :
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); });
}
@@ -144,6 +147,7 @@ void ConfigPanelWidget::reset()
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());
diff --git a/panel/config/configpanelwidget.h b/panel/config/configpanelwidget.h
index c2a576b..2b48744 100644
--- a/panel/config/configpanelwidget.h
+++ b/panel/config/configpanelwidget.h
@@ -96,6 +96,7 @@ private:
QColor mOldBackgroundColor;
QString mOldBackgroundImage;
int mOldOpacity;
+ bool mOldReserveSpace;
};
#endif
diff --git a/panel/config/configpanelwidget.ui b/panel/config/configpanelwidget.ui
index f0517a9..27466b5 100644
--- a/panel/config/configpanelwidget.ui
+++ b/panel/config/configpanelwidget.ui
@@ -6,8 +6,8 @@
0
0
- 372
- 397
+ 382
+ 517
@@ -324,6 +324,16 @@
+ -
+
+
+ Don't allow maximized windows go under the panel window
+
+
+ Reserve space on display
+
+
+
diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp
index 6edfe6c..9bce88d 100644
--- a/panel/lxqtpanel.cpp
+++ b/panel/lxqtpanel.cpp
@@ -72,6 +72,7 @@
#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"
@@ -134,6 +135,7 @@ LXQtPanel::LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidg
mHidable(false),
mHidden(false),
mAnimationTime(0),
+ mReserveSpace(true),
mAnimation(nullptr),
mLockPanel(false)
{
@@ -263,6 +265,7 @@ void LXQtPanel::readSettings()
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);
@@ -310,6 +313,7 @@ void LXQtPanel::saveSettings(bool later)
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);
@@ -388,7 +392,10 @@ void LXQtPanel::loadPlugins()
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(); });
+ }
}
/************************************************
@@ -582,51 +589,62 @@ void LXQtPanel::updateWmStrut()
if(wid == 0 || !isVisible())
return;
- 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)
+ if (mReserveSpace)
{
- 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;
+ 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::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
- );
+ 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;
+ break;
- case LXQtPanel::PositionRight:
+ 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 */ wholeScreen.right() - rect.right() + getReserveDimension(), rect.top(), rect.bottom(),
+ /* Right */ 0, 0, 0,
/* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0
);
- break;
}
}
@@ -947,6 +965,23 @@ void LXQtPanel::setOpacity(int opacity, bool save)
}
+/************************************************
+ *
+ ************************************************/
+void LXQtPanel::setReserveSpace(bool reserveSpace, bool save)
+{
+ if (mReserveSpace == reserveSpace)
+ return;
+
+ mReserveSpace = reserveSpace;
+
+ if (save)
+ saveSettings(true);
+
+ updateWmStrut();
+}
+
+
/************************************************
************************************************/
@@ -1161,7 +1196,13 @@ QRect LXQtPanel::calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const Q
{
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);
}
diff --git a/panel/lxqtpanel.h b/panel/lxqtpanel.h
index f944622..8b650d9 100644
--- a/panel/lxqtpanel.h
+++ b/panel/lxqtpanel.h
@@ -218,6 +218,7 @@ public:
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(); }
@@ -294,6 +295,7 @@ public slots:
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()
@@ -637,6 +639,14 @@ private:
* 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
diff --git a/panel/lxqtpanelapplication.cpp b/panel/lxqtpanelapplication.cpp
index 4015850..8625126 100644
--- a/panel/lxqtpanelapplication.cpp
+++ b/panel/lxqtpanelapplication.cpp
@@ -79,10 +79,14 @@ LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv)
Q_D(LXQtPanelApplication);
QCoreApplication::setApplicationName(QLatin1String("lxqt-panel"));
- QCoreApplication::setApplicationVersion(LXQT_VERSION);
+ 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.setApplicationDescription(QLatin1String("LXQt Panel"));
parser.addHelpOption();
parser.addVersionOption();
diff --git a/panel/lxqtpanellayout.cpp b/panel/lxqtpanellayout.cpp
index 234276b..add12d2 100644
--- a/panel/lxqtpanellayout.cpp
+++ b/panel/lxqtpanellayout.cpp
@@ -701,7 +701,10 @@ void LXQtPanelLayout::setGeometryHoriz(const QRect &geometry)
}
else
{
- const int height = qMin(qMin(info.geometry.height(), geometry.height()), bh + (0 < remain-- ? 1 : 0));
+ 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)
@@ -746,7 +749,10 @@ void LXQtPanelLayout::setGeometryHoriz(const QRect &geometry)
}
else
{
- const int height = qMin(qMin(info.geometry.height(), geometry.height()), bh + (0 < remain-- ? 1 : 0));
+ 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)
@@ -834,7 +840,10 @@ void LXQtPanelLayout::setGeometryVert(const QRect &geometry)
else
{
rect.setHeight(qMin(info.geometry.height(), geometry.height()));
- const int width = qMin(qMin(info.geometry.width(), geometry.width()), bw + (0 < remain-- ? 1 : 0));
+ 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));
@@ -879,7 +888,10 @@ void LXQtPanelLayout::setGeometryVert(const QRect &geometry)
else
{
rect.setHeight(qMin(info.geometry.height(), geometry.height()));
- const int width = qMin(qMin(info.geometry.width(), geometry.width()), bw + (0 < remain-- ? 1 : 0));
+ 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));
diff --git a/panel/main.cpp b/panel/main.cpp
index ba6d047..4bbb2e4 100644
--- a/panel/main.cpp
+++ b/panel/main.cpp
@@ -37,6 +37,7 @@
int main(int argc, char *argv[])
{
LXQtPanelApplication app(argc, argv);
+ app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
return app.exec();
}
diff --git a/panel/plugin.cpp b/panel/plugin.cpp
index e98d330..416a87b 100644
--- a/panel/plugin.cpp
+++ b/panel/plugin.cpp
@@ -155,11 +155,12 @@ Plugin::Plugin(const LXQt::PluginInfo &desktopFile, LXQt::Settings *settings, co
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);
- saveSettings();
}
@@ -267,6 +268,7 @@ bool Plugin::loadLib(ILXQtPanelPluginLibrary const * pluginLib)
if (mPluginWidget)
{
mPluginWidget->setObjectName(mPlugin->themeId());
+ watchWidgets(mPluginWidget);
}
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
return true;
@@ -300,6 +302,34 @@ bool Plugin::loadModule(const QString &libraryName)
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);
+ }
+}
/************************************************
@@ -422,6 +452,28 @@ bool Plugin::isExpandable() const
}
+/************************************************
+
+ ************************************************/
+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;
+}
+
/************************************************
************************************************/
diff --git a/panel/plugin.h b/panel/plugin.h
index 1e0986c..20c26a4 100644
--- a/panel/plugin.h
+++ b/panel/plugin.h
@@ -81,6 +81,8 @@ public:
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; }
@@ -93,6 +95,11 @@ public slots:
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);
@@ -104,6 +111,8 @@ 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;
diff --git a/panel/resources/panel.conf b/panel/resources/panel.conf
index e833229..b749831 100644
--- a/panel/resources/panel.conf
+++ b/panel/resources/panel.conf
@@ -24,8 +24,8 @@ type=tray
[mount]
type=mount
-[clock]
-type=clock
+[worldclock]
+type=worldclock
[volume]
device=0
diff --git a/plugin-clock/lxqtclock.cpp b/plugin-clock/lxqtclock.cpp
index 34d8a63..9bfa746 100644
--- a/plugin-clock/lxqtclock.cpp
+++ b/plugin-clock/lxqtclock.cpp
@@ -44,6 +44,32 @@
#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
@@ -82,6 +108,8 @@ LXQtClock::LXQtClock(const ILXQtPanelPluginStartupInfo &startupInfo):
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();
diff --git a/plugin-clock/translations/clock_pl.desktop b/plugin-clock/translations/clock_pl.desktop
index baefee7..035b3e4 100644
--- a/plugin-clock/translations/clock_pl.desktop
+++ b/plugin-clock/translations/clock_pl.desktop
@@ -8,5 +8,5 @@ Comment=Displays the current time. Comes with a calendar.
# Translations
-Comment[pl]=Zegar oraz kalendarz
+Comment[pl]=Wyświetla obecny czas. Zawiera kalendarz.
Name[pl]=Zegar
diff --git a/plugin-clock/translations/clock_pl_PL.desktop b/plugin-clock/translations/clock_pl_PL.desktop
deleted file mode 100644
index 37b3bd9..0000000
--- a/plugin-clock/translations/clock_pl_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_PL]=Zegar i kalendarz
-Name[pl_PL]=Zegar
diff --git a/plugin-colorpicker/translations/colorpicker_pl_PL.desktop b/plugin-colorpicker/translations/colorpicker_lt.desktop
similarity index 60%
rename from plugin-colorpicker/translations/colorpicker_pl_PL.desktop
rename to plugin-colorpicker/translations/colorpicker_lt.desktop
index 5859c2d..7245a19 100644
--- a/plugin-colorpicker/translations/colorpicker_pl_PL.desktop
+++ b/plugin-colorpicker/translations/colorpicker_lt.desktop
@@ -6,5 +6,5 @@ Comment=Get the color under the cursor. For web developers.
# Translations
-Comment[pl_PL]=Pobierz kolor spod kursora. Dla webdeveloperów.
-Name[pl_PL]=Wybieracz kolorów
+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
new file mode 100644
index 0000000..edf202d
--- /dev/null
+++ b/plugin-colorpicker/translations/colorpicker_pl.desktop
@@ -0,0 +1,10 @@
+[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-cpuload/translations/cpuload_pl_PL.desktop b/plugin-cpuload/translations/cpuload_pl.desktop
similarity index 64%
rename from plugin-cpuload/translations/cpuload_pl_PL.desktop
rename to plugin-cpuload/translations/cpuload_pl.desktop
index 690b7e0..14dd5bf 100644
--- a/plugin-cpuload/translations/cpuload_pl_PL.desktop
+++ b/plugin-cpuload/translations/cpuload_pl.desktop
@@ -9,5 +9,5 @@ Comment=Displays the current CPU load.
# Translations
-Comment[pl_PL]=Monitor obciążenia CPU
-Name[pl_PL]=Obciążenie CPU
+Comment[pl]=Wyświetla obecne obciążenie CPU
+Name[pl]=Obciążenie CPU
diff --git a/plugin-desktopswitch/translations/desktopswitch_da.desktop b/plugin-desktopswitch/translations/desktopswitch_da.desktop
index 67e6bd6..77f70d0 100644
--- a/plugin-desktopswitch/translations/desktopswitch_da.desktop
+++ b/plugin-desktopswitch/translations/desktopswitch_da.desktop
@@ -9,4 +9,4 @@ Icon=user-desktop
# Translations
Name[da]=Skrivebordsskifter
-Comment[da]=Giver mulighed for nemt at skifte imellem virtuelle skriveborde.
+Comment[da]=Giver mulighed for nemt at skifte mellem virtuelle skriveborde.
diff --git a/plugin-desktopswitch/translations/desktopswitch_lt.desktop b/plugin-desktopswitch/translations/desktopswitch_lt.desktop
index b40fb0b..ca2912f 100644
--- a/plugin-desktopswitch/translations/desktopswitch_lt.desktop
+++ b/plugin-desktopswitch/translations/desktopswitch_lt.desktop
@@ -8,5 +8,5 @@ Comment=Allows easy switching between virtual desktops.
# Translations
-Comment[lt]=Leidžia judėti tarp virtualių darbalaukių
-Name[lt]=Darbalaukių perjungimas
+Comment[lt]=Leidžia lengvai perjunginėti virtualius darbalaukius
+Name[lt]=Darbalaukių perjungiklis
diff --git a/plugin-desktopswitch/translations/desktopswitch_pl.desktop b/plugin-desktopswitch/translations/desktopswitch_pl.desktop
index 5817287..653316e 100644
--- a/plugin-desktopswitch/translations/desktopswitch_pl.desktop
+++ b/plugin-desktopswitch/translations/desktopswitch_pl.desktop
@@ -8,5 +8,5 @@ Comment=Allows easy switching between virtual desktops.
# Translations
-Comment[pl]=Pozwala przełączać się pomiędzy writualnymi pulpitami
+Comment[pl]=Pozwala na proste przełączanie pomiędzy wirtualnymi pulpitami
Name[pl]=Obszary robocze
diff --git a/plugin-desktopswitch/translations/desktopswitch_pl_PL.desktop b/plugin-desktopswitch/translations/desktopswitch_pl_PL.desktop
deleted file mode 100644
index 28c49c5..0000000
--- a/plugin-desktopswitch/translations/desktopswitch_pl_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_PL]=Zezwól na przełączanie między pulpitami
-Name[pl_PL]=Zmień pulpit
diff --git a/plugin-directorymenu/directorymenu.cpp b/plugin-directorymenu/directorymenu.cpp
index 3a71b80..de75efe 100644
--- a/plugin-directorymenu/directorymenu.cpp
+++ b/plugin-directorymenu/directorymenu.cpp
@@ -46,7 +46,8 @@ DirectoryMenu::DirectoryMenu(const ILXQtPanelPluginStartupInfo &startupInfo) :
mOpenDirectorySignalMapper = new QSignalMapper(this);
mMenuSignalMapper = new QSignalMapper(this);
- mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+ mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ mButton.setAutoRaise(true);
mButton.setIcon(XdgIcon::fromTheme("folder"));
connect(&mButton, SIGNAL(clicked()), this, SLOT(showMenu()));
diff --git a/plugin-directorymenu/translations/directorymenu_it.desktop b/plugin-directorymenu/translations/directorymenu_it.desktop
index 9766bce..56c1537 100644
--- a/plugin-directorymenu/translations/directorymenu_it.desktop
+++ b/plugin-directorymenu/translations/directorymenu_it.desktop
@@ -1,2 +1,2 @@
-Name[it]=Menù cartella
+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
new file mode 100644
index 0000000..26496a0
--- /dev/null
+++ b/plugin-directorymenu/translations/directorymenu_lt.desktop
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..39c6168
--- /dev/null
+++ b/plugin-directorymenu/translations/directorymenu_pl.desktop
@@ -0,0 +1,2 @@
+Name[pl]=Menu katalogów
+Comment[pl]=Wyświetla menu z zawartością katalogów
diff --git a/plugin-dom/translations/dom_lt.desktop b/plugin-dom/translations/dom_lt.desktop
new file mode 100644
index 0000000..2babc26
--- /dev/null
+++ b/plugin-dom/translations/dom_lt.desktop
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..b97984e
--- /dev/null
+++ b/plugin-dom/translations/dom_pl.desktop
@@ -0,0 +1,2 @@
+Name[pl]=Drzewo DOM panelu
+Comment[pl]=Wyświetla drzewo DOM panelu LXQt.
diff --git a/plugin-kbindicator/src/x11/kbdlayout.cpp b/plugin-kbindicator/src/x11/kbdlayout.cpp
index c4aa4e2..883df07 100644
--- a/plugin-kbindicator/src/x11/kbdlayout.cpp
+++ b/plugin-kbindicator/src/x11/kbdlayout.cpp
@@ -33,8 +33,15 @@
#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"
diff --git a/plugin-kbindicator/translations/kbindicator_lt.desktop b/plugin-kbindicator/translations/kbindicator_lt.desktop
new file mode 100644
index 0000000..ef1893a
--- /dev/null
+++ b/plugin-kbindicator/translations/kbindicator_lt.desktop
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..a0584dc
--- /dev/null
+++ b/plugin-kbindicator/translations/kbindicator_pl.desktop
@@ -0,0 +1,2 @@
+Name[pl]=Wskaźnik stanu klawiatury
+Comment[pl]=Wskaźnik i przełącznik stanu klawiatury.
diff --git a/plugin-mainmenu/lxqtmainmenu.cpp b/plugin-mainmenu/lxqtmainmenu.cpp
index 8f943dc..487ed8f 100644
--- a/plugin-mainmenu/lxqtmainmenu.cpp
+++ b/plugin-mainmenu/lxqtmainmenu.cpp
@@ -61,6 +61,7 @@ LXQtMainMenu::LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo):
mMakeDirtyAction{new QAction{this}},
mFilterMenu(true),
mFilterShow(true),
+ mFilterClear(false),
mFilterShowHideMenu(true),
mHeavyMenuChanges(false)
{
@@ -127,6 +128,7 @@ LXQtMainMenu::~LXQtMainMenu()
{
mMenu->removeAction(mSearchEditAction);
mMenu->removeAction(mSearchViewAction);
+ delete mMenu;
}
#ifdef HAVE_MENU_CACHE
if(mMenuCache)
@@ -163,6 +165,10 @@ void LXQtMainMenu::showMenu()
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
@@ -213,8 +219,11 @@ void LXQtMainMenu::settingsChanged()
menu_cache_unref(mMenuCache);
}
mMenuCache = menu_cache_lookup(mMenuFile.toLocal8Bit());
- if (menu_cache_get_root_dir(mMenuCache))
+ 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");
@@ -240,6 +249,7 @@ void LXQtMainMenu::settingsChanged()
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)
{
@@ -287,6 +297,18 @@ static void showHideMenuEntries(QMenu * menu, bool 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);
+ }
+ }
+}
+
/************************************************
************************************************/
@@ -326,6 +348,16 @@ void LXQtMainMenu::setSearchFocus(QAction *action)
}
}
+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);
+}
+
/************************************************
************************************************/
@@ -343,6 +375,7 @@ void LXQtMainMenu::buildMenu()
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
@@ -351,13 +384,7 @@ void LXQtMainMenu::buildMenu()
mMenu->addSeparator();
- Q_FOREACH(QAction* action, mMenu->actions())
- {
- if (action->menu())
- action->menu()->installEventFilter(this);
- }
-
- mMenu->installEventFilter(this);
+ menuInstallEventFilter(mMenu, this);
connect(mMenu, &QMenu::aboutToHide, &mHideTimer, static_cast(&QTimer::start));
connect(mMenu, &QMenu::aboutToShow, &mHideTimer, &QTimer::stop);
@@ -470,19 +497,21 @@ bool LXQtMainMenu::eventFilter(QObject *obj, QEvent *event)
mMenu->hide(); // close the app menu
return true;
}
- else // go to the menu item starts with the pressed key
+ 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();
- 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(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);
+ }
}
}
diff --git a/plugin-mainmenu/lxqtmainmenu.h b/plugin-mainmenu/lxqtmainmenu.h
index ec82d59..0b149c5 100644
--- a/plugin-mainmenu/lxqtmainmenu.h
+++ b/plugin-mainmenu/lxqtmainmenu.h
@@ -97,6 +97,7 @@ private:
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
diff --git a/plugin-mainmenu/lxqtmainmenuconfiguration.cpp b/plugin-mainmenu/lxqtmainmenuconfiguration.cpp
index 5f97f3b..b5c5f00 100644
--- a/plugin-mainmenu/lxqtmainmenuconfiguration.cpp
+++ b/plugin-mainmenu/lxqtmainmenuconfiguration.cpp
@@ -77,10 +77,12 @@ LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(PluginSettings *settings, G
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)
@@ -95,6 +97,10 @@ LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(PluginSettings *settings, G
{
this->settings().setValue("filterShowHideMenu", enabled);
});
+ connect(ui->filterClearCB, &QCheckBox::toggled, [this] (bool enabled)
+ {
+ this->settings().setValue("filterClear", enabled);
+ });
}
LXQtMainMenuConfiguration::~LXQtMainMenuConfiguration()
@@ -124,7 +130,8 @@ void LXQtMainMenuConfiguration::loadSettings()
systemFont.fromString(lxqtSettings.value("font", this->font()).toString());
lxqtSettings.endGroup();
ui->customFontSizeSB->setValue(settings().value("customFontSize", systemFont.pointSize()).toInt());
- ui->filterMenuCB->setChecked(settings().value("filterMenu", true).toBool());
+ 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);
@@ -135,6 +142,8 @@ void LXQtMainMenuConfiguration::loadSettings()
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);
}
diff --git a/plugin-mainmenu/lxqtmainmenuconfiguration.ui b/plugin-mainmenu/lxqtmainmenuconfiguration.ui
index 9359fbd..3ab261f 100644
--- a/plugin-mainmenu/lxqtmainmenuconfiguration.ui
+++ b/plugin-mainmenu/lxqtmainmenuconfiguration.ui
@@ -150,19 +150,6 @@
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 41
-
-
-
-
-
@@ -224,9 +211,29 @@
+ -
+
+
+ Clear search upon showing menu
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 41
+
+
+
+
-
diff --git a/plugin-mainmenu/translations/mainmenu_pl.desktop b/plugin-mainmenu/translations/mainmenu_pl.desktop
index a6491d3..1cc748b 100644
--- a/plugin-mainmenu/translations/mainmenu_pl.desktop
+++ b/plugin-mainmenu/translations/mainmenu_pl.desktop
@@ -8,5 +8,5 @@ Comment=A menu of all your applications.
# Translations
-Comment[pl]=Główne menu
+Comment[pl]=Menu pozwalające na uruchomienie i wyszukiwanie wszystkich aplikacji.
Name[pl]=Menu
diff --git a/plugin-mainmenu/translations/mainmenu_pl_PL.desktop b/plugin-mainmenu/translations/mainmenu_pl_PL.desktop
deleted file mode 100644
index af61999..0000000
--- a/plugin-mainmenu/translations/mainmenu_pl_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_PL]=Menu aplikacji
-Name[pl_PL]=Menu
diff --git a/plugin-mainmenu/xdgcachedmenu.cpp b/plugin-mainmenu/xdgcachedmenu.cpp
index 255f69e..864c63d 100644
--- a/plugin-mainmenu/xdgcachedmenu.cpp
+++ b/plugin-mainmenu/xdgcachedmenu.cpp
@@ -35,8 +35,8 @@
#include
XdgCachedMenuAction::XdgCachedMenuAction(MenuCacheItem* item, QObject* parent):
- QAction(parent),
- item_(menu_cache_item_ref(item))
+ 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
@@ -47,19 +47,18 @@ XdgCachedMenuAction::XdgCachedMenuAction(MenuCacheItem* item, QObject* parent):
QString comment = QString::fromUtf8(menu_cache_item_get_comment(item));
setToolTip(comment);
}
-}
-
-XdgCachedMenuAction::~XdgCachedMenuAction()
-{
- if(item_)
- menu_cache_item_unref(item_);
+ 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(menu_cache_item_get_icon(item_));
+ QIcon icon = XdgIcon::fromTheme(iconName_, QIcon::fromTheme("unknown"));
setIcon(icon);
}
}
@@ -72,7 +71,7 @@ XdgCachedMenu::XdgCachedMenu(QWidget* parent): QMenu(parent)
XdgCachedMenu::XdgCachedMenu(MenuCache* menuCache, QWidget* parent): QMenu(parent)
{
// qDebug() << "CREATE MENU FROM CACHE" << menuCache;
- MenuCacheDir* dir = menu_cache_get_root_dir(menuCache);
+ MenuCacheDir* dir = menu_cache_dup_root_dir(menuCache);
// get current desktop name or fallback to LXQt
const QByteArray xdgDesktop = qgetenv("XDG_CURRENT_DESKTOP");
@@ -80,6 +79,7 @@ XdgCachedMenu::XdgCachedMenu(MenuCache* menuCache, QWidget* parent): QMenu(paren
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()));
}
@@ -89,7 +89,8 @@ XdgCachedMenu::~XdgCachedMenu()
void XdgCachedMenu::addMenuItems(QMenu* menu, MenuCacheDir* dir)
{
- for(GSList* l = menu_cache_dir_get_children(dir); l; l = l->next)
+ 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);
@@ -122,16 +123,17 @@ void XdgCachedMenu::addMenuItems(QMenu* menu, MenuCacheDir* dir)
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;
- char* desktop_file = menu_cache_item_get_file_path(action->item());
- df.load(desktop_file);
- g_free(desktop_file);
+ df.load(action->filePath());
df.startDetached();
}
@@ -176,9 +178,7 @@ void XdgCachedMenu::handleMouseMoveEvent(QMouseEvent *event)
return;
QList urls;
- char* desktop_file = menu_cache_item_get_file_path(a->item());
- urls << QUrl(QString("file://%1").arg(desktop_file));
- g_free(desktop_file);
+ urls << QUrl(QString("file://%1").arg(a->filePath()));
QMimeData *mimeData = new QMimeData();
mimeData->setUrls(urls);
diff --git a/plugin-mainmenu/xdgcachedmenu.h b/plugin-mainmenu/xdgcachedmenu.h
index 980f1d5..b9f953d 100644
--- a/plugin-mainmenu/xdgcachedmenu.h
+++ b/plugin-mainmenu/xdgcachedmenu.h
@@ -56,16 +56,13 @@ class XdgCachedMenuAction: public QAction
Q_OBJECT
public:
explicit XdgCachedMenuAction(MenuCacheItem* item, QObject* parent = 0);
- virtual ~XdgCachedMenuAction();
-
- MenuCacheItem* item() const {
- return item_;
- }
+ inline const QString & filePath() const { return filePath_; }
void updateIcon();
private:
- MenuCacheItem* item_;
+ QString iconName_;
+ QString filePath_;
};
diff --git a/plugin-mount/actions/deviceaction.cpp b/plugin-mount/actions/deviceaction.cpp
index 8843347..2efc780 100644
--- a/plugin-mount/actions/deviceaction.cpp
+++ b/plugin-mount/actions/deviceaction.cpp
@@ -80,18 +80,14 @@ QString DeviceAction::actionIdToString(DeviceAction::ActionId id)
return ACT_INFO;
}
-void DeviceAction::onDeviceAdded(QString const & udi)
+void DeviceAction::onDeviceAdded(Solid::Device device)
{
- Solid::Device device(udi);
- if (device.is())
- doDeviceAdded(device);
+ doDeviceAdded(device);
}
-void DeviceAction::onDeviceRemoved(QString const & udi)
+void DeviceAction::onDeviceRemoved(Solid::Device device)
{
- Solid::Device device(udi);
- if (device.is())
- doDeviceRemoved(device);
+ doDeviceRemoved(device);
}
DeviceAction::ActionId DeviceAction::stringToActionId(const QString &string, ActionId defaultValue)
diff --git a/plugin-mount/actions/deviceaction.h b/plugin-mount/actions/deviceaction.h
index 8b46f37..8d414e3 100644
--- a/plugin-mount/actions/deviceaction.h
+++ b/plugin-mount/actions/deviceaction.h
@@ -54,8 +54,8 @@ public:
static QString actionIdToString(ActionId id);
public slots:
- void onDeviceAdded(QString const & udi);
- void onDeviceRemoved(QString const & udi);
+ void onDeviceAdded(Solid::Device device);
+ void onDeviceRemoved(Solid::Device device);
protected:
explicit DeviceAction(LXQtMountPlugin *plugin, QObject *parent = 0);
diff --git a/plugin-mount/lxqtmountplugin.cpp b/plugin-mount/lxqtmountplugin.cpp
index 064724f..4158825 100644
--- a/plugin-mount/lxqtmountplugin.cpp
+++ b/plugin-mount/lxqtmountplugin.cpp
@@ -41,6 +41,8 @@ LXQtMountPlugin::LXQtMountPlugin(const ILXQtPanelPluginStartupInfo &startupInfo)
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()
@@ -74,11 +76,8 @@ void LXQtMountPlugin::settingsChanged()
delete mDeviceAction;
mDeviceAction = DeviceAction::create(actionId, this);
- connect(Solid::DeviceNotifier::instance(), &Solid::DeviceNotifier::deviceAdded,
- mDeviceAction, &DeviceAction::onDeviceAdded);
-
- connect(Solid::DeviceNotifier::instance(), &Solid::DeviceNotifier::deviceRemoved,
- mDeviceAction, &DeviceAction::onDeviceRemoved);
+ connect(mPopup, &Popup::deviceAdded, mDeviceAction, &DeviceAction::onDeviceAdded);
+ connect(mPopup, &Popup::deviceRemoved, mDeviceAction, &DeviceAction::onDeviceRemoved);
}
}
diff --git a/plugin-mount/popup.cpp b/plugin-mount/popup.cpp
index 7993681..0de6dd4 100644
--- a/plugin-mount/popup.cpp
+++ b/plugin-mount/popup.cpp
@@ -131,6 +131,8 @@ void Popup::onDeviceRemoved(QString const & udi)
--mDisplayCount;
if (mDisplayCount == 0)
mPlaceholder->show();
+
+ emit deviceRemoved(Solid::Device{udi});
}
}
@@ -163,6 +165,8 @@ void Popup::addItem(Solid::Device device)
if (isVisible())
realign();
+
+ emit deviceAdded(device);
}
void Popup::realign()
diff --git a/plugin-mount/popup.h b/plugin-mount/popup.h
index d00b9db..53a4659 100644
--- a/plugin-mount/popup.h
+++ b/plugin-mount/popup.h
@@ -54,6 +54,16 @@ private slots:
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);
diff --git a/plugin-mount/translations/mount_da.desktop b/plugin-mount/translations/mount_da.desktop
index 4837f7a..ca3910d 100644
--- a/plugin-mount/translations/mount_da.desktop
+++ b/plugin-mount/translations/mount_da.desktop
@@ -9,4 +9,4 @@ Icon=drive-removable-media
# Translations
Name[da]=Flytbare medier
-Comment[da]=Nem montering og afmontering af USB og optiske drev.
+Comment[da]=Nem montering og afmontering af USB- og optiske drev.
diff --git a/plugin-mount/translations/mount_lt.desktop b/plugin-mount/translations/mount_lt.desktop
index f4d2058..aa68375 100644
--- a/plugin-mount/translations/mount_lt.desktop
+++ b/plugin-mount/translations/mount_lt.desktop
@@ -8,5 +8,5 @@ Comment=Easy mounting and unmounting of USB and optical drives.
# Translations
-Comment[lt]=Pašalinimų įrenginių tvarkymas (USB, CD, DVD, ...)
-Name[lt]=Pašalinami įrenginiai
+Comment[lt]=Lengvas USB ir optinių diskų prijungimas ir atjungimas.
+Name[lt]=Keičiamosios laikmenos
diff --git a/plugin-mount/translations/mount_pl.desktop b/plugin-mount/translations/mount_pl.desktop
index edf188b..e5eba0e 100644
--- a/plugin-mount/translations/mount_pl.desktop
+++ b/plugin-mount/translations/mount_pl.desktop
@@ -8,5 +8,5 @@ Comment=Easy mounting and unmounting of USB and optical drives.
# Translations
-Comment[pl]=Menedżer urządzeń (USB, CD, DVD, ...)
+Comment[pl]=Menedżer urządzeń wymiennych
Name[pl]=Menedżer urządzeń
diff --git a/plugin-mount/translations/mount_pl_PL.desktop b/plugin-mount/translations/mount_pl_PL.desktop
deleted file mode 100644
index 68eef0c..0000000
--- a/plugin-mount/translations/mount_pl_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_PL]=Nośniki wymienne (USB, CD, DVD, ...)
-Name[pl_PL]=Nośniki wymienne
diff --git a/plugin-networkmonitor/translations/networkmonitor_lt.desktop b/plugin-networkmonitor/translations/networkmonitor_lt.desktop
new file mode 100644
index 0000000..351d67e
--- /dev/null
+++ b/plugin-networkmonitor/translations/networkmonitor_lt.desktop
@@ -0,0 +1,2 @@
+Name[lt]=Tinklo prižiūryklė
+Comment[lt]=Rodo tinklo būseną ir veiklą
diff --git a/plugin-networkmonitor/translations/networkmonitor_pl.desktop b/plugin-networkmonitor/translations/networkmonitor_pl.desktop
index 90348bf..f7fb15b 100644
--- a/plugin-networkmonitor/translations/networkmonitor_pl.desktop
+++ b/plugin-networkmonitor/translations/networkmonitor_pl.desktop
@@ -6,5 +6,5 @@ Name=Network monitor
Comment=Displays network status and activity.
# Translations
-Name[pl]=monitor sieci
-Comment[pl]=pokazuje stan i aktywność sieci.
+Name[pl]=Monitorowanie sieci
+Comment[pl]=Wyświetla stan i aktywność sieci.
diff --git a/plugin-quicklaunch/quicklaunchaction.cpp b/plugin-quicklaunch/quicklaunchaction.cpp
index 3b6e821..aa03f47 100644
--- a/plugin-quicklaunch/quicklaunchaction.cpp
+++ b/plugin-quicklaunch/quicklaunchaction.cpp
@@ -56,7 +56,7 @@ QuickLaunchAction::QuickLaunchAction(const QString & name,
setIcon(QIcon(icon));
setData(exec);
- connect(this, SIGNAL(triggered()), this, SLOT(execAction()));
+ connect(this, &QAction::triggered, this, [this] { execAction(); });
}
QuickLaunchAction::QuickLaunchAction(const XdgDesktopFile * xdg,
@@ -77,7 +77,16 @@ QuickLaunchAction::QuickLaunchAction(const XdgDesktopFile * xdg,
setIcon(xdg->icon(XdgIcon::defaultApplicationIcon()));
setData(xdg->fileName());
- connect(this, SIGNAL(triggered()), this, SLOT(execAction()));
+ 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)
@@ -103,10 +112,10 @@ QuickLaunchAction::QuickLaunchAction(const QString & fileName, QWidget * parent)
setIcon(mi.icon());
}
- connect(this, SIGNAL(triggered()), this, SLOT(execAction()));
+ connect(this, &QAction::triggered, this, [this] { execAction(); });
}
-void QuickLaunchAction::execAction()
+void QuickLaunchAction::execAction(QString additionalAction)
{
QString exec(data().toString());
qDebug() << "execAction" << exec;
@@ -119,7 +128,12 @@ void QuickLaunchAction::execAction()
{
XdgDesktopFile xdg;
if(xdg.load(exec))
- xdg.startDetached();
+ {
+ if (additionalAction.isEmpty())
+ xdg.startDetached();
+ else
+ xdg.actionActivate(additionalAction, QStringList{});
+ }
break;
}
case ActionFile:
diff --git a/plugin-quicklaunch/quicklaunchaction.h b/plugin-quicklaunch/quicklaunchaction.h
index 01d8f1d..662c392 100644
--- a/plugin-quicklaunch/quicklaunchaction.h
+++ b/plugin-quicklaunch/quicklaunchaction.h
@@ -66,8 +66,14 @@ public:
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();
+ void execAction(QString additionalAction = QString{});
private:
enum ActionType { ActionLegacy, ActionXdg, ActionFile };
@@ -75,6 +81,7 @@ private:
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
index d002e68..6b6644b 100644
--- a/plugin-quicklaunch/quicklaunchbutton.cpp
+++ b/plugin-quicklaunch/quicklaunchbutton.cpp
@@ -64,6 +64,7 @@ QuickLaunchButton::QuickLaunchButton(QuickLaunchAction * act, ILXQtPanelPlugin *
addAction(mDeleteAct);
mMenu = new QMenu(this);
mMenu->addAction(mAct);
+ mMenu->addActions(mAct->addtitionalActions());
mMenu->addSeparator();
mMenu->addAction(mMoveLeftAct);
mMenu->addAction(mMoveRightAct);
@@ -97,7 +98,7 @@ void QuickLaunchButton::this_customContextMenuRequested(const QPoint & pos)
mMoveLeftAct->setEnabled( panel && panel->indexOfButton(this) > 0);
mMoveRightAct->setEnabled(panel && panel->indexOfButton(this) < panel->countOfButtons() - 1);
mPlugin->willShowWindow(mMenu);
- mMenu->popup(mPlugin->calculatePopupWindowPos(mMenu->sizeHint()).topLeft());
+ mMenu->popup(mPlugin->panel()->calculatePopupWindowPos(mapToGlobal({0, 0}), mMenu->sizeHint()).topLeft());
}
diff --git a/plugin-quicklaunch/translations/quicklaunch_lt.desktop b/plugin-quicklaunch/translations/quicklaunch_lt.desktop
index 769553b..cd44313 100644
--- a/plugin-quicklaunch/translations/quicklaunch_lt.desktop
+++ b/plugin-quicklaunch/translations/quicklaunch_lt.desktop
@@ -8,5 +8,5 @@ Comment=Easy access to your favourite applications.
# Translations
-Comment[lt]=Paleiskite savo mėgstamas programas
-Name[lt]=Greitasis paleidimas
+Comment[lt]=Lengva prieiga prie jūsų mėgstamų programų
+Name[lt]=Spartusis paleidimas
diff --git a/plugin-quicklaunch/translations/quicklaunch_pl.desktop b/plugin-quicklaunch/translations/quicklaunch_pl.desktop
index 037b5c4..687ec81 100644
--- a/plugin-quicklaunch/translations/quicklaunch_pl.desktop
+++ b/plugin-quicklaunch/translations/quicklaunch_pl.desktop
@@ -8,5 +8,5 @@ Comment=Easy access to your favourite applications.
# Translations
-Comment[pl]=Uruchamiaj Twoje ulubione aplikacje
+Comment[pl]=Szybki dostęp do Twoich ulubionych aplikacji.
Name[pl]=Szybkie uruchamianie
diff --git a/plugin-quicklaunch/translations/quicklaunch_pl_PL.desktop b/plugin-quicklaunch/translations/quicklaunch_pl_PL.desktop
deleted file mode 100644
index 9485352..0000000
--- a/plugin-quicklaunch/translations/quicklaunch_pl_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_PL]=Uruchom swoje ulubione aplikacje.
-Name[pl_PL]=Szybkie uruchamianie
diff --git a/plugin-sensors/translations/sensors_da.desktop b/plugin-sensors/translations/sensors_da.desktop
index 5470af6..d51180c 100644
--- a/plugin-sensors/translations/sensors_da.desktop
+++ b/plugin-sensors/translations/sensors_da.desktop
@@ -9,4 +9,4 @@ Comment=View readings from hardware sensors.
# Translations
Name[da]=Sensorer
-Comment[da]=Vis målinger fra hardware-sensorer
+Comment[da]=Vis målinger fra hardware-sensorer.
diff --git a/plugin-sensors/translations/sensors_lt.desktop b/plugin-sensors/translations/sensors_lt.desktop
index ea30d5b..f19ba0d 100644
--- a/plugin-sensors/translations/sensors_lt.desktop
+++ b/plugin-sensors/translations/sensors_lt.desktop
@@ -7,4 +7,4 @@ Comment=View readings from hardware sensors.
# Translations
Name[lt]=Jutikliai
-Comment[lt]=Rodo nuskaitymus iš jutiklių (lm_sensors)
+Comment[lt]=Rodo aparatinės įrangos jutiklių duomenis.
diff --git a/plugin-sensors/translations/sensors_pl_PL.desktop b/plugin-sensors/translations/sensors_pl.desktop
similarity index 60%
rename from plugin-sensors/translations/sensors_pl_PL.desktop
rename to plugin-sensors/translations/sensors_pl.desktop
index 760269d..fd1b290 100644
--- a/plugin-sensors/translations/sensors_pl_PL.desktop
+++ b/plugin-sensors/translations/sensors_pl.desktop
@@ -6,5 +6,5 @@ Comment=View readings from hardware sensors.
# Translations
-Name[pl_PL]=Czujniki
-Comment[pl_PL]=Pokaż wskazania z czujników (aktualnie lm_sensors)
+Name[pl]=Czujniki
+Comment[pl]=Wyświetla wskazania z czujników sprzętowych.
diff --git a/plugin-showdesktop/translations/showdesktop_lt.desktop b/plugin-showdesktop/translations/showdesktop_lt.desktop
index c84e63f..50332d3 100644
--- a/plugin-showdesktop/translations/showdesktop_lt.desktop
+++ b/plugin-showdesktop/translations/showdesktop_lt.desktop
@@ -8,5 +8,5 @@ Comment=Minimize all windows and show the desktop
# Translations
-Comment[lt]=Sumažina visus langus ir rodo darbalaukį
+Comment[lt]=Suskleidžia visus langus ir rodo darbalaukį
Name[lt]=Darbalaukio rodymas
diff --git a/plugin-showdesktop/translations/showdesktop_pl_PL.desktop b/plugin-showdesktop/translations/showdesktop_pl_PL.desktop
deleted file mode 100644
index c4eb4c0..0000000
--- a/plugin-showdesktop/translations/showdesktop_pl_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_PL]=Minimalizuj wszystkie okna i pokaż pulpit
-Name[pl_PL]=Pokaż pulpit
diff --git a/plugin-spacer/translations/spacer_da.desktop b/plugin-spacer/translations/spacer_da.desktop
index 18fe603..0293f01 100644
--- a/plugin-spacer/translations/spacer_da.desktop
+++ b/plugin-spacer/translations/spacer_da.desktop
@@ -9,4 +9,4 @@ Icon=bookmark-new
# Translations
Name[da]=Mellemrum
-Comment[da]=Mellemrum imellem widgets
\ No newline at end of file
+Comment[da]=Mellemrum mellem widgets
diff --git a/plugin-spacer/translations/spacer_lt.desktop b/plugin-spacer/translations/spacer_lt.desktop
new file mode 100644
index 0000000..33a9e14
--- /dev/null
+++ b/plugin-spacer/translations/spacer_lt.desktop
@@ -0,0 +1,2 @@
+Name[lt]=Tarpiklis
+Comment[lt]=Tarpas tarp valdiklių
diff --git a/plugin-spacer/translations/spacer_pl.desktop b/plugin-spacer/translations/spacer_pl.desktop
new file mode 100644
index 0000000..2eb1649
--- /dev/null
+++ b/plugin-spacer/translations/spacer_pl.desktop
@@ -0,0 +1,2 @@
+Name[pl]=Odstęp
+Comment[pl]=Odstęp między elementami
diff --git a/plugin-statusnotifier/statusnotifierbutton.cpp b/plugin-statusnotifier/statusnotifierbutton.cpp
index 37d8c7f..5cc894b 100644
--- a/plugin-statusnotifier/statusnotifierbutton.cpp
+++ b/plugin-statusnotifier/statusnotifierbutton.cpp
@@ -60,6 +60,7 @@ StatusNotifierButton::StatusNotifierButton(QString service, QString objectPath,
mFallbackIcon(QIcon::fromTheme("application-x-executable")),
mPlugin(plugin)
{
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setAutoRaise(true);
interface = new SniAsync(service, objectPath, QDBusConnection::sessionBus(), this);
diff --git a/plugin-statusnotifier/statusnotifierwidget.cpp b/plugin-statusnotifier/statusnotifierwidget.cpp
index e3b6152..50bf5fb 100644
--- a/plugin-statusnotifier/statusnotifierwidget.cpp
+++ b/plugin-statusnotifier/statusnotifierwidget.cpp
@@ -68,7 +68,6 @@ void StatusNotifierWidget::itemAdded(QString serviceAndPath)
mServices.insert(serviceAndPath, button);
layout()->addWidget(button);
- layout()->setAlignment(button, Qt::AlignCenter);
button->show();
}
diff --git a/plugin-statusnotifier/translations/statusnotifier_lt.desktop b/plugin-statusnotifier/translations/statusnotifier_lt.desktop
new file mode 100644
index 0000000..05b8081
--- /dev/null
+++ b/plugin-statusnotifier/translations/statusnotifier_lt.desktop
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..c41011a
--- /dev/null
+++ b/plugin-statusnotifier/translations/statusnotifier_pl.desktop
@@ -0,0 +1,2 @@
+Name[pl]=Wtyczka powiadomień o stanie
+Comment[pl]=Wtyczka powiadomień o stanie
diff --git a/plugin-sysstat/lxqtsysstatconfiguration.cpp b/plugin-sysstat/lxqtsysstatconfiguration.cpp
index 1ca24fd..0e901de 100644
--- a/plugin-sysstat/lxqtsysstatconfiguration.cpp
+++ b/plugin-sysstat/lxqtsysstatconfiguration.cpp
@@ -51,34 +51,33 @@ namespace
auto t = localizationWorkaround;//avoid unused function warning
void localizationWorkaround()
{
- const char * loc;
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu0");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu1");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu2");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu3");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu4");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu5");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu6");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu7");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu8");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu9");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu10");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu11");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu12");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu13");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu14");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu15");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu16");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu17");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu18");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu19");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu20");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu21");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu22");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu23");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "memory");
- loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "swap");
+ 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
}
}
@@ -105,6 +104,7 @@ LXQtSysStatConfiguration::LXQtSysStatConfiguration(PluginSettings *settings, QWi
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);
diff --git a/plugin-sysstat/translations/sysstat_lt.desktop b/plugin-sysstat/translations/sysstat_lt.desktop
new file mode 100644
index 0000000..8c938be
--- /dev/null
+++ b/plugin-sysstat/translations/sysstat_lt.desktop
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..6b9e777
--- /dev/null
+++ b/plugin-sysstat/translations/sysstat_pl.desktop
@@ -0,0 +1,2 @@
+Name[pl]=Statystyki systemowe
+Comment[pl]=Wtyczka statystyk systemu.
diff --git a/plugin-taskbar/CMakeLists.txt b/plugin-taskbar/CMakeLists.txt
index 3e646cc..4f7b34d 100644
--- a/plugin-taskbar/CMakeLists.txt
+++ b/plugin-taskbar/CMakeLists.txt
@@ -24,6 +24,7 @@ set(UIS
set(LIBRARIES
lxqt
+ lxqt-globalkeys
Qt5Xdg
)
diff --git a/plugin-taskbar/lxqtgrouppopup.cpp b/plugin-taskbar/lxqtgrouppopup.cpp
index e7db7fc..c518149 100644
--- a/plugin-taskbar/lxqtgrouppopup.cpp
+++ b/plugin-taskbar/lxqtgrouppopup.cpp
@@ -34,6 +34,8 @@
#include
#include
#include
+#include
+#include
#include
/************************************************
@@ -50,6 +52,7 @@ LXQtGroupPopup::LXQtGroupPopup(LXQtTaskGroup *group):
setAcceptDrops(true);
setWindowFlags(Qt::FramelessWindowHint | Qt::ToolTip);
setAttribute(Qt::WA_AlwaysShowToolTips);
+ setAttribute(Qt::WA_TranslucentBackground);
setLayout(new QVBoxLayout);
layout()->setSpacing(3);
@@ -142,6 +145,14 @@ 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)
diff --git a/plugin-taskbar/lxqtgrouppopup.h b/plugin-taskbar/lxqtgrouppopup.h
index 4a4c227..5dbfd22 100644
--- a/plugin-taskbar/lxqtgrouppopup.h
+++ b/plugin-taskbar/lxqtgrouppopup.h
@@ -67,6 +67,7 @@ protected:
void dropEvent(QDropEvent * event);
void leaveEvent(QEvent * event);
void enterEvent(QEvent * event);
+ void paintEvent(QPaintEvent * event);
void closeTimerSlot();
diff --git a/plugin-taskbar/lxqttaskbar.cpp b/plugin-taskbar/lxqttaskbar.cpp
index eb880ed..344bea9 100644
--- a/plugin-taskbar/lxqttaskbar.cpp
+++ b/plugin-taskbar/lxqttaskbar.cpp
@@ -31,6 +31,7 @@
#include
#include
+#include
#include
#include
#include
@@ -41,6 +42,7 @@
#include
#include
+#include
#include
#include
@@ -54,6 +56,7 @@ using namespace LXQt;
************************************************/
LXQtTaskBar::LXQtTaskBar(ILXQtPanelPlugin *plugin, QWidget *parent) :
QFrame(parent),
+ mSignalMapper(new QSignalMapper(this)),
mButtonStyle(Qt::ToolButtonTextBesideIcon),
mCloseOnMiddleClick(true),
mRaiseOnCurrentDesktop(true),
@@ -84,6 +87,9 @@ LXQtTaskBar::LXQtTaskBar(ILXQtPanelPlugin *plugin, QWidget *parent) :
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);
@@ -617,3 +623,67 @@ void LXQtTaskBar::changeEvent(QEvent* event)
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
index 98fd4a8..5c6693c 100644
--- a/plugin-taskbar/lxqttaskbar.h
+++ b/plugin-taskbar/lxqttaskbar.h
@@ -42,11 +42,13 @@
#include
#include
#include
+#include
#include "../panel/ilxqtpanel.h"
#include
#include
#include
+class QSignalMapper;
class LXQtTaskButton;
class ElidedButtonStyle;
@@ -102,6 +104,9 @@ private slots:
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;
@@ -114,6 +119,8 @@ private:
private:
QMap mKnownWindows; //!< Ids of known windows (mapping to buttons/groups)
LXQt::GridLayout *mLayout;
+ QList mKeys;
+ QSignalMapper *mSignalMapper;
// Settings
Qt::ToolButtonStyle mButtonStyle;
diff --git a/plugin-taskbar/lxqttaskbarconfiguration.ui b/plugin-taskbar/lxqttaskbarconfiguration.ui
index 13b4687..d3439bd 100644
--- a/plugin-taskbar/lxqttaskbarconfiguration.ui
+++ b/plugin-taskbar/lxqttaskbarconfiguration.ui
@@ -99,7 +99,7 @@
-
- Show popup on mouse hover
+ Show popup on mouse hover
diff --git a/plugin-taskbar/lxqttaskbutton.cpp b/plugin-taskbar/lxqttaskbutton.cpp
index 08e4509..894343e 100644
--- a/plugin-taskbar/lxqttaskbutton.cpp
+++ b/plugin-taskbar/lxqttaskbutton.cpp
@@ -68,7 +68,8 @@ void LeftAlignedTextStyle::drawItemText(QPainter * painter, const QRect & rect,
, const QPalette & pal, bool enabled, const QString & text
, QPalette::ColorRole textRole) const
{
- return QProxyStyle::drawItemText(painter, rect, (flags & ~Qt::AlignHCenter) | Qt::AlignLeft, pal, enabled, text, textRole);
+ 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);
}
diff --git a/plugin-taskbar/lxqttaskgroup.cpp b/plugin-taskbar/lxqttaskgroup.cpp
index f1cba5b..3efc514 100644
--- a/plugin-taskbar/lxqttaskgroup.cpp
+++ b/plugin-taskbar/lxqttaskgroup.cpp
@@ -490,17 +490,12 @@ int LXQtTaskGroup::recalculateFrameHeight() const
************************************************/
int LXQtTaskGroup::recalculateFrameWidth() const
{
- // FIXME: 300?
- int minimum = 300;
- int hh = width();
-
- if (!plugin()->panel()->isHorizontal() && !parentTaskBar()->isAutoRotate())
- hh = height();
-
- if (hh < minimum)
- hh = minimum;
-
- return hh;
+ 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*/;
}
/************************************************
diff --git a/plugin-taskbar/translations/taskbar_da.desktop b/plugin-taskbar/translations/taskbar_da.desktop
index 92f62ac..9139a8a 100644
--- a/plugin-taskbar/translations/taskbar_da.desktop
+++ b/plugin-taskbar/translations/taskbar_da.desktop
@@ -9,4 +9,4 @@ Icon=window-duplicate
# Translations
Name[da]=Opgavehåndtering
-Comment[da]=Skift imellem kørende programmer
+Comment[da]=Skift mellem kørende programmer
diff --git a/plugin-taskbar/translations/taskbar_lt.desktop b/plugin-taskbar/translations/taskbar_lt.desktop
index 9619591..5763167 100644
--- a/plugin-taskbar/translations/taskbar_lt.desktop
+++ b/plugin-taskbar/translations/taskbar_lt.desktop
@@ -8,5 +8,5 @@ Comment=Switch between running applications
# Translations
-Comment[lt]=Persijungimas tarp programų
+Comment[lt]=Perjungti tarp paleistų programų
Name[lt]=Užduočių tvarkytuvė
diff --git a/plugin-taskbar/translations/taskbar_pl.desktop b/plugin-taskbar/translations/taskbar_pl.desktop
index c5082ab..2b17ade 100644
--- a/plugin-taskbar/translations/taskbar_pl.desktop
+++ b/plugin-taskbar/translations/taskbar_pl.desktop
@@ -8,5 +8,5 @@ Comment=Switch between running applications
# Translations
-Comment[pl]=Przełączaj się pomiędzy otwartymi aplikacjami
+Comment[pl]=Przełączaj pomiędzy otwartymi aplikacjami
Name[pl]=Pasek zadań
diff --git a/plugin-taskbar/translations/taskbar_pl_PL.desktop b/plugin-taskbar/translations/taskbar_pl_PL.desktop
deleted file mode 100644
index 65e9c18..0000000
--- a/plugin-taskbar/translations/taskbar_pl_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_PL]=Przełączaj między uruchomionymi aplikacjami
-Name[pl_PL]=Pasek zadań
diff --git a/plugin-tray/lxqttray.cpp b/plugin-tray/lxqttray.cpp
index 79ba975..0ba385a 100644
--- a/plugin-tray/lxqttray.cpp
+++ b/plugin-tray/lxqttray.cpp
@@ -387,7 +387,12 @@ void LXQtTray::onIconDestroyed(QObject * icon)
************************************************/
void LXQtTray::addIcon(Window winId)
{
- TrayIcon* icon = new TrayIcon(winId, mIconSize, this);
+ // 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/translations/tray_lt.desktop b/plugin-tray/translations/tray_lt.desktop
index 3f9573b..de769e0 100644
--- a/plugin-tray/translations/tray_lt.desktop
+++ b/plugin-tray/translations/tray_lt.desktop
@@ -8,5 +8,5 @@ Comment=Display applications minimized to the system tray.
# Translations
-Comment[lt]=Leidžia pasiekti į sistemos dėklą nuleistas programas
+Comment[lt]=Rodyti į sistemos dėklą suskleistas programas
Name[lt]=Sistemos dėklas
diff --git a/plugin-tray/translations/tray_pl.desktop b/plugin-tray/translations/tray_pl.desktop
index 4c1e697..34e9800 100644
--- a/plugin-tray/translations/tray_pl.desktop
+++ b/plugin-tray/translations/tray_pl.desktop
@@ -8,5 +8,5 @@ Comment=Display applications minimized to the system tray.
# Translations
-Comment[pl]=Udostępnia ukryte aplikacje
-Name[pl]=Tacka systemowa
+Comment[pl]=Wyświetla aplikacje zminimalizowane do paska zadań
+Name[pl]=Zasobnik systemowy
diff --git a/plugin-tray/translations/tray_pl_PL.desktop b/plugin-tray/translations/tray_pl_PL.desktop
deleted file mode 100644
index 4d9f0ad..0000000
--- a/plugin-tray/translations/tray_pl_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_PL]=Dostęp do aplikacji zminimalizowanych do tacki systemowej.
-Name[pl_PL]=Tacka systemowa
diff --git a/plugin-tray/trayicon.cpp b/plugin-tray/trayicon.cpp
index f34b96f..d726ad2 100644
--- a/plugin-tray/trayicon.cpp
+++ b/plugin-tray/trayicon.cpp
@@ -126,7 +126,8 @@ void TrayIcon::init()
set_attr.border_pixel = 0;
mask = CWColormap|CWBackPixel|CWBorderPixel;
- mWindowId = XCreateWindow(dsp, this->winId(), 0, 0, mIconSize.width() * metric(PdmDevicePixelRatio), mIconSize.height() * metric(PdmDevicePixelRatio),
+ 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);
@@ -197,7 +198,6 @@ void TrayIcon::init()
XMapRaised(dsp, mWindowId);
const QSize req_size{mIconSize * metric(PdmDevicePixelRatio)};
- XResizeWindow(dsp, mWindowId, req_size.width(), req_size.height());
XResizeWindow(dsp, mIconId, req_size.width(), req_size.height());
}
diff --git a/plugin-volume/alsadevice.cpp b/plugin-volume/alsadevice.cpp
index 3e049a9..4595da1 100644
--- a/plugin-volume/alsadevice.cpp
+++ b/plugin-volume/alsadevice.cpp
@@ -30,7 +30,9 @@
AlsaDevice::AlsaDevice(AudioDeviceType t, AudioEngine *engine, QObject *parent) :
AudioDevice(t, engine, parent),
m_mixer(0),
- m_elem(0)
+ m_elem(0),
+ m_volumeMin(0),
+ m_volumeMax(100)
{
}
@@ -60,3 +62,9 @@ void AlsaDevice::setCardName(const QString &cardName)
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
index c2a9440..9d535b8 100644
--- a/plugin-volume/alsadevice.h
+++ b/plugin-volume/alsadevice.h
@@ -45,10 +45,13 @@ public:
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();
@@ -59,6 +62,8 @@ 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
index a268f43..9f2c6ba 100644
--- a/plugin-volume/alsaengine.cpp
+++ b/plugin-volume/alsaengine.cpp
@@ -63,9 +63,9 @@ AlsaEngine *AlsaEngine::instance()
int AlsaEngine::volumeMax(AudioDevice *device) const
{
- // We already did snd_mixer_selem_set_playback_volume_range(mixerElem, 0, 100);
- // during initialization. So we can return 100 directly here.
- return 100;
+ AlsaDevice * alsa_dev = qobject_cast(device);
+ Q_ASSERT(alsa_dev);
+ return alsa_dev->volumeMax();
}
AlsaDevice *AlsaEngine::getDeviceByAlsaElem(snd_mixer_elem_t *elem) const
@@ -88,7 +88,7 @@ void AlsaEngine::commitDeviceVolume(AudioDevice *device)
if (!dev || !dev->element())
return;
- long value = dev->volume();
+ 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);
}
@@ -112,7 +112,7 @@ void AlsaEngine::updateDevice(AlsaDevice *device)
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(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;
@@ -198,18 +198,12 @@ void AlsaEngine::discoverDevices()
dev->setMixer(mixer);
dev->setElement(mixerElem);
- // set the range of volume to 0-100
- snd_mixer_selem_set_playback_volume_range(mixerElem, 0, 100);
- long value;
- snd_mixer_selem_get_playback_volume(mixerElem, (snd_mixer_selem_channel_id_t)0, &value);
- // qDebug() << dev->name() << "initial volume" << value;
- dev->setVolumeNoCommit(value);
-
- if (snd_mixer_selem_has_playback_switch(mixerElem)) {
- int mute;
- snd_mixer_selem_get_playback_switch(mixerElem, (snd_mixer_selem_channel_id_t)0, &mute);
- dev->setMuteNoCommit(!(bool)mute);
- }
+ // 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);
diff --git a/plugin-volume/lxqtvolume.cpp b/plugin-volume/lxqtvolume.cpp
index 4383668..05c2c6f 100644
--- a/plugin-volume/lxqtvolume.cpp
+++ b/plugin-volume/lxqtvolume.cpp
@@ -53,7 +53,8 @@ LXQtVolume::LXQtVolume(const ILXQtPanelPluginStartupInfo &startupInfo):
ILXQtPanelPlugin(startupInfo),
m_engine(0),
m_defaultSinkIndex(0),
- m_defaultSink(0)
+ m_defaultSink(0),
+ m_allwaysShowNotifications(SETTINGS_DEFAULT_ALLWAYS_SHOW_NOTIFICATIONS)
{
m_volumeButton = new VolumeButton(this);
@@ -146,7 +147,13 @@ void LXQtVolume::setAudioEngine(AudioEngine *engine)
if (m_engine->backendName() == engine->backendName())
return;
- m_volumeButton->volumePopup()->setDevice(0);
+ 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;
@@ -193,6 +200,7 @@ void LXQtVolume::settingsChanged()
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();
@@ -206,6 +214,8 @@ void LXQtVolume::handleSinkListChanged()
{
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());
}
@@ -220,8 +230,7 @@ void LXQtVolume::handleShortcutVolumeUp()
if (m_defaultSink)
{
m_defaultSink->setVolume(m_defaultSink->volume() + settings()->value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt());
- m_notification->setSummary(tr("Volume: %1").arg(QString::number(m_defaultSink->volume())));
- m_notification->update();
+ showNotification(true);
}
}
@@ -230,15 +239,17 @@ void LXQtVolume::handleShortcutVolumeDown()
if (m_defaultSink)
{
m_defaultSink->setVolume(m_defaultSink->volume() - settings()->value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt());
- m_notification->setSummary(tr("Volume: %1").arg(QString::number(m_defaultSink->volume())));
- m_notification->update();
+ showNotification(true);
}
}
void LXQtVolume::handleShortcutVolumeMute()
{
if (m_defaultSink)
+ {
m_defaultSink->toggleMute();
+ showNotification(true);
+ }
}
QWidget *LXQtVolume::widget()
@@ -254,7 +265,10 @@ QDialog *LXQtVolume::configureDialog()
{
if (!m_configDialog)
{
- m_configDialog = new LXQtVolumeConfiguration(settings());
+ 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)
@@ -263,6 +277,21 @@ QDialog *LXQtVolume::configureDialog()
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
index ff40c4a..2100106 100644
--- a/plugin-volume/lxqtvolume.h
+++ b/plugin-volume/lxqtvolume.h
@@ -67,6 +67,7 @@ protected slots:
void handleShortcutVolumeDown();
void handleShortcutVolumeMute();
void shortcutRegistered();
+ void showNotification(bool forceShow) const;
private:
AudioEngine *m_engine;
@@ -78,6 +79,7 @@ private:
GlobalKeyShortcut::Action *m_keyMuteToggle;
LXQt::Notification *m_notification;
QPointer m_configDialog;
+ bool m_allwaysShowNotifications;
};
diff --git a/plugin-volume/lxqtvolumeconfiguration.cpp b/plugin-volume/lxqtvolumeconfiguration.cpp
index 26a9746..e70dc4a 100644
--- a/plugin-volume/lxqtvolumeconfiguration.cpp
+++ b/plugin-volume/lxqtvolumeconfiguration.cpp
@@ -33,14 +33,13 @@
#include
#include
-LXQtVolumeConfiguration::LXQtVolumeConfiguration(PluginSettings *settings, QWidget *parent) :
+LXQtVolumeConfiguration::LXQtVolumeConfiguration(PluginSettings *settings, bool ossAvailable, QWidget *parent) :
LXQtPanelPluginConfigDialog(settings, parent),
ui(new Ui::LXQtVolumeConfiguration)
{
ui->setupUi(this);
loadSettings();
- connect(ui->ossRadioButton, SIGNAL(toggled(bool)), this, SLOT(audioEngineChanged(bool)));
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)));
@@ -48,11 +47,17 @@ LXQtVolumeConfiguration::LXQtVolumeConfiguration(PluginSettings *settings, QWidg
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
@@ -135,6 +140,11 @@ 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();
@@ -151,5 +161,6 @@ void LXQtVolumeConfiguration::loadSettings()
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
index 65ef6fb..d20e6b5 100644
--- a/plugin-volume/lxqtvolumeconfiguration.h
+++ b/plugin-volume/lxqtvolumeconfiguration.h
@@ -40,6 +40,7 @@
#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
@@ -56,6 +57,8 @@
#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;
@@ -68,7 +71,7 @@ class LXQtVolumeConfiguration : public LXQtPanelPluginConfigDialog
Q_OBJECT
public:
- explicit LXQtVolumeConfiguration(PluginSettings *settings, QWidget *parent = nullptr);
+ explicit LXQtVolumeConfiguration(PluginSettings *settings, bool ossAvailable, QWidget *parent = nullptr);
~LXQtVolumeConfiguration();
public slots:
@@ -80,6 +83,7 @@ public slots:
void mixerLineEditChanged(const QString &command);
void stepSpinBoxChanged(int step);
void ignoreMaxVolumeCheckBoxChanged(bool state);
+ void allwaysShowNotificationsCheckBoxChanged(bool state);
protected slots:
virtual void loadSettings();
diff --git a/plugin-volume/lxqtvolumeconfiguration.ui b/plugin-volume/lxqtvolumeconfiguration.ui
index 75e3104..370edb1 100644
--- a/plugin-volume/lxqtvolumeconfiguration.ui
+++ b/plugin-volume/lxqtvolumeconfiguration.ui
@@ -78,6 +78,13 @@
+ -
+
+
+ Always notify about volume changes
+
+
+
-
-
diff --git a/plugin-volume/pulseaudioengine.cpp b/plugin-volume/pulseaudioengine.cpp
index 0135ffd..986be05 100644
--- a/plugin-volume/pulseaudioengine.cpp
+++ b/plugin-volume/pulseaudioengine.cpp
@@ -209,7 +209,7 @@ void PulseAudioEngine::addOrUpdateSink(const pa_sink_info *info)
pa_volume_t v = pa_cvolume_avg(&(info->volume));
// convert real volume to percentage
- dev->setVolumeNoCommit(((double)v * 100.0) / m_maximumVolume);
+ dev->setVolumeNoCommit(qRound((static_cast(v) * 100.0) / m_maximumVolume));
if (newSink) {
//keep the sinks sorted by index()
diff --git a/plugin-volume/translations/volume_lt.desktop b/plugin-volume/translations/volume_lt.desktop
new file mode 100644
index 0000000..beb1fa0
--- /dev/null
+++ b/plugin-volume/translations/volume_lt.desktop
@@ -0,0 +1,2 @@
+Name[lt]=Garsio reguliavimas
+Comment[lt]=Reguliuoti sistemos garsį ir paleisti pageidaujamą mašiklį.
diff --git a/plugin-volume/translations/volume_pl_PL.desktop b/plugin-volume/translations/volume_pl.desktop
similarity index 64%
rename from plugin-volume/translations/volume_pl_PL.desktop
rename to plugin-volume/translations/volume_pl.desktop
index 3820070..3cb3a5c 100644
--- a/plugin-volume/translations/volume_pl_PL.desktop
+++ b/plugin-volume/translations/volume_pl.desktop
@@ -8,5 +8,5 @@ Comment=Control the system's volume and launch your preferred mixer.
# Translations
-Comment[pl_PL]=Dopasuj poziom dźwięku i włącz preferowany mikser.
-Name[pl_PL]=Regulacja poziomu dźwięku
+Comment[pl]=Dopasuj poziom dźwięku i uruchom preferowany mikser.
+Name[pl]=Regulacja poziomu dźwięku
diff --git a/plugin-volume/volumebutton.cpp b/plugin-volume/volumebutton.cpp
index 4c85e7c..5186023 100644
--- a/plugin-volume/volumebutton.cpp
+++ b/plugin-volume/volumebutton.cpp
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include
#include "../panel/ilxqtpanel.h"
@@ -45,7 +46,9 @@ VolumeButton::VolumeButton(ILXQtPanelPlugin *plugin, QWidget* parent):
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")
@@ -93,6 +96,20 @@ void VolumeButton::enterEvent(QEvent *event)
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();
diff --git a/plugin-volume/volumebutton.h b/plugin-volume/volumebutton.h
index ad08c34..b275e29 100644
--- a/plugin-volume/volumebutton.h
+++ b/plugin-volume/volumebutton.h
@@ -54,10 +54,11 @@ public slots:
void showVolumeSlider();
protected:
- void enterEvent(QEvent *event);
- void leaveEvent(QEvent *event);
- void wheelEvent(QWheelEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
+ 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();
diff --git a/plugin-volume/volumepopup.cpp b/plugin-volume/volumepopup.cpp
index c6bcd0e..5294ae8 100644
--- a/plugin-volume/volumepopup.cpp
+++ b/plugin-volume/volumepopup.cpp
@@ -40,6 +40,7 @@
#include
#include "audioengine.h"
#include
+#include
VolumePopup::VolumePopup(QWidget* parent):
QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint),
@@ -60,6 +61,7 @@ VolumePopup::VolumePopup(QWidget* parent):
// 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"));
@@ -89,6 +91,20 @@ bool VolumePopup::event(QEvent *event)
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();
@@ -106,9 +122,7 @@ void VolumePopup::handleSliderValueChanged(int value)
return;
// qDebug("VolumePopup::handleSliderValueChanged: %d\n", value);
m_device->setVolume(value);
- m_volumeSlider->setToolTip(QString("%1%").arg(value));
- dynamic_cast(*parent()).setToolTip(m_volumeSlider->toolTip()); //parent is the button on panel
- QToolTip::showText(QCursor::pos(), m_volumeSlider->toolTip(), m_volumeSlider);
+ QTimer::singleShot(0, this, [this] { QToolTip::showText(QCursor::pos(), m_volumeSlider->toolTip()); });
}
void VolumePopup::handleMuteToggleClicked()
@@ -177,7 +191,8 @@ void VolumePopup::openAt(QPoint pos, Qt::Corner anchor)
void VolumePopup::handleWheelEvent(QWheelEvent *event)
{
- m_volumeSlider->event(reinterpret_cast(event));
+ m_volumeSlider->setSliderPosition(m_volumeSlider->sliderPosition()
+ + (event->angleDelta().y() / QWheelEvent::DefaultDeltasPerStep * m_volumeSlider->singleStep()));
}
void VolumePopup::setDevice(AudioDevice *device)
diff --git a/plugin-volume/volumepopup.h b/plugin-volume/volumepopup.h
index f02b9c0..ce240af 100644
--- a/plugin-volume/volumepopup.h
+++ b/plugin-volume/volumepopup.h
@@ -59,10 +59,11 @@ signals:
void stockIconChanged(const QString &iconName);
protected:
- void resizeEvent(QResizeEvent *event);
- void enterEvent(QEvent *event);
- void leaveEvent(QEvent *event);
- bool event(QEvent * event);
+ 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);
diff --git a/plugin-worldclock/lxqtworldclock.cpp b/plugin-worldclock/lxqtworldclock.cpp
index 54a89e5..34c3696 100644
--- a/plugin-worldclock/lxqtworldclock.cpp
+++ b/plugin-worldclock/lxqtworldclock.cpp
@@ -81,32 +81,78 @@ void LXQtWorldClock::timeout()
{
if (QDateTime{}.time().msec() > 500)
restartTimer();
- setTimeText();
+ updateTimeText();
}
-void LXQtWorldClock::setTimeText()
+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());
+ }
+ }
- QString time_text = formatDateTime(now, timeZoneName);
- if (mContent->text() != time_text)
+ if (!isUpToDate)
{
- mContent->setText(time_text);
+ 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();
- mTimer->setInterval(mUpdateInterval);
+ // 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((mUpdateInterval - (static_cast(QTime::currentTime().msecsSinceStartOfDay()) % mUpdateInterval)) % mUpdateInterval);
- QTimer::singleShot(delay, Qt::PreciseTimer, this, &LXQtWorldClock::setTimeText);
+ 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()));
}
diff --git a/plugin-worldclock/lxqtworldclock.h b/plugin-worldclock/lxqtworldclock.h
index 8bbc4d4..50d1073 100644
--- a/plugin-worldclock/lxqtworldclock.h
+++ b/plugin-worldclock/lxqtworldclock.h
@@ -66,7 +66,7 @@ private slots:
void timeout();
void wheelScrolled(int);
void deletePopup();
- void setTimeText();
+ void updateTimeText();
private:
QWidget *mMainWidget;
@@ -86,8 +86,11 @@ private:
bool mAutoRotate;
QLabel *mPopupContent;
+ QDateTime mShownTime;
+
void restartTimer();
+ void setTimeText();
QString formatDateTime(const QDateTime &datetime, const QString &timeZoneName);
void updatePopupContent();
bool formatHasTimeZone(QString format);
diff --git a/plugin-worldclock/translations/worldclock_lt.desktop b/plugin-worldclock/translations/worldclock_lt.desktop
new file mode 100644
index 0000000..b5b2996
--- /dev/null
+++ b/plugin-worldclock/translations/worldclock_lt.desktop
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..4bcf085
--- /dev/null
+++ b/plugin-worldclock/translations/worldclock_pl.desktop
@@ -0,0 +1,2 @@
+Name[pl]=Zegar światowy
+Comment[pl]=Wtyczka zegara światowego.