summaryrefslogtreecommitdiffstats
path: root/kxkb/pixmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kxkb/pixmap.cpp')
-rw-r--r--kxkb/pixmap.cpp51
1 files changed, 17 insertions, 34 deletions
diff --git a/kxkb/pixmap.cpp b/kxkb/pixmap.cpp
index 63fc4f1db..830625ca8 100644
--- a/kxkb/pixmap.cpp
+++ b/kxkb/pixmap.cpp
@@ -13,43 +13,28 @@
#include "pixmap.h"
#include "x11helper.h"
+const TQString LayoutIconManager::flagTemplate("l10n/%1/flag.png");
-static const int FLAG_MAX_DIM = 24;
-
-const TQString LayoutIcon::flagTemplate("l10n/%1/flag.png");
-const TQString& LayoutIcon::ERROR_CODE("error");
-LayoutIcon* LayoutIcon::instance;
-
-
-LayoutIcon& LayoutIcon::getInstance() {
- if( instance == NULL ) {
- instance = new LayoutIcon();
- }
- return *instance;
-}
-
-LayoutIcon::LayoutIcon():
- m_pixmapCache(80)
+LayoutIconManager::LayoutIconManager(KxkbConfig *kxkbConfig)
+ : m_pixmapCache(80),
+ m_kxkbConfig(kxkbConfig)
{
}
-const TQPixmap&
-LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& displayName_)
+const TQPixmap& LayoutIconManager::find(const TQString& code_, int pixmapStyle, const TQString& displayName_)
{
- m_kxkbConfig.load(KxkbConfig::LOAD_ALL); // (re)load settings
-
- if (m_kxkbConfig.m_useThemeColors) { // use colors from color scheme
+ if (m_kxkbConfig->m_useThemeColors) { // use colors from color scheme
m_bgColor = TDEGlobalSettings::highlightColor();
m_fgColor = TDEGlobalSettings::highlightedTextColor();
} else {
- m_bgColor = m_kxkbConfig.m_colorBackground;
- m_fgColor = m_kxkbConfig.m_colorLabel;
+ m_bgColor = m_kxkbConfig->m_colorBackground;
+ m_fgColor = m_kxkbConfig->m_colorLabel;
}
- m_labelFont = m_kxkbConfig.m_labelFont;
- m_labelShadow = m_kxkbConfig.m_labelShadow;
- m_shColor = m_kxkbConfig.m_colorShadow;
- m_bgTransparent = m_kxkbConfig.m_bgTransparent;
+ m_labelFont = m_kxkbConfig->m_labelFont;
+ m_labelShadow = m_kxkbConfig->m_labelShadow;
+ m_shColor = m_kxkbConfig->m_colorShadow;
+ m_bgTransparent = m_kxkbConfig->m_bgTransparent;
// Decide on how to style the pixmap
switch(pixmapStyle) {
@@ -61,8 +46,8 @@ LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& d
case PIXMAP_STYLE_INDICATOR:
m_fitToBox = true;
- m_showFlag = m_kxkbConfig.m_showFlag;
- m_showLabel = m_kxkbConfig.m_showLabel;
+ m_showFlag = m_kxkbConfig->m_showFlag;
+ m_showLabel = m_kxkbConfig->m_showLabel;
break;
case PIXMAP_STYLE_CONTEXTMENU:
@@ -178,7 +163,7 @@ LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& d
/**
@brief Try to get country code from layout name in xkb before xorg 6.9.0
*/
-TQString LayoutIcon::getCountryFromLayoutName(const TQString& layoutName)
+TQString LayoutIconManager::getCountryFromLayoutName(const TQString& layoutName)
{
TQString flag;
@@ -286,7 +271,7 @@ TQString LayoutIcon::getCountryFromLayoutName(const TQString& layoutName)
}
-void LayoutIcon::dimPixmap(TQPixmap& pm)
+void LayoutIconManager::dimPixmap(TQPixmap& pm)
{
TQImage image = pm.convertToImage();
for (int y=0; y<image.height(); y++)
@@ -299,10 +284,8 @@ void LayoutIcon::dimPixmap(TQPixmap& pm)
pm.convertFromImage(image);
}
-static const char* ERROR_LABEL = "err";
-
//private
-TQPixmap* LayoutIcon::createErrorPixmap()
+TQPixmap* LayoutIconManager::createErrorPixmap()
{
TQPixmap* pm = new TQPixmap(21, 14);
pm->fill(TQt::white);