Translations adjustments, trigger history reload earlier

This commit is contained in:
Sebastian J. Wolf 2020-08-30 15:04:15 +02:00
parent d4954e0d7e
commit 0849fadadd
3 changed files with 15 additions and 15 deletions

View file

@ -278,17 +278,17 @@ Page {
function handleScrollPositionChanged() { function handleScrollPositionChanged() {
console.log("Current position: " + chatView.contentY); console.log("Current position: " + chatView.contentY);
tdLibWrapper.viewMessage(chatInformation.id, chatView.itemAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin )).myMessage.id); tdLibWrapper.viewMessage(chatInformation.id, chatView.itemAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin )).myMessage.id);
var indexAtCursor = chatView.indexAt(chatView.contentX, chatView.contentY);
// If the list is at the top or close to the top, the index jumps to the top of the new list
// Before we find a solution, we don't reload at the top... TODO ;)
if (indexAtCursor > 5 && indexAtCursor < 25) {
chatModel.triggerLoadMoreHistory();
}
} }
onContentYChanged: { onContentYChanged: {
chatViewLoadingTimer.stop(); chatViewLoadingTimer.stop();
chatViewLoadingTimer.start(); chatViewLoadingTimer.start();
if (!chatPage.loading) {
if (chatView.indexAt(chatView.contentX, chatView.contentY) < 20) {
console.log("Trying to get older history items...");
chatModel.triggerLoadMoreHistory();
}
}
} }
onMovementEnded: { onMovementEnded: {

View file

@ -59,8 +59,8 @@ void ChatModel::initialize(const QVariantMap &chatInformation)
void ChatModel::triggerLoadMoreHistory() void ChatModel::triggerLoadMoreHistory()
{ {
qDebug() << "[ChatModel] Trigger loading older history...";
if (!this->inIncrementalUpdate) { if (!this->inIncrementalUpdate) {
qDebug() << "[ChatModel] Trigger loading older history...";
this->inIncrementalUpdate = true; this->inIncrementalUpdate = true;
this->tdLibWrapper->getChatHistory(this->chatId, this->messages.first().toMap().value("id").toLongLong()); this->tdLibWrapper->getChatHistory(this->chatId, this->messages.first().toMap().value("id").toLongLong());
} }

View file

@ -170,15 +170,15 @@
</message> </message>
<message> <message>
<source>Waiting for network...</source> <source>Waiting for network...</source>
<translation>Auf Netzwerk warten...</translation> <translation>Warte auf Netzwerk...</translation>
</message> </message>
<message> <message>
<source>Connecting to network...</source> <source>Connecting to network...</source>
<translation>Zum Netzwerk verbinden...</translation> <translation>Verbinde zum Netzwerk...</translation>
</message> </message>
<message> <message>
<source>Connecting to proxy...</source> <source>Connecting to proxy...</source>
<translation>Zum Proxy verbinden...</translation> <translation>Verbinde zum Proxy...</translation>
</message> </message>
<message> <message>
<source>Connected</source> <source>Connected</source>
@ -186,7 +186,7 @@
</message> </message>
<message> <message>
<source>Updating content...</source> <source>Updating content...</source>
<translation>Inhalte aktualisieren...</translation> <translation>Aktualisiere Inhalte...</translation>
</message> </message>
<message> <message>
<source>chat</source> <source>chat</source>
@ -281,19 +281,19 @@
</message> </message>
<message> <message>
<source>Waiting for network...</source> <source>Waiting for network...</source>
<translation>Warten auf Netzwerk...</translation> <translation>Warte auf Netzwerk...</translation>
</message> </message>
<message> <message>
<source>Connecting to network...</source> <source>Connecting to network...</source>
<translation>Zum Netzwerk verbinden...</translation> <translation>Verbinde zum Netzwerk...</translation>
</message> </message>
<message> <message>
<source>Connecting to proxy...</source> <source>Connecting to proxy...</source>
<translation>Zum Proxy verbinden...</translation> <translation>Verbinde zum Proxy...</translation>
</message> </message>
<message> <message>
<source>Updating content...</source> <source>Updating content...</source>
<translation>Inhalte aktualisieren...</translation> <translation>Aktualisiere Inhalte...</translation>
</message> </message>
<message> <message>
<source>Unknown</source> <source>Unknown</source>