(appliedStyle);
- if (style) {
- KStyle::KStyleFlags flags = style->styleFlags();
- if (flags & KStyle::AllowMenuTransparency)
- allowMenuTransparency = true;
- }*/
- }
-
- //### KDE4: not at all clear whether this will come back
- allowMenuTransparency = false;
-
- QString warn_string( i18n("Selected style: %1
"
- "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.
"
- "
", 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->currentIndex() == 3) ) // Make Translucent
- {
- warn_string += i18n("Menu translucency is not available.
");
- comboMenuEffect->setCurrentIndex(0); // Disable menu effect.
- show_warning = true;
- }
-
- if (!allowMenuDropShadow && cbMenuShadow->isChecked())
- {
- warn_string += i18n("Menu drop-shadows are not available.");
- cbMenuShadow->setChecked(false);
- show_warning = true;
- }
-
- // Tell the user what features we could not apply on their behalf.
- if (show_warning)
- KMessageBox::information(this, warn_string);
-
-
// Save effects.
KConfig _config( "kdeglobals" );
KConfigGroup config(&_config, "KDE");
- config.writeEntry( "EffectsEnabled", cbEnableEffects->isChecked());
- int item = comboComboEffect->currentIndex();
- config.writeEntry( "EffectAnimateCombo", item == 1 );
- item = comboTooltipEffect->currentIndex();
- config.writeEntry( "EffectAnimateTooltip", item == 1);
- config.writeEntry( "EffectFadeTooltip", item == 2 );
- item = comboMenuHandle->currentIndex();
- config.writeEntry( "InsertTearOffHandle", item );
- item = comboMenuEffect->currentIndex();
- config.writeEntry( "EffectAnimateMenu", item == 1 );
- config.writeEntry( "EffectFadeMenu", item == 2 );
-
- // Handle KStyle's menu effects
- QString engine("Disabled");
- if (item == 3 && cbEnableEffects->isChecked()) // Make Translucent
- switch( comboMenuEffectType->currentIndex())
- {
- case 1: engine = "SoftwareBlend"; break;
- case 2: engine = "XRender"; break;
- default:
- case 0: engine = "SoftwareTint"; break;
- }
-
- { // Braces force a QSettings::sync()
- QSettings settings; // Only for KStyle stuff
- settings.setValue("/KStyle/Settings/MenuTransparencyEngine", engine);
- settings.setValue("/KStyle/Settings/MenuOpacity", slOpacity->value()/100.0);
- settings.setValue("/KStyle/Settings/MenuDropShadow",
- cbEnableEffects->isChecked() && cbMenuShadow->isChecked() );
- }
-
- // Misc page
+ // Effects page
config.writeEntry( "ShowIconsOnPushButtons", cbIconsOnButtons->isChecked(), KConfig::Normal|KConfig::Global);
KConfigGroup g( &_config, "KDE-Global GUI Settings" );
g.writeEntry( "GraphicEffectsLevel", comboGraphicEffectsLevel->itemData(comboGraphicEffectsLevel->currentIndex()), KConfig::Normal|KConfig::Global);
@@ -635,7 +402,6 @@
KConfigGroup toolbarStyleGroup(&_config, "Toolbar style");
toolbarStyleGroup.writeEntry("Highlighting", cbHoverButtons->isChecked(), KConfig::Normal|KConfig::Global);
- toolbarStyleGroup.writeEntry("TransparentMoving", cbTransparentToolbars->isChecked(), KConfig::Normal|KConfig::Global);
QString tbIcon;
switch( comboToolbarIcons->currentIndex() )
{
@@ -666,25 +432,23 @@
if ( m_bStyleDirty )
KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged);
- if ( m_bToolbarsDirty )
+ if ( m_bEffectsDirty ) {
+ KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged);
// ##### FIXME - Doesn't apply all settings correctly due to bugs in
// KApplication/KToolbar
KGlobalSettings::self()->emitChange(KGlobalSettings::ToolbarStyleChanged);
- if (m_bEffectsDirty) {
- KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged);
#ifdef Q_WS_X11
- // Send signal to all kwin instances
- QDBusMessage message =
- QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
- QDBusConnection::sessionBus().send(message);
+ // Send signal to all kwin instances
+ QDBusMessage message =
+ QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
+ QDBusConnection::sessionBus().send(message);
#endif
}
// Clean up
- m_bEffectsDirty = false;
- m_bToolbarsDirty = false;
m_bStyleDirty = false;
+ m_bEffectsDirty = false;
emit changed( false );
}
@@ -732,24 +496,12 @@
m_bStyleDirty = true;
switchStyle( currentStyle() ); // make resets visible
- // Effects..
- cbEnableEffects->setChecked(false);
- comboTooltipEffect->setCurrentIndex(0);
- comboComboEffect->setCurrentIndex(0);
- comboMenuEffect->setCurrentIndex(0);
- comboMenuHandle->setCurrentIndex(0);
- comboMenuEffectType->setCurrentIndex(0);
- slOpacity->setValue(90);
- cbMenuShadow->setChecked(false);
-
- // Miscellaneous
+ // Effects
cbHoverButtons->setChecked(true);
- cbTransparentToolbars->setChecked(true);
cbEnableTooltips->setChecked(true);
comboToolbarIcons->setCurrentIndex(0);
cbIconsOnButtons->setChecked(true);
comboGraphicEffectsLevel->setCurrentIndex(comboGraphicEffectsLevel->findData(((int) KGlobalSettings::graphicEffectsLevelDefault())));
- cbTearOffHandles->setChecked(false);
}
void KCMStyle::setEffectsDirty()
@@ -758,12 +510,6 @@
emit changed(true);
}
-void KCMStyle::setToolbarsDirty()
-{
- m_bToolbarsDirty = true;
- emit changed(true);
-}
-
void KCMStyle::setStyleDirty()
{
m_bStyleDirty = true;
@@ -943,130 +689,15 @@
}
}
-
// ----------------------------------------------------------------
// All the Effects stuff
// ----------------------------------------------------------------
void KCMStyle::loadEffects( KConfig& config )
{
- // Load effects.
- KConfigGroup configGroup = config.group("KDE");
-
- cbEnableEffects->setChecked( configGroup.readEntry( "EffectsEnabled", false) );
-
- if ( configGroup.readEntry( "EffectAnimateCombo", false) )
- comboComboEffect->setCurrentIndex( 1 );
- else
- comboComboEffect->setCurrentIndex( 0 );
-
- if ( configGroup.readEntry( "EffectAnimateTooltip", false) )
- comboTooltipEffect->setCurrentIndex( 1 );
- else if ( configGroup.readEntry( "EffectFadeTooltip", false) )
- comboTooltipEffect->setCurrentIndex( 2 );
- else
- comboTooltipEffect->setCurrentIndex( 0 );
-
- if ( configGroup.readEntry( "EffectAnimateMenu", false) )
- comboMenuEffect->setCurrentIndex( 1 );
- else if ( configGroup.readEntry( "EffectFadeMenu", false) )
- comboMenuEffect->setCurrentIndex( 2 );
- else
- comboMenuEffect->setCurrentIndex( 0 );
-
- comboMenuHandle->setCurrentIndex(configGroup.readEntry("InsertTearOffHandle", 0));
-
- // KStyle Menu transparency and drop-shadow options...
- QSettings settings;
- QString effectEngine = settings.value("/KStyle/Settings/MenuTransparencyEngine", "Disabled" ).toString();
-
-#ifdef HAVE_XRENDER
- if (effectEngine == "XRender") {
- comboMenuEffectType->setCurrentIndex(2);
- comboMenuEffect->setCurrentIndex(3);
- } else if (effectEngine == "SoftwareBlend") {
- comboMenuEffectType->setCurrentIndex(1);
- comboMenuEffect->setCurrentIndex(3);
-#else
- if (effectEngine == "XRender" || effectEngine == "SoftwareBlend") {
- comboMenuEffectType->setCurrentIndex(1); // Software Blend
- comboMenuEffect->setCurrentIndex(3);
-#endif
- } else if (effectEngine == "SoftwareTint") {
- comboMenuEffectType->setCurrentIndex(0);
- comboMenuEffect->setCurrentIndex(3);
- } else
- comboMenuEffectType->setCurrentIndex(0);
-
- if (comboMenuEffect->currentIndex() != 3) // If not translucency...
- menuPreview->setPreviewMode( MenuPreview::Tint );
- else if (comboMenuEffectType->currentIndex() == 0)
- menuPreview->setPreviewMode( MenuPreview::Tint );
- else
- menuPreview->setPreviewMode( MenuPreview::Blend );
-
- slOpacity->setValue( (int)(100 * settings.value("/KStyle/Settings/MenuOpacity", 0.90).toDouble()) );
-
- // Menu Drop-shadows...
- cbMenuShadow->setChecked( settings.value("/KStyle/Settings/MenuDropShadow", false).toBool() );
-
- if (cbEnableEffects->isChecked()) {
- containerFrame->setEnabled( true );
- menuContainer->setEnabled( comboMenuEffect->currentIndex() == 3 );
- } else {
- menuContainer->setEnabled( false );
- containerFrame->setEnabled( false );
- }
-
- m_bEffectsDirty = false;
-}
-
-
-void KCMStyle::menuEffectTypeChanged()
-{
- MenuPreview::PreviewMode mode;
-
- if (comboMenuEffect->currentIndex() != 3)
- mode = MenuPreview::Tint;
- else if (comboMenuEffectType->currentIndex() == 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->currentIndex() == 3) {
- menuContainer->setEnabled(true);
- } else
- menuContainer->setEnabled(false);
- m_bEffectsDirty = true;
-}
-
-
-// ----------------------------------------------------------------
-// All the Miscellaneous stuff
-// ----------------------------------------------------------------
-
-void KCMStyle::loadMisc( KConfig& config )
-{
// KDE's Part via KConfig
KConfigGroup configGroup = config.group("Toolbar style");
cbHoverButtons->setChecked(configGroup.readEntry("Highlighting", true));
- cbTransparentToolbars->setChecked(configGroup.readEntry("TransparentMoving", true));
QString tbIcon = configGroup.readEntry("ToolButtonStyle", "TextUnderIcon");
if (tbIcon == "TextOnly")
@@ -1081,12 +712,11 @@
configGroup = config.group("KDE");
cbIconsOnButtons->setChecked(configGroup.readEntry("ShowIconsOnPushButtons", true));
cbEnableTooltips->setChecked(!configGroup.readEntry("EffectNoTooltip", false));
- cbTearOffHandles->setChecked(configGroup.readEntry("InsertTearOffHandle", false));
KConfigGroup graphicConfigGroup = config.group("KDE-Global GUI Settings");
comboGraphicEffectsLevel->setCurrentIndex(comboGraphicEffectsLevel->findData(graphicConfigGroup.readEntry("GraphicEffectsLevel", ((int) KGlobalSettings::graphicEffectsLevel()))));
- m_bToolbarsDirty = false;
+ m_bEffectsDirty = false;
}
void KCMStyle::addWhatsThis()
@@ -1098,38 +728,11 @@
" like a marble texture or a gradient).") );
stylePreview->setWhatsThis( i18n("This area shows a preview of the currently selected style "
"without having to apply it to the whole desktop.") );
-
// Page2
page2->setWhatsThis( i18n("This page allows you to enable various widget style effects. "
"For best performance, it is advisable to disable all effects.") );
- cbEnableEffects->setWhatsThis( i18n( "If you check this box, you can select several effects "
- "for different widgets like combo boxes, menus or tooltips.") );
- comboComboEffect->setWhatsThis( i18n( "Disable: do not use any combo box effects.
\n"
- "Animate: Do some animation.") );
- comboTooltipEffect->setWhatsThis( i18n( "Disable: do not use any tooltip effects.
\n"
- "Animate: Do some animation.
\n"
- "Fade: Fade in tooltips using alpha-blending.") );
- comboMenuEffect->setWhatsThis( i18n( "Disable: do not use any menu effects.
\n"
- "Animate: Do some animation.
\n"
- "Fade: Fade in menus using alpha-blending.
\n"
- "Make Translucent: Alpha-blend menus for a see-through effect. (KDE styles only)") );
- cbMenuShadow->setWhatsThis( i18n( "When enabled, all popup menus will have a drop-shadow, otherwise "
- "drop-shadows will not be displayed. At present, only KDE styles can have this "
- "effect enabled.") );
- comboMenuEffectType->setWhatsThis( i18n( "Software Tint: Alpha-blend using a flat color.
\n"
- "Software Blend: Alpha-blend using an image.
\n"
- "XRender Blend: 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.
\n") );
- slOpacity->setWhatsThis( i18n("By adjusting this slider you can control the menu effect opacity.") );
-
- // Page3
- page3->setWhatsThis( i18n("Note: that all widgets in this combobox "
- "do not apply to Qt-only applications.") );
cbHoverButtons->setWhatsThis( i18n("If this option is selected, toolbar buttons will change "
"their color when the mouse cursor is moved over them." ) );
- cbTransparentToolbars->setWhatsThis( i18n("If you check this box, the toolbars will be "
- "transparent when moving them around.") );
cbEnableTooltips->setWhatsThis( i18n( "If you check this option, the KDE application "
"will offer tooltips when the cursor remains over items in the toolbar." ) );
comboToolbarIcons->setWhatsThis( i18n( "Icons only: Shows only icons on toolbar buttons. "
@@ -1143,10 +746,6 @@
"show small icons alongside some important buttons.") );
comboGraphicEffectsLevel->setWhatsThis( i18n( "If you enable this option, KDE Applications will "
"run internal animations.") );
- cbTearOffHandles->setWhatsThis( i18n( "If you enable this option some pop-up menus will "
- "show so called tear-off handles. If you click them, you get the menu "
- "inside a widget. This can be very helpful when performing "
- "the same action multiple times.") );
}
#include "kcmstyle.moc"
Index: menupreview.h
===================================================================
--- menupreview.h (revision 801679)
+++ menupreview.h (working copy)
@@ -1,59 +0,0 @@
-/*
- * Menu Transparency Preview Widget
- * Copyright (C) 2002 Karol Szwed
- *
- * 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
-
-class MenuPreview : public QWidget
-{
- Q_OBJECT
-
-public:
- enum PreviewMode {
- NoEffect = 0,
- Tint,
- Blend
- };
-
- MenuPreview( QWidget* parent, int opacity, PreviewMode pvm );
- ~MenuPreview();
-
-public Q_SLOTS:
- void setOpacity( int opacity );
- void setPreviewMode( PreviewMode pvm );
-
-protected:
- void paintEvent( QPaintEvent* pe );
-
-private:
- void createPixmaps();
- void blendPixmaps();
-
- QPixmap* pixBackground;
- QPixmap* pixOverlay;
- QPixmap* pixBlended;
- float menuOpacity;
- PreviewMode mode;
-};
-
-// vim: set noet ts=4:
-#endif // __MENUPREVIEW_H
-
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 801679)
+++ CMakeLists.txt (working copy)
@@ -5,7 +5,7 @@
########### next target ###############
-set(kcm_style_PART_SRCS ../krdb/krdb.cpp menupreview.cpp styleconfdialog.cpp kcmstyle.cpp)
+set(kcm_style_PART_SRCS ../krdb/krdb.cpp styleconfdialog.cpp kcmstyle.cpp)
kde4_add_ui_files(kcm_style_PART_SRCS stylepreview.ui)
--Boundary-00=_7saGIhusMepmU6H--