Improve QML types

This commit is contained in:
Tobias Fella
2023-06-06 21:06:58 +02:00
parent 72c85af407
commit 47c28ce9a2
30 changed files with 35 additions and 30 deletions

View File

@@ -261,6 +261,7 @@ int main(int argc, char *argv[])
qmlRegisterUncreatableType<PushNotificationAction>("org.kde.neochat", 1, 0, "PushNotificationAction", "ENUM");
qmlRegisterUncreatableType<NeoChatRoomType>("org.kde.neochat", 1, 0, "NeoChatRoomType", "ENUM");
qmlRegisterUncreatableType<NeoChatUser>("org.kde.neochat", 1, 0, "NeoChatUser", {});
qmlRegisterUncreatableType<NeoChatRoom>("org.kde.neochat", 1, 0, "NeoChatRoom", {});
qRegisterMetaType<User *>("User*");
qRegisterMetaType<User *>("const User*");

View File

@@ -36,7 +36,7 @@ QQC2.Control {
/**
* @brief The current room that user is viewing.
*/
property var currentRoom
property NeoChatRoom currentRoom
/**
* @brief The QQC2.TextArea object.

View File

@@ -35,7 +35,7 @@ ColumnLayout {
/**
* @brief The current room that user is viewing.
*/
property var currentRoom
property NeoChatRoom currentRoom
/**
* @brief The chatBar object

View File

@@ -11,10 +11,12 @@ import org.kde.kirigamiaddons.labs.components 1.0 as Components
import org.kde.kirigami 2.15 as Kirigami
import org.kde.neochat 1.0
Components.AbstractMaximizeComponent {
id: root
required property var room
required property NeoChatRoom room
property var location
title: i18n("Choose a Location")

View File

@@ -12,7 +12,7 @@ import org.kde.neochat 1.0
Kirigami.PlaceholderMessage {
id: root
required property var currentRoom
required property NeoChatRoom currentRoom
text: i18n("Accept this invitation?")
RowLayout {
@@ -32,4 +32,4 @@ Kirigami.PlaceholderMessage {
}
}
}
}
}

View File

@@ -89,7 +89,7 @@ QQC2.Dialog {
delegate: Kirigami.BasicListItem {
id: roomListItem
required property var currentRoom
required property NeoChatRoom currentRoom
required property string displayName
required property int index
required property int notificationCount

View File

@@ -11,7 +11,7 @@ import org.kde.neochat 1.0
QQC2.TextArea {
id: root
property var room
property NeoChatRoom room
onRoomChanged: room.chatBoxEditIdChanged.connect(updateEditText)
property string messageId

View File

@@ -15,7 +15,7 @@ import org.kde.neochat 1.0
QQC2.ScrollView {
id: root
required property var currentRoom
required property NeoChatRoom currentRoom
readonly property bool isLoaded: root.width * root.height > 10
readonly property bool atYEnd: messageListView.atYEnd

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.15 as Kirigami
QQC2.Dialog {
id: confirmEncryptionDialog
property var room
property NeoChatRoom room
ColumnLayout {
Kirigami.Heading {

View File

@@ -13,7 +13,7 @@ Kirigami.OverlaySheet {
id: root
title: i18n("Edit user power level")
property var room
property NeoChatRoom room
property var userId
property int powerLevel

View File

@@ -15,7 +15,7 @@ Kirigami.OverlaySheet {
signal closed()
property var room
property NeoChatRoom room
property var user
parent: applicationWindow().overlay

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami
Kirigami.Page {
id: banSheet
property var room
property NeoChatRoom room
property string userId
title: i18n("Ban User")

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami
Kirigami.Page {
id: deleteSheet
property var room
property NeoChatRoom room
property string eventId
property string userId: ""

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami
Kirigami.Page {
id: reportSheet
property var room
property NeoChatRoom room
property string eventId
title: i18n("Report Message")

View File

@@ -12,7 +12,7 @@ import org.kde.neochat 1.0
Kirigami.Page {
id: devtoolsPage
property var room
property NeoChatRoom room
title: i18n("Developer Tools")

View File

@@ -12,7 +12,7 @@ import org.kde.neochat 1.0
Kirigami.ScrollablePage {
id: root
property var room
property NeoChatRoom room
title: i18n("Invite a User")

View File

@@ -28,7 +28,7 @@ Kirigami.ScrollablePage {
Kirigami.SearchField {
id: identifierField
property bool isRoomAlias: text.match(/#(.+):(.+)/g)
property var room: isRoomAlias ? connection.roomByAlias(text) : null
property NeoChatRoom room: isRoomAlias ? connection.roomByAlias(text) : null
property bool isJoined: room != null
Layout.fillWidth: true

View File

@@ -16,7 +16,7 @@ import './' as RoomList
QQC2.ItemDelegate {
id: root
required property var currentRoom
required property NeoChatRoom currentRoom
required property bool categoryVisible
required property string filterText
required property string avatar

View File

@@ -15,7 +15,7 @@ import org.kde.neochat 1.0
*/
Loader {
id: root
property var room
property NeoChatRoom room
signal closed()
Component {

View File

@@ -19,7 +19,7 @@ Kirigami.BasicListItem {
required property int index
required property int notificationCount
required property int highlightCount
required property var currentRoom
required property NeoChatRoom currentRoom
required property bool categoryVisible
required property string filterText
required property string avatar

View File

@@ -15,7 +15,7 @@ import org.kde.neochat 1.0
*/
Loader {
id: root
property var room
property NeoChatRoom room
signal closed()
Component {

View File

@@ -16,7 +16,7 @@ Kirigami.Page {
id: root
/// Not readonly because of the separate window view.
property var currentRoom: RoomManager.currentRoom
property NeoChatRoom currentRoom: RoomManager.currentRoom
property bool loading: !root.currentRoom || (root.currentRoom.timelineSize === 0 && !root.currentRoom.allHistoryLoaded)
/// Used to determine if scrolling to the bottom should mark the message as unread
property bool hasScrolledUpBefore: false;

View File

@@ -7,9 +7,11 @@ import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami
import org.kde.neochat 1.0
Kirigami.ApplicationWindow {
id: window
required property var currentRoom
required property NeoChatRoom currentRoom
minimumWidth: Kirigami.Units.gridUnit * 10
minimumHeight: Kirigami.Units.gridUnit * 15

View File

@@ -12,7 +12,7 @@ import org.kde.neochat 1.0
Kirigami.ScrollablePage {
id: searchPage
property var currentRoom
property NeoChatRoom currentRoom
title: i18nc("@action:title", "Search Messages")

View File

@@ -13,7 +13,7 @@ import org.kde.neochat 1.0
Kirigami.OverlayDrawer {
id: roomDrawer
readonly property var room: RoomManager.currentRoom
readonly property NeoChatRoom room: RoomManager.currentRoom
width: actualWidth

View File

@@ -7,7 +7,7 @@ import QtQuick.Layouts 1.15
Kirigami.CategorizedSettings {
id: root
property var room
property NeoChatRoom room
objectName: "settingsPage"
actions: [

View File

@@ -15,7 +15,7 @@ import org.kde.neochat 1.0
Kirigami.ScrollablePage {
id: root
property var room
property NeoChatRoom room
title: i18n("General")

View File

@@ -14,7 +14,7 @@ import org.kde.neochat 1.0
Kirigami.ScrollablePage {
id: root
property var room
property NeoChatRoom room
title: i18nc('@title:window', 'Permissions')

View File

@@ -12,7 +12,7 @@ import org.kde.neochat 1.0
Kirigami.ScrollablePage {
property var room
property NeoChatRoom room
title: i18nc('@title:window', 'Notifications')

View File

@@ -13,7 +13,7 @@ import org.kde.neochat 1.0
Kirigami.ScrollablePage {
id: root
property var room
property NeoChatRoom room
property string needUpgradeRoom: i18n("You need to upgrade this room to a newer version to enable this setting.")
title: i18n("Security")