-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartservers.cpp
More file actions
65 lines (53 loc) · 1.6 KB
/
startservers.cpp
File metadata and controls
65 lines (53 loc) · 1.6 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
#include "startservers.h"
#include "ui_startservers.h"
#include <stdlib.h>
#include <iostream>
#include "servermanager.h"
CStartServers::CStartServers(QWidget *parent) :
QDialog(parent),
CLogable("StartServerDialogLog"),
ui(new Ui::StartServers)
{
ui->setupUi(this);
}
CStartServers::~CStartServers()
{
delete ui;
}
void CStartServers::show()
{
std::string errMsg("");
ui->comboBox->clear();
auto data = std::move(CServerManager::getReference().getTableData());
ui->comboBox->addItem("All", QVariant(-1));
for (auto& outer : data)
{
if (ui->comboBox->findText(outer.second[CServerManager::SERVER_NAME]) == -1)
{
//qDebug() << "the status is: " << outer.second["Status"];
LOGGER_HELPER(DEBUG, errMsg, QString("the status is "), outer.second["Status"]);
if (outer.second[CServerManager::STATUS] == CServerManager::DEACTIVE)
{
ui->comboBox->addItem(outer.second[CServerManager::SERVER_NAME], QVariant(outer.first));
}
}
}
QDialog::show();
}
void CStartServers::on_pushButton_clicked()
{
std::string errMsg("");
auto currVal = ui->comboBox->currentData().toString();
(currVal == "-1") ? currVal = "All" : "";
//qDebug() << "Strting server: [ " << currVal << "]";
LOGGER_HELPER(DEBUG, errMsg, "Starting server: [ ", currVal ," ]");
if (currVal == "All")
{
CServerManager::getReference().startAll();
}
else //we just need to start one server
{
CServerManager::getReference().startClient(currVal.toInt());
}
hide();
}