-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathremoveprofiledialog.cpp
More file actions
51 lines (44 loc) · 1.06 KB
/
removeprofiledialog.cpp
File metadata and controls
51 lines (44 loc) · 1.06 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
#include <QSettings>
#include "removeprofiledialog.h"
#include "ui_removeprofiledialog.h"
RemoveProfileDialog::RemoveProfileDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::RemoveProfileDialog)
{
ui->setupUi(this);
load();
}
void RemoveProfileDialog::load()
{
QSettings settings;
QString prof = settings.value("current-profile", "").toString();
settings.beginGroup("Profiles");
QStringList list = settings.childGroups();
settings.endGroup();
ui->listWidget->clear();
foreach(QString s, list) {
if (s != prof) {
ui->listWidget->addItem(s);
}
}
ui->btnRemove->setEnabled(false);
}
RemoveProfileDialog::~RemoveProfileDialog()
{
delete ui;
}
void RemoveProfileDialog::on_btnRemove_clicked()
{
QString s = ui->listWidget->currentItem()->text();
QSettings settings;
settings.remove("Profiles/" + s);
load();
}
void RemoveProfileDialog::on_btnCancel_clicked()
{
accept();
}
void RemoveProfileDialog::on_listWidget_itemSelectionChanged()
{
ui->btnRemove->setEnabled(true);
}