Commit 916aa463 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: remove the HACK with the static QAction for minimalViewAction, and fix a...

Qt: remove the HACK with the static QAction for minimalViewAction, and fix a few minimalVIew issues.
parent 2dfd048e
...@@ -257,7 +257,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -257,7 +257,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* And switch to minimal view if needed /* And switch to minimal view if needed
Must be called after the show() */ Must be called after the show() */
if( i_visualmode == QT_MINIMAL_MODE ) if( i_visualmode == QT_MINIMAL_MODE )
toggleMinimalView(); toggleMinimalView( true );
/* Update the geometry : It is useful if you switch between /* Update the geometry : It is useful if you switch between
qt-display-modes ?*/ qt-display-modes ?*/
...@@ -803,7 +803,7 @@ void MainInterface::dockPlaylist( pl_dock_e i_pos ) ...@@ -803,7 +803,7 @@ void MainInterface::dockPlaylist( pl_dock_e i_pos )
{ {
} }
void MainInterface::toggleMinimalView() void MainInterface::toggleMinimalView( bool b_switch )
{ {
if( i_visualmode != QT_ALWAYS_VIDEO_MODE && if( i_visualmode != QT_ALWAYS_VIDEO_MODE &&
i_visualmode != QT_MINIMAL_MODE ) i_visualmode != QT_MINIMAL_MODE )
...@@ -816,13 +816,13 @@ void MainInterface::toggleMinimalView() ...@@ -816,13 +816,13 @@ void MainInterface::toggleMinimalView()
} }
} }
TOGGLEV( menuBar() ); menuBar()->setVisible( !b_switch );
TOGGLEV( controls ); controls->setVisible( !b_switch );
TOGGLEV( statusBar() ); statusBar()->setVisible( !b_switch );
TOGGLEV( inputC ); inputC->setVisible( !b_switch );
doComponentsUpdate(); doComponentsUpdate();
QVLCMenu::minimalViewAction->setChecked( bgWasVisible ); emit minimalViewToggled( b_switch );
} }
/* Video widget cannot do this synchronously as it runs in another thread */ /* Video widget cannot do this synchronously as it runs in another thread */
...@@ -855,6 +855,8 @@ void MainInterface::toggleAdvanced() ...@@ -855,6 +855,8 @@ void MainInterface::toggleAdvanced()
/* Get the visibility status of the controls (hidden or not, advanced or not) */ /* Get the visibility status of the controls (hidden or not, advanced or not) */
int MainInterface::getControlsVisibilityStatus() int MainInterface::getControlsVisibilityStatus()
{ {
msg_Warn( p_intf, "%i", (controls->isVisible() ? CONTROLS_VISIBLE : CONTROLS_HIDDEN )
+ CONTROLS_ADVANCED * controls->b_advancedVisible );
return( (controls->isVisible() ? CONTROLS_VISIBLE : CONTROLS_HIDDEN ) return( (controls->isVisible() ? CONTROLS_VISIBLE : CONTROLS_HIDDEN )
+ CONTROLS_ADVANCED * controls->b_advancedVisible ); + CONTROLS_ADVANCED * controls->b_advancedVisible );
} }
...@@ -1126,7 +1128,7 @@ void MainInterface::keyPressEvent( QKeyEvent *e ) ...@@ -1126,7 +1128,7 @@ void MainInterface::keyPressEvent( QKeyEvent *e )
if( ( e->modifiers() & Qt::ControlModifier ) && ( e->key() == Qt::Key_H ) if( ( e->modifiers() & Qt::ControlModifier ) && ( e->key() == Qt::Key_H )
&& menuBar()->isHidden() ) && menuBar()->isHidden() )
{ {
toggleMinimalView(); toggleMinimalView( false );
e->accept(); e->accept();
} }
......
...@@ -51,9 +51,9 @@ class QMenu; ...@@ -51,9 +51,9 @@ class QMenu;
class QSize; class QSize;
enum { enum {
CONTROLS_HIDDEN = 0x0,
CONTROLS_VISIBLE = 0x1, CONTROLS_VISIBLE = 0x1,
CONTROLS_ADVANCED = 0x2 CONTROLS_HIDDEN = 0x2,
CONTROLS_ADVANCED = 0x4,
}; };
typedef enum pl_dock_e { typedef enum pl_dock_e {
...@@ -153,7 +153,7 @@ private: ...@@ -153,7 +153,7 @@ private:
public slots: public slots:
void undockPlaylist(); void undockPlaylist();
void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM ); void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
void toggleMinimalView(); void toggleMinimalView( bool );
void togglePlaylist(); void togglePlaylist();
void toggleUpdateSystrayMenu(); void toggleUpdateSystrayMenu();
void toggleAdvanced(); void toggleAdvanced();
...@@ -185,6 +185,7 @@ signals: ...@@ -185,6 +185,7 @@ signals:
void askVideoToToggle(); void askVideoToToggle();
void askBgWidgetToToggle(); void askBgWidgetToToggle();
void askUpdate(); void askUpdate();
void minimalViewToggled( bool );
}; };
#endif #endif
...@@ -75,7 +75,6 @@ static QActionGroup *currentGroup; ...@@ -75,7 +75,6 @@ static QActionGroup *currentGroup;
/* HACK for minimalView to go around a Qt bug/feature /* HACK for minimalView to go around a Qt bug/feature
* that doesn't update the QAction checked state when QMenu is hidden */ * that doesn't update the QAction checked state when QMenu is hidden */
QAction *QVLCMenu::minimalViewAction = NULL;
QAction *QVLCMenu::fullscreenViewAction = NULL; QAction *QVLCMenu::fullscreenViewAction = NULL;
QMenu *QVLCMenu::recentsMenu = NULL; QMenu *QVLCMenu::recentsMenu = NULL;
...@@ -413,13 +412,14 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, ...@@ -413,13 +412,14 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
} }
/* Minimal View */ /* Minimal View */
QAction *action = menu->addAction( qtr( "Mi&nimal View" ), mi, QAction *action = menu->addAction( qtr( "Mi&nimal View" ) );
SLOT( toggleMinimalView() ), qtr( "Ctrl+H" ) ); action->setShortcut( qtr( "Ctrl+H" ) );
action->setCheckable( true ); action->setCheckable( true );
action->setChecked( !with_intf &&
(mi->getControlsVisibilityStatus() && CONTROLS_HIDDEN ) );
if( mi->getControlsVisibilityStatus() & CONTROLS_VISIBLE ) CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) );
action->setChecked( true ); CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) );
minimalViewAction = action; /* HACK for minimalView */
/* FullScreen View */ /* FullScreen View */
action = menu->addAction( qtr( "&Fullscreen Interface" ), mi, action = menu->addAction( qtr( "&Fullscreen Interface" ), mi,
......
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