parent
628bfd13ac
commit
4e87067cc4
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"/usr/include/qt/QtWidgets",
|
||||
"/usr/include/qt"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"configurationProvider": "ms-vscode.cmake-tools"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"cmake.configureOnOpen": true,
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
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)
|
||||
|
||||
|
237
src/echidna.ui
237
src/echidna.ui
|
@ -1,237 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EchidnaEditor</class>
|
||||
<widget class="QMainWindow" name="EchidnaEditor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>770</width>
|
||||
<height>559</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Echidna Editor</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<widget class="QWidget" name="statusBar" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>490</y>
|
||||
<width>801</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #191A21</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="langFeaturesTab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>290</y>
|
||||
<width>531</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="problemsTab">
|
||||
<attribute name="title">
|
||||
<string>Problems</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="outputTab">
|
||||
<attribute name="title">
|
||||
<string>Output</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="terminalTab">
|
||||
<attribute name="title">
|
||||
<string>Terminal</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="debugConsoleTab">
|
||||
<attribute name="title">
|
||||
<string>Debug Console</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="activityTab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>271</width>
|
||||
<height>491</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QTabBar::tab {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Tab 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Tab 2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>770</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuEdiut">
|
||||
<property name="title">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuSelection">
|
||||
<property name="title">
|
||||
<string>Selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuTabs">
|
||||
<property name="title">
|
||||
<string>Tabs</string>
|
||||
</property>
|
||||
<addaction name="actionProblem"/>
|
||||
<addaction name="actionOutput"/>
|
||||
<addaction name="actionTerminal"/>
|
||||
<addaction name="actionTerminal_2"/>
|
||||
</widget>
|
||||
<addaction name="menuTabs"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuGo">
|
||||
<property name="title">
|
||||
<string>Go</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRun">
|
||||
<property name="title">
|
||||
<string>Run</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTerminal">
|
||||
<property name="title">
|
||||
<string>Terminal</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEchidna">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuNew">
|
||||
<property name="title">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<addaction name="actionFile"/>
|
||||
<addaction name="actionWindow"/>
|
||||
</widget>
|
||||
<addaction name="menuNew"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
</widget>
|
||||
<addaction name="menuEchidna"/>
|
||||
<addaction name="menuEdiut"/>
|
||||
<addaction name="menuSelection"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuGo"/>
|
||||
<addaction name="menuRun"/>
|
||||
<addaction name="menuTerminal"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionNew_File">
|
||||
<property name="text">
|
||||
<string>New File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUndo">
|
||||
<property name="text">
|
||||
<string>Undo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRedo">
|
||||
<property name="text">
|
||||
<string>Redo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProblem">
|
||||
<property name="text">
|
||||
<string>Problems</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOutput">
|
||||
<property name="text">
|
||||
<string>Output</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTerminal">
|
||||
<property name="text">
|
||||
<string>Debug Console</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTerminal_2">
|
||||
<property name="text">
|
||||
<string>Terminal</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFile">
|
||||
<property name="text">
|
||||
<string>File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen">
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWindow">
|
||||
<property name="text">
|
||||
<string>Window</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,18 +0,0 @@
|
|||
#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;
|
||||
}
|
24
src/editor.h
24
src/editor.h
|
@ -1,24 +0,0 @@
|
|||
#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
14
src/main.cpp
|
@ -1,14 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "editor.h"
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
QApplication EchidnaEditorApp(argc, argv);
|
||||
|
||||
EchidnaEditor Editor;
|
||||
|
||||
Editor.show();
|
||||
|
||||
EchidnaEditorApp.exec();
|
||||
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
#include "core-editor.h"
|
||||
|
||||
EchidnaCoreEditor::EchidnaCoreEditor(QWidget *parent) : QPlainTextEdit(parent) {
|
||||
LineNumberArea *lineNumber = new LineNumberArea(this);
|
||||
|
||||
QObject::connect(this, &EchidnaCoreEditor::cursorPositionChanged, &EchidnaCoreEditor::highlightCurrentLine);
|
||||
QObject::connect(this, &EchidnaCoreEditor::updateRequest, &EchidnaCoreEditor::updateLineNumberArea);
|
||||
QObject::connect(this, &EchidnaCoreEditor::blockCountChanged, &EchidnaCoreEditor::updateLineNumberAreaWidth);
|
||||
|
||||
this->highlightCurrentLine();
|
||||
this->updateLineNumberAreaWidth(0);
|
||||
}
|
||||
|
||||
EchidnaCoreEditor::~EchidnaCoreEditor(){
|
||||
|
||||
}
|
||||
|
||||
int EchidnaCoreEditor::lineNumberAreaWidth(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
void EchidnaCoreEditor::lineNumberAreaPaintEvent(QPaintEvent *event){
|
||||
|
||||
}
|
||||
|
||||
void EchidnaCoreEditor::resizeEvent(QResizeEvent *e){
|
||||
|
||||
QPlainTextEdit::resizeEvent(e);
|
||||
|
||||
QRect contentsRect = this->contentsRect();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This function implements the functionaly that highlight the current line your cursor is currently on.
|
||||
*
|
||||
* TODO: Implement support for multi-line editing.
|
||||
*
|
||||
*/
|
||||
void EchidnaCoreEditor::highlightCurrentLine(){
|
||||
|
||||
if(this->isReadOnly()){
|
||||
return;
|
||||
} else {
|
||||
QList<QTextEdit::ExtraSelection> selections;
|
||||
|
||||
QTextEdit::ExtraSelection selection;
|
||||
|
||||
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
|
||||
QBrush selectionFormatBrush = selection.format.foreground();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
the method `set_menubar` exists for reference `&components::echidna_editor::imp::EchidnaEditor`, but its trait bounds were not satisfied
|
||||
|
||||
method cannot be called on `&components::echidna_editor::imp::EchidnaEditor` due to unsatisfied trait bounds
|
||||
|
||||
note: the following trait bounds were not satisfied:
|
||||
`components::echidna_editor::imp::EchidnaEditor: glib::IsA<gtk4::Application>`
|
||||
which is required by `components::echidna_editor::imp::EchidnaEditor: gtk4::prelude::GtkApplicationExt`
|
||||
`&components::echidna_editor::imp::EchidnaEditor: glib::IsA<gtk4::Application>`
|
||||
which is required by `&components::echidna_editor::imp::EchidnaEditor: gtk4::prelude::GtkApplicationExt`
|
||||
|
||||
*/
|
|
@ -1,58 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
Echidna Core Text Editor. This is the Monaco replacement for Echidna.
|
||||
|
||||
A lot of the code are ~~stolen~~ inspired from [Qt's Code Editor example](https://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html), with added features to replicate the Visual Studio Code experience.
|
||||
|
||||
*/
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
class LineNumberArea : public QWidget
|
||||
{
|
||||
|
||||
public:
|
||||
LineNumberArea(EchidnaCoreEditor *editor) : QWidget(editor), coreEditor(editor)
|
||||
{
|
||||
}
|
||||
|
||||
QSize sizeHint() const override
|
||||
{
|
||||
return QSize(coreEditor->lineNumberAreaWidth(), 0);
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override
|
||||
{
|
||||
coreEditor->lineNumberAreaPaintEvent(event);
|
||||
}
|
||||
|
||||
EchidnaCoreEditor *coreEditor;
|
||||
};
|
||||
|
||||
class EchidnaCoreEditor : public QPlainTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EchidnaCoreEditor(QWidget *parent = nullptr);
|
||||
~EchidnaCoreEditor();
|
||||
|
||||
void lineNumberAreaPaintEvent(QPaintEvent *event);
|
||||
int lineNumberAreaWidth();
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void highlightCurrentLine();
|
||||
void updateLineNumberAreaWidth(int newBlockCount);
|
||||
void updateLineNumberArea(const QRect &rect, int dy);
|
||||
|
||||
|
||||
LineNumberArea *lineNumber;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
#include "editor.h"
|
||||
#include <ui_echidna.h>
|
||||
#include <QtCore>
|
||||
#include <algorithm>
|
||||
#include <QtWidgets>
|
||||
|
||||
EchidnaEditor::EchidnaEditor(QWidget *parent) : QMainWindow(parent),
|
||||
ui(new Ui::EchidnaEditor)
|
||||
{
|
||||
|
||||
ui->setupUi(this);
|
||||
this->setCentralWidget(ui->centralWidget);
|
||||
|
||||
QObject::connect(this, &EchidnaEditor::newFileOpened, &EchidnaEditor::handleNewFileOpened);
|
||||
}
|
||||
|
||||
EchidnaEditor::~EchidnaEditor()
|
||||
{
|
||||
delete ui;
|
||||
};
|
||||
|
||||
void EchidnaEditor::actionOpenFolder()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this,
|
||||
"Add a Folder to Workspace",
|
||||
QDir::homePath(),
|
||||
QFileDialog::ShowDirsOnly);
|
||||
|
||||
|
||||
std::vector<QFileSystemModel>::iterator foundExistingOpenedFolders = std::find_if(this->folders->begin(), this->folders->end(),
|
||||
[&](QFileSystemModel *iterator)
|
||||
{
|
||||
return iterator->rootPath() == dir;
|
||||
});
|
||||
if (this->folders->end() != foundExistingOpenedFolders)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileSystemModel *model = new QFileSystemModel;
|
||||
model->setRootPath(dir);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void EchidnaEditor::actionOpenFile(){
|
||||
QStringList files = QFileDialog::getOpenFileNames(this,
|
||||
"Open Files",
|
||||
QDir::homePath()
|
||||
);
|
||||
|
||||
for(int i = 0; i < files.size(); ++i){
|
||||
emit this->newFileOpened(files.at(i));
|
||||
}
|
||||
}
|
||||
void EchidnaEditor::handleNewFileOpened(QString filename){
|
||||
|
||||
QFile file(filename);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
#include <QMainWindow>
|
||||
#include <QtWidgets>
|
||||
#include <vector>
|
||||
namespace Ui
|
||||
{
|
||||
class EchidnaEditor;
|
||||
}
|
||||
|
||||
class EchidnaEditor : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EchidnaEditor(QWidget *parent = nullptr);
|
||||
~EchidnaEditor();
|
||||
|
||||
private slots:
|
||||
|
||||
void actionOpenFolder();
|
||||
void actionAddFolderToWorkspace(QString folder);
|
||||
void actionOpenFile();
|
||||
void handleNewFileOpened(QString file);
|
||||
|
||||
signals:
|
||||
|
||||
void newFileOpened(QString file);
|
||||
void newFolderOpened();
|
||||
private:
|
||||
Ui::EchidnaEditor *ui;
|
||||
std::vector<QFileSystemModel> *folders;
|
||||
std::vector<QFile> *files;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "editor.h"
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
QApplication EchidnaEditorApp(argc, argv);
|
||||
|
||||
EchidnaEditor Editor;
|
||||
|
||||
Editor.show();
|
||||
|
||||
EchidnaEditorApp.exec();
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue