[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: get rid of QVLCApp
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue May 2 05:37:43 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
f6a7faaa by Fatih Uzunoglu at 2023-05-02T05:18:45+00:00
qt: get rid of QVLCApp
- - - - -
7f00b321 by Fatih Uzunoglu at 2023-05-02T05:18:45+00:00
qt: get rid of qt_intf_t::p_app
- - - - -
7 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- modules/gui/qt/meson.build
- modules/gui/qt/qt.cpp
- modules/gui/qt/qt.hpp
- − modules/gui/qt/util/qvlcapp.hpp
- po/POTFILES.in
Changes:
=====================================
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 \
=====================================
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<QComboBox *>( optionWidgets["styleCB"] )
- , p_intf->p_app->defaultStyle() ) );
+ , qApp->property("initialStyle").toString() ) );
/* force refresh on all widgets */
QWidgetList widgets = QApplication::allWidgets();
=====================================
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',
=====================================
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 <QVector>
@@ -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
@@ -724,9 +733,6 @@ static void *Thread( void *obj )
* necessary for RTL locales */
app.setLayoutDirection(QLocale().textDirection());
- p_intf->p_app = &app;
-
-
/* All the settings are in the .conf/.ini style */
#ifdef _WIN32
char *cConfigDir = config_GetUserDir( VLC_CONFIG_DIR );
=====================================
modules/gui/qt/qt.hpp
=====================================
@@ -95,7 +95,6 @@ struct qt_intf_t
vlc_thread_t thread;
- class QVLCApp *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 */
=====================================
modules/gui/qt/util/qvlcapp.hpp deleted
=====================================
@@ -1,72 +0,0 @@
-/*****************************************************************************
- * qvlcapp.hpp : A few helpers
- *****************************************************************************
- * Copyright (C) 2008 the VideoLAN team
- *
- * Authors: Jean-Baptiste Kempf <jb at videolan.org>
- *
- * 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 <QApplication>
-#include <QStyle>
-
-#if defined(Q_OS_WIN)
-# include "qt.hpp"
-# include <windows.h>
-# 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<QVLCApp*>( instance() );
- if( app )
- emit app->quitSignal();
- }
-
- QString defaultStyle() const
- {
- return m_defaultStyle;
- }
-
-signals:
- void quitSignal();
-
-private:
- const QString m_defaultStyle;
-};
-
-#endif
=====================================
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
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dccda0e133ff0a2e85de727cf19ddbc634f06b67...7f00b321d438d8cf4f55bb7dd880e7ba5febd1e3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dccda0e133ff0a2e85de727cf19ddbc634f06b67...7f00b321d438d8cf4f55bb7dd880e7ba5febd1e3
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