2 * QCPUFreq - a simple cpufreq GUI
3 * Copyright (C) 2010 Daniel Klaffenbach <danielklaffenbach@gmail.com>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "settingswidget.h"
21 #include "ui_settingswidget.h"
24 SettingsWidget::SettingsWidget(QWidget *parent) :
27 ui(new Ui::SettingsWidget)
31 //read values from config file
32 autoRotate = settings.value("main/autorotate", true).toBool();
33 overclocking = settings.value("main/overclocking", false).toBool();
34 advancedTemperature = settings.value("main/advanced_temperature", true).toBool();
39 connect(ui->btn_save, SIGNAL(clicked()), this, SLOT(save()));
42 SettingsWidget::~SettingsWidget()
49 * Resets the UI to the values stored by QSettings.
51 void SettingsWidget::reset()
53 ui->checkBox_rotate->setChecked(autoRotate);
54 ui->checkBox_oc->setChecked(overclocking);
55 ui->checkBox_temperature->setChecked(advancedTemperature);
60 * Saves the changes and hides the SettingsWidget.
62 void SettingsWidget::save()
64 autoRotate = ui->checkBox_rotate->isChecked();
65 overclocking = ui->checkBox_oc->isChecked();
66 advancedTemperature = ui->checkBox_temperature->isChecked();
68 settings.setValue("main/autorotate", autoRotate);
69 settings.setValue("main/overclocking", overclocking);
70 settings.setValue("main/advanced_temperature", advancedTemperature);
72 //save settings to file