-
Notifications
You must be signed in to change notification settings - Fork 25
/
optdialog.cpp
41 lines (33 loc) · 987 Bytes
/
optdialog.cpp
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
#include <QPushButton>
#include "optdialog.h"
#include "ui_optdialog.h"
#include "mainwindow.h"
static const char *defpgm = "minipro";
static const char *defed = "binhexedit -r";
OptDialog::OptDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::OptDialog)
{
QSettings settings;
ui->setupUi(this);
ui->exec->setText(settings.value("options/command",defpgm).toString());
ui->editor->setText(settings.value("options/editcmd",defed).toString());
QPushButton *restoreButton = ui->buttonBox->button(QDialogButtonBox::RestoreDefaults);
connect(restoreButton, SIGNAL(clicked()), this, SLOT(restoreDefaults()));
}
OptDialog::~OptDialog()
{
delete ui;
}
void OptDialog::accept()
{
QSettings settings;
settings.setValue("options/command",ui->exec->text());
settings.setValue("options/editcmd",ui->editor->text());
QDialog::accept();
}
void OptDialog::restoreDefaults()
{
ui->exec->setText(defpgm);
ui->editor->setText(defed);
}