@@ -225,6 +225,20 @@ MainWindow::MainWindow()
225225 connect (actionNextSelectedPageW, SIGNAL (triggered (bool )), this , SLOT (goNextSelectedPage ()));
226226 connect (actionAbout, SIGNAL (triggered (bool )), this , SLOT (showAboutDialog ()));
227227 connect (&OutOfMemoryHandler::instance (), SIGNAL (outOfMemory ()), SLOT (handleOutOfMemorySituation ()));
228+ connect (prevPageBtn, &QToolButton::clicked, this , [this ]() {
229+ if (filterSelectedBtn->isChecked ()) {
230+ goPrevSelectedPage ();
231+ } else {
232+ goPrevPage ();
233+ }
234+ });
235+ connect (nextPageBtn, &QToolButton::clicked, this , [this ]() {
236+ if (filterSelectedBtn->isChecked ()) {
237+ goNextSelectedPage ();
238+ } else {
239+ goNextPage ();
240+ }
241+ });
228242
229243 connect (actionSwitchFilter1, SIGNAL (triggered (bool )), SLOT (switchFilter1 ()));
230244 connect (actionSwitchFilter2, SIGNAL (triggered (bool )), SLOT (switchFilter2 ()));
@@ -283,6 +297,12 @@ MainWindow::MainWindow()
283297 }
284298 }
285299 m_autoSaveProject = settings.value (" settings/auto_save_project" ).toBool ();
300+
301+ m_maxLogicalThumbSizeUpdater.setSingleShot (true );
302+ connect (&m_maxLogicalThumbSizeUpdater, &QTimer::timeout, this , &MainWindow::updateMaxLogicalThumbSize);
303+
304+ m_sceneItemsPosUpdater.setSingleShot (true );
305+ connect (&m_sceneItemsPosUpdater, &QTimer::timeout, m_thumbSequence.get (), &ThumbnailSequence::updateSceneItemsPos);
286306}
287307
288308MainWindow::~MainWindow () {
@@ -438,23 +458,27 @@ void MainWindow::createBatchProcessingWidget() {
438458 connect (stop_btn, SIGNAL (clicked ()), SLOT (stopBatchProcessing ()));
439459} // MainWindow::createBatchProcessingWidget
440460
441- void MainWindow::setupThumbView () {
461+ void MainWindow::updateThumbViewMinWidth () {
442462 const int sb = thumbView->style ()->pixelMetric (QStyle::PM_ScrollBarExtent);
443463 int inner_width = thumbView->maximumViewportSize ().width () - sb;
444464 if (thumbView->style ()->styleHint (QStyle::SH_ScrollView_FrameOnlyAroundContents, 0 , thumbView)) {
445465 inner_width -= thumbView->frameWidth () * 2 ;
446466 }
447467 const int delta_x = thumbView->size ().width () - inner_width;
448468 thumbView->setMinimumWidth ((int ) std::ceil (m_maxLogicalThumbSize.width () + delta_x));
469+ }
449470
471+ void MainWindow::setupThumbView () {
472+ updateThumbViewMinWidth ();
450473 m_thumbSequence->attachView (thumbView);
451-
452474 thumbView->installEventFilter (this );
453475}
454476
455477bool MainWindow::eventFilter (QObject* obj, QEvent* ev) {
456478 if ((obj == thumbView) && (ev->type () == QEvent::Resize)) {
457- emit invalidateAllThumbnails ();
479+ if (!m_sceneItemsPosUpdater.isActive ()) {
480+ m_sceneItemsPosUpdater.start (150 );
481+ }
458482 }
459483
460484 if ((obj == thumbView || obj == thumbView->verticalScrollBar ()) && (ev->type () == QEvent::Wheel)) {
@@ -1385,19 +1409,32 @@ void MainWindow::openDefaultParamsDialog() {
13851409
13861410void MainWindow::onSettingsChanged () {
13871411 QSettings settings;
1412+ bool need_invalidate = true ;
13881413
13891414 m_autoSaveProject = settings.value (" settings/auto_save_project" ).toBool ();
13901415
13911416 if (auto * app = dynamic_cast <Application*>(qApp)) {
13921417 app->installLanguage (settings.value (" settings/language" ).toString ());
13931418 }
13941419
1420+ if (m_thumbnailCache) {
1421+ const QSize max_thumb_size = settings.value (" settings/thumbnail_quality" ).toSize ();
1422+ if (m_thumbnailCache->getMaxThumbSize () != max_thumb_size) {
1423+ m_thumbnailCache->setMaxThumbSize (max_thumb_size);
1424+ need_invalidate = true ;
1425+ }
1426+ }
1427+
13951428 const QSizeF max_logical_thumb_size = settings.value (" settings/max_logical_thumb_size" ).toSizeF ();
13961429 if (m_maxLogicalThumbSize != max_logical_thumb_size) {
1397- updateMaxLogicalThumbSize (max_logical_thumb_size);
1430+ m_maxLogicalThumbSize = max_logical_thumb_size;
1431+ updateMaxLogicalThumbSize ();
1432+ need_invalidate = false ;
13981433 }
13991434
1400- m_thumbSequence->invalidateAllThumbnails ();
1435+ if (need_invalidate) {
1436+ m_thumbSequence->invalidateAllThumbnails ();
1437+ }
14011438}
14021439
14031440void MainWindow::showAboutDialog () {
@@ -1567,7 +1604,7 @@ void MainWindow::updateWindowTitle() {
15671604 } else if (cli.hasWindowTitle ()) {
15681605 project_name = cli.getWindowTitle ();
15691606 } else {
1570- project_name = QFileInfo (m_projectFile).baseName ();
1607+ project_name = QFileInfo (m_projectFile).completeBaseName ();
15711608 }
15721609 const QString version (QString::fromUtf8 (VERSION));
15731610 setWindowTitle (tr (" %2 - ScanTailor Advanced [%1bit]" ).arg (sizeof (void *) * 8 ).arg (project_name));
@@ -2015,16 +2052,17 @@ void MainWindow::scaleThumbnails(const QWheelEvent* wheel_event) {
20152052 const double dy = std::copysign (16.0 , wheel_dist);
20162053 const double width = qBound (100.0 , m_maxLogicalThumbSize.width () + dx, 1000.0 );
20172054 const double height = qBound (64.0 , m_maxLogicalThumbSize.height () + dy, 640.0 );
2018- updateMaxLogicalThumbSize (QSizeF (width, height));
2055+ m_maxLogicalThumbSize = QSizeF (width, height);
2056+ if (!m_maxLogicalThumbSizeUpdater.isActive ()) {
2057+ m_maxLogicalThumbSizeUpdater.start (350 );
2058+ }
20192059
20202060 QSettings ().setValue (" settings/max_logical_thumb_size" , m_maxLogicalThumbSize);
20212061 }
20222062}
20232063
2024- void MainWindow::updateMaxLogicalThumbSize (const QSizeF& size) {
2025- m_maxLogicalThumbSize = size;
2026-
2064+ void MainWindow::updateMaxLogicalThumbSize () {
20272065 m_thumbSequence->setMaxLogicalThumbSize (m_maxLogicalThumbSize);
2028- setupThumbView ();
2066+ updateThumbViewMinWidth ();
20292067 resetThumbSequence (currentPageOrderProvider (), ThumbnailSequence::KEEP_SELECTION);
2030- }
2068+ }
0 commit comments