summaryrefslogtreecommitdiff
path: root/src/main_window.cpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-09-16 11:19:28 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-09-16 11:19:28 -0500
commit107d96690b37a6e4803f02117f22244d53c56706 (patch)
tree2358888bec7870d90da37bde6870c50a477eeafb /src/main_window.cpp
Initial commit
Diffstat (limited to 'src/main_window.cpp')
-rw-r--r--src/main_window.cpp66
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