Commit a254cd2d authored by Pierre Lamot's avatar Pierre Lamot Committed by Jean-Baptiste Kempf

qt: provide always on top for main UI

it defaults to video-on-top settings
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 9dce7032
......@@ -152,6 +152,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* */
b_plDocked = getSettings()->value( "MainWindow/pl-dock-status", true ).toBool();
/* Should the UI stays on top of other windows */
b_interfaceOnTop = var_InheritBool( p_intf, "video-on-top" );
/**************************
* UI and Widgets design
......@@ -524,6 +526,9 @@ void MainInterface::createMainWidget( QSettings *creationSettings )
CONNECT( fullscreenControls, keyPressed( QKeyEvent * ),
this, handleKeyPress( QKeyEvent * ) );
}
if ( b_interfaceOnTop )
setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint );
}
inline void MainInterface::initSystray()
......@@ -913,6 +918,10 @@ void MainInterface::setHideMouse( bool hide )
* Emit askVideoOnTop() to invoke this from other thread. */
void MainInterface::setVideoOnTop( bool on_top )
{
//don't apply changes if user has already sets its interface on top
if ( b_interfaceOnTop )
return;
Qt::WindowFlags oldflags = windowFlags(), newflags;
if( on_top )
......@@ -920,7 +929,22 @@ void MainInterface::setVideoOnTop( bool on_top )
else
newflags = oldflags & ~Qt::WindowStaysOnTopHint;
if( newflags != oldflags && !b_videoFullScreen )
{
setWindowFlags( newflags );
show(); /* necessary to apply window flags */
}
}
void MainInterface::setInterfaceAlwaysOnTop( bool on_top )
{
b_interfaceOnTop = on_top;
Qt::WindowFlags oldflags = windowFlags(), newflags;
if( on_top )
newflags = oldflags | Qt::WindowStaysOnTopHint;
else
newflags = oldflags & ~Qt::WindowStaysOnTopHint;
if( newflags != oldflags && !b_videoFullScreen )
{
setWindowFlags( newflags );
show(); /* necessary to apply window flags */
......
......@@ -95,6 +95,7 @@ public:
int getControlsVisibilityStatus();
bool isPlDocked() { return ( b_plDocked != false ); }
bool isInterfaceFullScreen() { return b_interfaceFullScreen; }
bool isInterfaceAlwaysOnTop() { return b_interfaceOnTop; }
StandardPLPanel* getPlaylistView();
protected:
......@@ -179,6 +180,7 @@ protected:
bool b_hideAfterCreation;
bool b_minimalView; ///< Minimal video
bool b_interfaceFullScreen;
bool b_interfaceOnTop; ///keep UI on top
bool b_pauseOnMinimize;
bool b_maximizedView;
bool b_isWindowTiled;
......@@ -205,6 +207,7 @@ public slots:
void toggleAdvancedButtons();
void toggleInterfaceFullScreen();
void toggleFSC();
void setInterfaceAlwaysOnTop( bool );
void setStatusBarVisibility(bool b_visible);
void setPlaylistVisibility(bool b_visible);
......
......@@ -119,7 +119,6 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
" This option only works with Windows and " \
"X11 with composite extensions." )
#define ERROR_TEXT N_( "Show unimportant error and warnings dialogs" )
#define UPDATER_TEXT N_( "Activate the updates availability notification" )
......
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