Skip to content

Commit

Permalink
Officially drop Qt Multimedia with Qt 6
Browse files Browse the repository at this point in the history
Closes #483.
  • Loading branch information
KitsuneRal committed Jul 16, 2021
1 parent adb6725 commit 9a5fa62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ set(CMAKE_AUTOMOC ON)
option(BUILD_WITH_QT6 "Build Quotient with Qt 6 (EXPERIMENTAL)" OFF)

if (BUILD_WITH_QT6)
find_package(Qt6 6.2 REQUIRED Core Network Gui Test) # TODO: Multimedia
set(Qt Qt6)
qt6_wrap_cpp(lib_SRCS lib/quotient_common.h)
set(QtMinVersion "6.0")
else()
find_package(Qt5 5.12 REQUIRED Core Network Gui Multimedia Test)
set(Qt Qt5)
set(QtMinVersion "5.12")
set(QtExtraModules "Multimedia") # See #483
endif()
get_filename_component($Qt_Prefix "${${Qt}_DIR}/../../../.." ABSOLUTE)
string(REGEX REPLACE "^(.).*" "Qt\\1" Qt ${QtMinVersion}) # makes "Qt5" or "Qt6"
find_package(${Qt} ${QtMinVersion} REQUIRED Core Network Gui Test ${QtExtraModules})
get_filename_component(Qt_Prefix "${${Qt}_DIR}/../../../.." ABSOLUTE)
message(STATUS "Using Qt ${${Qt}_VERSION} at ${Qt_Prefix}")

if (${PROJECT_NAME}_ENABLE_E2EE)
Expand Down Expand Up @@ -299,7 +299,7 @@ if (${PROJECT_NAME}_ENABLE_E2EE)
set(FIND_DEPS "find_dependency(QtOlm)") # For QuotientConfig.cmake.in
endif()
target_link_libraries(${PROJECT_NAME} ${Qt}::Core ${Qt}::Network ${Qt}::Gui)
if (Qt STREQUAL Qt5) # Qt 6 hasn't got Multimedia component as yet
if (Qt STREQUAL Qt5) # See #483
target_link_libraries(${PROJECT_NAME} ${Qt}::Multimedia)
endif()

Expand Down
6 changes: 2 additions & 4 deletions lib/events/roommessageevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ RoomMessageEvent::RoomMessageEvent(const QString& plainBody, MsgType msgType,
: RoomMessageEvent(plainBody, msgTypeToJson(msgType), content)
{}

#if QT_VERSION_MAJOR < 6
TypedBase* contentFromFile(const QFileInfo& file, bool asGenericFile)
{
auto filePath = file.absoluteFilePath();
Expand All @@ -151,11 +152,7 @@ TypedBase* contentFromFile(const QFileInfo& file, bool asGenericFile)
// done by starting to play the file. Left for a future implementation.
if (mimeTypeName.startsWith("video/"))
return new VideoContent(localUrl, file.size(), mimeType,
#if QT_VERSION_MAJOR < 6
QMediaResource(localUrl).resolution(),
#else
{},
#endif
file.fileName());

if (mimeTypeName.startsWith("audio/"))
Expand All @@ -172,6 +169,7 @@ RoomMessageEvent::RoomMessageEvent(const QString& plainBody,
: rawMsgTypeForFile(file),
contentFromFile(file, asGenericFile))
{}
#endif

RoomMessageEvent::RoomMessageEvent(const QJsonObject& obj)
: RoomEvent(typeId(), obj), _content(nullptr)
Expand Down
4 changes: 4 additions & 0 deletions lib/events/roommessageevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ class RoomMessageEvent : public RoomEvent {
explicit RoomMessageEvent(const QString& plainBody,
MsgType msgType = MsgType::Text,
EventContent::TypedBase* content = nullptr);
#if QT_VERSION_MAJOR < 6
[[deprecated("Create an EventContent object on the client side"
" and pass it to other constructors")]] //
explicit RoomMessageEvent(const QString& plainBody, const QFileInfo& file,
bool asGenericFile = false);
#endif
explicit RoomMessageEvent(const QJsonObject& obj);

MsgType msgtype() const;
Expand Down

0 comments on commit 9a5fa62

Please sign in to comment.