diff --git a/CMakeLists.txt b/CMakeLists.txt index 4300005..691e9fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ add_subdirectory("ResourceManager") add_subdirectory(plotly_maker) add_subdirectory(array_core) add_subdirectory(common_utils) +add_subdirectory(gui) set(HEADER_FILES davis.h) diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt new file mode 100644 index 0000000..cd82210 --- /dev/null +++ b/gui/CMakeLists.txt @@ -0,0 +1,55 @@ +cmake_minimum_required(VERSION 3.5) + +project(gui LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# QtCreator supports the following variables for Android, which are identical to qmake Android variables. +# Check https://doc.qt.io/qt/deployment-android.html for more information. +# They need to be set before the find_package( ...) calls below. + +#if(ANDROID) +# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") +# if (ANDROID_ABI STREQUAL "armeabi-v7a") +# set(ANDROID_EXTRA_LIBS +# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so +# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) +# endif() +#endif() + +find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) + +set(PROJECT_SOURCES + main.cpp + ../davis_one/davis.h + ../davis_one/davis.cpp + davis_gui.cpp + davis_gui.h + davis_gui.ui +) + +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + qt_add_executable(gui + ${PROJECT_SOURCES} + ) +else() + if(ANDROID) + add_library(gui SHARED + ${PROJECT_SOURCES} + ) + else() + add_executable(gui + ${PROJECT_SOURCES} + ) + endif() +endif() + +target_link_libraries(gui PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) diff --git a/gui/davis_gui.cpp b/gui/davis_gui.cpp new file mode 100644 index 0000000..aedf90d --- /dev/null +++ b/gui/davis_gui.cpp @@ -0,0 +1,19 @@ +#include "davis_gui.h" +#include "./ui_davis_gui.h" + +#include "../davis_one/davis.h" + +DavisGUI::DavisGUI(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::DavisGUI) +{ + ui->setupUi(this); + //std::vector test_data = {5,6,8}; + //dv::show(test_data); +} + +DavisGUI::~DavisGUI() +{ + delete ui; +} + diff --git a/gui/davis_gui.h b/gui/davis_gui.h new file mode 100644 index 0000000..7a1d3a6 --- /dev/null +++ b/gui/davis_gui.h @@ -0,0 +1,21 @@ +#ifndef DAVISGUI_H +#define DAVISGUI_H + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { class DavisGUI; } +QT_END_NAMESPACE + +class DavisGUI : public QMainWindow +{ + Q_OBJECT + +public: + DavisGUI(QWidget *parent = nullptr); + ~DavisGUI(); + +private: + Ui::DavisGUI *ui; +}; +#endif // DAVISGUI_H diff --git a/gui/davis_gui.ui b/gui/davis_gui.ui new file mode 100644 index 0000000..a6510c7 --- /dev/null +++ b/gui/davis_gui.ui @@ -0,0 +1,22 @@ + + + DavisGUI + + + + 0 + 0 + 800 + 600 + + + + DavisGUI + + + + + + + + diff --git a/gui/main.cpp b/gui/main.cpp new file mode 100644 index 0000000..a2fd6ee --- /dev/null +++ b/gui/main.cpp @@ -0,0 +1,11 @@ +#include "davis_gui.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + DavisGUI w; + w.show(); + return a.exec(); +}