diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /kcontrol/style | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/style')
-rw-r--r-- | kcontrol/style/Makefile.am | 18 | ||||
-rw-r--r-- | kcontrol/style/kcmstyle.cpp | 1070 | ||||
-rw-r--r-- | kcontrol/style/kcmstyle.h | 163 | ||||
-rw-r--r-- | kcontrol/style/keramik/Makefile.am | 12 | ||||
-rw-r--r-- | kcontrol/style/keramik/keramikconf.cpp | 103 | ||||
-rw-r--r-- | kcontrol/style/keramik/keramikconf.h | 62 | ||||
-rw-r--r-- | kcontrol/style/main.cpp | 16 | ||||
-rw-r--r-- | kcontrol/style/menupreview.cpp | 166 | ||||
-rw-r--r-- | kcontrol/style/menupreview.h | 61 | ||||
-rw-r--r-- | kcontrol/style/style.desktop | 234 | ||||
-rw-r--r-- | kcontrol/style/styleconfdialog.cpp | 46 | ||||
-rw-r--r-- | kcontrol/style/styleconfdialog.h | 46 | ||||
-rw-r--r-- | kcontrol/style/stylepreview.ui | 285 | ||||
-rw-r--r-- | kcontrol/style/stylepreview.ui.h | 69 |
14 files changed, 2351 insertions, 0 deletions
diff --git a/kcontrol/style/Makefile.am b/kcontrol/style/Makefile.am new file mode 100644 index 000000000..27f38de72 --- /dev/null +++ b/kcontrol/style/Makefile.am @@ -0,0 +1,18 @@ + +AM_CPPFLAGS = $(all_includes) +SUBDIRS = keramik . + +kde_module_LTLIBRARIES = kcm_style.la + +kcm_style_la_SOURCES = kcmstyle.cpp stylepreview.ui menupreview.cpp styleconfdialog.cpp +kcm_style_la_LDFLAGS = $(KDE_RPATH) -module -avoid-version $(all_libraries) -no-undefined +kcm_style_la_LIBADD = $(LIB_KIO) ../krdb/libkrdb.la +METASOURCES = AUTO + +noinst_HEADERS = kcmstyle.h stylepreview.h menupreview.h + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmstyle.pot + +xdg_apps_DATA = style.desktop + diff --git a/kcontrol/style/kcmstyle.cpp b/kcontrol/style/kcmstyle.cpp new file mode 100644 index 000000000..9333c0f72 --- /dev/null +++ b/kcontrol/style/kcmstyle.cpp @@ -0,0 +1,1070 @@ +/* + * KCMStyle + * Copyright (C) 2002 Karol Szwed <[email protected]> + * Copyright (C) 2002 Daniel Molkentin <[email protected]> + * + * Portions Copyright (C) 2000 TrollTech AS. + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <qcheckbox.h> +#include <kcombobox.h> +#include <qlistbox.h> +#include <qgroupbox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qslider.h> +#include <qstylefactory.h> +#include <qtabwidget.h> +#include <qvbox.h> +#include <qfile.h> +#include <qsettings.h> +#include <qobjectlist.h> +#include <qpixmapcache.h> +#include <qwhatsthis.h> +#include <qpushbutton.h> + +#include <dcopclient.h> +#include <kapplication.h> +#include <kglobalsettings.h> +#include <kdebug.h> +#include <kipc.h> +#include <kaboutdata.h> +#include <kdialog.h> +#include <klibloader.h> +#include <klistview.h> +#include <kmessagebox.h> +#include <ksimpleconfig.h> +#include <kstyle.h> +#include <kstandarddirs.h> + +#include "../krdb/krdb.h" + +#include "kcmstyle.h" +#include "styleconfdialog.h" + +#include <X11/Xlib.h> +// X11 namespace cleanup +#undef Below +#undef KeyPress +#undef KeyRelease + + +/**** DLL Interface for kcontrol ****/ + +// Plugin Interface +// Danimo: Why do we use the old interface?! +extern "C" +{ + KDE_EXPORT KCModule *create_style(QWidget *parent, const char*) + { + KGlobal::locale()->insertCatalogue("kcmstyle"); + return new KCMStyle(parent, "kcmstyle"); + } + + KDE_EXPORT void init_style() + { + uint flags = KRdbExportQtSettings | KRdbExportQtColors | KRdbExportXftSettings; + KConfig config("kcmdisplayrc", true /*readonly*/, false /*don't read kdeglobals etc.*/); + config.setGroup("X11"); + + // This key is written by the "colors" module. + bool exportKDEColors = config.readBoolEntry("exportKDEColors", true); + if (exportKDEColors) + flags |= KRdbExportColors; + runRdb( flags ); + + // Write some Qt root property. +#ifndef __osf__ // this crashes under Tru64 randomly -- will fix later + QByteArray properties; + QDataStream d(properties, IO_WriteOnly); + d.setVersion( 3 ); // Qt2 apps need this. + d << kapp->palette() << KGlobalSettings::generalFont(); + Atom a = XInternAtom(qt_xdisplay(), "_QT_DESKTOP_PROPERTIES", false); + + // do it for all root windows - multihead support + int screen_count = ScreenCount(qt_xdisplay()); + for (int i = 0; i < screen_count; i++) + XChangeProperty(qt_xdisplay(), RootWindow(qt_xdisplay(), i), + a, a, 8, PropModeReplace, + (unsigned char*) properties.data(), properties.size()); +#endif + } +} + +/* +typedef KGenericFactory<KWidgetSettingsModule, QWidget> GeneralFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_kcmstyle, GeneralFactory ) +*/ + + +KCMStyle::KCMStyle( QWidget* parent, const char* name ) + : KCModule( parent, name ), appliedStyle(NULL) +{ + setQuickHelp( i18n("<h1>Style</h1>" + "This module allows you to modify the visual appearance " + "of user interface elements, such as the widget style " + "and effects.")); + + m_bEffectsDirty = false; + m_bStyleDirty= false; + m_bToolbarsDirty = false; + + KGlobal::dirs()->addResourceType("themes", + KStandardDirs::kde_default("data") + "kstyle/themes"); + + KAboutData *about = + new KAboutData( I18N_NOOP("kcmstyle"), + I18N_NOOP("KDE Style Module"), + 0, 0, KAboutData::License_GPL, + I18N_NOOP("(c) 2002 Karol Szwed, Daniel Molkentin")); + + about->addAuthor("Karol Szwed", 0, "[email protected]"); + about->addAuthor("Daniel Molkentin", 0, "[email protected]"); + about->addAuthor("Ralf Nolden", 0, "[email protected]"); + setAboutData( about ); + + // Setup pages and mainLayout + mainLayout = new QVBoxLayout( this ); + tabWidget = new QTabWidget( this ); + mainLayout->addWidget( tabWidget ); + + page1 = new QWidget( tabWidget ); + page1Layout = new QVBoxLayout( page1, KDialog::marginHint(), KDialog::spacingHint() ); + page2 = new QWidget( tabWidget ); + page2Layout = new QVBoxLayout( page2, KDialog::marginHint(), KDialog::spacingHint() ); + page3 = new QWidget( tabWidget ); + page3Layout = new QVBoxLayout( page3, KDialog::marginHint(), KDialog::spacingHint() ); + + // Add Page1 (Style) + // ----------------- + gbWidgetStyle = new QGroupBox( i18n("Widget Style"), page1, "gbWidgetStyle" ); + gbWidgetStyle->setColumnLayout( 0, Qt::Vertical ); + gbWidgetStyle->layout()->setMargin( KDialog::marginHint() ); + gbWidgetStyle->layout()->setSpacing( KDialog::spacingHint() ); + + gbWidgetStyleLayout = new QVBoxLayout( gbWidgetStyle->layout() ); + gbWidgetStyleLayout->setAlignment( Qt::AlignTop ); + hbLayout = new QHBoxLayout( KDialog::spacingHint(), "hbLayout" ); + + cbStyle = new KComboBox( gbWidgetStyle, "cbStyle" ); + cbStyle->setEditable( FALSE ); + hbLayout->addWidget( cbStyle ); + + pbConfigStyle = new QPushButton( i18n("Con&figure..."), gbWidgetStyle ); + pbConfigStyle->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum ); + pbConfigStyle->setEnabled( FALSE ); + hbLayout->addWidget( pbConfigStyle ); + + gbWidgetStyleLayout->addLayout( hbLayout ); + + lblStyleDesc = new QLabel( gbWidgetStyle ); + lblStyleDesc->setTextFormat(Qt::RichText); + gbWidgetStyleLayout->addWidget( lblStyleDesc ); + + cbIconsOnButtons = new QCheckBox( i18n("Sho&w icons on buttons"), gbWidgetStyle ); + gbWidgetStyleLayout->addWidget( cbIconsOnButtons ); + cbEnableTooltips = new QCheckBox( i18n("E&nable tooltips"), gbWidgetStyle ); + gbWidgetStyleLayout->addWidget( cbEnableTooltips ); + cbTearOffHandles = new QCheckBox( i18n("Show tear-off handles in &popup menus"), gbWidgetStyle ); + gbWidgetStyleLayout->addWidget( cbTearOffHandles ); + cbTearOffHandles->hide(); // reenable when the corresponding Qt method is virtual and properly reimplemented + + QGroupBox *gbPreview = new QGroupBox( i18n( "Preview" ), page1 ); + gbPreview->setColumnLayout( 0, Vertical ); + gbPreview->layout()->setMargin( 0 ); + gbPreview->layout()->setSpacing( KDialog::spacingHint() ); + gbPreview->setFlat( true ); + stylePreview = new StylePreview( gbPreview ); + gbPreview->layout()->add( stylePreview ); + + page1Layout->addWidget( gbWidgetStyle ); + page1Layout->addWidget( gbPreview ); + + // Connect all required stuff + connect( cbStyle, SIGNAL(activated(int)), this, SLOT(styleChanged()) ); + connect( cbStyle, SIGNAL(activated(int)), this, SLOT(updateConfigButton())); + connect( pbConfigStyle, SIGNAL(clicked()), this, SLOT(styleSpecificConfig())); + + // Add Page2 (Effects) + // ------------------- + cbEnableEffects = new QCheckBox( i18n("&Enable GUI effects"), page2 ); + containerFrame = new QFrame( page2 ); + containerFrame->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); + containerFrame->setMargin(0); + containerLayout = new QGridLayout( containerFrame, 1, 1, // rows, columns + KDialog::marginHint(), KDialog::spacingHint() ); + + comboComboEffect = new QComboBox( FALSE, containerFrame ); + comboComboEffect->insertItem( i18n("Disable") ); + comboComboEffect->insertItem( i18n("Animate") ); + lblComboEffect = new QLabel( i18n("Combobo&x effect:"), containerFrame ); + lblComboEffect->setBuddy( comboComboEffect ); + containerLayout->addWidget( lblComboEffect, 0, 0 ); + containerLayout->addWidget( comboComboEffect, 0, 1 ); + + comboTooltipEffect = new QComboBox( FALSE, containerFrame ); + comboTooltipEffect->insertItem( i18n("Disable") ); + comboTooltipEffect->insertItem( i18n("Animate") ); + comboTooltipEffect->insertItem( i18n("Fade") ); + lblTooltipEffect = new QLabel( i18n("&Tool tip effect:"), containerFrame ); + lblTooltipEffect->setBuddy( comboTooltipEffect ); + containerLayout->addWidget( lblTooltipEffect, 1, 0 ); + containerLayout->addWidget( comboTooltipEffect, 1, 1 ); + + comboMenuEffect = new QComboBox( FALSE, containerFrame ); + comboMenuEffect->insertItem( i18n("Disable") ); + comboMenuEffect->insertItem( i18n("Animate") ); + comboMenuEffect->insertItem( i18n("Fade") ); + comboMenuEffect->insertItem( i18n("Make Translucent") ); + lblMenuEffect = new QLabel( i18n("&Menu effect:"), containerFrame ); + lblMenuEffect->setBuddy( comboMenuEffect ); + containerLayout->addWidget( lblMenuEffect, 2, 0 ); + containerLayout->addWidget( comboMenuEffect, 2, 1 ); + + comboMenuHandle = new QComboBox( FALSE, containerFrame ); + comboMenuHandle->insertItem( i18n("Disable") ); + comboMenuHandle->insertItem( i18n("Application Level") ); +// comboMenuHandle->insertItem( i18n("Enable") ); + lblMenuHandle = new QLabel( i18n("Me&nu tear-off handles:"), containerFrame ); + lblMenuHandle->setBuddy( comboMenuHandle ); + containerLayout->addWidget( lblMenuHandle, 3, 0 ); + containerLayout->addWidget( comboMenuHandle, 3, 1 ); + + cbMenuShadow = new QCheckBox( i18n("Menu &drop shadow"), containerFrame ); + containerLayout->addWidget( cbMenuShadow, 4, 0 ); + + // Push the [label combo] to the left. + comboSpacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + containerLayout->addItem( comboSpacer, 1, 2 ); + + // Separator. + QFrame* hline = new QFrame ( page2 ); + hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + // Now implement the Menu Transparency container. + menuContainer = new QFrame( page2 ); + menuContainer->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); + menuContainer->setMargin(0); + menuContainerLayout = new QGridLayout( menuContainer, 1, 1, // rows, columns + KDialog::marginHint(), KDialog::spacingHint() ); + + menuPreview = new MenuPreview( menuContainer, /* opacity */ 90, MenuPreview::Blend ); + + comboMenuEffectType = new QComboBox( FALSE, menuContainer ); + comboMenuEffectType->insertItem( i18n("Software Tint") ); + comboMenuEffectType->insertItem( i18n("Software Blend") ); +#ifdef HAVE_XRENDER + comboMenuEffectType->insertItem( i18n("XRender Blend") ); +#endif + + // So much stuffing around for a simple slider.. + sliderBox = new QVBox( menuContainer ); + sliderBox->setSpacing( KDialog::spacingHint() ); + sliderBox->setMargin( 0 ); + slOpacity = new QSlider( 0, 100, 5, /*opacity*/ 90, Qt::Horizontal, sliderBox ); + slOpacity->setTickmarks( QSlider::Below ); + slOpacity->setTickInterval( 10 ); + QHBox* box1 = new QHBox( sliderBox ); + box1->setSpacing( KDialog::spacingHint() ); + box1->setMargin( 0 ); + QLabel* lbl = new QLabel( i18n("0%"), box1 ); + lbl->setAlignment( AlignLeft ); + lbl = new QLabel( i18n("50%"), box1 ); + lbl->setAlignment( AlignHCenter ); + lbl = new QLabel( i18n("100%"), box1 ); + lbl->setAlignment( AlignRight ); + + lblMenuEffectType = new QLabel( comboMenuEffectType, i18n("Menu trans&lucency type:"), menuContainer ); + lblMenuEffectType->setAlignment( AlignBottom | AlignLeft ); + lblMenuOpacity = new QLabel( slOpacity, i18n("Menu &opacity:"), menuContainer ); + lblMenuOpacity->setAlignment( AlignBottom | AlignLeft ); + + menuContainerLayout->addWidget( lblMenuEffectType, 0, 0 ); + menuContainerLayout->addWidget( comboMenuEffectType, 1, 0 ); + menuContainerLayout->addWidget( lblMenuOpacity, 2, 0 ); + menuContainerLayout->addWidget( sliderBox, 3, 0 ); + menuContainerLayout->addMultiCellWidget( menuPreview, 0, 3, 1, 1 ); + + // Layout page2. + page2Layout->addWidget( cbEnableEffects ); + page2Layout->addWidget( containerFrame ); + page2Layout->addWidget( hline ); + page2Layout->addWidget( menuContainer ); + + QSpacerItem* sp1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + page2Layout->addItem( sp1 ); + + // Data flow stuff. + connect( cbEnableEffects, SIGNAL(toggled(bool)), containerFrame, SLOT(setEnabled(bool)) ); + connect( cbEnableEffects, SIGNAL(toggled(bool)), this, SLOT(menuEffectChanged(bool)) ); + connect( slOpacity, SIGNAL(valueChanged(int)),menuPreview, SLOT(setOpacity(int)) ); + connect( comboMenuEffect, SIGNAL(activated(int)), this, SLOT(menuEffectChanged()) ); + connect( comboMenuEffect, SIGNAL(highlighted(int)), this, SLOT(menuEffectChanged()) ); + connect( comboMenuEffectType, SIGNAL(activated(int)), this, SLOT(menuEffectTypeChanged()) ); + connect( comboMenuEffectType, SIGNAL(highlighted(int)), this, SLOT(menuEffectTypeChanged()) ); + + // Add Page3 (Miscellaneous) + // ------------------------- + cbHoverButtons = new QCheckBox( i18n("High&light buttons under mouse"), page3 ); + cbTransparentToolbars = new QCheckBox( i18n("Transparent tool&bars when moving"), page3 ); + + QWidget * dummy = new QWidget( page3 ); + + QHBoxLayout* box2 = new QHBoxLayout( dummy, 0, KDialog::spacingHint() ); + lbl = new QLabel( i18n("Text pos&ition:"), dummy ); + comboToolbarIcons = new QComboBox( FALSE, dummy ); + comboToolbarIcons->insertItem( i18n("Icons Only") ); + comboToolbarIcons->insertItem( i18n("Text Only") ); + comboToolbarIcons->insertItem( i18n("Text Alongside Icons") ); + comboToolbarIcons->insertItem( i18n("Text Under Icons") ); + lbl->setBuddy( comboToolbarIcons ); + + box2->addWidget( lbl ); + box2->addWidget( comboToolbarIcons ); + QSpacerItem* sp2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + box2->addItem( sp2 ); + + page3Layout->addWidget( cbHoverButtons ); + page3Layout->addWidget( cbTransparentToolbars ); + page3Layout->addWidget( dummy ); + + // Layout page3. + QSpacerItem* sp3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + page3Layout->addItem( sp3 ); + + // Load settings + load(); + + // Do all the setDirty connections. + connect(cbStyle, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); + // Page2 + connect( cbEnableEffects, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); + connect( cbEnableEffects, SIGNAL(toggled(bool)), this, SLOT(setStyleDirty())); + connect( comboTooltipEffect, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); + connect( comboComboEffect, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); + connect( comboMenuEffect, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); + connect( comboMenuHandle, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); + connect( comboMenuEffectType, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); + connect( slOpacity, SIGNAL(valueChanged(int)),this, SLOT(setStyleDirty())); + connect( cbMenuShadow, SIGNAL(toggled(bool)), this, SLOT(setStyleDirty())); + // Page3 + connect( cbHoverButtons, SIGNAL(toggled(bool)), this, SLOT(setToolbarsDirty())); + connect( cbTransparentToolbars, SIGNAL(toggled(bool)), this, SLOT(setToolbarsDirty())); + connect( cbEnableTooltips, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); + connect( cbIconsOnButtons, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); + connect( cbTearOffHandles, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); + connect( comboToolbarIcons, SIGNAL(activated(int)), this, SLOT(setToolbarsDirty())); + + addWhatsThis(); + + // Insert the pages into the tabWidget + tabWidget->insertTab( page1, i18n("&Style")); + tabWidget->insertTab( page2, i18n("&Effects")); + tabWidget->insertTab( page3, i18n("&Toolbar")); + + //Enable/disable the button for the initial style + updateConfigButton(); +} + + +KCMStyle::~KCMStyle() +{ + delete appliedStyle; +} + +void KCMStyle::updateConfigButton() +{ + if (!styleEntries[currentStyle()] || styleEntries[currentStyle()]->configPage.isEmpty()) { + 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 ); +} + +void KCMStyle::styleSpecificConfig() +{ + QString libname = styleEntries[currentStyle()]->configPage; + + // Use KLibLoader to get the library, handling + // any errors that arise + KLibLoader* loader = KLibLoader::self(); + + KLibrary* library = loader->library( QFile::encodeName(libname) ); + if (!library) + { + KMessageBox::detailedError(this, + i18n("There was an error loading the configuration dialog for this style."), + loader->lastErrorMessage(), + i18n("Unable to Load Dialog")); + return; + } + + void* allocPtr = library->symbol("allocate_kstyle_config"); + + if (!allocPtr) + { + KMessageBox::detailedError(this, + i18n("There was an error loading the configuration dialog for this style."), + loader->lastErrorMessage(), + i18n("Unable to Load Dialog")); + return; + } + + //Create the container dialog + StyleConfigDialog* dial = new StyleConfigDialog(this, styleEntries[currentStyle()]->name); + dial->enableButtonSeparator(true); + + 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 + KIPC::sendMessageAll(KIPC::StyleChanged); + + // We call setStyleDirty here to make sure we force style re-creation + setStyleDirty(); + } + + delete dial; +} + +void KCMStyle::load() +{ + load( false ); +} + +void KCMStyle::load(bool useDefaults) +{ + KConfig config( "kdeglobals", true, false ); + + config.setReadDefaults( useDefaults ); + + // Page1 - Build up the Style ListBox + loadStyle( config ); + + // Page2 - Effects + loadEffects( config ); + + // Page3 - Misc. + loadMisc( config ); + + m_bEffectsDirty = false; + m_bStyleDirty= false; + m_bToolbarsDirty = false; + + emit changed( useDefaults ); +} + + +void KCMStyle::save() +{ + // Don't do anything if we don't need to. + if ( !(m_bToolbarsDirty | m_bEffectsDirty | m_bStyleDirty ) ) + return; + + bool allowMenuTransparency = false; + bool allowMenuDropShadow = false; + + // Read the KStyle flags to see if the style writer + // has enabled menu translucency in the style. + if (appliedStyle && appliedStyle->inherits("KStyle")) + { + allowMenuDropShadow = true; + KStyle* style = dynamic_cast<KStyle*>(appliedStyle); + if (style) { + KStyle::KStyleFlags flags = style->styleFlags(); + if (flags & KStyle::AllowMenuTransparency) + allowMenuTransparency = true; + } + } + + QString warn_string( i18n("<qt>Selected style: <b>%1</b><br><br>" + "One or more effects that you have chosen could not be applied because the selected " + "style does not support them; they have therefore been disabled.<br>" + "<br>" ).arg( cbStyle->currentText()) ); + bool show_warning = false; + + // Warn the user if they're applying a style that doesn't support + // menu translucency and they enabled it. + if ( (!allowMenuTransparency) && + (cbEnableEffects->isChecked()) && + (comboMenuEffect->currentItem() == 3) ) // Make Translucent + { + warn_string += i18n("Menu translucency is not available.<br>"); + comboMenuEffect->setCurrentItem(0); // Disable menu effect. + show_warning = true; + } + + if (!allowMenuDropShadow && cbMenuShadow->isChecked()) + { + warn_string += i18n("Menu drop-shadows are not available."); + cbMenuShadow->setChecked(false); + show_warning = true; + } + + // Tell the user what features we could not apply on their behalf. + if (show_warning) + KMessageBox::information(this, warn_string); + + + // Save effects. + KConfig config( "kdeglobals" ); + config.setGroup("KDE"); + + config.writeEntry( "EffectsEnabled", cbEnableEffects->isChecked()); + int item = comboComboEffect->currentItem(); + config.writeEntry( "EffectAnimateCombo", item == 1 ); + item = comboTooltipEffect->currentItem(); + config.writeEntry( "EffectAnimateTooltip", item == 1); + config.writeEntry( "EffectFadeTooltip", item == 2 ); + item = comboMenuHandle->currentItem(); + config.writeEntry( "InsertTearOffHandle", item ); + item = comboMenuEffect->currentItem(); + config.writeEntry( "EffectAnimateMenu", item == 1 ); + config.writeEntry( "EffectFadeMenu", item == 2 ); + + // Handle KStyle's menu effects + QString engine("Disabled"); + if (item == 3 && cbEnableEffects->isChecked()) // Make Translucent + switch( comboMenuEffectType->currentItem()) + { + case 1: engine = "SoftwareBlend"; break; + case 2: engine = "XRender"; break; + default: + case 0: engine = "SoftwareTint"; break; + } + + { // Braces force a QSettings::sync() + QSettings settings; // Only for KStyle stuff + settings.writeEntry("/KStyle/Settings/MenuTransparencyEngine", engine); + settings.writeEntry("/KStyle/Settings/MenuOpacity", slOpacity->value()/100.0); + settings.writeEntry("/KStyle/Settings/MenuDropShadow", + cbEnableEffects->isChecked() && cbMenuShadow->isChecked() ); + } + + // Misc page + config.writeEntry( "ShowIconsOnPushButtons", cbIconsOnButtons->isChecked(), true, true ); + config.writeEntry( "EffectNoTooltip", !cbEnableTooltips->isChecked(), true, true ); + + config.setGroup("General"); + config.writeEntry( "widgetStyle", currentStyle() ); + + config.setGroup("Toolbar style"); + config.writeEntry( "Highlighting", cbHoverButtons->isChecked(), true, true ); + config.writeEntry( "TransparentMoving", cbTransparentToolbars->isChecked(), true, true ); + QString tbIcon; + switch( comboToolbarIcons->currentItem() ) + { + case 1: tbIcon = "TextOnly"; break; + case 2: tbIcon = "IconTextRight"; break; + case 3: tbIcon = "IconTextBottom"; break; + case 0: + default: tbIcon = "IconOnly"; break; + } + config.writeEntry( "IconText", tbIcon, true, true ); + 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; + KConfig kconfig("kcmdisplayrc", true /*readonly*/, false /*no globals*/); + kconfig.setGroup("X11"); + bool exportKDEColors = kconfig.readBoolEntry("exportKDEColors", true); + if (exportKDEColors) + flags |= KRdbExportColors; + runRdb( flags ); + } + + // Now allow KDE apps to reconfigure themselves. + if ( m_bStyleDirty ) + KIPC::sendMessageAll(KIPC::StyleChanged); + + if ( m_bToolbarsDirty ) + // ##### FIXME - Doesn't apply all settings correctly due to bugs in + // KApplication/KToolbar + KIPC::sendMessageAll(KIPC::ToolbarStyleChanged); + + if (m_bEffectsDirty) { + KIPC::sendMessageAll(KIPC::SettingsChanged); + kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); + } + //update kicker to re-used tooltips kicker parameter otherwise, it overwritted + //by style tooltips parameters. + QByteArray data; + kapp->dcopClient()->send( "kicker", "kicker", "configure()", data ); + + // Clean up + m_bEffectsDirty = false; + m_bToolbarsDirty = false; + m_bStyleDirty = false; + emit changed( false ); +} + + +bool KCMStyle::findStyle( const QString& str, int& combobox_item ) +{ + StyleEntry* se = styleEntries.find(str.lower()); + + QString name = se ? se->name : str; + + combobox_item = 0; + + //look up name + for( int i = 0; i < cbStyle->count(); i++ ) + { + if ( cbStyle->text(i) == name ) + { + combobox_item = i; + return TRUE; + } + } + + return FALSE; +} + + +void KCMStyle::defaults() +{ + load( true ); +} + +void KCMStyle::setEffectsDirty() +{ + m_bEffectsDirty = true; + emit changed(true); +} + +void KCMStyle::setToolbarsDirty() +{ + m_bToolbarsDirty = 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(); + + // Create a dictionary of WidgetStyle to Name and Desc. mappings, + // as well as the config page info + styleEntries.clear(); + styleEntries.setAutoDelete(true); + + QString strWidgetStyle; + QStringList list = KGlobal::dirs()->findAllResources("themes", "*.themerc", true, true); + for (QStringList::iterator it = list.begin(); it != list.end(); ++it) + { + KSimpleConfig config( *it, true ); + if ( !(config.hasGroup("KDE") && config.hasGroup("Misc")) ) + continue; + + config.setGroup("KDE"); + + strWidgetStyle = config.readEntry("WidgetStyle"); + if (strWidgetStyle.isNull()) + continue; + + // We have a widgetstyle, so lets read the i18n entries for it... + StyleEntry* entry = new StyleEntry; + config.setGroup("Misc"); + entry->name = config.readEntry("Name"); + entry->desc = config.readEntry("Comment", i18n("No description available.")); + entry->configPage = config.readEntry("ConfigPage", QString::null); + + // Check if this style should be shown + config.setGroup("Desktop Entry"); + entry->hidden = config.readBoolEntry("Hidden", false); + + // Insert the entry into our dictionary. + styleEntries.insert(strWidgetStyle.lower(), 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).lower(); + // Find the entry. + if ( (entry = styleEntries.find(id)) != 0 ) + { + // 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->insertStringList( styles ); + + // Find out which style is currently being used + config.setGroup( "General" ); + QString defaultStyle = KStyle::defaultStyle(); + QString cfgStyle = config.readEntry( "widgetStyle", defaultStyle ); + + // Select the current style + // Do not use cbStyle->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.lower(); + int item = 0; + for( int i = 0; i < cbStyle->count(); i++ ) + { + QString id = nameToStyleKey[cbStyle->text(i)]; + item = i; + if ( id == cfgStyle ) // ExactMatch + break; + else if ( id.contains( cfgStyle ) ) + break; + else if ( id.contains( QApplication::style().className() ) ) + break; + item = 0; + } + cbStyle->setCurrentItem( item ); + + m_bStyleDirty = false; + + switchStyle( currentStyle() ); // make resets visible +} + +QString KCMStyle::currentStyle() +{ + return nameToStyleKey[cbStyle->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->name() == 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.find( styleName ); + QString desc; + desc = i18n("Description: %1").arg( 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->unsetPalette(); + + QPalette newPalette(KApplication::createApplicationPalette()); + s->polish( newPalette ); + w->setPalette(newPalette); + + // Apply the new style. + w->setStyle(s); + + // Recursively update all children. + const QObjectList *children = w->children(); + if (!children) + return; + + // Apply the style to each child widget. + QPtrListIterator<QObject> childit(*children); + QObject *child; + while ((child = childit.current()) != 0) + { + ++childit; + if (child->isWidgetType()) + setStyleRecursive((QWidget *) child, s); + } +} + + +// ---------------------------------------------------------------- +// All the Effects stuff +// ---------------------------------------------------------------- + +void KCMStyle::loadEffects( KConfig& config ) +{ + // Load effects. + config.setGroup("KDE"); + + cbEnableEffects->setChecked( config.readBoolEntry( "EffectsEnabled", false) ); + + if ( config.readBoolEntry( "EffectAnimateCombo", false) ) + comboComboEffect->setCurrentItem( 1 ); + else + comboComboEffect->setCurrentItem( 0 ); + + if ( config.readBoolEntry( "EffectAnimateTooltip", false) ) + comboTooltipEffect->setCurrentItem( 1 ); + else if ( config.readBoolEntry( "EffectFadeTooltip", false) ) + comboTooltipEffect->setCurrentItem( 2 ); + else + comboTooltipEffect->setCurrentItem( 0 ); + + if ( config.readBoolEntry( "EffectAnimateMenu", false) ) + comboMenuEffect->setCurrentItem( 1 ); + else if ( config.readBoolEntry( "EffectFadeMenu", false) ) + comboMenuEffect->setCurrentItem( 2 ); + else + comboMenuEffect->setCurrentItem( 0 ); + + comboMenuHandle->setCurrentItem(config.readNumEntry("InsertTearOffHandle", 0)); + + // KStyle Menu transparency and drop-shadow options... + QSettings settings; + QString effectEngine = settings.readEntry("/KStyle/Settings/MenuTransparencyEngine", "Disabled"); + +#ifdef HAVE_XRENDER + if (effectEngine == "XRender") { + comboMenuEffectType->setCurrentItem(2); + comboMenuEffect->setCurrentItem(3); + } else if (effectEngine == "SoftwareBlend") { + comboMenuEffectType->setCurrentItem(1); + comboMenuEffect->setCurrentItem(3); +#else + if (effectEngine == "XRender" || effectEngine == "SoftwareBlend") { + comboMenuEffectType->setCurrentItem(1); // Software Blend + comboMenuEffect->setCurrentItem(3); +#endif + } else if (effectEngine == "SoftwareTint") { + comboMenuEffectType->setCurrentItem(0); + comboMenuEffect->setCurrentItem(3); + } else + comboMenuEffectType->setCurrentItem(0); + + if (comboMenuEffect->currentItem() != 3) // If not translucency... + menuPreview->setPreviewMode( MenuPreview::Tint ); + else if (comboMenuEffectType->currentItem() == 0) + menuPreview->setPreviewMode( MenuPreview::Tint ); + else + menuPreview->setPreviewMode( MenuPreview::Blend ); + + slOpacity->setValue( (int)(100 * settings.readDoubleEntry("/KStyle/Settings/MenuOpacity", 0.90)) ); + + // Menu Drop-shadows... + cbMenuShadow->setChecked( settings.readBoolEntry("/KStyle/Settings/MenuDropShadow", false) ); + + if (cbEnableEffects->isChecked()) { + containerFrame->setEnabled( true ); + menuContainer->setEnabled( comboMenuEffect->currentItem() == 3 ); + } else { + menuContainer->setEnabled( false ); + containerFrame->setEnabled( false ); + } + + m_bEffectsDirty = false; +} + + +void KCMStyle::menuEffectTypeChanged() +{ + MenuPreview::PreviewMode mode; + + if (comboMenuEffect->currentItem() != 3) + mode = MenuPreview::Tint; + else if (comboMenuEffectType->currentItem() == 0) + mode = MenuPreview::Tint; + else + mode = MenuPreview::Blend; + + menuPreview->setPreviewMode(mode); + + m_bEffectsDirty = true; +} + + +void KCMStyle::menuEffectChanged() +{ + menuEffectChanged( cbEnableEffects->isChecked() ); + m_bEffectsDirty = true; +} + + +void KCMStyle::menuEffectChanged( bool enabled ) +{ + if (enabled && + comboMenuEffect->currentItem() == 3) { + menuContainer->setEnabled(true); + } else + menuContainer->setEnabled(false); + m_bEffectsDirty = true; +} + + +// ---------------------------------------------------------------- +// All the Miscellaneous stuff +// ---------------------------------------------------------------- + +void KCMStyle::loadMisc( KConfig& config ) +{ + // KDE's Part via KConfig + config.setGroup("Toolbar style"); + cbHoverButtons->setChecked(config.readBoolEntry("Highlighting", true)); + cbTransparentToolbars->setChecked(config.readBoolEntry("TransparentMoving", true)); + + QString tbIcon = config.readEntry("IconText", "IconOnly"); + if (tbIcon == "TextOnly") + comboToolbarIcons->setCurrentItem(1); + else if (tbIcon == "IconTextRight") + comboToolbarIcons->setCurrentItem(2); + else if (tbIcon == "IconTextBottom") + comboToolbarIcons->setCurrentItem(3); + else + comboToolbarIcons->setCurrentItem(0); + + config.setGroup("KDE"); + cbIconsOnButtons->setChecked(config.readBoolEntry("ShowIconsOnPushButtons", false)); + cbEnableTooltips->setChecked(!config.readBoolEntry("EffectNoTooltip", false)); + cbTearOffHandles->setChecked(config.readBoolEntry("InsertTearOffHandle", false)); + + m_bToolbarsDirty = false; +} + +void KCMStyle::addWhatsThis() +{ + // Page1 + QWhatsThis::add( cbStyle, 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).") ); + QWhatsThis::add( stylePreview, i18n("This area shows a preview of the currently selected style " + "without having to apply it to the whole desktop.") ); + + // Page2 + QWhatsThis::add( page2, i18n("This page allows you to enable various widget style effects. " + "For best performance, it is advisable to disable all effects.") ); + QWhatsThis::add( cbEnableEffects, i18n( "If you check this box, you can select several effects " + "for different widgets like combo boxes, menus or tooltips.") ); + QWhatsThis::add( comboComboEffect, i18n( "<p><b>Disable: </b>do not use any combo box effects.</p>\n" + "<b>Animate: </b>Do some animation.") ); + QWhatsThis::add( comboTooltipEffect, i18n( "<p><b>Disable: </b>do not use any tooltip effects.</p>\n" + "<p><b>Animate: </b>Do some animation.</p>\n" + "<b>Fade: </b>Fade in tooltips using alpha-blending.") ); + QWhatsThis::add( comboMenuEffect, i18n( "<p><b>Disable: </b>do not use any menu effects.</p>\n" + "<p><b>Animate: </b>Do some animation.</p>\n" + "<p><b>Fade: </b>Fade in menus using alpha-blending.</p>\n" + "<b>Make Translucent: </b>Alpha-blend menus for a see-through effect. (KDE styles only)") ); + QWhatsThis::add( cbMenuShadow, i18n( "When enabled, all popup menus will have a drop-shadow, otherwise " + "drop-shadows will not be displayed. At present, only KDE styles can have this " + "effect enabled.") ); + QWhatsThis::add( comboMenuEffectType, i18n( "<p><b>Software Tint: </b>Alpha-blend using a flat color.</p>\n" + "<p><b>Software Blend: </b>Alpha-blend using an image.</p>\n" + "<b>XRender Blend: </b>Use the XFree RENDER extension for image blending (if available). " + "This method may be slower than the Software routines on non-accelerated displays, " + "but may however improve performance on remote displays.</p>\n") ); + QWhatsThis::add( slOpacity, i18n("By adjusting this slider you can control the menu effect opacity.") ); + + // Page3 + QWhatsThis::add( page3, i18n("<b>Note:</b> that all widgets in this combobox " + "do not apply to Qt-only applications.") ); + QWhatsThis::add( cbHoverButtons, i18n("If this option is selected, toolbar buttons will change " + "their color when the mouse cursor is moved over them." ) ); + QWhatsThis::add( cbTransparentToolbars, i18n("If you check this box, the toolbars will be " + "transparent when moving them around.") ); + QWhatsThis::add( cbEnableTooltips, i18n( "If you check this option, the KDE application " + "will offer tooltips when the cursor remains over items in the toolbar." ) ); + QWhatsThis::add( comboToolbarIcons, i18n( "<p><b>Icons only:</b> Shows only icons on toolbar buttons. " + "Best option for low resolutions.</p>" + "<p><b>Text only: </b>Shows only text on toolbar buttons.</p>" + "<p><b>Text alongside icons: </b> Shows icons and text on toolbar buttons. " + "Text is aligned alongside the icon.</p>" + "<b>Text under icons: </b> Shows icons and text on toolbar buttons. " + "Text is aligned below the icon.") ); + QWhatsThis::add( cbIconsOnButtons, i18n( "If you enable this option, KDE Applications will " + "show small icons alongside some important buttons.") ); + QWhatsThis::add( cbTearOffHandles, i18n( "If you enable this option some pop-up menus will " + "show so called tear-off handles. If you click them, you get the menu " + "inside a widget. This can be very helpful when performing " + "the same action multiple times.") ); +} + +#include "kcmstyle.moc" + +// vim: set noet ts=4: diff --git a/kcontrol/style/kcmstyle.h b/kcontrol/style/kcmstyle.h new file mode 100644 index 000000000..fb2909b1a --- /dev/null +++ b/kcontrol/style/kcmstyle.h @@ -0,0 +1,163 @@ +/* + * KCMStyle + * Copyright (C) 2002 Karol Szwed <[email protected]> + * Copyright (C) 2002 Daniel Molkentin <[email protected]> + * + * 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 <qstring.h> +#include <qtimer.h> + +#include <kcmodule.h> + +#include "stylepreview.h" +#include "menupreview.h" + +class KComboBox; +class QCheckBox; +class QComboBox; +class QFrame; +class QGroupBox; +class QLabel; +class QListBox; +class QListViewItem; +class QSettings; +class QSlider; +class QSpacerItem; +class QStyle; +class QTabWidget; +class QVBoxLayout; +class StyleConfigDialog; +class WidgetPreview; + +struct StyleEntry { + QString name; + QString desc; + QString configPage; + bool hidden; +}; + +class KCMStyle : public KCModule +{ + Q_OBJECT + +public: + KCMStyle( QWidget* parent = 0, const char* name = 0 ); + ~KCMStyle(); + + virtual void load(); + virtual void load(bool useDefaults); + virtual void save(); + virtual void defaults(); + +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 loadMisc( KConfig& config ); + void addWhatsThis(); + +protected slots: + void styleSpecificConfig(); + void updateConfigButton(); + + void setEffectsDirty(); + void setToolbarsDirty(); + void setStyleDirty(); + + void styleChanged(); + void menuEffectChanged( bool enabled ); + void menuEffectChanged(); + void menuEffectTypeChanged(); + +private: + QString currentStyle(); + + bool m_bEffectsDirty, m_bStyleDirty, m_bToolbarsDirty; + QDict<StyleEntry> styleEntries; + QMap <QString,QString> nameToStyleKey; + + QVBoxLayout* mainLayout; + QTabWidget* tabWidget; + QWidget *page1, *page2, *page3; + QVBoxLayout* page1Layout; + QVBoxLayout* page2Layout; + QVBoxLayout* page3Layout; + + // Page1 widgets + QGroupBox* gbWidgetStyle; + QVBoxLayout* gbWidgetStyleLayout; + QHBoxLayout* hbLayout; + KComboBox* cbStyle; + QPushButton* pbConfigStyle; + QLabel* lblStyleDesc; + StylePreview* stylePreview; + QStyle* appliedStyle; + QPalette palette; + + // Page2 widgets + QCheckBox* cbEnableEffects; + + QFrame* containerFrame; + QGridLayout* containerLayout; + QComboBox* comboTooltipEffect; + QComboBox* comboComboEffect; + QComboBox* comboMenuEffect; + QComboBox* comboMenuHandle; + + QLabel* lblTooltipEffect; + QLabel* lblComboEffect; + QLabel* lblMenuEffect; + QLabel* lblMenuHandle; + QSpacerItem* comboSpacer; + + QFrame* menuContainer; + QGridLayout* menuContainerLayout; + MenuPreview* menuPreview; + QVBox* sliderBox; + QSlider* slOpacity; + QComboBox* comboMenuEffectType; + QLabel* lblMenuEffectType; + QLabel* lblMenuOpacity; + QCheckBox* cbMenuShadow; + + // Page3 widgets + QGroupBox* gbVisualAppearance; + + QCheckBox* cbHoverButtons; + QCheckBox* cbTransparentToolbars; + QCheckBox* cbEnableTooltips; + QComboBox* comboToolbarIcons; + + QCheckBox* cbIconsOnButtons; + QCheckBox* cbTearOffHandles; +}; + +#endif // __KCMSTYLE_H + +// vim: set noet ts=4: diff --git a/kcontrol/style/keramik/Makefile.am b/kcontrol/style/keramik/Makefile.am new file mode 100644 index 000000000..028585373 --- /dev/null +++ b/kcontrol/style/keramik/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES = $(all_includes) + +noinst_HEADERS = keramikconf.h +kde_module_LTLIBRARIES = kstyle_keramik_config.la +kstyle_keramik_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kstyle_keramik_config_la_LIBADD = $(LIB_KDEUI) +kstyle_keramik_config_la_SOURCES = keramikconf.cpp +METASOURCES = AUTO + + +messages: + $(XGETTEXT) *.cpp *.h -o $(podir)/kstyle_keramik_config.pot diff --git a/kcontrol/style/keramik/keramikconf.cpp b/kcontrol/style/keramik/keramikconf.cpp new file mode 100644 index 000000000..28e0ce424 --- /dev/null +++ b/kcontrol/style/keramik/keramikconf.cpp @@ -0,0 +1,103 @@ +/* +Copyright (c) 2003 Maksim Orlovich <[email protected]> + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +*/ + +#include <qcheckbox.h> +#include <qlayout.h> +#include <qsettings.h> +#include <kdialog.h> +#include <kglobal.h> +#include <klocale.h> + +#include "keramikconf.h" + +extern "C" +{ + KDE_EXPORT QWidget* allocate_kstyle_config(QWidget* parent) + { + return new KeramikStyleConfig(parent); + } +} + +KeramikStyleConfig::KeramikStyleConfig(QWidget* parent): QWidget(parent) +{ + //Should have no margins here, the dialog provides them + QVBoxLayout* layout = new QVBoxLayout(this, 0, 0); + KGlobal::locale()->insertCatalogue("kstyle_keramik_config"); + + //highlightLineEdits = new QCheckBox(i18n("Highlight active lineedits"), this); + highlightScrollBar = new QCheckBox(i18n("Highlight scroll bar handles"), this); + animateProgressBar = new QCheckBox(i18n("Animate progress bars"), this); + + //layout->add(highlightLineEdits); + layout->add(highlightScrollBar); + layout->add(animateProgressBar); + layout->addStretch(1); + + QSettings s; + //origHlLineEdit = s.readBoolEntry("/keramik/Settings/highlightLineEdits", false); + //highlightLineEdits->setChecked(origHlLineEdit); + + origHlScrollbar = s.readBoolEntry("/keramik/Settings/highlightScrollBar", true); + highlightScrollBar->setChecked(origHlScrollbar); + + origAnimProgressBar = s.readBoolEntry("/keramik/Settings/animateProgressBar", false); + animateProgressBar->setChecked(origAnimProgressBar); + + //connect(highlightLineEdits, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) ); + connect(highlightScrollBar, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) ); + connect(animateProgressBar, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) ); +} + +KeramikStyleConfig::~KeramikStyleConfig() +{ + KGlobal::locale()->removeCatalogue("kstyle_keramik_config"); +} + + +void KeramikStyleConfig::save() +{ + QSettings s; + //s.writeEntry("/keramik/Settings/highlightLineEdits", highlightLineEdits->isChecked()); + s.writeEntry("/keramik/Settings/highlightScrollBar", highlightScrollBar->isChecked()); + s.writeEntry("/keramik/Settings/animateProgressBar", animateProgressBar->isChecked()); +} + +void KeramikStyleConfig::defaults() +{ + //highlightLineEdits->setChecked(false); + highlightScrollBar->setChecked(true); + animateProgressBar->setChecked(false); + //updateChanged would be done by setChecked already +} + +void KeramikStyleConfig::updateChanged() +{ + if ( /*(highlightLineEdits->isChecked() == origHlLineEdit) &&*/ + (highlightScrollBar->isChecked() == origHlScrollbar) && + (animateProgressBar->isChecked() == origAnimProgressBar) ) + emit changed(false); + else + emit changed(true); +} + +#include "keramikconf.moc" diff --git a/kcontrol/style/keramik/keramikconf.h b/kcontrol/style/keramik/keramikconf.h new file mode 100644 index 000000000..f482fdb14 --- /dev/null +++ b/kcontrol/style/keramik/keramikconf.h @@ -0,0 +1,62 @@ +/* +Copyright (c) 2003 Maksim Orlovich <[email protected]> + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef KERAMIK_CONF_H +#define KERAMIK_CONF_H + +class QCheckBox; + +class KeramikStyleConfig: public QWidget +{ + Q_OBJECT +public: + KeramikStyleConfig(QWidget* parent); + ~KeramikStyleConfig(); + + //This signal and the next two slots are the plugin + //page interface +signals: + void changed(bool); + +public slots: + void save(); + void defaults(); + + //Everything below this is internal. +protected slots: + void updateChanged(); + +protected: + //We store settings directly in widgets to + //avoid the hassle of sync'ing things + //QCheckBox* highlightLineEdits; + QCheckBox* animateProgressBar; + QCheckBox* highlightScrollBar; + + //Original settings, for accurate dirtiness tracking + //bool origHlLineEdit; + bool origAnimProgressBar; + bool origHlScrollbar; +}; + +#endif diff --git a/kcontrol/style/main.cpp b/kcontrol/style/main.cpp new file mode 100644 index 000000000..543685502 --- /dev/null +++ b/kcontrol/style/main.cpp @@ -0,0 +1,16 @@ +#include <kglobal.h> +#include <klocale.h> +#include <kgenericfactory.h> + +#include "kcmstyle.h" + +extern "C" { + KCModule *create_style(QWidget *parent, const char *) { + return new KCMStyle(parent, "kcmstyle"); + } +} + +/* +typedef KGenericFactory<KWidgetSettingsModule, QWidget> GeneralFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_style, GeneralFactory ) +*/ diff --git a/kcontrol/style/menupreview.cpp b/kcontrol/style/menupreview.cpp new file mode 100644 index 000000000..a8a74c981 --- /dev/null +++ b/kcontrol/style/menupreview.cpp @@ -0,0 +1,166 @@ +/* + * Menu Transparency Preview Widget + * Copyright (C) 2002 Karol Szwed <[email protected]> + * + * 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. + */ + +#include "menupreview.h" + +#include <qpainter.h> +#include <qimage.h> + +#include <kpixmap.h> +#include <kpixmapeffect.h> +#include <klocale.h> +#include <kimageeffect.h> +#include <kiconloader.h> + + +MenuPreview::MenuPreview( QWidget* parent, int opacity, PreviewMode pvm ) + : QWidget( parent, 0, WStyle_Customize | WRepaintNoErase ), + pixBackground(NULL), pixOverlay(NULL), pixBlended(NULL) +{ + setFixedSize(150, 150); + setFocusPolicy( NoFocus ); + + mode = pvm; + if (opacity < 0) opacity = 0; + if (opacity > 100) opacity = 100; + menuOpacity = opacity/100.0; + + pixBackground = new KPixmap(); + pixOverlay = new KPixmap(); + pixBlended = new KPixmap(); + + createPixmaps(); + blendPixmaps(); +} + +MenuPreview::~MenuPreview() +{ + delete pixBackground; + delete pixOverlay; + delete pixBlended; +} + +void MenuPreview::createPixmaps() +{ + int w = width()-2; + int h = height()-2; + + if (pixBackground) + pixBackground->resize( w, h ); + if (pixOverlay) + pixOverlay->resize( w, h ); + if (pixBlended) + pixBlended->resize( w, h ); + + QColorGroup cg = colorGroup(); + QColor c1 = cg.background(); + QColor c2 = cg.mid(); + + if (pixBackground) { + // Paint checkerboard + QPainter p; + p.begin(pixBackground); + for(int x=0; x < pixBackground->width(); x+=5) + for(int y=0; y < pixBackground->height(); y+=5) + p.fillRect( x, y, 5, 5, + (x % 2) ? + ((y % 2) ? c2 : c1 ) : // See the grid? ;-) + ((y % 2) ? c1 : c2 ) ); + KIconLoader* icl = KGlobal::iconLoader(); + QPixmap pix = icl->loadIcon("go", KIcon::Desktop, KIcon::SizeLarge, KIcon::ActiveState); + p.drawPixmap( (width()-2-pix.width())/2, (height()-2-pix.height())/2, pix ); + } + + if (pixOverlay) { + c1 = cg.button().light(110); + c2 = cg.button().dark(110); + KPixmapEffect::gradient( *pixOverlay, c1, c2, KPixmapEffect::VerticalGradient ); + } +} + +void MenuPreview::blendPixmaps() +{ + // Rebuild pixmaps, and repaint + if (pixBlended && pixBackground) + { + if (mode == Blend && pixOverlay) { + QImage src = pixOverlay->convertToImage(); + QImage dst = pixBackground->convertToImage(); + KImageEffect::blend(src, dst, menuOpacity); + pixBlended->convertFromImage( dst ); + } else if (mode == Tint) { + QColor clr = colorGroup().button(); + QImage dst = pixBackground->convertToImage(); + KImageEffect::blend(clr, dst, menuOpacity); + pixBlended->convertFromImage( dst ); + } + } +} + +void MenuPreview::setOpacity( int opacity ) +{ + if (opacity < 0 || opacity > 100) + return; + + if ((int)(menuOpacity*100) != opacity) { + menuOpacity = opacity/100.0; + blendPixmaps(); + repaint( false ); + } +} + +void MenuPreview::setPreviewMode( PreviewMode pvm ) +{ + if (mode != pvm) { + mode = pvm; + blendPixmaps(); + repaint( false ); + } +} + +void MenuPreview::paintEvent( QPaintEvent* /* pe */ ) +{ + // Paint the frame and blended pixmap + QColorGroup cg = colorGroup(); + int x2 = width()-1; + int y2 = height()-1; + + QPainter p(this); + p.setPen(cg.dark()); + p.drawLine(0, 0, x2, 0); + p.drawLine(0, 0, 0, y2); + p.setPen(cg.light()); + p.drawLine(1, y2, x2, y2); + p.drawLine(x2, 1, x2, y2); + + if (mode == NoEffect) + p.fillRect(1, 1, --x2, --y2, cg.button()); + else if (mode != NoEffect && pixBlended) + p.drawPixmap(1, 1, *pixBlended, 0, 0, --x2, --y2); + + QRect r = rect(); + r.moveBy(6,3); + p.setPen( cg.text() ); + p.drawText( r, AlignTop | AlignLeft, QString::number((int)(menuOpacity*100))+i18n("%") ); +} + +#include "menupreview.moc" + +// vim: set noet ts=4: + diff --git a/kcontrol/style/menupreview.h b/kcontrol/style/menupreview.h new file mode 100644 index 000000000..2b7cb8bc8 --- /dev/null +++ b/kcontrol/style/menupreview.h @@ -0,0 +1,61 @@ +/* + * Menu Transparency Preview Widget + * Copyright (C) 2002 Karol Szwed <[email protected]> + * + * 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 __MENUPREVIEW_H +#define __MENUPREVIEW_H + +#include <qwidget.h> + +class KPixmap; + +class MenuPreview : public QWidget +{ + Q_OBJECT + +public: + enum PreviewMode { + NoEffect = 0, + Tint, + Blend + }; + + MenuPreview( QWidget* parent, int opacity, PreviewMode pvm ); + ~MenuPreview(); + +public slots: + void setOpacity( int opacity ); + void setPreviewMode( PreviewMode pvm ); + +protected: + void paintEvent( QPaintEvent* pe ); + +private: + void createPixmaps(); + void blendPixmaps(); + + KPixmap* pixBackground; + KPixmap* pixOverlay; + KPixmap* pixBlended; + float menuOpacity; + PreviewMode mode; +}; + +// vim: set noet ts=4: +#endif // __MENUPREVIEW_H + diff --git a/kcontrol/style/style.desktop b/kcontrol/style/style.desktop new file mode 100644 index 000000000..648853ea1 --- /dev/null +++ b/kcontrol/style/style.desktop @@ -0,0 +1,234 @@ +[Desktop Entry] +Exec=kcmshell style +Icon=style +Type=Application +DocPath=kcontrol/kcmstyle/index.html + + +X-KDE-Library=style +X-KDE-FactoryName=style +X-KDE-Init=style +X-KDE-ParentApp=kcontrol + +Name=Style +Name[af]=Styl +Name[ar]=المظهر العام +Name[az]=Tərz +Name[be]=Стыль +Name[bg]=Теми и стилове +Name[bn]=স্টাইল +Name[br]=Giz +Name[bs]=Stil +Name[ca]=Estil +Name[cs]=Styl +Name[csb]=Sztél +Name[cy]=Arddull +Name[da]=Stil +Name[de]=Stil +Name[el]=Στυλ +Name[eo]=Stilo +Name[es]=Estilo +Name[et]=Stiil +Name[eu]=Estiloa +Name[fa]=سبک +Name[fi]=Tyyli +Name[fy]=Styl +Name[ga]=Stíl +Name[gl]=Estilo +Name[he]=סגנון +Name[hi]=शैली +Name[hr]=Stil +Name[hu]=Stílus +Name[id]=Gaya +Name[is]=Stíll +Name[it]=Stile +Name[ja]=スタイル +Name[ka]=სტილი +Name[kk]=Стилі +Name[km]=រចនាប័ទ្ម +Name[ko]=스타일 +Name[lo]=ລັກສະນະ +Name[lt]=Stilius +Name[lv]=Stils +Name[mk]=Стил +Name[mn]=Хэлбэр +Name[ms]=Gaya +Name[mt]=Stil +Name[nb]=Stil +Name[nds]=Stil +Name[ne]=शैली +Name[nl]=Stijl +Name[nn]=Stil +Name[nso]=Mokgwa +Name[oc]=Estil +Name[pa]=ਸ਼ੈਲੀ +Name[pl]=Styl +Name[pt]=Estilo +Name[pt_BR]=Estilo +Name[ro]=Stil +Name[ru]=Стиль +Name[rw]=Imisusire +Name[se]=Stiila +Name[sk]=Štýl +Name[sl]=Slog +Name[sr]=Стил +Name[sr@Latn]=Stil +Name[ss]=Sitayela +Name[sv]=Stil +Name[ta]=பாணி +Name[tg]=Услуб +Name[th]=ลักษณะ +Name[tr]=Stil +Name[tt]=Stil +Name[uk]=Стиль +Name[uz]=Uslub +Name[uz@cyrillic]=Услуб +Name[ven]=Tshitaela +Name[vi]=Kiểu dáng +Name[wa]=Stîle +Name[xh]=Uhlobo +Name[zh_CN]=风格 +Name[zh_TW]=風格 +Name[zu]=Isitayela +Comment=Allows the manipulation of widget behavior and changing the Style for KDE +Comment[af]=Laat toe die manipulasie van gui-element gedrag en verandering die Styl vir Kde +Comment[be]=Дазваляе кіраваць паводзінамі віджэтаў і змяняць стыль KDE +Comment[bg]=Настройване на стила +Comment[bn]=উইজেট আচরণ নিয়ন্ত্রণ করুন এবং কে.ডি.ই-র স্টাইল পাল্টান +Comment[bs]=Omogućuje upravljanje ponašanjem ukrasa i izmjenu stila za KDE +Comment[ca]=Permet la manipulació del comportament dels estris i permet canviar-ne l'estil per al KDE +Comment[cs]=Umožňuje upravit chování prvků grafického prostředí a změnu stylu KDE +Comment[csb]=Zezwôlô na òpisanié zachòwaniô elementów interfejsu ë zmianã Sztélu KDE +Comment[cy]=Yn caniatau trin ymddygiad teclyn a newid arddull KDE +Comment[da]=Tillader manipulation af kontrolopførsel og ændring af stilen for KDE +Comment[de]=Stile und das Verhalten von Bedienelementen verändern +Comment[el]=Επιτρέπει τη διαχείριση της συμπεριφοράς των γραφικών συστατικών και την αλλαγή του Στυλ για το KDE +Comment[en_GB]=Allows the manipulation of widget behaviour and changing the Style for KDE +Comment[eo]=Aspekto kaj konduto de la fenestroelementoj +Comment[es]=Permite la manipulación del comportamiento del widget y permite cambiar el estilo para KDE +Comment[et]=Võimaldab muuta kasutajaliidese elementide käitumist ning välimust +Comment[eu]=Widget-en portaera eta KDEren estiloa aldatzen uzten dizu +Comment[fa]=اجازۀ دستکاری رفتار عنصر و تغییر سبک را برای KDE میدهد. +Comment[fi]=Mahdollistaa kontrollien käyttäytymisen muokaamisen ja KDE:n tyylin vaihtamisen +Comment[fr]=Permet la configuration du comportement des éléments graphiques et la modification des styles de KDE +Comment[fy]=Hjirmei kinne jo it gedrach fan de widgets oanpasse en de styl fan KDE wizigje +Comment[gl]=Permite a manipulación do comportamento dun widget e o cámbio de estilo de KDE +Comment[he]=שינוי הגדרות פעולת הפריטים והסגנון של KDE +Comment[hi]=केडीई की शैली तथा विजेट बर्ताव में परिवर्तन की स्वीकृति देता है +Comment[hr]=Dopušta upravljanje ponašanja widgeta i izmjenu KDE stila +Comment[hu]=Lehetővé teszi a grafikus alapelemek jellemzőinek megváltoztatását, a KDE stílusának módosítását +Comment[is]=Leyfir hagræðingu á græjuhegðun og breytingu á KDE stílnum +Comment[it]=Permette la configurazione del comportamento degli elementi grafici e il cambio dello stile di KDE +Comment[ja]=ウィジェットの挙動と KDE のスタイルを変更 +Comment[ka]=KDE-ს ელემენტების სტილი და იერსახე +Comment[kk]=KDE элементтерінің қасиеттері +Comment[km]=អនុញ្ញាតឲ្យរៀបចំឥរិយាបថវត្ថុមើលឃើញ និងប្ដូររចនាប័ទ្មរបស់ KDE +Comment[ko]=KDE 위젯의 행동을 조정하고 스타일을 변경하기 +Comment[lt]=Leidžia manipuliuoti valdiklio elgsena ir leidžia pakeisti KDE stilių +Comment[lv]=Atļauj manipulācijas ar logdaļu izturēšanos un ļauj mainīt Stilu priekš KDE +Comment[mk]=Дозволува манипулација со однесувањата на графичките контроли и промена на стиловите во KDE +Comment[mn]=Үйлчилгээний элементийн хэлбэр ба байдал өөрчилөх +Comment[ms]=Membolehkan manipulasi kelakuan widget dan mengubah Gaya untuk KDE +Comment[mt]=Hawn tista' timmanipula l-imġieba tal-kontrolli u tbiddel l-istil għall-KDE +Comment[nb]=Her kan du endre oppførsel til skjermelementer, og endre stiler i KDE +Comment[nds]=Hier kann dat Bedregen vun Bedeen-Elementen un ehr KDE-Stil ännert warrn +Comment[ne]=KDE का लागि परिवर्तन शैली र विजेट व्यवहारको परिचालन गर्न अनुमति दिन्छ +Comment[nl]=Hiermee kunt u het gedrag van de widgets aanpassen en de stijl van KDE wijzigen +Comment[nn]=Let deg endra KDE-stilen og åtferda til skjermelementa +Comment[nso]=Dumelela peakanyo ya mekgwa ya widget lego fetosa Mokgwa wa KDE +Comment[pa]=KDE ਲਈ ਵਿਦਗਿਟ ਵਿਵਹਾਰ ਅਤੇ ਸ਼ੈਲੀ ਤਬਦੀਲ ਲਈ ਸਹਾਈ ਹੈ +Comment[pl]=Pozwala na określenie zachowania elementów interfejsu i zmianę Stylu KDE +Comment[pt]=Permite a manipulação do comportamento dos elementos gráficos e a mudança do estilo para o KDE +Comment[pt_BR]=Permite a manipulação do comportamente de widgets e a escolha do estilo usado pelo KDE +Comment[ro]=Modifică stilul grafic KDE și comportamentul elementelor grafice +Comment[ru]=Стиль и облик элементов KDE +Comment[rw]=Yemerera ikoreshwa ry'imyitwarire y'irenga no guhindura Imisusire ya KDE +Comment[se]=Diktá du rievdadit KDE-stiilla ja šearbmaáđaid láhttema +Comment[sk]=Umožňuje upraviť správanie prvkov a zmenu štýlu pre KDE +Comment[sl]=Omogoča manipulacijo z gradniki in spreminjanje sloga KDE +Comment[sr]=Омогућава подешавање понашања форми и промену стила за KDE +Comment[sr@Latn]=Omogućava podešavanje ponašanja formi i promenu stila za KDE +Comment[sv]=Tillåter manipulering av beteendet hos komponenter och ändring av stil på KDE +Comment[ta]=KDEக்கான வளைவுகளின் இயக்கத்தை கையாளவும் பாணிகளை மாற்றவும் அனுமதிக்கிறது +Comment[tg]= Тавоноии таъғир ва ислоҳи навъи рафтори тарҳ ва услуби KDE-ро ба шумо медиҳад +Comment[th]=อนุญาตการปรับรพฤติกรรมขอวิตเจ็ตลและเปลี่ยนลักษณะของ KDE +Comment[tr]=KDE için Aletlerin davranışlarını ve stili değiştirmeyi sağlar +Comment[tt]=KDE yözara berämleklärneñ çağılışı belän küreneşe +Comment[uk]=Керування поведінкою віджетів та зміна стилю KDE +Comment[ven]=Tendela u tshinywa ha maitele a widget ni tendele nau shandukisa tshitaela tsha KDE +Comment[vi]=Cho phép điều chỉnh ứng xử của các thành tố điều khiển và thay đổi kiểu dáng của KDE +Comment[wa]=Permete d' eployî li dujhance des ahesses et d' candjî l' stîle po KDE +Comment[xh]=Ivumela uhanahaniso lokuziphatha kwe widget kwaye itshintsha Uhlobo lwe KDE +Comment[zh_CN]=允许操纵修饰行为和更改 KDE 的样式 +Comment[zh_TW]=讓您控制視窗元件 (widget) 的操作方式,以及更改 KDE 的風格 +Comment[zu]=Ivumela ukulawula kokuziphatha kwe-widget kanye nokushintsha isitayela se-KDE + +Keywords=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications +Keywords[af]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE programme +Keywords[az]=tərz,tərzlər,görünüş,dekorlar,örtük,örtüklər,parçacıq,menyu,MacOS,menyu çubuğu,timsal,timsallar,vasitə çubuğu,mətn,düymə,siçan,şəffaf,hərəkət,ekran,proqram,proqramlar,KDE proqramları +Keywords[be]=Стыль,Стылі,Выгляд,Вонкавы выгляд,Віджэт,Значкі,Панэлі начынняў,Тэкст,Падсвятленне,Праграмы,Праграмы KDE,style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications +Keywords[bg]=стил, тема, външен, вид, икони, текст, цветове, style, styles, look, widget, icons, toolbars, text, highlight, apps, KDE applications +Keywords[br]=giz,gizioù,widget,neuz,arlunoù,barrennoù an ostilhoù,skrid,highlight,meziantoù,meziantoù KDE +Keywords[ca]=estil,estils,temes,aspecte,objete visual,estri,icones,barres d'eines,text,ressaltat,aplicacions,aplicacions KDE +Keywords[cs]=Styl,Témata,Motivy,Vzhled,Text,Zvýraznění,Tlačítka,Aplikace KDE +Keywords[csb]=sztél,sztéle,wëzdrzatk,òkno,ikònë,lëstwë nôrzãdzów,tekstë,nôdpisë,pòdskrzënienié,programë,programë KDE +Keywords[cy]=arddull,arddulliau,golwg,teclyn,celfigyn,eiconau,bar offer,testun,amlygu,rhaglenni,rhaglenni KDE +Keywords[da]=stil,udseende,kontrol,ikoner,værktøjslinjer,tekst,fremhæv,prog,KDE-programmer +Keywords[de]=Stile,Design,Themes,Schema,Elemente,Bildschirmelemente,Icons,Bedienelemente,Schriften,Symbole,Werkzeugleisten,Text,Hervorhebungen,Knöpfe,Anwendungen,Programme,KDE-Programme +Keywords[el]=στυλ,στυλ,εμφάνιση,γραφικό συστατικό,εικονίδια,γραμμές εργαλείων,κείμενο,τονισμός,εφαρμογές,εφαρμογές KDE +Keywords[eo]=stilo,aspekto,fenestraĵo,piktogramo,ilobreto,aplikaĵoj +Keywords[es]=estilo,estilos,temas,aspecto,objeto visual,widget,texto,resaltado,botones, aplicaciones, aplicaciones KDE +Keywords[et]=stiil,stiilid,teemad,välimus,elemendid,vidinad,menüüriba,ikoonid, tööriistaribad,rakendused,KDE rakendused +Keywords[eu]=estiloa,estiloak,itxura,widget-a,ikonoak,tresna-barrak,testua, nabarmenketa,aplikazioak,KDE aplikazioak +Keywords[fa]=سبک، سبکها، ظاهر، عنصر، شمایلها، میله ابزارها، متن، مشخص، کاربردها، کاربردهای KDE +Keywords[fi]=tyyli,tyylit,ulkonäkö,kontrolli,kuvakkeet,työkalurivit,teksti,korostus,sovellukset,KDE sovellukset +Keywords[fr]=style,styles,thème,apparence,widget,élément graphique,barre demenus,MacOS,police,couleur,non KDE,icône,icônes,barre d'outils,barres d'outils,barres de menus,texte,surbrillance,sélection,bouton,souris,transparence,déplacement,écran,applications,programmes,programmes non KDE,applications non KDE +Keywords[fy]=styl,stylen,look,üterlik,widget,icons,ikoan,ikoanen,wurkbalke,tekst,highlight,pljochtsje,apps,KDE-tapassingen,programma's,KDE-programma's,tapassingen +Keywords[ga]=stíl,stíleanna,téama,cuma,giuirléid,deilbhíní,barraí uirlisí,téacs,aibhsiú,feidhmchláir,feidhmchláir KDE +Keywords[gl]=estilo,estilos,apariencia,widget,iconas,barras de ferramentas,texto,resaltar,aplicacións,aplicacións KDE +Keywords[he]=סגנון,מראה,פריטים,סמלים,סרגל כלים,טקסט,הדגשה,יישומים,יישומים של KDE,style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications +Keywords[hi]=शैली,शैलियाँ,रूप,विजेट,प्रतीक,औज़ार-पट्टी,पाठ,उभारें,एप्प्स,केडीई अनुप्रयोग +Keywords[hr]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,stil,izgled,ikone,alatne trake,tekst,naglašavanje,KDE aplikacije +Keywords[hu]=stílus,stílusok,kinézet,grafikus elem,ikonok,eszköztárak,szöveg,kiemelés,alkalmazások,KDE alkalmazások +Keywords[is]=stíll,stílar,þemur,þema,útlit,valmyndir,valslá,MacOS,letur,leturgerðir,leturgerð,gegnsætt,skjár,forrit, táknmyndir,takkar,mús,takki,hnappur +Keywords[it]=stile,stili,aspetto,widget,elemento grafico,icone,barre degli strumenti,testo,evidenziazione,applicazioni,applicazioni KDE +Keywords[ja]=スタイル,スタイル,外観,ウィジェット,アイコン,ツールバー,テキスト,ハイライト,アプリ,KDEアプリケーション +Keywords[km]=រចនាប័ទ្ម,រូបរាង,វត្ថុមើលឃើញ,រូបតំណាង,របារឧបករណ៍,អត្ថបទ,បន្លិច,កម្មវិធី,កម្មវិធី KDE +Keywords[lt]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications, stilius,stiliai,išvaizda,valdiklis,ženkliukai,piktogramos,įrankių juostos,paryškinimas,KDE taikomosios programos +Keywords[mk]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,стил,стилови,изглед,икони,алатници,текст,KDE апликации +Keywords[mn]=Хэлбэр,Загвар,Themes,Схем,Элемент,Дэлгэцийн элемент,Icons, Үйлчилгээний элемент,Бичиг,Тэмдэг,Багаж самбар,Текст,Онцгойлолт,Товч, Хэрэглээний,Програм,КДЭ-Програм +Keywords[mt]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,stili,dehra,ikoni,test,immarkar +Keywords[nb]=stil,stiler,temaer,utseende,menylinje,skrifttype,farger,ikke-KDE,ikoner,verktøylinje,tekst,knapper,mus,flytting,skjerm,programmer,ikke-KDE programmer +Keywords[nds]=Stil,Stilen,look,widget,Lüttbiller,Warktüüchbalken,Text,markeren,Programmen,KDE-Programmen,Bedeenelement +Keywords[ne]=शैली, शैलीहरू, हेर्नुहोस्, विजेट, प्रतिमा, उपकरणपट्टी, पाठ, हाइलाइट,apps,KDE अनुप्रयोगहरू +Keywords[nl]=stijl,stijlen,look,uiterlijk,widget,icons,iconen,pictogrammen,werkbalken,tekst,highlight,accentuatie,apps,KDE-toepassingen,programma's,KDE-programma's,toepassingen +Keywords[nn]=stil,tema,utsjånad,bunad,element,skjermelement,verktøylinje,tekst,markering,program,KDE-program +Keywords[nso]=mokgwa,mekgwa,tebelelo,widget,diemedi,di-bar tsa dibereka,sengwalwana,pontshwana,apps,KDE ditshomiso +Keywords[pa]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,ਸ਼ੈਲੀ,ਸ਼ੈਲੀਆਂ,ਦਿੱਖ,ਆਈਕਾਨ,ਸੰਦ-ਪੱਟੀ,ਪਾਠ,ਉਘਾੜੋ,ਕਾਰਜ +Keywords[pl]=styl,style,wygląd,okienko,ikony,paski narzędzi,tekst,napisy,podświetlenie,programy,programy KDE +Keywords[pt]=estilo,estilos,aparência,elemento,ícones,ferramentas,texto,realce,aplicações,aplicações do KDE +Keywords[pt_BR]=estilo,estilos,aparência,widget,ícones,barra de ferramentas,texto,realce,aplicativos,aplicativos não-KDE +Keywords[ro]=stil,aspect,componentă,widget,iconițe,bare de unelte,text,evidențiere,aplicații,KDE +Keywords[ru]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,стиль,стили,приложения +Keywords[rw]=umususire,imisusire,imboneko,irenga,udushushondanga,umwanyabikoresho,umwandiko,gushimangira,porogaramu,Porogaramu KDE +Keywords[se]=stiila,fáddá,fárda,áđat,govažat,neavvoholggat,teaksta,merken,prográmmat,KDE-prográmmat +Keywords[sk]=štýl,štýly,vzhľad,prvok,ikony,KDE aplikácie,panely nástrojov,text,zvýraznenie,aplikácie +Keywords[sl]=slog,slogi,stil,stili,teme,videz,izgled,gradnik,menujska vrstica,osvetlitev,programi,programi za KDEi +Keywords[sr]=style,styles,look,widget,icons,toolbars,text,highlight,apps,стил,стилови,теме,изглед,форма,иконе,траке са алатима,текст,истицање,програми,KDE програми +Keywords[sr@Latn]=style,styles,look,widget,icons,toolbars,text,highlight,apps,stil,stilovi,teme,izgled,forma,ikone,trake sa alatima,tekst,isticanje,programi,KDE programi +Keywords[sv]=stil,stilar,utseende,komponent,ikoner,verktygrader,text,färgläggning, program,KDE-program +Keywords[ta]=பாணி,பாணிகள்,பார்,வளைவு,சின்னம்,கருவிப்பட்டி,உரை,தனிப்படுத்து,பயன்பாடு,கேடியி பயன்பாடுகள் +Keywords[th]=ลักษณะ,ที่มองเห็น,วิตเจ็ต,ไอคอน,แถบเครื่องมือ,ข้อความ,ทำตัวเน้น,โปรแกรม,แอพพลิเคชัน KDE +Keywords[tr]=simgeler,stil,stiller,dekor,dekorlar,tema,temalar,görünüm,parçacık,menü,KDE uygulamaları,araç çubukları,uygulamalar +Keywords[uk]=стиль,стилі,вигляд,віджет,піктограми,пенали, текст,виділення,програми KDE +Keywords[uz]=uslub,uslublar,tashqi koʻrinishi,vidjet,nishonchalar,asboblar paneli,matn,belgilash,dasturlar,KDE dasturlari +Keywords[uz@cyrillic]=услуб,услублар,ташқи кўриниши,виджет,нишончалар,асбоблар панели,матн,белгилаш,дастурлар,KDE дастурлари +Keywords[ven]=Tshitaela,Zwitaela,sedza,widget,dziaikhono,bara ya tshishumiswa,manwalwa,bvisela khagala,apps,dziapulifikhesheni ya KDE +Keywords[vi]=kiểu,các kiểu,nhìn,widget,biểu tượng,thanh công cụ,text,đánh dấu,apps,ứng dụng KDE +Keywords[wa]=stîle,stîles,rivnance,ahesse,imådjete,Bårs ås usteyes,tecse,programes,programes KDE +Keywords[xh]=uhlobo, iintlobo, jonga, widget, amaphawu emifanekiso, iibar zesixhobo, umbhalo, phawula, apps, izicelo ze KDE +Keywords[zh_CN]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,风格,外观,窗口部件,图标,工具栏,文字,突出,KDE 程序,KDE 应用程序 +Keywords[zh_TW]=style,styles,look,widget,icons,toolbars,text,highlight,apps,KDE applications,風格,主題,外觀,視窗元件,圖示,工具列,文字,突出顯示,應用程式,KDE 應用程式 +Keywords[zu]=isitayela,izitayela,ukubukeka,widget,izimpawu zezithombe,amabha amathuluzi,umbhalo,ukugqamisa,apps,abayaleli be-KDE + +Categories=Qt;KDE;X-KDE-settings-looknfeel; diff --git a/kcontrol/style/styleconfdialog.cpp b/kcontrol/style/styleconfdialog.cpp new file mode 100644 index 000000000..6638b620d --- /dev/null +++ b/kcontrol/style/styleconfdialog.cpp @@ -0,0 +1,46 @@ +/* + * KCMStyle's container dialog for custom style setup dialogs + * + * (c) 2003 Maksim Orlovich <[email protected]> + * + * 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. + */ + +#include "styleconfdialog.h" +#include <klocale.h> + +StyleConfigDialog::StyleConfigDialog(QWidget* parent, QString styleName): + KDialogBase(parent, "StyleConfigDialog", + true, /*modal*/ + i18n("Configure %1").arg(styleName), + KDialogBase::Default | KDialogBase::Ok | KDialogBase::Cancel, + KDialogBase::Cancel) +{ + m_dirty = false; + connect( this, SIGNAL( defaultClicked() ), this, SIGNAL( defaults() )); + connect( this, SIGNAL( okClicked() ), this, SIGNAL( save() )); +} + +bool StyleConfigDialog::isDirty() const +{ + return m_dirty; +} + +void StyleConfigDialog::setDirty(bool dirty) +{ + m_dirty = dirty; +} + +#include <styleconfdialog.moc> diff --git a/kcontrol/style/styleconfdialog.h b/kcontrol/style/styleconfdialog.h new file mode 100644 index 000000000..ab299225a --- /dev/null +++ b/kcontrol/style/styleconfdialog.h @@ -0,0 +1,46 @@ +/* + * KCMStyle's container dialog for custom style setup dialogs + * + * (c) 2003 Maksim Orlovich <[email protected]> + * + * 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 STYLE_CONF_DIALOG +#define STYLE_CONF_DIALOG + +#include <kdialogbase.h> + + +class StyleConfigDialog: public KDialogBase +{ + Q_OBJECT +public: + StyleConfigDialog(QWidget* parent, QString styleName); + + bool isDirty() const; + +public slots: + void setDirty(bool dirty); + +signals: + void defaults(); + void save(); + +private: + bool m_dirty; +}; + +#endif diff --git a/kcontrol/style/stylepreview.ui b/kcontrol/style/stylepreview.ui new file mode 100644 index 000000000..fbb4929f2 --- /dev/null +++ b/kcontrol/style/stylepreview.ui @@ -0,0 +1,285 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>StylePreview</class> +<widget class="QWidget"> + <property name="name"> + <cstring>StylePreview</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>483</width> + <height>254</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>50</height> + </size> + </property> + </spacer> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>TabWidget2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="margin"> + <number>2</number> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="0" column="0" rowspan="4" colspan="1"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="title"> + <string>Button Group</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>RadioButton1</cstring> + </property> + <property name="text"> + <string>Radio button</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>RadioButton2</cstring> + </property> + <property name="text"> + <string>Radio button</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>Line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox1</cstring> + </property> + <property name="text"> + <string>Checkbox</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="tristate"> + <bool>false</bool> + </property> + </widget> + </vbox> + </widget> + <widget class="QScrollBar" row="0" column="2" rowspan="4" colspan="1"> + <property name="name"> + <cstring>ScrollBar1</cstring> + </property> + <property name="maxValue"> + <number>19</number> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + </widget> + <widget class="QComboBox" row="3" column="1"> + <item> + <property name="text"> + <string>Combobox</string> + </property> + </item> + <property name="name"> + <cstring>ComboBox1</cstring> + </property> + </widget> + <widget class="QProgressBar" row="0" column="1"> + <property name="name"> + <cstring>ProgressBar1</cstring> + </property> + <property name="progress"> + <number>70</number> + </property> + </widget> + <widget class="QSlider" row="1" column="1"> + <property name="name"> + <cstring>Slider1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="1"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>SpinBox1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>32767</height> + </size> + </property> + <property name="maxValue"> + <number>999999</number> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>Button</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </grid> +</widget> +<includes> + <include location="local" impldecl="in implementation">kdialog.h</include> + <include location="local" impldecl="in implementation">stylepreview.ui.h</include> +</includes> +<slots> + <slot>init()</slot> + <slot returnType="bool">eventFilter( QObject *, QEvent * ev )</slot> +</slots> +<layoutdefaults spacing="6" margin="10"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kcontrol/style/stylepreview.ui.h b/kcontrol/style/stylepreview.ui.h new file mode 100644 index 000000000..09b50a0ce --- /dev/null +++ b/kcontrol/style/stylepreview.ui.h @@ -0,0 +1,69 @@ +/* + * Style Preview Widget + * Copyright (C) 2002 Karol Szwed <[email protected]> + * Copyright (C) 2002 Daniel Molkentin <[email protected]> + * + * Portions Copyright (C) 2000 TrollTech AS. + * + * 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. + * + *************************************************************************** + ** ui.h extension file, included from the uic-generated form implementation. + ** + ** If you wish to add, delete or rename slots use Qt Designer which will + ** update this file, preserving your code. Create an init() slot in place of + ** a constructor, and a destroy() slot in place of a destructor. + *****************************************************************************/ + +#include <qobjectlist.h> + +void StylePreview::init() +{ + // Ensure that the user can't toy with the child widgets. + // Method borrowed from Qt's qtconfig. + QObjectList* l = queryList("QWidget"); + QObjectListIt it(*l); + QObject* obj; + while ((obj = it.current()) != 0) + { + ++it; + obj->installEventFilter(this); + ((QWidget*)obj)->setFocusPolicy(NoFocus); + } + delete l; +} + +bool StylePreview::eventFilter( QObject* /* obj */, QEvent* ev ) +{ + 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; +} + +// vim: set noet ts=4: |