Skip to content
Snippets Groups Projects
Commit d0a537b2 authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Steve Lhomme
Browse files

qt: add setting to hide the window on close

When `qt-close-to-system-tray` is set,
the application would not exit on close
event, but rather the window becomes
hidden.

This setting is not enabled by default,
and is only applicable when `qt-system-tray`
is also set.

I believe that with the media library,
this setting becomes relevant to keep
one instance open rather than closing
and re-opening. Currently, even if the
user does not want to close the application,
the inclination is to close the application
since the window occupies space in the
task bar.
parent 916dc562
No related branches found
No related tags found
1 merge request!5585qt: add setting to hide the window on close
Pipeline #485528 passed with stage
in 32 minutes
......@@ -229,6 +229,19 @@ bool InterfaceWindowHandler::eventFilter(QObject*, QEvent* event)
}
case QEvent::Close:
{
if (var_InheritBool(p_intf, "qt-close-to-system-tray"))
{
if (const QSystemTrayIcon* const sysTrayIcon = m_mainCtx->getSysTray())
{
if (sysTrayIcon->isSystemTrayAvailable() && sysTrayIcon->isVisible())
{
setInterfaceHiden();
event->accept();
return true;
}
}
}
bool ret = m_mainCtx->onWindowClose(m_window);
if (ret)
{
......
......@@ -256,6 +256,9 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
#define VERBOSE_TEXT N_( "Print Qt's important internal messages" )
#define VERBOSE_LONGTEXT N_( "Enable Qt's all own messaging categories except the debug category." )
#define HIDE_WINDOW_ON_CLOSE_TEXT N_( "Hide the window on close" )
#define HIDE_WINDOW_ON_CLOSE_LONGTEXT N_( "Instead of closing the application, hide the window. This setting is only applicable when system tray icon is enabled." )
static const int initial_prefs_view_list[] = { 0, 1, 2 };
static const char *const initial_prefs_view_list_texts[] =
{ N_("Simple"), N_("Advanced"), N_("Expert") };
......@@ -428,6 +431,8 @@ vlc_module_begin ()
add_bool( "qt-verbose", false, VERBOSE_TEXT, VERBOSE_LONGTEXT )
add_bool( "qt-close-to-system-tray", false, HIDE_WINDOW_ON_CLOSE_TEXT, HIDE_WINDOW_ON_CLOSE_LONGTEXT )
add_float_with_range( "qt-safe-area", 0, 0, 100.0, SAFE_AREA_TEXT, SAFE_AREA_LONGTEXT )
cannot_unload_broken_library()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment