-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
105 lines (89 loc) · 2.49 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "customlogger.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
analogClock = 0;
tabDialog = 0;
customDialog = 0;
controller = 0;
createActions();
createMenus();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::createTab()
{
customLog(DEBUG, "createTab()");
}
void MainWindow::showMainWidget()
{
customLog(DEBUG, "analogClock = %p", analogClock);
if (analogClock == 0)
{
analogClock = new AnalogClock(this);
setCentralWidget(analogClock);
}
analogClock->show();
}
void MainWindow::clear()
{
if (analogClock != 0)
analogClock->hide();
customLog(DEBUG, "analogClock = %p", analogClock);
}
void MainWindow::createActions()
{
createTabAct = new QAction(tr("&Create Tab"), this);
createTabAct->setShortcut(QKeySequence::Open);
connect(createTabAct, SIGNAL(triggered()), this, SLOT(createTab()));
showAct = new QAction(tr("&Show Widget"), this);
showAct->setShortcut(tr("Ctrl+S"));
connect(showAct, SIGNAL(triggered()), this, SLOT(showMainWidget()));
clearAct = new QAction(tr("&Clear"), this);
clearAct->setShortcut(tr("Ctrl+C"));
connect(clearAct, SIGNAL(triggered()), this, SLOT(clear()));
exitAct = new QAction(tr("&Exit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
}
void MainWindow::createMenus()
{
fileMenu = new QMenu(tr("&File"), this);
fileMenu->addAction(createTabAct);
fileMenu->addSeparator();
fileMenu->addAction(showAct);
fileMenu->addAction(clearAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);
menuBar()->addMenu(fileMenu);
helpMenu = new QMenu(tr("&Help"), this);
menuBar()->addMenu(helpMenu);
}
void MainWindow::on_actionShow_sample_dialog_triggered()
{
tabDialog = new TabDialog("test file name", this);
tabDialog->show();
}
void MainWindow::on_actionCreate_Custom_Dialog_triggered()
{
customDialog = new CustomDialog(this);
customDialog->show();
}
void MainWindow::on_actionCreate_Wizard_Page_triggered()
{
SimpleWizard *testWizard = new SimpleWizard();
testWizard->buildWizardPages();
testWizard->show();
}
void MainWindow::on_actionCreate_Controller_triggered()
{
customLog(DEBUG, "on_actionCreate_Controller_triggered()");
controller = new ControllerWindow();
controller->show();
}