summaryrefslogtreecommitdiffstats
path: root/kxkb/kxkbtraywindow.cpp
diff options
context:
space:
mode:
authorMavridis Philippe <[email protected]>2024-11-12 23:23:00 +0200
committerMavridis Philippe <[email protected]>2025-01-15 13:39:05 +0200
commitf113ca7dec03fd6d470ab54383349f9f02a5783c (patch)
treeb0469bcfbdc3c8ca5e93bb123dbaba3c14f50e44 /kxkb/kxkbtraywindow.cpp
parent84ca90dc9369c01c778be01ee26f69b1ee1a422a (diff)
downloadtdebase-f113ca7dec03fd6d470ab54383349f9f02a5783c.tar.gz
tdebase-f113ca7dec03fd6d470ab54383349f9f02a5783c.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 <[email protected]>
Diffstat (limited to 'kxkb/kxkbtraywindow.cpp')
-rw-r--r--kxkb/kxkbtraywindow.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/kxkb/kxkbtraywindow.cpp b/kxkb/kxkbtraywindow.cpp
index 0606a4c43..7871f443a 100644
--- a/kxkb/kxkbtraywindow.cpp
+++ b/kxkb/kxkbtraywindow.cpp
@@ -21,12 +21,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)
@@ -44,7 +49,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)
@@ -56,7 +61,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)
@@ -77,7 +82,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));