-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreferences_dialog.cpp
58 lines (47 loc) · 1.7 KB
/
preferences_dialog.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <QMainWindow>
#include <QObject>
#include "preferences_dialog.h"
#include "ui_preferences_dialog.h"
#include "mainwindow.h"
Preferences_Dialog::Preferences_Dialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::Preferences_Dialog)
{
ui->setupUi(this);
// Set checkboxes to reflect configuration file status.
MainWindow myObj;
if (myObj.g_NetworkAccessPermission == true){
ui->checkBox_Allow->setChecked(true);
}else ui->checkBox_Allow->setChecked(false);
if (myObj.g_NetworkAccessDontAskAgain== true){
ui->checkBox_DontAsk->setChecked(true);
}else ui->checkBox_DontAsk->setChecked(false);
}
Preferences_Dialog::~Preferences_Dialog()
{
delete ui;
}
void Preferences_Dialog::on_buttonBox_accepted()
{
qDebug() << "OK Selected in Preferences_Dialog";
bool allow = ui->checkBox_Allow->isChecked();
qDebug() << "allow = " << allow;
bool dontAsk = ui->checkBox_DontAsk->isChecked();
qDebug() << "dontAsk = " << dontAsk;
MainWindow myObj;
myObj.parseConfigFile("NetworkAccessPermission ", true, allow);
myObj.parseConfigFile("NetworkAccessAsked ", true, true);
myObj.parseConfigFile("NetworkAccessDontAskAgain ", true, dontAsk);
myObj.setConfigGlobals();
done(1); //closes dialog and returns int "1"?
qDebug() << "In runAtStart g_NetworkAccessPermission = "
<< myObj.g_NetworkAccessPermission;
qDebug() << "In runAtStart g_NetworkAccessAsked = "
<< myObj.g_NetworkAccessAsked;
qDebug() << "In runAtStart g_NetworkAccessDontAskAgain = "
<< myObj.g_NetworkAccessDontAskAgain;
}
void Preferences_Dialog::on_buttonBox_rejected()
{
done(2); //closes dialog and returns int "2"?
}