diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index b7eb13ac4804aa9aece6528d70c051ddc8f7a1ff..d062588454299b2ae42079d328cd27c6edf6ba35 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -67,7 +67,7 @@ libqt_plugin_la_CPPFLAGS += -DQT_QML_DEBUG endif libqt_plugin_la_SOURCES = \ - gui/qt/qt.cpp gui/qt/qt.hpp \ + gui/qt/qt.cpp gui/qt/qt.hpp gui/qt/plugins.hpp \ gui/qt/dialogs/bookmarks/bookmarks.cpp gui/qt/dialogs/bookmarks/bookmarks.hpp \ gui/qt/dialogs/dialogs/dialogmodel.cpp \ gui/qt/dialogs/dialogs/dialogmodel.hpp \ @@ -1058,7 +1058,7 @@ gui/qt/resources.cpp: $(lib_qt_plugin_la_QRC) $(libqt_plugin_la_RES) $(libqt_plu endif -vlc_qt_check_SOURCES = gui/qt/vlc-qt-check.cpp +vlc_qt_check_SOURCES = gui/qt/vlc-qt-check.cpp gui/qt/plugins.hpp vlc_qt_check_CXXFLAGS = $(AM_CXXFLAGS) $(QT_CFLAGS) -fPIC $(CXXFLAGS_qt) vlc_qt_check_LDADD = $(QT_LIBS) diff --git a/modules/gui/qt/plugins.hpp b/modules/gui/qt/plugins.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1c948718ab6f6bbca1f2f0df1dfb47a46ba80644 --- /dev/null +++ b/modules/gui/qt/plugins.hpp @@ -0,0 +1,58 @@ +/***************************************************************************** + * plugins.hpp : Qt static plugin integration + **************************************************************************** + * Copyright © 2006-2009 the VideoLAN team + * Copyright © 2022 Videolabs + * + * Authors: Clément Stenac <zorglub@videolan.org> + * Jean-Baptiste Kempf <jb@videolan.org> + * Alexandre Janniaux <ajanni@videolabs.io> + * + * 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. + *****************************************************************************/ + +#if !defined(QT_STATIC) && !defined(QT_SHARED) +# error "Make sure qconfig.h was included before" +#endif + +#if !defined(Q_IMPORT_PLUGIN) +# error "Make sure QtPlugin was included before" +#endif + +#ifdef QT_STATIC /* For static builds */ + Q_IMPORT_PLUGIN(QSvgIconPlugin) + Q_IMPORT_PLUGIN(QSvgPlugin) + Q_IMPORT_PLUGIN(QJpegPlugin) + Q_IMPORT_PLUGIN(QtQuick2Plugin) + Q_IMPORT_PLUGIN(QtQuickControls2Plugin) + Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin) + Q_IMPORT_PLUGIN(QtQuick2WindowPlugin) + Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin) + Q_IMPORT_PLUGIN(QtQmlModelsPlugin) + Q_IMPORT_PLUGIN(QtGraphicalEffectsPlugin) + Q_IMPORT_PLUGIN(QtGraphicalEffectsPrivatePlugin) + Q_IMPORT_PLUGIN(QmlShapesPlugin) + + #if QT_VERSION >= QT_VERSION_CHECK(5,15,0) + Q_IMPORT_PLUGIN(QtQmlPlugin) + #endif + + #ifdef _WIN32 + Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin) + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) + #elif defined(Q_OS_MACOS) + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) + #endif +#endif diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp index 9aaf992bbf131309d2d2aae9c0ffbd975e574cda..7032de06b7dd93b57f4c3f15d70b659718706569 100644 --- a/modules/gui/qt/qt.cpp +++ b/modules/gui/qt/qt.cpp @@ -25,6 +25,13 @@ # include "config.h" #endif +#include <qconfig.h> +#include <QtPlugin> + +QT_BEGIN_NAMESPACE +#include "plugins.hpp" +QT_END_NAMESPACE + #define VLC_MODULE_LICENSE VLC_LICENSE_GPL_2_PLUS #include <stdlib.h> @@ -68,36 +75,7 @@ extern "C" char **environ; #include <vlc_window.h> #include <vlc_cxx_helpers.hpp> -#ifdef QT_STATIC /* For static builds */ - #include <QtPlugin> - #include <QQuickWindow> - - #ifdef QT_STATICPLUGIN - Q_IMPORT_PLUGIN(QSvgIconPlugin) - Q_IMPORT_PLUGIN(QSvgPlugin) - Q_IMPORT_PLUGIN(QJpegPlugin) - Q_IMPORT_PLUGIN(QtQuick2Plugin) - Q_IMPORT_PLUGIN(QtQuickControls2Plugin) - Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin) - Q_IMPORT_PLUGIN(QtQuick2WindowPlugin) - Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin) - Q_IMPORT_PLUGIN(QtQmlModelsPlugin) - Q_IMPORT_PLUGIN(QtGraphicalEffectsPlugin) - Q_IMPORT_PLUGIN(QtGraphicalEffectsPrivatePlugin) - Q_IMPORT_PLUGIN(QmlShapesPlugin) - - #if QT_VERSION >= QT_VERSION_CHECK(5,15,0) - Q_IMPORT_PLUGIN(QtQmlPlugin) - #endif - - #ifdef _WIN32 - Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin) - Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) - #elif defined(Q_OS_MACOS) - Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) - #endif - #endif -#endif +#include <QQuickWindow> #ifndef X_DISPLAY_MISSING # include <vlc_xlib.h> diff --git a/modules/gui/qt/vlc-qt-check.cpp b/modules/gui/qt/vlc-qt-check.cpp index 52a7f4a78b36fafd45f5f9c7dffd11674fffbce5..d666662f42abfc9cfa835a84d4d5689239a01d0f 100644 --- a/modules/gui/qt/vlc-qt-check.cpp +++ b/modules/gui/qt/vlc-qt-check.cpp @@ -32,6 +32,12 @@ static void messageOutput(QtMsgType type, const QMessageLogContext &, exit(1); } +#include <qconfig.h> +#include <QtPlugin> +QT_BEGIN_NAMESPACE +#include "plugins.hpp" +QT_END_NAMESPACE + int main(int argc, char *argv[]) { qInstallMessageHandler(messageOutput);