diff options
Diffstat (limited to 'kcontrol/style')
-rw-r--r-- | kcontrol/style/CMakeLists.txt | 38 | ||||
-rw-r--r-- | kcontrol/style/Makefile.am | 18 | ||||
-rw-r--r-- | kcontrol/style/kcmstyle.cpp | 1161 | ||||
-rw-r--r-- | kcontrol/style/kcmstyle.h | 172 | ||||
-rw-r--r-- | kcontrol/style/keramik/CMakeLists.txt | 29 | ||||
-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 |
16 files changed, 2518 insertions, 0 deletions
diff --git a/kcontrol/style/CMakeLists.txt b/kcontrol/style/CMakeLists.txt new file mode 100644 index 000000000..88f0927af --- /dev/null +++ b/kcontrol/style/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( keramik ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### other data ################################ + +install( FILES style.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_style (module) ######################## + +tde_add_kpart( kcm_style AUTOMOC + SOURCES + kcmstyle.cpp stylepreview.ui menupreview.cpp + styleconfdialog.cpp + LINK krdb-static tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kcontrol/style/Makefile.am b/kcontrol/style/Makefile.am new file mode 100644 index 000000000..6029c770f --- /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_TDEIO) ../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..d6a7ae6ee --- /dev/null +++ b/kcontrol/style/kcmstyle.cpp @@ -0,0 +1,1161 @@ +/* + * 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 <tqcheckbox.h> +#include <kcombobox.h> +#include <tqlistbox.h> +#include <tqgroupbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqslider.h> +#include <tqstylefactory.h> +#include <tqtabwidget.h> +#include <tqvbox.h> +#include <tqfile.h> +#include <tqsettings.h> +#include <tqobjectlist.h> +#include <tqpixmapcache.h> +#include <tqwhatsthis.h> +#include <tqpushbutton.h> + +#include <dcopclient.h> +#include <tdeapplication.h> +#include <tdeglobalsettings.h> +#include <kdebug.h> +#include <kipc.h> +#include <tdeaboutdata.h> +#include <kdialog.h> +#include <klibloader.h> +#include <tdelistview.h> +#include <tdemessagebox.h> +#include <ksimpleconfig.h> +#include <tdestyle.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 TDECModule *create_style(TQWidget *parent, const char*) + { + TDEGlobal::locale()->insertCatalogue("kcmstyle"); + return new KCMStyle(parent, "kcmstyle"); + } + + KDE_EXPORT void init_style() + { + uint flags = KRdbExportQtSettings | KRdbExportQtColors | KRdbExportXftSettings; + TDEConfig 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 + TQByteArray properties; + TQDataStream d(properties, IO_WriteOnly); + d.setVersion( 3 ); // Qt2 apps need this. + d << kapp->palette() << TDEGlobalSettings::generalFont(); + Atom a = XInternAtom(tqt_xdisplay(), "_QT_DESKTOP_PROPERTIES", false); + + // do it for all root windows - multihead support + int screen_count = ScreenCount(tqt_xdisplay()); + for (int i = 0; i < screen_count; i++) + XChangeProperty(tqt_xdisplay(), RootWindow(tqt_xdisplay(), i), + a, a, 8, PropModeReplace, + (unsigned char*) properties.data(), properties.size()); +#endif + } +} + +/* +typedef KGenericFactory<KWidgetSettingsModule, TQWidget> GeneralFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_kcmstyle, GeneralFactory ) +*/ + + +KCMStyle::KCMStyle( TQWidget* parent, const char* name ) + : TDECModule( 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; + + TDEGlobal::dirs()->addResourceType("themes", + TDEStandardDirs::kde_default("data") + "tdestyle/themes"); + + TDEAboutData *about = + new TDEAboutData( I18N_NOOP("kcmstyle"), + I18N_NOOP("TDE Style Module"), + 0, 0, TDEAboutData::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 TQVBoxLayout( this ); + tabWidget = new TQTabWidget( this ); + mainLayout->addWidget( tabWidget ); + + page1 = new TQWidget( tabWidget ); + page1Layout = new TQVBoxLayout( page1, KDialog::marginHint(), KDialog::spacingHint() ); + page2 = new TQWidget( tabWidget ); + page2Layout = new TQVBoxLayout( page2, KDialog::marginHint(), KDialog::spacingHint() ); + page3 = new TQWidget( tabWidget ); + page3Layout = new TQVBoxLayout( page3, KDialog::marginHint(), KDialog::spacingHint() ); + + // Add Page1 (Style) + // ----------------- + gbWidgetStyle = new TQGroupBox( i18n("Widget Style"), page1, "gbWidgetStyle" ); + gbWidgetStyle->setColumnLayout( 0, Qt::Vertical ); + gbWidgetStyle->layout()->setMargin( KDialog::marginHint() ); + gbWidgetStyle->layout()->setSpacing( KDialog::spacingHint() ); + + gbWidgetStyleLayout = new TQVBoxLayout( gbWidgetStyle->layout() ); + gbWidgetStyleLayout->setAlignment( Qt::AlignTop ); + hbLayout = new TQHBoxLayout( KDialog::spacingHint(), "hbLayout" ); + + cbStyle = new KComboBox( gbWidgetStyle, "cbStyle" ); + cbStyle->setEditable( FALSE ); + hbLayout->addWidget( cbStyle ); + + pbConfigStyle = new TQPushButton( i18n("Con&figure..."), gbWidgetStyle ); + pbConfigStyle->setSizePolicy( TQSizePolicy::Maximum, TQSizePolicy::Minimum ); + pbConfigStyle->setEnabled( FALSE ); + hbLayout->addWidget( pbConfigStyle ); + + gbWidgetStyleLayout->addLayout( hbLayout ); + + lblStyleDesc = new TQLabel( gbWidgetStyle ); + lblStyleDesc->setTextFormat(TQt::RichText); + gbWidgetStyleLayout->addWidget( lblStyleDesc ); + + cbIconsOnButtons = new TQCheckBox( i18n("Sho&w icons on buttons"), gbWidgetStyle ); + gbWidgetStyleLayout->addWidget( cbIconsOnButtons ); + cbScrollablePopupMenus = new TQCheckBox( i18n("Enable &scrolling in popup menus"), gbWidgetStyle ); + gbWidgetStyleLayout->addWidget( cbScrollablePopupMenus ); + cbAutoHideAccelerators = new TQCheckBox( i18n("Hide &underlined characters in the menu bar when not in use"), gbWidgetStyle ); + gbWidgetStyleLayout->addWidget( cbAutoHideAccelerators ); + cbMenuAltKeyNavigation = new TQCheckBox( i18n("&Pressing only the menu bar activator key selects the menu bar"), gbWidgetStyle ); + gbWidgetStyleLayout->addWidget( cbMenuAltKeyNavigation ); + cbEnableTooltips = new TQCheckBox( i18n("E&nable tooltips"), gbWidgetStyle ); + gbWidgetStyleLayout->addWidget( cbEnableTooltips ); + cbTearOffHandles = new TQCheckBox( 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 + + gbWidgetStyleLayout->addSpacing(10); + + m_popupMenuDelay = new KIntNumInput(250, gbWidgetStyle); + m_popupMenuDelay->setLabel(i18n("Menu popup delay:")); + m_popupMenuDelay->setRange(0, 5000, 50); + m_popupMenuDelay->setSuffix(i18n(" msec")); + m_popupMenuDelay->setSteps(50, 50); + gbWidgetStyleLayout->addWidget(m_popupMenuDelay); + + gbWidgetStyleLayout->addSpacing(10); + + TQGroupBox *gbPreview = new TQGroupBox( i18n( "Preview" ), page1 ); + gbPreview->setColumnLayout( 0, Qt::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, TQT_SIGNAL(activated(int)), this, TQT_SLOT(styleChanged()) ); + connect( cbStyle, TQT_SIGNAL(activated(int)), this, TQT_SLOT(updateConfigButton())); + connect( pbConfigStyle, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleSpecificConfig())); + + // Add Page2 (Effects) + // ------------------- + cbEnableEffects = new TQCheckBox( i18n("&Enable GUI effects"), page2 ); + containerFrame = new TQFrame( page2 ); + containerFrame->setFrameStyle( TQFrame::NoFrame | TQFrame::Plain ); + containerFrame->setMargin(0); + containerLayout = new TQGridLayout( containerFrame, 1, 1, // rows, columns + KDialog::marginHint(), KDialog::spacingHint() ); + + comboComboEffect = new TQComboBox( FALSE, containerFrame ); + comboComboEffect->insertItem( i18n("Disable") ); + comboComboEffect->insertItem( i18n("Animate") ); + lblComboEffect = new TQLabel( i18n("Combobo&x effect:"), containerFrame ); + lblComboEffect->setBuddy( comboComboEffect ); + containerLayout->addWidget( lblComboEffect, 0, 0 ); + containerLayout->addWidget( comboComboEffect, 0, 1 ); + + comboTooltipEffect = new TQComboBox( FALSE, containerFrame ); + comboTooltipEffect->insertItem( i18n("Disable") ); + comboTooltipEffect->insertItem( i18n("Animate") ); + comboTooltipEffect->insertItem( i18n("Fade") ); + lblTooltipEffect = new TQLabel( i18n("&Tool tip effect:"), containerFrame ); + lblTooltipEffect->setBuddy( comboTooltipEffect ); + containerLayout->addWidget( lblTooltipEffect, 1, 0 ); + containerLayout->addWidget( comboTooltipEffect, 1, 1 ); + + comboRubberbandEffect = new TQComboBox( FALSE, containerFrame ); + comboRubberbandEffect->insertItem( i18n("Disable") ); + comboRubberbandEffect->insertItem( i18n("Make translucent") ); + lblRubberbandEffect = new TQLabel( i18n("&Rubberband effect:"), containerFrame ); + lblRubberbandEffect->setBuddy( comboRubberbandEffect ); + containerLayout->addWidget( lblRubberbandEffect, 2, 0 ); + containerLayout->addWidget( comboRubberbandEffect, 2, 1 ); + + comboMenuEffect = new TQComboBox( FALSE, containerFrame ); + comboMenuEffect->insertItem( i18n("Disable") ); + comboMenuEffect->insertItem( i18n("Animate") ); + comboMenuEffect->insertItem( i18n("Fade") ); + comboMenuEffect->insertItem( i18n("Make Translucent") ); + lblMenuEffect = new TQLabel( i18n("&Menu effect:"), containerFrame ); + lblMenuEffect->setBuddy( comboMenuEffect ); + containerLayout->addWidget( lblMenuEffect, 3, 0 ); + containerLayout->addWidget( comboMenuEffect, 3, 1 ); + + comboMenuHandle = new TQComboBox( FALSE, containerFrame ); + comboMenuHandle->insertItem( i18n("Disable") ); + comboMenuHandle->insertItem( i18n("Application Level") ); +// comboMenuHandle->insertItem( i18n("Enable") ); + lblMenuHandle = new TQLabel( i18n("Me&nu tear-off handles:"), containerFrame ); + lblMenuHandle->setBuddy( comboMenuHandle ); + containerLayout->addWidget( lblMenuHandle, 4, 0 ); + containerLayout->addWidget( comboMenuHandle, 4, 1 ); + + cbMenuShadow = new TQCheckBox( i18n("Menu &drop shadow"), containerFrame ); + containerLayout->addWidget( cbMenuShadow, 5, 0 ); + + // Push the [label combo] to the left. + comboSpacer = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); + containerLayout->addItem( comboSpacer, 1, 2 ); + + // Separator. + TQFrame* hline = new TQFrame ( page2 ); + hline->setFrameStyle( TQFrame::HLine | TQFrame::Sunken ); + + // Now implement the Menu Transparency container. + menuContainer = new TQFrame( page2 ); + menuContainer->setFrameStyle( TQFrame::NoFrame | TQFrame::Plain ); + menuContainer->setMargin(0); + menuContainerLayout = new TQGridLayout( menuContainer, 1, 1, // rows, columns + KDialog::marginHint(), KDialog::spacingHint() ); + + menuPreview = new MenuPreview( menuContainer, /* opacity */ 90, MenuPreview::Blend ); + + comboMenuEffectType = new TQComboBox( 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 TQVBox( menuContainer ); + sliderBox->setSpacing( KDialog::spacingHint() ); + sliderBox->setMargin( 0 ); + slOpacity = new TQSlider( 0, 100, 5, /*opacity*/ 90, Qt::Horizontal, sliderBox ); + slOpacity->setTickmarks( TQSlider::Below ); + slOpacity->setTickInterval( 10 ); + TQHBox* box1 = new TQHBox( sliderBox ); + box1->setSpacing( KDialog::spacingHint() ); + box1->setMargin( 0 ); + TQLabel* lbl = new TQLabel( i18n("0%"), box1 ); + lbl->setAlignment( AlignLeft ); + lbl = new TQLabel( i18n("50%"), box1 ); + lbl->setAlignment( AlignHCenter ); + lbl = new TQLabel( i18n("100%"), box1 ); + lbl->setAlignment( AlignRight ); + + lblMenuEffectType = new TQLabel( comboMenuEffectType, i18n("Menu trans&lucency type:"), menuContainer ); + lblMenuEffectType->setAlignment( AlignBottom | AlignLeft ); + lblMenuOpacity = new TQLabel( 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 ); + + TQSpacerItem* sp1 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); + page2Layout->addItem( sp1 ); + + // Data flow stuff. + connect( cbEnableEffects, TQT_SIGNAL(toggled(bool)), containerFrame, TQT_SLOT(setEnabled(bool)) ); + connect( cbEnableEffects, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(menuEffectChanged(bool)) ); + connect( slOpacity, TQT_SIGNAL(valueChanged(int)),menuPreview, TQT_SLOT(setOpacity(int)) ); + connect( comboMenuEffect, TQT_SIGNAL(activated(int)), this, TQT_SLOT(menuEffectChanged()) ); + connect( comboMenuEffect, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(menuEffectChanged()) ); + connect( comboMenuEffectType, TQT_SIGNAL(activated(int)), this, TQT_SLOT(menuEffectTypeChanged()) ); + connect( comboMenuEffectType, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(menuEffectTypeChanged()) ); + + // Add Page3 (Miscellaneous) + // ------------------------- + cbHoverButtons = new TQCheckBox( i18n("High&light buttons under mouse"), page3 ); + cbTransparentToolbars = new TQCheckBox( i18n("Transparent tool&bars when moving"), page3 ); + + TQWidget * dummy = new TQWidget( page3 ); + + TQHBoxLayout* box2 = new TQHBoxLayout( dummy, 0, KDialog::spacingHint() ); + lbl = new TQLabel( i18n("Text pos&ition:"), dummy ); + comboToolbarIcons = new TQComboBox( 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 ); + TQSpacerItem* sp2 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); + box2->addItem( sp2 ); + + page3Layout->addWidget( cbHoverButtons ); + page3Layout->addWidget( cbTransparentToolbars ); + page3Layout->addWidget( dummy ); + + // Layout page3. + TQSpacerItem* sp3 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); + page3Layout->addItem( sp3 ); + + // Load settings + load(); + + // Do all the setDirty connections. + connect(cbStyle, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setStyleDirty())); + // Page2 + connect( cbEnableEffects, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setEffectsDirty())); + connect( cbEnableEffects, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setStyleDirty())); + connect( comboTooltipEffect, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setEffectsDirty())); + connect( comboRubberbandEffect, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setStyleDirty())); + connect( comboComboEffect, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setEffectsDirty())); + connect( comboMenuEffect, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setStyleDirty())); + connect( comboMenuHandle, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setStyleDirty())); + connect( comboMenuEffectType, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setStyleDirty())); + connect( slOpacity, TQT_SIGNAL(valueChanged(int)),this, TQT_SLOT(setStyleDirty())); + connect( cbMenuShadow, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setStyleDirty())); + // Page1 & Page3 + connect( cbHoverButtons, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setToolbarsDirty())); + connect( cbTransparentToolbars, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setToolbarsDirty())); + connect( cbEnableTooltips, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setEffectsDirty())); + connect( cbIconsOnButtons, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setEffectsDirty())); + connect( cbScrollablePopupMenus,TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setEffectsDirty())); + connect( cbAutoHideAccelerators,TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setEffectsDirty())); + connect( cbMenuAltKeyNavigation,TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setEffectsDirty())); + connect( cbTearOffHandles, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setEffectsDirty())); + connect( comboToolbarIcons, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setToolbarsDirty())); + connect( m_popupMenuDelay, TQT_SIGNAL(valueChanged(int)),this, TQT_SLOT(setStyleDirty())); + + 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() +{ + TQString libname = styleEntries[currentStyle()]->configPage; + + // Use KLibLoader to get the library, handling + // any errors that arise + KLibLoader* loader = KLibLoader::self(); + + KLibrary* library = loader->library( TQFile::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_tdestyle_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 TQWidget*(* factoryRoutine)( TQWidget* 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. + + TQWidget* pluginConfig = factory( dial ); + + //Insert it in... + dial->setMainWidget( pluginConfig ); + + //..and connect it to the wrapper + connect(pluginConfig, TQT_SIGNAL(changed(bool)), dial, TQT_SLOT(setDirty(bool))); + connect(dial, TQT_SIGNAL(defaults()), pluginConfig, TQT_SLOT(defaults())); + connect(dial, TQT_SIGNAL(save()), pluginConfig, TQT_SLOT(save())); + + if (dial->exec() == TQDialog::Accepted && dial->isDirty() ) { + // Force re-rendering of the preview, to apply settings + switchStyle(currentStyle(), true); + + //For now, ask all TDE 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) +{ + TDEConfig 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 TDEStyle flags to see if the style writer + // has enabled menu translucency in the style. + if (appliedStyle && appliedStyle->inherits("TDEStyle")) + { + allowMenuDropShadow = true; + TDEStyle* style = dynamic_cast<TDEStyle*>(appliedStyle); + if (style) { + TDEStyle::TDEStyleFlags flags = style->styleFlags(); + if (flags & TDEStyle::AllowMenuTransparency) + allowMenuTransparency = true; + } + } + + TQString 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. + TDEConfig 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 = comboRubberbandEffect->currentItem(); + { + TQSettings settings; // Only for TDEStyle stuff + settings.writeEntry("/TDEStyle/Settings/SemiTransparentRubberband", item == 1); + } + item = comboMenuHandle->currentItem(); + config.writeEntry( "InsertTearOffHandle", item ); + item = comboMenuEffect->currentItem(); + config.writeEntry( "EffectAnimateMenu", item == 1 ); + config.writeEntry( "EffectFadeMenu", item == 2 ); + + // Handle TDEStyle's menu effects + TQString 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 TQSettings::sync() + TQSettings settings; // Only for TDEStyle stuff + settings.writeEntry("/TDEStyle/Settings/MenuTransparencyEngine", engine); + settings.writeEntry("/TDEStyle/Settings/MenuOpacity", slOpacity->value()/100.0); + settings.writeEntry("/TDEStyle/Settings/MenuDropShadow", + cbEnableEffects->isChecked() && cbMenuShadow->isChecked() ); + } + + // Misc page + config.writeEntry( "ShowIconsOnPushButtons", cbIconsOnButtons->isChecked(), true, true ); + { // Braces force a TQSettings::sync() + TQSettings settings; // Only for TDEStyle stuff + settings.writeEntry("/TDEStyle/Settings/ScrollablePopupMenus", cbScrollablePopupMenus->isChecked() ); + settings.writeEntry("/TDEStyle/Settings/AutoHideAccelerators", cbAutoHideAccelerators->isChecked() ); + settings.writeEntry("/TDEStyle/Settings/MenuAltKeyNavigation", cbMenuAltKeyNavigation->isChecked() ); + settings.writeEntry("/TDEStyle/Settings/PopupMenuDelay", m_popupMenuDelay->value() ); + } + 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 ); + TQString 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; + TDEConfig tdeconfig("kcmdisplayrc", true /*readonly*/, false /*no globals*/); + tdeconfig.setGroup("X11"); + bool exportKDEColors = tdeconfig.readBoolEntry("exportKDEColors", true); + if (exportKDEColors) + flags |= KRdbExportColors; + runRdb( flags ); + } + + // Now allow TDE 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 + // TDEApplication/TDEToolbar + KIPC::sendMessageAll(KIPC::ToolbarStyleChanged); + + if (m_bEffectsDirty) { + KIPC::sendMessageAll(KIPC::SettingsChanged); + kapp->dcopClient()->send("twin*", "", "reconfigure()", TQString("")); + } + //update kicker to re-used tooltips kicker parameter otherwise, it overwritted + //by style tooltips parameters. + TQByteArray 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 TQString& str, int& combobox_item ) +{ + StyleEntry* se = styleEntries.find(str.lower()); + + TQString 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( TDEConfig& 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); + + TQString strWidgetStyle; + TQStringList list = TDEGlobal::dirs()->findAllResources("themes", "*.themerc", true, true); + for (TQStringList::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", TQString::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 + TQStringList allStyles = TQStyleFactory::keys(); + + // Get translated names, remove all hidden style entries. + TQStringList styles; + StyleEntry* entry; + for (TQStringList::iterator it = allStyles.begin(); it != allStyles.end(); it++) + { + TQString 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" ); + TQString defaultStyle = TDEStyle::defaultStyle(); + TQString 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, + // TQStringList::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++ ) + { + TQString id = nameToStyleKey[cbStyle->text(i)]; + item = i; + if ( id == cfgStyle ) // ExactMatch + break; + else if ( id.contains( cfgStyle ) ) + break; + else if ( id.contains( TQApplication::style().className() ) ) + break; + item = 0; + } + cbStyle->setCurrentItem( item ); + + m_bStyleDirty = false; + + switchStyle( currentStyle() ); // make resets visible +} + +TQString KCMStyle::currentStyle() +{ + return nameToStyleKey[cbStyle->currentText()]; +} + + +void KCMStyle::styleChanged() +{ + switchStyle( currentStyle() ); +} + + +void KCMStyle::switchStyle(const TQString& styleName, bool force) +{ + // Don't flicker the preview if the same style is chosen in the cb + if (!force && appliedStyle && TQT_TQOBJECT(appliedStyle)->name() == styleName) + return; + + // Create an instance of the new style... + TQStyle* style = TQStyleFactory::create(styleName); + if (!style) + return; + + // Prevent Qt from wrongly caching radio button images + TQPixmapCache::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 ); + TQString desc; + desc = i18n("Description: %1").arg( entry ? entry->desc : i18n("No description available.") ); + lblStyleDesc->setText( desc ); +} + +void KCMStyle::setStyleRecursive(TQWidget* w, TQStyle* s) +{ + // Don't let broken styles kill the palette + // for other styles being previewed. (e.g SGI style) + w->unsetPalette(); + + TQPalette newPalette(TDEApplication::createApplicationPalette()); + s->polish( newPalette ); + w->setPalette(newPalette); + + // Apply the new style. + w->setStyle(s); + + // Recursively update all children. + const TQObjectList children = w->childrenListObject(); + if (children.isEmpty()) + return; + + // Apply the style to each child widget. + TQPtrListIterator<TQObject> childit(children); + TQObject *child; + while ((child = childit.current()) != 0) + { + ++childit; + if (child->isWidgetType()) + setStyleRecursive((TQWidget *) child, s); + } +} + + +// ---------------------------------------------------------------- +// All the Effects stuff +// ---------------------------------------------------------------- + +void KCMStyle::loadEffects( TDEConfig& 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 ); + + TQSettings settings; + bool semiTransparentRubberband = settings.readBoolEntry("/TDEStyle/Settings/SemiTransparentRubberband", false); + comboRubberbandEffect->setCurrentItem( semiTransparentRubberband ? 1 : 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)); + + // TDEStyle Menu transparency and drop-shadow options... + + TQString effectEngine = settings.readEntry("/TDEStyle/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("/TDEStyle/Settings/MenuOpacity", 0.90)) ); + + // Menu Drop-shadows... + cbMenuShadow->setChecked( settings.readBoolEntry("/TDEStyle/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( TDEConfig& config ) +{ + // TDE's Part via TDEConfig + config.setGroup("Toolbar style"); + cbHoverButtons->setChecked(config.readBoolEntry("Highlighting", true)); + cbTransparentToolbars->setChecked(config.readBoolEntry("TransparentMoving", true)); + + TQString 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)); + + TQSettings settings; + cbScrollablePopupMenus->setChecked(settings.readBoolEntry("/TDEStyle/Settings/ScrollablePopupMenus", false)); + cbAutoHideAccelerators->setChecked(settings.readBoolEntry("/TDEStyle/Settings/AutoHideAccelerators", false)); + cbMenuAltKeyNavigation->setChecked(settings.readBoolEntry("/TDEStyle/Settings/MenuAltKeyNavigation", true)); + m_popupMenuDelay->setValue(settings.readNumEntry("/TDEStyle/Settings/PopupMenuDelay", 250)); + + m_bToolbarsDirty = false; +} + +void KCMStyle::addWhatsThis() +{ + // Page1 + TQWhatsThis::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).") ); + TQWhatsThis::add( stylePreview, i18n("This area shows a preview of the currently selected style " + "without having to apply it to the whole desktop.") ); + + // Page2 + TQWhatsThis::add( page2, i18n("This page allows you to enable various widget style effects. " + "For best performance, it is advisable to disable all effects.") ); + TQWhatsThis::add( cbEnableEffects, i18n( "If you check this box, you can select several effects " + "for different widgets like combo boxes, menus or tooltips.") ); + TQWhatsThis::add( comboComboEffect, i18n( "<p><b>Disable: </b>do not use any combo box effects.</p>\n" + "<b>Animate: </b>Do some animation.") ); + TQWhatsThis::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.") ); + TQWhatsThis::add( comboRubberbandEffect, i18n( "<p><b>Disable: </b>do not use any rubberband effects.</p>\n" + "<b>Make Translucent: </b>Draw a translucent rubberband.") ); + TQWhatsThis::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. (TDE styles only)") ); + TQWhatsThis::add( cbMenuShadow, i18n( "When enabled, all popup menus will have a drop-shadow, otherwise " + "drop-shadows will not be displayed. At present, only TDE styles can have this " + "effect enabled.") ); + TQWhatsThis::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") ); + TQWhatsThis::add( slOpacity, i18n("By adjusting this slider you can control the menu effect opacity.") ); + + // Page3 + TQWhatsThis::add( page3, i18n("<b>Note:</b> that all widgets in this combobox " + "do not apply to Qt-only applications.") ); + TQWhatsThis::add( cbHoverButtons, i18n("If this option is selected, toolbar buttons will change " + "their color when the mouse cursor is moved over them." ) ); + TQWhatsThis::add( cbTransparentToolbars, i18n("If you check this box, the toolbars will be " + "transparent when moving them around.") ); + TQWhatsThis::add( cbEnableTooltips, i18n( "If you check this option, the TDE application " + "will offer tooltips when the cursor remains over items in the toolbar." ) ); + TQWhatsThis::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.") ); + TQWhatsThis::add( cbIconsOnButtons, i18n( "If you enable this option, TDE Applications will " + "show small icons alongside some important buttons.") ); + TQWhatsThis::add( cbScrollablePopupMenus, i18n( "If you enable this option, pop-up menus will scroll if vertical space is exhausted." ) ); + TQWhatsThis::add( cbAutoHideAccelerators, i18n( "Program drop-down menus can be used with either the mouse or " + "keyboard. Each menu item on the menu bar that can be activated from the keyboard contains one " + "character that is underlined. When the underlined character key is pressed concurrently with the " + "activator key (usually Alt), the keyboard combination opens the menu or selects that menu item. The " + "underlines can remain hidden until the activator key is pressed or remain visible at all times. " + "Enabling this option hides the underlines until pressing the activator key. Note: some widget styles " + "do not support this feature." ) ); + TQWhatsThis::add( cbMenuAltKeyNavigation, i18n( "When using the keyboard, program drop-down menus can be " + "activated in one of two ways. Concurrently press the activator key (usually Alt) and the underlined " + "character that is part of the menu name, or sequentially press and release the activator key and then " + "press the underlined character. Enabling this option selects the latter method. The method of " + "concurrently pressing both keys is supported in both Trinity and non Trinity programs. The choice " + "of using either method applies to Trinity Programs only and not to non Trinity programs. Regardless " + "of which option is preferred, after a desired menu opens, pressing only the respective underlined " + "key of any menu item is required to select that menu item.") ); + TQWhatsThis::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.") ); + TQWhatsThis::add( m_popupMenuDelay, i18n( "The menu popup delay is the time " + "(in milliseconds) before a selected menu " + "or submenu appears.") ); +} + +TQString KCMStyle::handbookSection() const +{ + int index = tabWidget->currentPageIndex(); + if (index == 0) { + //return "style-style"; + return TQString::null; + } + else if (index == 1) { + return "style-effects"; + } + else if (index == 2) { + return "style-misc"; + } + else { + return TQString::null; + } +} + +#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..4fb1065bf --- /dev/null +++ b/kcontrol/style/kcmstyle.h @@ -0,0 +1,172 @@ +/* + * 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 <tqstring.h> +#include <tqtimer.h> + +#include <tdecmodule.h> +#include <knuminput.h> + +#include "stylepreview.h" +#include "menupreview.h" + +class KComboBox; +class TQCheckBox; +class TQComboBox; +class TQFrame; +class TQGroupBox; +class TQLabel; +class TQListBox; +class TQListViewItem; +class TQSettings; +class TQSlider; +class TQSpacerItem; +class TQStyle; +class TQTabWidget; +class TQVBoxLayout; +class StyleConfigDialog; +class WidgetPreview; + +struct StyleEntry { + TQString name; + TQString desc; + TQString configPage; + bool hidden; +}; + +class KCMStyle : public TDECModule +{ + Q_OBJECT + +public: + KCMStyle( TQWidget* parent = 0, const char* name = 0 ); + ~KCMStyle(); + + virtual void load(); + virtual void load(bool useDefaults); + virtual void save(); + virtual void defaults(); + + virtual TQString handbookSection() const; + +protected: + bool findStyle( const TQString& str, int& combobox_item ); + void switchStyle(const TQString& styleName, bool force = false); + void setStyleRecursive(TQWidget* w, TQStyle* s); + + void loadStyle( TDEConfig& config ); + void loadEffects( TDEConfig& config ); + void loadMisc( TDEConfig& 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: + TQString currentStyle(); + + bool m_bEffectsDirty, m_bStyleDirty, m_bToolbarsDirty; + TQDict<StyleEntry> styleEntries; + TQMap <TQString,TQString> nameToStyleKey; + + TQVBoxLayout* mainLayout; + TQTabWidget* tabWidget; + TQWidget *page1, *page2, *page3; + TQVBoxLayout* page1Layout; + TQVBoxLayout* page2Layout; + TQVBoxLayout* page3Layout; + + // Page1 widgets + TQGroupBox* gbWidgetStyle; + TQVBoxLayout* gbWidgetStyleLayout; + TQHBoxLayout* hbLayout; + KComboBox* cbStyle; + TQPushButton* pbConfigStyle; + TQLabel* lblStyleDesc; + StylePreview* stylePreview; + TQStyle* appliedStyle; + TQPalette palette; + TQCheckBox* cbIconsOnButtons; + TQCheckBox* cbScrollablePopupMenus; + TQCheckBox* cbAutoHideAccelerators; + TQCheckBox* cbMenuAltKeyNavigation; + TQCheckBox* cbEnableTooltips; + KIntNumInput *m_popupMenuDelay; + + // Page2 widgets + TQCheckBox* cbEnableEffects; + + TQFrame* containerFrame; + TQGridLayout* containerLayout; + TQComboBox* comboTooltipEffect; + TQComboBox* comboRubberbandEffect; + TQComboBox* comboComboEffect; + TQComboBox* comboMenuEffect; + TQComboBox* comboMenuHandle; + + TQLabel* lblTooltipEffect; + TQLabel* lblRubberbandEffect; + TQLabel* lblComboEffect; + TQLabel* lblMenuEffect; + TQLabel* lblMenuHandle; + TQSpacerItem* comboSpacer; + + TQFrame* menuContainer; + TQGridLayout* menuContainerLayout; + MenuPreview* menuPreview; + TQVBox* sliderBox; + TQSlider* slOpacity; + TQComboBox* comboMenuEffectType; + TQLabel* lblMenuEffectType; + TQLabel* lblMenuOpacity; + TQCheckBox* cbMenuShadow; + TQCheckBox* cbTearOffHandles; + + // Page3 widgets + TQGroupBox* gbVisualAppearance; + + TQCheckBox* cbHoverButtons; + TQCheckBox* cbTransparentToolbars; + TQComboBox* comboToolbarIcons; + +}; + +#endif // __KCMSTYLE_H + +// vim: set noet ts=4: diff --git a/kcontrol/style/keramik/CMakeLists.txt b/kcontrol/style/keramik/CMakeLists.txt new file mode 100644 index 000000000..c6ba1f64b --- /dev/null +++ b/kcontrol/style/keramik/CMakeLists.txt @@ -0,0 +1,29 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### tdestyle_keramik_config (module) ############ + +tde_add_kpart( tdestyle_keramik_config AUTOMOC + SOURCES keramikconf.cpp + LINK tdeui-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kcontrol/style/keramik/Makefile.am b/kcontrol/style/keramik/Makefile.am new file mode 100644 index 000000000..d0fd2d721 --- /dev/null +++ b/kcontrol/style/keramik/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES = $(all_includes) + +noinst_HEADERS = keramikconf.h +kde_module_LTLIBRARIES = tdestyle_keramik_config.la +tdestyle_keramik_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +tdestyle_keramik_config_la_LIBADD = $(LIB_TDEUI) +tdestyle_keramik_config_la_SOURCES = keramikconf.cpp +METASOURCES = AUTO + + +messages: + $(XGETTEXT) *.cpp *.h -o $(podir)/tdestyle_keramik_config.pot diff --git a/kcontrol/style/keramik/keramikconf.cpp b/kcontrol/style/keramik/keramikconf.cpp new file mode 100644 index 000000000..7fa6ef698 --- /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 <tqcheckbox.h> +#include <tqlayout.h> +#include <tqsettings.h> +#include <kdialog.h> +#include <tdeglobal.h> +#include <tdelocale.h> + +#include "keramikconf.h" + +extern "C" +{ + KDE_EXPORT TQWidget* allocate_tdestyle_config(TQWidget* parent) + { + return new KeramikStyleConfig(parent); + } +} + +KeramikStyleConfig::KeramikStyleConfig(TQWidget* parent): TQWidget(parent) +{ + //Should have no margins here, the dialog provides them + TQVBoxLayout* layout = new TQVBoxLayout(this, 0, 0); + TDEGlobal::locale()->insertCatalogue("tdestyle_keramik_config"); + + //highlightLineEdits = new TQCheckBox(i18n("Highlight active lineedits"), this); + highlightScrollBar = new TQCheckBox(i18n("Highlight scroll bar handles"), this); + animateProgressBar = new TQCheckBox(i18n("Animate progress bars"), this); + + //layout->add(highlightLineEdits); + layout->add(highlightScrollBar); + layout->add(animateProgressBar); + layout->addStretch(1); + + TQSettings 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, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) ); + connect(highlightScrollBar, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) ); + connect(animateProgressBar, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) ); +} + +KeramikStyleConfig::~KeramikStyleConfig() +{ + TDEGlobal::locale()->removeCatalogue("tdestyle_keramik_config"); +} + + +void KeramikStyleConfig::save() +{ + TQSettings 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..6de7edb10 --- /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 TQCheckBox; + +class KeramikStyleConfig: public TQWidget +{ + Q_OBJECT +public: + KeramikStyleConfig(TQWidget* 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 + //TQCheckBox* highlightLineEdits; + TQCheckBox* animateProgressBar; + TQCheckBox* 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..7748e9ea7 --- /dev/null +++ b/kcontrol/style/main.cpp @@ -0,0 +1,16 @@ +#include <tdeglobal.h> +#include <tdelocale.h> +#include <kgenericfactory.h> + +#include "kcmstyle.h" + +extern "C" { + TDECModule *create_style(TQWidget *parent, const char *) { + return new KCMStyle(parent, "kcmstyle"); + } +} + +/* +typedef KGenericFactory<KWidgetSettingsModule, TQWidget> 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..9b5edb672 --- /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 <tqpainter.h> +#include <tqimage.h> + +#include <kpixmap.h> +#include <kpixmapeffect.h> +#include <tdelocale.h> +#include <kimageeffect.h> +#include <kiconloader.h> + + +MenuPreview::MenuPreview( TQWidget* parent, int opacity, PreviewMode pvm ) + : TQWidget( parent, 0, (WFlags)(WStyle_Customize | WRepaintNoErase) ), + pixBackground(NULL), pixOverlay(NULL), pixBlended(NULL) +{ + setFixedSize(150, 150); + setFocusPolicy( TQ_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 ); + + TQColorGroup cg = colorGroup(); + TQColor c1 = cg.background(); + TQColor c2 = cg.mid(); + + if (pixBackground) { + // Paint checkerboard + TQPainter 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 ) ); + TDEIconLoader* icl = TDEGlobal::iconLoader(); + TQPixmap pix = icl->loadIcon("go", TDEIcon::Desktop, TDEIcon::SizeLarge, TDEIcon::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) { + TQImage src = pixOverlay->convertToImage(); + TQImage dst = pixBackground->convertToImage(); + KImageEffect::blend(src, dst, menuOpacity); + pixBlended->convertFromImage( dst ); + } else if (mode == Tint) { + TQColor clr = colorGroup().button(); + TQImage 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( TQPaintEvent* /* pe */ ) +{ + // Paint the frame and blended pixmap + TQColorGroup cg = colorGroup(); + int x2 = width()-1; + int y2 = height()-1; + + TQPainter 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); + + TQRect r = rect(); + r.moveBy(6,3); + p.setPen( cg.text() ); + p.drawText( r, AlignTop | AlignLeft, TQString::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..e82b88f18 --- /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 <tqwidget.h> + +class KPixmap; + +class MenuPreview : public TQWidget +{ + Q_OBJECT + +public: + enum PreviewMode { + NoEffect = 0, + Tint, + Blend + }; + + MenuPreview( TQWidget* parent, int opacity, PreviewMode pvm ); + ~MenuPreview(); + +public slots: + void setOpacity( int opacity ); + void setPreviewMode( PreviewMode pvm ); + +protected: + void paintEvent( TQPaintEvent* 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..87eada719 --- /dev/null +++ b/kcontrol/style/style.desktop @@ -0,0 +1,234 @@ +[Desktop Entry] +Exec=tdecmshell style +Icon=style +Type=Application +X-DocPath=kcontrol/kcmstyle/index.html + + +X-TDE-Library=style +X-TDE-FactoryName=style +X-TDE-Init=style +X-TDE-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 TDE +Comment[af]=Laat toe die manipulasie van gui-element gedrag en verandering die Styl vir TDE +Comment[be]=Дазваляе кіраваць паводзінамі віджэтаў і змяняць стыль TDE +Comment[bg]=Настройване на стила +Comment[bn]=উইজেট আচরণ নিয়ন্ত্রণ করুন এবং কে.ডি.ই-র স্টাইল পাল্টান +Comment[bs]=Omogućuje upravljanje ponašanjem ukrasa i izmjenu stila za TDE +Comment[ca]=Permet la manipulació del comportament dels estris i permet canviar-ne l'estil per al TDE +Comment[cs]=Umožňuje upravit chování prvků grafického prostředí a změnu stylu TDE +Comment[csb]=Zezwôlô na òpisanié zachòwaniô elementów interfejsu ë zmianã Sztélu TDE +Comment[cy]=Yn caniatau trin ymddygiad teclyn a newid arddull TDE +Comment[da]=Tillader manipulation af kontrolopførsel og ændring af stilen for TDE +Comment[de]=Stile und das Verhalten von Bedienelementen verändern +Comment[el]=Επιτρέπει τη διαχείριση της συμπεριφοράς των γραφικών συστατικών και την αλλαγή του Στυλ για το TDE +Comment[en_GB]=Allows the manipulation of widget behaviour and changing the Style for TDE +Comment[eo]=Aspekto kaj konduto de la fenestroelementoj +Comment[es]=Permite la manipulación del comportamiento del widget y permite cambiar el estilo para TDE +Comment[et]=Võimaldab muuta kasutajaliidese elementide käitumist ning välimust +Comment[eu]=Widget-en portaera eta TDEren estiloa aldatzen uzten dizu +Comment[fa]=اجازۀ دستکاری رفتار عنصر و تغییر سبک را برای TDE میدهد. +Comment[fi]=Mahdollistaa kontrollien käyttäytymisen muokaamisen ja TDE:n tyylin vaihtamisen +Comment[fr]=Permet la configuration du comportement des éléments graphiques et la modification des styles de TDE +Comment[fy]=Hjirmei kinne jo it gedrach fan de widgets oanpasse en de styl fan TDE wizigje +Comment[gl]=Permite a manipulación do comportamento dun widget e o cámbio de estilo de TDE +Comment[he]=שינוי הגדרות פעולת הפריטים והסגנון של TDE +Comment[hi]=केडीई की शैली तथा विजेट बर्ताव में परिवर्तन की स्वीकृति देता है +Comment[hr]=Dopušta upravljanje ponašanja widgeta i izmjenu TDE stila +Comment[hu]=Lehetővé teszi a grafikus alapelemek jellemzőinek megváltoztatását, a TDE stílusának módosítását +Comment[is]=Leyfir hagræðingu á græjuhegðun og breytingu á TDE stílnum +Comment[it]=Permette la configurazione del comportamento degli elementi grafici e il cambio dello stile di TDE +Comment[ja]=ウィジェットの挙動と TDE のスタイルを変更 +Comment[ka]=TDE-ს ელემენტების სტილი და იერსახე +Comment[kk]=TDE элементтерінің қасиеттері +Comment[km]=អនុញ្ញាតឲ្យរៀបចំឥរិយាបថវត្ថុមើលឃើញ និងប្ដូររចនាប័ទ្មរបស់ TDE +Comment[ko]=TDE 위젯의 행동을 조정하고 스타일을 변경하기 +Comment[lt]=Leidžia manipuliuoti valdiklio elgsena ir leidžia pakeisti TDE stilių +Comment[lv]=Atļauj manipulācijas ar logdaļu izturēšanos un ļauj mainīt Stilu priekš TDE +Comment[mk]=Дозволува манипулација со однесувањата на графичките контроли и промена на стиловите во TDE +Comment[mn]=Үйлчилгээний элементийн хэлбэр ба байдал өөрчилөх +Comment[ms]=Membolehkan manipulasi kelakuan widget dan mengubah Gaya untuk TDE +Comment[mt]=Hawn tista' timmanipula l-imġieba tal-kontrolli u tbiddel l-istil għall-TDE +Comment[nb]=Her kan du endre oppførsel til skjermelementer, og endre stiler i TDE +Comment[nds]=Hier kann dat Bedregen vun Bedeen-Elementen un ehr TDE-Stil ännert warrn +Comment[ne]=TDE का लागि परिवर्तन शैली र विजेट व्यवहारको परिचालन गर्न अनुमति दिन्छ +Comment[nl]=Hiermee kunt u het gedrag van de widgets aanpassen en de stijl van TDE wijzigen +Comment[nn]=Let deg endra TDE-stilen og åtferda til skjermelementa +Comment[nso]=Dumelela peakanyo ya mekgwa ya widget lego fetosa Mokgwa wa TDE +Comment[pa]=TDE ਲਈ ਵਿਦਗਿਟ ਵਿਵਹਾਰ ਅਤੇ ਸ਼ੈਲੀ ਤਬਦੀਲ ਲਈ ਸਹਾਈ ਹੈ +Comment[pl]=Pozwala na określenie zachowania elementów interfejsu i zmianę Stylu TDE +Comment[pt]=Permite a manipulação do comportamento dos elementos gráficos e a mudança do estilo para o TDE +Comment[pt_BR]=Permite a manipulação do comportamente de widgets e a escolha do estilo usado pelo TDE +Comment[ro]=Modifică stilul grafic TDE și comportamentul elementelor grafice +Comment[ru]=Стиль и облик элементов TDE +Comment[rw]=Yemerera ikoreshwa ry'imyitwarire y'irenga no guhindura Imisusire ya TDE +Comment[se]=Diktá du rievdadit TDE-stiilla ja šearbmaáđaid láhttema +Comment[sk]=Umožňuje upraviť správanie prvkov a zmenu štýlu pre TDE +Comment[sl]=Omogoča manipulacijo z gradniki in spreminjanje sloga TDE +Comment[sr]=Омогућава подешавање понашања форми и промену стила за TDE +Comment[sr@Latn]=Omogućava podešavanje ponašanja formi i promenu stila za TDE +Comment[sv]=Tillåter manipulering av beteendet hos komponenter och ändring av stil på TDE +Comment[ta]=TDEக்கான வளைவுகளின் இயக்கத்தை கையாளவும் பாணிகளை மாற்றவும் அனுமதிக்கிறது +Comment[tg]= Тавоноии таъғир ва ислоҳи навъи рафтори тарҳ ва услуби TDE-ро ба шумо медиҳад +Comment[th]=อนุญาตการปรับรพฤติกรรมขอวิตเจ็ตลและเปลี่ยนลักษณะของ TDE +Comment[tr]=TDE için Aletlerin davranışlarını ve stili değiştirmeyi sağlar +Comment[tt]=TDE yözara berämleklärneñ çağılışı belän küreneşe +Comment[uk]=Керування поведінкою віджетів та зміна стилю TDE +Comment[ven]=Tendela u tshinywa ha maitele a widget ni tendele nau shandukisa tshitaela tsha TDE +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 TDE +Comment[wa]=Permete d' eployî li dujhance des ahesses et d' candjî l' stîle po TDE +Comment[xh]=Ivumela uhanahaniso lokuziphatha kwe widget kwaye itshintsha Uhlobo lwe TDE +Comment[zh_CN]=允许操纵修饰行为和更改 TDE 的样式 +Comment[zh_TW]=讓您控制視窗元件 (widget) 的操作方式,以及更改 TDE 的風格 +Comment[zu]=Ivumela ukulawula kokuziphatha kwe-widget kanye nokushintsha isitayela se-TDE + +Keywords=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications; +Keywords[af]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE 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;TDE proqramları; +Keywords[be]=Стыль;Стылі;Выгляд;Вонкавы выгляд;Віджэт;Значкі;Панэлі начынняў;Тэкст;Падсвятленне;Праграмы;Праграмы TDE;style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications; +Keywords[bg]=стил; тема; външен; вид; икони; текст; цветове; style; styles; look; widget; icons; toolbars; text; highlight; apps; TDE applications; +Keywords[br]=giz;gizioù;widget;neuz;arlunoù;barrennoù an ostilhoù;skrid;highlight;meziantoù;meziantoù TDE; +Keywords[ca]=estil;estils;temes;aspecte;objete visual;estri;icones;barres d'eines;text;ressaltat;aplicacions;aplicacions TDE; +Keywords[cs]=Styl;Témata;Motivy;Vzhled;Text;Zvýraznění;Tlačítka;Aplikace TDE; +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ë TDE; +Keywords[cy]=arddull;arddulliau;golwg;teclyn;celfigyn;eiconau;bar offer;testun;amlygu;rhaglenni;rhaglenni TDE; +Keywords[da]=stil;udseende;kontrol;ikoner;værktøjslinjer;tekst;fremhæv;prog;TDE-programmer; +Keywords[de]=Stile;Design;Themes;Schema;Elemente;Bildschirmelemente;Icons;Bedienelemente;Schriften;Symbole;Werkzeugleisten;Text;Hervorhebungen;Knöpfe;Anwendungen;Programme;TDE-Programme; +Keywords[el]=στυλ;στυλ;εμφάνιση;γραφικό συστατικό;εικονίδια;γραμμές εργαλείων;κείμενο;τονισμός;εφαρμογές;εφαρμογές TDE; +Keywords[eo]=stilo;aspekto;fenestraĵo;piktogramo;ilobreto;aplikaĵoj; +Keywords[es]=estilo;estilos;temas;aspecto;objeto visual;widget;texto;resaltado;botones; aplicaciones; aplicaciones TDE; +Keywords[et]=stiil;stiilid;teemad;välimus;elemendid;vidinad;menüüriba;ikoonid; tööriistaribad;rakendused;TDE rakendused; +Keywords[eu]=estiloa;estiloak;itxura;widget-a;ikonoak;tresna-barrak;testua; nabarmenketa;aplikazioak;TDE aplikazioak; +Keywords[fa]=سبک، سبکها، ظاهر، عنصر، شمایلها، میله ابزارها، متن، مشخص، کاربردها، کاربردهای TDE; +Keywords[fi]=tyyli;tyylit;ulkonäkö;kontrolli;kuvakkeet;työkalurivit;teksti;korostus;sovellukset;TDE sovellukset; +Keywords[fr]=style;styles;thème;apparence;widget;élément graphique;barre demenus;MacOS;police;couleur;non TDE;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 TDE;applications non TDE; +Keywords[fy]=styl;stylen;look;üterlik;widget;icons;ikoan;ikoanen;wurkbalke;tekst;highlight;pljochtsje;apps;TDE-tapassingen;programma's;TDE-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 TDE; +Keywords[gl]=estilo;estilos;apariencia;widget;iconas;barras de ferramentas;texto;resaltar;aplicacións;aplicacións TDE; +Keywords[he]=סגנון;מראה;פריטים;סמלים;סרגל כלים;טקסט;הדגשה;יישומים;יישומים של TDE;style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications; +Keywords[hi]=शैली;शैलियाँ;रूप;विजेट;प्रतीक;औज़ार-पट्टी;पाठ;उभारें;एप्प्स;केडीई अनुप्रयोग; +Keywords[hr]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications;stil;izgled;ikone;alatne trake;tekst;naglašavanje;TDE aplikacije; +Keywords[hu]=stílus;stílusok;kinézet;grafikus elem;ikonok;eszköztárak;szöveg;kiemelés;alkalmazások;TDE 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 TDE; +Keywords[ja]=スタイル;スタイル;外観;ウィジェット;アイコン;ツールバー;テキスト;ハイライト;アプリ;TDEアプリケーション; +Keywords[km]=រចនាប័ទ្ម;រូបរាង;វត្ថុមើលឃើញ;រូបតំណាង;របារឧបករណ៍;អត្ថបទ;បន្លិច;កម្មវិធី;កម្មវិធី TDE; +Keywords[lt]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications; stilius;stiliai;išvaizda;valdiklis;ženkliukai;piktogramos;įrankių juostos;paryškinimas;TDE taikomosios programos; +Keywords[mk]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications;стил;стилови;изглед;икони;алатници;текст;TDE апликации; +Keywords[mn]=Хэлбэр;Загвар;Themes;Схем;Элемент;Дэлгэцийн элемент;Icons; Үйлчилгээний элемент;Бичиг;Тэмдэг;Багаж самбар;Текст;Онцгойлолт;Товч; Хэрэглээний;Програм;КДЭ-Програм; +Keywords[mt]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications;stili;dehra;ikoni;test;immarkar; +Keywords[nb]=stil;stiler;temaer;utseende;menylinje;skrifttype;farger;ikke-TDE;ikoner;verktøylinje;tekst;knapper;mus;flytting;skjerm;programmer;ikke-TDE programmer; +Keywords[nds]=Stil;Stilen;look;widget;Lüttbiller;Warktüüchbalken;Text;markeren;Programmen;TDE-Programmen;Bedeenelement; +Keywords[ne]=शैली; शैलीहरू; हेर्नुहोस्; विजेट; प्रतिमा; उपकरणपट्टी; पाठ; हाइलाइट;apps;TDE अनुप्रयोगहरू; +Keywords[nl]=stijl;stijlen;look;uiterlijk;widget;icons;iconen;pictogrammen;werkbalken;tekst;highlight;accentuatie;apps;TDE-toepassingen;programma's;TDE-programma's;toepassingen; +Keywords[nn]=stil;tema;utsjånad;bunad;element;skjermelement;verktøylinje;tekst;markering;program;TDE-program; +Keywords[nso]=mokgwa;mekgwa;tebelelo;widget;diemedi;di-bar tsa dibereka;sengwalwana;pontshwana;apps;TDE ditshomiso; +Keywords[pa]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications;ਸ਼ੈਲੀ;ਸ਼ੈਲੀਆਂ;ਦਿੱਖ;ਆਈਕਾਨ;ਸੰਦ-ਪੱਟੀ;ਪਾਠ;ਉਘਾੜੋ;ਕਾਰਜ; +Keywords[pl]=styl;style;wygląd;okienko;ikony;paski narzędzi;tekst;napisy;podświetlenie;programy;programy TDE; +Keywords[pt]=estilo;estilos;aparência;elemento;ícones;ferramentas;texto;realce;aplicações;aplicações do TDE; +Keywords[pt_BR]=estilo;estilos;aparência;widget;ícones;barra de ferramentas;texto;realce;aplicativos;aplicativos não-TDE; +Keywords[ro]=stil;aspect;componentă;widget;iconițe;bare de unelte;text;evidențiere;aplicații;TDE; +Keywords[ru]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications;стиль;стили;приложения; +Keywords[rw]=umususire;imisusire;imboneko;irenga;udushushondanga;umwanyabikoresho;umwandiko;gushimangira;porogaramu;Porogaramu TDE; +Keywords[se]=stiila;fáddá;fárda;áđat;govažat;neavvoholggat;teaksta;merken;prográmmat;TDE-prográmmat; +Keywords[sk]=štýl;štýly;vzhľad;prvok;ikony;TDE 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 TDEi; +Keywords[sr]=style;styles;look;widget;icons;toolbars;text;highlight;apps;стил;стилови;теме;изглед;форма;иконе;траке са алатима;текст;истицање;програми;TDE програми; +Keywords[sr@Latn]=style;styles;look;widget;icons;toolbars;text;highlight;apps;stil;stilovi;teme;izgled;forma;ikone;trake sa alatima;tekst;isticanje;programi;TDE programi; +Keywords[sv]=stil;stilar;utseende;komponent;ikoner;verktygrader;text;färgläggning; program;TDE-program; +Keywords[ta]=பாணி;பாணிகள்;பார்;வளைவு;சின்னம்;கருவிப்பட்டி;உரை;தனிப்படுத்து;பயன்பாடு;கேடியி பயன்பாடுகள்; +Keywords[th]=ลักษณะ;ที่มองเห็น;วิตเจ็ต;ไอคอน;แถบเครื่องมือ;ข้อความ;ทำตัวเน้น;โปรแกรม;แอพพลิเคชัน TDE; +Keywords[tr]=simgeler;stil;stiller;dekor;dekorlar;tema;temalar;görünüm;parçacık;menü;TDE uygulamaları;araç çubukları;uygulamalar; +Keywords[uk]=стиль;стилі;вигляд;віджет;піктограми;пенали; текст;виділення;програми TDE; +Keywords[uz]=uslub;uslublar;tashqi koʻrinishi;vidjet;nishonchalar;asboblar paneli;matn;belgilash;dasturlar;TDE dasturlari; +Keywords[uz@cyrillic]=услуб;услублар;ташқи кўриниши;виджет;нишончалар;асбоблар панели;матн;белгилаш;дастурлар;TDE дастурлари; +Keywords[ven]=Tshitaela;Zwitaela;sedza;widget;dziaikhono;bara ya tshishumiswa;manwalwa;bvisela khagala;apps;dziapulifikhesheni ya TDE; +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 TDE; +Keywords[wa]=stîle;stîles;rivnance;ahesse;imådjete;Bårs ås usteyes;tecse;programes;programes TDE; +Keywords[xh]=uhlobo; iintlobo; jonga; widget; amaphawu emifanekiso; iibar zesixhobo; umbhalo; phawula; apps; izicelo ze TDE; +Keywords[zh_CN]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications;风格;外观;窗口部件;图标;工具栏;文字;突出;TDE 程序;TDE 应用程序; +Keywords[zh_TW]=style;styles;look;widget;icons;toolbars;text;highlight;apps;TDE applications;風格;主題;外觀;視窗元件;圖示;工具列;文字;突出顯示;應用程式;TDE 應用程式; +Keywords[zu]=isitayela;izitayela;ukubukeka;widget;izimpawu zezithombe;amabha amathuluzi;umbhalo;ukugqamisa;apps;abayaleli be-TDE; + +Categories=Qt;TDE;X-TDE-settings-looknfeel; diff --git a/kcontrol/style/styleconfdialog.cpp b/kcontrol/style/styleconfdialog.cpp new file mode 100644 index 000000000..8cb426b3f --- /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 <tdelocale.h> + +StyleConfigDialog::StyleConfigDialog(TQWidget* parent, TQString styleName): + KDialogBase(parent, "StyleConfigDialog", + true, /*modal*/ + i18n("Configure %1").arg(styleName), + KDialogBase::Default | KDialogBase::Ok | KDialogBase::Cancel, + KDialogBase::Cancel) +{ + m_dirty = false; + connect( this, TQT_SIGNAL( defaultClicked() ), this, TQT_SIGNAL( defaults() )); + connect( this, TQT_SIGNAL( okClicked() ), this, TQT_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..6555adee6 --- /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(TQWidget* parent, TQString 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..ed6d2e43a --- /dev/null +++ b/kcontrol/style/stylepreview.ui @@ -0,0 +1,285 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>StylePreview</class> +<widget class="TQWidget"> + <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="TQTabWidget" 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="TQWidget"> + <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="TQButtonGroup" 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="TQRadioButton"> + <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="TQRadioButton"> + <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="TQCheckBox"> + <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="TQScrollBar" 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="TQComboBox" row="3" column="1"> + <item> + <property name="text"> + <string>Combobox</string> + </property> + </item> + <property name="name"> + <cstring>ComboBox1</cstring> + </property> + </widget> + <widget class="TQProgressBar" row="0" column="1"> + <property name="name"> + <cstring>ProgressBar1</cstring> + </property> + <property name="progress"> + <number>70</number> + </property> + </widget> + <widget class="TQSlider" row="1" column="1"> + <property name="name"> + <cstring>Slider1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQLayoutWidget" 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="TQSpinBox"> + <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="TQPushButton"> + <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="TQWidget"> + <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> +<Q_SLOTS> + <slot>init()</slot> + <slot returnType="bool">eventFilter( TQObject *, TQEvent * ev )</slot> +</Q_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..edf38650e --- /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 <tqobjectlist.h> + +void StylePreview::init() +{ + // Ensure that the user can't toy with the child widgets. + // Method borrowed from Qt's qtconfig. + TQObjectList* l = queryList(TQWIDGET_OBJECT_NAME_STRING); + TQObjectListIt it(*l); + TQObject* obj; + while ((obj = it.current()) != 0) + { + ++it; + obj->installEventFilter(this); + ((TQWidget*)obj)->setFocusPolicy(TQ_NoFocus); + } + delete l; +} + +bool StylePreview::eventFilter( TQObject* /* obj */, TQEvent* ev ) +{ + switch( ev->type() ) + { + case TQEvent::MouseButtonPress: + case TQEvent::MouseButtonRelease: + case TQEvent::MouseButtonDblClick: + case TQEvent::MouseMove: + case TQEvent::KeyPress: + case TQEvent::KeyRelease: + case TQEvent::Enter: + case TQEvent::Leave: + case TQEvent::Wheel: + case TQEvent::ContextMenu: + return TRUE; // ignore + default: + break; + } + return FALSE; +} + +// vim: set noet ts=4: |