summaryrefslogtreecommitdiff
path: root/numberator.cpp
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-08-04 01:04:52 +0200
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-08-04 01:04:52 +0200
commit872bb95acf6fabd639da57cd41a4844d7e6dd0f0 (patch)
tree689d8fd95b93e2b54111fd207e93f6789c4b7f28 /numberator.cpp
downloadnumberator-872bb95acf6fabd639da57cd41a4844d7e6dd0f0.tar.gz
numberator-872bb95acf6fabd639da57cd41a4844d7e6dd0f0.tar.bz2
numberator-872bb95acf6fabd639da57cd41a4844d7e6dd0f0.zip
Initial commit
Diffstat (limited to 'numberator.cpp')
-rw-r--r--numberator.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/numberator.cpp b/numberator.cpp
new file mode 100644
index 0000000..2497403
--- /dev/null
+++ b/numberator.cpp
@@ -0,0 +1,86 @@
+#include "numberator.h"
+#include "ui_numberator.h"
+#include "ui_TagListDock.h"
+
+Numberator::Numberator(QWidget *parent)
+ : QMainWindow(parent)
+ , ui(new Ui::Numberator)
+ , tagsDockUi(new Ui::TagListDock)
+ , settings("jaseg.de", "Numberator")
+ , loadImageDialog(this)
+ , proj()
+ , tagListModel(proj)
+ , tagPropTableModel(proj)
+{
+ ui->setupUi(this);
+
+ QDockWidget *dock = new QDockWidget(this);
+ tagsDockUi->setupUi(dock);
+ addDockWidget(Qt::LeftDockWidgetArea, dock);
+ ui->menuView->addAction(dock->toggleViewAction());
+ connect(ui->actionReload_Image, &QAction::triggered,
+ &proj, &SQLiteSaveFile::reloadImageFromDisk);
+
+ tagsDockUi->tagList->setModel(&tagListModel);
+ tagsDockUi->propertyTable->setModel(&tagPropTableModel);
+
+ loadImageDialog.setWindowModality(Qt::ApplicationModal);
+ loadImageDialog.setWindowTitle("Load Image...");
+ loadImageDialog.setNameFilter("Images (*.png, *.xpm, *.jpg)");
+ loadImageDialog.setFileMode(QFileDialog::ExistingFile);
+ loadImageDialog.restoreState(settings.value("MainWindow/LoadImageFileDialogState").toByteArray());
+ connect(&loadImageDialog, &QFileDialog::accepted, [=]() {
+ settings.setValue("MainWindow/LoadImageFileDialogState", this->loadImageDialog.saveState());
+ });
+ connect(&loadImageDialog, &QFileDialog::fileSelected, &proj, &SQLiteSaveFile::loadImageFromDisk);
+ connect(ui->actionImport_Image, &QAction::triggered, [=](bool checked){
+ Q_UNUSED(checked);
+ this->loadImageDialog.open();
+ });
+
+ saveOpenDialog.setWindowModality(Qt::ApplicationModal);
+ saveOpenDialog.setNameFilter("Project Files (*.npr);;Any File (*)");
+ saveOpenDialog.setFileMode(QFileDialog::AnyFile);
+ saveOpenDialog.restoreState(settings.value("MainWindow/SaveAsFileDialogState").toByteArray());
+ connect(&saveOpenDialog, &QFileDialog::accepted, [=]() {
+ settings.setValue("MainWindow/SaveAsFileDialogState", this->saveOpenDialog.saveState());
+ });
+ connect(ui->actionSave_Project, &QAction::triggered, [=](bool checked){
+ Q_UNUSED(checked);
+ this->saveOpenDialog.setWindowTitle("Save Project as...");
+ disconnect(&this->saveOpenDialog, &QFileDialog::fileSelected, nullptr, nullptr);
+ connect(&this->saveOpenDialog, &QFileDialog::fileSelected,
+ &this->proj, &SQLiteSaveFile::saveAs);
+ this->saveOpenDialog.open();
+ });
+ connect(ui->actionOpen_Project, &QAction::triggered, [=](bool checked){
+ Q_UNUSED(checked);
+ this->saveOpenDialog.setWindowTitle("Open Project...");
+ disconnect(&this->saveOpenDialog, &QFileDialog::fileSelected, nullptr, nullptr);
+ connect(&this->saveOpenDialog, &QFileDialog::fileSelected,
+ this, &Numberator::openFile);
+ this->saveOpenDialog.open();
+ });
+
+ connect(ui->actionNew_Project, &QAction::triggered,
+ &proj, &SQLiteSaveFile::clearNew);
+ connect(ui->actionQuit, &QAction::triggered, &QApplication::quit);
+ connect(ui->actionAbout, &QAction::triggered, &aboutDialog, &AboutDialog::open);
+
+ connect(tagsDockUi->tagList->selectionModel(), &QItemSelectionModel::currentChanged,
+ [=](const QModelIndex &current, const QModelIndex &previous) {
+ Q_UNUSED(previous);
+ tagPropTableModel.showTag(tagListModel.getTag(current));
+ });
+}
+
+Numberator::~Numberator()
+{
+ delete ui;
+}
+
+void Numberator::openFile(const QString &path)
+{
+
+}
+