Changeset View
Changeset View
Standalone View
Standalone View
kcmodule/global/GeneralPage.cpp
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 91 | { | |||
---|---|---|---|---|---|
119 | connect(notificationsButton, SIGNAL(clicked()), SLOT(configureNotifications())); | 119 | connect(notificationsButton, SIGNAL(clicked()), SLOT(configureNotifications())); | ||
120 | 120 | | |||
121 | connect(lowSpin, SIGNAL(valueChanged(int)), SLOT(changed())); | 121 | connect(lowSpin, SIGNAL(valueChanged(int)), SLOT(changed())); | ||
122 | connect(criticalSpin, SIGNAL(valueChanged(int)), SLOT(changed())); | 122 | connect(criticalSpin, SIGNAL(valueChanged(int)), SLOT(changed())); | ||
123 | connect(lowPeripheralSpin, SIGNAL(valueChanged(int)), SLOT(changed())); | 123 | connect(lowPeripheralSpin, SIGNAL(valueChanged(int)), SLOT(changed())); | ||
124 | 124 | | |||
125 | connect(BatteryCriticalCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed())); | 125 | connect(BatteryCriticalCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed())); | ||
126 | 126 | | |||
127 | connect(pausePlayersCheckBox, &QCheckBox::stateChanged, this, static_cast<void(KCModule::*)()>(&KCModule::changed)); | ||||
128 | | ||||
127 | if (!hasPowerSupplyBattery) { | 129 | if (!hasPowerSupplyBattery) { | ||
128 | BatteryCriticalLabel->hide(); | 130 | BatteryCriticalLabel->hide(); | ||
129 | BatteryCriticalCombo->hide(); | 131 | BatteryCriticalCombo->hide(); | ||
130 | lowLabel->hide(); | 132 | lowLabel->hide(); | ||
131 | lowSpin->hide(); | 133 | lowSpin->hide(); | ||
132 | criticalLabel->hide(); | 134 | criticalLabel->hide(); | ||
133 | criticalSpin->hide(); | 135 | criticalSpin->hide(); | ||
134 | } | 136 | } | ||
Show All 10 Lines | |||||
145 | 147 | | |||
146 | void GeneralPage::load() | 148 | void GeneralPage::load() | ||
147 | { | 149 | { | ||
148 | lowSpin->setValue(PowerDevilSettings::batteryLowLevel()); | 150 | lowSpin->setValue(PowerDevilSettings::batteryLowLevel()); | ||
149 | criticalSpin->setValue(PowerDevilSettings::batteryCriticalLevel()); | 151 | criticalSpin->setValue(PowerDevilSettings::batteryCriticalLevel()); | ||
150 | lowPeripheralSpin->setValue(PowerDevilSettings::peripheralBatteryLowLevel()); | 152 | lowPeripheralSpin->setValue(PowerDevilSettings::peripheralBatteryLowLevel()); | ||
151 | 153 | | |||
152 | BatteryCriticalCombo->setCurrentIndex(BatteryCriticalCombo->findData(PowerDevilSettings::batteryCriticalAction())); | 154 | BatteryCriticalCombo->setCurrentIndex(BatteryCriticalCombo->findData(PowerDevilSettings::batteryCriticalAction())); | ||
155 | | ||||
156 | pausePlayersCheckBox->setChecked(PowerDevilSettings::pausePlayersOnSuspend()); | ||||
153 | } | 157 | } | ||
154 | 158 | | |||
155 | void GeneralPage::configureNotifications() | 159 | void GeneralPage::configureNotifications() | ||
156 | { | 160 | { | ||
157 | KNotifyConfigWidget::configure(this, "powerdevil"); | 161 | KNotifyConfigWidget::configure(this, "powerdevil"); | ||
158 | } | 162 | } | ||
159 | 163 | | |||
160 | void GeneralPage::save() | 164 | void GeneralPage::save() | ||
161 | { | 165 | { | ||
162 | PowerDevilSettings::setBatteryLowLevel(lowSpin->value()); | 166 | PowerDevilSettings::setBatteryLowLevel(lowSpin->value()); | ||
163 | PowerDevilSettings::setBatteryCriticalLevel(criticalSpin->value()); | 167 | PowerDevilSettings::setBatteryCriticalLevel(criticalSpin->value()); | ||
164 | PowerDevilSettings::setPeripheralBatteryLowLevel(lowPeripheralSpin->value()); | 168 | PowerDevilSettings::setPeripheralBatteryLowLevel(lowPeripheralSpin->value()); | ||
165 | 169 | | |||
166 | PowerDevilSettings::setBatteryCriticalAction(BatteryCriticalCombo->itemData(BatteryCriticalCombo->currentIndex()).toInt()); | 170 | PowerDevilSettings::setBatteryCriticalAction(BatteryCriticalCombo->itemData(BatteryCriticalCombo->currentIndex()).toInt()); | ||
167 | 171 | | |||
172 | PowerDevilSettings::setPausePlayersOnSuspend(pausePlayersCheckBox->checkState() == Qt::Checked); | ||||
173 | | ||||
168 | PowerDevilSettings::self()->save(); | 174 | PowerDevilSettings::self()->save(); | ||
169 | 175 | | |||
170 | // Notify Daemon | 176 | // Notify Daemon | ||
171 | QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", | 177 | QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", | ||
172 | "org.kde.Solid.PowerManagement", "refreshStatus"); | 178 | "org.kde.Solid.PowerManagement", "refreshStatus"); | ||
173 | 179 | | |||
174 | // Perform call | 180 | // Perform call | ||
175 | QDBusConnection::sessionBus().asyncCall(call); | 181 | QDBusConnection::sessionBus().asyncCall(call); | ||
Show All 34 Lines |