feat: option to disable gallery looping
This change is sponsored by @superuser7777 Related: https://github.com/BLumia/pineapple-pictures/issues/153
This commit is contained in:
@ -139,10 +139,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
m_gv->setOpacity(0, false);
|
||||
m_closeButton->setOpacity(0, false);
|
||||
|
||||
connect(m_pm, &PlaylistManager::totalCountChanged, this, [this](int galleryFileCount) {
|
||||
m_prevButton->setVisible(galleryFileCount > 1);
|
||||
m_nextButton->setVisible(galleryFileCount > 1);
|
||||
});
|
||||
connect(m_pm, &PlaylistManager::totalCountChanged, this, &MainWindow::updateGalleryButtonsVisibility);
|
||||
|
||||
connect(m_pm->model(), &PlaylistModel::modelReset, this, std::bind(&MainWindow::galleryCurrent, this, false, false));
|
||||
connect(m_pm, &PlaylistManager::currentIndexChanged, this, std::bind(&MainWindow::galleryCurrent, this, true, false));
|
||||
@ -279,6 +276,8 @@ void MainWindow::galleryCurrent(bool showLoadImageHintWhenEmpty, bool reloadImag
|
||||
m_graphicsView->showText(QCoreApplication::translate("GraphicsScene", "Drag image here"));
|
||||
}
|
||||
|
||||
updateGalleryButtonsVisibility();
|
||||
|
||||
if (shouldResetfileWatcher) updateFileWatcher();
|
||||
}
|
||||
|
||||
@ -603,8 +602,7 @@ void MainWindow::toggleProtectedMode()
|
||||
{
|
||||
m_protectedMode = !m_protectedMode;
|
||||
m_closeButton->setVisible(!m_protectedMode);
|
||||
m_prevButton->setVisible(!m_protectedMode);
|
||||
m_nextButton->setVisible(!m_protectedMode);
|
||||
updateGalleryButtonsVisibility();
|
||||
}
|
||||
|
||||
void MainWindow::toggleStayOnTop()
|
||||
@ -927,3 +925,13 @@ bool MainWindow::updateFileWatcher(const QString &basePath)
|
||||
if (!basePath.isEmpty()) return m_fileSystemWatcher->addPath(basePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::updateGalleryButtonsVisibility()
|
||||
{
|
||||
const int galleryFileCount = m_pm->totalCount();
|
||||
const bool loopGallery = Settings::instance()->loopGallery();
|
||||
m_prevButton->setVisible(!m_protectedMode && galleryFileCount > 1);
|
||||
m_nextButton->setVisible(!m_protectedMode && galleryFileCount > 1);
|
||||
m_prevButton->setEnabled(loopGallery || !m_pm->isFirstIndex());
|
||||
m_nextButton->setEnabled(loopGallery || !m_pm->isLastIndex());
|
||||
}
|
||||
|
Reference in New Issue
Block a user