mirror of
https://github.com/jorenchik/mdemory.git
synced 2026-03-22 00:26:21 +00:00
docs, added help window, CMakeLists in root dir, other small changes
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(Mdemory LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
set(
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
"${CMAKE_CXX_FLAGS_DEBUG} -g3 -O0 -ggdb -fvar-tracking-assignments -fno-inline"
|
||||
)
|
||||
|
||||
add_subdirectory(transpiler)
|
||||
add_subdirectory(qtapp)
|
||||
@@ -16,13 +16,16 @@ find_package(Qt5 COMPONENTS Widgets REQUIRED)
|
||||
# find_package(QScintilla REQUIRED)
|
||||
include_directories(/usr/include/qt/Qsci)
|
||||
|
||||
qt5_add_resources(RESOURCES ${CMAKE_SOURCE_DIR}/resources/resources.qrc)
|
||||
|
||||
add_executable(
|
||||
MdemoryApp
|
||||
main.cpp
|
||||
mdemList.cpp
|
||||
trainWindow.cpp
|
||||
settings.cpp
|
||||
${RESOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(MdemoryApp Qt5::Widgets /usr/lib/libqscintilla2_qt5.so api)
|
||||
target_include_directories(MdemoryApp PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
||||
target_include_directories(MdemoryApp PRIVATE ${CMAKE_SOURCE_DIR}/src/include)
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include <QStandardPaths>
|
||||
#include <QShortcut>
|
||||
#include <QWidget>
|
||||
#include <QTextBrowser>
|
||||
|
||||
#include "config.h"
|
||||
#include "settings.h"
|
||||
@@ -780,29 +781,48 @@ QMainWindow *initMdemListWindow() {
|
||||
pagination = new Pagination;
|
||||
auto *toolbar = new Toolbar();
|
||||
|
||||
// Setup related windows
|
||||
// Setup the related windows.
|
||||
auto *settingsWindow = initSettings();
|
||||
trainWindow = initTrainWindow();
|
||||
|
||||
QMainWindow *guideWindow = new QMainWindow;
|
||||
{ // Guide window.
|
||||
auto guideWidget = new QWidget;
|
||||
auto *layout = new QVBoxLayout;
|
||||
auto *textBrowser = new QTextBrowser;
|
||||
textBrowser->setSource(QUrl("qrc:/html/help.html"));
|
||||
textBrowser->zoomIn(2);
|
||||
layout->addWidget(textBrowser);
|
||||
guideWidget->setLayout(layout);
|
||||
guideWindow->setCentralWidget(guideWidget);
|
||||
}
|
||||
|
||||
QAction *actionOpen;
|
||||
QAction *openSettings;
|
||||
QAction *actionHelp;
|
||||
{ // Menu bar.
|
||||
QMenuBar *menuBar = new QMenuBar;
|
||||
QFileDialog *fileDialog = new QFileDialog;
|
||||
|
||||
QMenu *menu = new QMenu("File");
|
||||
QAction *actionOpen = menu->addAction("Open memorybase");
|
||||
QObject::connect(actionOpen, &QAction::triggered, [fileDialog]() {
|
||||
fileDialog->setDirectory(QDir::homePath());
|
||||
fileDialog->setFileMode(QFileDialog::FileMode::Directory);
|
||||
fileDialog->open();
|
||||
QObject::disconnect(fileDialog, 0, 0, 0);
|
||||
fileDialog->connect(
|
||||
fileDialog,
|
||||
&QFileDialog::fileSelected,
|
||||
pickDirectory
|
||||
);
|
||||
});
|
||||
actionOpen = menu->addAction("Open memorybase");
|
||||
QObject::connect(
|
||||
actionOpen,
|
||||
&QAction::triggered,
|
||||
[fileDialog]() {
|
||||
fileDialog->setDirectory(QDir::homePath());
|
||||
fileDialog->setFileMode(QFileDialog::FileMode::Directory);
|
||||
fileDialog->open();
|
||||
QObject::disconnect(fileDialog, 0, 0, 0);
|
||||
fileDialog->connect(
|
||||
fileDialog,
|
||||
&QFileDialog::fileSelected,
|
||||
pickDirectory
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QAction *openSettings = menu->addAction("Settings");
|
||||
openSettings = menu->addAction("Settings");
|
||||
QObject::connect(
|
||||
openSettings,
|
||||
&QAction::triggered,
|
||||
@@ -810,6 +830,15 @@ QMainWindow *initMdemListWindow() {
|
||||
settingsWindow->show();
|
||||
});
|
||||
|
||||
actionHelp = menu->addAction("Help");
|
||||
QObject::connect(
|
||||
actionHelp,
|
||||
&QAction::triggered,
|
||||
[guideWindow]() {
|
||||
guideWindow->show();
|
||||
}
|
||||
);
|
||||
|
||||
menuBar->addMenu(menu);
|
||||
window->setMenuBar(menuBar);
|
||||
}
|
||||
@@ -1113,8 +1142,14 @@ QMainWindow *initMdemListWindow() {
|
||||
});
|
||||
};
|
||||
|
||||
addShortcut("Ctrl+,", [settingsWindow]() {
|
||||
settingsWindow->show();
|
||||
addShortcut("Ctrl+O", [actionOpen]() {
|
||||
actionOpen->trigger();
|
||||
});
|
||||
addShortcut("Ctrl+H", [actionHelp]() {
|
||||
actionHelp->trigger();
|
||||
});
|
||||
addShortcut("Ctrl+,", [openSettings]() {
|
||||
openSettings->trigger();
|
||||
});
|
||||
addShortcut("Ctrl+S", [toolbar]() {
|
||||
toolbar->btnSave.click();
|
||||
|
||||
@@ -17,5 +17,5 @@ target_link_libraries(transpiler api)
|
||||
|
||||
target_compile_options(transpiler PRIVATE -Wall -Wextra -Wpedantic)
|
||||
|
||||
target_include_directories(transpiler PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
||||
target_include_directories(api PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
||||
target_include_directories(transpiler PRIVATE ${CMAKE_SOURCE_DIR}/src/include)
|
||||
target_include_directories(api PUBLIC ${CMAKE_SOURCE_DIR}/src/include)
|
||||
|
||||
@@ -18,7 +18,7 @@ typedef std::map<TokenType, std::vector<TokenType>> TokenAutomata;
|
||||
|
||||
TokenAutomata *automata = nullptr;
|
||||
/*
|
||||
* Galīgs automāts, kas nosaka, kādā secībā ir var būt tekstvienības.
|
||||
* Tekstvienību secības pārejas, kas nosaka, kādā secībā tekstvienības var būt.
|
||||
* */
|
||||
void initParserAutomata() {
|
||||
automata = new TokenAutomata;
|
||||
|
||||
Reference in New Issue
Block a user