Commit aa20a048 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

qt: Add a setting to chose when to raise the interface or not

Fix #14363
parent 4594ea75
......@@ -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;
......
......@@ -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 ); }
......
......@@ -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 );
......
......@@ -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 ()
......
......@@ -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>
......
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