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

@ -2,40 +2,97 @@
<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">
<string notr="true">MainWindow</string>
</property>
<property name="windowTitle">
<string notr="true">Graph</string>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>640</width> <width>800</width>
<height>480</height> <height>600</height>
</rect> </rect>
</property> </property>
<widget class="QMenuBar" name="menuBar"> <property name="windowTitle">
<widget class="QMenu" name="menuFile"> <string>Graphs</string>
<property name="title">
<string>&amp;File</string>
</property> </property>
<addaction name="actionExit"/> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<property name="documentMode">
<bool>false</bool>
</property>
<widget class="QWidget" name="graphsTab">
<attribute name="title">
<string>Graphs</string>
</attribute>
<layout class="QVBoxLayout" name="graphsVerticalLayout">
<item>
<widget class="QListView" name="graphsListView"/>
</item>
</layout>
</widget> </widget>
<addaction name="menuFile"/> <widget class="QWidget" name="pluginsTab">
<attribute name="title">
<string>Plugins</string>
</attribute>
<layout class="QVBoxLayout" name="pluginsVerticalLayout">
<item>
<widget class="QListView" name="pluginsListView"/>
</item>
</layout>
</widget> </widget>
<action name="actionExit"> </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"> <property name="text">
<string>E&amp;xit</string> <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> </property>
</action> </action>
<widget class="QToolBar" name="toolBar"/>
<widget class="QWidget" name="centralWidget"/>
<widget class="QStatusBar" name="statusBar"/>
</widget> </widget>
<resources> <resources/>
<include location="mainwindow.qrc"/>
</resources>
<connections/> <connections/>
</ui> </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);