Add a dialog for loading a kernel-config preset
[qcpufreq] / src / loadpreset.cpp
1 /*
2  * QCPUFreq - a simple cpufreq GUI
3  * Copyright (C) 2010 Daniel Klaffenbach <danielklaffenbach@gmail.com>
4  *
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.
9  *
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.
14  *
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/>.
17  */
18
19 #include "loadpreset.h"
20 #include "ui_loadpreset.h"
21
22 LoadPreset::LoadPreset(QWidget *parent) :
23     QDialog(parent),
24     ui(new Ui::LoadPreset)
25 {
26     ui->setupUi(this);
27
28     connect(ui->loadDefault, SIGNAL(toggled()), this, SLOT(buttonPressed("loadDefault")));
29     connect(ui->loadIdeal, SIGNAL(toggled()), this, SLOT(buttonPressed("loadIdeal")));
30     connect(ui->loadLV, SIGNAL(toggled()), this, SLOT(buttonPressed("loadLV")));
31     connect(ui->loadULV, SIGNAL(toggled()), this, SLOT(buttonPressed("loadULV")));
32     connect(ui->loadXLV, SIGNAL(toggled()), this, SLOT(buttonPressed("loadXLV")));
33     connect(ui->loadCustom, SIGNAL(toggled()), this, SLOT(buttonPressed("loadCustom")));
34
35 }
36
37 LoadPreset::~LoadPreset()
38 {
39     delete ui;
40 }
41
42
43 /**
44   * This slot is called when a button was pressed. It takes care of emmiting
45   * the "load" signal. The load signal will contain the actual name of the
46   * preset which needs to be loaded.
47   *
48   * @emits: load(QString)
49   */
50 void LoadPreset::buttonPressed(QString buttonName)
51 {
52     if (buttonName == "loadDefault") {
53         emit load("default");
54     } else if (buttonName == "loadIdeal") {
55         emit load("ideal");
56     } else if (buttonName == "loadLV") {
57         emit load("lv");
58     } else if (buttonName == "loadULV") {
59         emit load("ulv");
60     } else if (buttonName == "loadXLV")
61         emit load("xlv");
62     } else if (buttonName == "loadCustom") {
63         emit load("custom");
64     }
65 }