Added customization options for Kxkb

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/202/head
Mavridis Philippe 3 years ago
parent bbdeb170a4
commit eff93621da
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -14,6 +14,8 @@
#include <tqbuttongroup.h>
#include <tqspinbox.h>
#include <tdefontrequester.h>
#include <kcolorbutton.h>
#include <kkeydialog.h>
#include <tdeglobal.h>
#include <tdeconfig.h>
@ -95,7 +97,7 @@ static TQListViewItem* copyLVI(const TQListViewItem* src, TQListView* parent)
LayoutConfig::LayoutConfig(TQWidget *parent, const char *name)
: TDECModule(parent, name),
: TDECModule(parent, name),
m_rules(NULL)
{
TQVBoxLayout *main = new TQVBoxLayout(this, 0, KDialog::spacingHint());
@ -105,7 +107,7 @@ LayoutConfig::LayoutConfig(TQWidget *parent, const char *name)
connect( TQT_TQOBJECT(widget->chkEnable), TQT_SIGNAL( toggled( bool )), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( TQT_TQOBJECT(widget->chkShowSingle), TQT_SIGNAL( toggled( bool )), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( TQT_TQOBJECT(widget->chkShowFlag), TQT_SIGNAL( toggled( bool )), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( TQT_TQOBJECT(widget->comboModel), TQT_SIGNAL(activated(int)), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( TQT_TQOBJECT(widget->listLayoutsSrc), TQT_SIGNAL(doubleClicked(TQListViewItem*,const TQPoint&, int)),
@ -130,7 +132,15 @@ LayoutConfig::LayoutConfig(TQWidget *parent, const char *name)
connect( widget->btnDown, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( widget->btnDown, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(moveDown()));
connect( widget->grpStyle, TQT_SIGNAL( clicked( int ) ), TQT_SLOT(changed()));
connect( widget->grpSwitching, TQT_SIGNAL( clicked( int ) ), TQT_SLOT(changed()));
connect( widget->grpLabel, TQT_SIGNAL( clicked( int ) ), TQT_SLOT(changed()));
connect( widget->bgColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( widget->fgColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( widget->labelFont, TQT_SIGNAL( fontSelected(const TQFont&) ), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( widget->chkLabelShadow, TQT_SIGNAL( toggled( bool ) ), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( widget->shColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( widget->chkEnableSticky, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(changed()));
connect( widget->spinStickyDepth, TQT_SIGNAL(valueChanged(int)), TQT_TQOBJECT(this), TQT_SLOT(changed()));
@ -148,7 +158,7 @@ LayoutConfig::LayoutConfig(TQWidget *parent, const char *name)
widget->listLayoutsDst->setColumnWidthMode(LAYOUT_COLUMN_INCLUDE, TQListView::Manual);
widget->listLayoutsDst->setColumnWidth(LAYOUT_COLUMN_INCLUDE, 0);
// widget->listLayoutsDst->setColumnWidth(LAYOUT_COLUMN_DISPLAY_NAME, 0);
widget->listLayoutsDst->setSorting(-1);
#if 0
widget->listLayoutsDst->setResizeMode(TQListView::LastColumn);
@ -177,12 +187,12 @@ void LayoutConfig::load()
initUI();
}
void LayoutConfig::initUI() {
const char* modelName = m_rules->models()[m_kxkbConfig.m_model];
if( modelName == NULL )
modelName = DEFAULT_MODEL;
widget->comboModel->setCurrentText(i18n(modelName));
TQValueList<LayoutUnit> otherLayouts = m_kxkbConfig.m_layouts;
@ -192,13 +202,13 @@ void LayoutConfig::initUI() {
for (it = otherLayouts.begin(); it != otherLayouts.end(); ++it ) {
TQListViewItemIterator src_it( widget->listLayoutsSrc );
LayoutUnit layoutUnit = *it;
for ( ; src_it.current(); ++src_it ) {
TQListViewItem* srcItem = src_it.current();
if ( layoutUnit.layout == src_it.current()->text(LAYOUT_COLUMN_MAP) ) { // check if current config knows about this layout
TQListViewItem* newItem = copyLVI(srcItem, widget->listLayoutsDst);
newItem->setText(LAYOUT_COLUMN_VARIANT, layoutUnit.variant);
newItem->setText(LAYOUT_COLUMN_INCLUDE, layoutUnit.includeGroup);
newItem->setText(LAYOUT_COLUMN_DISPLAY_NAME, layoutUnit.displayName);
@ -212,11 +222,23 @@ void LayoutConfig::initUI() {
// display KXKB switching options
widget->chkShowSingle->setChecked(m_kxkbConfig.m_showSingle);
widget->chkShowFlag->setChecked(m_kxkbConfig.m_showFlag);
bool showFlag = m_kxkbConfig.m_showFlag;
bool showLabel = m_kxkbConfig.m_showLabel;
widget->radFlagLabel->setChecked( showFlag && showLabel );
widget->radFlagOnly->setChecked( showFlag && !showLabel );
widget->radLabelOnly->setChecked( !showFlag && showLabel );
widget->chkEnableOptions->setChecked( m_kxkbConfig.m_enableXkbOptions );
widget->checkResetOld->setChecked(m_kxkbConfig.m_resetOldOptions);
widget->grpLabel->setButton( ( m_kxkbConfig.m_useThemeColors ? 0 : 1 ) );
widget->bgColor->setColor( m_kxkbConfig.m_colorBackground );
widget->fgColor->setColor( m_kxkbConfig.m_colorLabel );
widget->labelFont->setFont( m_kxkbConfig.m_labelFont );
widget->chkLabelShadow->setChecked( m_kxkbConfig.m_labelShadow );
widget->shColor->setColor( m_kxkbConfig.m_colorShadow );
switch( m_kxkbConfig.m_switchingPolicy ) {
default:
case SWITCH_POLICY_GLOBAL:
@ -248,7 +270,7 @@ void LayoutConfig::initUI() {
TQString optionKey = option.mid(0, option.find(':'));
TQString optionName = m_rules->options()[option];
OptionListItem *item = m_optionGroups[i18n(optionKey.latin1())];
if (item != NULL) {
OptionListItem *child = item->findChildItem( option );
@ -274,7 +296,14 @@ void LayoutConfig::save()
m_kxkbConfig.m_enableXkbOptions = widget->chkEnableOptions->isChecked();
m_kxkbConfig.m_resetOldOptions = widget->checkResetOld->isChecked();
m_kxkbConfig.m_options = createOptionString();
m_kxkbConfig.m_options = createOptionString();
m_kxkbConfig.m_useThemeColors = widget->radLabelUseTheme->isChecked();
m_kxkbConfig.m_colorBackground = widget->bgColor->color();
m_kxkbConfig.m_colorLabel = widget->fgColor->color();
m_kxkbConfig.m_labelFont = widget->labelFont->font();
m_kxkbConfig.m_labelShadow = widget->chkLabelShadow->isChecked();
m_kxkbConfig.m_colorShadow = widget->shColor->color();
TQListViewItem *item = widget->listLayoutsDst->firstChild();
TQValueList<LayoutUnit> layouts;
@ -283,15 +312,15 @@ void LayoutConfig::save()
TQString variant = item->text(LAYOUT_COLUMN_VARIANT);
TQString includes = item->text(LAYOUT_COLUMN_INCLUDE);
TQString displayName = item->text(LAYOUT_COLUMN_DISPLAY_NAME);
LayoutUnit layoutUnit(layout, variant);
layoutUnit.includeGroup = includes;
layoutUnit.displayName = displayName;
layouts.append( layoutUnit );
item = item->nextSibling();
kdDebug() << "To save: layout " << layoutUnit.toPair()
<< ", inc: " << layoutUnit.includeGroup
kdDebug() << "To save: layout " << layoutUnit.toPair()
<< ", inc: " << layoutUnit.includeGroup
<< ", disp: " << layoutUnit.displayName << endl;
}
m_kxkbConfig.m_layouts = layouts;
@ -303,7 +332,9 @@ void LayoutConfig::save()
m_kxkbConfig.m_useKxkb = widget->chkEnable->isChecked();
m_kxkbConfig.m_showSingle = widget->chkShowSingle->isChecked();
m_kxkbConfig.m_showFlag = widget->chkShowFlag->isChecked();
m_kxkbConfig.m_showFlag = ( widget->radFlagLabel->isChecked() || widget->radFlagOnly->isChecked() );
m_kxkbConfig.m_showLabel = ( widget->radFlagLabel->isChecked() || widget->radLabelOnly->isChecked() );
int modeId = widget->grpSwitching->id(widget->grpSwitching->selected());
switch( modeId ) {
@ -323,7 +354,7 @@ void LayoutConfig::save()
m_kxkbConfig.m_stickySwitchingDepth = widget->spinStickyDepth->value();
m_kxkbConfig.save();
kapp->tdeinitExec("kxkb");
emit TDECModule::changed( false );
}
@ -347,11 +378,11 @@ void LayoutConfig::updateStickyLimit()
{
int layoutsCnt = widget->listLayoutsDst->childCount();
int maxDepth = layoutsCnt - 1;
if( maxDepth < 2 ) {
maxDepth = 2;
}
widget->spinStickyDepth->setMaxValue(maxDepth);
/* if( value > maxDepth )
setValue(maxDepth);*/
@ -366,7 +397,7 @@ void LayoutConfig::add()
// Create a copy of the sel widget, as one might add the same layout more
// than one time, with different variants.
TQListViewItem* toadd = copyLVI(sel, widget->listLayoutsDst);
// Turn on "Include Latin layout" for new language by default (bnc:204402)
toadd->setText(LAYOUT_COLUMN_INCLUDE, "us");
@ -376,12 +407,12 @@ void LayoutConfig::add()
// disabling temporary: does not work reliable in Qt :(
// widget->listLayoutsDst->setSelected(sel, true);
// layoutSelChanged(sel);
updateStickyLimit();
changed();
}
void LayoutConfig::remove()
void LayoutConfig::remove()
{
TQListViewItem* sel = widget->listLayoutsDst->selectedItem();
TQListViewItem* newSel = 0;
@ -456,15 +487,15 @@ void LayoutConfig::displayNameChanged(const TQString& newDisplayName)
TQListViewItem* selLayout = widget->listLayoutsDst->selectedItem();
if( selLayout == NULL )
return;
const LayoutUnit layoutUnitKey = getLayoutUnitKey( selLayout );
LayoutUnit& layoutUnit = *m_kxkbConfig.m_layouts.find(layoutUnitKey);
TQString oldName = selLayout->text(LAYOUT_COLUMN_DISPLAY_NAME);
if( oldName.isEmpty() )
oldName = KxkbConfig::getDefaultDisplayName( layoutUnit );
if( oldName != newDisplayName ) {
kdDebug() << "setting label for " << layoutUnit.toPair() << " : " << newDisplayName << endl;
selLayout->setText(LAYOUT_COLUMN_DISPLAY_NAME, newDisplayName);
@ -517,7 +548,7 @@ void LayoutConfig::layoutSelChanged(TQListViewItem *sel)
TQString kbdLayout = layoutUnitKey.layout;
// TODO: need better algorithm here for determining if needs us group
if ( ! m_rules->isSingleGroup(kbdLayout)
if ( ! m_rules->isSingleGroup(kbdLayout)
|| kbdLayout.startsWith("us") || kbdLayout.startsWith("en") ) {
widget->chkLatin->setEnabled( false );
}
@ -533,11 +564,11 @@ void LayoutConfig::layoutSelChanged(TQListViewItem *sel)
TQStringList vars = m_rules->getAvailableVariants(kbdLayout);
kdDebug() << "layout " << kbdLayout << " has " << vars.count() << " variants" << endl;
if( vars.count() > 0 ) {
vars.prepend(DEFAULT_VARIANT_NAME);
widget->comboVariant->insertStringList(vars);
TQString variant = sel->text(LAYOUT_COLUMN_VARIANT);
if( variant != NULL && variant.isEmpty() == false ) {
widget->comboVariant->setCurrentText(variant);
@ -668,7 +699,7 @@ void LayoutConfig::updateLayoutCommand()
layoutDisplayName = m_kxkbConfig.getDefaultDisplayName(LayoutUnit(kbdLayout, variant), single);
}
kdDebug() << "disp: '" << layoutDisplayName << "'" << endl;
if( !variant.isEmpty() ) {
setxkbmap += " -variant ";
if( widget->chkLatin->isChecked() )
@ -676,9 +707,9 @@ void LayoutConfig::updateLayoutCommand()
setxkbmap += variant;
}
}
widget->editCmdLine->setText(setxkbmap);
widget->editDisplayName->setEnabled( sel != NULL );
widget->editDisplayName->setText(layoutDisplayName);
}
@ -704,7 +735,7 @@ void LayoutConfig::loadRules()
++it;
}
modelsList.sort();
widget->comboModel->clear();
widget->comboModel->insertStringList(modelsList);
widget->comboModel->setCurrentItem(0);
@ -713,20 +744,20 @@ void LayoutConfig::loadRules()
widget->listLayoutsSrc->clear();
widget->listLayoutsDst->clear();
TQDictIterator<char> it2(m_rules->layouts());
while (it2.current())
{
TQString layout = it2.currentKey();
TQString layoutName = it2.current();
TQListViewItem *item = new TQListViewItem(widget->listLayoutsSrc);
item->setPixmap(LAYOUT_COLUMN_FLAG, LayoutIcon::getInstance().findPixmap(layout, true));
item->setPixmap(LAYOUT_COLUMN_FLAG, LayoutIcon::getInstance().findPixmap(layout, false));
item->setText(LAYOUT_COLUMN_NAME, i18n(layoutName.latin1()));
item->setText(LAYOUT_COLUMN_MAP, layout);
++it2;
}
widget->listLayoutsSrc->setSorting(LAYOUT_COLUMN_NAME); // from Qt3 TQListView sorts by language
//TODO: reset options and xkb options
}
@ -813,19 +844,19 @@ extern "C"
{
return new LayoutConfig(parent, "kcmlayout");
}
KDE_EXPORT TDECModule *create_keyboard(TQWidget *parent, const char *)
{
return new KeyboardConfig(parent, "kcmlayout");
}
KDE_EXPORT void init_keyboard()
{
KeyboardConfig::init_keyboard();
KxkbConfig m_kxkbConfig;
m_kxkbConfig.load(KxkbConfig::LOAD_INIT_OPTIONS);
if( m_kxkbConfig.m_useKxkb == true ) {
kapp->startServiceByDesktopName("kxkb");
}
@ -916,7 +947,7 @@ extern "C"
I18N_NOOP( "Left Alt key changes group" );
I18N_NOOP( "Left Ctrl key changes group" );
I18N_NOOP( "Compose Key" );
//these seem to be new in XFree86 4.4.0
I18N_NOOP("Shift with numpad keys works as in MS Windows.");
I18N_NOOP("Special keys (Ctrl+Alt+<key>) handled in a server.");

@ -466,6 +466,214 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQButtonGroup" row="1" column="0">
<property name="name">
<cstring>grpStyle</cstring>
</property>
<property name="title">
<string>Indicator Style</string>
</property>
<property name="exclusive">
<bool>true</bool>
</property>
<property name="whatsThis" stdset="0">
<string>Here you can choose the way your keyboard layout indicator will look.</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQRadioButton">
<property name="name">
<cstring>radFlagLabel</cstring>
</property>
<property name="text">
<string>&amp;Both Flag and Label</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="TQRadioButton">
<property name="name">
<cstring>radFlagOnly</cstring>
</property>
<property name="text">
<string>&amp;Flag Only</string>
</property>
</widget>
<widget class="TQRadioButton">
<property name="name">
<cstring>radLabelOnly</cstring>
</property>
<property name="text">
<string>&amp;Label Only</string>
</property>
</widget>
</vbox>
</widget>
<widget class="TQButtonGroup" row="1" column="1">
<property name="name">
<cstring>grpLabel</cstring>
</property>
<property name="title">
<string>Label Style</string>
</property>
<property name="whatsThis" stdset="0">
<string>Here you can choose the way the label of your keyboard layout indicator will be displayed. These options are relevant even when labels are disabled, for locales where the flag is missing.</string>
</property>
<grid>
<widget class="TQRadioButton" row="0" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>radLabelUseTheme</cstring>
</property>
<property name="text">
<string>Use &amp;theme colors</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="TQRadioButton" row="1" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>radLabelUseCustom</cstring>
</property>
<property name="text">
<string>Use c&amp;ustom colors</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<spacer row="2" column="0">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="2" column="1">
<property name="name">
<cstring>labelBgColor</cstring>
</property>
<property name="text">
<string>Background color:</string>
</property>
<property name="whatsThis" stdset="0">
<string>This color will be used as the indicator's background unless the indicator was set to display a flag.</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="KColorButton" row="2" column="2">
<property name="name">
<cstring>bgColor</cstring>
</property>
<property name="whatsThis" stdset="0">
<string>This color will be used as the indicator's background unless the indicator was set to display a flag.</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<spacer row="3" column="0">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="3" column="1">
<property name="name">
<cstring>labelFgColor</cstring>
</property>
<property name="text">
<string>Text color:</string>
</property>
<property name="whatsThis" stdset="0">
<string>This color will be used to draw the language label on the indicator.</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="KColorButton" row="3" column="2">
<property name="name">
<cstring>fgColor</cstring>
</property>
<property name="whatsThis" stdset="0">
<string>This color will be used to draw the language label on the indicator.</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="KSeparator" row="4" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>separator1</cstring>
</property>
</widget>
<widget class="TQLabel" row="5" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>labelFontRequester</cstring>
</property>
<property name="text">
<string>Label font:</string>
</property>
<property name="whatsThis" stdset="0">
<string>This is the font which will be used by the layout indicator to draw the label.</string>
</property>
</widget>
<widget class="TDEFontRequester" row="5" column="2">
<property name="name">
<cstring>labelFont</cstring>
</property>
</widget>
<widget class="TQCheckBox" row="6" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkLabelShadow</cstring>
</property>
<property name="text">
<string>Enable shadow</string>
</property>
<property name="whatsThis" stdset="0">
<string>Draw a drop shadow behind the language label. In some cases this option can improve readability.</string>
</property>
</widget>
<widget class="KColorButton" row="6" column="2">
<property name="name">
<cstring>shColor</cstring>
</property>
<property name="whatsThis" stdset="0">
<string>The drop shadow behind the language label will be of this color.</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</grid>
</widget>
<widget class="TQButtonGroup" row="2" column="0">
<property name="name">
<cstring>grpSwitching</cstring>
@ -512,20 +720,6 @@
</widget>
</vbox>
</widget>
<widget class="TQCheckBox" row="1" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkShowFlag</cstring>
</property>
<property name="text">
<string>Show country flag</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="whatsThis" stdset="0">
<string>Shows country flag on background of layout name in tray icon</string>
</property>
</widget>
<widget class="TQGroupBox" row="2" column="1">
<property name="name">
<cstring>grpBoxStickySwitching</cstring>
@ -537,7 +731,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
<widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>chkEnableSticky</cstring>
</property>
@ -548,7 +742,24 @@
<string>If you have more than two layouts and turn this option on, switching with the keyboard shortcut or clicking on the kxkb indicator will only cycle through the last few layouts. You can specify the number of layouts to rotate below. You can still access all layouts by right-clicking on the kxkb indicator.</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<spacer row="1" column="0">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="1" column="1">
<property name="name">
<cstring>textLabel1_5</cstring>
</property>
@ -562,7 +773,7 @@
<cstring>spinBox1</cstring>
</property>
</widget>
<widget class="TQSpinBox" row="1" column="1">
<widget class="TQSpinBox" row="1" column="2">
<property name="name">
<cstring>spinStickyDepth</cstring>
</property>
@ -575,6 +786,14 @@
<property name="minValue">
<number>2</number>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</grid>
</widget>
@ -698,6 +917,36 @@
<receiver>textLabel1_5</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>radLabelUseCustom</sender>
<signal>toggled(bool)</signal>
<receiver>bgColor</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>radLabelUseCustom</sender>
<signal>toggled(bool)</signal>
<receiver>fgColor</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>radLabelUseCustom</sender>
<signal>toggled(bool)</signal>
<receiver>labelBgColor</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>radLabelUseCustom</sender>
<signal>toggled(bool)</signal>
<receiver>labelFgColor</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>chkLabelShadow</sender>
<signal>toggled(bool)</signal>
<receiver>shColor</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>chkEnable</sender>
<signal>toggled(bool)</signal>
@ -708,6 +957,9 @@
<includes>
<include location="local" impldecl="in implementation">kiconloader.h</include>
<include location="local" impldecl="in implementation">kdialogbase.h</include>
<include location="local" impldecl="in implementation">kcolorbutton.h</include>
<include location="local" impldecl="in implementation">kseparator.h</include>
<include location="local" impldecl="in implementation">tdefontrequester.h</include>
</includes>
<pixmapfunction>SmallIcon</pixmapfunction>
<layoutdefaults spacing="6" margin="11"/>

@ -1,7 +1,7 @@
//
// C++ Implementation: kxkbconfig
//
// Description:
// Description:
//
//
// Author: Andriy Rysin <rysin@kde.org>, (C) 2006
@ -34,11 +34,11 @@ LayoutUnit KxkbConfig::getDefaultLayout()
{
if( m_layouts.size() == 0 )
return DEFAULT_LAYOUT_UNIT;
return m_layouts[0];
}
bool KxkbConfig::load(int loadMode)
bool KxkbConfig::load(int loadMode)
{
TDEConfig *config = new TDEConfig("kxkbrc", true, false);
config->setGroup("Layout");
@ -46,13 +46,13 @@ bool KxkbConfig::load(int loadMode)
// Even if the layouts have been disabled we still want to set Xkb options
// user can always switch them off now in the "Options" tab
m_enableXkbOptions = config->readBoolEntry("EnableXkbOptions", false);
if( m_enableXkbOptions == true || loadMode == LOAD_ALL ) {
m_resetOldOptions = config->readBoolEntry("ResetOldOptions", false);
m_options = config->readEntry("Options", "");
kdDebug() << "Xkb options (enabled=" << m_enableXkbOptions << "): " << m_options << endl;
}
m_useKxkb = config->readBoolEntry("Use", false);
kdDebug() << "Use kxkb " << m_useKxkb << endl;
@ -62,7 +62,7 @@ bool KxkbConfig::load(int loadMode)
m_model = config->readEntry("Model", DEFAULT_MODEL);
kdDebug() << "Model: " << m_model << endl;
TQStringList layoutList;
if( config->hasKey("LayoutList") ) {
layoutList = config->readListEntry("LayoutList");
@ -74,7 +74,7 @@ bool KxkbConfig::load(int loadMode)
}
if( layoutList.count() == 0 )
layoutList.append("us");
m_layouts.clear();
for(TQStringList::ConstIterator it = layoutList.begin(); it != layoutList.end() ; ++it) {
m_layouts.append( LayoutUnit(*it) );
@ -82,7 +82,7 @@ bool KxkbConfig::load(int loadMode)
}
kdDebug() << "Found " << m_layouts.count() << " layouts, default is " << getDefaultLayout().toPair() << endl;
TQStringList displayNamesList = config->readListEntry("DisplayNames", ',');
for(TQStringList::ConstIterator it = displayNamesList.begin(); it != displayNamesList.end() ; ++it) {
TQStringList displayNamePair = TQStringList::split(':', *it );
@ -127,7 +127,15 @@ bool KxkbConfig::load(int loadMode)
m_showSingle = config->readBoolEntry("ShowSingle", false);
m_showFlag = config->readBoolEntry("ShowFlag", true);
m_showLabel = config->readBoolEntry("ShowLabel", true);
m_useThemeColors = config->readBoolEntry("UseThemeColors", false);
m_colorBackground = config->readColorEntry("ColorBackground", new TQColor(TQt::gray));
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);
m_colorShadow = config->readColorEntry("ColorShadow", new TQColor(TQt::black));
TQString layoutOwner = config->readEntry("SwitchMode", "Global");
if( layoutOwner == "WinClass" ) {
@ -139,14 +147,14 @@ bool KxkbConfig::load(int loadMode)
else /*if( layoutOwner == "Global" )*/ {
m_switchingPolicy = SWITCH_POLICY_GLOBAL;
}
if( m_layouts.count() < 2 && m_switchingPolicy != SWITCH_POLICY_GLOBAL ) {
kdWarning() << "Layout count is less than 2, using Global switching policy" << endl;
m_switchingPolicy = SWITCH_POLICY_GLOBAL;
}
kdDebug() << "Layout owner mode " << layoutOwner << endl;
m_stickySwitching = config->readBoolEntry("StickySwitching", false);
m_stickySwitchingDepth = config->readEntry("StickySwitchingDepth", "2").toInt();
if( m_stickySwitchingDepth < 2 )
@ -157,7 +165,7 @@ bool KxkbConfig::load(int loadMode)
kdWarning() << "Layout count is less than 3, sticky switching will be off" << endl;
m_stickySwitching = false;
}
else
else
if( (int)m_layouts.count() - 1 < m_stickySwitchingDepth ) {
kdWarning() << "Sticky switching depth is more than layout count -1, adjusting..." << endl;
m_stickySwitchingDepth = m_layouts.count() - 1;
@ -169,7 +177,7 @@ bool KxkbConfig::load(int loadMode)
return true;
}
void KxkbConfig::save()
void KxkbConfig::save()
{
TDEConfig *config = new TDEConfig("kxkbrc", false, false);
config->setGroup("Layout");
@ -183,18 +191,18 @@ void KxkbConfig::save()
TQStringList layoutList;
TQStringList includeList;
TQStringList displayNamesList;
TQValueList<LayoutUnit>::ConstIterator it;
for(it = m_layouts.begin(); it != m_layouts.end(); ++it) {
const LayoutUnit& layoutUnit = *it;
layoutList.append( layoutUnit.toPair() );
if( layoutUnit.includeGroup.isEmpty() == false ) {
TQString incGroupUnit = TQString("%1:%2").arg(layoutUnit.toPair(), layoutUnit.includeGroup);
includeList.append( incGroupUnit );
}
TQString displayName( layoutUnit.displayName );
kdDebug() << " displayName " << layoutUnit.toPair() << " : " << displayName << endl;
if( displayName.isEmpty() == false && displayName != layoutUnit.layout ) {
@ -202,13 +210,13 @@ void KxkbConfig::save()
displayNamesList.append( displayName );
}
}
config->writeEntry("LayoutList", layoutList);
kdDebug() << "Saving Layouts: " << layoutList << endl;
config->writeEntry("IncludeGroups", includeList);
kdDebug() << "Saving includeGroups: " << includeList << endl;
// if( displayNamesList.empty() == false )
config->writeEntry("DisplayNames", displayNamesList);
// else
@ -216,21 +224,30 @@ void KxkbConfig::save()
config->writeEntry("Use", m_useKxkb);
config->writeEntry("ShowSingle", m_showSingle);
config->writeEntry("ShowFlag", m_showFlag);
config->writeEntry("ShowLabel", m_showLabel);
config->writeEntry("UseThemeColors", m_useThemeColors);
config->writeEntry("ColorBackground", m_colorBackground);
config->writeEntry("ColorLabel", m_colorLabel);
config->writeEntry("LabelFont", m_labelFont);
config->writeEntry("LabelShadow", m_labelShadow);
config->writeEntry("ColorShadow", m_colorShadow);
config->writeEntry("SwitchMode", switchModes[m_switchingPolicy]);
config->writeEntry("StickySwitching", m_stickySwitching);
config->writeEntry("StickySwitchingDepth", m_stickySwitchingDepth);
// remove old options
// remove old options
config->deleteEntry("Variants");
config->deleteEntry("Includes");
config->deleteEntry("Encoding");
config->deleteEntry("AdditionalEncodings");
config->deleteEntry("Additional");
config->deleteEntry("Layout");
config->sync();
delete config;
@ -252,7 +269,7 @@ void KxkbConfig::setDefaults()
m_showFlag = true;
m_switchingPolicy = SWITCH_POLICY_GLOBAL;
m_stickySwitching = false;
m_stickySwitchingDepth = 2;
}
@ -271,7 +288,7 @@ TQStringList KxkbConfig::getLayoutStringList(/*bool compact*/)
TQString KxkbConfig::getDefaultDisplayName(const TQString& code_)
{
TQString displayName;
if( code_.length() <= 2 ) {
displayName = code_;
}
@ -281,13 +298,13 @@ TQString KxkbConfig::getDefaultDisplayName(const TQString& code_)
TQString rightCode;
if( sepPos != -1 )
rightCode = code_.mid(sepPos+1);
if( rightCode.length() > 0 )
displayName = leftCode.left(2) + rightCode.left(1).lower();
else
displayName = leftCode.left(3);
}
return displayName;
}
@ -295,7 +312,7 @@ TQString KxkbConfig::getDefaultDisplayName(const LayoutUnit& layoutUnit, bool si
{
if( layoutUnit.variant == "" )
return getDefaultDisplayName( layoutUnit.layout );
TQString displayName = layoutUnit.layout.left(2);
if( single == false )
displayName += layoutUnit.variant.left(1);

@ -1,7 +1,7 @@
//
// C++ Interface: kxkbconfig
//
// Description:
// Description:
//
//
// Author: Andriy Rysin <rysin@kde.org>, (C) 2006
@ -14,13 +14,15 @@
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqcolor.h>
#include <tqfont.h>
#include <tqptrqueue.h>
#include <tqmap.h>
/* Utility classes for per-window/per-application layout implementation
*/
enum SwitchingPolicy {
enum SwitchingPolicy {
SWITCH_POLICY_GLOBAL = 0,
SWITCH_POLICY_WIN_CLASS = 1,
SWITCH_POLICY_WINDOW = 2,
@ -29,12 +31,12 @@ enum SwitchingPolicy {
inline TQString createPair(TQString key, TQString value)
inline TQString createPair(TQString key, TQString value)
{
if( value.isEmpty() )
return key;
return TQString("%1(%2)").arg(key, value);
}
}
struct LayoutUnit {
TQString layout;
@ -42,41 +44,41 @@ struct LayoutUnit {
TQString includeGroup;
TQString displayName;
int defaultGroup;
LayoutUnit() {}
LayoutUnit(TQString layout_, TQString variant_):
layout(layout_),
variant(variant_)
{}
LayoutUnit(TQString pair) {
setFromPair( pair );
}
void setFromPair(const TQString& pair) {
layout = parseLayout(pair);
variant = parseVariant(pair);
}
TQString toPair() const {
return createPair(layout, variant);
}
bool operator<(const LayoutUnit& lu) const {
return layout<lu.layout ||
(layout==lu.layout && variant<lu.variant);
}
bool operator!=(const LayoutUnit& lu) const {
return layout!=lu.layout || variant!=lu.variant;
}
bool operator==(const LayoutUnit& lu) const {
// kdDebug() << layout << "==" << lu.layout << "&&" << variant << "==" << lu.variant << endl;
return layout==lu.layout && variant==lu.variant;
}
//private:
static const TQString parseLayout(const TQString &layvar);
static const TQString parseVariant(const TQString &layvar);
@ -90,31 +92,39 @@ class KxkbConfig
{
public:
enum { LOAD_INIT_OPTIONS, LOAD_ACTIVE_OPTIONS, LOAD_ALL };
bool m_useKxkb;
bool m_showSingle;
bool m_showFlag;
bool m_showLabel;
bool m_enableXkbOptions;
bool m_resetOldOptions;
SwitchingPolicy m_switchingPolicy;
bool m_stickySwitching;
int m_stickySwitchingDepth;
bool m_useThemeColors;
TQColor m_colorBackground;
TQColor m_colorLabel;
TQFont m_labelFont;
bool m_labelShadow;
TQColor m_colorShadow;
TQString m_model;
TQString m_options;
TQValueList<LayoutUnit> m_layouts;
LayoutUnit getDefaultLayout();
bool load(int loadMode);
void save();
void setDefaults();
TQStringList getLayoutStringList(/*bool compact*/);
static TQString getDefaultDisplayName(const TQString& code_);
static TQString getDefaultDisplayName(const LayoutUnit& layoutUnit, bool single=false);
private:
private:
static const TQMap<TQString, TQString> parseIncludesMap(const TQStringList& pairList);
};

@ -1,7 +1,7 @@
//
// C++ Implementation: kxkbtraywindow
//
// Description:
// Description:
//
//
// Author: Andriy Rysin <rysin@kde.org>, (C) 2006
@ -25,7 +25,7 @@
#include "kxkbconfig.h"
KxkbLabelController::KxkbLabelController(TQLabel* label_, TQPopupMenu* contextMenu_) :
KxkbLabelController::KxkbLabelController(TQLabel* label_, TDEPopupMenu* contextMenu_) :
label(label_),
contextMenu(contextMenu_),
m_menuStartIndex(contextMenu_->count()),
@ -51,7 +51,7 @@ void KxkbLabelController::setPixmap(const TQPixmap& pixmap)
void KxkbLabelController::setCurrentLayout(const LayoutUnit& layoutUnit)
{
setToolTip(m_descriptionMap[layoutUnit.toPair()]);
setPixmap( LayoutIcon::getInstance().findPixmap(layoutUnit.layout, m_showFlag, layoutUnit.displayName) );
setPixmap( LayoutIcon::getInstance().findPixmap(layoutUnit.layout, PIXMAP_STYLE_INDICATOR, layoutUnit.displayName) );
}
@ -60,14 +60,14 @@ void KxkbLabelController::setError(const TQString& layoutInfo)
TQString msg = i18n("Error changing keyboard layout to '%1'").arg(layoutInfo);
setToolTip(msg);
label->setPixmap(LayoutIcon::getInstance().findPixmap("error", m_showFlag));
label->setPixmap(LayoutIcon::getInstance().findPixmap("error", PIXMAP_STYLE_NORMAL));
}
void KxkbLabelController::initLayoutList(const TQValueList<LayoutUnit>& layouts, const XkbRules& rules)
{
// TDEPopupMenu* menu = contextMenu();
TQPopupMenu* menu = contextMenu;
TDEPopupMenu* menu = contextMenu;
// TQPopupMenu* menu = contextMenu;
// int index = menu->indexOf(0);
m_descriptionMap.clear();
@ -80,30 +80,30 @@ void KxkbLabelController::initLayoutList(const TQValueList<LayoutUnit>& layouts,
}
/* menu->removeItem(CONFIG_MENU_ID);
menu->removeItem(HELP_MENU_ID);*/
TDEIconEffect iconeffect;
int cnt = 0;
TQValueList<LayoutUnit>::ConstIterator it;
for (it=layouts.begin(); it != layouts.end(); ++it)
{
const TQString layoutName = (*it).layout;
const TQString variantName = (*it).variant;
const TQPixmap& layoutPixmap = LayoutIcon::getInstance().findPixmap(layoutName, m_showFlag, (*it).displayName);
const TQPixmap& layoutPixmap = LayoutIcon::getInstance().findPixmap(layoutName, PIXMAP_STYLE_CONTEXTMENU, (*it).displayName);
const TQPixmap pix = iconeffect.apply(layoutPixmap, TDEIcon::Small, TDEIcon::DefaultState);
TQString fullName = i18n((rules.layouts()[layoutName]));
if( variantName.isEmpty() == false )
fullName += " (" + variantName + ")";
contextMenu->insertItem(pix, fullName, START_MENU_ID + cnt, m_menuStartIndex + cnt);
m_descriptionMap.insert((*it).toPair(), fullName);
cnt++;
}
m_prevLayoutCount = cnt;
// if show config, if show help
if( menu->indexOf(CONFIG_MENU_ID) == -1 ) {
contextMenu->insertSeparator();

@ -21,7 +21,7 @@
class TQLabel;
class TQPopupMenu;
class TDEPopupMenu;
class XkbRules;
/* This class is responsible for displaying flag/label for the layout,
@ -35,7 +35,7 @@ class KxkbLabelController: public QObject
public:
enum { START_MENU_ID = 100, CONFIG_MENU_ID = 130, HELP_MENU_ID = 131 };
KxkbLabelController(TQLabel *label, TQPopupMenu* contextMenu);
KxkbLabelController(TQLabel *label, TDEPopupMenu* contextMenu);
void initLayoutList(const TQValueList<LayoutUnit>& layouts, const XkbRules& rule);
void setCurrentLayout(const LayoutUnit& layout);
@ -55,7 +55,7 @@ public:
private:
TQLabel* label;
TQPopupMenu* contextMenu;
TDEPopupMenu* contextMenu;
const int m_menuStartIndex;
bool m_showFlag;

@ -6,16 +6,15 @@
#include <tqdict.h>
#include <kstandarddirs.h>
#include <tdeglobalsettings.h>
#include <tdelocale.h>
#include <kdebug.h>
#include "pixmap.h"
#include "x11helper.h"
#include "kxkbconfig.h"
static const int FLAG_MAX_WIDTH = 21;
static const int FLAG_MAX_HEIGHT = 14;
static const int FLAG_MAX_DIM = 24;
const TQString LayoutIcon::flagTemplate("l10n/%1/flag.png");
const TQString& LayoutIcon::ERROR_CODE("error");
@ -30,16 +29,52 @@ LayoutIcon& LayoutIcon::getInstance() {
}
LayoutIcon::LayoutIcon():
m_pixmapCache(80),
m_labelFont("sans")
m_pixmapCache(80)
{
m_labelFont.setPixelSize(10);
m_labelFont.setWeight(TQFont::Bold);
}
const TQPixmap&
LayoutIcon::findPixmap(const TQString& code_, bool showFlag, const TQString& displayName_)
LayoutIcon::findPixmap(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
m_bgColor = TDEGlobalSettings::highlightColor();
m_fgColor = TDEGlobalSettings::highlightedTextColor();
} else {
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;
// Decide on how to style the pixmap
switch(pixmapStyle) {
case PIXMAP_STYLE_NORMAL:
m_fitToBox = true;
m_showFlag = true;
m_showLabel = false;
break;
case PIXMAP_STYLE_INDICATOR:
m_fitToBox = true;
m_showFlag = m_kxkbConfig.m_showFlag;
m_showLabel = m_kxkbConfig.m_showLabel;
break;
case PIXMAP_STYLE_CONTEXTMENU:
m_fitToBox = false; // causes white color loss
m_showFlag = true;
m_showLabel = false;
break;
}
// Label only mode is always 'fit to box'
if( m_showLabel && !m_showFlag )
m_fitToBox = true;
TQPixmap* pm = NULL;
if( code_ == ERROR_CODE ) {
@ -52,61 +87,68 @@ LayoutIcon::findPixmap(const TQString& code_, bool showFlag, const TQString& dis
}
TQString displayName(displayName_);
if( displayName.isEmpty() ) {
displayName = KxkbConfig::getDefaultDisplayName(code_);
}
if( displayName.length() > 3 )
displayName = displayName.left(3);
const TQString pixmapKey( showFlag ? code_ + "." + displayName : displayName );
pm = m_pixmapCache[pixmapKey];
if( pm )
return *pm;
TQString flag;
if( showFlag ) {
TQString countryCode = getCountryFromLayoutName( code_ );
flag = locate("locale", flagTemplate.arg(countryCode));
}
if( flag.isEmpty() ) {
pm = new TQPixmap(FLAG_MAX_WIDTH, FLAG_MAX_HEIGHT);
pm->fill(Qt::gray);
}
else {
pm = new TQPixmap(flag);
dimPixmap( *pm );
#if 0
if( pm->height() < FLAG_MAX_HEIGHT ) {
TQPixmap* pix = new TQPixmap(FLAG_MAX_WIDTH, FLAG_MAX_HEIGHT);
pix->fill( Qt::lightGray );
// pix->fill( TQColor(tqRgba(127,127,127,255)) );
// TQBitmap mask;
// mask.fill(1);
// pix->setMask(mask);
int dy = (pix->height() - pm->height()) / 2;
copyBlt( pix, 0, dy, pm, 0, 0, -1, -1 );
// TQPixmap* px = new TQPixmap(21, 14);
// px->convertFromImage(img);*/
delete pm;
pm = pix;
}
#endif
}
TQPainter p(pm);
p.setFont(m_labelFont);
p.setPen(Qt::black);
p.drawText(1, 1, pm->width(), pm->height()-2, Qt::AlignCenter, displayName);
p.setPen(Qt::white);
p.drawText(0, 0, pm->width(), pm->height()-2, Qt::AlignCenter, displayName);
m_pixmapCache.insert(pixmapKey, pm);
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
);
// Only use cache for indicator
if( pixmapStyle == PIXMAP_STYLE_INDICATOR ) {
pm = m_pixmapCache[pixmapKey];
if( pm )
return *pm;
}
// Need to create new pixmap
pm = new TQPixmap();
if( m_fitToBox ) // Resize to box size
pm->resize(FLAG_MAX_DIM, FLAG_MAX_DIM);
if( m_showFlag ) {
TQString countryCode = getCountryFromLayoutName( code_ );
TQString flag = locate("locale", flagTemplate.arg(countryCode));
if( flag.isEmpty() ) {
pm->fill(m_bgColor);
m_showLabel = true;
} else {
if( m_fitToBox ) { // Resize flag
TQPainter p_(pm);
p_.drawPixmap(TQRect(0, 0, FLAG_MAX_DIM, FLAG_MAX_DIM), flag);
} else { // Show the flag as is
pm->load(flag);
}
if( m_showLabel ) // only dim for label
dimPixmap( *pm );
}
} else {
pm->fill(m_bgColor);
}
if( m_showLabel ) {
TQPainter p(pm);
p.setFont(m_labelFont);
if( m_labelShadow ) {
p.setPen(m_shColor);
p.drawText(1, 1, pm->width(), pm->height(), Qt::AlignCenter, displayName);
}
p.setPen(m_fgColor);
p.drawText(0, 0, pm->width(), pm->height(), Qt::AlignCenter, displayName);
}
if( pixmapStyle == PIXMAP_STYLE_INDICATOR )
m_pixmapCache.insert(pixmapKey, pm);
return *pm;
}
@ -117,7 +159,7 @@ LayoutIcon::findPixmap(const TQString& code_, bool showFlag, const TQString& dis
TQString LayoutIcon::getCountryFromLayoutName(const TQString& layoutName)
{
TQString flag;
if( X11Helper::areLayoutsClean() ) { // >= Xorg 6.9.0
if( layoutName == "mkd" )
flag = "mk";
@ -178,8 +220,8 @@ TQString LayoutIcon::getCountryFromLayoutName(const TQString& layoutName)
if( layoutName.endsWith("/jp") )
flag = "jp";
else
if( layoutName == "ml" || layoutName == "dev" || layoutName == "gur"
|| layoutName == "guj" || layoutName == "kan" || layoutName == "ori"
if( layoutName == "ml" || layoutName == "dev" || layoutName == "gur"
|| layoutName == "guj" || layoutName == "kan" || layoutName == "ori"
|| layoutName == "tel" || layoutName == "tml" || layoutName == "ben" ) // some Indian languages
flag = "in";
else {
@ -189,8 +231,8 @@ TQString LayoutIcon::getCountryFromLayoutName(const TQString& layoutName)
if( sepPos != -1 )
rightCode = layoutName.mid(sepPos+1);
// kdDebug() << "layout name breakup: " << leftCode << ":" << rightCode << endl;
if( rightCode.length() == 2
if( rightCode.length() == 2
&& TQRegExp("[A-Z][A-Z]").exactMatch(rightCode) ) {
flag = rightCode.lower();
}
@ -199,7 +241,7 @@ TQString LayoutIcon::getCountryFromLayoutName(const TQString& layoutName)
}
}
}
return flag;
}

@ -6,26 +6,42 @@
#include <tqdict.h>
#include <tqstring.h>
#include "kxkbconfig.h"
enum PixmapStyle {
PIXMAP_STYLE_NORMAL = 0,
PIXMAP_STYLE_INDICATOR = 1,
PIXMAP_STYLE_CONTEXTMENU = 2
};
class LayoutIcon {
private:
static LayoutIcon* instance;
static const TQString flagTemplate;
TQDict<TQPixmap> m_pixmapCache;
TQFont m_labelFont;
LayoutIcon();
TQPixmap* createErrorPixmap();
void dimPixmap(TQPixmap& pixmap);
TQString getCountryFromLayoutName(const TQString& layoutName);
public:
static const TQString& ERROR_CODE;
static LayoutIcon& getInstance();
const TQPixmap& findPixmap(const TQString& code, bool showFlag, const TQString& displayName="");
static LayoutIcon* instance;
static const TQString flagTemplate;
KxkbConfig m_kxkbConfig;
bool m_showFlag;
bool m_showLabel;
TQColor m_bgColor;
TQColor m_fgColor;
TQFont m_labelFont;
bool m_labelShadow;
TQColor m_shColor;
bool m_fitToBox;
TQDict<TQPixmap> m_pixmapCache;
LayoutIcon();
TQPixmap* createErrorPixmap();
void dimPixmap(TQPixmap& pixmap);
TQString getCountryFromLayoutName(const TQString& layoutName);
public:
static const TQString& ERROR_CODE;
static LayoutIcon& getInstance();
const TQPixmap& findPixmap(const TQString& code, int pixmapStyle, const TQString& displayName="");
};
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 99 B

Loading…
Cancel
Save