Fix runtime issues with Qt6
To have the code bits reusable, they are defined as cmake variables. In order to make the relative paths work and avoid touching every line from the QRC, the resulting file is put into the source dir.
This commit is contained in:
parent
b1b04eff67
commit
4eddedb3dc
7 changed files with 33 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -33,3 +33,4 @@ CMakeLists.txt.user
|
||||||
.idea
|
.idea
|
||||||
/cmake-build*
|
/cmake-build*
|
||||||
.clang-format
|
.clang-format
|
||||||
|
app/resources.generated.qrc
|
||||||
|
|
|
@ -53,6 +53,20 @@ ecm_setup_version(${RELEASE_SERVICE_VERSION}
|
||||||
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/kdeconnect-version.h
|
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/kdeconnect-version.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(QT_MAJOR_VERSION STREQUAL "6")
|
||||||
|
set(KIRIGAMI_ICON "icon.name")
|
||||||
|
set(KIRIGAMI_ICON_NAME "icon.name")
|
||||||
|
set(KIRIGAMI_PAGE_ACTIONS "actions")
|
||||||
|
set(QTQUICK_FILEDIALOG_FOLDER "currentFolder")
|
||||||
|
else()
|
||||||
|
set(QTQUICK_DIALOGS_IMPORT_VERSION 1.0)
|
||||||
|
set(KIRIGAMI_ICON_NAME "iconName")
|
||||||
|
set(KIRIGAMI_ICON "icon")
|
||||||
|
set(KIRIGAMI_PAGE_ACTIONS "contextualActions")
|
||||||
|
set(QTQUICK_FILEDIALOG_FOLDER "folder")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Make the version header available by linking against kdeconnectversion
|
# Make the version header available by linking against kdeconnectversion
|
||||||
add_library(kdeconnectversion INTERFACE)
|
add_library(kdeconnectversion INTERFACE)
|
||||||
target_include_directories(kdeconnectversion INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(kdeconnectversion INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
qt_add_resources(kdeconnect_SRCS resources.qrc)
|
configure_file(qml/main.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/main.qml)
|
||||||
|
configure_file(qml/DevicePage.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/DevicePage.qml)
|
||||||
|
configure_file(qml/FindDevicesPage.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/FindDevicesPage.qml)
|
||||||
|
configure_file(resources.qrc.in ${CMAKE_CURRENT_SOURCE_DIR}/resources.generated.qrc)
|
||||||
|
|
||||||
|
qt_add_resources(kdeconnect_SRCS resources.generated.qrc)
|
||||||
|
|
||||||
qt_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc)
|
qt_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15 as QQC2
|
import QtQuick.Controls 2.15 as QQC2
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
import QtQuick.Dialogs 1.0
|
import QtQuick.Dialogs @QTQUICK_DIALOGS_IMPORT_VERSION@
|
||||||
import org.kde.kirigami 2.20 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.kdeconnect 1.0
|
import org.kde.kdeconnect 1.0
|
||||||
|
|
||||||
|
@ -16,15 +16,15 @@ Kirigami.ScrollablePage {
|
||||||
property QtObject currentDevice
|
property QtObject currentDevice
|
||||||
title: currentDevice.name
|
title: currentDevice.name
|
||||||
|
|
||||||
actions.contextualActions: [
|
@KIRIGAMI_PAGE_ACTIONS@: [
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
iconName:"network-disconnect"
|
@KIRIGAMI_ICON_NAME@:"network-disconnect"
|
||||||
onTriggered: root.currentDevice.unpair()
|
onTriggered: root.currentDevice.unpair()
|
||||||
text: i18nd("kdeconnect-app", "Unpair")
|
text: i18nd("kdeconnect-app", "Unpair")
|
||||||
visible: root.currentDevice.isTrusted
|
visible: root.currentDevice.isTrusted
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
iconName:"hands-free"
|
@KIRIGAMI_ICON_NAME@:"hands-free"
|
||||||
text: i18nd("kdeconnect-app", "Send Ping")
|
text: i18nd("kdeconnect-app", "Send Ping")
|
||||||
visible: root.currentDevice.isTrusted && root.currentDevice.isReachable
|
visible: root.currentDevice.isTrusted && root.currentDevice.isReachable
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
@ -32,7 +32,7 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
iconName: "settings-configure"
|
@KIRIGAMI_ICON_NAME@: "settings-configure"
|
||||||
text: i18n("Plugin Settings")
|
text: i18n("Plugin Settings")
|
||||||
visible: root.currentDevice.isTrusted && root.currentDevice.isReachable
|
visible: root.currentDevice.isTrusted && root.currentDevice.isReachable
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
@ -155,7 +155,7 @@ Kirigami.ScrollablePage {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
readonly property var shareIface: root.currentDevice ? ShareDbusInterfaceFactory.create(root.currentDevice.id()) : null
|
readonly property var shareIface: root.currentDevice ? ShareDbusInterfaceFactory.create(root.currentDevice.id()) : null
|
||||||
title: i18nd("kdeconnect-app", "Please choose a file")
|
title: i18nd("kdeconnect-app", "Please choose a file")
|
||||||
folder: shortcuts.home
|
@QTQUICK_FILEDIALOG_FOLDER@: shortcuts.home
|
||||||
onAccepted: shareIface.shareUrl(fileDialog.fileUrl)
|
onAccepted: shareIface.shareUrl(fileDialog.fileUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ Kirigami.ScrollablePage
|
||||||
sourceModel: DevicesModel {}
|
sourceModel: DevicesModel {}
|
||||||
}
|
}
|
||||||
delegate: Kirigami.BasicListItem {
|
delegate: Kirigami.BasicListItem {
|
||||||
icon: iconName
|
@KIRIGAMI_ICON@: iconName
|
||||||
iconColor: "transparent"
|
iconColor: "transparent"
|
||||||
label: model.name
|
label: model.name
|
||||||
subtitle: toolTip
|
subtitle: toolTip
|
||||||
|
|
|
@ -74,7 +74,7 @@ Kirigami.ApplicationWindow {
|
||||||
Kirigami.BasicListItem {
|
Kirigami.BasicListItem {
|
||||||
id: findDevicesAction
|
id: findDevicesAction
|
||||||
text: i18nd("kdeconnect-app", "Find devices...")
|
text: i18nd("kdeconnect-app", "Find devices...")
|
||||||
icon: "list-add"
|
@KIRIGAMI_ICON@: "list-add"
|
||||||
checked: pageStack.currentItem && pageStack.currentItem.objectName == "FindDevices"
|
checked: pageStack.currentItem && pageStack.currentItem.objectName == "FindDevices"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ Kirigami.ApplicationWindow {
|
||||||
|
|
||||||
Kirigami.BasicListItem {
|
Kirigami.BasicListItem {
|
||||||
text: i18n("Settings")
|
text: i18n("Settings")
|
||||||
icon: "settings-configure"
|
@KIRIGAMI_ICON@: "settings-configure"
|
||||||
onClicked: pageStack.pushDialogLayer('qrc:/qml/Settings.qml', {}, {
|
onClicked: pageStack.pushDialogLayer('qrc:/qml/Settings.qml', {}, {
|
||||||
title: i18n("Settings"),
|
title: i18n("Settings"),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<!DOCTYPE RCC><RCC version="1.0">
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
<qresource>
|
<qresource>
|
||||||
<file>qml/main.qml</file>
|
<file alias="qml/main.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/main.qml</file>
|
||||||
<file>qml/mpris.qml</file>
|
<file>qml/mpris.qml</file>
|
||||||
<file>qml/mousepad.qml</file>
|
<file>qml/mousepad.qml</file>
|
||||||
<file>qml/presentationRemote.qml</file>
|
<file>qml/presentationRemote.qml</file>
|
||||||
|
|
||||||
<file>qml/PluginItem.qml</file>
|
<file>qml/PluginItem.qml</file>
|
||||||
<file>qml/DevicePage.qml</file>
|
<file alias="qml/DevicePage.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/DevicePage.qml</file>
|
||||||
<file>qml/FindDevicesPage.qml</file>
|
<file alias="qml/FindDevicesPage.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/FindDevicesPage.qml</file>
|
||||||
<file>qml/runcommand.qml</file>
|
<file>qml/runcommand.qml</file>
|
||||||
<file>qml/volume.qml</file>
|
<file>qml/volume.qml</file>
|
||||||
<file>qml/MprisSlider.qml</file>
|
<file>qml/MprisSlider.qml</file>
|
Loading…
Reference in a new issue