Skip to content

Commit

Permalink
integrate gui
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeryStk authored and AntonMrt committed Aug 5, 2024
1 parent 14ec12e commit 574764c
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
55 changes: 55 additions & 0 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 19 additions & 0 deletions gui/davis_gui.cpp
Original file line number Diff line number Diff line change
@@ -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<double> test_data = {5,6,8};
//dv::show(test_data);
}

DavisGUI::~DavisGUI()
{
delete ui;
}

21 changes: 21 additions & 0 deletions gui/davis_gui.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef DAVISGUI_H
#define DAVISGUI_H

#include <QMainWindow>

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
22 changes: 22 additions & 0 deletions gui/davis_gui.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DavisGUI</class>
<widget class="QMainWindow" name="DavisGUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>DavisGUI</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar"/>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
11 changes: 11 additions & 0 deletions gui/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "davis_gui.h"

#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
DavisGUI w;
w.show();
return a.exec();
}

0 comments on commit 574764c

Please sign in to comment.