This repository has been archived by the owner on Jan 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
executable file
·58 lines (44 loc) · 1.73 KB
/
mainwindow.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
#include "mainwindow.h"
#include <QFile>
#include <QMenuBar>
#include <QStyle>
#include "log.h"
#include <QToolBar>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
setWindowIconText("Config MiNET");
setWindowIcon(QIcon("minet.png"));
mLog = new Log("log.log", this);
mGridLayout = new QGridLayout;
mWiredConnectionButton = new QPushButton(tr("Wired Connection"));
mWiredConnectionWindow = new WiredConnectionWindow(mLog);
setCentralWidget(new QWidget);
centralWidget()->setLayout(mGridLayout);
mGridLayout->addWidget(mWiredConnectionButton);
connect(mWiredConnectionButton, SIGNAL(clicked()), mWiredConnectionWindow, SLOT(show()));
connect(menuBar()->addAction(tr("Help")), SIGNAL(triggered()), this, SLOT(helpWindow()));
}
void MainWindow::helpWindow(void)
{
QMessageBox::information(this, tr("Help"), tr("You have to choose between \"Wired connexion\" and \"Wireless connexion\" (not implemented yet).\n\n"
"You have to enter your MiNET Login and MiNET password, not the DISI ones, and press Launch.\n\n"
"When all prompts are closed, you can leave the application, and your computer should be configured.\n"));
}
MainWindow::~MainWindow()
{
delete mWiredConnectionWindow;
}
QString exec_command(QString const &command, Log *log)
{
QString newCommand = "chcp 65001 && " + command + " >tmp";
QString ret;
system(newCommand.toLatin1());
QFile tmp("tmp");
tmp.open(QIODevice::ReadOnly);
ret = log->write(command, tmp.readAll());
tmp.close();
remove("tmp");
return ret;
}