This commit is contained in:
Reilly Brogan 2024-11-18 14:35:04 +01:00 committed by GitHub
commit 9984aa2204
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 116 additions and 2 deletions

View file

@ -277,6 +277,20 @@ else()
find_package(KDSingleApplication-qt6 REQUIRED) find_package(KDSingleApplication-qt6 REQUIRED)
endif() endif()
if(UNIX)
set(KF_MIN_VERSION "6.0.0")
find_package(ECM ${KF_MIN_VERSION})
if(ECM_FOUND)
list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package(KF6 COMPONENTS
Kirigami
)
if(KF6_FOUND)
add_compile_definitions(NHEKO_USE_KIRIGAMI)
endif()
endif()
endif()
if(Qt6Widgets_FOUND) if(Qt6Widgets_FOUND)
if(Qt6Widgets_VERSION VERSION_LESS 6.5.0) if(Qt6Widgets_VERSION VERSION_LESS 6.5.0)
message(STATUS "Qt version ${Qt6Widgets_VERSION}") message(STATUS "Qt version ${Qt6Widgets_VERSION}")
@ -821,12 +835,20 @@ set(QML_SOURCES
resources/qml/delegates/EncryptionEnabled.qml resources/qml/delegates/EncryptionEnabled.qml
resources/qml/ui/TimelineEffects.qml resources/qml/ui/TimelineEffects.qml
) )
set(QML_DEPENDENCIES
QtQuick
QtQml.Models
)
if(KF6_FOUND)
list(APPEND QML_SOURCES "resources/qml/components/KirigamiWheelHandler.qml")
list(APPEND QML_DEPENDENCIES "org.kde.kirigami")
endif()
qt_add_qml_module(nheko qt_add_qml_module(nheko
URI im.nheko URI im.nheko
NO_RESOURCE_TARGET_PATH NO_RESOURCE_TARGET_PATH
RESOURCE_PREFIX "/" RESOURCE_PREFIX "/"
VERSION 1.1 VERSION 1.1
DEPENDENCIES QtQuick QtQml.Models DEPENDENCIES ${QML_DEPENDENCIES}
QML_FILES QML_FILES
${QML_SOURCES} ${QML_SOURCES}
SOURCES SOURCES

View file

@ -38,6 +38,10 @@ Page {
model: Communities.filtered() model: Communities.filtered()
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
Loader {
source: NHEKO_USE_KIRIGAMI ? "components/KirigamiWheelHandler.qml" : ""
}
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
id: scrollbar id: scrollbar

View file

@ -93,6 +93,10 @@ Control {
contentItem: ListView { contentItem: ListView {
id: listView id: listView
Loader {
source: NHEKO_USE_KIRIGAMI ? "components/KirigamiWheelHandler.qml" : ""
}
clip: true clip: true
displayMarginBeginning: height / 2 displayMarginBeginning: height / 2
displayMarginEnd: height / 2 displayMarginEnd: height / 2

View file

@ -65,6 +65,10 @@ Item {
spacing: 2 spacing: 2
verticalLayoutDirection: ListView.BottomToTop verticalLayoutDirection: ListView.BottomToTop
Loader {
source: NHEKO_USE_KIRIGAMI ? "components/KirigamiWheelHandler.qml" : ""
}
property int lastScrollPos: 0 property int lastScrollPos: 0
// Fixup the scroll position when the height changes. Without this, the view is kept around the center of the currently visible content, while we usually want to stick to the bottom. // Fixup the scroll position when the height changes. Without this, the view is kept around the center of the currently visible content, while we usually want to stick to the bottom.

View file

@ -446,6 +446,10 @@ Page {
model: Rooms model: Rooms
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
Loader {
source: NHEKO_USE_KIRIGAMI ? "components/KirigamiWheelHandler.qml" : ""
}
//reuseItems: true //reuseItems: true
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
id: scrollbar id: scrollbar

View file

@ -22,6 +22,10 @@ Page {
contentItem: ListView { contentItem: ListView {
id: uploadsList id: uploadsList
Loader {
source: NHEKO_USE_KIRIGAMI ? "components/KirigamiWheelHandler.qml" : ""
}
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
model: room ? room.input.uploads : undefined model: room ? room.input.uploads : undefined

View file

@ -122,6 +122,10 @@ Container {
contentItem: ListView { contentItem: ListView {
id: view id: view
Loader {
source: NHEKO_USE_KIRIGAMI ? "KirigamiWheelHandler.qml" : ""
}
model: container.contentModel model: container.contentModel
snapMode: ListView.SnapOneItem snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal orientation: ListView.Horizontal

View file

@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
import org.kde.kirigami as Kirigami
Kirigami.WheelHandler {
id: wheelHandler
target: parent
filterMouseEvents: true
keyNavigationEnabled: true
}

View file

@ -100,6 +100,10 @@ Item {
ListView { ListView {
id: view id: view
Loader {
source: NHEKO_USE_KIRIGAMI ? "KirigamiWheelHandler.qml" : ""
}
clip: true clip: true
anchors { fill: parent; margins: 2 } anchors { fill: parent; margins: 2 }

View file

@ -52,6 +52,9 @@ ApplicationWindow {
clip: true clip: true
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
model: editingModel model: editingModel
spacing: 4 spacing: 4

View file

@ -51,6 +51,9 @@ ApplicationWindow {
clip: true clip: true
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
model: roomSettings.allowedRoomsModel model: roomSettings.allowedRoomsModel
spacing: 4 spacing: 4

View file

@ -26,6 +26,10 @@ Window {
spacing: Nheko.paddingMedium spacing: Nheko.paddingMedium
footerPositioning: ListView.OverlayFooter footerPositioning: ListView.OverlayFooter
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
model: TimelineManager.ignoredUsers model: TimelineManager.ignoredUsers
header: ColumnLayout { header: ColumnLayout {
Text { Text {

View file

@ -49,6 +49,9 @@ ApplicationWindow {
model: imagePack model: imagePack
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
header: AvatarListTile { header: AvatarListTile {
title: imagePack.packname title: imagePack.packname

View file

@ -59,7 +59,9 @@ ApplicationWindow {
model: packlist model: packlist
clip: true clip: true
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
footer: ColumnLayout { footer: ColumnLayout {
Button { Button {

View file

@ -166,6 +166,9 @@ ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
delegate: UserListRow { delegate: UserListRow {
id: del2 id: del2
width: ListView.view.width width: ListView.view.width
@ -192,6 +195,10 @@ ApplicationWindow {
clip: true clip: true
visible: inviteDialogRoot.width >= 500 visible: inviteDialogRoot.width >= 500
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
delegate: UserListRow { delegate: UserListRow {
id: del id: del
hoverEnabled: true hoverEnabled: true

View file

@ -86,6 +86,10 @@ ApplicationWindow {
spacing: 4 spacing: 4
cacheBuffer: 50 cacheBuffer: 50
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
delegate: RowLayout { delegate: RowLayout {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -54,6 +54,10 @@ ApplicationWindow {
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
model: readReceipts model: readReceipts
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
delegate: ItemDelegate { delegate: ItemDelegate {
id: del id: del

View file

@ -34,6 +34,10 @@ ApplicationWindow {
anchors.fill: parent anchors.fill: parent
model: publicRooms model: publicRooms
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
delegate: Rectangle { delegate: Rectangle {
id: roomDirDelegate id: roomDirDelegate

View file

@ -108,6 +108,9 @@ ApplicationWindow {
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
model: members model: members
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
delegate: ItemDelegate { delegate: ItemDelegate {
id: del id: del

View file

@ -45,6 +45,10 @@ ApplicationWindow {
anchors.margins: 10 anchors.margins: 10
footerPositioning: ListView.OverlayFooter footerPositioning: ListView.OverlayFooter
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
header: ColumnLayout { header: ColumnLayout {
id: contentL id: contentL

View file

@ -116,6 +116,10 @@ Menu {
clip: true clip: true
currentIndex: -1 // prevent sorting from stealing focus currentIndex: -1 // prevent sorting from stealing focus
Loader {
source: NHEKO_USE_KIRIGAMI ? "../components/KirigamiWheelHandler.qml" : ""
}
section.property: "packname" section.property: "packname"
section.criteria: ViewSection.FullString section.criteria: ViewSection.FullString
section.delegate: Rectangle { section.delegate: Rectangle {

View file

@ -4,6 +4,7 @@
#include <QApplication> #include <QApplication>
#include <QMessageBox> #include <QMessageBox>
#include <QQmlContext>
#include <mtx/events/collections.hpp> #include <mtx/events/collections.hpp>
#include <mtx/requests.hpp> #include <mtx/requests.hpp>
@ -123,6 +124,12 @@ MainWindow::registerQmlTypes()
nhlog::ui()->warn("Could not connect to D-Bus!"); nhlog::ui()->warn("Could not connect to D-Bus!");
} }
#endif #endif
#ifdef NHEKO_USE_KIRIGAMI
engine()->rootContext()->setContextProperty("NHEKO_USE_KIRIGAMI", QVariant(true));
#else
engine()->rootContext()->setContextProperty("NHEKO_USE_KIRIGAMI", QVariant(false));
#endif
} }
void void