-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettingswindow.cpp
More file actions
57 lines (44 loc) · 1.8 KB
/
settingswindow.cpp
File metadata and controls
57 lines (44 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "settingswindow.h"
settingsWindow::settingsWindow() : QDialog(0,0), ui(new Ui::options){
ui->setupUi(this);
this->setWindowTitle("Configure");
comboBoxCCompiler = this->findChild<QComboBox *> ("ComboBoxCompiler");
comboBoxSpinCmd = this->findChild<QComboBox *> ("comboBoxSpin");
browseC = this->findChild<QPushButton *> ("pushButtonCompiler");
browseSpin = this->findChild<QPushButton *> ("pushButtonSpin");
connect(browseC, SIGNAL(clicked()), this, SLOT(browseForCompiler()));
connect(browseSpin, SIGNAL(clicked()), this, SLOT(browseForSpin()));
QSettings settings;
QString compiler = settings.value("settings/compiler",CCOMPILER).toString();
QString spin = settings.value("settings/spin",SPIN).toString();
comboBoxCCompiler->addItem(compiler);
comboBoxSpinCmd->addItem(spin);
}
void settingsWindow::saveSettings() {
QSettings settings;
settings.setValue("settings/compiler",comboBoxCCompiler->currentText());
settings.setValue("settings/spin",comboBoxSpinCmd->currentText());
}
QString settingsWindow::getCompiler() {
return comboBoxCCompiler->currentText();
}
QString settingsWindow::getSpin() {
return comboBoxSpinCmd->currentText();
}
void settingsWindow::browseForCompiler() {
QString path = browse();
if (path!=NULL) {
comboBoxCCompiler->addItem(path);
comboBoxCCompiler->setCurrentIndex(comboBoxCCompiler->currentIndex()+1);
}
}
void settingsWindow::browseForSpin() {
QString path = browse();
if (path!=NULL) {
comboBoxSpinCmd->addItem(path);
comboBoxSpinCmd->setCurrentIndex(comboBoxSpinCmd->currentIndex()+1);
}
}
QString settingsWindow::browse() {
return QFileDialog::getOpenFileName(this, tr("Browse"),"",tr("All Files (*);;.exe Files (*.exe)"));
}