From 933cf3487a8b582fdacee9b0e677f711c51bdb5a Mon Sep 17 00:00:00 2001 From: BENEDEK Date: Tue, 14 May 2024 10:54:07 +0200 Subject: [PATCH] this compiles --- CMakeLists.txt | 29 ++-- CMakeLists.txt.user | 197 ++++++++++++++++++++++++++++ inc/graph/server/gui/mainwindow.h | 23 ++++ src/graph/server/gui/mainwindow.cpp | 10 ++ src/graph/server/gui/mainwindow.qrc | 4 + src/graph/server/gui/mainwindow.ui | 28 ++++ src/graph/server/main.cpp | 9 +- 7 files changed, 288 insertions(+), 12 deletions(-) create mode 100644 CMakeLists.txt.user create mode 100644 inc/graph/server/gui/mainwindow.h create mode 100644 src/graph/server/gui/mainwindow.cpp create mode 100644 src/graph/server/gui/mainwindow.qrc create mode 100644 src/graph/server/gui/mainwindow.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index fa5ed8a..a8bbee6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,27 +5,34 @@ include(CMakePrintHelpers) set(CMAKE_C_COMPILER clang) set(CMAKE_CXX_COMPILER clang++) + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable") + +set(CMAKE_EXPORT_COMPILE_COMMANDS true) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field") if(DEBUG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DDEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DDEBUG") endif() -set(CMAKE_EXPORT_COMPILE_COMMANDS true) - +# build plugins include_directories("${CMAKE_SOURCE_DIR}/inc") add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/plugins") +# build gui server find_package(Qt6 REQUIRED COMPONENTS Widgets) -qt_standard_project_setup() +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_RES "${CMAKE_SOURCE_DIR}/src/graph/server/*.ui") -qt_add_executable(server ${SERVER_SOURCES} ${SERVER_RES}) -target_link_libraries(server PRIVATE dl Qt6::Widgets) - - -# add_executable(server ${SERVER_SOURCES}) +file(GLOB_RECURSE SERVER_UI "${CMAKE_SOURCE_DIR}/src/graph/server/*.ui") +file(GLOB_RECURSE SERVER_RES "${CMAKE_SOURCE_DIR}/src/graph/server/*.qrc") +file(GLOB_RECURSE SERVER_HEADERS "${CMAKE_SOURCE_DIR}/inc/graph/server/*.h") +add_executable(server ${SERVER_SOURCES} ${SERVER_RES} ${SERVER_UI} ${SERVER_HEADERS}) +target_link_libraries(server PRIVATE dl Qt6::Widgets) \ No newline at end of file diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user new file mode 100644 index 0000000..cc3a60c --- /dev/null +++ b/CMakeLists.txt.user @@ -0,0 +1,197 @@ + + + + + + EnvironmentId + {4f657d63-be8b-425f-9d8c-4dd5085ebe29} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 6 + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + Desktop + {23592716-1d94-4067-93fe-e6827d70d9cc} + 0 + 0 + 0 + + Build + false + + -DCMAKE_GENERATOR:STRING=Unix Makefiles +-DCMAKE_BUILD_TYPE:STRING=Build +-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} +-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} +-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} +-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} +-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} + /home/laci/prog/graph + /home/laci/prog/graph/build + + + + + all + + false + + true + Build + CMakeProjectManager.MakeStep + + 1 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + + + clean + + false + + true + Build + CMakeProjectManager.MakeStep + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Build + CMakeProjectManager.CMakeBuildConfiguration + + 1 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + server + CMakeProjectManager.CMakeRunConfiguration.server + server + false + true + true + false + true + /home/laci/prog/graph/build + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/inc/graph/server/gui/mainwindow.h b/inc/graph/server/gui/mainwindow.h new file mode 100644 index 0000000..d2ca94d --- /dev/null +++ b/inc/graph/server/gui/mainwindow.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow { + Q_OBJECT +public: + explicit MainWindow(QWidget *parent = nullptr); + ~MainWindow(); +private: + QMenuBar* menuBar; + QToolBar* toolbar; + QStatusBar* statusBar; + + Ui::MainWindow *ui; +}; \ No newline at end of file diff --git a/src/graph/server/gui/mainwindow.cpp b/src/graph/server/gui/mainwindow.cpp new file mode 100644 index 0000000..6f97c59 --- /dev/null +++ b/src/graph/server/gui/mainwindow.cpp @@ -0,0 +1,10 @@ +#include + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { + this->menuBar = new QMenuBar(); + setMenuBar(this->menuBar); + this->statusBar = new QStatusBar(); + setStatusBar(this->statusBar); +} + +MainWindow::~MainWindow() {} \ No newline at end of file diff --git a/src/graph/server/gui/mainwindow.qrc b/src/graph/server/gui/mainwindow.qrc new file mode 100644 index 0000000..71fe652 --- /dev/null +++ b/src/graph/server/gui/mainwindow.qrc @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/graph/server/gui/mainwindow.ui b/src/graph/server/gui/mainwindow.ui new file mode 100644 index 0000000..942b328 --- /dev/null +++ b/src/graph/server/gui/mainwindow.ui @@ -0,0 +1,28 @@ + + + MainWindow + + + MainWindow + + + Graph + + + + 0 + 0 + 640 + 480 + + + + + + + + + + + + \ No newline at end of file diff --git a/src/graph/server/main.cpp b/src/graph/server/main.cpp index 637710f..291622c 100644 --- a/src/graph/server/main.cpp +++ b/src/graph/server/main.cpp @@ -1,9 +1,16 @@ +#include #include #include #include +#include int main(int argc, char** argv) { Graph::Plugin plugin("src/graph/plugins/http/libhttp.so"); plugin.init((update_callback_t)1); - return 0; + + QApplication app(argc, argv); + MainWindow window; + window.show(); + + return app.exec(); } \ No newline at end of file