From bf51d4dd9f253d24e92d1f1101e0f3e2452f8f9a Mon Sep 17 00:00:00 2001 From: Nefomemes Date: Mon, 13 Sep 2021 14:32:06 +0700 Subject: [PATCH] feat: Add the needed boilerplate code needed to run the program This moves ui/echidna.ui and src/resources.qrs to src/echidna.ui and src/resources.qrs respectively. I couldn't find any way to have these files on a separate ui folder, as CMake's AUTOUIC feature will only look for .ui files in the importing code's directory. I have compiled and ran this and the UI feels great. I mean I have the Dracula theme configured on my machine, not sure what will it looked like without it. Next up we will work on our Monaco replacement. Will discuss on whether making it a Qt Designer plugin or not. --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 0 {ui => src}/echidna.ui | 8 ++++---- src/editor.cpp | 31 +++++++++++++++++++++++++++++++ src/editor.h | 24 ++++++++++++++++++++++++ src/main.cpp | 14 ++++++++++++++ src/resources.qrc | 5 +++++ 7 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt rename {ui => src}/echidna.ui (97%) create mode 100644 src/editor.cpp create mode 100644 src/editor.h create mode 100644 src/main.cpp create mode 100644 src/resources.qrc diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5407626 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +CMake_Minimum_Required(VERSION 3.1.0) + +Project(echidna VERSION 0.0 LANGUAGES CXX) + +Set(CMAKE_CXX_STANDARD 11) +Set(CMAKE_CXX_STANDARD_REQUIRED ON) + +Set(CMAKE_AUTOMOC ON) +Set(CMAKE_AUTORCC ON) +Set(CMAKE_AUTOUIC ON) + + + +Find_Package(Qt5 COMPONENTS Widgets REQUIRED) + +add_subdirectory(src) + +file(GLOB SOURCES src/*.cpp) +file(GLOB HEADERS src/*.h) + +Add_Executable(echidna + ${SOURCES} + ${HEADERS} + src/echidna.ui + src/resources.qrc +) + + + +Target_Link_Libraries(echidna Qt5::Widgets) + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/ui/echidna.ui b/src/echidna.ui similarity index 97% rename from ui/echidna.ui rename to src/echidna.ui index 43d2a85..6ff9ab8 100644 --- a/ui/echidna.ui +++ b/src/echidna.ui @@ -1,7 +1,7 @@ - MainWindow - + EchidnaEditor + 0 @@ -11,9 +11,9 @@ - MainWindow + Echidna Editor - + diff --git a/src/editor.cpp b/src/editor.cpp new file mode 100644 index 0000000..2a69a9b --- /dev/null +++ b/src/editor.cpp @@ -0,0 +1,31 @@ +#include "editor.h" +#include + +EchidnaEditor::EchidnaEditor(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::EchidnaEditor) +{ + +ui->setupUi(this); +this->setCentralWidget(ui->centralWidget); + + + +} + +EchidnaEditor::~EchidnaEditor(){ + delete ui; +} + + +/** + * undefined reference to `vtable for EchidnaEditor' + * + * / + + +/* + +undefined reference to `vtable for EchidnaEditor' + +*/ \ No newline at end of file diff --git a/src/editor.h b/src/editor.h new file mode 100644 index 0000000..a355ca2 --- /dev/null +++ b/src/editor.h @@ -0,0 +1,24 @@ +#include + +namespace Ui { +class EchidnaEditor; +} + + +class EchidnaEditor : public QMainWindow +{ + Q_OBJECT + +public: + explicit EchidnaEditor(QWidget *parent = nullptr); + ~EchidnaEditor(); + +private slots: + void addFolderIntoWorkspace(){ + + } + +private: + Ui::EchidnaEditor *ui; + +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..cbaed37 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,14 @@ +#include +#include "editor.h" + +int main(int argc, char *argv[]){ + + QApplication EchidnaEditorApp(argc, argv); + + EchidnaEditor Editor; + + Editor.show(); + + EchidnaEditorApp.exec(); + +} \ No newline at end of file diff --git a/src/resources.qrc b/src/resources.qrc new file mode 100644 index 0000000..d601a4b --- /dev/null +++ b/src/resources.qrc @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file