diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2024-11-12 23:23:00 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2024-11-12 23:23:00 +0200 |
commit | 753873e6d73ffcf00199d31e084e6a96b9eb84e0 (patch) | |
tree | f9a04c6245200db777e2942ed9dc1fecd44d9a9e /kxkb/kxkbtraywindow.cpp | |
parent | 71068b3b258a340be30a91c3a5af92718da70cdd (diff) | |
download | tdebase-753873e6d73ffcf00199d31e084e6a96b9eb84e0.tar.gz tdebase-753873e6d73ffcf00199d31e084e6a96b9eb84e0.zip |
Kxkb: Improvements for tray window pixmap manager, optimize settings reloadings
* Rename LayoutIcon to LayoutIconManager for clarity
* Remove use of singleton pattern for LayoutIconManager
* Do not reload all Kxkb settings every time we are requested to get a pixmap!
* Use pointer to global KxkbConfig instance instead of keeping own copy
* Make "Transparent background" checkbox available for theme colors in the GUI
* Minor code cleanup in LayoutIconManager
* KxkbConfig: do not reload settings every time getKxkbOptions() is called; if settings actually need to be re-read, it must be done maunally before calling this function
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kxkb/kxkbtraywindow.cpp')
-rw-r--r-- | kxkb/kxkbtraywindow.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kxkb/kxkbtraywindow.cpp b/kxkb/kxkbtraywindow.cpp index da0c7c0b4..4f0359d79 100644 --- a/kxkb/kxkbtraywindow.cpp +++ b/kxkb/kxkbtraywindow.cpp @@ -22,12 +22,17 @@ #include "kxkbtraywindow.h" #include "pixmap.h" #include "rules.h" -#include "kxkbconfig.h" -KxkbSystemTray::KxkbSystemTray() +KxkbSystemTray::KxkbSystemTray(KxkbConfig *kxkbConfig) : KSystemTray(nullptr), m_prevLayoutCount(0) { + m_icoMgr = new LayoutIconManager(kxkbConfig); +} + +KxkbSystemTray::~KxkbSystemTray() +{ + delete m_icoMgr; } void KxkbSystemTray::setToolTip(const TQString& tip) @@ -45,7 +50,7 @@ void KxkbSystemTray::setPixmap(const TQPixmap& pix) void KxkbSystemTray::setCurrentLayout(const LayoutUnit& layoutUnit) { setToolTip(m_descriptionMap[layoutUnit.toPair()]); - setPixmap(LayoutIcon::getInstance().findPixmap(layoutUnit.layout, PIXMAP_STYLE_INDICATOR, layoutUnit.displayName)); + setPixmap(m_icoMgr->find(layoutUnit.layout, PIXMAP_STYLE_INDICATOR, layoutUnit.displayName)); } void KxkbSystemTray::setError(const TQString& layoutInfo) @@ -57,7 +62,7 @@ void KxkbSystemTray::setError(const TQString& layoutInfo) TQString msg = i18n("Error changing keyboard layout to '%1'").arg(layoutInfo); setToolTip(msg); - setPixmap(LayoutIcon::getInstance().findPixmap("error", PIXMAP_STYLE_NORMAL)); + setPixmap(m_icoMgr->find(ERROR_CODE, PIXMAP_STYLE_NORMAL)); } void KxkbSystemTray::initLayoutList(const TQValueList<LayoutUnit>& layouts, const XkbRules& rules) @@ -78,7 +83,7 @@ void KxkbSystemTray::initLayoutList(const TQValueList<LayoutUnit>& layouts, cons const TQString layoutName = (*it).layout; const TQString variantName = (*it).variant; - const TQPixmap& layoutPixmap = LayoutIcon::getInstance().findPixmap((*it).layout, PIXMAP_STYLE_CONTEXTMENU, (*it).displayName); + const TQPixmap& layoutPixmap = m_icoMgr->find((*it).layout, PIXMAP_STYLE_CONTEXTMENU, (*it).displayName); const TQPixmap pix = iconeffect.apply(layoutPixmap, TDEIcon::Small, TDEIcon::DefaultState); TQString fullName = rules.getLayoutName((*it)); |