#include "main_interface.hpp"
#include "input_manager.hpp"
#include "actions_manager.hpp"
+#include "extensions_manager.hpp" // killInstance
#include "util/customwidgets.hpp"
#include "util/qt_dirs.hpp"
#include <vlc_keys.h> /* Wheel event */
#include <vlc_vout_window.h>
-#include <vlc_vout.h>
+#include <vlc_vout_display.h>
// #define DEBUG_INTF
/* Callback prototypes */
i_bg_height = 0;
/* Ask for Privacy */
- new FirstRun( this, p_intf );
+ FirstRun::CheckAndRun( this, p_intf );
/**
* Configuration and settings
setAcceptDrops( true );
setWindowRole( "vlc-main" );
setWindowIcon( QApplication::windowIcon() );
- setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
+ setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) );
/* Set The Video In emebedded Mode or not */
- videoEmbeddedFlag = config_GetInt( p_intf, "embedded-video" );
+ videoEmbeddedFlag = var_InheritBool( p_intf, "embedded-video" );
/* Does the interface resize to video size or the opposite */
- b_keep_size = !config_GetInt( p_intf, "qt-video-autoresize" );
+ b_keep_size = !var_InheritBool( p_intf, "qt-video-autoresize" );
/* Are we in the enhanced always-video mode or not ? */
- i_visualmode = config_GetInt( p_intf, "qt-display-mode" );
+ i_visualmode = var_InheritInteger( p_intf, "qt-display-mode" );
/* Do we want anoying popups or not */
- notificationEnabled = (bool)config_GetInt( p_intf, "qt-notification" );
+ notificationEnabled = (bool)var_InheritBool( p_intf, "qt-notification" );
/* Set the other interface settings */
settings = getSettings();
MainInputManager::getInstance( p_intf );
#ifdef WIN32
- createTaskBarButtons();
+ himl = NULL;
+ p_taskbl = NULL;
+ taskbar_wmsg = RegisterWindowMessage("TaskbarButtonCreated");
#endif
/************************************************************
}
#endif
/* and title of the Main Interface*/
- if( config_GetInt( p_intf, "qt-name-in-title" ) )
+ if( var_InheritBool( p_intf, "qt-name-in-title" ) )
{
CONNECT( THEMIM->getIM(), nameChanged( const QString& ),
this, setVLCWindowsTitle( const QString& ) );
}
msg_Dbg( p_intf, "%i", stackCentralOldState );
+
/* Playlist */
- if( settings->value( "playlist-visible", 0 ).toInt() )
- togglePlaylist();
+ int i_plVis = settings->value( "playlist-visible", 0 ).toInt();
+
settings->endGroup();
+ if( i_plVis ) togglePlaylist();
+
/* Final sizing and showing */
setVisible( !b_hideAfterCreation );
//setMinimumSize( QSize( 0, 0 ) );
/* Be sure to kill the actionsManager... FIXME */
ActionsManager::killInstance();
+ /* Idem, FIXME */
+ ExtensionsManager::killInstance();
+
/* Delete the FSC controller */
delete fullscreenControls;
if ( depth() > 8 )
#endif
/* Create the FULLSCREEN CONTROLS Widget */
- if( config_GetInt( p_intf, "qt-fs-controller" ) )
+ if( var_InheritBool( p_intf, "qt-fs-controller" ) )
{
fullscreenControls = new FullscreenControllerWidget( p_intf, this );
CONNECT( fullscreenControls, keyPressed( QKeyEvent * ),
{
#ifndef HAVE_MAEMO
bool b_systrayAvailable = QSystemTrayIcon::isSystemTrayAvailable();
- bool b_systrayWanted = config_GetInt( p_intf, "qt-system-tray" );
+ bool b_systrayWanted = var_InheritBool( p_intf, "qt-system-tray" );
- if( config_GetInt( p_intf, "qt-start-minimized") > 0 )
+ if( var_InheritBool( p_intf, "qt-start-minimized") )
{
if( b_systrayAvailable )
{
#ifdef WIN32
void MainInterface::createTaskBarButtons()
{
+ taskbar_wmsg = WM_NULL;
/*Here is the code for the taskbar thumb buttons
FIXME:We need pretty buttons in 16x16 px that are handled correctly by masks in Qt
FIXME:the play button's picture doesn't changed to pause when clicked
*/
- OSVERSIONINFO winVer;
- winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if( GetVersionEx(&winVer) && winVer.dwMajorVersion > 5 )
+
+ CoInitialize( 0 );
+
+ if( S_OK == CoCreateInstance( &clsid_ITaskbarList,
+ NULL, CLSCTX_INPROC_SERVER,
+ &IID_ITaskbarList3,
+ (void **)&p_taskbl) )
{
+ p_taskbl->vt->HrInit(p_taskbl);
+
if(himl = ImageList_Create( 15, //cx
- 18, //cy
- ILC_COLOR,//flags
- 4,//initial nb of images
- 0//nb of images that can be added
- ))
+ 18, //cy
+ ILC_COLOR,//flags
+ 4,//initial nb of images
+ 0//nb of images that can be added
+ ))
{
QPixmap img = QPixmap(":/toolbar/previous_b");
QPixmap img2 = QPixmap(":/toolbar/pause_b");
msg_Err( p_intf, "ImageList_Add failed" );
}
- CoInitialize( 0 );
-
- if( S_OK == CoCreateInstance( &clsid_ITaskbarList,
- NULL, CLSCTX_INPROC_SERVER,
- &IID_ITaskbarList3,
- (void **)&p_taskbl) )
+ // Define an array of two buttons. These buttons provide images through an
+ // image list and also provide tooltips.
+ DWORD dwMask = THB_BITMAP | THB_FLAGS;
+
+ THUMBBUTTON thbButtons[3];
+ thbButtons[0].dwMask = dwMask;
+ thbButtons[0].iId = 0;
+ thbButtons[0].iBitmap = 0;
+ thbButtons[0].dwFlags = THBF_HIDDEN;
+
+ thbButtons[1].dwMask = dwMask;
+ thbButtons[1].iId = 1;
+ thbButtons[1].iBitmap = 2;
+ thbButtons[1].dwFlags = THBF_HIDDEN;
+
+ thbButtons[2].dwMask = dwMask;
+ thbButtons[2].iId = 2;
+ thbButtons[2].iBitmap = 3;
+ thbButtons[2].dwFlags = THBF_HIDDEN;
+
+ HRESULT hr = p_taskbl->vt->ThumbBarSetImageList(p_taskbl, winId(), himl );
+ if(S_OK != hr)
+ msg_Err( p_intf, "ThumbBarSetImageList failed with error %08x", hr );
+ else
{
- p_taskbl->vt->HrInit(p_taskbl);
-
- int msg_value = RegisterWindowMessage("TaskbarButtonCreated");
- //msg_Info( p_intf, "msg value: %04x", msg_value );
-
- // Define an array of two buttons. These buttons provide images through an
- // image list and also provide tooltips.
- DWORD dwMask = THB_BITMAP | THB_FLAGS;
-
- THUMBBUTTON thbButtons[2];
- thbButtons[0].dwMask = dwMask;
- thbButtons[0].iId = 0;
- thbButtons[0].iBitmap = 0;
- thbButtons[0].dwFlags = THBF_HIDDEN;
-
- thbButtons[1].dwMask = dwMask;
- thbButtons[1].iId = 1;
- thbButtons[1].iBitmap = 2;
- thbButtons[1].dwFlags = THBF_HIDDEN;
-
- thbButtons[2].dwMask = dwMask;
- thbButtons[2].iId = 2;
- thbButtons[2].iBitmap = 3;
- thbButtons[2].dwFlags = THBF_HIDDEN;
-
- HRESULT hr = p_taskbl->vt->ThumbBarSetImageList(p_taskbl, GetForegroundWindow(), himl );
+ hr = p_taskbl->vt->ThumbBarAddButtons(p_taskbl, winId(), 3, thbButtons);
if(S_OK != hr)
- msg_Err( p_intf, "ThumbBarSetImageList failed with error %08x", hr );
- if(S_OK != p_taskbl->vt->ThumbBarAddButtons(p_taskbl, GetForegroundWindow(), 3, thbButtons))
- msg_Err( p_intf, "ThumbBarAddButtons failed with error %08x", GetLastError() );
-
- CONNECT( THEMIM->getIM(), statusChanged( int ), this, changeThumbbarButtons( int ) );
+ msg_Err( p_intf, "ThumbBarAddButtons failed with error %08x", hr );
}
+ CONNECT( THEMIM->getIM(), statusChanged( int ), this, changeThumbbarButtons( int ) );
}
else
{
himl = NULL;
p_taskbl = NULL;
}
-}
-#endif
+}
+bool MainInterface::winEvent ( MSG * msg, long * result )
+{
+ if (msg->message == taskbar_wmsg)
+ {
+ //We received the taskbarbuttoncreated, now we can really create th buttons
+ createTaskBarButtons();
+ }
+ short cmd;
+ switch( msg->message )
+ {
+ case WM_COMMAND:
+ if (HIWORD(msg->wParam) == THBN_CLICKED)
+ {
+ switch(LOWORD(msg->wParam))
+ {
+ case 0:
+ THEMIM->prev();
+ break;
+ case 1:
+ THEMIM->togglePlayPause();
+ break;
+ case 2:
+ THEMIM->next();
+ break;
+ }
+ }
+ break;
+ case WM_APPCOMMAND:
+ cmd = GET_APPCOMMAND_LPARAM(msg->lParam);
+ switch(cmd)
+ {
+ case APPCOMMAND_MEDIA_PLAY_PAUSE:
+ THEMIM->togglePlayPause();
+ break;
+ case APPCOMMAND_MEDIA_PLAY:
+ THEMIM->play();
+ break;
+ case APPCOMMAND_MEDIA_PAUSE:
+ THEMIM->pause();
+ break;
+ case APPCOMMAND_MEDIA_PREVIOUSTRACK:
+ THEMIM->prev();
+ break;
+ case APPCOMMAND_MEDIA_NEXTTRACK:
+ THEMIM->next();
+ break;
+ case APPCOMMAND_MEDIA_STOP:
+ THEMIM->stop();
+ break;
+ case APPCOMMAND_VOLUME_DOWN:
+ THEAM->AudioDown();
+ break;
+ case APPCOMMAND_VOLUME_UP:
+ THEAM->AudioUp();
+ break;
+ case APPCOMMAND_VOLUME_MUTE:
+ THEAM->toggleMuteAudio();
+ break;
+ default:
+ msg_Dbg( p_intf, "unknown APPCOMMAND = %d", cmd);
+ break;
+ }
+ break;
+ }
+ return false;
+}
+#endif
/**********************************************************************
* Handling of sizing of the components
unsigned int i_height = va_arg( args, unsigned int );
emit askVideoToResize( i_width, i_height );
emit askUpdate();
- return VLC_SUCCESS;
+ return VLC_EGENERIC;
}
- case VOUT_WINDOW_SET_ON_TOP:
+ case VOUT_WINDOW_SET_STATE:
{
- int i_arg = va_arg( args, int );
- QApplication::postEvent( this, new SetVideoOnTopQtEvent( i_arg ) );
+ unsigned i_arg = va_arg( args, unsigned );
+ unsigned on_top = i_arg & VOUT_WINDOW_STATE_ABOVE;
+ QApplication::postEvent( this, new SetVideoOnTopQtEvent( on_top ) );
return VLC_SUCCESS;
}
case VOUT_WINDOW_SET_FULLSCREEN:
void MainInterface::changeThumbbarButtons( int i_status)
{
#ifdef WIN32
- // Define an array of two buttons. These buttons provide images through an
+ // Define an array of three buttons. These buttons provide images through an
// image list and also provide tooltips.
DWORD dwMask = THB_BITMAP | THB_FLAGS;
switch( i_status )
{
- case 0:
- case END_S:
- {
- thbButtons[0].dwFlags = THBF_HIDDEN;
- thbButtons[1].dwFlags = THBF_HIDDEN;
- thbButtons[2].dwFlags = THBF_HIDDEN;
- break;
- }
case PLAYING_S:
{
thbButtons[0].dwFlags = THBF_ENABLED;
}
case PAUSE_S:
{
- //thbButtons[0].dwFlags = THBF_ENABLED;
- //thbButtons[1].dwFlags = THBF_ENABLED;
- //thbButtons[2].dwFlags = THBF_ENABLED;
+ thbButtons[0].dwFlags = THBF_ENABLED;
+ thbButtons[1].dwFlags = THBF_ENABLED;
+ thbButtons[2].dwFlags = THBF_ENABLED;
thbButtons[1].iBitmap = 2;
break;
}
+ default:
+ return;
}
-
- HRESULT hr = p_taskbl->vt->ThumbBarUpdateButtons(p_taskbl, GetForegroundWindow(), 3, thbButtons);
+ HRESULT hr = p_taskbl->vt->ThumbBarUpdateButtons(p_taskbl, this->winId(), 3, thbButtons);
if(S_OK != hr)
msg_Err( p_intf, "ThumbBarUpdateButtons failed with error %08x", hr );
#else