aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mingui/main.cpp16
-rw-r--r--mingui/mingui.cpp15
-rw-r--r--mingui/mingui.hpp4
3 files changed, 30 insertions, 5 deletions
diff --git a/mingui/main.cpp b/mingui/main.cpp
index 6856cad..57c2fb1 100644
--- a/mingui/main.cpp
+++ b/mingui/main.cpp
@@ -128,14 +128,14 @@ int main(int argc, char **argv)
w = new MinGuiWidget();
w->show_images(build_list(lists[curlist]));
w->update_distances(build_dists(lists[curlist]));
- w->update_permamsg(curlist, lists.size());
+ w->update_viewstatus(curlist, lists.size());
w->show();
QObject::connect(w, &MinGuiWidget::next,
[]{
if (curlist < lists.size() - 1) ++curlist;
w->show_images(build_list(lists[curlist]));
w->update_distances(build_dists(lists[curlist]));
- w->update_permamsg(curlist, lists.size());
+ w->update_viewstatus(curlist, lists.size());
});
QObject::connect(w, &MinGuiWidget::prev,
@@ -143,7 +143,17 @@ int main(int argc, char **argv)
if (curlist > 0) --curlist;
w->show_images(build_list(lists[curlist]));
w->update_distances(build_dists(lists[curlist]));
- w->update_permamsg(curlist, lists.size());
+ w->update_viewstatus(curlist, lists.size());
+ });
+ QObject::connect(w, &MinGuiWidget::switch_group,
+ [](size_t g){
+ if (g < lists.size())
+ {
+ curlist = g;
+ w->show_images(build_list(lists[curlist]));
+ w->update_distances(build_dists(lists[curlist]));
+ w->update_viewstatus(curlist, lists.size());
+ }
});
a.exec();
diff --git a/mingui/mingui.cpp b/mingui/mingui.cpp
index c251f61..ab1a083 100644
--- a/mingui/mingui.cpp
+++ b/mingui/mingui.cpp
@@ -21,6 +21,7 @@
#include <QKeySequence>
#include <QTextEdit>
#include <QMessageBox>
+#include <QInputDialog>
#include <QDesktopServices>
using std::size_t;
@@ -119,9 +120,11 @@ void MinGuiWidget::update_distances(const std::map<std::pair<size_t, size_t>, do
infopanel->setText(r);
}
-void MinGuiWidget::update_permamsg(std::size_t cur, std::size_t size)
+void MinGuiWidget::update_viewstatus(std::size_t cur, std::size_t size)
{
permamsg->setText(QString("Viewing group %1 of %2").arg(cur + 1).arg(size));
+ ngroups = size;
+ curgroup = cur;
}
void MinGuiWidget::save_list()
@@ -284,6 +287,16 @@ void MinGuiWidget::keyReleaseEvent(QKeyEvent *e)
case Qt::Key::Key_M: Q_EMIT next(); break;
case Qt::Key::Key_Z: Q_EMIT prev(); break;
case Qt::Key::Key_N: load_list(); break;
+ case Qt::Key::Key_B:
+ {
+ bool ok = false;
+ int g = QInputDialog::getInt(this, "Skip to group",
+ QString("Group # (1-%1)").arg(ngroups),
+ curgroup + 1,
+ 1, ngroups, 1, &ok);
+ if (ok) Q_EMIT switch_group((size_t) g - 1);
+ }
+ break;
case Qt::Key::Key_Return: if (e->modifiers() & Qt::KeyboardModifier::ShiftModifier) save_list(); break;
}
}
diff --git a/mingui/mingui.hpp b/mingui/mingui.hpp
index 7aa7576..755b6ad 100644
--- a/mingui/mingui.hpp
+++ b/mingui/mingui.hpp
@@ -26,6 +26,7 @@ private:
QWidget *imgcontainer;
QStatusBar *sb;
QScrollArea *sa;
+ std::size_t ngroups, curgroup;
bool nohotkeywarn;
void mark_toggle(std::size_t x);
void mark_all_but(std::size_t x);
@@ -45,12 +46,13 @@ public:
MinGuiWidget();
void show_images(const std::vector<std::filesystem::path> &fns);
void update_distances(const std::map<std::pair<std::size_t, std::size_t>, double> &d);
- void update_permamsg(std::size_t cur, std::size_t size);
+ void update_viewstatus(std::size_t cur, std::size_t size);
void save_list();
void load_list();
Q_SIGNALS:
void next();
void prev();
+ void switch_group(std::size_t group);
};
class ImageWidget : public QWidget