Commit 92661c0e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: clean and cosmetics

parent 84a974e6
...@@ -83,7 +83,6 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable, ...@@ -83,7 +83,6 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{ {
/* Variables initialisation */ /* Variables initialisation */
// need_components_update = false;
bgWidget = NULL; bgWidget = NULL;
videoWidget = NULL; videoWidget = NULL;
playlistWidget = NULL; playlistWidget = NULL;
...@@ -95,12 +94,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -95,12 +94,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
controls = NULL; controls = NULL;
inputC = NULL; inputC = NULL;
b_hideAfterCreation = false; b_hideAfterCreation = false; // --qt-start-minimized
playlistVisible = false; // FIXME remove playlistVisible = false; // FIXME remove
input_name = ""; input_name = "";
i_bg_height = 0; i_bg_height = 0;
/* Ask for Privacy */ /* Ask for Privacy */
FirstRun::CheckAndRun( this, p_intf ); FirstRun::CheckAndRun( this, p_intf );
...@@ -116,7 +115,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -116,7 +115,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) ); setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) );
/* Set The Video In emebedded Mode or not */ /* Set The Video In emebedded Mode or not */
videoEmbeddedFlag = var_InheritBool( p_intf, "embedded-video" ); b_videoEmbedded = var_InheritBool( p_intf, "embedded-video" );
/* Does the interface resize to video size or the opposite */ /* Does the interface resize to video size or the opposite */
b_keep_size = !var_InheritBool( p_intf, "qt-video-autoresize" ); b_keep_size = !var_InheritBool( p_intf, "qt-video-autoresize" );
...@@ -125,7 +124,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -125,7 +124,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
i_visualmode = var_InheritInteger( p_intf, "qt-display-mode" ); i_visualmode = var_InheritInteger( p_intf, "qt-display-mode" );
/* Do we want anoying popups or not */ /* Do we want anoying popups or not */
notificationEnabled = var_InheritBool( p_intf, "qt-notification" ); b_notificationEnabled = var_InheritBool( p_intf, "qt-notification" );
/* Set the other interface settings */ /* Set the other interface settings */
settings = getSettings(); settings = getSettings();
...@@ -343,8 +342,7 @@ MainInterface::~MainInterface() ...@@ -343,8 +342,7 @@ MainInterface::~MainInterface()
settings->setValue( "mainBasedSize", mainBasedSize ); settings->setValue( "mainBasedSize", mainBasedSize );
settings->setValue( "mainVideoSize", mainVideoSize ); settings->setValue( "mainVideoSize", mainVideoSize );
if( bgWidget ) settings->setValue( "backgroundSize", bgWidget->size() );
settings->setValue( "backgroundSize", bgWidget->size() );
/* Save this size */ /* Save this size */
QVLCTools::saveWidgetPosition(settings, this); QVLCTools::saveWidgetPosition(settings, this);
...@@ -364,6 +362,7 @@ MainInterface::~MainInterface() ...@@ -364,6 +362,7 @@ MainInterface::~MainInterface()
*****************************/ *****************************/
void MainInterface::recreateToolbars() void MainInterface::recreateToolbars()
{ {
// FIXME: do the same for the FSC
//msg_Dbg( p_intf, "Recreating the toolbars" ); //msg_Dbg( p_intf, "Recreating the toolbars" );
settings->beginGroup( "MainWindow" ); settings->beginGroup( "MainWindow" );
delete controls; delete controls;
...@@ -406,7 +405,7 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -406,7 +405,7 @@ void MainInterface::createMainWidget( QSettings *settings )
/* And video Outputs */ /* And video Outputs */
if( videoEmbeddedFlag ) if( b_videoEmbedded )
{ {
videoWidget = new VideoWidget( p_intf ); videoWidget = new VideoWidget( p_intf );
stackCentralW->insertWidget( VIDEO_TAB, videoWidget ); stackCentralW->insertWidget( VIDEO_TAB, videoWidget );
...@@ -784,7 +783,7 @@ void MainInterface::debug() ...@@ -784,7 +783,7 @@ void MainInterface::debug()
{ {
#ifdef DEBUG_INTF #ifdef DEBUG_INTF
msg_Dbg( p_intf, "Stack Size: %i - %i", stackCentralW->size().height(), size().width() ); msg_Dbg( p_intf, "Stack Size: %i - %i", stackCentralW->size().height(), size().width() );
if( videoEmbeddedFlag ) if( b_videoEmbedded )
msg_Dbg( p_intf, "Stack Size: %i - %i", msg_Dbg( p_intf, "Stack Size: %i - %i",
stackCentralW->widget( VIDEO_TAB )->size().height(), stackCentralW->widget( VIDEO_TAB )->size().height(),
stackCentralW->widget( VIDEO_TAB )->size().width() ); stackCentralW->widget( VIDEO_TAB )->size().width() );
...@@ -863,23 +862,24 @@ void MainInterface::destroyPopupMenu() ...@@ -863,23 +862,24 @@ void MainInterface::destroyPopupMenu()
QVLCMenu::PopupMenu( p_intf, false ); QVLCMenu::PopupMenu( p_intf, false );
} }
void MainInterface::toggleFSC()
{
if( !fullscreenControls ) return;
IMEvent *eShow = new IMEvent( FullscreenControlToggle_Type, 0 );
QApplication::postEvent( fullscreenControls, eShow );
}
void MainInterface::popupMenu( const QPoint &p ) void MainInterface::popupMenu( const QPoint &p )
{ {
/* Ow, that's ugly: don't show the popup menu if cursor over /* FIXME
* Ow, that's ugly: don't show the popup menu if cursor over
* the main menu bar or the status bar */ * the main menu bar or the status bar */
if( !childAt( p ) || ( ( childAt( p ) != menuBar() ) if( !childAt( p ) || ( ( childAt( p ) != menuBar() )
&& ( childAt( p )->parentWidget() != statusBar() ) ) ) && ( childAt( p )->parentWidget() != statusBar() ) ) )
QVLCMenu::PopupMenu( p_intf, true ); QVLCMenu::PopupMenu( p_intf, true );
} }
void MainInterface::toggleFSC()
{
if( !fullscreenControls ) return;
IMEvent *eShow = new IMEvent( FullscreenControlToggle_Type, 0 );
QApplication::postEvent( fullscreenControls, eShow );
}
/**************************************************************************** /****************************************************************************
* Video Handling * Video Handling
****************************************************************************/ ****************************************************************************/
...@@ -901,7 +901,7 @@ private: ...@@ -901,7 +901,7 @@ private:
/** /**
* NOTE: * NOTE:
* You must note change the state of this object or other Qt4 UI objects, * You must not change the state of this object or other Qt4 UI objects,
* from the video output thread - only from the Qt4 UI main loop thread. * from the video output thread - only from the Qt4 UI main loop thread.
* All window provider queries must be handled through signals or events. * All window provider queries must be handled through signals or events.
* That's why we have all those emit statements... * That's why we have all those emit statements...
...@@ -1312,7 +1312,7 @@ void MainInterface::updateSystrayTooltipName( const QString& name ) ...@@ -1312,7 +1312,7 @@ void MainInterface::updateSystrayTooltipName( const QString& name )
else else
{ {
sysTray->setToolTip( name ); sysTray->setToolTip( name );
if( notificationEnabled && ( isHidden() || isMinimized() ) ) if( b_notificationEnabled && ( isHidden() || isMinimized() ) )
{ {
sysTray->showMessage( qtr( "VLC media player" ), name, sysTray->showMessage( qtr( "VLC media player" ), name,
QSystemTrayIcon::NoIcon, 3000 ); QSystemTrayIcon::NoIcon, 3000 );
......
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
protected: protected:
void dropEventPlay( QDropEvent *, bool); void dropEventPlay( QDropEvent *, bool);
#ifdef WIN32 #ifdef WIN32
bool winEvent( MSG *, long * ); virtual bool winEvent( MSG *, long * );
#endif #endif
virtual void dropEvent( QDropEvent *); virtual void dropEvent( QDropEvent *);
virtual void dragEnterEvent( QDragEnterEvent * ); virtual void dragEnterEvent( QDragEnterEvent * );
...@@ -105,21 +105,24 @@ protected: ...@@ -105,21 +105,24 @@ protected:
virtual void resizeEvent( QResizeEvent * event ); virtual void resizeEvent( QResizeEvent * event );
private: private:
/* Main Widgets Creation */
void createMainWidget( QSettings* ); void createMainWidget( QSettings* );
void createStatusBar(); void createStatusBar();
void createPlaylist(); void createPlaylist();
/* Systray */ /* Systray */
void handleSystray();
void createSystray(); void createSystray();
void handleSystray();
void initSystray(); void initSystray();
/* Mess about stackWidget */
void showTab( int i_tab ); void showTab( int i_tab );
void restoreStackOldWidget(); void restoreStackOldWidget();
void showVideo() { showTab( VIDEO_TAB ); } void showVideo() { showTab( VIDEO_TAB ); }
void showBg() { showTab( BACKG_TAB ); } void showBg() { showTab( BACKG_TAB ); }
void hideStackWidget() { showTab( HIDDEN_TAB ); } void hideStackWidget() { showTab( HIDDEN_TAB ); }
/* */
QSettings *settings; QSettings *settings;
#ifndef HAVE_MAEMO #ifndef HAVE_MAEMO
QSystemTrayIcon *sysTray; QSystemTrayIcon *sysTray;
...@@ -131,6 +134,7 @@ private: ...@@ -131,6 +134,7 @@ private:
InputControlsWidget *inputC; InputControlsWidget *inputC;
FullscreenControllerWidget *fullscreenControls; FullscreenControllerWidget *fullscreenControls;
QStackedWidget *stackCentralW; QStackedWidget *stackCentralW;
/* Video */ /* Video */
VideoWidget *videoWidget; VideoWidget *videoWidget;
...@@ -151,19 +155,22 @@ private: ...@@ -151,19 +155,22 @@ private:
}; };
int stackCentralOldState; int stackCentralOldState;
// bool videoIsActive; ///< Having a video now / THEMIM->hasV /* Flags */
bool videoEmbeddedFlag; ///< Want an external Video Window bool b_notificationEnabled; /// Systray Notifications
bool b_keep_size; ///< persistent resizeable window
bool b_videoEmbedded; ///< Want an external Video Window
bool b_hideAfterCreation;
int i_visualmode; ///< Visual Mode
/* States */
bool playlistVisible; ///< Is the playlist visible ? bool playlistVisible; ///< Is the playlist visible ?
bool visualSelectorEnabled; // bool videoIsActive; ///< Having a video now / THEMIM->hasV
bool notificationEnabled; /// Systray Notifications // bool b_visualSelectorEnabled;
bool b_plDocked; ///< Is the playlist docked ?
bool b_keep_size; ///< persistent resizeable window
QSize mainBasedSize; ///< based Wnd (normal mode only) QSize mainBasedSize; ///< based Wnd (normal mode only)
QSize mainVideoSize; ///< Wnd with video (all modes) QSize mainVideoSize; ///< Wnd with video (all modes)
int i_visualmode; ///< Visual Mode
bool b_plDocked;
int i_bg_height; ///< Save height of bgWidget int i_bg_height; ///< Save height of bgWidget
bool b_hideAfterCreation;
#ifdef WIN32 #ifdef WIN32
HIMAGELIST himl; HIMAGELIST himl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment