-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
48 lines (38 loc) · 1.42 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
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
resize(WINDOW_WIDTH, WINDOW_HEIGHT);
setWindowTitle(WINDOW_TITLE);
setWindowIcon(getFavicon());
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint);
setPalette(getMainPalette());
setCentralWidget(mainWidget);
setStyleSheet(getMainStyle());
loadFonts();
mainWidget->addWidget(mainMenu);
mainWidget->addWidget(learning);
mainWidget->addWidget(training);
mainWidget->addWidget(exam);
mainWidget->addWidget(dictionary);
mainWidget->addWidget(levelChoice);
mainWidget->setCurrentIndex(MAIN_MENU_INDEX);
connect(mainMenu, SIGNAL(changeScene()), this, SLOT(changeScene()));
connect(learning, SIGNAL(changeScene()), this, SLOT(changeScene()));
connect(training, SIGNAL(changeScene()), this, SLOT(changeScene()));
connect(exam, SIGNAL(changeScene()), this, SLOT(changeScene()));
connect(dictionary, SIGNAL(changeScene()), this, SLOT(changeScene()));
connect(levelChoice, SIGNAL(changeScene()), this, SLOT(changeScene()));
connect(mainMenu, SIGNAL(quitProgram()), this, SLOT(quitProgram()));
}
MainWindow::~MainWindow() {}
void MainWindow::changeScene()
{
if(mainWidget->currentIndex() == MAIN_MENU_INDEX) {
mainWidget->setCurrentIndex(mainMenu->nextSceneIndex);
} else mainWidget->setCurrentIndex(MAIN_MENU_INDEX);
}
void MainWindow::quitProgram()
{
close();
}