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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user