// // FUNCTION: InitInstance(HINSTANCE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPED | WS_SYSMENU, CW_USEDEFAULT, 0, 275, 154, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } ShowWindow(hWnd, SW_HIDE); UpdateWindow(hWnd); initSystray(hWnd, hInstance); SetTimer(hWnd, // handle to main window IDT_TIMERGLOBAL, // timer identifier 1000, // 1-seconds interval (TIMERPROC)NULL); // no timer callback return TRUE; }
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) { /* Variables initialisation */ bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL; stackCentralOldWidget= NULL; #ifndef HAVE_MAEMO sysTray = NULL; #endif fullscreenControls = NULL; cryptedLabel = NULL; controls = NULL; inputC = NULL; b_hideAfterCreation = false; // --qt-start-minimized playlistVisible = false; input_name = ""; /* Ask for Privacy */ FirstRun::CheckAndRun( this, p_intf ); /** * Configuration and settings * Pre-building of interface **/ /* Main settings */ setFocusPolicy( Qt::StrongFocus ); setAcceptDrops( true ); setWindowRole( "vlc-main" ); setWindowIcon( QApplication::windowIcon() ); setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) ); #ifdef Q_WS_MAC setAttribute( Qt::WA_MacBrushedMetal ); #endif /* Is video in embedded in the UI or not */ b_videoEmbedded = var_InheritBool( p_intf, "embedded-video" ); /* Does the interface resize to video size or the opposite */ b_autoresize = var_InheritBool( p_intf, "qt-video-autoresize" ); /* Are we in the enhanced always-video mode or not ? */ b_minimalView = var_InheritBool( p_intf, "qt-minimal-view" ); /* Do we want anoying popups or not */ b_notificationEnabled = var_InheritBool( p_intf, "qt-notification" ); /* Set the other interface settings */ settings = getSettings(); settings->beginGroup( "MainWindow" ); /* */ b_plDocked = getSettings()->value( "pl-dock-status", true ).toBool(); settings->endGroup( ); /************** * Status Bar * **************/ createStatusBar(); /************************** * UI and Widgets design **************************/ setVLCWindowsTitle(); /************ * Menu Bar * ************/ QVLCMenu::createMenuBar( this, p_intf ); CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), this, destroyPopupMenu() ); createMainWidget( settings ); /********************************* * Create the Systray Management * *********************************/ initSystray(); /******************** * Input Manager * ********************/ MainInputManager::getInstance( p_intf ); #ifdef WIN32 himl = NULL; p_taskbl = NULL; taskbar_wmsg = RegisterWindowMessage("TaskbarButtonCreated"); #endif /************************************************************ * Connect the input manager to the GUI elements it manages * ************************************************************/ /** * Connects on nameChanged() * Those connects are different because options can impeach them to trigger. **/ /* Main Interface statusbar */ CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, setName( const QString& ) ); /* and systray */ #ifndef HAVE_MAEMO if( sysTray ) { CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, updateSystrayTooltipName( const QString& ) ); } #endif /* and title of the Main Interface*/ if( var_InheritBool( p_intf, "qt-name-in-title" ) ) { CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, setVLCWindowsTitle( const QString& ) ); }
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) { /* Variables initialisation */ // need_components_update = false; bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL; #ifndef HAVE_MAEMO sysTray = NULL; #endif videoIsActive = false; playlistVisible = false; input_name = ""; fullscreenControls = NULL; cryptedLabel = NULL; controls = NULL; inputC = NULL; b_shouldHide = false; bgWasVisible = false; i_bg_height = 0; /* Ask for privacy */ askForPrivacy(); /** * Configuration and settings * Pre-building of interface **/ /* Main settings */ setFocusPolicy( Qt::StrongFocus ); setAcceptDrops( true ); setWindowRole( "vlc-main" ); setWindowIcon( QApplication::windowIcon() ); setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) ); /* Set The Video In emebedded Mode or not */ videoEmbeddedFlag = config_GetInt( p_intf, "embedded-video" ); /* Does the interface resize to video size or the opposite */ b_keep_size = !config_GetInt( p_intf, "qt-video-autoresize" ); /* Are we in the enhanced always-video mode or not ? */ i_visualmode = config_GetInt( p_intf, "qt-display-mode" ); /* Do we want anoying popups or not */ notificationEnabled = (bool)config_GetInt( p_intf, "qt-notification" ); /* Set the other interface settings */ settings = getSettings(); settings->beginGroup( "MainWindow" ); /** * Retrieve saved sizes for main window * mainBasedSize = based window size for normal mode * (no video, no background) * mainVideoSize = window size with video (all modes) **/ mainBasedSize = settings->value( "mainBasedSize", QSize( 350, 120 ) ).toSize(); mainVideoSize = settings->value( "mainVideoSize", QSize( 400, 300 ) ).toSize(); /************** * Status Bar * **************/ createStatusBar(); /************************** * UI and Widgets design **************************/ setVLCWindowsTitle(); createMainWidget( settings ); /************ * Menu Bar * ************/ QVLCMenu::createMenuBar( this, p_intf ); CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), this, destroyPopupMenu() ); #if 0 /* Create a Dock to get the playlist */ dockPL = new QDockWidget( qtr( "Playlist" ), this ); dockPL->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); dockPL->setFeatures( QDockWidget::AllDockWidgetFeatures ); dockPL->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea ); dockPL->hide(); #endif /********************************* * Create the Systray Management * *********************************/ initSystray(); /******************** * Input Manager * ********************/ MainInputManager::getInstance( p_intf ); /************************************************************ * Connect the input manager to the GUI elements it manages * ************************************************************/ /** * Connects on nameChanged() * Those connects are different because options can impeach them to trigger. **/ /* Main Interface statusbar */ CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, setName( const QString& ) ); /* and systray */ #ifndef HAVE_MAEMO if( sysTray ) { CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, updateSystrayTooltipName( const QString& ) ); } #endif /* and title of the Main Interface*/ if( config_GetInt( p_intf, "qt-name-in-title" ) ) { CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, setVLCWindowsTitle( const QString& ) ); }