forked from slawkens/otadmin-plus-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.cpp
65 lines (47 loc) · 1.77 KB
/
settings.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
58
59
60
61
62
63
64
65
//#include <QtWidgets>
#include <QSettings>
#include "mainwindow.h"
void MainWindow::readSettings()
{
QSettings settings(QApplication::applicationDirPath() + "/otadmin.ini", QSettings::IniFormat);
settings.beginGroup("main");
//QMessageBox::information(this, "PATH TEST", QDir::currentPath());
//QMessageBox::information(this, "PATH TEST222", QApplication::applicationDirPath());
QString style = settings.value("style", "Cleanlooks").toString();
QList<QAction*> actions = stylesMenu->actions();
foreach(QAction* action, actions)
{
if(action->text() == style)
action->setChecked(true);
}
currentStyle = style;
changeStyle(style);
QString styleSheet = settings.value("stylesheet", "").toString();
currentStyleSheet = styleSheet;
// changeStyleSheet(styleSheet);
move(settings.value("pos", QPoint(100, 80)).toPoint());
resize(settings.value("size", QSize(280, 160)).toSize());
displayTrayNotify = settings.value("trayNotify", true).toBool();
settings.endGroup();
settings.beginGroup("lastserver");
hostEdit->setText(settings.value("host", "localhost").toString());
portEdit->setValue(settings.value("port", "7171").toInt());
//passwordEdit->setText(settings.value("password", "test").toString());
settings.endGroup();
}
void MainWindow::writeSettings()
{
QSettings settings;
settings.beginGroup("main");
settings.setValue("style", currentStyle);
// settings.setValue("stylesheet", currentStyleSheet);
settings.setValue("pos", pos());
settings.setValue("size", size());
settings.setValue("trayNotify", displayTrayNotify);
settings.endGroup();
settings.beginGroup("lastserver");
settings.setValue("host", hostEdit->text());
settings.setValue("port", portEdit->value());
//settings.setValue("password", passwordEdit->text());
settings.endGroup();
}