Faster infinite scroll.
This commit is contained in:
parent
7ad988df4a
commit
57f04cf308
|
@ -111,7 +111,6 @@ Item {
|
||||||
displayMarginEnd: 40
|
displayMarginEnd: 40
|
||||||
verticalLayoutDirection: ListView.BottomToTop
|
verticalLayoutDirection: ListView.BottomToTop
|
||||||
spacing: 8
|
spacing: 8
|
||||||
cacheBuffer: 200
|
|
||||||
|
|
||||||
flickDeceleration: 4096
|
flickDeceleration: 4096
|
||||||
|
|
||||||
|
@ -126,17 +125,18 @@ Item {
|
||||||
{
|
{
|
||||||
// Request the amount of messages enough to scroll at this
|
// Request the amount of messages enough to scroll at this
|
||||||
// rate for 3 more seconds
|
// rate for 3 more seconds
|
||||||
var avgHeight = contentHeight / count
|
currentRoom.getPreviousContent(20);
|
||||||
currentRoom.getPreviousContent(-curVelocity*3 / avgHeight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMovementEnded: currentRoom.saveViewport(sortedMessageEventModel.mapToSource(indexAt(contentX, contentY)), sortedMessageEventModel.mapToSource(largestVisibleIndex))
|
onMovementEnded: currentRoom.saveViewport(sortedMessageEventModel.mapToSource(indexAt(contentX, contentY)), sortedMessageEventModel.mapToSource(largestVisibleIndex))
|
||||||
|
|
||||||
displaced: Transition { NumberAnimation {
|
displaced: Transition {
|
||||||
|
NumberAnimation {
|
||||||
property: "y"; duration: 200
|
property: "y"; duration: 200
|
||||||
easing.type: Easing.OutQuad
|
easing.type: Easing.OutQuad
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
model: SortFilterProxyModel {
|
model: SortFilterProxyModel {
|
||||||
id: sortedMessageEventModel
|
id: sortedMessageEventModel
|
||||||
|
|
|
@ -210,15 +210,11 @@ QDateTime MessageEventModel::makeMessageTimestamp(
|
||||||
|
|
||||||
QString MessageEventModel::renderDate(QDateTime timestamp) const {
|
QString MessageEventModel::renderDate(QDateTime timestamp) const {
|
||||||
auto date = timestamp.toLocalTime().date();
|
auto date = timestamp.toLocalTime().date();
|
||||||
if (QMatrixClient::SettingsGroup("UI")
|
if (date == QDate::currentDate()) return tr("Today");
|
||||||
.value("banner_human_friendly_date", true)
|
if (date == QDate::currentDate().addDays(-1)) return tr("Yesterday");
|
||||||
.toBool()) {
|
if (date == QDate::currentDate().addDays(-2))
|
||||||
if (date == QDate::currentDate()) return tr("Today");
|
return tr("The day before yesterday");
|
||||||
if (date == QDate::currentDate().addDays(-1)) return tr("Yesterday");
|
if (date > QDate::currentDate().addDays(-7)) return date.toString("dddd");
|
||||||
if (date == QDate::currentDate().addDays(-2))
|
|
||||||
return tr("The day before yesterday");
|
|
||||||
if (date > QDate::currentDate().addDays(-7)) return date.toString("dddd");
|
|
||||||
}
|
|
||||||
return date.toString(Qt::DefaultLocaleShortDate);
|
return date.toString(Qt::DefaultLocaleShortDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +330,7 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
|
||||||
|
|
||||||
if (e.hasTextContent() && e.mimeType().name() != "text/plain") {
|
if (e.hasTextContent() && e.mimeType().name() != "text/plain") {
|
||||||
static const QRegExp userPillRegExp(
|
static const QRegExp userPillRegExp(
|
||||||
"<a href=\"https://matrix.to/#/@.*:.*\">(.*)</a>");
|
"<a href =\"https://matrix.to/#/@.*:.*\">(.*)</a>");
|
||||||
QString formattedStr(
|
QString formattedStr(
|
||||||
static_cast<const TextContent*>(e.content())->body);
|
static_cast<const TextContent*>(e.content())->body);
|
||||||
formattedStr.replace(userPillRegExp,
|
formattedStr.replace(userPillRegExp,
|
||||||
|
@ -504,13 +500,11 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
|
||||||
if (is<RedactionEvent>(evt)) return EventStatus::Hidden;
|
if (is<RedactionEvent>(evt)) return EventStatus::Hidden;
|
||||||
auto* memberEvent = timelineIt->viewAs<RoomMemberEvent>();
|
auto* memberEvent = timelineIt->viewAs<RoomMemberEvent>();
|
||||||
if (memberEvent) {
|
if (memberEvent) {
|
||||||
if ((memberEvent->isJoin() || memberEvent->isLeave()) &&
|
if ((memberEvent->isJoin() || memberEvent->isLeave()))
|
||||||
!Settings().value("UI/show_joinleave", true).toBool())
|
|
||||||
return EventStatus::Hidden;
|
return EventStatus::Hidden;
|
||||||
}
|
}
|
||||||
if (memberEvent || evt.isRedacted()) {
|
if (memberEvent || evt.isRedacted()) {
|
||||||
if (evt.senderId() == m_currentRoom->localUser()->id() ||
|
if (evt.senderId() == m_currentRoom->localUser()->id()) {
|
||||||
Settings().value("UI/show_spammy").toBool()) {
|
|
||||||
// QElapsedTimer et; et.start();
|
// QElapsedTimer et; et.start();
|
||||||
auto hide = !isUserActivityNotable(timelineIt);
|
auto hide = !isUserActivityNotable(timelineIt);
|
||||||
// qDebug() << "Checked user activity for" << evt.id() <<
|
// qDebug() << "Checked user activity for" << evt.id() <<
|
||||||
|
@ -518,14 +512,10 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
|
||||||
if (hide) return EventStatus::Hidden;
|
if (hide) return EventStatus::Hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (evt.isRedacted())
|
if (evt.isRedacted()) return EventStatus::Redacted;
|
||||||
return Settings().value("UI/show_redacted").toBool()
|
|
||||||
? EventStatus::Redacted
|
|
||||||
: EventStatus::Hidden;
|
|
||||||
|
|
||||||
if (evt.isStateEvent() &&
|
if (evt.isStateEvent() &&
|
||||||
static_cast<const StateEventBase&>(evt).repeatsState() &&
|
static_cast<const StateEventBase&>(evt).repeatsState())
|
||||||
!Settings().value("UI/show_noop_events").toBool())
|
|
||||||
return EventStatus::Hidden;
|
return EventStatus::Hidden;
|
||||||
|
|
||||||
return EventStatus::Normal;
|
return EventStatus::Normal;
|
||||||
|
|
Loading…
Reference in New Issue