diff --git a/kxkb/kcmlayout.cpp b/kxkb/kcmlayout.cpp index 682ea10da..a022b6389 100644 --- a/kxkb/kcmlayout.cpp +++ b/kxkb/kcmlayout.cpp @@ -237,10 +237,17 @@ void LayoutConfig::initUI() { widget->grpLabel->setButton( ( m_kxkbConfig.m_useThemeColors ? 0 : 1 ) ); widget->bgColor->setColor( m_kxkbConfig.m_colorBackground ); widget->fgColor->setColor( m_kxkbConfig.m_colorLabel ); + widget->chkBgTransparent->setChecked( m_kxkbConfig.m_bgTransparent ); widget->labelFont->setFont( m_kxkbConfig.m_labelFont ); widget->chkLabelShadow->setChecked( m_kxkbConfig.m_labelShadow ); widget->shColor->setColor( m_kxkbConfig.m_colorShadow ); + widget->grpLabel->setDisabled(showFlag && !showLabel); + widget->grpLabelColors->setDisabled(m_kxkbConfig.m_useThemeColors); + widget->labelBgColor->setDisabled(showFlag); + widget->bgColor->setDisabled(showFlag); + widget->chkBgTransparent->setDisabled(showFlag); + switch( m_kxkbConfig.m_switchingPolicy ) { default: case SWITCH_POLICY_GLOBAL: @@ -303,6 +310,7 @@ void LayoutConfig::save() m_kxkbConfig.m_useThemeColors = widget->radLabelUseTheme->isChecked(); m_kxkbConfig.m_colorBackground = widget->bgColor->color(); m_kxkbConfig.m_colorLabel = widget->fgColor->color(); + m_kxkbConfig.m_bgTransparent = widget->chkBgTransparent->isChecked(); m_kxkbConfig.m_labelFont = widget->labelFont->font(); m_kxkbConfig.m_labelShadow = widget->chkLabelShadow->isChecked(); m_kxkbConfig.m_colorShadow = widget->shColor->color(); diff --git a/kxkb/kcmlayoutwidget.ui b/kxkb/kcmlayoutwidget.ui index dc3350a87..e8dcc3a9e 100644 --- a/kxkb/kcmlayoutwidget.ui +++ b/kxkb/kcmlayoutwidget.ui @@ -545,96 +545,108 @@ false - + - spacer2 - - - Horizontal - - - Fixed - - - - 20 - 20 - - - - - - labelBgColor - - - Background color: - - - This color will be used as the indicator's background unless the indicator was set to display a flag. - - - false - + grpLabelColors + + + NoFrame + + + Plain + + + + + spacer2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + labelBgColor + + + Background color: + + + This color will be used as the indicator's background unless the indicator was set to display a flag. + + + + + bgColor + + + This color will be used as the indicator's background unless the indicator was set to display a flag. + + + + + spacer2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + labelFgColor + + + Text color: + + + This color will be used to draw the language label on the indicator. + + + + + fgColor + + + This color will be used to draw the language label on the indicator. + + + - + - bgColor - - - This color will be used as the indicator's background unless the indicator was set to display a flag. - - - false - - - - - spacer2 - - - Horizontal - - - Fixed - - - - 20 - 20 - - - - - - labelFgColor + chkBgTransparent - Text color: + Transparent background - This color will be used to draw the language label on the indicator. - - - false + Check this to remove the indicator's background. Only applicable in "Label only" mode. - - - fgColor - - - This color will be used to draw the language label on the indicator. - - - false - - - + separator1 - + labelFontRequester @@ -645,12 +657,12 @@ This is the font which will be used by the layout indicator to draw the label. - + labelFont - + chkLabelShadow @@ -661,7 +673,7 @@ Draw a drop shadow behind the language label. In some cases this option can improve readability. - + shColor @@ -920,38 +932,56 @@ radLabelUseCustom toggled(bool) - bgColor + grpLabelColors setEnabled(bool) - radLabelUseCustom + chkLabelShadow toggled(bool) - fgColor + shColor setEnabled(bool) - - - radLabelUseCustom + + + chkEnable toggled(bool) - labelBgColor + optionsFrame setEnabled(bool) - - - radLabelUseCustom + + + radFlagOnly + toggled(bool) + grpLabel + setDisabled(bool) + + + radLabelOnly toggled(bool) - labelFgColor + chkBgTransparent + setEnabled(bool) + + + radLabelOnly + toggled(bool) + bgColor setEnabled(bool) - chkLabelShadow + radLabelOnly toggled(bool) - shColor + labelBgColor setEnabled(bool) - chkEnable + radFlagLabel toggled(bool) - optionsFrame - setEnabled(bool) + bgColor + setDisabled(bool) + + + radFlagLabel + toggled(bool) + labelBgColor + setDisabled(bool) diff --git a/kxkb/kxkbconfig.cpp b/kxkb/kxkbconfig.cpp index a01fd6a0e..8e6890161 100644 --- a/kxkb/kxkbconfig.cpp +++ b/kxkb/kxkbconfig.cpp @@ -131,6 +131,7 @@ bool KxkbConfig::load(int loadMode) m_useThemeColors = config->readBoolEntry("UseThemeColors", false); m_colorBackground = config->readColorEntry("ColorBackground", new TQColor(TQt::gray)); + m_bgTransparent = config->readBoolEntry("BgTransparent", false); m_colorLabel = config->readColorEntry("ColorLabel", new TQColor(TQt::white)); m_labelFont = config->readFontEntry("LabelFont", new TQFont("sans", 10, TQFont::Bold)); m_labelShadow = config->readBoolEntry("LabelShadow", true); @@ -230,6 +231,7 @@ void KxkbConfig::save() config->writeEntry("UseThemeColors", m_useThemeColors); config->writeEntry("ColorBackground", m_colorBackground); + config->writeEntry("BgTransparent", m_bgTransparent); config->writeEntry("ColorLabel", m_colorLabel); config->writeEntry("LabelFont", m_labelFont); config->writeEntry("LabelShadow", m_labelShadow); diff --git a/kxkb/kxkbconfig.h b/kxkb/kxkbconfig.h index 0f8c981ea..a4dc83e5a 100644 --- a/kxkb/kxkbconfig.h +++ b/kxkb/kxkbconfig.h @@ -105,6 +105,7 @@ public: bool m_useThemeColors; TQColor m_colorBackground; + bool m_bgTransparent; TQColor m_colorLabel; TQFont m_labelFont; bool m_labelShadow; diff --git a/kxkb/pixmap.cpp b/kxkb/pixmap.cpp index 238023d9b..c7e08a741 100644 --- a/kxkb/pixmap.cpp +++ b/kxkb/pixmap.cpp @@ -1,5 +1,5 @@ #include -//#include +#include #include #include #include @@ -49,6 +49,7 @@ LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& d 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) { @@ -96,7 +97,7 @@ LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& d const TQString pixmapKey( TQString( m_showFlag ? "f" : "" ) + TQString( m_showLabel ? "l" : "" ) + TQString( m_labelShadow ? "s" : "" ) + "." + - m_labelFont.key() + "." + m_bgColor.name() + "." + m_fgColor.name() + "." + m_shColor.name() + '.' + code_ + "." + displayName + m_labelFont.key() + "." + ( m_bgTransparent ? "x" : m_bgColor.name() ) + "." + m_fgColor.name() + "." + m_shColor.name() + '.' + code_ + "." + displayName ); // Only use cache for indicator @@ -145,8 +146,29 @@ LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& d p.setPen(m_fgColor); p.drawText(0, 0, pm->width(), pm->height(), Qt::AlignCenter, displayName); + + if( m_bgTransparent && !m_showFlag ) + { + TQPixmap maskpix(pm->width(), pm->height()); + TQPainter maskp(&maskpix); + + maskpix.fill(TQt::white); + maskp.setPen(TQt::black); + maskp.setFont(m_labelFont); + + maskp.drawText(0, 0, maskpix.width(), maskpix.height(), Qt::AlignCenter, displayName); + if( m_labelShadow ) + { + maskp.drawText(1, 1, maskpix.width(), maskpix.height(), Qt::AlignCenter, displayName); + } + + TQBitmap mask; + mask = maskpix; + pm->setMask(mask); + } } + if( pixmapStyle == PIXMAP_STYLE_INDICATOR ) m_pixmapCache.insert(pixmapKey, pm); diff --git a/kxkb/pixmap.h b/kxkb/pixmap.h index 2fd6c2a3c..a17f48d89 100644 --- a/kxkb/pixmap.h +++ b/kxkb/pixmap.h @@ -24,6 +24,7 @@ private: bool m_showFlag; bool m_showLabel; TQColor m_bgColor; + bool m_bgTransparent; TQColor m_fgColor; TQFont m_labelFont; bool m_labelShadow;