forked from adaburrows/C---QT-Geoloqi-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
44 lines (40 loc) · 1.2 KB
/
Copy pathmainwindow.cpp
File metadata and controls
44 lines (40 loc) · 1.2 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
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
settings = new QSettings("ModernTwinPowers", "geoeater");
authdialog = new AuthDialog();
connect(authdialog->saveSettingsButton,SIGNAL(clicked()),this,SLOT(authSave()));
readSettings();
manager = new NetManager();
editMenu = menuBar()->addMenu("Edit");
editAuthKey = new QAction(tr("Edit Auth Key"),this);
connect(editAuthKey,SIGNAL(triggered()),this,SLOT(showAuthDialog()));
editMenu->addAction(editAuthKey);
loc_his = new LocHisWidget();
NetTracker *loc_his_tracker = loc_his->tracker;
loc_his_tracker->setManager(manager);
loc_his_tracker->setToken(permanent_token);
setCentralWidget(loc_his);
}
void MainWindow::readSettings()
{
if(!settings->contains("authkey")){
authdialog->show();
}
else
{
permanent_token = settings->value("authkey").toString();
authdialog->authEdit->setText(permanent_token);
}
}
void MainWindow::showAuthDialog()
{
authdialog->show();
}
void MainWindow::authSave()
{
permanent_token = authdialog->authEdit->text();
settings->setValue("authkey",permanent_token);
authdialog->hide();
}