Port all qml elements to declarative registration

This commit is contained in:
Nicolas Werner 2022-04-15 02:58:44 +02:00
parent 423d649aa7
commit fdae12df6f
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
135 changed files with 639 additions and 629 deletions

View file

@ -333,7 +333,6 @@ set(SRC_FILES
src/ui/MxcAnimatedImage.cpp
src/ui/MxcMediaProxy.cpp
src/ui/NhekoCursorShape.cpp
src/ui/NhekoEventObserver.cpp
src/ui/NhekoDropArea.cpp
src/ui/NhekoGlobalObject.cpp
src/ui/RoomSettings.cpp
@ -530,7 +529,6 @@ set(MOC_HEADERS
src/ui/MxcAnimatedImage.h
src/ui/MxcMediaProxy.h
src/ui/NhekoCursorShape.h
src/ui/NhekoEventObserver.h
src/ui/NhekoGlobalObject.h
src/ui/RoomSettings.h
src/ui/Theme.h
@ -645,7 +643,7 @@ qt_add_translations(nheko RESOURCE_PREFIX "/translations" TS_FILES ${LANG_TS_SRC
set_property(TARGET nheko PROPERTY AUTOMOC ON)
qt_add_qml_module(nheko
URI im.nheko2
URI im.nheko
RESOURCE_PREFIX "/"
VERSION 1.0
SOURCES
@ -749,6 +747,10 @@ qt_target_qml_sources(nheko
qml/TimelineView.qml
)
if (NOT COMPILE_QML)
set_target_properties(nheko PROPERTIES QT_QMLCACHEGEN_ARGUMENTS "--only-bytecode")
endif()
if(APPLE)
target_link_libraries (nheko PRIVATE Qt5::MacExtras)
@ -764,7 +766,7 @@ else()
target_compile_definitions(nheko PRIVATE NHEKO_FLATPAK)
endif()
endif()
target_include_directories(nheko PRIVATE src includes third_party/blurhash third_party/cpp-httplib-0.5.12 src/timeline src/ui)
target_include_directories(nheko PRIVATE src includes third_party/blurhash third_party/cpp-httplib-0.5.12 src/timeline src/ui src/encryption src/emoji src/voip)
# Fixup bundled keychain include dirs
if (USE_BUNDLED_QTKEYCHAIN)

View file

@ -7,7 +7,7 @@ import "./ui"
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import im.nheko 1.0
import im.nheko
AbstractButton {
id: avatar
@ -98,7 +98,7 @@ AbstractButton {
}
}
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}

View file

@ -7,7 +7,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import "components"
import im.nheko 1.0
import im.nheko
// this needs to be last
import QtQml 2.15

View file

@ -9,7 +9,7 @@ import QtQml 2.12
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
Page {
id: communitySidebar

View file

@ -7,7 +7,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import im.nheko
import im.nheko2
import im.nheko
import "./ui/"

View file

@ -5,7 +5,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.5
import im.nheko 1.0
import im.nheko
Label {
id: root

View file

@ -6,7 +6,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.1
import QtQuick.Window 2.15
import im.nheko 1.0
import im.nheko
Image {
id: stateImg

View file

@ -6,7 +6,7 @@
import "./delegates/"
import QtQuick 2.9
import QtQuick.Controls 2.3
import im.nheko 1.0
import im.nheko
Popup {
id: forwardMessagePopup

View file

@ -6,7 +6,7 @@
import "./ui"
import QtQuick 2.3
import QtQuick.Controls 2.3
import im.nheko 1.0 // for cursor shape
import im.nheko
AbstractButton {
id: button
@ -31,7 +31,7 @@ AbstractButton {
fillMode: Image.PreserveAspectFit
}
CursorShape {
NhekoCursorShape {
id: mouseArea
anchors.fill: parent

View file

@ -5,7 +5,7 @@
import QtQuick 2.5
import QtQuick.Controls 2.3
import im.nheko 1.0
import im.nheko
TextEdit {
id: r
@ -29,9 +29,8 @@ TextEdit {
TimelineManager.fixImageRendering(r.textDocument, r);
}
CursorShape {
NhekoCursorShape {
id: cs
anchors.fill: parent
cursorShape: hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}

View file

@ -6,7 +6,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import im.nheko 1.0
import im.nheko
ColumnLayout {

View file

@ -9,7 +9,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.13
import im.nheko 1.0
import im.nheko
Rectangle {
id: inputBar

View file

@ -13,7 +13,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2
import QtQuick.Window 2.13
import im.nheko 1.0
import im.nheko
Item {
@ -326,7 +326,7 @@ Item {
leftPadding: 0
rightPadding: 0
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}

View file

@ -6,7 +6,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
BusyIndicator {
id: control

View file

@ -6,7 +6,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Item {
implicitHeight: warningRect.visible ? warningDisplay.implicitHeight : 0

View file

@ -6,7 +6,7 @@
//import QtGraphicalEffects 1.0
import QtQuick 2.12
import QtQuick.Window 2.2
import im.nheko 1.0
import im.nheko
Item {
id: privacyScreen

View file

@ -6,7 +6,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
import im.nheko
Popup {
id: quickSwitcher

View file

@ -5,7 +5,7 @@
import QtQuick 2.6
import QtQuick.Controls 2.2
import im.nheko 1.0
import im.nheko
// This class is for showing Reactions in the timeline row, not for
// adding new reactions via the emoji picker

View file

@ -7,7 +7,7 @@ import "./delegates/"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Rectangle {
id: replyPopup

View file

@ -10,7 +10,7 @@ import QtQml 2.12
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
Page {
//leftPadding: Nheko.paddingSmall

View file

@ -15,8 +15,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import QtQuick.Window 2.15
import im.nheko 1.0
import im.nheko.EmojiModel 1.0
import im.nheko
Pane {
id: timelineRoot

View file

@ -8,7 +8,7 @@ import Qt.labs.platform 1.1 as P
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
Item {
visible: false

View file

@ -5,7 +5,7 @@
import QtQuick 2.5
import QtQuick.Controls 2.1
import im.nheko 1.0
import im.nheko
ImageButton {
id: indicator

View file

@ -9,7 +9,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.13
import im.nheko 1.0
import im.nheko
AbstractButton {
id: r
@ -164,7 +164,7 @@ AbstractButton {
duration: r.relatedEventCacheBuster, fromModel(Room.Duration) ?? 0
roomTopic: r.relatedEventCacheBuster, fromModel(Room.RoomTopic) ?? ""
roomName: r.relatedEventCacheBuster, fromModel(Room.RoomName) ?? ""
callType: r.relatedEventCacheBuster, fromModel(Room.CallType) ?? ""
callType: r.relatedEventCacheBuster, fromModel(Room.Voip) ?? ""
encryptionError: r.relatedEventCacheBuster, fromModel(Room.EncryptionError) ?? 0
relatedEventCacheBuster: r.relatedEventCacheBuster, fromModel(Room.RelatedEventCacheBuster) ?? 0
}

View file

@ -15,8 +15,7 @@ import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import QtQuick.Window 2.13
import im.nheko
import im.nheko2
import im.nheko.EmojiModel 1.0
import im.nheko
Item {
id: timelineView
@ -98,7 +97,7 @@ Item {
}
Loader {
source: CallManager.isOnCall && CallManager.callType != CallType.VOICE ? "voip/VideoCall.qml" : ""
source: CallManager.isOnCall && CallManager.callType != Voip.VOICE ? "voip/VideoCall.qml" : ""
onLoaded: TimelineManager.setVideoCallItem()
}
@ -231,7 +230,7 @@ Item {
horizontalAlignment: TextEdit.AlignHCenter
onLinkActivated: Nheko.openLink(link)
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}

View file

@ -6,7 +6,7 @@
import QtQuick 2.5
import QtQuick 2.12
import QtQuick.Controls 2.12
import im.nheko 1.0
import im.nheko
Switch {
id: toggleButton

View file

@ -8,7 +8,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2
import QtQuick.Window 2.15
import im.nheko 1.0
import im.nheko
import "./delegates"
@ -26,7 +26,7 @@ Pane {
property string directChatOtherUserId: room ? room.directChatOtherUserId : ""
Layout.fillWidth: true
implicitHeight: topLayout.height + Nheko.paddingMedium * 2
implicitHeight: topBarC.height + Nheko.paddingMedium * 2
z: 3
padding: 0
@ -71,8 +71,7 @@ Pane {
contentItem: Item {
GridLayout {
id: topLayout
id: topBarC
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Nheko.paddingMedium
@ -344,7 +343,7 @@ Pane {
}
}
CursorShape {
NhekoCursorShape {
anchors.fill: parent
anchors.bottomMargin: (pinnedMessages.visible ? pinnedMessages.height : 0) + (widgets.visible ? widgets.height : 0)
cursorShape: Qt.PointingHandCursor

View file

@ -6,7 +6,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Item {
implicitHeight: Math.max(fontMetrics.height * 1.2, typingDisplay.height)

View file

@ -8,7 +8,7 @@ import "./ui"
import QtQuick 2.9
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
Page {
id: uploadPopup

View file

@ -6,7 +6,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
import im.nheko 1.0
import im.nheko
Container {
//Component.onCompleted: {
@ -88,7 +88,7 @@ Container {
x: parent.preferredWidth
z: 3
CursorShape {
NhekoCursorShape {
height: parent.height
width: container.splitterGrabMargin * 2
x: -container.splitterGrabMargin

View file

@ -7,7 +7,7 @@ import ".."
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
import im.nheko
Rectangle {
id: tile

View file

@ -7,7 +7,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
// FIXME(Nico): Don't use hardcoded colors.
Button {

View file

@ -7,7 +7,7 @@ import Qt.labs.platform 1.1 as P
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
Dialog {
default property alias inner: scroll.data

View file

@ -6,7 +6,7 @@
import "../ui"
import QtQuick 2.15
import QtQuick.Controls 2.15
import im.nheko 1.0 // for cursor shape
import im.nheko // for cursor shape
AbstractButton {
id: button
@ -33,7 +33,7 @@ AbstractButton {
horizontalAlignment: Text.AlignHCenter
}
CursorShape {
NhekoCursorShape {
id: mouseArea
anchors.fill: parent

View file

@ -7,7 +7,7 @@ import ".."
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
import im.nheko
Rectangle {
id: r

View file

@ -5,7 +5,7 @@
import QtQuick 2.12
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Item {
required property string eventId
@ -51,7 +51,7 @@ Item {
gesturePolicy: TapHandler.ReleaseWithinBounds
}
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}

View file

@ -6,7 +6,7 @@
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.3
import im.nheko 1.0
import im.nheko
AbstractButton {
required property int type

View file

@ -7,7 +7,7 @@ import QtQuick 2.6
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.2
import im.nheko
import im.nheko2
import im.nheko
Item {
id: d

View file

@ -4,7 +4,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.5
import im.nheko 1.0
import im.nheko
TextMessage {

View file

@ -5,7 +5,7 @@
import QtQuick 2.5
import QtQuick.Controls 2.1
import im.nheko 1.0
import im.nheko
Label {
property bool isStateEvent

View file

@ -4,7 +4,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import ".."
import im.nheko 1.0
import im.nheko
MatrixText {
required property string typeString

View file

@ -9,7 +9,7 @@ import QtMultimedia
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
import im.nheko
Item {
id: content

View file

@ -6,7 +6,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
import im.nheko
Rectangle{

View file

@ -8,7 +8,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.13
import im.nheko 1.0
import im.nheko
import "../"
AbstractButton {
@ -43,7 +43,7 @@ AbstractButton {
implicitHeight: replyContainer.height
implicitWidth: visible? colorLine.width+Math.max(replyContainer.implicitWidth,userName_.fullTextWidth) : 0 // visible? seems to be causing issues
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}

View file

@ -43,7 +43,7 @@ MatrixText {
enabled: !Settings.mobileMode
font.pointSize: (Settings.enlargeEmojiOnlyMessages && isOnlyEmoji > 0 && isOnlyEmoji < 4) ? Settings.fontSize * 3 : Settings.fontSize
CursorShape {
NhekoCursorShape {
enabled: isReply
anchors.fill: parent
cursorShape: Qt.PointingHandCursor

View file

@ -6,7 +6,7 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Window 2.13
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: dialog

View file

@ -6,7 +6,7 @@
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10
import im.nheko 1.0
import im.nheko
Pane {
property string title: qsTr("Verification Code")

View file

@ -6,7 +6,7 @@
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10
import im.nheko 1.0
import im.nheko
Pane {
property string title: qsTr("Verification Code")

View file

@ -6,7 +6,7 @@
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10
import im.nheko 1.0
import im.nheko
Pane {
property string title: qsTr("Verification failed")

View file

@ -6,7 +6,7 @@
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10
import im.nheko 1.0
import im.nheko
Pane {
property string title: flow.sender ? qsTr("Send Verification Request") : qsTr("Received Verification Request")

View file

@ -6,7 +6,7 @@
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10
import im.nheko 1.0
import im.nheko
Pane {
property string title: qsTr("Successful Verification")

View file

@ -7,7 +7,7 @@ import "../ui"
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10
import im.nheko 1.0
import im.nheko
Pane {
property string title: qsTr("Waiting for other party…")

View file

@ -9,7 +9,7 @@ import QtQuick.Window 2.13
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3
import QtQml.Models 2.15
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: createDirectRoot

View file

@ -8,7 +8,7 @@ import QtQuick 2.15
import QtQuick.Window 2.13
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: createRoomRoot

View file

@ -6,7 +6,7 @@ import ".."
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: hiddenEventsDialog

View file

@ -7,7 +7,7 @@ import QtQuick.Window 2.15
import ".."
import im.nheko 1.0
import im.nheko
Window {
id: imageOverlay

View file

@ -9,7 +9,7 @@ import Qt.labs.platform 1.1
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: win

View file

@ -8,7 +8,7 @@ import "../components"
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: win

View file

@ -7,7 +7,7 @@ import ".."
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: inputDialog

View file

@ -7,7 +7,7 @@ import ".."
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: inviteDialogRoot
@ -154,7 +154,7 @@ ApplicationWindow {
}
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}

View file

@ -7,7 +7,7 @@ import ".."
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: joinRoomRoot

View file

@ -6,7 +6,7 @@
import Qt.labs.platform 1.1 as P
import QtQuick 2.15
import QtQuick.Controls 2.15
import im.nheko 1.0
import im.nheko
P.MessageDialog {
id: leaveRoomRoot

View file

@ -6,7 +6,7 @@
import Qt.labs.platform 1.1 as P
import QtQuick 2.15
import QtQuick.Controls 2.15
import im.nheko 1.0
import im.nheko
P.MessageDialog {
id: logoutRoot

View file

@ -8,7 +8,7 @@ import ".."
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: inputDialog

View file

@ -5,7 +5,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: rawMessageRoot

View file

@ -7,7 +7,7 @@ import ".."
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: readReceiptsRoot
@ -110,7 +110,7 @@ ApplicationWindow {
}
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}

View file

@ -8,7 +8,7 @@ import "../ui"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: roomDirectoryWindow

View file

@ -9,7 +9,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Window 2.13
import im.nheko 1.0
import im.nheko
ApplicationWindow {
id: roomMembersRoot
@ -187,7 +187,7 @@ ApplicationWindow {
}
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}

View file

@ -10,7 +10,8 @@ import QtQuick 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.13
import im.nheko 1.0
import im.nheko
import im.nheko
ApplicationWindow {
id: roomSettingsDialog
@ -165,7 +166,7 @@ ApplicationWindow {
onSingleTapped: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId))
}
CursorShape {
NhekoCursorShape {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
}
@ -196,7 +197,7 @@ ApplicationWindow {
horizontalAlignment: TextEdit.AlignHCenter
onLinkActivated: Nheko.openLink(link)
CursorShape {
NhekoCursorShape {
anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}

View file

@ -10,7 +10,8 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2
import QtQuick.Window 2.13
import im.nheko 1.0
import im.nheko
import im.nheko
ApplicationWindow {
id: userProfileDialog

View file

@ -8,8 +8,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Window 2.15
import im.nheko 1.0
import im.nheko.EmojiModel 1.0
import im.nheko
Menu {
id: emojiPopup
@ -203,56 +202,56 @@ Menu {
// Display the normal categories
Repeater {
model: ListModel {
model: [
// TODO: Would like to get 'simple' icons for the categories
ListElement {
image: ":/icons/icons/emoji-categories/people.svg"
{
image: ":/icons/icons/emoji-categories/people.svg",
category: Emoji.Category.People
}
},
ListElement {
image: ":/icons/icons/emoji-categories/nature.svg"
{
image: ":/icons/icons/emoji-categories/nature.svg",
category: Emoji.Category.Nature
}
},
ListElement {
image: ":/icons/icons/emoji-categories/foods.svg"
{
image: ":/icons/icons/emoji-categories/foods.svg",
category: Emoji.Category.Food
}
},
ListElement {
image: ":/icons/icons/emoji-categories/activity.svg"
{
image: ":/icons/icons/emoji-categories/activity.svg",
category: Emoji.Category.Activity
}
},
ListElement {
image: ":/icons/icons/emoji-categories/travel.svg"
{
image: ":/icons/icons/emoji-categories/travel.svg",
category: Emoji.Category.Travel
}
},
ListElement {
image: ":/icons/icons/emoji-categories/objects.svg"
{
image: ":/icons/icons/emoji-categories/objects.svg",
category: Emoji.Category.Objects
}
},
ListElement {
image: ":/icons/icons/emoji-categories/symbols.svg"
{
image: ":/icons/icons/emoji-categories/symbols.svg",
category: Emoji.Category.Symbols
}
},
ListElement {
image: ":/icons/icons/emoji-categories/flags.svg"
{
image: ":/icons/icons/emoji-categories/flags.svg",
category: Emoji.Category.Flags
}
}
]
delegate: AbstractButton {
Layout.preferredWidth: 36
Layout.preferredHeight: 36
hoverEnabled: true
ToolTip.text: {
switch (model.category) {
switch (modelData.category) {
case Emoji.Category.People:
return qsTr('People');
case Emoji.Category.Nature:
@ -274,7 +273,7 @@ Menu {
ToolTip.visible: hovered
onClicked: {
//emojiPopup.model.category = model.category;
gridView.positionViewAtIndex(emojiPopup.model.sourceModel.categoryToIndex(model.category), GridView.Beginning);
gridView.positionViewAtIndex(emojiPopup.model.sourceModel.categoryToIndex(modelData.category), GridView.Beginning);
}
MouseArea {
@ -295,14 +294,14 @@ Menu {
mipmap: true
sourceSize.width: 32 * Screen.devicePixelRatio
sourceSize.height: 32 * Screen.devicePixelRatio
source: "image://colorimage/" + model.image + "?" + (hovered ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText)
source: "image://colorimage/" + modelData.image + "?" + (hovered ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText)
}
background: Rectangle {
anchors.fill: parent
color: emojiPopup.model.category === model.category ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.2) : 'transparent'
color: emojiPopup.model.category === modelData.category ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.2) : 'transparent'
radius: 5
border.color: emojiPopup.model.category === model.category ? timelineRoot.palette.highlight : 'transparent'
border.color: emojiPopup.model.category === modelData.category ? timelineRoot.palette.highlight : 'transparent'
}
}

View file

@ -7,8 +7,7 @@ import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import im.nheko 1.0
import im.nheko.EmojiModel 1.0
import im.nheko
Menu {
id: stickerPopup

View file

@ -6,7 +6,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2
import QtQuick.Window 2.15
import im.nheko 1.0
import im.nheko
import "../components/"
import "../ui/"
import "../"

View file

@ -6,7 +6,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2
import QtQuick.Window 2.15
import im.nheko 1.0
import im.nheko
import "../components/"
import "../ui/"
import "../"

View file

@ -11,7 +11,7 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2
import QtQuick.Window 2.15
import im.nheko
import im.nheko2
import im.nheko
Rectangle {
id: userSettingsDialog

View file

@ -6,7 +6,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.2
import QtQuick.Window 2.15
import im.nheko 1.0
import im.nheko
import "../components/"
ColumnLayout {

View file

@ -5,7 +5,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import im.nheko 1.0
import im.nheko
Slider {
id: control

View file

@ -4,7 +4,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import im.nheko 1.0
import im.nheko
Popup {
id: snackbar

View file

@ -9,7 +9,7 @@ import QtMultimedia 5.15
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
import im.nheko
Rectangle {
id: control

View file

@ -7,7 +7,7 @@ import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Rectangle {
visible: CallManager.isOnCall
@ -17,7 +17,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
onClicked: {
if (CallManager.callType != CallType.VOICE)
if (CallManager.callType != Voip.VOICE)
stackLayout.currentIndex = stackLayout.currentIndex ? 0 : 1;
}
@ -59,7 +59,7 @@ Rectangle {
states: [
State {
name: "VOICE"
when: CallManager.callType == CallType.VOICE
when: CallManager.callType == Voip.VOICE
PropertyChanges {
target: callTypeIcon
@ -69,7 +69,7 @@ Rectangle {
},
State {
name: "VIDEO"
when: CallManager.callType == CallType.VIDEO
when: CallManager.callType == Voip.VIDEO
PropertyChanges {
target: callTypeIcon
@ -79,7 +79,7 @@ Rectangle {
},
State {
name: "SCREEN"
when: CallManager.callType == CallType.SCREEN
when: CallManager.callType == Voip.SCREEN
PropertyChanges {
target: callTypeIcon
@ -101,7 +101,7 @@ Rectangle {
states: [
State {
name: "OFFERSENT"
when: CallManager.callState == WebRTCState.OFFERSENT
when: CallManager.callState == Voip.OFFERSENT
PropertyChanges {
target: callStateLabel
@ -111,7 +111,7 @@ Rectangle {
},
State {
name: "CONNECTING"
when: CallManager.callState == WebRTCState.CONNECTING
when: CallManager.callState == Voip.CONNECTING
PropertyChanges {
target: callStateLabel
@ -121,7 +121,7 @@ Rectangle {
},
State {
name: "ANSWERSENT"
when: CallManager.callState == WebRTCState.ANSWERSENT
when: CallManager.callState == Voip.ANSWERSENT
PropertyChanges {
target: callStateLabel
@ -131,7 +131,7 @@ Rectangle {
},
State {
name: "CONNECTED"
when: CallManager.callState == WebRTCState.CONNECTED
when: CallManager.callState == Voip.CONNECTED
PropertyChanges {
target: callStateLabel
@ -145,13 +145,13 @@ Rectangle {
PropertyChanges {
target: stackLayout
currentIndex: CallManager.callType != CallType.VOICE ? 1 : 0
currentIndex: CallManager.callType != Voip.VOICE ? 1 : 0
}
},
State {
name: "DISCONNECTED"
when: CallManager.callState == WebRTCState.DISCONNECTED
when: CallManager.callState == Voip.DISCONNECTED
PropertyChanges {
target: callStateLabel
@ -177,7 +177,7 @@ Rectangle {
}
interval: 1000
running: CallManager.callState == WebRTCState.CONNECTED
running: CallManager.callState == Voip.CONNECTED
repeat: true
onTriggered: {
var d = new Date();
@ -191,7 +191,7 @@ Rectangle {
Label {
Layout.leftMargin: 16
visible: CallManager.callType == CallType.SCREEN && CallManager.callState == WebRTCState.CONNECTED
visible: CallManager.callType == Voip.SCREEN && CallManager.callState == Voip.CONNECTED
text: qsTr("You are screen sharing")
font.pointSize: fontMetrics.font.pointSize * 1.1
color: "#000000"

View file

@ -6,7 +6,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Popup {
modal: true
@ -45,7 +45,7 @@ Popup {
}
RowLayout {
visible: CallManager.callType == CallType.VIDEO && CallManager.cameras.length > 0
visible: CallManager.callType == Voip.VIDEO && CallManager.cameras.length > 0
Image {
Layout.preferredWidth: 22

View file

@ -7,7 +7,7 @@ import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Popup {
id: callInv
@ -64,7 +64,7 @@ Popup {
Layout.bottomMargin: callInv.height / 25
Image {
property string image: CallManager.callType == CallType.VIDEO ? ":/icons/icons/ui/video.svg" : ":/icons/icons/ui/place-call.svg"
property string image: CallManager.callType == Voip.VIDEO ? ":/icons/icons/ui/video.svg" : ":/icons/icons/ui/place-call.svg"
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: callInv.height / 10
@ -74,7 +74,7 @@ Popup {
Label {
Layout.alignment: Qt.AlignCenter
text: CallManager.callType == CallType.VIDEO ? qsTr("Video Call") : qsTr("Voice Call")
text: CallManager.callType == Voip.VIDEO ? qsTr("Video Call") : qsTr("Voice Call")
font.pointSize: fontMetrics.font.pointSize * 2
color: timelineRoot.palette.windowText
}
@ -108,7 +108,7 @@ Popup {
}
RowLayout {
visible: CallManager.callType == CallType.VIDEO && CallManager.cameras.length > 0
visible: CallManager.callType == Voip.VIDEO && CallManager.cameras.length > 0
Layout.alignment: Qt.AlignCenter
Image {
@ -171,7 +171,7 @@ Popup {
RoundButton {
id: acceptButton
property string image: CallManager.callType == CallType.VIDEO ? ":/icons/icons/ui/video.svg" : ":/icons/icons/ui/place-call.svg"
property string image: CallManager.callType == Voip.VIDEO ? ":/icons/icons/ui/video.svg" : ":/icons/icons/ui/place-call.svg"
implicitWidth: buttonLayout.buttonSize
implicitHeight: buttonLayout.buttonSize

View file

@ -7,7 +7,7 @@ import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Rectangle {
visible: CallManager.haveCallInvite && !Settings.mobileMode
@ -58,12 +58,12 @@ Rectangle {
Layout.leftMargin: 4
Layout.preferredWidth: 24
Layout.preferredHeight: 24
source: CallManager.callType == CallType.VIDEO ? "qrc:/icons/icons/ui/video.svg" : "qrc:/icons/icons/ui/place-call.svg"
source: CallManager.callType == Voip.CallType.VIDEO ? "qrc:/icons/icons/ui/video.svg" : "qrc:/icons/icons/ui/place-call.svg"
}
Label {
font.pointSize: fontMetrics.font.pointSize * 1.1
text: CallManager.callType == CallType.VIDEO ? qsTr("Video Call") : qsTr("Voice Call")
text: CallManager.callType == Voip.VIDEO ? qsTr("Video Call") : qsTr("Voice Call")
color: "#000000"
}
@ -89,7 +89,7 @@ Rectangle {
Button {
Layout.rightMargin: 4
icon.source: CallManager.callType == CallType.VIDEO ? "qrc:/icons/icons/ui/video.svg" : "qrc:/icons/icons/ui/place-call.svg"
icon.source: CallManager.callType == Voip.VIDEO ? "qrc:/icons/icons/ui/video.svg" : "qrc:/icons/icons/ui/place-call.svg"
text: qsTr("Accept")
palette: timelineRoot.palette
onClicked: {
@ -110,7 +110,7 @@ Rectangle {
timelineRoot.destroyOnClose(dialog);
return ;
}
if (CallManager.callType == CallType.VIDEO && CallManager.cameras.length > 0 && !CallManager.cameras.includes(Settings.camera)) {
if (CallManager.callType == Voip.VIDEO && CallManager.cameras.length > 0 && !CallManager.cameras.includes(Settings.camera)) {
var dialog = deviceError.createObject(timelineRoot, {
"errorString": qsTr("Unknown camera: %1").arg(Settings.camera),
"image": ":/icons/icons/ui/video.svg"

View file

@ -6,7 +6,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Popup {
property string errorString

View file

@ -7,7 +7,7 @@ import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Popup {
modal: true
@ -83,7 +83,7 @@ Popup {
onClicked: {
if (buttonLayout.validateMic()) {
Settings.microphone = micCombo.currentText;
CallManager.sendInvite(room.roomId, CallType.VOICE);
CallManager.sendInvite(room.roomId, Voip.VOICE);
close();
}
}
@ -97,7 +97,7 @@ Popup {
if (buttonLayout.validateMic()) {
Settings.microphone = micCombo.currentText;
Settings.camera = cameraCombo.currentText;
CallManager.sendInvite(room.roomId, CallType.VIDEO);
CallManager.sendInvite(room.roomId, Voip.VIDEO);
close();
}
}

View file

@ -7,7 +7,7 @@ import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import im.nheko
Popup {
modal: true
@ -132,7 +132,7 @@ Popup {
Settings.screenShareRemoteVideo = remoteVideoCheckBox.checked;
Settings.screenShareHideCursor = hideCursorCheckBox.checked;
CallManager.sendInvite(room.roomId, CallType.SCREEN, windowCombo.currentIndex);
CallManager.sendInvite(room.roomId, Voip.SCREEN, windowCombo.currentIndex);
close();
}
}

View file

@ -6,6 +6,7 @@
#pragma once
#include <QObject>
#include <QQmlEngine>
#include <map>
#include <mutex>
@ -17,6 +18,8 @@
namespace crypto {
Q_NAMESPACE
QML_NAMED_ELEMENT(Crypto)
//! How much a participant is trusted.
enum Trust
{

View file

@ -6,11 +6,15 @@
#pragma once
#include <QObject>
#include <QQmlEngine>
#include <QString>
class Clipboard : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
public:

View file

@ -23,10 +23,12 @@ ColorImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &)
QColor color(args[1]);
QPixmap colorized = source;
if (!source.isNull()) {
QPainter painter(&colorized);
painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
painter.fillRect(colorized.rect(), color);
painter.end();
}
return colorized;
}

View file

@ -9,10 +9,14 @@
#include <QQmlEngine>
#include <QSharedPointer>
class SingleImagePackModel;
#include "SingleImagePackModel.h"
class ImagePackListModel : public QAbstractListModel
{
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("Needs to be instantiated from C++")
Q_PROPERTY(bool containsAccountPack READ containsAccountPack CONSTANT)
public:
enum Roles

View file

@ -7,6 +7,7 @@
#define INVITEESMODEL_H
#include <QAbstractListModel>
#include <QQmlEngine>
#include <QVector>
class Invitee : public QObject
@ -30,6 +31,8 @@ private:
class InviteesModel : public QAbstractListModel
{
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("Needs to be instantiated from C++")
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)

View file

@ -7,13 +7,10 @@
#pragma once
#include <QObject>
#include <QQmlEngine>
#include <QVariantList>
namespace mtx {
namespace responses {
struct Login;
}
}
#include <mtx/responses/login.hpp>
struct SSOProvider
{
@ -35,6 +32,7 @@ public:
class LoginPage : public QObject
{
Q_OBJECT
QML_NAMED_ELEMENT(Login)
Q_PROPERTY(QString mxid READ mxid WRITE setMxid NOTIFY matrixIdChanged)
Q_PROPERTY(QString homeserver READ homeserver WRITE setHomeserver NOTIFY homeserverChanged)

View file

@ -24,13 +24,11 @@
#include "InviteesModel.h"
#include "JdenticonProvider.h"
#include "Logging.h"
#include "LoginPage.h"
#include "MainWindow.h"
#include "MatrixClient.h"
#include "MemberList.h"
#include "MxcImageProvider.h"
#include "ReadReceiptsModel.h"
#include "RegisterPage.h"
#include "RoomDirectoryModel.h"
#include "RoomsModel.h"
#include "SingleImagePackModel.h"
@ -43,11 +41,6 @@
#include "encryption/DeviceVerificationFlow.h"
#include "encryption/SelfVerificationStatus.h"
#include "timeline/TimelineViewManager.h"
#include "ui/HiddenEvents.h"
#include "ui/MxcAnimatedImage.h"
#include "ui/MxcMediaProxy.h"
#include "ui/NhekoCursorShape.h"
#include "ui/NhekoEventObserver.h"
#include "ui/NhekoGlobalObject.h"
#include "ui/UIA.h"
#include "voip/WebRTCSession.h"
@ -79,7 +72,7 @@ MainWindow::MainWindow(QWindow *parent)
registerQmlTypes();
setColor(Theme::paletteFromTheme(userSettings_->theme()).window().color());
setSource(QUrl(QStringLiteral("qrc:///im/nheko2/qml/Root.qml")));
setSource(QUrl(QStringLiteral("qrc:///im/nheko/qml/Root.qml")));
trayIcon_ = new TrayIcon(QStringLiteral(":/logos/nheko.svg"), this);
@ -126,153 +119,6 @@ MainWindow::MainWindow(QWindow *parent)
void
MainWindow::registerQmlTypes()
{
qRegisterMetaType<mtx::events::msg::KeyVerificationAccept>();
qRegisterMetaType<mtx::events::msg::KeyVerificationCancel>();
qRegisterMetaType<mtx::events::msg::KeyVerificationDone>();
qRegisterMetaType<mtx::events::msg::KeyVerificationKey>();
qRegisterMetaType<mtx::events::msg::KeyVerificationMac>();
qRegisterMetaType<mtx::events::msg::KeyVerificationReady>();
qRegisterMetaType<mtx::events::msg::KeyVerificationRequest>();
qRegisterMetaType<mtx::events::msg::KeyVerificationStart>();
qRegisterMetaType<CombinedImagePackModel *>();
qRegisterMetaType<mtx::events::collections::TimelineEvents>();
qRegisterMetaType<std::vector<DeviceInfo>>();
qRegisterMetaType<std::vector<mtx::responses::PublicRoomsChunk>>();
qmlRegisterUncreatableMetaObject(qml_mtx_events::staticMetaObject,
"im.nheko",
1,
0,
"MtxEvent",
QStringLiteral("Can't instantiate enum!"));
qmlRegisterUncreatableMetaObject(
olm::staticMetaObject, "im.nheko", 1, 0, "Olm", QStringLiteral("Can't instantiate enum!"));
qmlRegisterUncreatableMetaObject(crypto::staticMetaObject,
"im.nheko",
1,
0,
"Crypto",
QStringLiteral("Can't instantiate enum!"));
qmlRegisterUncreatableMetaObject(verification::staticMetaObject,
"im.nheko",
1,
0,
"VerificationStatus",
QStringLiteral("Can't instantiate enum!"));
qmlRegisterType<NhekoCursorShape>("im.nheko", 1, 0, "CursorShape");
qmlRegisterType<NhekoEventObserver>("im.nheko", 1, 0, "EventObserver");
qmlRegisterType<MxcAnimatedImage>("im.nheko", 1, 0, "MxcAnimatedImage");
qmlRegisterType<MxcMediaProxy>("im.nheko", 1, 0, "MxcMedia");
qmlRegisterType<RoomDirectoryModel>("im.nheko", 1, 0, "RoomDirectoryModel");
qmlRegisterType<LoginPage>("im.nheko", 1, 0, "Login");
qmlRegisterType<RegisterPage>("im.nheko", 1, 0, "Registration");
qmlRegisterType<HiddenEvents>("im.nheko", 1, 0, "HiddenEvents");
qmlRegisterUncreatableType<DeviceVerificationFlow>(
"im.nheko",
1,
0,
"DeviceVerificationFlow",
QStringLiteral("Can't create verification flow from QML!"));
qmlRegisterUncreatableType<UserProfile>(
"im.nheko",
1,
0,
"UserProfileModel",
QStringLiteral("UserProfile needs to be instantiated on the C++ side"));
qmlRegisterUncreatableType<MemberList>(
"im.nheko",
1,
0,
"MemberList",
QStringLiteral("MemberList needs to be instantiated on the C++ side"));
qmlRegisterUncreatableType<RoomSettings>(
"im.nheko",
1,
0,
"RoomSettingsModel",
QStringLiteral("Room Settings needs to be instantiated on the C++ side"));
qmlRegisterUncreatableType<TimelineModel>(
"im.nheko", 1, 0, "Room", QStringLiteral("Room needs to be instantiated on the C++ side"));
qmlRegisterUncreatableType<ImagePackListModel>(
"im.nheko",
1,
0,
"ImagePackListModel",
QStringLiteral("ImagePackListModel needs to be instantiated on the C++ side"));
qmlRegisterUncreatableType<SingleImagePackModel>(
"im.nheko",
1,
0,
"SingleImagePackModel",
QStringLiteral("SingleImagePackModel needs to be instantiated on the C++ side"));
qmlRegisterUncreatableType<InviteesModel>(
"im.nheko",
1,
0,
"InviteesModel",
QStringLiteral("InviteesModel needs to be instantiated on the C++ side"));
qmlRegisterUncreatableType<ReadReceiptsProxy>(
"im.nheko",
1,
0,
"ReadReceiptsProxy",
QStringLiteral("ReadReceiptsProxy needs to be instantiated on the C++ side"));
qmlRegisterSingletonType<Clipboard>(
"im.nheko", 1, 0, "Clipboard", [](QQmlEngine *, QJSEngine *) -> QObject * {
return new Clipboard();
});
qmlRegisterSingletonType<Nheko>(
"im.nheko", 1, 0, "Nheko", [](QQmlEngine *, QJSEngine *) -> QObject * {
return new Nheko();
});
qmlRegisterSingletonType<UserSettingsModel>(
"im.nheko", 1, 0, "UserSettingsModel", [](QQmlEngine *, QJSEngine *) -> QObject * {
return new UserSettingsModel();
});
qmlRegisterSingletonInstance("im.nheko", 1, 0, "Settings", userSettings_.data());
qRegisterMetaType<mtx::events::collections::TimelineEvents>();
qRegisterMetaType<std::vector<DeviceInfo>>();
qmlRegisterUncreatableType<FilteredCommunitiesModel>(
"im.nheko",
1,
0,
"FilteredCommunitiesModel",
QStringLiteral("Use Communities.filtered() to create a FilteredCommunitiesModel"));
qmlRegisterType<emoji::EmojiModel>("im.nheko.EmojiModel", 1, 0, "EmojiModel");
qmlRegisterUncreatableType<emoji::Emoji>(
"im.nheko.EmojiModel", 1, 0, "Emoji", QStringLiteral("Used by emoji models"));
qmlRegisterUncreatableType<MediaUpload>(
"im.nheko", 1, 0, "MediaUpload", QStringLiteral("MediaUploads can not be created in Qml"));
qmlRegisterUncreatableMetaObject(emoji::staticMetaObject,
"im.nheko.EmojiModel",
1,
0,
"EmojiCategory",
QStringLiteral("Error: Only enums"));
qmlRegisterType<RoomDirectoryModel>("im.nheko", 1, 0, "RoomDirectoryModel");
qmlRegisterSingletonType<SelfVerificationStatus>(
"im.nheko", 1, 0, "SelfVerificationStatus", [](QQmlEngine *, QJSEngine *) -> QObject * {
auto ptr = new SelfVerificationStatus();
QObject::connect(ChatPage::instance(),
&ChatPage::initializeEmptyViews,
ptr,
&SelfVerificationStatus::invalidate);
return ptr;
});
qmlRegisterSingletonInstance("im.nheko", 1, 0, "MainWindow", this);
qmlRegisterSingletonInstance("im.nheko", 1, 0, "UIA", UIA::instance());
qmlRegisterSingletonInstance(
"im.nheko", 1, 0, "CallManager", ChatPage::instance()->callManager());
imgProvider = new MxcImageProvider();
engine()->addImageProvider(QStringLiteral("MxcImage"), imgProvider);
engine()->addImageProvider(QStringLiteral("colorimage"), new ColorImageProvider());

View file

@ -8,6 +8,7 @@
#include <functional>
#include <QQmlEngine>
#include <QQuickView>
#include <QSharedPointer>
#include <QSystemTrayIcon>
@ -40,11 +41,32 @@ class ReCaptcha;
class MainWindow : public QQuickView
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
public:
explicit MainWindow(QWindow *parent = nullptr);
explicit MainWindow(QWindow *parent);
static MainWindow *instance() { return instance_; }
static MainWindow *create(QQmlEngine *qmlEngine, QJSEngine *)
{
// The instance has to exist before it is used. We cannot replace it.
Q_ASSERT(instance_);
// The engine has to have the same thread affinity as the singleton.
Q_ASSERT(qmlEngine->thread() == instance_->thread());
// There can only be one engine accessing the singleton.
static QJSEngine *s_engine = nullptr;
if (s_engine)
Q_ASSERT(qmlEngine == s_engine);
else
s_engine = qmlEngine;
QJSEngine::setObjectOwnership(instance_, QJSEngine::CppOwnership);
return instance_;
}
void saveCurrentWindowSize();
void openJoinRoomDialog(std::function<void(const QString &room_id)> callback);

View file

@ -7,9 +7,9 @@
#include <QAbstractListModel>
#include <QSortFilterProxyModel>
#include <QQmlEngine>
#include <mtx/events/power_levels.hpp>
#include "CacheStructs.h"
class MemberListBackend : public QAbstractListModel
@ -80,6 +80,8 @@ private:
class MemberList : public QSortFilterProxyModel
{
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("MemberList needs to be instantiated from C++")
Q_PROPERTY(QString roomName READ roomName NOTIFY roomNameChanged)
Q_PROPERTY(int memberCount READ memberCount NOTIFY memberCountChanged)

View file

@ -9,6 +9,7 @@
#include <QAbstractListModel>
#include <QDateTime>
#include <QObject>
#include <QQmlEngine>
#include <QSortFilterProxyModel>
#include <QString>
@ -54,6 +55,8 @@ private:
class ReadReceiptsProxy : public QSortFilterProxyModel
{
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("Needs to be instantiated from C++")
Q_PROPERTY(QString eventId READ eventId CONSTANT)
Q_PROPERTY(QString roomId READ roomId CONSTANT)

View file

@ -7,6 +7,7 @@
#pragma once
#include <QObject>
#include <QQmlEngine>
#include <QString>
#include <mtx/user_interactive.hpp>
@ -15,6 +16,7 @@
class RegisterPage : public QObject
{
Q_OBJECT
QML_NAMED_ELEMENT(Registration)
Q_PROPERTY(QString error READ error NOTIFY errorChanged)
Q_PROPERTY(QString hsError READ hsError NOTIFY hsErrorChanged)

View file

@ -7,6 +7,7 @@
#include <QAbstractListModel>
#include <QHash>
#include <QQmlEngine>
#include <QString>
#include <string>
#include <vector>
@ -27,6 +28,7 @@ struct PublicRooms;
class RoomDirectoryModel : public QAbstractListModel
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(bool loadingMoreRooms READ loadingMoreRooms NOTIFY loadingMoreRoomsChanged)
Q_PROPERTY(

View file

@ -184,8 +184,7 @@ SingleImagePackModel::canEdit() const
if (roomid_.empty())
return true;
else
return Permissions(QString::fromStdString(roomid_))
.canChange(qml_mtx_events::ImagePackInRoom);
return Permissions(QString::fromStdString(roomid_)).canChange(MtxEvent::ImagePackInRoom);
}
void

View file

@ -7,6 +7,7 @@
#include <QAbstractListModel>
#include <QList>
#include <QQmlEngine>
#include <QUrl>
#include <mtx/events/mscs/image_packs.hpp>
@ -16,6 +17,8 @@
class SingleImagePackModel : public QAbstractListModel
{
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("Needs to be instantiated from C++")
Q_PROPERTY(QString roomid READ roomid CONSTANT)
Q_PROPERTY(QString statekey READ statekey WRITE setStatekey NOTIFY statekeyChanged)

Some files were not shown because too many files have changed in this diff Show more