Commit fabb1d71 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: mainInterface cleanup and simplifications

Functions renaming, dead code removal, simplifications and various resizing fixes.
parent 81b4ed0e
...@@ -68,6 +68,8 @@ AbstractController::AbstractController( intf_thread_t * _p_i, QWidget *_parent ) ...@@ -68,6 +68,8 @@ AbstractController::AbstractController( intf_thread_t * _p_i, QWidget *_parent )
CONNECT( toolbarActionsMapper, mapped( int ), CONNECT( toolbarActionsMapper, mapped( int ),
ActionsManager::getInstance( p_intf ), doAction( int ) ); ActionsManager::getInstance( p_intf ), doAction( int ) );
CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) ); CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
} }
/* Reemit some signals on status Change to activate some buttons */ /* Reemit some signals on status Change to activate some buttons */
......
...@@ -86,7 +86,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -86,7 +86,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
b_hideAfterCreation = false; // --qt-start-minimized b_hideAfterCreation = false; // --qt-start-minimized
playlistVisible = false; playlistVisible = false;
input_name = ""; input_name = "";
i_bg_height = 0;
/* Ask for Privacy */ /* Ask for Privacy */
...@@ -226,7 +225,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -226,7 +225,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
this, handleKeyPress( QKeyEvent * ) ); this, handleKeyPress( QKeyEvent * ) );
} }
CONNECT( this, askUpdate(), this, doComponentsUpdate() );
CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() ); CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() );
/** END of CONNECTS**/ /** END of CONNECTS**/
...@@ -341,9 +339,9 @@ void MainInterface::recreateToolbars() ...@@ -341,9 +339,9 @@ void MainInterface::recreateToolbars()
controls = new ControlsWidget( p_intf, false, this ); /* FIXME */ controls = new ControlsWidget( p_intf, false, this ); /* FIXME */
CONNECT( controls, advancedControlsToggled( bool ), CONNECT( controls, advancedControlsToggled( bool ),
this, doComponentsUpdate() ); this, adaptGeometry() );
CONNECT( controls, sizeChanged(), CONNECT( controls, sizeChanged(),
this, doComponentsUpdate() ); this, adaptGeometry() );
inputC = new InputControlsWidget( p_intf, this ); inputC = new InputControlsWidget( p_intf, this );
...@@ -381,9 +379,9 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -381,9 +379,9 @@ void MainInterface::createMainWidget( QSettings *settings )
controls = new ControlsWidget( p_intf, controls = new ControlsWidget( p_intf,
settings->value( "adv-controls", false ).toBool(), this ); settings->value( "adv-controls", false ).toBool(), this );
CONNECT( controls, advancedControlsToggled( bool ), CONNECT( controls, advancedControlsToggled( bool ),
this, doComponentsUpdate() ); this, adaptGeometry() );
CONNECT( controls, sizeChanged(), CONNECT( controls, sizeChanged(),
this, doComponentsUpdate() ); this, adaptGeometry() );
inputC = new InputControlsWidget( p_intf, this ); inputC = new InputControlsWidget( p_intf, this );
mainLayout->insertWidget( 2, inputC ); mainLayout->insertWidget( 2, inputC );
...@@ -478,27 +476,15 @@ inline void MainInterface::createStatusBar() ...@@ -478,27 +476,15 @@ inline void MainInterface::createStatusBar()
**********************************************************************/ **********************************************************************/
/* This function is called: /* This function is called:
- toggling of minimal View
- through askUpdate() by Vout thread request video and resize video (zoom)
- Advanced buttons toggled - Advanced buttons toggled
- Toolbar geom changed
*/ */
void MainInterface::doComponentsUpdate() void MainInterface::adaptGeometry()
{ {
#if 0 resize( sizeHint() );
if( isFullScreen() || isMaximized() ) return;
// msg_Warn( p_intf, "Updating the geometry" );
/* Here we resize to sizeHint() and not adjustsize because we want
the videoWidget to be exactly the correctSize */
#ifdef DEBUG_INTF #ifdef DEBUG_INTF
debug(); debug();
#endif
/* This is WRONG, but I believe there is a Qt bug here */
setMinimumSize( 0, 0 );
//resize( sizeHint() );
//adjustSize() ; /* This is not needed, but might help in the future */
#endif #endif
} }
...@@ -621,26 +607,21 @@ void MainInterface::getVideoSlot( WId *p_id, int *pi_x, int *pi_y, ...@@ -621,26 +607,21 @@ void MainInterface::getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
} }
} }
/* Asynchronous call from the WindowClose function */ /* Asynchronous call from the WindowClose function */
void MainInterface::releaseVideo( void ) void MainInterface::releaseVideo( void )
{ {
emit askReleaseVideo( ); emit askReleaseVideo();
} }
/* Function that is CONNECTED to the previous emit */ /* Function that is CONNECTED to the previous emit */
void MainInterface::releaseVideoSlot( void ) void MainInterface::releaseVideoSlot( void )
{ {
videoWidget->release( ); videoWidget->release();
restoreStackOldWidget(); restoreStackOldWidget();
/* We don't want to have a blank video to popup */ /* We don't want to have a blank video to popup */
stackCentralOldWidget = bgWidget; stackCentralOldWidget = bgWidget;
/* Try to resize, except when you are in Fullscreen mode */
// doComponentsUpdate();
} }
/* Asynchronous call from WindowControl function */ /* Asynchronous call from WindowControl function */
...@@ -779,20 +760,16 @@ void MainInterface::toggleMinimalView( bool b_switch ) ...@@ -779,20 +760,16 @@ void MainInterface::toggleMinimalView( bool b_switch )
} }
} }
i_bg_height = stackCentralW->height();
menuBar()->setVisible( !b_switch ); menuBar()->setVisible( !b_switch );
controls->setVisible( !b_switch ); controls->setVisible( !b_switch );
statusBar()->setVisible( !b_switch ); statusBar()->setVisible( !b_switch );
inputC->setVisible( !b_switch ); inputC->setVisible( !b_switch );
doComponentsUpdate();
emit minimalViewToggled( b_switch ); emit minimalViewToggled( b_switch );
} }
/* toggling advanced controls buttons */ /* toggling advanced controls buttons */
void MainInterface::toggleAdvanced() void MainInterface::toggleAdvancedButtons()
{ {
controls->toggleAdvanced(); controls->toggleAdvanced();
// if( fullscreenControls ) fullscreenControls->toggleAdvanced(); // if( fullscreenControls ) fullscreenControls->toggleAdvanced();
...@@ -823,7 +800,6 @@ void MainInterface::visual() ...@@ -823,7 +800,6 @@ void MainInterface::visual()
visualSelector->hide(); visualSelector->hide();
visualSelectorEnabled = false; visualSelectorEnabled = false;
} }
doComponentsUpdate();
} }
#endif #endif
......
...@@ -69,14 +69,15 @@ class MainInterface : public QVLCMW ...@@ -69,14 +69,15 @@ class MainInterface : public QVLCMW
friend class PlaylistWidget; friend class PlaylistWidget;
public: public:
/* tors */
MainInterface( intf_thread_t *); MainInterface( intf_thread_t *);
virtual ~MainInterface(); virtual ~MainInterface();
/* Video requests from core */ /* Video requests from core */
WId getVideo( int *pi_x, int *pi_y, WId getVideo( int *pi_x, int *pi_y,
unsigned int *pi_width, unsigned int *pi_height ); unsigned int *pi_width, unsigned int *pi_height );
void releaseVideo( void ); void releaseVideo( void );
int controlVideo( int i_query, va_list args ); int controlVideo( int i_query, va_list args );
/* Getters */ /* Getters */
#ifndef HAVE_MAEMO #ifndef HAVE_MAEMO
...@@ -86,9 +87,6 @@ public: ...@@ -86,9 +87,6 @@ public:
int getControlsVisibilityStatus(); int getControlsVisibilityStatus();
bool isPlDocked() { return ( b_plDocked != false ); } bool isPlDocked() { return ( b_plDocked != false ); }
/* Sizehint() */
// virtual QSize sizeHint() const;
protected: protected:
void dropEventPlay( QDropEvent *, bool); void dropEventPlay( QDropEvent *, bool);
#ifdef WIN32 #ifdef WIN32
...@@ -112,10 +110,10 @@ private: ...@@ -112,10 +110,10 @@ private:
/* Systray */ /* Systray */
void createSystray(); void createSystray();
void handleSystray();
void initSystray(); void initSystray();
void handleSystray();
/* Mess about stackWidget */ /* Central StackWidget Management */
void showTab( QWidget *); void showTab( QWidget *);
void showVideo(); void showVideo();
void showBg(); void showBg();
...@@ -127,6 +125,7 @@ private: ...@@ -127,6 +125,7 @@ private:
QSystemTrayIcon *sysTray; QSystemTrayIcon *sysTray;
QMenu *systrayMenu; QMenu *systrayMenu;
#endif #endif
QString input_name; QString input_name;
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;
ControlsWidget *controls; ControlsWidget *controls;
...@@ -163,7 +162,6 @@ private: ...@@ -163,7 +162,6 @@ private:
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_bg_height; ///< Save height of bgWidget
#ifdef WIN32 #ifdef WIN32
HIMAGELIST himl; HIMAGELIST himl;
...@@ -179,9 +177,10 @@ public slots: ...@@ -179,9 +177,10 @@ public slots:
#ifndef HAVE_MAEMO #ifndef HAVE_MAEMO
void toggleUpdateSystrayMenu(); void toggleUpdateSystrayMenu();
#endif #endif
void toggleAdvanced(); void toggleAdvancedButtons();
void toggleFullScreen(); void toggleFullScreen();
void toggleFSC(); void toggleFSC();
void popupMenu( const QPoint& ); void popupMenu( const QPoint& );
void changeThumbbarButtons( int ); void changeThumbbarButtons( int );
...@@ -194,7 +193,7 @@ private slots: ...@@ -194,7 +193,7 @@ private slots:
void debug(); void debug();
void destroyPopupMenu(); void destroyPopupMenu();
void recreateToolbars(); void recreateToolbars();
void doComponentsUpdate(); void adaptGeometry();
void setName( const QString& ); void setName( const QString& );
void setVLCWindowsTitle( const QString& title = "" ); void setVLCWindowsTitle( const QString& title = "" );
#if 0 #if 0
...@@ -222,7 +221,6 @@ signals: ...@@ -222,7 +221,6 @@ signals:
void askReleaseVideo( ); void askReleaseVideo( );
void askVideoToResize( unsigned int, unsigned int ); void askVideoToResize( unsigned int, unsigned int );
void askVideoSetFullScreen( bool ); void askVideoSetFullScreen( bool );
void askUpdate();
void minimalViewToggled( bool ); void minimalViewToggled( bool );
void fullscreenInterfaceToggled( bool ); void fullscreenInterfaceToggled( bool );
......
...@@ -465,7 +465,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface ...@@ -465,7 +465,7 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface
/* Advanced Controls */ /* Advanced Controls */
action = menu->addAction( qtr( "&Advanced Controls" ), mi, action = menu->addAction( qtr( "&Advanced Controls" ), mi,
SLOT( toggleAdvanced() ) ); SLOT( toggleAdvancedButtons() ) );
action->setCheckable( true ); action->setCheckable( true );
if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED ) if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED )
action->setChecked( true ); action->setChecked( true );
......
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