Create a common MessageModel and inherit SearchModel and MessageEventModel from it.

Title
This commit is contained in:
James Graham
2024-12-28 13:32:26 +00:00
parent 4f02472421
commit 6e4973cef7
23 changed files with 1049 additions and 1070 deletions

View File

@@ -80,16 +80,16 @@ QQC2.ScrollView {
running: messageListView.atYBeginning
triggeredOnStart: true
onTriggered: {
if (messageListView.atYBeginning && root.timelineModel.messageEventModel.canFetchMore(root.timelineModel.index(0, 0))) {
root.timelineModel.messageEventModel.fetchMore(root.timelineModel.index(0, 0));
if (messageListView.atYBeginning && root.timelineModel.timelineMessageModel.canFetchMore(root.timelineModel.index(0, 0))) {
root.timelineModel.timelineMessageModel.fetchMore(root.timelineModel.index(0, 0));
}
}
repeat: true
}
// HACK: The view should do this automatically but doesn't.
onAtYBeginningChanged: if (atYBeginning && root.timelineModel.messageEventModel.canFetchMore(root.timelineModel.index(0, 0))) {
root.timelineModel.messageEventModel.fetchMore(root.timelineModel.index(0, 0));
onAtYBeginningChanged: if (atYBeginning && root.timelineModel.timelineMessageModel.canFetchMore(root.timelineModel.index(0, 0))) {
root.timelineModel.timelineMessageModel.fetchMore(root.timelineModel.index(0, 0));
}
Timer {
@@ -325,7 +325,7 @@ QQC2.ScrollView {
}
function eventToIndex(eventID) {
const index = root.timelineModel.messageEventModel.eventIdToRow(eventID);
const index = root.timelineModel.timelineMessageModel.eventIdToRow(eventID);
if (index === -1)
return -1;
return root.messageFilterModel.mapFromSource(root.timelineModel.index(index, 0)).row;