#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 ¤t, const QModelIndex &previous) { Q_UNUSED(previous); tagPropTableModel.showTag(tagListModel.getTag(current)); }); } Numberator::~Numberator() { delete ui; } void Numberator::openFile(const QString &path) { }