Adapt qml for qt5 and qt6

This commit is contained in:
Laurent Montel
2023-07-12 07:49:24 +02:00
committed by Tobias Fella
parent 63a17b5985
commit 98e86f887b
8 changed files with 33 additions and 13 deletions

View File

@@ -48,6 +48,19 @@ if(NEOCHAT_FLATPAK)
include(cmake/Flatpak.cmake)
endif()
if(QT_MAJOR_VERSION STREQUAL "6")
set(BASICLISTITEM_BOLD "font.bold")
set(OVERLAYSHEET_OPEN "onOpened")
set(QTQUICK_MODULE_QML_VERSION "")
set(QTLOCATION_MODULE_QML_VERSION "")
else()
set(BASICLISTITEM_BOLD "bold")
set(OVERLAYSHEET_OPEN "onSheetOpenChanged")
set(QTQUICK_MODULE_QML_VERSION "2.15")
set(QTLOCATION_MODULE_QML_VERSION "5.15")
endif()
ecm_setup_version(${PROJECT_VERSION}
VARIABLE_PREFIX NEOCHAT
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/neochat-version.h

View File

@@ -3,6 +3,14 @@
# SPDX-FileCopyrightText: 2020-2021 Tobias Fella <tobias.fella@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
configure_file(qml/Page/RoomList/RoomDelegate.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Page/RoomList/RoomDelegate.qml)
configure_file(qml/Component/QuickSwitcher.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Component/QuickSwitcher.qml)
configure_file(qml/Dialog/UserDetailDialog.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Dialog/UserDetailDialog.qml)
configure_file(qml/Dialog/PowerLevelDialog.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Dialog/PowerLevelDialog.qml)
configure_file(qml/Component/Timeline/OsmLocationPlugin.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Component/Timeline/OsmLocationPlugin.qml)
configure_file(res.qrc ${CMAKE_CURRENT_SOURCE_DIR}/res.generated.qrc)
add_library(neochat STATIC
controller.cpp
controller.h
@@ -129,7 +137,7 @@ ecm_qt_declare_logging_category(neochat
add_executable(neochat-app
main.cpp
res.qrc
${CMAKE_CURRENT_SOURCE_DIR}/res.generated.qrc
)
target_include_directories(neochat-app PRIVATE ${CMAKE_BINARY_DIR})

View File

@@ -113,7 +113,7 @@ QQC2.Dialog {
RoomManager.enterRoom(roomListItem.currentRoom);
root.close();
}
bold: roomListItem.notificationCount > 0
@BASICLISTITEM_BOLD@: roomListItem.notificationCount > 0
label: roomListItem.displayName ?? ""
labelItem.textFormat: Text.PlainText
subtitle: roomListItem.subtitleText

View File

@@ -3,8 +3,8 @@
pragma Singleton
import QtQuick 2.15
import QtLocation 5.15
import QtQuick @QTQUICK_MODULE_QML_VERSION@
import QtLocation @QTLOCATION_MODULE_QML_VERSION@
QtObject {
property var plugin: Plugin {

View File

@@ -17,7 +17,7 @@ Kirigami.OverlaySheet {
property var userId
property int powerLevel
onSheetOpenChanged: {
@OVERLAYSHEET_OPEN@: {
if (sheetOpen) {
powerLevelComboBox.currentIndex = powerLevelComboBox.indexOfValue(root.powerLevel)
}

View File

@@ -195,8 +195,7 @@ Kirigami.OverlaySheet {
}
}
}
onSheetOpenChanged: {
@OVERLAYSHEET_OPEN@: {
if (!sheetOpen) {
closed()
}

View File

@@ -36,7 +36,7 @@ Kirigami.BasicListItem {
highlighted: ListView.view.currentIndex === index
focus: true
icon: undefined
bold: root.hasNotifications
@BASICLISTITEM_BOLD@: root.hasNotifications
label: root.displayName
labelItem.textFormat: Text.PlainText

View File

@@ -9,7 +9,7 @@
<file alias="RoomList/ExploreComponent.qml">qml/Page/RoomList/ExploreComponent.qml</file>
<file alias="RoomList/ContextMenu.qml">qml/Page/RoomList/ContextMenu.qml</file>
<file alias="RoomList/CollapsedRoomDelegate.qml">qml/Page/RoomList/CollapsedRoomDelegate.qml</file>
<file alias="RoomList/RoomDelegate.qml">qml/Page/RoomList/RoomDelegate.qml</file>
<file alias="RoomList/RoomDelegate.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/Page/RoomList/RoomDelegate.qml</file>
<file alias="RoomList/Page.qml">qml/Page/RoomList/Page.qml</file>
<file alias="SpaceListContextMenu.qml">qml/Page/RoomList/SpaceListContextMenu.qml</file>
<file alias="RoomList/UserInfo.qml">qml/Page/RoomList/UserInfo.qml</file>
@@ -31,7 +31,7 @@
<file alias="FancyEffectsContainer.qml">qml/Component/FancyEffectsContainer.qml</file>
<file alias="TypingPane.qml">qml/Component/TypingPane.qml</file>
<file alias="ShimmerGradient.qml">qml/Component/ShimmerGradient.qml</file>
<file alias="QuickSwitcher.qml">qml/Component/QuickSwitcher.qml</file>
<file alias="QuickSwitcher.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/Component/QuickSwitcher.qml</file>
<file alias="HoverActions.qml">qml/Component/HoverActions.qml</file>
<file alias="ChatBox.qml">qml/Component/ChatBox/ChatBox.qml</file>
<file alias="ChatBar.qml">qml/Component/ChatBox/ChatBar.qml</file>
@@ -74,14 +74,14 @@
<file alias="RoomDrawer.qml">qml/Panel/RoomDrawer.qml</file>
<file alias="DirectChatDrawerHeader.qml">qml/Panel/DirectChatDrawerHeader.qml</file>
<file alias="GroupChatDrawerHeader.qml">qml/Panel/GroupChatDrawerHeader.qml</file>
<file alias="UserDetailDialog.qml">qml/Dialog/UserDetailDialog.qml</file>
<file alias="UserDetailDialog.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/Dialog/UserDetailDialog.qml</file>
<file alias="CreateRoomDialog.qml">qml/Dialog/CreateRoomDialog.qml</file>
<file alias="CreateSpaceDialog.qml">qml/Dialog/CreateSpaceDialog.qml</file>
<file alias="EmojiDialog.qml">qml/Dialog/EmojiDialog.qml</file>
<file alias="OpenFileDialog.qml">qml/Dialog/OpenFileDialog.qml</file>
<file alias="KeyVerificationDialog.qml">qml/Dialog/KeyVerification/KeyVerificationDialog.qml</file>
<file alias="Dialog/ConfirmLogout.qml">qml/Dialog/ConfirmLogout.qml</file>
<file alias="PowerLevelDialog.qml">qml/Dialog/PowerLevelDialog.qml</file>
<file alias="PowerLevelDialog.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/Dialog/PowerLevelDialog.qml</file>
<file alias="Message.qml">qml/Dialog/KeyVerification/Message.qml</file>
<file alias="EmojiItem.qml">qml/Dialog/KeyVerification/EmojiItem.qml</file>
<file alias="EmojiRow.qml">qml/Dialog/KeyVerification/EmojiRow.qml</file>
@@ -126,7 +126,7 @@
<file alias="InvitationView.qml">qml/Component/InvitationView.qml</file>
<file alias="AvatarTabButton.qml">qml/Component/AvatarTabButton.qml</file>
<file alias="SpaceDrawer.qml">qml/Page/RoomList/SpaceDrawer.qml</file>
<file alias="OsmLocationPlugin.qml">qml/Component/Timeline/OsmLocationPlugin.qml</file>
<file alias="OsmLocationPlugin.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/Component/Timeline/OsmLocationPlugin.qml</file>
<file alias="LiveLocationDelegate.qml">qml/Component/Timeline/LiveLocationDelegate.qml</file>
<file alias="FullScreenMap.qml">qml/Component/FullScreenMap.qml</file>
<file alias="LocationsPage.qml">qml/Component/LocationPage.qml</file>