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.
pull/4/head
Nefo Fortressia 2021-09-13 14:32:06 +07:00
parent 9db81886ef
commit bf51d4dd9f
7 changed files with 110 additions and 4 deletions

32
CMakeLists.txt Normal file
View File

@ -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)

0
src/CMakeLists.txt Normal file
View File

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<class>EchidnaEditor</class>
<widget class="QMainWindow" name="EchidnaEditor">
<property name="geometry">
<rect>
<x>0</x>
@ -11,9 +11,9 @@
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>Echidna Editor</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QWidget" name="centralWidget">
<widget class="QWidget" name="statusBar" native="true">
<property name="geometry">
<rect>

31
src/editor.cpp Normal file
View File

@ -0,0 +1,31 @@
#include "editor.h"
#include <ui_echidna.h>
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'
*/

24
src/editor.h Normal file
View File

@ -0,0 +1,24 @@
#include <QMainWindow>
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;
};

14
src/main.cpp Normal file
View File

@ -0,0 +1,14 @@
#include <QApplication>
#include "editor.h"
int main(int argc, char *argv[]){
QApplication EchidnaEditorApp(argc, argv);
EchidnaEditor Editor;
Editor.show();
EchidnaEditorApp.exec();
}

5
src/resources.qrc Normal file
View File

@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
</qresource>
</RCC>