diff options
Diffstat (limited to 'src/main_window.cpp')
-rw-r--r-- | src/main_window.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/main_window.cpp b/src/main_window.cpp new file mode 100644 index 0000000..796b4fc --- /dev/null +++ b/src/main_window.cpp @@ -0,0 +1,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 |