blob: 796b4fc0467cc08d87d741415431925750118e71 (
plain)
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
|
#include "main_window.hpp"
#include <QString>
namespace getsuyobi {
GetsuyobiApp::GetsuyobiApp() : m_getsuyobi{new Getsuyobi()}
{
setCentralWidget(m_getsuyobi);
setup();
}
void GetsuyobiApp::setup()
{
createActions();
createMenus();
QCoreApplication::setApplicationName(AppName);
QCoreApplication::setApplicationVersion(AppVersionString);
setWindowTitle(AppName);
show();
}
void GetsuyobiApp::createActions()
{
m_openAction = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::DocumentOpen), tr("&Open"), this);
m_openAction->setShortcuts(QKeySequence::Open);
m_openAction->setStatusTip(tr("Open a file"));
connect(m_openAction, &QAction::triggered, this, &GetsuyobiApp::openFile);
m_quitAction = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::ApplicationExit), tr("&Quit"), this);
m_quitAction->setShortcuts(QKeySequence::Quit);
m_quitAction->setStatusTip(tr("Quit"));
connect(m_quitAction, &QAction::triggered, this, &GetsuyobiApp::quit);
}
void GetsuyobiApp::createMenus()
{
m_fileMenu = menuBar()->addMenu(tr("&File"));
m_fileMenu->addAction(m_openAction);
m_fileMenu->addAction(m_quitAction);
}
void GetsuyobiApp::openFile()
{
printf("Open file!\n");
}
void GetsuyobiApp::quit()
{
printf("Quit!\n");
QCoreApplication::quit();
}
Getsuyobi::Getsuyobi()
{
m_layout = new QVBoxLayout();
auto* label = new QLabel(AppName);
m_layout->addWidget(label);
setLayout(m_layout);
}
} // namespace getsuyobi
|