From 9c40ce2daa9446f170b909e6e312c5bd5cd48afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Wed, 2 Oct 2024 00:09:54 +0200 Subject: [PATCH] Add open marked files --- README | 4 ++++ imageringlist.cpp | 10 ++++++++++ imageringlist.h | 1 + mainwindow.cpp | 7 +++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README b/README index a169d7a..d659aee 100644 --- a/README +++ b/README @@ -25,3 +25,7 @@ Then to build run standard cmake sequence cmake -B build -S . cmake --build build ./build/tenmon + +For working plate solving you must have compiled and installed StellarSolver https://github.com/rlancaste/stellarsolver +It is important that you compile StellarSolver with Qt6. By default it use Qt5 but when linked with Qt6 program it will +crash. diff --git a/imageringlist.cpp b/imageringlist.cpp index def16c1..e64af1d 100644 --- a/imageringlist.cpp +++ b/imageringlist.cpp @@ -218,6 +218,16 @@ void ImageRingList::decrement() } } +void ImageRingList::setMarked() +{ + QStringList files = m_database->getMarkedFiles(); + std::remove_if(files.begin(), files.end(), [](const QString &file){ + QFileInfo info(file); + return !info.exists() || !info.isReadable(); + }); + setFiles(files); +} + void ImageRingList::setLiveMode(bool live) { m_liveMode = live; diff --git a/imageringlist.h b/imageringlist.h index 442fb82..aa7d347 100644 --- a/imageringlist.h +++ b/imageringlist.h @@ -100,6 +100,7 @@ public slots: void toggleSlideshow(bool start); void increment(); void decrement(); + void setMarked(); protected: void setFiles(const QStringList files, const QString ¤tFile = QString()); QList::iterator increment(QList::iterator iter); diff --git a/mainwindow.cpp b/mainwindow.cpp index 328dbd5..a65ff39 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -157,7 +157,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) QMenu *fileMenu = new QMenu(tr("File"), this); fileMenu->addAction(tr("Open"), QKeySequence::Open, this, SLOT(loadFile())); fileMenu->addAction(tr("Open directory recursively"), this, &MainWindow::loadDir); - fileMenu->addAction(tr("Save as"), QKeySequence::Save, this, SLOT(saveAs())); + QAction *saveAs = fileMenu->addAction(tr("Save as"), QKeySequence::Save, this, SLOT(saveAs())); fileMenu->addSeparator(); fileMenu->addAction(tr("Copy marked files"), Qt::Key_F5, this, SLOT(copyMarked())); fileMenu->addAction(tr("Move marked files"), Qt::Key_F6, this, SLOT(moveMarked())); @@ -225,8 +225,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) selectMenu->addSeparator(); selectMenu->addAction(tr("Mark and next"), Qt::Key_M, this, SLOT(markAndNext())); selectMenu->addAction(tr("Unmark and next"), Qt::Key_X, this, SLOT(unmarkAndNext())); - selectMenu->addAction(tr("Show marked"), this, &MainWindow::showMarkFilesDialog); + selectMenu->addSeparator(); + selectMenu->addAction(tr("Show marked list"), this, &MainWindow::showMarkFilesDialog); + QAction *openMarked = selectMenu->addAction(tr("Open marked"), m_ringList, &ImageRingList::setMarked); menuBar()->addMenu(selectMenu); + fileMenu->insertAction(saveAs, openMarked); /*QMenu *analyzeMenu = new QMenu(tr("Analyze"), this); QActionGroup *analyzeGroup = new QActionGroup(this);