Skip to content

Commit

Permalink
Just a very rough test, don't know if this is feasible
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpurcell committed Feb 24, 2024
1 parent 918e8d5 commit b1782c6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,23 @@ MainWindow::~MainWindow()

bool MainWindow::event(QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride || event->type() == QEvent::KeyRelease)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
//qDebug() << keyEvent;
if (keyEvent->keyCombination() == QKeyCombination(Qt::Key_Right | Qt::KeypadModifier)) {
if (event->type() == QEvent::ShortcutOverride) {
if (!turboNavNext) {
turboNavNext = true;
graphicsView->goToFile(QVGraphicsView::GoToFileMode::next);
}
}
else {
turboNavNext = false;
}
}
event->accept();
}
if (event->type() == QEvent::WindowActivate && !qvApp->getIsApplicationQuitting())
{
lastActivated.start();
Expand Down
2 changes: 2 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class MainWindow : public QMainWindow

bool getIsClosing() const { return isClosing; }

bool turboNavNext {false};

public slots:
void openFile(const QString &fileName);

Expand Down
11 changes: 11 additions & 0 deletions src/qvimagecore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ void QVImageCore::loadFile(const QString &fileName, bool isReloading)
{
if (waitingOnLoad)
{
qDebug() << "waiting on load";
return;
}

if (!tmr.isValid())
tmr.start();

QString sanitaryFileName = fileName;

//sanitize file name if necessary
Expand Down Expand Up @@ -236,6 +240,13 @@ void QVImageCore::loadPixmap(const ReadData &readData)

emit fileChanged();

qDebug() << tmr.elapsed();
if (static_cast<MainWindow*>(static_cast<QWidget*>(parent())->window())->turboNavNext) {
QTimer::singleShot(0, this, [this]() {
static_cast<QVGraphicsView*>(parent())->goToFile(QVGraphicsView::GoToFileMode::next);
});
}

requestCaching();
}

Expand Down
1 change: 1 addition & 0 deletions src/qvimagecore.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class QVImageCore : public QObject
FileDetails getEmptyFileDetails();

private:
QElapsedTimer tmr;
QPixmap loadedPixmap;
QMovie loadedMovie;

Expand Down

0 comments on commit b1782c6

Please sign in to comment.