]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Qt: put Win32 Main Interface function in its own file.
[vlc] / modules / gui / qt4 / main_interface.cpp
index 99ef957bcd56502df818168d862e725402077dd5..6c717b4d5ad2ece9de87f681480f700d620671bc 100644 (file)
 #include <vlc_keys.h>                       /* Wheel event */
 #include <vlc_vout_display.h>               /* vout_thread_t and VOUT_ events */
 
-#ifdef WIN32 /* Win7 taskbar */
- #include <vlc_windows_interfaces.h>
- #include <QBitmap>
-#endif
-
 // #define DEBUG_INTF
 
 /* Callback prototypes */
@@ -477,158 +472,6 @@ inline void MainInterface::createStatusBar()
              timeLabel, setDisplayPosition( float ) );
 }
 
-#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
-    */
-
-    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
-                        ))
-        {
-            QPixmap img   = QPixmap(":/toolbar/previous_b");
-            QPixmap img2  = QPixmap(":/toolbar/pause_b");
-            QPixmap img3  = QPixmap(":/toolbar/play_b");
-            QPixmap img4  = QPixmap(":/toolbar/next_b");
-            QBitmap mask  = img.createMaskFromColor(Qt::transparent);
-            QBitmap mask2 = img2.createMaskFromColor(Qt::transparent);
-            QBitmap mask3 = img3.createMaskFromColor(Qt::transparent);
-            QBitmap mask4 = img4.createMaskFromColor(Qt::transparent);
-
-            if(-1 == ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha),mask.toWinHBITMAP()))
-                msg_Err( p_intf, "ImageList_Add failed" );
-            if(-1 == ImageList_Add(himl, img2.toWinHBITMAP(QPixmap::PremultipliedAlpha),mask2.toWinHBITMAP()))
-                msg_Err( p_intf, "ImageList_Add failed" );
-            if(-1 == ImageList_Add(himl, img3.toWinHBITMAP(QPixmap::PremultipliedAlpha),mask3.toWinHBITMAP()))
-                msg_Err( p_intf, "ImageList_Add failed" );
-            if(-1 == ImageList_Add(himl, img4.toWinHBITMAP(QPixmap::PremultipliedAlpha),mask4.toWinHBITMAP()))
-                msg_Err( p_intf, "ImageList_Add failed" );
-        }
-
-        // 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
-        {
-            hr = p_taskbl->vt->ThumbBarAddButtons(p_taskbl, winId(), 3, thbButtons);
-            if(S_OK != hr)
-                msg_Err( p_intf, "ThumbBarAddButtons failed with error %08x", hr );
-        }
-        CONNECT( THEMIM->getIM(), statusChanged( int ), this, changeThumbbarButtons( int ) );
-    }
-    else
-    {
-        himl = NULL;
-        p_taskbl = NULL;
-    }
-
-}
-
-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
  **********************************************************************/
@@ -1447,58 +1290,6 @@ void MainInterface::toggleFullScreen( void )
 
 }
 
-//moc doesn't know about #ifdef, so we have to build this method for every platform
-void MainInterface::changeThumbbarButtons( int i_status)
-{
-#ifdef WIN32
-    // Define an array of three buttons. These buttons provide images through an
-    // image list and also provide tooltips.
-    DWORD dwMask = THB_BITMAP | THB_FLAGS;
-
-    THUMBBUTTON thbButtons[3];
-    //prev
-    thbButtons[0].dwMask = dwMask;
-    thbButtons[0].iId = 0;
-    thbButtons[0].iBitmap = 0;
-
-    //play/pause
-    thbButtons[1].dwMask = dwMask;
-    thbButtons[1].iId = 1;
-
-    //next
-    thbButtons[2].dwMask = dwMask;
-    thbButtons[2].iId = 2;
-    thbButtons[2].iBitmap = 3;
-
-    switch( i_status )
-    {
-        case PLAYING_S:
-            {
-                thbButtons[0].dwFlags = THBF_ENABLED;
-                thbButtons[1].dwFlags = THBF_ENABLED;
-                thbButtons[2].dwFlags = THBF_ENABLED;
-                thbButtons[1].iBitmap = 1;
-                break;
-            }
-        case PAUSE_S:
-            {
-                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, this->winId(), 3, thbButtons);
-    if(S_OK != hr)
-        msg_Err( p_intf, "ThumbBarUpdateButtons failed with error %08x", hr );
-#else
-    ;
-#endif
-}
-
 /*****************************************************************************
  * PopupMenuCB: callback triggered by the intf-popupmenu playlist variable.
  *  We don't show the menu directly here because we don't want the