[haiku-commits] Change in haiku[master]: ShowImage: Reset slide show delay if a user interferes

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 29 Jun 2020 14:57:49 +0000

From humdinger <humdingerb@xxxxxxxxx>:

humdinger has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2967 ;)


Change subject: ShowImage: Reset slide show delay if a user interferes
......................................................................

ShowImage: Reset slide show delay if a user interferes

This change resets the delay by calling _StartSlideShow() when the user
moves to next/previous or deletes an image while a slide show is running.

Fixes #16321
---
M src/apps/showimage/ShowImageWindow.cpp
M src/apps/showimage/ShowImageWindow.h
2 files changed, 16 insertions(+), 3 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/67/2967/1

diff --git a/src/apps/showimage/ShowImageWindow.cpp 
b/src/apps/showimage/ShowImageWindow.cpp
index 724b4ff..9dd0a8e 100644
--- a/src/apps/showimage/ShowImageWindow.cpp
+++ b/src/apps/showimage/ShowImageWindow.cpp
@@ -840,8 +840,10 @@
                        break;

                case MSG_FILE_PREV:
-                       if (_ClosePrompt() && fNavigator.PreviousFile())
+                       if (_ClosePrompt() && fNavigator.PreviousFile()) {
+                               _ResetSlideShowDelay();
                                _LoadImage(false);
+                       }
                        break;

                case MSG_FILE_NEXT:
@@ -851,15 +853,17 @@
                                        // Wrap back around
                                        fNavigator.FirstFile();
                                }
+                               _ResetSlideShowDelay();
                                _LoadImage();
                        }
                        break;
 
                case kMsgDeleteCurrentFile:
                {
-                       if (fNavigator.MoveFileToTrash())
+                       if (fNavigator.MoveFileToTrash()) {
+                               _ResetSlideShowDelay();
                                _LoadImage();
-                       else
+                       } else
                                PostMessage(B_QUIT_REQUESTED);
                        break;
                }
@@ -1514,6 +1518,14 @@


 void
+ShowImageWindow::_ResetSlideShowDelay()
+{
+       if (fSlideShowRunner != NULL)
+               fSlideShowRunner->SetInterval(fSlideShowDelay);
+}
+
+
+void
 ShowImageWindow::_UpdateRatingMenu()
 {
        BFile file(&fNavigator.CurrentRef(), B_READ_ONLY);
diff --git a/src/apps/showimage/ShowImageWindow.h 
b/src/apps/showimage/ShowImageWindow.h
index 1fb2871..f276647 100644
--- a/src/apps/showimage/ShowImageWindow.h
+++ b/src/apps/showimage/ShowImageWindow.h
@@ -101,6 +101,7 @@
                        void                            
_SetSlideShowDelay(bigtime_t delay);
                        void                            _StartSlideShow();
                        void                            _StopSlideShow();
+                       void                            _ResetSlideShowDelay();

                        void                            _UpdateRatingMenu();


--
To view, visit https://review.haiku-os.org/c/haiku/+/2967
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: If0b8f4caef9c6aa4c0ad5bbb01d65bf43c1f831f
Gerrit-Change-Number: 2967
Gerrit-PatchSet: 1
Gerrit-Owner: humdinger <humdingerb@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: ShowImage: Reset slide show delay if a user interferes - Gerrit