basic layout

This commit is contained in:
Benedek László 2024-05-14 16:08:39 +02:00
parent 1787f701e9
commit 1fb3e98146
6 changed files with 131 additions and 67 deletions

View File

@ -19,32 +19,10 @@ if(DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DDEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DDEBUG")
endif() endif()
include_directories("${CMAKE_SOURCE_DIR}/inc")
# build plugins # build plugins
include_directories("${CMAKE_SOURCE_DIR}/inc" "${CMAKE_SOURCE_DIR}/build")
add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/plugins") add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/plugins")
# build gui server # build gui server
find_package(Qt6 REQUIRED COMPONENTS Widgets) add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/server")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
file(GLOB_RECURSE SERVER_SOURCES "${CMAKE_SOURCE_DIR}/src/graph/server/*.cpp")
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")
cmake_print_variables(SERVER_SOURCES)
cmake_print_variables(SERVER_UI)
cmake_print_variables(SERVER_RES)
cmake_print_variables(SERVER_HEADERS)
qt_wrap_cpp(SERVER_GEN_SRC ${SERVER_SRC})
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)

View File

@ -1,2 +1,3 @@
file(GLOB_RECURSE HTTP_SOURCES "./*.cpp") file(GLOB_RECURSE HTTP_SOURCES "./*.cpp")
add_library(http SHARED ${HTTP_SOURCES}) add_library(http SHARED ${HTTP_SOURCES})
set_target_properties(http PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")

View File

@ -0,0 +1,28 @@
find_package(Qt6 REQUIRED COMPONENTS Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
file(GLOB_RECURSE SERVER_SOURCES "*.cpp")
file(GLOB_RECURSE SERVER_UI "*.ui")
file(GLOB_RECURSE SERVER_RES "*.qrc")
# file(GLOB_RECURSE SERVER_HEADERS "${CMAKE_SOURCE_DIR}/inc/graph/server/*.h")
file(GLOB_RECURSE SERVER_HEADERS "../../../inc/graph/server/*.h")
cmake_print_variables(SERVER_SOURCES)
cmake_print_variables(SERVER_UI)
cmake_print_variables(SERVER_RES)
cmake_print_variables(SERVER_HEADERS)
cmake_print_variables(CMAKE_BINARY_DIR)
qt_wrap_cpp(SERVER_GEN_SRC ${SERVER_SRC})
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_include_directories(server PRIVATE "${CMAKE_BINARY_DIR}/src")
target_link_libraries(server PRIVATE dl Qt6::Widgets)
set_target_properties(server PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

View File

@ -1,5 +1,5 @@
#include <graph/server/gui/mainwindow.h> #include <graph/server/gui/mainwindow.h>
#include <ui_mainwindow.h> #include <graph/server/ui_mainwindow.h>
namespace Graph::GUI { namespace Graph::GUI {
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)

View File

@ -1,41 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MainWindow</class> <class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow"> <widget class="QMainWindow" name="MainWindow">
<property name="objectName"> <property name="geometry">
<string notr="true">MainWindow</string> <rect>
</property> <x>0</x>
<property name="windowTitle"> <y>0</y>
<string notr="true">Graph</string> <width>800</width>
</property> <height>600</height>
<property name="geometry"> </rect>
<rect> </property>
<x>0</x> <property name="windowTitle">
<y>0</y> <string>Graphs</string>
<width>640</width> </property>
<height>480</height> <widget class="QWidget" name="centralwidget">
</rect> <layout class="QVBoxLayout" name="verticalLayout">
</property> <item>
<widget class="QMenuBar" name="menuBar"> <widget class="QTabWidget" name="tabWidget">
<widget class="QMenu" name="menuFile"> <property name="currentIndex">
<property name="title"> <number>0</number>
<string>&amp;File</string> </property>
</property> <property name="documentMode">
<addaction name="actionExit"/> <bool>false</bool>
</widget> </property>
<addaction name="menuFile"/> <widget class="QWidget" name="graphsTab">
</widget> <attribute name="title">
<action name="actionExit"> <string>Graphs</string>
<property name="text"> </attribute>
<string>E&amp;xit</string> <layout class="QVBoxLayout" name="graphsVerticalLayout">
</property> <item>
</action> <widget class="QListView" name="graphsListView"/>
<widget class="QToolBar" name="toolBar"/> </item>
<widget class="QWidget" name="centralWidget"/> </layout>
<widget class="QStatusBar" name="statusBar"/> </widget>
</widget> <widget class="QWidget" name="pluginsTab">
<resources> <attribute name="title">
<include location="mainwindow.qrc"/> <string>Plugins</string>
</resources> </attribute>
<connections/> <layout class="QVBoxLayout" name="pluginsVerticalLayout">
</ui> <item>
<widget class="QListView" name="pluginsListView"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menu_Graph">
<property name="title">
<string>&amp;Graph</string>
</property>
<addaction name="action_Add"/>
<addaction name="action_Remove"/>
</widget>
<widget class="QMenu" name="menu_Plugin">
<property name="title">
<string>&amp;Plugin</string>
</property>
<addaction name="action_Load"/>
</widget>
<addaction name="menu_Graph"/>
<addaction name="menu_Plugin"/>
</widget>
<action name="action_Load">
<property name="text">
<string>&amp;Load</string>
</property>
</action>
<action name="action_Unload">
<property name="text">
<string>&amp;Unload</string>
</property>
</action>
<action name="action_Add">
<property name="text">
<string>&amp;Add</string>
</property>
</action>
<action name="action_Remove">
<property name="text">
<string>&amp;Remove</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -5,7 +5,7 @@
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
int main(int argc, char** argv) { int main(int argc, char** argv) {
Graph::Plugin plugin("src/graph/plugins/http/libhttp.so"); Graph::Plugin plugin("plugins/libhttp.so");
plugin.init((update_callback_t)1); plugin.init((update_callback_t)1);
QApplication app(argc, argv); QApplication app(argc, argv);