-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
62 lines (48 loc) · 2.5 KB
/
mainwindow.cpp
File metadata and controls
62 lines (48 loc) · 2.5 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
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
/* Widgets */
workspace = new QMdiArea(this);
setCentralWidget(workspace);
tabWidget = new CTabDockWidget(0 , true);
addDockWidget(Qt::LeftDockWidgetArea,tabWidget);
loadWidget = new CLoadPlayersWidget(this);
tabWidget->tabs->addTab(loadWidget, "Players");
mapWidget = new CLoadMapWidget(this);
tabWidget->tabs->addTab(mapWidget, "Map");
gameWidget = new CGameWidget(this);
tabWidget->tabs->addTab(gameWidget, "Game");
info = new CInfoWidget(this);
tabWidget->tabs->addTab(info, "Info");
printer = new CStatusPrinter();
statusWidget = new CStatusWidget(printer );
addDockWidget(Qt::BottomDockWidgetArea, statusWidget);
printer->textBuffer.enqueue(CStatusText("Initializing..."));
statusUpdateTimer = new QTimer();
statusUpdateTimer->setInterval(_RATE);
statusUpdateTimer->start();
knowledge = new CKnowledge(printer);
game = new CGame();
monitorWidget = new CMonitorWidget(this);
monitorWidget->setWindowTitle(tr("Monitor"));
workspace->addSubWindow(monitorWidget, Qt::CustomizeWindowHint | Qt::WindowTitleHint);
monitorWidget->setWindowState(Qt::WindowMaximized );
/* Connections */
connect(statusUpdateTimer, SIGNAL(timeout()), statusWidget, SLOT(update()));
connect(loadWidget->compileButt[0],SIGNAL(clicked()),game,SLOT(compilePlayer1()));
connect(loadWidget->compileButt[1],SIGNAL(clicked()),game,SLOT(compilePlayer2()));
connect(loadWidget->compileButt[2],SIGNAL(clicked()),game,SLOT(compilePlayer3()));
connect(loadWidget->compileButt[3],SIGNAL(clicked()),game,SLOT(compilePlayer4()));
connect(game,SIGNAL(activateTeam1Label(QString)),loadWidget->activeLabels[0],SLOT(setText(QString)));
connect(game,SIGNAL(activateTeam2Label(QString)),loadWidget->activeLabels[1],SLOT(setText(QString)));
connect(game,SIGNAL(activateTeam3Label(QString)),loadWidget->activeLabels[2],SLOT(setText(QString)));
connect(game,SIGNAL(activateTeam4Label(QString)),loadWidget->activeLabels[3],SLOT(setText(QString)));
connect(game,SIGNAL(activateTeam(int,bool)),knowledge,SLOT(activateSlot(int,bool)));
connect(mapWidget,SIGNAL(mapGenerationSignal(int,int,int,int,int)),knowledge,SLOT(generateMap(int,int,int,int,int)));
connect(knowledge,SIGNAL(updateMonitorView()),monitorWidget,SLOT(updateSize()));
connect(gameWidget->playPB,SIGNAL(clicked()),game,SLOT(initiateGame()));
}
MainWindow::~MainWindow()
{
}