Browse Source

qt: get rid of QVLCApp

pull/162/head
Fatih Uzunoglu 3 years ago
committed by Steve Lhomme
parent
commit
f6a7faaab6
  1. 2
      modules/gui/qt/Makefile.am
  2. 3
      modules/gui/qt/dialogs/preferences/simple_preferences.cpp
  3. 2
      modules/gui/qt/meson.build
  4. 17
      modules/gui/qt/qt.cpp
  5. 2
      modules/gui/qt/qt.hpp
  6. 72
      modules/gui/qt/util/qvlcapp.hpp
  7. 1
      po/POTFILES.in

2
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 \

3
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() ) );
, p_intf->p_app->property("initialStyle").toString() ) );
/* force refresh on all widgets */
QWidgetList widgets = QApplication::allWidgets();

2
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',

17
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

2
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 */

72
modules/gui/qt/util/qvlcapp.hpp

@ -1,72 +0,0 @@
/*****************************************************************************
* qvlcapp.hpp : A few helpers
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
*
* Authors: Jean-Baptiste Kempf <jb@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

1
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

Loading…
Cancel
Save