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