[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: use `hasPrev()`/`hasNext()` instead of `count()` in Win32 thumb bar prev/next buttons

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Mar 28 06:08:35 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
26994740 by Fatih Uzunoglu at 2025-03-28T05:44:38+00:00
qt: use `hasPrev()`/`hasNext()` instead of `count()` in Win32 thumb bar prev/next buttons

- - - - -
629d1d64 by Fatih Uzunoglu at 2025-03-28T05:44:38+00:00
qt: disable Win32 thumb bar buttons instead of hiding

This is mainly because when all of them are hidden, there
is still a gap between the DWM thumbnail and and the task
bar.

- - - - -


2 changed files:

- modules/gui/qt/maininterface/mainctx_win32.cpp
- modules/gui/qt/maininterface/mainctx_win32.hpp


Changes:

=====================================
modules/gui/qt/maininterface/mainctx_win32.cpp
=====================================
@@ -656,17 +656,17 @@ void WinTaskbarWidget::createTaskBarButtons()
     thbButtons[0].dwMask = dwMask;
     thbButtons[0].iId = 0;
     thbButtons[0].iBitmap = 0;
-    thbButtons[0].dwFlags = THEMPL->count() > 1 ? THBF_ENABLED : THBF_HIDDEN;
+    thbButtons[0].dwFlags = THEMPL->hasPrev() ? THBF_ENABLED : THBF_DISABLED;
 
     thbButtons[1].dwMask = dwMask;
     thbButtons[1].iId = 1;
     thbButtons[1].iBitmap = 2;
-    thbButtons[1].dwFlags = THEMPL->count() > 0 ? THBF_ENABLED : THBF_HIDDEN;
+    thbButtons[1].dwFlags = THEMPL->count() > 0 ? THBF_ENABLED : THBF_DISABLED;
 
     thbButtons[2].dwMask = dwMask;
     thbButtons[2].iId = 2;
     thbButtons[2].iBitmap = 3;
-    thbButtons[2].dwFlags = THEMPL->count() > 1 ? THBF_ENABLED : THBF_HIDDEN;
+    thbButtons[2].dwFlags = THEMPL->hasNext() ? THBF_ENABLED : THBF_DISABLED;
 
     hr = p_taskbl->ThumbBarSetImageList( winId, himl );
     if( FAILED(hr) )
@@ -683,8 +683,12 @@ void WinTaskbarWidget::createTaskBarButtons()
              this, &WinTaskbarWidget::changeThumbbarButtons);
     connect( THEMPL, &vlc::playlist::PlaylistController::countChanged,
             this, &WinTaskbarWidget::playlistItemCountChanged );
+    connect( THEMPL, &vlc::playlist::PlaylistController::hasPrevChanged,
+            this, &WinTaskbarWidget::changeThumbbarButtons );
+    connect( THEMPL, &vlc::playlist::PlaylistController::hasNextChanged,
+            this, &WinTaskbarWidget::changeThumbbarButtons );
     if( THEMIM->getPlayingState() == PlayerController::PLAYING_STATE_PLAYING )
-        changeThumbbarButtons( THEMIM->getPlayingState() );
+        changeThumbbarButtons( );
 }
 
 bool WinTaskbarWidget::nativeEventFilter(const QByteArray &, void *message, qintptr* /* result */)
@@ -724,16 +728,16 @@ bool WinTaskbarWidget::nativeEventFilter(const QByteArray &, void *message, qint
 
 void WinTaskbarWidget::playlistItemCountChanged( size_t  )
 {
-    changeThumbbarButtons( THEMIM->getPlayingState() );
+    changeThumbbarButtons( );
 }
 
 void WinTaskbarWidget::onVideoFullscreenChanged( bool fs )
 {
     if( !fs )
-        changeThumbbarButtons( THEMIM->getPlayingState() );
+        changeThumbbarButtons( );
 }
 
-void WinTaskbarWidget::changeThumbbarButtons( PlayerController::PlayingState i_status )
+void WinTaskbarWidget::changeThumbbarButtons( )
 {
     if( p_taskbl == NULL )
         return;
@@ -747,7 +751,7 @@ void WinTaskbarWidget::changeThumbbarButtons( PlayerController::PlayingState i_s
     thbButtons[0].dwMask = dwMask;
     thbButtons[0].iId = 0;
     thbButtons[0].iBitmap = 0;
-    thbButtons[0].dwFlags = THEMPL->count() > 1 ? THBF_ENABLED : THBF_HIDDEN;
+    thbButtons[0].dwFlags = THEMPL->hasPrev() ? THBF_ENABLED : THBF_DISABLED;
 
     //play/pause
     thbButtons[1].dwMask = dwMask;
@@ -758,9 +762,9 @@ void WinTaskbarWidget::changeThumbbarButtons( PlayerController::PlayingState i_s
     thbButtons[2].dwMask = dwMask;
     thbButtons[2].iId = 2;
     thbButtons[2].iBitmap = 3;
-    thbButtons[2].dwFlags = THEMPL->count() > 1 ? THBF_ENABLED : THBF_HIDDEN;
+    thbButtons[2].dwFlags = THEMPL->hasNext() ? THBF_ENABLED : THBF_DISABLED;
 
-    switch( i_status )
+    switch( THEMIM->getPlayingState() )
     {
         case PlayerController::PLAYING_STATE_PLAYING:
             {


=====================================
modules/gui/qt/maininterface/mainctx_win32.hpp
=====================================
@@ -46,7 +46,7 @@ private:
     void createTaskBarButtons();
 
 private slots:
-    void changeThumbbarButtons(PlayerController::PlayingState );
+    void changeThumbbarButtons();
     void playlistItemCountChanged( size_t itemId );
     virtual void onVideoFullscreenChanged( bool fs );
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/da9b147a867e7633349452f0bab82c3139f5b2e3...629d1d6405eef40d142931f47d46f4d9efc75689

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/da9b147a867e7633349452f0bab82c3139f5b2e3...629d1d6405eef40d142931f47d46f4d9efc75689
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list