summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <[email protected]>2025-01-14 16:23:10 +0200
committerMavridis Philippe <[email protected]>2025-01-14 17:02:10 +0200
commitec805eb40d55775dd8833ef4e13d7112073ba4c2 (patch)
tree37bc79d34a5f41846177e313f5e465984e4eed00
parent2b3ed3c3cb35f56aa98f8364eff6e0c3342a523a (diff)
downloadtdebase-ec805eb40d55775dd8833ef4e13d7112073ba4c2.tar.gz
tdebase-ec805eb40d55775dd8833ef4e13d7112073ba4c2.zip
KXkb: fix bug related to flag dimmingfix/kxkb/547
The flag dimming would not work the first time KXkb would show due to a logic error. This commit also makes it obvious in the config module that the dimming option only works when both flag and label are used for the indicator. Signed-off-by: Mavridis Philippe <[email protected]>
-rw-r--r--kxkb/kcmlayout.cpp1
-rw-r--r--kxkb/kcmlayoutwidget.ui6
-rw-r--r--kxkb/pixmap.cpp33
-rw-r--r--kxkb/pixmap.h1
4 files changed, 22 insertions, 19 deletions
diff --git a/kxkb/kcmlayout.cpp b/kxkb/kcmlayout.cpp
index cc0caace7..f2fd5d252 100644
--- a/kxkb/kcmlayout.cpp
+++ b/kxkb/kcmlayout.cpp
@@ -336,6 +336,7 @@ void LayoutConfig::initUI(bool modified) {
widget->bgColor->setDisabled(showFlag);
widget->chkBgTransparent->setDisabled(showFlag);
widget->grpFlag->setEnabled(showFlag);
+ widget->chkDimFlag->setEnabled(showFlag && showLabel);
switch( m_kxkbConfig.m_switchingPolicy ) {
default:
diff --git a/kxkb/kcmlayoutwidget.ui b/kxkb/kcmlayoutwidget.ui
index 8a16ebf0a..52cab2e88 100644
--- a/kxkb/kcmlayoutwidget.ui
+++ b/kxkb/kcmlayoutwidget.ui
@@ -1276,6 +1276,12 @@
<receiver>grpFlag</receiver>
<slot>setDisabled(bool)</slot>
</connection>
+ <connection>
+ <sender>radFlagLabel</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>chkDimFlag</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
</connections>
<includes>
<include location="local" impldecl="in implementation">kiconloader.h</include>
diff --git a/kxkb/pixmap.cpp b/kxkb/pixmap.cpp
index 012350143..718677769 100644
--- a/kxkb/pixmap.cpp
+++ b/kxkb/pixmap.cpp
@@ -38,7 +38,7 @@ const TQPixmap& LayoutIconManager::find(const TQString& code_, int pixmapStyle,
m_shColor = m_kxkbConfig->m_colorShadow;
m_bgTransparent = m_kxkbConfig->m_bgTransparent;
m_fitToBox = m_kxkbConfig->m_fitToBox;
- m_dimFlag = m_kxkbConfig->m_dimFlag && m_showFlag && m_showLabel;
+ m_dimFlag = m_kxkbConfig->m_dimFlag;
m_bevel = m_kxkbConfig->m_bevel && !m_bgTransparent && pixmapStyle == PIXMAP_STYLE_INDICATOR;
// Decide on how to style the pixmap
@@ -111,12 +111,23 @@ const TQPixmap& LayoutIconManager::find(const TQString& code_, int pixmapStyle,
} else {
TQPixmap fp(flag);
- if (m_dimFlag) // only dim for label
+ if (m_dimFlag && m_showLabel)
{
- dimPixmap(fp);
+ TQImage image = fp.convertToImage();
+ for (int y = 0; y < image.height(); y++)
+ {
+ for(int x = 0; x < image.width(); x++)
+ {
+ TQRgb rgb = image.pixel(x,y);
+ TQRgb dimRgb(tqRgb(tqRed(rgb) * 3/4, tqGreen(rgb) * 3/4, tqBlue(rgb) * 3/4));
+ image.setPixel(x, y, dimRgb);
+ }
+ }
+ fp.convertFromImage(image);
}
- if (!m_fitToBox) {
+ if (!m_fitToBox)
+ {
r = TQRect((FLAG_MAX_DIM - fp.width()) / 2, (FLAG_MAX_DIM - fp.height()) / 2, fp.width(), fp.height());
}
@@ -303,20 +314,6 @@ TQString LayoutIconManager::getCountryFromLayoutName(const TQString& layoutName)
return flag;
}
-
-void LayoutIconManager::dimPixmap(TQPixmap& pm)
-{
- TQImage image = pm.convertToImage();
- for (int y=0; y<image.height(); y++)
- for(int x=0; x<image.width(); x++)
- {
- TQRgb rgb = image.pixel(x,y);
- TQRgb dimRgb(tqRgb(tqRed(rgb)*3/4, tqGreen(rgb)*3/4, tqBlue(rgb)*3/4));
- image.setPixel(x, y, dimRgb);
- }
- pm.convertFromImage(image);
-}
-
//private
TQPixmap* LayoutIconManager::createErrorPixmap()
{
diff --git a/kxkb/pixmap.h b/kxkb/pixmap.h
index bb747f8c8..08dee8a87 100644
--- a/kxkb/pixmap.h
+++ b/kxkb/pixmap.h
@@ -26,7 +26,6 @@ class LayoutIconManager {
private:
TQPixmap* createErrorPixmap();
- void dimPixmap(TQPixmap& pixmap);
TQString getCountryFromLayoutName(const TQString& layoutName);
private: