Qt: A bit more Qt 6 porting progress

This commit is contained in:
Vicki Pfau 2023-05-03 02:21:55 -07:00
parent 2b8bb4baf7
commit d8643870d6
3 changed files with 22 additions and 9 deletions

View File

@ -25,8 +25,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(QT_LIBRARIES)
find_package(Qt5 COMPONENTS Core Widgets Network OPTIONAL_COMPONENTS Multimedia)
set(QT Qt5)
set(QT_V 5)
find_package(Qt${QT_V} COMPONENTS Core Widgets Network OPTIONAL_COMPONENTS Multimedia)
if(QT_V GREATER_EQUAL 6)
find_package(Qt${QT_V} COMPONENTS OpenGL OpenGLWidgets)
endif()
set(QT Qt${QT_V})
if(NOT BUILD_GL AND NOT BUILD_GLES2 AND NOT BUILD_GLES3)
message(WARNING "OpenGL is recommended to build the Qt port")
@ -199,7 +203,7 @@ set(GB_SRC
GBOverride.cpp
PrinterView.cpp)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libqt5widgets5")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libqt${QT_V}widgets${QT_V}")
set(AUDIO_SRC)
if(BUILD_SDL)
@ -219,15 +223,17 @@ if(${QT}Multimedia_FOUND)
list(APPEND AUDIO_SRC
AudioProcessorQt.cpp
AudioDevice.cpp)
if(QT_V LESS 6)
list(APPEND SOURCE_FILES
VideoDumper.cpp)
endif()
if (WIN32 AND QT_STATIC)
list(APPEND QT_LIBRARIES ${QT}::QWindowsAudioPlugin ${QT}::DSServicePlugin ${QT}::QWindowsVistaStylePlugin ${QT}::QJpegPlugin
strmiids mfuuid mfplat mf ksguid dxva2 evr d3d9)
endif()
list(APPEND QT_LIBRARIES ${QT}::Multimedia)
list(APPEND QT_DEFINES BUILD_QT_MULTIMEDIA)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libqt5multimedia5")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libqt${QT_V}multimedia${QT_V}")
endif()
if(NOT AUDIO_SRC)
@ -403,6 +409,9 @@ if(WIN32)
endif()
list(APPEND QT_LIBRARIES ${QT}::Widgets ${QT}::Network)
if(${QT_V} GREATER_EQUAL 6)
list(APPEND QT_LIBRARIES ${QT}::OpenGL ${QT}::OpenGLWidgets)
endif()
if(BUILD_GL OR BUILD_GLES2 OR BUILD_EPOXY)
list(APPEND QT_LIBRARIES ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY})
endif()

View File

@ -25,7 +25,9 @@
#include <mgba/gba/interface.h>
#ifdef BUILD_QT_MULTIMEDIA
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include "VideoDumper.h"
#endif
#include <QCamera>
#endif
@ -165,7 +167,9 @@ private:
bool m_cameraActive = false;
QByteArray m_cameraDevice;
std::unique_ptr<QCamera> m_camera;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
VideoDumper m_videoDumper;
#endif
#endif
mInputMap m_inputMap;

View File

@ -8,7 +8,7 @@
#include "input/InputMapper.h"
#include "InputController.h"
#include <QRegExp>
#include <QRegularExpression>
using namespace QGBA;
@ -202,8 +202,8 @@ constexpr InputProfile::InputProfile(const char* name,
const InputProfile* InputProfile::findProfile(const QString& name) {
for (size_t i = 0; i < sizeof(s_defaultMaps) / sizeof(*s_defaultMaps); ++i) {
QRegExp re(s_defaultMaps[i].m_profileName);
if (re.exactMatch(name)) {
QRegularExpression re(QString("^%1$").arg(s_defaultMaps[i].m_profileName));
if (re.match(name).hasMatch()) {
return &s_defaultMaps[i];
}
}