diff --git a/CMakeLists.txt b/CMakeLists.txt index cc7acd0..0a64004 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,6 @@ find_package(Qt6 REQUIRED COMPONENTS Widgets) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -# qt_standard_project_setup() file(GLOB_RECURSE SERVER_SOURCES "${CMAKE_SOURCE_DIR}/src/graph/server/*.cpp") file(GLOB_RECURSE SERVER_UI "${CMAKE_SOURCE_DIR}/src/graph/server/*.ui") @@ -46,6 +45,6 @@ qt_wrap_ui(SERVER_GEN_UI ${SERVER_UI}) add_executable(server ${SERVER_SOURCES} ${SERVER_RES} ${SERVER_UI} ${SERVER_HEADERS} ${SERVER_GEN_SRC} ${SERVER_GEN_UI} - ) +) target_link_libraries(server PRIVATE dl Qt6::Widgets) \ No newline at end of file diff --git a/inc/graph/server/gui/mainwindow.h b/inc/graph/server/gui/mainwindow.h index 2eab2a3..d6d21d3 100644 --- a/inc/graph/server/gui/mainwindow.h +++ b/inc/graph/server/gui/mainwindow.h @@ -9,16 +9,17 @@ namespace Ui { class MainWindow; } +namespace Graph::GUI { class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); -private: - QMenuBar *menuBar; - QToolBar *toolbar; - QStatusBar *statusBar; +private slots: + void on_actionExit_triggered(); +private: Ui::MainWindow *ui; -}; \ No newline at end of file +}; +} // namespace Graph::GUI diff --git a/src/graph/server/gui/mainwindow.cpp b/src/graph/server/gui/mainwindow.cpp index 820d95f..5261f66 100644 --- a/src/graph/server/gui/mainwindow.cpp +++ b/src/graph/server/gui/mainwindow.cpp @@ -1,10 +1,15 @@ #include #include -MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { - ui->setupUi(this); +namespace Graph::GUI { +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent), ui(new Ui::MainWindow) { + ui->setupUi(this); } -MainWindow::~MainWindow() { - delete ui; -} \ No newline at end of file +MainWindow::~MainWindow() { delete ui; } + +void MainWindow::on_actionExit_triggered() { + this->close(); +} +} // namespace Graph::GUI diff --git a/src/graph/server/gui/mainwindow.ui b/src/graph/server/gui/mainwindow.ui index 24e14ec..a47d899 100644 --- a/src/graph/server/gui/mainwindow.ui +++ b/src/graph/server/gui/mainwindow.ui @@ -13,10 +13,23 @@ 0 0 640 - 480 + 480 - + + + + &File + + + + + + + + E&xit + + diff --git a/src/graph/server/main.cpp b/src/graph/server/main.cpp index 291622c..4d752d6 100644 --- a/src/graph/server/main.cpp +++ b/src/graph/server/main.cpp @@ -9,7 +9,7 @@ int main(int argc, char** argv) { plugin.init((update_callback_t)1); QApplication app(argc, argv); - MainWindow window; + Graph::GUI::MainWindow window; window.show(); return app.exec();