#include "main_window.hpp" #include 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