[vlc-commits] [Git][videolan/vlc][master] qt: add setting to hide the window on close
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Jun 27 13:26:00 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
d0a537b2 by Fatih Uzunoglu at 2024-06-27T13:12:33+00:00
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.
- - - - -
2 changed files:
- modules/gui/qt/maininterface/interface_window_handler.cpp
- modules/gui/qt/qt.cpp
Changes:
=====================================
modules/gui/qt/maininterface/interface_window_handler.cpp
=====================================
@@ -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)
{
=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -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()
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d0a537b2698320dbf1ae0718da7c4704b246cd5d
--
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d0a537b2698320dbf1ae0718da7c4704b246cd5d
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list