[vlc-commits] qt: Add a setting to chose when to raise the interface or not
Hugo Beauzée-Luyssen
git at videolan.org
Fri Feb 3 12:51:51 CET 2017
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Jan 26 18:48:31 2017 +0100| [aa20a048251da5eb8a6c4e263de59e5aaf905e9d] | committer: Hugo Beauzée-Luyssen
qt: Add a setting to chose when to raise the interface or not
Fix #14363
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aa20a048251da5eb8a6c4e263de59e5aaf905e9d
---
modules/gui/qt/components/simple_preferences.cpp | 1 +
modules/gui/qt/main_interface.cpp | 21 ++++++++++++++++++++-
modules/gui/qt/main_interface.hpp | 8 ++++++++
modules/gui/qt/qt.cpp | 14 ++++++++++++++
modules/gui/qt/ui/sprefs_interface.ui | 10 ++++++++++
5 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp
index 1c758cb..f216653 100644
--- a/modules/gui/qt/components/simple_preferences.cpp
+++ b/modules/gui/qt/components/simple_preferences.cpp
@@ -852,6 +852,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "qt-continue", IntegerList, ui.continuePlaybackLabel, continuePlaybackComboBox );
CONFIG_GENERIC( "qt-recentplay-filter", String, ui.filterLabel,
recentlyPlayedFilters );
+ CONFIG_GENERIC( "qt-auto-raise", IntegerList, ui.autoRaiseLabel, autoRaiseComboBox );
END_SPREFS_CAT;
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 55046e3..fa5da3b 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -185,6 +185,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT( THEMIM->getIM(), nameChanged( const QString& ),
this, setVLCWindowsTitle( const QString& ) );
}
+ CONNECT( THEMIM, inputChanged( bool ), this, onInputChanged( bool ) );
+
/* END CONNECTS ON IM */
/* VideoWidget connects for asynchronous calls */
@@ -419,6 +421,23 @@ void MainInterface::resumePlayback()
hideResumePanel();
}
+void MainInterface::onInputChanged( bool hasInput )
+{
+ if( hasInput == false )
+ return;
+ int autoRaise = var_InheritInteger( p_intf, "qt-auto-raise" );
+ if ( autoRaise == MainInterface::RAISE_NEVER )
+ return;
+ if( THEMIM->getIM()->hasVideo() == true )
+ {
+ if( ( autoRaise & MainInterface::RAISE_VIDEO ) == 0 )
+ return;
+ }
+ else if ( ( autoRaise & MainInterface::RAISE_AUDIO ) == 0 )
+ return;
+ emit askRaise();
+}
+
void MainInterface::createMainWidget( QSettings *creationSettings )
{
/* Create the main Widget and the mainLayout */
@@ -590,7 +609,7 @@ void MainInterface::debug()
#endif
}
-inline void MainInterface::showVideo() { showTab( videoWidget ); setRaise(); }
+inline void MainInterface::showVideo() { showTab( videoWidget ); }
inline void MainInterface::restoreStackOldWidget()
{ showTab( stackCentralOldWidget ); }
diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp
index 4ce7db0..03e78d3 100644
--- a/modules/gui/qt/main_interface.hpp
+++ b/modules/gui/qt/main_interface.hpp
@@ -84,6 +84,13 @@ public:
CONTROLS_HIDDEN = 0x2,
CONTROLS_ADVANCED = 0x4,
};
+ enum
+ {
+ RAISE_NEVER,
+ RAISE_VIDEO,
+ RAISE_AUDIO,
+ RAISE_AUDIOVIDEO,
+ };
int getControlsVisibilityStatus();
bool isPlDocked() { return ( b_plDocked != false ); }
bool isInterfaceFullScreen() { return b_interfaceFullScreen; }
@@ -251,6 +258,7 @@ protected slots:
void showResumePanel( int64_t);
void hideResumePanel();
void resumePlayback();
+ void onInputChanged( bool );
signals:
void askGetVideo( WId *, struct vout_window_t *, unsigned, unsigned, bool );
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index 3d1a4b2..43439f1 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -188,6 +188,10 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
#define VOLUME_MAX_TEXT N_( "Maximum Volume displayed" )
+#define AUTORAISE_ON_PLAYBACK_TEXT N_( "When to raise the interface" )
+#define AUTORAISE_ON_PLAYBACK_LONGTEXT N_( "This option allows the interface to be raised automatically " \
+ "when a video/audio playback starts, or never" )
+
#define FULLSCREEN_CONTROL_PIXELS N_( "Fullscreen controller mouse sensitivity" )
#define CONTINUE_PLAYBACK_TEXT N_("Continue playback?")
@@ -204,6 +208,12 @@ static const int i_continue_list[] =
static const char *const psz_continue_list_text[] =
{ N_("Never"), N_("Ask"), N_("Always") };
+static const int i_raise_list[] =
+ { MainInterface::RAISE_NEVER, MainInterface::RAISE_VIDEO, \
+ MainInterface::RAISE_AUDIO, MainInterface::RAISE_AUDIOVIDEO, };
+
+static const char *const psz_raise_list_text[] =
+ { N_( "Never" ), N_( "Video" ), N_( "Audio" ), _( "Both" ) };
/**********************************************************************/
vlc_module_begin ()
@@ -306,6 +316,10 @@ vlc_module_begin ()
add_obsolete_bool( "qt-volume-complete" ) /* Since 2.0.0 */
add_obsolete_integer( "qt-startvolume" ) /* Since 2.0.0 */
+ add_integer( "qt-auto-raise", MainInterface::RAISE_VIDEO, AUTORAISE_ON_PLAYBACK_TEXT,
+ AUTORAISE_ON_PLAYBACK_LONGTEXT, false )
+ change_integer_list( i_raise_list, psz_raise_list_text )
+
cannot_unload_broken_library()
add_submodule ()
diff --git a/modules/gui/qt/ui/sprefs_interface.ui b/modules/gui/qt/ui/sprefs_interface.ui
index e9dd718..fe937d1 100644
--- a/modules/gui/qt/ui/sprefs_interface.ui
+++ b/modules/gui/qt/ui/sprefs_interface.ui
@@ -285,6 +285,16 @@
</property>
</widget>
</item>
+ <item row="11" column="0">
+ <widget class="QLabel" name="autoRaiseLabel">
+ <property name="text">
+ <string>Auto raising the interface:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="2" colspan="2">
+ <widget class="QComboBox" name="autoRaiseComboBox"/>
+ </item>
</layout>
</widget>
</item>
More information about the vlc-commits
mailing list