vlc | branch: master | Pierre Lamot <[email protected]> | Wed Nov 15 17:09:35 2017 +0100| [a254cd2de2fe4e0ba9b5480744afcd9f9003ee18] | committer: Jean-Baptiste Kempf
qt: provide always on top for main UI it defaults to video-on-top settings Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a254cd2de2fe4e0ba9b5480744afcd9f9003ee18 --- modules/gui/qt/main_interface.cpp | 24 ++++++++++++++++++++++++ modules/gui/qt/main_interface.hpp | 3 +++ modules/gui/qt/qt.cpp | 1 - 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp index 3fbd58e5eb..94e54550aa 100644 --- a/modules/gui/qt/main_interface.cpp +++ b/modules/gui/qt/main_interface.cpp @@ -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 */ diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp index 8977bd4007..79abd52894 100644 --- a/modules/gui/qt/main_interface.hpp +++ b/modules/gui/qt/main_interface.hpp @@ -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); diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp index abb54c647b..7976172afb 100644 --- a/modules/gui/qt/qt.cpp +++ b/modules/gui/qt/qt.cpp @@ -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" ) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
