diff options
Diffstat (limited to 'twin/kcmtwin/twinoptions/windows.cpp')
-rw-r--r-- | twin/kcmtwin/twinoptions/windows.cpp | 295 |
1 files changed, 163 insertions, 132 deletions
diff --git a/twin/kcmtwin/twinoptions/windows.cpp b/twin/kcmtwin/twinoptions/windows.cpp index f675ed1c4..617ad2fdf 100644 --- a/twin/kcmtwin/twinoptions/windows.cpp +++ b/twin/kcmtwin/twinoptions/windows.cpp @@ -612,60 +612,14 @@ void KFocusConfig::defaults() emit TDECModule::changed(true); } -KAdvancedConfig::~KAdvancedConfig () -{ - if (standAlone) - delete config; +KActiveBorderConfig::~KActiveBorderConfig() { + if (standAlone) delete config; } -KAdvancedConfig::KAdvancedConfig (bool _standAlone, TDEConfig *_config, TQWidget *parent, const char *) - : TDECModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) -{ - TQString wtstr; - TQBoxLayout *lay = new TQVBoxLayout (this, 0, KDialog::spacingHint()); - - //iTLabel = new TQLabel(i18n(" Allowed overlap:\n" - // "(% of desktop space)"), - // plcBox); - //iTLabel->setAlignment(AlignTop|AlignHCenter); - //pLay->addWidget(iTLabel,1,1); - - //interactiveTrigger = new TQSpinBox(0, 500, 1, plcBox); - //pLay->addWidget(interactiveTrigger,1,2); - - //pLay->addRowSpacing(2,KDialog::spacingHint()); +KActiveBorderConfig::KActiveBorderConfig(bool _standAlone, TDEConfig *_config, TQWidget *parent, const char*) + : TDECModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) { - //lay->addWidget(plcBox); - - shBox = new TQVButtonGroup(i18n("Shading"), this); - - animateShade = new TQCheckBox(i18n("Anima&te"), shBox); - TQWhatsThis::add(animateShade, i18n("Animate the action of reducing the window to its titlebar (shading)" - " as well as the expansion of a shaded window") ); - - shadeHoverOn = new TQCheckBox(i18n("&Enable hover"), shBox); - - connect(shadeHoverOn, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(shadeHoverChanged(bool))); - - shadeHover = new KIntNumInput(500, shBox); - shadeHover->setLabel(i18n("Dela&y:"), Qt::AlignVCenter|Qt::AlignLeft); - shadeHover->setRange(0, 3000, 100, true); - shadeHover->setSteps(100, 100); - shadeHover->setSuffix(i18n(" msec")); - - TQWhatsThis::add(shadeHoverOn, i18n("If Shade Hover is enabled, a shaded window will un-shade automatically " - "when the mouse pointer has been over the title bar for some time.")); - - wtstr = i18n("Sets the time in milliseconds before the window unshades " - "when the mouse pointer goes over the shaded window."); - TQWhatsThis::add(shadeHover, wtstr); - - lay->addWidget(shBox); - - // Any changes goes to slotChanged() - connect(animateShade, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); - connect(shadeHoverOn, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); - connect(shadeHover, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(changed())); + TQBoxLayout *lay = new TQVBoxLayout(this, 0, KDialog::spacingHint()); active_box = new TQButtonGroup(i18n("Active Desktop Borders"), this); TQVBoxLayout *active_vbox = new TQVBoxLayout(active_box); @@ -722,7 +676,7 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, TDEConfig *_config, TQWidget active_vbox->addWidget(delays); active_vbox->addWidget(distance); - connect(active_box, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(setEBorders())); + connect(active_box, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(updateActiveBorders())); // Any changes goes to slotChanged() connect(active_box, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(changed())); @@ -732,54 +686,12 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, TDEConfig *_config, TQWidget connect(distance, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); lay->addWidget(active_box); - - hideUtilityWindowsForInactive = new TQCheckBox( i18n( "Hide utility windows for inactive applications" ), this ); - TQWhatsThis::add( hideUtilityWindowsForInactive, - i18n( "When turned on, utility windows (tool windows, torn-off menus,...) of inactive applications will be" - " hidden and will be shown only when the application becomes active. Note that applications" - " have to mark the windows with the proper window type for this feature to work." )); - connect(hideUtilityWindowsForInactive, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); - lay->addWidget( hideUtilityWindowsForInactive ); - lay->addStretch(); - load(); - } -void KAdvancedConfig::setShadeHover(bool on) { - shadeHoverOn->setChecked(on); - shadeHover->setEnabled(on); -} - -void KAdvancedConfig::setShadeHoverInterval(int k) { - shadeHover->setValue(k); -} - -int KAdvancedConfig::getShadeHoverInterval() { - - return shadeHover->value(); -} - -void KAdvancedConfig::shadeHoverChanged(bool a) { - shadeHover->setEnabled(a); -} - -void KAdvancedConfig::setAnimateShade(bool a) { - animateShade->setChecked(a); -} - -void KAdvancedConfig::setHideUtilityWindowsForInactive(bool s) { - hideUtilityWindowsForInactive->setChecked( s ); -} - -void KAdvancedConfig::load( void ) -{ - config->setGroup( "Windows" ); - - setAnimateShade(config->readBoolEntry(KWIN_ANIMSHADE, true)); - setShadeHover(config->readBoolEntry(KWIN_SHADEHOVER, false)); - setShadeHoverInterval(config->readNumEntry(KWIN_SHADEHOVER_INTERVAL, 250)); +void KActiveBorderConfig::load() { + config->setGroup("Windows"); // compatibility with old option names int active_borders = config->readNumEntry(KWIN_ACTIVE_BORDERS, -1); @@ -796,32 +708,16 @@ void KAdvancedConfig::load( void ) setActiveBorderDelay(active_borders_delay); setActiveBorderDistance(config->readNumEntry(KWIN_ACTIVE_BORDER_DISTANCE, 10)); - setHideUtilityWindowsForInactive( config->readBoolEntry( KWIN_HIDE_UTILITY, true )); - emit TDECModule::changed(false); } -void KAdvancedConfig::save( void ) -{ - int v; - - config->setGroup( "Windows" ); - config->writeEntry(KWIN_ANIMSHADE, animateShade->isChecked()); - if (shadeHoverOn->isChecked()) - config->writeEntry(KWIN_SHADEHOVER, "on"); - else - config->writeEntry(KWIN_SHADEHOVER, "off"); - - v = getShadeHoverInterval(); - if (v<0) v = 0; - config->writeEntry(KWIN_SHADEHOVER_INTERVAL, v); +void KActiveBorderConfig::save() { + config->setGroup("Windows"); config->writeEntry(KWIN_ACTIVE_BORDERS, getActiveBorders()); config->writeEntry(KWIN_ACTIVE_BORDER_DELAY, getActiveBorderDelay()); config->writeEntry(KWIN_ACTIVE_BORDER_DISTANCE, getActiveBorderDistance()); - config->writeEntry(KWIN_HIDE_UTILITY, hideUtilityWindowsForInactive->isChecked()); - // remove replaced legacy entries config->deleteEntry(KWIN_OLD_ACTIVE_BORDERS); config->deleteEntry(KWIN_OLD_ACTIVE_BORDER_DELAY); @@ -829,33 +725,26 @@ void KAdvancedConfig::save( void ) if (standAlone) { config->sync(); - if ( !kapp->dcopClient()->isAttached() ) + if (!kapp->dcopClient()->isAttached()) kapp->dcopClient()->attach(); kapp->dcopClient()->send("twin*", "", "reconfigure()", TQString("")); } emit TDECModule::changed(false); } -void KAdvancedConfig::defaults() -{ - setAnimateShade(true); - setShadeHover(false); - setShadeHoverInterval(250); +void KActiveBorderConfig::defaults() { setActiveBorders(0); setActiveBorderDelay(150); setActiveBorderDistance(10); - setHideUtilityWindowsForInactive( true ); emit TDECModule::changed(true); } -void KAdvancedConfig::setEBorders() -{ +void KActiveBorderConfig::updateActiveBorders() { active_desktop_conf->setEnabled(active_desktop->isChecked()); active_tile_conf->setEnabled(active_tile->isChecked()); } -int KAdvancedConfig::getActiveBorders() -{ +int KActiveBorderConfig::getActiveBorders() { if (active_desktop->isChecked()) { return active_move->isChecked() ? 1 : 2; @@ -869,16 +758,15 @@ int KAdvancedConfig::getActiveBorders() return 0; } -int KAdvancedConfig::getActiveBorderDelay() -{ +int KActiveBorderConfig::getActiveBorderDelay() { return delays->value(); } -int KAdvancedConfig::getActiveBorderDistance() { +int KActiveBorderConfig::getActiveBorderDistance() { return distance->value(); } -void KAdvancedConfig::setActiveBorders(int i){ +void KActiveBorderConfig::setActiveBorders(int i) { switch(i) { case 1: @@ -895,18 +783,161 @@ void KAdvancedConfig::setActiveBorders(int i){ active_disable->setChecked(true); break; } - setEBorders(); + updateActiveBorders(); } -void KAdvancedConfig::setActiveBorderDelay(int delay) +void KActiveBorderConfig::setActiveBorderDelay(int delay) { delays->setValue(delay); } -void KAdvancedConfig::setActiveBorderDistance(int d) { +void KActiveBorderConfig::setActiveBorderDistance(int d) { distance->setValue(d); } +KAdvancedConfig::~KAdvancedConfig () +{ + if (standAlone) + delete config; +} + +KAdvancedConfig::KAdvancedConfig (bool _standAlone, TDEConfig *_config, TQWidget *parent, const char *) + : TDECModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) +{ + TQString wtstr; + TQBoxLayout *lay = new TQVBoxLayout (this, 0, KDialog::spacingHint()); + + //iTLabel = new TQLabel(i18n(" Allowed overlap:\n" + // "(% of desktop space)"), + // plcBox); + //iTLabel->setAlignment(AlignTop|AlignHCenter); + //pLay->addWidget(iTLabel,1,1); + + //interactiveTrigger = new TQSpinBox(0, 500, 1, plcBox); + //pLay->addWidget(interactiveTrigger,1,2); + + //pLay->addRowSpacing(2,KDialog::spacingHint()); + + //lay->addWidget(plcBox); + + shBox = new TQVButtonGroup(i18n("Shading"), this); + + animateShade = new TQCheckBox(i18n("Anima&te"), shBox); + TQWhatsThis::add(animateShade, i18n("Animate the action of reducing the window to its titlebar (shading)" + " as well as the expansion of a shaded window") ); + + shadeHoverOn = new TQCheckBox(i18n("&Enable hover"), shBox); + + connect(shadeHoverOn, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(shadeHoverChanged(bool))); + + shadeHover = new KIntNumInput(500, shBox); + shadeHover->setLabel(i18n("Dela&y:"), Qt::AlignVCenter|Qt::AlignLeft); + shadeHover->setRange(0, 3000, 100, true); + shadeHover->setSteps(100, 100); + shadeHover->setSuffix(i18n(" msec")); + + TQWhatsThis::add(shadeHoverOn, i18n("If Shade Hover is enabled, a shaded window will un-shade automatically " + "when the mouse pointer has been over the title bar for some time.")); + + wtstr = i18n("Sets the time in milliseconds before the window unshades " + "when the mouse pointer goes over the shaded window."); + TQWhatsThis::add(shadeHover, wtstr); + + lay->addWidget(shBox); + + // Any changes goes to slotChanged() + connect(animateShade, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); + connect(shadeHoverOn, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); + connect(shadeHover, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(changed())); + + hideUtilityWindowsForInactive = new TQCheckBox( i18n( "Hide utility windows for inactive applications" ), this ); + TQWhatsThis::add( hideUtilityWindowsForInactive, + i18n( "When turned on, utility windows (tool windows, torn-off menus,...) of inactive applications will be" + " hidden and will be shown only when the application becomes active. Note that applications" + " have to mark the windows with the proper window type for this feature to work." )); + connect(hideUtilityWindowsForInactive, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); + lay->addWidget( hideUtilityWindowsForInactive ); + + lay->addStretch(); + + load(); + +} + +void KAdvancedConfig::setShadeHover(bool on) { + shadeHoverOn->setChecked(on); + shadeHover->setEnabled(on); +} + +void KAdvancedConfig::setShadeHoverInterval(int k) { + shadeHover->setValue(k); +} + +int KAdvancedConfig::getShadeHoverInterval() { + + return shadeHover->value(); +} + +void KAdvancedConfig::shadeHoverChanged(bool a) { + shadeHover->setEnabled(a); +} + +void KAdvancedConfig::setAnimateShade(bool a) { + animateShade->setChecked(a); +} + +void KAdvancedConfig::setHideUtilityWindowsForInactive(bool s) { + hideUtilityWindowsForInactive->setChecked( s ); +} + +void KAdvancedConfig::load( void ) +{ + config->setGroup( "Windows" ); + + setAnimateShade(config->readBoolEntry(KWIN_ANIMSHADE, true)); + setShadeHover(config->readBoolEntry(KWIN_SHADEHOVER, false)); + setShadeHoverInterval(config->readNumEntry(KWIN_SHADEHOVER_INTERVAL, 250)); + + setHideUtilityWindowsForInactive( config->readBoolEntry( KWIN_HIDE_UTILITY, true )); + + emit TDECModule::changed(false); +} + +void KAdvancedConfig::save( void ) +{ + int v; + + config->setGroup( "Windows" ); + config->writeEntry(KWIN_ANIMSHADE, animateShade->isChecked()); + if (shadeHoverOn->isChecked()) + config->writeEntry(KWIN_SHADEHOVER, "on"); + else + config->writeEntry(KWIN_SHADEHOVER, "off"); + + v = getShadeHoverInterval(); + if (v<0) v = 0; + config->writeEntry(KWIN_SHADEHOVER_INTERVAL, v); + config->writeEntry(KWIN_HIDE_UTILITY, hideUtilityWindowsForInactive->isChecked()); + + if (standAlone) + { + config->sync(); + if ( !kapp->dcopClient()->isAttached() ) + kapp->dcopClient()->attach(); + kapp->dcopClient()->send("twin*", "", "reconfigure()", TQString("")); + } + emit TDECModule::changed(false); +} + +void KAdvancedConfig::defaults() +{ + setAnimateShade(true); + setShadeHover(false); + setShadeHoverInterval(250); + setHideUtilityWindowsForInactive( true ); + emit TDECModule::changed(true); +} + KMovingConfig::~KMovingConfig () { if (standAlone) |