[vlc-commits] main_interface_win32: Adapt taskbar buttons based on the playlist
Hugo Beauzée-Luyssen
git at videolan.org
Thu Dec 29 11:36:06 CET 2016
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Dec 29 10:35:25 2016 +0100| [44cf24579a0aa2534959750dddce6272a4461092] | committer: Hugo Beauzée-Luyssen
main_interface_win32: Adapt taskbar buttons based on the playlist
Fix #10429
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=44cf24579a0aa2534959750dddce6272a4461092
---
modules/gui/qt/main_interface.hpp | 2 ++
modules/gui/qt/main_interface_win32.cpp | 29 ++++++++++++++++++++---------
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp
index 5a13733..a69eac7 100644
--- a/modules/gui/qt/main_interface.hpp
+++ b/modules/gui/qt/main_interface.hpp
@@ -211,6 +211,8 @@ public slots:
#ifdef _WIN32
void changeThumbbarButtons( int );
+ void playlistItemAppended( int itemId, int parentId );
+ void playlistItemRemoved( int itemId );
#endif
/* Manage the Video Functions from the vout threads */
diff --git a/modules/gui/qt/main_interface_win32.cpp b/modules/gui/qt/main_interface_win32.cpp
index f8e80a3..7eef3cc 100644
--- a/modules/gui/qt/main_interface_win32.cpp
+++ b/modules/gui/qt/main_interface_win32.cpp
@@ -169,17 +169,17 @@ void MainInterface::createTaskBarButtons()
thbButtons[0].dwMask = dwMask;
thbButtons[0].iId = 0;
thbButtons[0].iBitmap = 0;
- thbButtons[0].dwFlags = THBF_HIDDEN;
+ thbButtons[0].dwFlags = THEPL->items.i_size > 1 ? THBF_ENABLED : THBF_HIDDEN;
thbButtons[1].dwMask = dwMask;
thbButtons[1].iId = 1;
thbButtons[1].iBitmap = 2;
- thbButtons[1].dwFlags = THBF_HIDDEN;
+ thbButtons[1].dwFlags = THEPL->items.i_size > 0 ? THBF_ENABLED : THBF_HIDDEN;
thbButtons[2].dwMask = dwMask;
thbButtons[2].iId = 2;
thbButtons[2].iBitmap = 3;
- thbButtons[2].dwFlags = THBF_HIDDEN;
+ thbButtons[2].dwFlags = THEPL->items.i_size > 1 ? THBF_ENABLED : THBF_HIDDEN;
hr = p_taskbl->ThumbBarSetImageList( WinId(this), himl );
if( FAILED(hr) )
@@ -194,6 +194,10 @@ void MainInterface::createTaskBarButtons()
}
CONNECT( THEMIM->getIM(), playingStatusChanged( int ),
this, changeThumbbarButtons( int ) );
+ CONNECT( THEMIM, playlistItemAppended( int, int ),
+ this, playlistItemAppended( int, int ) );
+ CONNECT( THEMIM, playlistItemRemoved( int ),
+ this, playlistItemRemoved( int ) );
if( THEMIM->getIM()->playingStatus() == PLAYING_S )
changeThumbbarButtons( THEMIM->getIM()->playingStatus() );
}
@@ -303,6 +307,16 @@ bool MainInterface::winEvent ( MSG * msg, long * result )
return false;
}
+void MainInterface::playlistItemAppended( int, int )
+{
+ changeThumbbarButtons( THEMIM->getIM()->playingStatus() );
+}
+
+void MainInterface::playlistItemRemoved( int )
+{
+ changeThumbbarButtons( THEMIM->getIM()->playingStatus() );
+}
+
void MainInterface::changeThumbbarButtons( int i_status )
{
if( p_taskbl == NULL )
@@ -317,24 +331,24 @@ void MainInterface::changeThumbbarButtons( int i_status )
thbButtons[0].dwMask = dwMask;
thbButtons[0].iId = 0;
thbButtons[0].iBitmap = 0;
+ thbButtons[0].dwFlags = THEPL->items.i_size > 1 ? THBF_ENABLED : THBF_HIDDEN;
//play/pause
thbButtons[1].dwMask = dwMask;
thbButtons[1].iId = 1;
+ thbButtons[1].dwFlags = THBF_ENABLED;
//next
thbButtons[2].dwMask = dwMask;
thbButtons[2].iId = 2;
thbButtons[2].iBitmap = 3;
+ thbButtons[2].dwFlags = THEPL->items.i_size > 1 ? THBF_ENABLED : THBF_HIDDEN;
switch( i_status )
{
case OPENING_S:
case PLAYING_S:
{
- thbButtons[0].dwFlags = THBF_ENABLED;
- thbButtons[1].dwFlags = THBF_ENABLED;
- thbButtons[2].dwFlags = THBF_ENABLED;
thbButtons[1].iBitmap = 1;
break;
}
@@ -342,9 +356,6 @@ void MainInterface::changeThumbbarButtons( int i_status )
case PAUSE_S:
case ERROR_S:
{
- thbButtons[0].dwFlags = THBF_ENABLED;
- thbButtons[1].dwFlags = THBF_ENABLED;
- thbButtons[2].dwFlags = THBF_ENABLED;
thbButtons[1].iBitmap = 2;
break;
}
More information about the vlc-commits
mailing list