@@ -146,6 +148,16 @@
}
};
+class StyleConfig : public QWidget, public Ui::StyleConfig
+{
+public:
+ StyleConfig(QWidget *parent = nullptr)
+ : QWidget(parent)
+ {
+ setupUi(this);
+ }
+};
+
QString KCMStyle::defaultStyle()
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
@@ -158,97 +170,57 @@
KCMStyle::KCMStyle( QWidget* parent, const QVariantList& )
: KCModule( parent ), appliedStyle(nullptr)
{
- setQuickHelp( i18n("Style
"
- "This module allows you to modify the visual appearance "
- "of user interface elements, such as the widget style "
- "and effects."));
+ setQuickHelp( i18n("This module allows you to modify the visual appearance "
+ "of user interface elements, such as the application style "
+ "and effects."));
m_bStyleDirty= false;
m_bEffectsDirty = false;
KGlobal::dirs()->addResourceType("themes", "data", "kstyle/themes");
KAboutData *about =
- new KAboutData( QStringLiteral("kcmstyle"), i18n("Widget Style"), QStringLiteral("1.0"),
+ new KAboutData( QStringLiteral("kcmstyle"), i18n("Application Style"), QStringLiteral("1.0"),
QString(), KAboutLicense::GPL,
i18n("(c) 2002 Karol Szwed, Daniel Molkentin"));
about->addAuthor(i18n("Karol Szwed"), QString(), QStringLiteral("gallium@kde.org"));
about->addAuthor(i18n("Daniel Molkentin"), QString(), QStringLiteral("molkentin@kde.org"));
setAboutData( about );
- // Setup pages and mainLayout
+ // Setup mainLayout
mainLayout = new QVBoxLayout( this );
mainLayout->setContentsMargins(0, 0, 0, 0);
- tabWidget = new QTabWidget( this );
- mainLayout->addWidget( tabWidget );
-
- // Add Page1 (Applications Style)
- // -----------------
- //gbWidgetStyle = new QGroupBox( i18n("Widget Style"), page1 );
- page1 = new QWidget;
- page1Layout = new QVBoxLayout( page1 );
-
- QWidget* gbWidgetStyle = new QWidget( page1 );
- QVBoxLayout *widgetLayout = new QVBoxLayout(gbWidgetStyle);
-
- gbWidgetStyleLayout = new QVBoxLayout;
- widgetLayout->addLayout( gbWidgetStyleLayout );
- gbWidgetStyleLayout->setAlignment( Qt::AlignTop );
- hbLayout = new QHBoxLayout( );
- hbLayout->setObjectName( QStringLiteral("hbLayout") );
-
- QLabel* label=new QLabel(i18n("Widget style:"),this);
- hbLayout->addWidget( label );
-
- cbStyle = new KComboBox( gbWidgetStyle );
- cbStyle->setObjectName( QStringLiteral("cbStyle") );
- cbStyle->setEditable( false );
- hbLayout->addWidget( cbStyle );
- hbLayout->setStretchFactor( cbStyle, 1 );
- label->setBuddy(cbStyle);
-
- pbConfigStyle = new QPushButton( QIcon::fromTheme(QStringLiteral("configure")), i18n("Con&figure..."), gbWidgetStyle );
- pbConfigStyle->setEnabled( false );
- hbLayout->addWidget( pbConfigStyle );
+ styleConfig = new StyleConfig();
- gbWidgetStyleLayout->addLayout( hbLayout );
+ QHBoxLayout *previewLayout = new QHBoxLayout();
+ QGroupBox *gbPreview = new QGroupBox( i18n( "Preview" ) );
+ QHBoxLayout *previewLayoutInner = new QHBoxLayout(gbPreview);
+ previewLayout->setContentsMargins(0, 0, 0, 0);
+ previewLayoutInner->setContentsMargins(0, 0, 0, 0);
+ previewLayout->addStretch();
+ previewLayout->addWidget( gbPreview );
+ previewLayout->addStretch();
- lblStyleDesc = new QLabel( gbWidgetStyle );
- gbWidgetStyleLayout->addWidget( lblStyleDesc );
-
- QGroupBox *gbPreview = new QGroupBox( i18n( "Preview" ), page1 );
- QVBoxLayout *previewLayout = new QVBoxLayout(gbPreview);
- previewLayout->setMargin( 0 );
stylePreview = new StylePreview( gbPreview );
- gbPreview->layout()->addWidget( stylePreview );
-
- page1Layout->addWidget( gbWidgetStyle );
- page1Layout->addWidget( gbPreview );
- page1Layout->addStretch();
+ previewLayoutInner->addWidget( stylePreview );
- connect( cbStyle, SIGNAL(activated(int)), this, SLOT(styleChanged()) );
- connect( cbStyle, SIGNAL(activated(int)), this, SLOT(updateConfigButton()));
- connect( pbConfigStyle, &QAbstractButton::clicked, this, &KCMStyle::styleSpecificConfig);
+ mainLayout->addWidget( styleConfig );
+ mainLayout->addLayout( previewLayout );
+ mainLayout->addStretch();
- // Add Page2 (Effects)
- // -------------------
- page2 = new QWidget;
- fineTuningUi.setupUi(page2);
-
- connect(cbStyle, SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
- connect(fineTuningUi.cbIconsOnButtons, &QAbstractButton::toggled, this, &KCMStyle::setEffectsDirty);
- connect(fineTuningUi.cbIconsInMenus, &QAbstractButton::toggled, this, &KCMStyle::setEffectsDirty);
- connect(fineTuningUi.comboToolbarIcons, SIGNAL(activated(int)), this, SLOT(setEffectsDirty()));
- connect(fineTuningUi.comboSecondaryToolbarIcons, SIGNAL(activated(int)), this, SLOT(setEffectsDirty()));
+ connect( styleConfig->comboStyle, SIGNAL(activated(int)), this, SLOT(styleChanged()) );
+ connect( styleConfig->comboStyle, SIGNAL(activated(int)), this, SLOT(updateConfigButton()) );
+ connect( styleConfig->pbConfigStyle, &QAbstractButton::clicked, this, &KCMStyle::styleSpecificConfig );
+ connect( styleConfig->comboStyle, SIGNAL(activated(int)), this, SLOT(setStyleDirty()) );
+ connect( styleConfig->cbIconsOnButtons, &QAbstractButton::toggled, this, &KCMStyle::setEffectsDirty );
+ connect( styleConfig->cbIconsInMenus, &QAbstractButton::toggled, this, &KCMStyle::setEffectsDirty );
+ connect( styleConfig->comboToolbarIcons, SIGNAL(activated(int)), this, SLOT(setEffectsDirty()) );
+ connect( styleConfig->comboSecondaryToolbarIcons, SIGNAL(activated(int)), this, SLOT(setEffectsDirty()) );
addWhatsThis();
-
- // Insert the pages into the tabWidget
- tabWidget->addTab(page1, i18nc("@title:tab", "&Applications"));
- tabWidget->addTab(page2, i18nc("@title:tab", "&Fine Tuning"));
}
@@ -261,14 +233,14 @@
void KCMStyle::updateConfigButton()
{
if (!styleEntries[currentStyle()] || styleEntries[currentStyle()]->configPage.isEmpty()) {
- pbConfigStyle->setEnabled(false);
+ styleConfig->pbConfigStyle->setEnabled(false);
return;
}
// We don't check whether it's loadable here -
// lets us report an error and not waste time
// loading things if the user doesn't click the button
- pbConfigStyle->setEnabled( true );
+ styleConfig->pbConfigStyle->setEnabled( true );
}
void KCMStyle::styleSpecificConfig()
@@ -364,16 +336,16 @@
KConfig _config(QStringLiteral("kdeglobals"), KConfig::NoGlobals);
KConfigGroup config(&_config, "KDE");
// Effects page
- config.writeEntry( "ShowIconsOnPushButtons", fineTuningUi.cbIconsOnButtons->isChecked());
- config.writeEntry( "ShowIconsInMenuItems", fineTuningUi.cbIconsInMenus->isChecked());
+ config.writeEntry( "ShowIconsOnPushButtons", styleConfig->cbIconsOnButtons->isChecked());
+ config.writeEntry( "ShowIconsInMenuItems", styleConfig->cbIconsInMenus->isChecked());
config.writeEntry("widgetStyle", currentStyle());
KConfigGroup toolbarStyleGroup(&_config, "Toolbar style");
toolbarStyleGroup.writeEntry("ToolButtonStyle",
- toolbarButtonText(fineTuningUi.comboToolbarIcons->currentIndex()));
+ toolbarButtonText(styleConfig->comboToolbarIcons->currentIndex()));
toolbarStyleGroup.writeEntry("ToolButtonStyleOtherToolbars",
- toolbarButtonText(fineTuningUi.comboSecondaryToolbarIcons->currentIndex()));
+ toolbarButtonText(styleConfig->comboSecondaryToolbarIcons->currentIndex()));
_config.sync();
@@ -425,9 +397,9 @@
combobox_item = 0;
//look up name
- for( int i = 0; i < cbStyle->count(); i++ )
+ for( int i = 0; i < styleConfig->comboStyle->count(); i++ )
{
- if ( cbStyle->itemText(i) == name )
+ if ( styleConfig->comboStyle->itemText(i) == name )
{
combobox_item = i;
return true;
@@ -456,17 +428,18 @@
if (!found)
found = findStyle( QStringLiteral("motif"), item );
- cbStyle->setCurrentIndex( item );
+ styleConfig->comboStyle->setCurrentIndex( item );
m_bStyleDirty = true;
switchStyle( currentStyle() ); // make resets visible
// Effects
- fineTuningUi.comboToolbarIcons->setCurrentIndex(toolbarButtonIndex(QStringLiteral("TextBesideIcon")));
- fineTuningUi.comboSecondaryToolbarIcons->setCurrentIndex(toolbarButtonIndex(QStringLiteral("TextBesideIcon")));
- fineTuningUi.cbIconsOnButtons->setChecked(true);
- fineTuningUi.cbIconsInMenus->setChecked(true);
+ styleConfig->comboToolbarIcons->setCurrentIndex(toolbarButtonIndex(QStringLiteral("TextBesideIcon")));
+ styleConfig->comboSecondaryToolbarIcons->setCurrentIndex(toolbarButtonIndex(QStringLiteral("TextBesideIcon")));
+ styleConfig->cbIconsOnButtons->setChecked(true);
+ styleConfig->cbIconsInMenus->setChecked(true);
emit changed(true);
+ emit updateConfigButton();
}
void KCMStyle::setEffectsDirty()
@@ -487,7 +460,7 @@
void KCMStyle::loadStyle( KConfig& config )
{
- cbStyle->clear();
+ styleConfig->comboStyle->clear();
// Create a dictionary of WidgetStyle to Name and Desc. mappings,
// as well as the config page info
qDeleteAll(styleEntries);
@@ -553,25 +526,25 @@
// Sort the style list, and add it to the combobox
styles.sort();
- cbStyle->addItems( styles );
+ styleConfig->comboStyle->addItems( styles );
// Find out which style is currently being used
KConfigGroup configGroup = config.group( "KDE" );
QString defaultStyle = KCMStyle::defaultStyle();
QString cfgStyle = configGroup.readEntry( "widgetStyle", defaultStyle );
// Select the current style
- // Do not use cbStyle->listBox() as this may be NULL for some styles when
+ // Do not use comboStyle->listBox() as this may be NULL for some styles when
// they use QPopupMenus for the drop-down list!
// ##### Since Trolltech likes to seemingly copy & paste code,
// QStringList::findItem() doesn't have a Qt::StringComparisonMode field.
// We roll our own (yuck)
cfgStyle = cfgStyle.toLower();
int item = 0;
- for( int i = 0; i < cbStyle->count(); i++ )
+ for( int i = 0; i < styleConfig->comboStyle->count(); i++ )
{
- QString id = nameToStyleKey[cbStyle->itemText(i)];
+ QString id = nameToStyleKey[styleConfig->comboStyle->itemText(i)];
item = i;
if ( id == cfgStyle ) // ExactMatch
break;
@@ -581,15 +554,15 @@
break;
item = 0;
}
- cbStyle->setCurrentIndex( item );
+ styleConfig->comboStyle->setCurrentIndex( item );
m_bStyleDirty = false;
switchStyle( currentStyle() ); // make resets visible
}
QString KCMStyle::currentStyle()
{
- return nameToStyleKey[cbStyle->currentText()];
+ return nameToStyleKey[styleConfig->comboStyle->currentText()];
}
@@ -620,12 +593,6 @@
delete appliedStyle;
appliedStyle = style;
-
- // Set the correct style description
- StyleEntry* entry = styleEntries[ styleName ];
- QString desc;
- desc = i18n("Description: %1", entry ? entry->desc : i18n("No description available.") );
- lblStyleDesc->setText( desc );
}
void KCMStyle::setStyleRecursive(QWidget* w, QStyle* s)
@@ -713,39 +680,36 @@
KConfigGroup configGroup = config.group("Toolbar style");
QString tbIcon = configGroup.readEntry("ToolButtonStyle", "TextBesideIcon");
- fineTuningUi.comboToolbarIcons->setCurrentIndex(toolbarButtonIndex(tbIcon));
+ styleConfig->comboToolbarIcons->setCurrentIndex(toolbarButtonIndex(tbIcon));
tbIcon = configGroup.readEntry("ToolButtonStyleOtherToolbars", "TextBesideIcon");
- fineTuningUi.comboSecondaryToolbarIcons->setCurrentIndex(toolbarButtonIndex(tbIcon));
+ styleConfig->comboSecondaryToolbarIcons->setCurrentIndex(toolbarButtonIndex(tbIcon));
configGroup = config.group("KDE");
- fineTuningUi.cbIconsOnButtons->setChecked(configGroup.readEntry("ShowIconsOnPushButtons", true));
- fineTuningUi.cbIconsInMenus->setChecked(configGroup.readEntry("ShowIconsInMenuItems", true));
+ styleConfig->cbIconsOnButtons->setChecked(configGroup.readEntry("ShowIconsOnPushButtons", true));
+ styleConfig->cbIconsInMenus->setChecked(configGroup.readEntry("ShowIconsInMenuItems", true));
m_bEffectsDirty = false;
}
void KCMStyle::addWhatsThis()
{
- // Page1
- cbStyle->setWhatsThis( i18n("Here you can choose from a list of"
+ stylePreview->setWhatsThis( i18n("This area shows a preview of the currently selected style "
+ "without having to apply it to the whole desktop.") );
+ styleConfig->comboStyle->setWhatsThis( i18n("Here you can choose from a list of"
" predefined widget styles (e.g. the way buttons are drawn) which"
" may or may not be combined with a theme (additional information"
" like a marble texture or a gradient).") );
- stylePreview->setWhatsThis( i18n("This area shows a preview of the currently selected style "
- "without having to apply it to the whole desktop.") );
- // Page2
- page2->setWhatsThis( i18n("This page allows you to choose details about the widget style options") );
- fineTuningUi.comboToolbarIcons->setWhatsThis( i18n( "No Text: Shows only icons on toolbar buttons. "
+ styleConfig->cbIconsOnButtons->setWhatsThis( i18n( "If you enable this option, applications will "
+ "show small icons alongside some important buttons.") );
+ styleConfig->cbIconsInMenus->setWhatsThis( i18n( "If you enable this option, applications will "
+ "show small icons alongside most menu items.") );
+ styleConfig->comboToolbarIcons->setWhatsThis( i18n( "
No text: Shows only icons on toolbar buttons. "
"Best option for low resolutions.
"
- "Text Only: Shows only text on toolbar buttons.
"
- "Text Beside Icons: Shows icons and text on toolbar buttons. "
+ "
Text only: Shows only text on toolbar buttons.
"
+ "Text beside icons: Shows icons and text on toolbar buttons. "
"Text is aligned beside the icon.
"
- "Text Below Icons: Shows icons and text on toolbar buttons. "
+ "Text below icons: Shows icons and text on toolbar buttons. "
"Text is aligned below the icon.") );
- fineTuningUi.cbIconsOnButtons->setWhatsThis( i18n( "If you enable this option, KDE Applications will "
- "show small icons alongside some important buttons.") );
- fineTuningUi.cbIconsInMenus->setWhatsThis( i18n( "If you enable this option, KDE Applications will "
- "show small icons alongside most menu items.") );
}
#include "kcmstyle.moc"
diff --git a/kcms/style/style.desktop b/kcms/style/style.desktop
--- a/kcms/style/style.desktop
+++ b/kcms/style/style.desktop
@@ -13,7 +13,7 @@
X-KDE-System-Settings-Parent-Category=applicationstyle
X-KDE-Weight=0
-Name=Widget Style
+Name=Application Style
Name[ar]=نمط الودجات
Name[bs]=Stil grafičke kontrole
Name[ca]=Estil dels estris
@@ -58,7 +58,7 @@
Name[x-test]=xxWidget Stylexx
Name[zh_CN]=部件风格
Name[zh_TW]=元件樣式
-Comment=Configure widget style and behavior
+Comment=Configure application style and behavior
Comment[ca]=Configura l'estil i el comportament dels estris
Comment[ca@valencia]=Configura l'estil i el comportament dels estris
Comment[es]=Configurar el estilo y el comportamiento de los elementos gráficos
diff --git a/kcms/style/styleconfig.ui b/kcms/style/styleconfig.ui
new file mode 100644
--- /dev/null
+++ b/kcms/style/styleconfig.ui
@@ -0,0 +1,157 @@
+
+
+ StyleConfig
+
+
+
+ 0
+ 0
+ 378
+ 204
+
+
+
+
+ Qt::AlignHCenter|Qt::AlignTop
+
+ -
+
+
+ Application style:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
-
+
+
+ QComboBox::AdjustToContents
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Configure Application Style...
+
+
+
+
+
+
+ ..
+
+
+
+
+
+ -
+
+
+ Show icons:
+
+
+
+ -
+
+
+ Main toolbar label:
+
+
+
+ -
+
+
+ 2
+
+
-
+
+ None
+
+
+ -
+
+ Text only
+
+
+ -
+
+ Beside icons
+
+
+ -
+
+ Below icons
+
+
+
+
+ -
+
+
+ Secondary toolbar label:
+
+
+
+ -
+
+
+ 2
+
+
-
+
+ None
+
+
+ -
+
+ Text only
+
+
+ -
+
+ Beside icons
+
+
+ -
+
+ Below icons
+
+
+
+
+ -
+
+
+ On buttons
+
+
+ true
+
+
+
+ -
+
+
+ In menus
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/kcms/style/stylepreview.ui b/kcms/style/stylepreview.ui
--- a/kcms/style/stylepreview.ui
+++ b/kcms/style/stylepreview.ui
@@ -2,155 +2,133 @@
StylePreview
-
+
+
+ 0
+ 0
+ 360
+ 172
+
+
+
+
+ 0
+ 0
+
+
+
-
-
+
-
- 1
+
+ 0
0
0
-
+
Tab 1
-
-
-
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ 30
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Push Button
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
-
-
-
-
-
-
- Group Box
-
-
-
-
-
-
- Radio button
-
-
- true
-
-
-
- -
-
-
- Radio button
-
-
-
- -
-
-
- QFrame::HLine
-
-
- QFrame::Sunken
-
-
-
- -
-
-
- Checkbox
-
-
- true
-
-
- false
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
-
+
+ Combo box
+
+
+
+ -
+
-
-
-
-
-
-
- 70
-
-
-
- -
-
-
- 30
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
-
-
- 999999
-
-
-
- -
-
-
- Button
-
-
-
-
-
- -
-
-
-
-
- Combobox
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
-
+
+
+ Checkbox
+
+
+ true
+
+
-
-
-
- 19
+
+
+ Radio button
+
+
+ true
-
- Qt::Vertical
+
+
+ -
+
+
+ Radio button
+ -
+
+
+ 70
+
+
+
-
+
Tab 2