-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
84 lines (77 loc) · 2.31 KB
/
mainwindow.cpp
File metadata and controls
84 lines (77 loc) · 2.31 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "session.h"
#include "qmessagebox.h"
#include "polsettings.h"
#include "qsettings.h"
#include "polcopy.h"
#include "polxmlparser.h"
#include "qdir.h"
#include "polruntool.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
mRunner(NULL)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void MainWindow::on_pushButton_clicked()
{
//Get the config.xml file
this->setCursor(Qt::WaitCursor);
QSettings settings;
QString locPath = settings.value("local","").toString();
if (locPath.isEmpty()) {
QMessageBox::information(this,"Path issue","Please configure local path");
return;
}
//Copy config file
if (!PolCopy::copyFromServer("config.xml",locPath)) {
//Check if there is a config file already available.
QDir local(locPath);
if (local.exists("config.xml")) {
QMessageBox::warning(this,"Warning","Unable to retrieve config.xml from server. Session will use an older local copy if it");
}else {
QMessageBox::information(this,"Error","Tools config file was not found. Make sure you have set all paths correctly or contact your ToolBox administrator");
}
}
this->setCursor(Qt::ArrowCursor);
//Parse config file
PolXMLParser* myParser = new PolXMLParser(locPath+"config.xml");
QStringList all = myParser->getToolsList();
ui->listWidget_available->addItems(all);
delete myParser;
}
void MainWindow::on_actionSettings_triggered()
{
PolSettings* sett = new PolSettings(this);
sett->exec();
}
void MainWindow::on_listWidget_available_doubleClicked(QModelIndex index)
{
QString appName = ui->listWidget_available->selectedItems().at(0)->text();
if (mRunner != NULL) {
//Remove previous run options
ui->verticalLayout->removeWidget(mRunner);
delete mRunner;
mRunner = NULL;
}
mRunner = new PolRunTool(this,appName);
mRunner->setObjectName(QString::fromUtf8("runOptions"));
ui->verticalLayout->addWidget(mRunner,1);
}