diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index 8ead8f585b..6e3635e200 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -308,7 +308,6 @@ libqt_plugin_la_SOURCES = \ gui/qt/util/hover_handler_rev11.cpp \ gui/qt/util/hover_handler_rev11.hpp \ gui/qt/util/qt_dirs.cpp gui/qt/util/qt_dirs.hpp \ - gui/qt/util/qvlcapp.hpp \ gui/qt/util/proxycolumnmodel.hpp \ gui/qt/util/registry.cpp gui/qt/util/registry.hpp \ gui/qt/util/renderer_manager.cpp gui/qt/util/renderer_manager.hpp \ @@ -506,7 +505,6 @@ nodist_libqt_plugin_la_SOURCES = \ gui/qt/util/effects_image_provider.moc.cpp \ gui/qt/util/flickable_scroll_handler.moc.cpp \ gui/qt/util/hover_handler_rev11.moc.cpp \ - gui/qt/util/qvlcapp.moc.cpp \ gui/qt/util/renderer_manager.moc.cpp \ gui/qt/util/selectable_list_model.moc.cpp \ gui/qt/util/sortfilterproxymodel.moc.cpp \ diff --git a/modules/gui/qt/dialogs/preferences/simple_preferences.cpp b/modules/gui/qt/dialogs/preferences/simple_preferences.cpp index a28f5f7d7a..e377d53341 100644 --- a/modules/gui/qt/dialogs/preferences/simple_preferences.cpp +++ b/modules/gui/qt/dialogs/preferences/simple_preferences.cpp @@ -30,7 +30,6 @@ #include "preferences_widgets.hpp" #include "maininterface/mainctx.hpp" #include "util/color_scheme_model.hpp" -#include "util/qvlcapp.hpp" #include "util/proxycolumnmodel.hpp" #include "medialibrary/mlrecentsmodel.hpp" @@ -1315,7 +1314,7 @@ void SPrefsPanel::lastfm_Changed( int i_state ) void SPrefsPanel::changeStyle() { QApplication::setStyle( getQStyleKey( qobject_cast( optionWidgets["styleCB"] ) - , p_intf->p_app->defaultStyle() ) ); + , p_intf->p_app->property("initialStyle").toString() ) ); /* force refresh on all widgets */ QWidgetList widgets = QApplication::allWidgets(); diff --git a/modules/gui/qt/meson.build b/modules/gui/qt/meson.build index 75001d1ad5..4e040e7a0c 100644 --- a/modules/gui/qt/meson.build +++ b/modules/gui/qt/meson.build @@ -129,7 +129,6 @@ moc_headers = files( 'util/effects_image_provider.hpp', 'util/flickable_scroll_handler.hpp', 'util/hover_handler_rev11.hpp', - 'util/qvlcapp.hpp', 'util/renderer_manager.hpp', 'util/selectable_list_model.hpp', 'util/sortfilterproxymodel.hpp', @@ -431,7 +430,6 @@ some_sources = files( 'util/hover_handler_rev11.hpp', 'util/qt_dirs.cpp', 'util/qt_dirs.hpp', - 'util/qvlcapp.hpp', 'util/proxycolumnmodel.hpp', 'util/registry.cpp', 'util/registry.hpp', diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp index e910c40e51..930555a588 100644 --- a/modules/gui/qt/qt.cpp +++ b/modules/gui/qt/qt.cpp @@ -67,7 +67,6 @@ extern "C" char **environ; #include "dialogs/extensions/extensions_manager.hpp" /* Extensions manager */ #include "dialogs/plugins/addons_manager.hpp" /* Addons manager */ #include "dialogs/help/help.hpp" /* Launch Update */ -#include "util/qvlcapp.hpp" /* QVLCApplication definition */ #include "maininterface/compositor.hpp" #include @@ -449,6 +448,14 @@ enum CleanupReason { CLEANUP_INTF_CLOSED }; +static inline void triggerQuit() +{ + QMetaObject::invokeMethod(qApp, []() { + qApp->closeAllWindows(); + qApp->quit(); + }, Qt::QueuedConnection); +} + /***************************************************************************** * Module callbacks *****************************************************************************/ @@ -461,7 +468,7 @@ static void *ThreadCleanup( qt_intf_t *p_intf, CleanupReason cleanupReason ); #include "../../../lib/libvlc_internal.h" /* libvlc_SetExitHandler */ static void Abort( void *obj ) { - QVLCApp::triggerQuit(); + triggerQuit(); } #endif @@ -553,7 +560,8 @@ static void CloseInternal( qt_intf_t *p_intf ) { /* And quit */ msg_Dbg( p_intf, "requesting exit..." ); - QVLCApp::triggerQuit(); + + triggerQuit(); msg_Dbg( p_intf, "waiting for UI thread..." ); #ifndef Q_OS_MAC @@ -710,7 +718,8 @@ static void *Thread( void *obj ) QQuickWindow::setDefaultAlphaBuffer(true); /* Start the QApplication here */ - QVLCApp app( argc, argv ); + QApplication app( argc, argv ); + app.setProperty("initialStyle", app.style()->objectName()); #if QT_VERSION >= QT_VERSION_CHECK(5,15,1) //suppress deprecation warnings about QML 'Connections' syntax diff --git a/modules/gui/qt/qt.hpp b/modules/gui/qt/qt.hpp index e7581047ae..265a8c2c7f 100644 --- a/modules/gui/qt/qt.hpp +++ b/modules/gui/qt/qt.hpp @@ -95,7 +95,7 @@ struct qt_intf_t vlc_thread_t thread; - class QVLCApp *p_app; /* Main Qt Application */ + class QApplication *p_app; /* Main Qt Application */ class MainCtx *p_mi; /* Main Interface, NULL if DialogProvider Mode */ class QSettings *mainSettings; /* Qt State settings not messing main VLC ones */ diff --git a/modules/gui/qt/util/qvlcapp.hpp b/modules/gui/qt/util/qvlcapp.hpp deleted file mode 100644 index 01df3ce485..0000000000 --- a/modules/gui/qt/util/qvlcapp.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************** - * qvlcapp.hpp : A few helpers - ***************************************************************************** - * Copyright (C) 2008 the VideoLAN team - * - * Authors: Jean-Baptiste Kempf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - - -#ifndef VLC_QT_QVLCAPP_HPP_ -#define VLC_QT_QVLCAPP_HPP_ - -#include -#include - -#if defined(Q_OS_WIN) -# include "qt.hpp" -# include -# include "player/player_controller.hpp" -#endif - -class QVLCApp : public QApplication -{ - Q_OBJECT - -private slots: - void doQuit() - { - closeAllWindows(); - quit(); - } - -public: - QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, true ), m_defaultStyle( style()->objectName() ) - { - connect( this, &QVLCApp::quitSignal, this, &QVLCApp::doQuit ); - } - - static void triggerQuit() - { - QVLCApp *app = qobject_cast( instance() ); - if( app ) - emit app->quitSignal(); - } - - QString defaultStyle() const - { - return m_defaultStyle; - } - -signals: - void quitSignal(); - -private: - const QString m_defaultStyle; -}; - -#endif diff --git a/po/POTFILES.in b/po/POTFILES.in index 3908b572eb..ec403d6519 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -900,7 +900,6 @@ modules/gui/qt/util/imagehelper.cpp modules/gui/qt/util/imagehelper.hpp modules/gui/qt/util/qt_dirs.cpp modules/gui/qt/util/qt_dirs.hpp -modules/gui/qt/util/qvlcapp.hpp modules/gui/qt/util/registry.cpp modules/gui/qt/util/registry.hpp modules/gui/qt/util/singleton.hpp