();
foreach (QWidget* widget, widgets)
{
widget->installEventFilter(this);
widget->setFocusPolicy(Qt::NoFocus);
}
}
bool eventFilter( QObject* /* obj */, QEvent* ev ) override
{
switch( ev->type() )
{
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
case QEvent::MouseMove:
case QEvent::KeyPress:
case QEvent::KeyRelease:
case QEvent::Enter:
case QEvent::Leave:
case QEvent::Wheel:
case QEvent::ContextMenu:
return true; // ignore
default:
break;
}
return false;
}
};
+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)
return QStringLiteral("breeze");
#else
return QString(); // native style
#endif
}
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 applications' user interface elements."));
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"));
}
KCMStyle::~KCMStyle()
{
qDeleteAll(styleEntries);
delete appliedStyle;
}
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()
{
QString libname = styleEntries[currentStyle()]->configPage;
KLibrary library(libname);
if (!library.load()) {
KMessageBox::detailedError(this,
i18n("There was an error loading the configuration dialog for this style."),
library.errorString(),
i18n("Unable to Load Dialog"));
return;
}
KLibrary::void_function_ptr allocPtr = library.resolveFunction("allocate_kstyle_config");
if (!allocPtr)
{
KMessageBox::detailedError(this,
i18n("There was an error loading the configuration dialog for this style."),
library.errorString(),
i18n("Unable to Load Dialog"));
return;
}
//Create the container dialog
StyleConfigDialog* dial = new StyleConfigDialog(this, styleEntries[currentStyle()]->name);
typedef QWidget*(* factoryRoutine)( QWidget* parent );
//Get the factory, and make the widget.
factoryRoutine factory = (factoryRoutine)(allocPtr); //Grmbl. So here I am on my
//"never use C casts" moralizing streak, and I find that one can't go void* -> function ptr
//even with a reinterpret_cast.
QWidget* pluginConfig = factory( dial );
//Insert it in...
dial->setMainWidget( pluginConfig );
//..and connect it to the wrapper
connect(pluginConfig, SIGNAL(changed(bool)), dial, SLOT(setDirty(bool)));
connect(dial, SIGNAL(defaults()), pluginConfig, SLOT(defaults()));
connect(dial, SIGNAL(save()), pluginConfig, SLOT(save()));
if (dial->exec() == QDialog::Accepted && dial->isDirty() ) {
// Force re-rendering of the preview, to apply settings
switchStyle(currentStyle(), true);
//For now, ask all KDE apps to recreate their styles to apply the setitngs
KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged);
// We call setStyleDirty here to make sure we force style re-creation
setStyleDirty();
}
delete dial;
}
void KCMStyle::changeEvent( QEvent *event )
{
KCModule::changeEvent( event );
if ( event->type() == QEvent::PaletteChange ) {
// Force re-rendering of the preview, to apply new palette
switchStyle(currentStyle(), true);
}
}
void KCMStyle::load()
{
KConfig config( QStringLiteral("kdeglobals"), KConfig::FullConfig );
loadStyle( config );
loadEffects( config );
m_bStyleDirty= false;
m_bEffectsDirty = false;
//Enable/disable the button for the initial style
updateConfigButton();
emit changed( false );
}
void KCMStyle::save()
{
// Don't do anything if we don't need to.
if ( !(m_bStyleDirty | m_bEffectsDirty ) )
return;
// Save effects.
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();
// Export the changes we made to qtrc, and update all qt-only
// applications on the fly, ensuring that we still follow the user's
// export fonts/colors settings.
if (m_bStyleDirty || m_bEffectsDirty) // Export only if necessary
{
uint flags = KRdbExportQtSettings | KRdbExportGtkTheme;
KConfig _kconfig( QStringLiteral("kcmdisplayrc"), KConfig::NoGlobals );
KConfigGroup kconfig(&_kconfig, "X11");
bool exportKDEColors = kconfig.readEntry("exportKDEColors", true);
if (exportKDEColors)
flags |= KRdbExportColors;
runRdb( flags );
}
// Now allow KDE apps to reconfigure themselves.
if ( m_bStyleDirty )
KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged);
if ( m_bEffectsDirty ) {
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_STYLE);
// ##### FIXME - Doesn't apply all settings correctly due to bugs in
// KApplication/KToolbar
KGlobalSettings::self()->emitChange(KGlobalSettings::ToolbarStyleChanged);
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal(QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"));
QDBusConnection::sessionBus().send(message);
#endif
}
// Clean up
m_bStyleDirty = false;
m_bEffectsDirty = false;
emit changed( false );
}
bool KCMStyle::findStyle( const QString& str, int& combobox_item )
{
StyleEntry* se = styleEntries[str.toLower()];
QString name = se ? se->name : str;
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;
}
}
return false;
}
void KCMStyle::defaults()
{
// Select default style
int item = 0;
bool found;
found = findStyle( defaultStyle(), item );
if (!found)
found = findStyle( QStringLiteral("oxygen"), item );
if (!found)
found = findStyle( QStringLiteral("plastique"), item );
if (!found)
found = findStyle( QStringLiteral("windows"), item );
if (!found)
found = findStyle( QStringLiteral("platinum"), item );
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()
{
m_bEffectsDirty = true;
emit changed(true);
}
void KCMStyle::setStyleDirty()
{
m_bStyleDirty = true;
emit changed(true);
}
// ----------------------------------------------------------------
// All the Style Switching / Preview stuff
// ----------------------------------------------------------------
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);
styleEntries.clear();
QString strWidgetStyle;
QStringList list = KGlobal::dirs()->findAllResources("themes", QStringLiteral("*.themerc"),
KStandardDirs::Recursive |
KStandardDirs::NoDuplicates);
for (QStringList::iterator it = list.begin(); it != list.end(); ++it)
{
KConfig config( *it, KConfig::SimpleConfig);
if ( !(config.hasGroup("KDE") && config.hasGroup("Misc")) )
continue;
KConfigGroup configGroup = config.group("KDE");
strWidgetStyle = configGroup.readEntry("WidgetStyle");
if (strWidgetStyle.isNull())
continue;
// We have a widgetstyle, so lets read the i18n entries for it...
StyleEntry* entry = new StyleEntry;
configGroup = config.group("Misc");
entry->name = configGroup.readEntry("Name");
entry->desc = configGroup.readEntry("Comment", i18n("No description available."));
entry->configPage = configGroup.readEntry("ConfigPage", QString());
// Check if this style should be shown
configGroup = config.group("Desktop Entry");
entry->hidden = configGroup.readEntry("Hidden", false);
// Insert the entry into our dictionary.
styleEntries.insert(strWidgetStyle.toLower(), entry);
}
// Obtain all style names
QStringList allStyles = QStyleFactory::keys();
// Get translated names, remove all hidden style entries.
QStringList styles;
StyleEntry* entry;
for (QStringList::iterator it = allStyles.begin(); it != allStyles.end(); ++it)
{
QString id = (*it).toLower();
// Find the entry.
if ( (entry = styleEntries[id]) != nullptr )
{
// Do not add hidden entries
if (entry->hidden)
continue;
styles += entry->name;
nameToStyleKey[entry->name] = id;
}
else
{
styles += (*it); //Fall back to the key (but in original case)
nameToStyleKey[*it] = id;
}
}
// 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;
else if ( id.contains( cfgStyle ) )
break;
else if ( id.contains( QApplication::style()->metaObject()->className() ) )
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()];
}
void KCMStyle::styleChanged()
{
switchStyle( currentStyle() );
}
void KCMStyle::switchStyle(const QString& styleName, bool force)
{
// Don't flicker the preview if the same style is chosen in the cb
if (!force && appliedStyle && appliedStyle->objectName() == styleName)
return;
// Create an instance of the new style...
QStyle* style = QStyleFactory::create(styleName);
if (!style)
return;
// Prevent Qt from wrongly caching radio button images
QPixmapCache::clear();
setStyleRecursive( stylePreview, style );
// this flickers, but reliably draws the widgets correctly.
stylePreview->resize( stylePreview->sizeHint() );
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)
{
// Don't let broken styles kill the palette
// for other styles being previewed. (e.g SGI style)
w->setPalette(QPalette());
QPalette newPalette(KGlobalSettings::createApplicationPalette());
s->polish( newPalette );
w->setPalette(newPalette);
// Apply the new style.
w->setStyle(s);
// Recursively update all children.
const QObjectList children = w->children();
// Apply the style to each child widget.
foreach (QObject* child, children)
{
if (child->isWidgetType())
setStyleRecursive((QWidget *) child, s);
}
}
// ----------------------------------------------------------------
// All the Effects stuff
// ----------------------------------------------------------------
QString KCMStyle::toolbarButtonText(int index)
{
switch (index) {
case 1:
return QStringLiteral("TextOnly");
case 2:
return QStringLiteral("TextBesideIcon");
case 3:
return QStringLiteral("TextUnderIcon");
default:
break;
}
return QStringLiteral("NoText");
}
int KCMStyle::toolbarButtonIndex(const QString &text)
{
if (text == QLatin1String("TextOnly")) {
return 1;
} else if (text == QLatin1String("TextBesideIcon")) {
return 2;
} else if (text == QLatin1String("TextUnderIcon")) {
return 3;
}
return 0;
}
QString KCMStyle::menuBarStyleText(int index)
{
switch (index) {
case 1:
return QStringLiteral("Decoration");
case 2:
return QStringLiteral("Widget");
}
return QStringLiteral("InApplication");
}
int KCMStyle::menuBarStyleIndex(const QString &text)
{
if (text == QLatin1String("Decoration")) {
return 1;
} else if (text == QLatin1String("Widget")) {
return 2;
}
return 0;
}
void KCMStyle::loadEffects( KConfig& config )
{
// KDE's Part via KConfig
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"
// vim: set noet ts=4:
diff --git a/kcms/style/kcmstyle.h b/kcms/style/kcmstyle.h
index e1dfb5822..c0e668eae 100644
--- a/kcms/style/kcmstyle.h
+++ b/kcms/style/kcmstyle.h
@@ -1,122 +1,105 @@
/*
* KCMStyle
* Copyright (C) 2002 Karol Szwed
* Copyright (C) 2002 Daniel Molkentin
* Copyright (C) 2007 Urs Wolfer
*
* Portions Copyright (C) TrollTech AS.
*
* Based on kcmdisplay
* Copyright (C) 1997-2002 kcmdisplay Authors.
* (see Help -> About Style Settings)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KCMSTYLE_H
#define KCMSTYLE_H
#include
#include
#include
#include
#include
-#include "ui_finetuning.h"
-
-class KComboBox;
class KConfig;
-class QCheckBox;
-class QComboBox;
-class QLabel;
-class QPushButton;
class StylePreview;
-class QTabWidget;
+class StyleConfig;
struct StyleEntry {
QString name;
QString desc;
QString configPage;
bool hidden;
};
class KCMStyle : public KCModule
{
Q_OBJECT
public:
KCMStyle( QWidget* parent, const QVariantList& );
~KCMStyle() override;
void load() override;
void save() override;
void defaults() override;
static QString defaultStyle();
protected:
bool findStyle( const QString& str, int& combobox_item );
void switchStyle(const QString& styleName, bool force = false);
void setStyleRecursive(QWidget* w, QStyle* s);
void loadStyle( KConfig& config );
void loadEffects( KConfig& config );
void addWhatsThis();
void changeEvent( QEvent *event ) override;
protected Q_SLOTS:
void styleSpecificConfig();
void updateConfigButton();
void setStyleDirty();
void setEffectsDirty();
void styleChanged();
private:
QString currentStyle();
static QString toolbarButtonText(int index);
static int toolbarButtonIndex(const QString &text);
static QString menuBarStyleText(int index);
static int menuBarStyleIndex(const QString &text);
bool m_bStyleDirty, m_bEffectsDirty;
QHash styleEntries;
QMap nameToStyleKey;
QVBoxLayout* mainLayout;
- QTabWidget* tabWidget;
- QWidget *page0, *page1, *page2;
- QVBoxLayout* page1Layout;
-
- // Page1 widgets
- QVBoxLayout* gbWidgetStyleLayout;
- QHBoxLayout* hbLayout;
- KComboBox* cbStyle;
- QPushButton* pbConfigStyle;
- QLabel* lblStyleDesc;
+
+ // Widgets
StylePreview* stylePreview;
+ StyleConfig* styleConfig;
QStyle* appliedStyle;
QPalette palette;
-
- // Page2 widgets
- Ui::FineTuning fineTuningUi;
};
#endif // __KCMSTYLE_H
// vim: set noet ts=4:
diff --git a/kcms/style/style.desktop b/kcms/style/style.desktop
index 20bae856b..e97817de2 100644
--- a/kcms/style/style.desktop
+++ b/kcms/style/style.desktop
@@ -1,116 +1,116 @@
[Desktop Entry]
Exec=kcmshell5 style
Icon=preferences-desktop-theme-style
Type=Service
X-KDE-ServiceTypes=KCModule,KCModuleInit
X-DocPath=kcontrol/kcmstyle/index.html
X-KDE-Library=kcm_style
X-KDE-Init-Symbol=kcminit_style
X-KDE-Init-Phase=0
X-KDE-ParentApp=kcontrol
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
Name[ca@valencia]=Estil dels estris
Name[cs]=Styl widgetu
Name[da]=Kontrolstil
Name[de]=Stil der Bedienelemente
Name[el]=Στιλ γραφικών συστατικών
Name[en_GB]=Widget Style
Name[es]=Estilo de los elementos gráficos
Name[et]=Vidina stiil
Name[eu]=Trepeten estiloa
Name[fi]=Elementtien tyyli
Name[fr]=Style de composant graphique
Name[gl]=Estilo do trebello
Name[he]=עיצוב הישומון
Name[hu]=Grafikai elemstílus
Name[id]=Gaya Widget
Name[is]=Græjustíll
Name[it]=Stile degli oggetti
Name[ja]=ウィジェットスタイル
Name[ko]=위젯 스타일
Name[lt]=Valdiklių stilius
Name[nb]=Skjermelementstil
Name[nds]=Bedeenelement-Stil
Name[nl]=Widget-stijl
Name[nn]=Elementstil
Name[pa]=ਵਿਜੈਟ ਸਟਾਈਲ
Name[pl]=Wygląd interfejsu
Name[pt]=Estilo Gráfico
Name[pt_BR]=Estilo dos widgets
Name[ru]=Стиль интерфейса
Name[sk]=Štýl prvku
Name[sl]=Slog gradnikov
Name[sr]=Стил виџета̂
Name[sr@ijekavian]=Стил виџета̂
Name[sr@ijekavianlatin]=Stil vidžetâ̂
Name[sr@latin]=Stil vidžetâ̂
Name[sv]=Stil för grafiska komponenter
Name[tr]=Gereç Biçemi
Name[uk]=Стиль віджетів
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
Comment[gl]=Configurar o estilo e comportamento dos trebellos
Comment[id]=Konfigurasikan perilaku dan gaya widget
Comment[it]=Configura stile e comportamento degli oggetti
Comment[nl]=Widget-stijl en gedrag configureren
Comment[nn]=Set opp utsjånad og åtferd for skjermelement
Comment[pl]=Ustawienia wyglądu i zachowania elementów interfejsu
Comment[pt]=Configurar o estilo e comportamento dos elementos gráficos
Comment[pt_BR]=Configurar o estilo e comportamento dos widgets
Comment[sk]=Nastavte štýl a správanie widgetov
Comment[sv]=Anpassa stil och beteende för grafiska komponenter
Comment[uk]=Налаштовування стилю і поведінки віджетів
Comment[x-test]=xxConfigure widget style and behaviorxx
Comment[zh_CN]=配置部件样式和行为
Comment[zh_TW]=設定元件樣式與行為
X-KDE-Keywords=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu
X-KDE-Keywords[ca]=estil,estils,aspecte,estri,icones,barres d'eines,text,ressaltat,aplicacions,aplicacions del KDE,tema,plasma,menu,menu global
X-KDE-Keywords[ca@valencia]=estil,estils,aspecte,estri,icones,barres d'eines,text,ressaltat,aplicacions,aplicacions del KDE,tema,plasma,menu,menu global
X-KDE-Keywords[da]=stil,style,udseende,kontrol,widget,ikoner,værktøjslinjer,tekst,fremhævning,programmer,KDE-programmer,tema,plasma,menu,global menu
X-KDE-Keywords[de]=Stile,Design,Themes,Schema,Elemente,Bildschirmelemente,Icons,Bedienelemente,Schriften,Symbole,Werkzeugleisten,Text,Hervorhebungen,Knöpfe,Anwendungen,Programme,KDE-Programme,Menü,Globales Menü
X-KDE-Keywords[el]=στιλ,στιλ,εμφάνιση,γραφικό συστατικό,εικονίδια,γραμμές εργαλείων,κείμενο,τονισμός,εφαρμογές,εφαρμογές KDE,θέμα,plasma,μενού,καθολικό μενού
X-KDE-Keywords[en_GB]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu
X-KDE-Keywords[es]=estilo,estilos,apariencia,controles,iconos,barras de herramientas,texto,resaltado,aplicaciones,aplicaciones de KDE,tema,plasma,menú,menú global
X-KDE-Keywords[eu]=estilo,estiloak,itxura,trepeta,ikonoak,tresna-barrak,testua,nabarmentzea,aplikazioak,KDE aplikazioak,gaia,plasma,menu,menu orokorra
X-KDE-Keywords[fi]=tyyli,tyylit,ulkoasu,käyttöliittymäelementti,elementti,kuvakkeet,työkalurivit,työkalupalkit, teksti,korostus,sovellukset,KDE-sovellukset,teema,plasma,työpöydänlaajuinen valikko
X-KDE-Keywords[fr]=style, styles, apparence, composant graphique, icônes, barres d'outil, texte, mise en valeur, applications, applications KDE, thème, plasma, menu, menu global
X-KDE-Keywords[gl]=estilo, estilos, aparencia, trebello, iconas, barras de ferramentas, texto, realzar, aplicativos, aplicacións, programas, software, tema, plasma,menu,menú,global menu,menú global
X-KDE-Keywords[hu]=stílus,stílusok,kinézet,widget,ikonok,eszköztárak,szöveg,kiemelés,alkalmazások,KDe alkalmazások,téma,plazma,menü,globális menü
X-KDE-Keywords[id]=gaya,gaya,look,widget,ikon,bilah alat,teks,sorot,apl,aplikasi KDE,tema,plasma,menu,menu global
X-KDE-Keywords[it]=stile,stili,aspetto,oggetto,icone,barre degli strumenti,testo,evidenziazione,applicazioni,applicazioni KDE,tema,plasma,menu,menu globale
X-KDE-Keywords[ko]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu,스타일,모양,위젯,아이콘,툴바,도구 모음,강조,프로그램,앱,KDE 프로그램,테마,전역 메뉴,메뉴
X-KDE-Keywords[nl]=stijl,stijlen,uiterlijk,widget,pictogrammen,werkbalk,tekst,accentuering,apps,KDE-toepassingen,thema,plasma, menu,globaal menu
X-KDE-Keywords[nn]=stil,stilar,utsjånad,skjermelement,ikon,verktøylinjer,tekst,framheva,program,KDE-program,tema,plasma,meny,global meny
X-KDE-Keywords[pa]=ਸਟਾਈਲ,ਸ਼ੈਲੀ,ਦਿੱਖ,ਵਿਜੈੱਟ,ਆਈਕਾਨ,ਟੂਲਬਾਰ,ਟੈਕਸਟ,ਪਾਠ,ਸ਼ਬਦ,ਉਭਾਰਨਾ,ਐਪਸ,ਕੇਡੀਈ ਐਪਲੀਕੇਸ਼ਨਾਂ,ਥੀਮ,ਪਲਾਜ਼ਮਾ,ਮੇਨੂ,ਗਲੋਬਲ ਮੇਨੂ
X-KDE-Keywords[pl]=style,styl,wygląd,element interfejsu,ikony,paski narzędzi,tekst,podświetlenie,programy,programy KDE,motyw,plazma,menu,globalne menu
X-KDE-Keywords[pt]=estilo,estilos,aparência,elemento,item,ícones,barras de ferramentas,texto,realce,aplicações,aplicações do KDE,tema,plasma,menu global
X-KDE-Keywords[pt_BR]=estilo,estilos,aparência,widget,ícones,barras de ferramentas,texto,realce,aplicativos,aplicativos do KDE,tema,plasma, menu, menu global
X-KDE-Keywords[ru]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,стиль,стили,внешний вид,виджет,значки,панель инструментов,текст,подсветка,приложения,приложения KDE,тема,плазма,меню,глобальное меню
X-KDE-Keywords[sk]=štýl,štýly,vzhľad,widget,ikony,panely nástrojov,text,zvýraznenie,aplikácie,KDE aplikácie,téma,plasma,ponuka,globálna ponuka
X-KDE-Keywords[sl]=slog,slogi,videz,gradnik,ikone,orodjarne,orodne vrstice,besedilo,poudarek,programi,tema,plasma,meni,splošni meni
X-KDE-Keywords[sr]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu,стил,стилови,изглед,виџет,иконице,траке алатки,текст,истицање,програми,КДЕ програми,тема,Плазма,мени,глобални мени
X-KDE-Keywords[sr@ijekavian]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu,стил,стилови,изглед,виџет,иконице,траке алатки,текст,истицање,програми,КДЕ програми,тема,Плазма,мени,глобални мени
X-KDE-Keywords[sr@ijekavianlatin]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu,stil,stilovi,izgled,vidžet,ikonice,trake alatki,tekst,isticanje,programi,KDE programi,tema,Plasma,meni,globalni meni
X-KDE-Keywords[sr@latin]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu,stil,stilovi,izgled,vidžet,ikonice,trake alatki,tekst,isticanje,programi,KDE programi,tema,Plasma,meni,globalni meni
X-KDE-Keywords[sv]=stil,stilar,utseende,grafisk komponent,ikoner,verktygsrader,text,markering,program,KDE-program,tema,plasma,meny,global meny
X-KDE-Keywords[tr]=biçim,biçimler,görünüm,parçacık,simgeler,araç çubukları,metin,vurgulama,uygulamalar,KDE uygulamaları,tema,plasmamenüsü,genel menü
X-KDE-Keywords[uk]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu,стиль,стилі,вигляд,віджет,піктограма,піктограми,значок,значки,іконки,панель,панель інструментів,текст,підсвічування,позначення,програма,програми,тема,плазма,меню,загальне меню
X-KDE-Keywords[x-test]=xxstylexx,xxstylesxx,xxlookxx,xxwidgetxx,xxiconsxx,xxtoolbarsxx,xxtextxx,xxhighlightxx,xxappsxx,xxKDE applicationsxx,xxthemexx,xxplasmaxx,xxmenuxx,xxglobal menuxx
X-KDE-Keywords[zh_CN]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,风格,外观,部件,图标,工具栏,文本,突出显示,程序,KDE 应用程序,主题
X-KDE-Keywords[zh_TW]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,theme,plasma,menu,global menu
Categories=Qt;KDE;X-KDE-settings-looknfeel;
diff --git a/kcms/style/styleconfig.ui b/kcms/style/styleconfig.ui
new file mode 100644
index 000000000..74ea8d690
--- /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
index f3dff8aaf..a443053bb 100644
--- a/kcms/style/stylepreview.ui
+++ b/kcms/style/stylepreview.ui
@@ -1,164 +1,142 @@
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