diff options
Diffstat (limited to 'kcontrol')
-rw-r--r-- | kcontrol/displayconfig/displayconfig.cpp | 60 | ||||
-rw-r--r-- | kcontrol/displayconfig/displayconfig.h | 5 | ||||
-rw-r--r-- | kcontrol/displayconfig/displayconfigbase.ui | 166 |
3 files changed, 230 insertions, 1 deletions
diff --git a/kcontrol/displayconfig/displayconfig.cpp b/kcontrol/displayconfig/displayconfig.cpp index 3498327b0..ad2d31fff 100644 --- a/kcontrol/displayconfig/displayconfig.cpp +++ b/kcontrol/displayconfig/displayconfig.cpp @@ -761,6 +761,13 @@ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStrin connect(base->gammaBlueSlider, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(gammaBlueSliderChanged(int))); connect(base->monitorDisplaySelectDD, TQT_SIGNAL(activated(int)), TQT_SLOT(selectScreen(int))); connect(base->gammamonitorDisplaySelectDD, TQT_SIGNAL(activated(int)), TQT_SLOT(gammaselectScreen(int))); + connect(base->systemEnableDPMS, TQT_SIGNAL(clicked()), TQT_SLOT(dpmsChanged())); + connect(base->systemEnableDPMSStandby, TQT_SIGNAL(clicked()), TQT_SLOT(dpmsChanged())); + connect(base->systemEnableDPMSSuspend, TQT_SIGNAL(clicked()), TQT_SLOT(dpmsChanged())); + connect(base->systemEnableDPMSPowerDown, TQT_SIGNAL(clicked()), TQT_SLOT(dpmsChanged())); + connect(base->dpmsStandbyTimeout, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dpmsChanged())); + connect(base->dpmsSuspendTimeout, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dpmsChanged())); + connect(base->dpmsPowerDownTimeout, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dpmsChanged())); connect(base->monitorPhyArrange, TQT_SIGNAL(workspaceRelayoutNeeded()), this, TQT_SLOT(layoutDragDropDisplay())); connect(base->isPrimaryMonitorCB, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); @@ -1014,6 +1021,17 @@ void KDisplayConfig::refreshDisplayedInformation () { updateDisplayedInformation(); updateDragDropDisplay(); + + screendata = m_screenInfoArray.at(0); + base->systemEnableDPMS->setEnabled(screendata->has_dpms); + base->systemEnableDPMS->setChecked(screendata->enable_dpms); + base->systemEnableDPMSStandby->setChecked(screendata->dpms_standby_delay!=0); + base->systemEnableDPMSSuspend->setChecked(screendata->dpms_suspend_delay!=0); + base->systemEnableDPMSPowerDown->setChecked(screendata->dpms_off_delay!=0); + base->dpmsStandbyTimeout->setValue(screendata->dpms_standby_delay/60); + base->dpmsSuspendTimeout->setValue(screendata->dpms_suspend_delay/60); + base->dpmsPowerDownTimeout->setValue(screendata->dpms_off_delay/60); + processDPMSControls(); } void KDisplayConfig::updateDragDropDisplay() { @@ -1322,21 +1340,63 @@ void KDisplayConfig::gammaTargetChanged (int slotNumber) { base->gammaTestImage->setBackgroundPixmap( gammaPixmap ); } +void KDisplayConfig::dpmsChanged() { + SingleScreenData *screendata; + screendata = m_screenInfoArray.at(0); + + processDPMSControls(); + + screendata->enable_dpms = base->systemEnableDPMS->isChecked(); + screendata->dpms_standby_delay = (base->systemEnableDPMSStandby->isChecked())?base->dpmsStandbyTimeout->value()*60:0; + screendata->dpms_suspend_delay = (base->systemEnableDPMSSuspend->isChecked())?base->dpmsSuspendTimeout->value()*60:0; + screendata->dpms_off_delay = (base->systemEnableDPMSPowerDown->isChecked())?base->dpmsPowerDownTimeout->value()*60:0; + + changed(); +} + +void KDisplayConfig::processDPMSControls() { + if (base->systemEnableDPMS->isChecked()) { + base->systemEnableDPMSStandby->setEnabled(true); + base->systemEnableDPMSSuspend->setEnabled(true); + base->systemEnableDPMSPowerDown->setEnabled(true); + base->dpmsStandbyTimeout->setEnabled(base->systemEnableDPMSStandby->isChecked()); + base->dpmsSuspendTimeout->setEnabled(base->systemEnableDPMSSuspend->isChecked()); + base->dpmsPowerDownTimeout->setEnabled(base->systemEnableDPMSPowerDown->isChecked()); + } + else { + base->systemEnableDPMSStandby->setEnabled(false); + base->systemEnableDPMSSuspend->setEnabled(false); + base->systemEnableDPMSPowerDown->setEnabled(false); + base->dpmsStandbyTimeout->setEnabled(false); + base->dpmsSuspendTimeout->setEnabled(false); + base->dpmsPowerDownTimeout->setEnabled(false); + } + + if (base->systemEnableDPMSStandby->isChecked()) base->dpmsSuspendTimeout->setMinValue(base->dpmsStandbyTimeout->value()); + else base->dpmsSuspendTimeout->setMinValue(1); + if (base->systemEnableDPMSSuspend->isChecked()) base->dpmsPowerDownTimeout->setMinValue(base->dpmsSuspendTimeout->value()); + else if (base->systemEnableDPMSStandby->isChecked()) base->dpmsPowerDownTimeout->setMinValue(base->dpmsStandbyTimeout->value()); + else base->dpmsPowerDownTimeout->setMinValue(1); +} + void KDisplayConfig::processLockoutControls() { if (getuid() != 0 || !systemconfig->checkConfigFilesWritable( true )) { base->globalTab->setEnabled(false); base->resolutionTab->setEnabled(false); base->gammaTab->setEnabled(false); + base->powerTab->setEnabled(false); } else { base->globalTab->setEnabled(true); if (base->systemEnableSupport->isChecked()) { base->resolutionTab->setEnabled(true); base->gammaTab->setEnabled(true); + base->powerTab->setEnabled(true); } else { base->resolutionTab->setEnabled(false); base->gammaTab->setEnabled(false); + base->powerTab->setEnabled(false); } } diff --git a/kcontrol/displayconfig/displayconfig.h b/kcontrol/displayconfig/displayconfig.h index cddb8186e..35cf7fa6c 100644 --- a/kcontrol/displayconfig/displayconfig.h +++ b/kcontrol/displayconfig/displayconfig.h @@ -30,6 +30,7 @@ #include <tqworkspace.h> #include <tqobjectlist.h> #include <tqwidgetlist.h> +#include <tqspinbox.h> #include <dcopobject.h> @@ -122,9 +123,11 @@ private slots: void gammaRedSliderChanged(int index); void gammaGreenSliderChanged(int index); void gammaBlueSliderChanged(int index); - void applyGamma(); + void applyGamma (void); void gammaselectScreen (int slotNumber); void gammaTargetChanged (int slotNumber); + void dpmsChanged (void); + void processDPMSControls (void); }; #endif diff --git a/kcontrol/displayconfig/displayconfigbase.ui b/kcontrol/displayconfig/displayconfigbase.ui index a0d73f4e9..a71dca758 100644 --- a/kcontrol/displayconfig/displayconfigbase.ui +++ b/kcontrol/displayconfig/displayconfigbase.ui @@ -55,6 +55,23 @@ </widget> </grid> </widget> + <spacer row="1" column="0"> + <property name="name" stdset="0"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> </grid> </widget> <widget class="TQWidget"> @@ -592,6 +609,155 @@ </grid> </grid> </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>powerTab</cstring> + </property> + <attribute name="title"> + <string>Power Management</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupPowerManagement</cstring> + </property> + <property name="title"> + <string>Energy Star (DPMS)</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox" row="0" column="0" colspan="3"> + <property name="name"> + <cstring>systemEnableDPMS</cstring> + </property> + <property name="text"> + <string>&Enable DPMS power save modes</string> + </property> + </widget> + <spacer row="0" column="3"> + <property name="name" stdset="0"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQCheckBox" row="1" column="0" colspan="1"> + <property name="name"> + <cstring>systemEnableDPMSStandby</cstring> + </property> + <property name="text"> + <string>Enable &standby after</string> + </property> + </widget> + <widget class="TQSpinBox" row="1" column="1" colspan="1"> + <property name="name"> + <cstring>dpmsStandbyTimeout</cstring> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="maxValue"> + <number>360</number> + </property> + </widget> + <widget class="TQLabel" row="1" column="2" colspan="1"> + <property name="name"> + <cstring>textLabel9_1</cstring> + </property> + <property name="text"> + <string>minutes.</string> + </property> + </widget> + <widget class="TQCheckBox" row="2" column="0" colspan="1"> + <property name="name"> + <cstring>systemEnableDPMSSuspend</cstring> + </property> + <property name="text"> + <string>Enable &suspend after</string> + </property> + </widget> + <widget class="TQSpinBox" row="2" column="1" colspan="1"> + <property name="name"> + <cstring>dpmsSuspendTimeout</cstring> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="maxValue"> + <number>360</number> + </property> + </widget> + <widget class="TQLabel" row="2" column="2" colspan="1"> + <property name="name"> + <cstring>textLabel9_2</cstring> + </property> + <property name="text"> + <string>minutes.</string> + </property> + </widget> + <widget class="TQCheckBox" row="3" column="0" colspan="1"> + <property name="name"> + <cstring>systemEnableDPMSPowerDown</cstring> + </property> + <property name="text"> + <string>Enable &power down after</string> + </property> + </widget> + <widget class="TQSpinBox" row="3" column="1" colspan="1"> + <property name="name"> + <cstring>dpmsPowerDownTimeout</cstring> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="maxValue"> + <number>360</number> + </property> + </widget> + <widget class="TQLabel" row="3" column="2" colspan="1"> + <property name="name"> + <cstring>textLabel9_3</cstring> + </property> + <property name="text"> + <string>minutes.</string> + </property> + </widget> + </grid> + </widget> + <spacer row="1" column="0"> + <property name="name" stdset="0"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> </widget> </grid> </widget> |