diff --git a/asset/font/material.ttf b/assets/font/material.ttf similarity index 100% rename from asset/font/material.ttf rename to assets/font/material.ttf diff --git a/asset/img/avatar.png b/assets/img/avatar.png similarity index 100% rename from asset/img/avatar.png rename to assets/img/avatar.png diff --git a/asset/img/background.jpg b/assets/img/background.jpg similarity index 100% rename from asset/img/background.jpg rename to assets/img/background.jpg diff --git a/asset/img/icon.icns b/assets/img/icon.icns similarity index 100% rename from asset/img/icon.icns rename to assets/img/icon.icns diff --git a/asset/img/icon.ico b/assets/img/icon.ico similarity index 100% rename from asset/img/icon.ico rename to assets/img/icon.ico diff --git a/asset/img/icon.png b/assets/img/icon.png similarity index 100% rename from asset/img/icon.png rename to assets/img/icon.png diff --git a/qml/component/AutoMouseArea.qml b/imports/Spectral/Component/AutoMouseArea.qml similarity index 92% rename from qml/component/AutoMouseArea.qml rename to imports/Spectral/Component/AutoMouseArea.qml index d5e8d10..ceaf84d 100644 --- a/qml/component/AutoMouseArea.qml +++ b/imports/Spectral/Component/AutoMouseArea.qml @@ -1,5 +1,6 @@ import QtQuick 2.9 -import Spectral.Settings 0.1 + +import Spectral.Setting 0.1 MouseArea { signal primaryClicked() diff --git a/qml/component/EmojiButton.qml b/imports/Spectral/Component/Emoji/EmojiButton.qml similarity index 100% rename from qml/component/EmojiButton.qml rename to imports/Spectral/Component/Emoji/EmojiButton.qml diff --git a/qml/component/EmojiPicker.qml b/imports/Spectral/Component/Emoji/EmojiPicker.qml similarity index 99% rename from qml/component/EmojiPicker.qml rename to imports/Spectral/Component/Emoji/EmojiPicker.qml index 120afac..0f85089 100644 --- a/qml/component/EmojiPicker.qml +++ b/imports/Spectral/Component/Emoji/EmojiPicker.qml @@ -2,6 +2,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls.Material 2.2 + import Spectral 0.1 Popup { diff --git a/imports/Spectral/Component/Emoji/qmldir b/imports/Spectral/Component/Emoji/qmldir new file mode 100644 index 0000000..d16a01e --- /dev/null +++ b/imports/Spectral/Component/Emoji/qmldir @@ -0,0 +1,2 @@ +module Spectral.Component.Emoji +EmojiPicker 2.0 EmojiPicker.qml diff --git a/qml/component/MaterialIcon.qml b/imports/Spectral/Component/MaterialIcon.qml similarity index 77% rename from qml/component/MaterialIcon.qml rename to imports/Spectral/Component/MaterialIcon.qml index 2730a2e..5f94994 100644 --- a/qml/component/MaterialIcon.qml +++ b/imports/Spectral/Component/MaterialIcon.qml @@ -1,7 +1,9 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 -import Spectral.Settings 0.1 + +import Spectral.Setting 0.1 +import Spectral.Font 0.1 Text { property alias icon: materialLabel.text @@ -10,7 +12,7 @@ Text { color: MSettings.darkTheme ? "white" : "dark" font.pointSize: 16 - font.family: materialFont.name + font.family: MaterialFont.name horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } diff --git a/qml/component/SideNavButton.qml b/imports/Spectral/Component/SideNavButton.qml similarity index 100% rename from qml/component/SideNavButton.qml rename to imports/Spectral/Component/SideNavButton.qml diff --git a/qml/component/AutoImage.qml b/imports/Spectral/Component/Timeline/AutoImage.qml similarity index 100% rename from qml/component/AutoImage.qml rename to imports/Spectral/Component/Timeline/AutoImage.qml diff --git a/qml/component/AutoLabel.qml b/imports/Spectral/Component/Timeline/AutoLabel.qml similarity index 93% rename from qml/component/AutoLabel.qml rename to imports/Spectral/Component/Timeline/AutoLabel.qml index 94b93cc..4774210 100644 --- a/qml/component/AutoLabel.qml +++ b/imports/Spectral/Component/Timeline/AutoLabel.qml @@ -1,7 +1,8 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.2 -import Spectral.Settings 0.1 + +import Spectral.Setting 0.1 Label { property bool coloredBackground diff --git a/qml/component/DownloadableContent.qml b/imports/Spectral/Component/Timeline/DownloadableContent.qml similarity index 100% rename from qml/component/DownloadableContent.qml rename to imports/Spectral/Component/Timeline/DownloadableContent.qml diff --git a/qml/component/GenericBubble.qml b/imports/Spectral/Component/Timeline/GenericBubble.qml similarity index 90% rename from qml/component/GenericBubble.qml rename to imports/Spectral/Component/Timeline/GenericBubble.qml index 1c27157..ae778a3 100644 --- a/qml/component/GenericBubble.qml +++ b/imports/Spectral/Component/Timeline/GenericBubble.qml @@ -1,7 +1,11 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.2 -import Spectral.Settings 0.1 + +import Spectral.Component 2.0 +import Spectral.Effect 2.0 + +import Spectral.Setting 0.1 Control { property bool highlighted: false diff --git a/qml/component/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml similarity index 99% rename from qml/component/MessageDelegate.qml rename to imports/Spectral/Component/Timeline/MessageDelegate.qml index af1d231..b38bc1f 100644 --- a/qml/component/MessageDelegate.qml +++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml @@ -2,8 +2,10 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls.Material 2.2 + import Spectral 0.1 -import Spectral.Settings 0.1 +import Spectral.Setting 0.1 + import "qrc:/js/util.js" as Util RowLayout { diff --git a/qml/component/StateDelegate.qml b/imports/Spectral/Component/Timeline/StateDelegate.qml similarity index 94% rename from qml/component/StateDelegate.qml rename to imports/Spectral/Component/Timeline/StateDelegate.qml index 809505b..ab7272b 100644 --- a/qml/component/StateDelegate.qml +++ b/imports/Spectral/Component/Timeline/StateDelegate.qml @@ -2,7 +2,8 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls.Material 2.2 -import Spectral.Settings 0.1 + +import Spectral.Setting 0.1 Label { Layout.alignment: Qt.AlignHCenter diff --git a/imports/Spectral/Component/Timeline/qmldir b/imports/Spectral/Component/Timeline/qmldir new file mode 100644 index 0000000..815bdd5 --- /dev/null +++ b/imports/Spectral/Component/Timeline/qmldir @@ -0,0 +1,4 @@ +module Spectral.Component.Timeline +MessageDelegate 2.0 MessageDelegate.qml +StateDelegate 2.0 StateDelegate.qml + diff --git a/imports/Spectral/Component/qmldir b/imports/Spectral/Component/qmldir new file mode 100644 index 0000000..09541c6 --- /dev/null +++ b/imports/Spectral/Component/qmldir @@ -0,0 +1,4 @@ +module Spectral.Component +AutoMouseArea 2.0 AutoMouseArea.qml +MaterialIcon 2.0 MaterialIcon.qml +SideNavButton 2.0 SideNavButton.qml diff --git a/qml/component/ElevationEffect.qml b/imports/Spectral/Effect/ElevationEffect.qml similarity index 100% rename from qml/component/ElevationEffect.qml rename to imports/Spectral/Effect/ElevationEffect.qml diff --git a/imports/Spectral/Effect/qmldir b/imports/Spectral/Effect/qmldir new file mode 100644 index 0000000..b4c470e --- /dev/null +++ b/imports/Spectral/Effect/qmldir @@ -0,0 +1,2 @@ +module Spectral.Effect +ElevationEffect 2.0 ElevationEffect.qml diff --git a/imports/Spectral/Font/MaterialFont.qml b/imports/Spectral/Font/MaterialFont.qml new file mode 100644 index 0000000..312fe23 --- /dev/null +++ b/imports/Spectral/Font/MaterialFont.qml @@ -0,0 +1,6 @@ +pragma Singleton +import QtQuick 2.9 + +FontLoader { + source: "qrc:/assets/font/material.ttf" +} diff --git a/qml/component/RoomDrawer.qml b/imports/Spectral/Form/RoomDrawer.qml similarity index 99% rename from qml/component/RoomDrawer.qml rename to imports/Spectral/Form/RoomDrawer.qml index d4f40a0..a63bd09 100644 --- a/qml/component/RoomDrawer.qml +++ b/imports/Spectral/Form/RoomDrawer.qml @@ -2,6 +2,9 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.2 import QtQuick.Layouts 1.3 + +import Spectral.Component 2.0 + import Spectral 0.1 import "qrc:/js/util.js" as Util diff --git a/qml/form/RoomForm.qml b/imports/Spectral/Form/RoomForm.qml similarity index 97% rename from qml/form/RoomForm.qml rename to imports/Spectral/Form/RoomForm.qml index 0ace76f..feca2e0 100644 --- a/qml/form/RoomForm.qml +++ b/imports/Spectral/Form/RoomForm.qml @@ -2,12 +2,17 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls.Material 2.2 + +import Spectral.Component 2.0 +import Spectral.Component.Emoji 2.0 +import Spectral.Component.Timeline 2.0 +import Spectral.Menu 2.0 +import Spectral.Effect 2.0 + import Spectral 0.1 -import Spectral.Settings 0.1 +import Spectral.Setting 0.1 import SortFilterProxyModel 0.2 -import "../component" -import "../menu" import "qrc:/js/md.js" as Markdown import "qrc:/js/util.js" as Util @@ -122,19 +127,14 @@ Item { spacing: 8 cacheBuffer: 200 - flickDeceleration: 4096 boundsBehavior: Flickable.DragOverBounds property int largestVisibleIndex: count > 0 ? indexAt(contentX, contentY + height - 1) : -1 onContentYChanged: { - // Check whether we're about to bump into the ceiling in 2 seconds - var curVelocity = verticalVelocity // Snapshot the current speed - if(curVelocity < 0 && contentY - 5000 < originY) - { + if(verticalVelocity < 0 && contentY - 5000 < originY) currentRoom.getPreviousContent(50); - } } onMovementEnded: currentRoom.saveViewport(sortedMessageEventModel.mapToSource(indexAt(contentX, contentY)), sortedMessageEventModel.mapToSource(largestVisibleIndex)) @@ -167,7 +167,7 @@ Item { messageListView.currentIndex = lastScrollPosition } if (messageListView.contentY < messageListView.originY + 10 || currentRoom.timelineSize === 0) - currentRoom.getPreviousContent(50) + currentRoom.getPreviousContent(100) } console.log("Model timeline reset") } diff --git a/qml/form/RoomListForm.qml b/imports/Spectral/Form/RoomListForm.qml similarity index 98% rename from qml/form/RoomListForm.qml rename to imports/Spectral/Form/RoomListForm.qml index f290d6e..723df91 100644 --- a/qml/form/RoomListForm.qml +++ b/imports/Spectral/Form/RoomListForm.qml @@ -4,12 +4,15 @@ import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import QtQuick.Controls.Material 2.2 import QtQml.Models 2.3 -import Spectral 0.1 -import SortFilterProxyModel 0.2 -import Spectral.Settings 0.1 -import "../component" -import "../menu" +import Spectral.Component 2.0 +import Spectral.Menu 2.0 +import Spectral.Effect 2.0 + +import Spectral 0.1 +import Spectral.Setting 0.1 +import SortFilterProxyModel 0.2 + import "qrc:/js/util.js" as Util Rectangle { diff --git a/imports/Spectral/Form/qmldir b/imports/Spectral/Form/qmldir new file mode 100644 index 0000000..b02e012 --- /dev/null +++ b/imports/Spectral/Form/qmldir @@ -0,0 +1,4 @@ +module Spectral.Form +RoomForm 2.0 RoomForm.qml +RoomListForm 2.0 RoomListForm.qml + diff --git a/qml/menu/MessageContextMenu.qml b/imports/Spectral/Menu/MessageContextMenu.qml similarity index 100% rename from qml/menu/MessageContextMenu.qml rename to imports/Spectral/Menu/MessageContextMenu.qml diff --git a/qml/menu/RoomContextMenu.qml b/imports/Spectral/Menu/RoomContextMenu.qml similarity index 100% rename from qml/menu/RoomContextMenu.qml rename to imports/Spectral/Menu/RoomContextMenu.qml diff --git a/imports/Spectral/Menu/qmldir b/imports/Spectral/Menu/qmldir new file mode 100644 index 0000000..031159a --- /dev/null +++ b/imports/Spectral/Menu/qmldir @@ -0,0 +1,4 @@ +module Spectral.Menu +MessageContextMenu 2.0 MessageContextMenu.qml +RoomContextMenu 2.0 RoomContextMenu.qml + diff --git a/qml/Login.qml b/imports/Spectral/Page/Login.qml similarity index 97% rename from qml/Login.qml rename to imports/Spectral/Page/Login.qml index 5efad37..85c83b2 100644 --- a/qml/Login.qml +++ b/imports/Spectral/Page/Login.qml @@ -3,10 +3,10 @@ import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.2 -import Qt.labs.settings 1.0 -import Spectral.Settings 0.1 -import "component" +import Spectral.Component 2.0 + +import Spectral.Setting 0.1 Page { property var controller @@ -22,7 +22,7 @@ Page { Image { id: background anchors.fill: parent - source: "qrc:/asset/img/background.jpg" + source: "qrc:/assets/img/background.jpg" fillMode: Image.PreserveAspectCrop cache: false } diff --git a/qml/Room.qml b/imports/Spectral/Page/Room.qml similarity index 90% rename from qml/Room.qml rename to imports/Spectral/Page/Room.qml index 99494a5..dc7b5a7 100644 --- a/qml/Room.qml +++ b/imports/Spectral/Page/Room.qml @@ -2,11 +2,13 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls.Material 2.2 -import Spectral 0.1 -import Spectral.Settings 0.1 -import "form" -import "component" +import Spectral.Form 2.0 +import Spectral.Component 2.0 +import Spectral.Effect 2.0 + +import Spectral 0.1 +import Spectral.Setting 0.1 Page { property alias connection: roomListModel.connection diff --git a/qml/Setting.qml b/imports/Spectral/Page/Setting.qml similarity index 98% rename from qml/Setting.qml rename to imports/Spectral/Page/Setting.qml index fb11a9f..c2523e6 100644 --- a/qml/Setting.qml +++ b/imports/Spectral/Page/Setting.qml @@ -2,11 +2,13 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.2 import QtQuick.Layouts 1.3 -import Spectral 0.1 -import Spectral.Settings 0.1 -import "component" -import "form" +import Spectral.Component 2.0 +import Spectral.Effect 2.0 + +import Spectral 0.1 +import Spectral.Setting 0.1 + import "qrc:/js/util.js" as Util Page { @@ -227,7 +229,7 @@ Page { Layout.preferredWidth: 64 Layout.preferredHeight: 64 - source: "qrc:/asset/img/icon.png" + source: "qrc:/assets/img/icon.png" } Label { text: "Spectral, an IM client for the Matrix protocol." } Label { text: "Released under GNU General Public License, version 3." } diff --git a/imports/Spectral/Page/qmldir b/imports/Spectral/Page/qmldir new file mode 100644 index 0000000..4ebdb69 --- /dev/null +++ b/imports/Spectral/Page/qmldir @@ -0,0 +1,5 @@ +module Spectral.Page +Login 2.0 Login.qml +Room 2.0 Room.qml +Setting 2.0 Setting.qml + diff --git a/qml/SpectralSettings.qml b/imports/Spectral/Setting/Setting.qml similarity index 100% rename from qml/SpectralSettings.qml rename to imports/Spectral/Setting/Setting.qml diff --git a/qml/main.qml b/qml/main.qml index 69b0b2f..b654309 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -3,12 +3,13 @@ import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls.Material 2.2 import Qt.labs.settings 1.0 -import QtGraphicalEffects 1.0 -import Spectral 0.1 -import Spectral.Settings 0.1 -import "component" -import "form" +import Spectral.Component 2.0 +import Spectral.Page 2.0 + +import Spectral 0.1 +import Spectral.Setting 0.1 + import "qrc:/js/util.js" as Util ApplicationWindow { @@ -28,8 +29,6 @@ ApplicationWindow { Material.accent: spectralController.color(currentConnection ? currentConnection.localUserId : "") - FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" } - Controller { id: spectralController diff --git a/res.qrc b/res.qrc index 0289272..6841644 100644 --- a/res.qrc +++ b/res.qrc @@ -1,35 +1,43 @@ qtquickcontrols2.conf - asset/img/avatar.png - asset/img/background.jpg - asset/font/material.ttf - qml/Login.qml qml/main.qml - qml/form/RoomForm.qml - qml/Room.qml - qml/component/SideNavButton.qml - qml/component/MaterialIcon.qml - asset/img/icon.png js/md.js - qml/component/MessageDelegate.qml - qml/component/DownloadableContent.qml - qml/form/RoomListForm.qml - qml/Setting.qml - qml/component/EmojiPicker.qml - qml/component/EmojiButton.qml - qml/component/AutoImage.qml - asset/img/icon.ico - asset/img/icon.icns - qml/component/AutoMouseArea.qml - qml/SpectralSettings.qml - qml/menu/MessageContextMenu.qml - qml/menu/RoomContextMenu.qml - qml/component/GenericBubble.qml - qml/component/StateDelegate.qml - qml/component/AutoLabel.qml - qml/component/RoomDrawer.qml js/util.js - qml/component/ElevationEffect.qml + imports/Spectral/Component/Emoji/EmojiButton.qml + imports/Spectral/Component/Emoji/EmojiPicker.qml + imports/Spectral/Component/Emoji/qmldir + imports/Spectral/Component/Timeline/AutoImage.qml + imports/Spectral/Component/Timeline/AutoLabel.qml + imports/Spectral/Component/Timeline/DownloadableContent.qml + imports/Spectral/Component/Timeline/GenericBubble.qml + imports/Spectral/Component/Timeline/MessageDelegate.qml + imports/Spectral/Component/Timeline/qmldir + imports/Spectral/Component/Timeline/StateDelegate.qml + imports/Spectral/Component/AutoMouseArea.qml + imports/Spectral/Component/MaterialIcon.qml + imports/Spectral/Component/qmldir + imports/Spectral/Component/SideNavButton.qml + imports/Spectral/Effect/ElevationEffect.qml + imports/Spectral/Effect/qmldir + imports/Spectral/Form/qmldir + imports/Spectral/Form/RoomDrawer.qml + imports/Spectral/Form/RoomForm.qml + imports/Spectral/Form/RoomListForm.qml + imports/Spectral/Menu/MessageContextMenu.qml + imports/Spectral/Menu/qmldir + imports/Spectral/Menu/RoomContextMenu.qml + imports/Spectral/Page/Login.qml + imports/Spectral/Page/qmldir + imports/Spectral/Page/Room.qml + imports/Spectral/Page/Setting.qml + assets/font/material.ttf + assets/img/avatar.png + assets/img/background.jpg + assets/img/icon.icns + assets/img/icon.ico + assets/img/icon.png + imports/Spectral/Setting/Setting.qml + imports/Spectral/Font/MaterialFont.qml diff --git a/spectral.pro b/spectral.pro index 183061d..651143a 100644 --- a/spectral.pro +++ b/spectral.pro @@ -39,26 +39,26 @@ DEFINES += QT_DEPRECATED_WARNINGS # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 -SOURCES += $$PWD/src/main.cpp \ - $$PWD/src/controller.cpp \ - $$PWD/src/roomlistmodel.cpp \ - $$PWD/src/imageprovider.cpp \ - $$PWD/src/messageeventmodel.cpp \ - $$PWD/src/emojimodel.cpp \ - $$PWD/src/spectralroom.cpp \ - $$PWD/src/userlistmodel.cpp \ - $$PWD/src/imageitem.cpp \ - $$PWD/src/accountlistmodel.cpp \ - $$PWD/src/spectraluser.cpp +SOURCES += src/main.cpp \ + src/controller.cpp \ + src/roomlistmodel.cpp \ + src/imageprovider.cpp \ + src/messageeventmodel.cpp \ + src/emojimodel.cpp \ + src/spectralroom.cpp \ + src/userlistmodel.cpp \ + src/imageitem.cpp \ + src/accountlistmodel.cpp \ + src/spectraluser.cpp RESOURCES += \ res.qrc # Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = +QML_IMPORT_PATH += imports/ # Additional import path used to resolve QML modules just for Qt Quick Designer -QML_DESIGNER_IMPORT_PATH = +QML_DESIGNER_IMPORT_PATH += imports/ # Default rules for deployment. unix:!mac:isEmpty(PREFIX) { @@ -80,11 +80,11 @@ unix:!mac { } win32 { - RC_ICONS = asset/img/icon.ico + RC_ICONS = assets/img/icon.ico } mac { - ICON = asset/img/icon.icns + ICON = assets/img/icon.icns } HEADERS += \ diff --git a/src/controller.cpp b/src/controller.cpp index f008085..646a06a 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -27,7 +27,7 @@ #include Controller::Controller(QObject* parent) : QObject(parent) { - tray->setIcon(QIcon(":/asset/img/icon.png")); + tray->setIcon(QIcon(":/assets/img/icon.png")); tray->setToolTip("Spectral"); connect(tray, &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason r) { diff --git a/src/main.cpp b/src/main.cpp index 06b16fe..5a165ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,10 +8,10 @@ #include "emojimodel.h" #include "imageitem.h" #include "imageprovider.h" -#include "spectralroom.h" #include "messageeventmodel.h" #include "room.h" #include "roomlistmodel.h" +#include "spectralroom.h" #include "userlistmodel.h" #include "csapi/joining.h" @@ -47,11 +47,18 @@ int main(int argc, char *argv[]) { qmlRegisterUncreatableType("Spectral", 0, 1, "RoomMessageEvent", "ENUM"); qmlRegisterUncreatableType("Spectral", 0, 1, "RoomType", "ENUM"); - qmlRegisterSingletonType(QUrl("qrc:/qml/SpectralSettings.qml"), - "Spectral.Settings", 0, 1, "MSettings"); + + qmlRegisterSingletonType(QUrl("qrc:/imports/Spectral/Setting/Setting.qml"), + "Spectral.Setting", 0, 1, "MSettings"); + qmlRegisterSingletonType( + QUrl("qrc:/imports/Spectral/Font/MaterialFont.qml"), "Spectral.Font", + 0, 1, "MaterialFont"); + qmlRegisterModule("qrc:/qml/component", 2, 0); QQmlApplicationEngine engine; + engine.addImportPath("qrc:/imports"); + ImageProvider *m_provider = new ImageProvider(); engine.rootContext()->setContextProperty("imageProvider", m_provider); diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp index 446c9f4..800a4a6 100644 --- a/src/messageeventmodel.cpp +++ b/src/messageeventmodel.cpp @@ -87,10 +87,12 @@ void MessageEventModel::setRoom(SpectralRoom* room) { {AboveEventTypeRole, AboveAuthorRole, AboveSectionRole, AboveTimeRole}); } + for (auto i = m_currentRoom->maxTimelineIndex() - biggest; i <= m_currentRoom->maxTimelineIndex() - lowest; ++i) refreshLastUserEvents(i); - }); + }, + Qt::QueuedConnection); connect(m_currentRoom, &Room::pendingEventAboutToAdd, this, [this] { beginInsertRows({}, 0, 0); }); connect(m_currentRoom, &Room::pendingEventAdded, this,