handle empty chat list after registration

also translate some strings from b0d85840 to german
This commit is contained in:
John Gibbon 2020-10-01 12:50:29 +02:00
parent 6c1fc77f0c
commit 3149cb38cb
11 changed files with 55 additions and 5 deletions

View file

@ -147,6 +147,12 @@ Page {
chatListCreatedTimer.start();
}
}
onChatsReceived: {
if(chats && chats.chat_ids && chats.chat_ids.length === 0) {
chatListCreatedTimer.stop();
chatListCreatedTimer.start();
}
}
}
Component.onCompleted: {
@ -210,7 +216,6 @@ Page {
anchors.fill: parent
clip: true
visible: count > 0
opacity: overviewPage.chatListCreated ? 1 : 0
Behavior on opacity { NumberAnimation {} }
@ -419,6 +424,11 @@ Page {
}
ViewPlaceholder {
enabled: chatListView.count === 0
text: qsTr("You don't have any chats yet.")
}
VerticalScrollDecorator {}
}

View file

@ -90,6 +90,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren
handlers.insert("updateChatNotificationSettings", &TDLibReceiver::processUpdateChatNotificationSettings);
handlers.insert("updateMessageContent", &TDLibReceiver::processUpdateMessageContent);
handlers.insert("updateDeleteMessages", &TDLibReceiver::processUpdateDeleteMessages);
handlers.insert("chats", &TDLibReceiver::processChats);
}
void TDLibReceiver::setActive(const bool &active)
@ -353,3 +354,8 @@ void TDLibReceiver::processUpdateDeleteMessages(const QVariantMap &receivedInfor
LOG("Some messages were deleted " << chatId);
emit messagesDeleted(chatId, messageIds);
}
void TDLibReceiver::processChats(const QVariantMap &receivedInformation)
{
emit chats(receivedInformation);
}

View file

@ -63,6 +63,7 @@ signals:
void chatNotificationSettingsUpdated(const QString &chatId, const QVariantMap updatedChatNotificationSettings);
void messageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent);
void messagesDeleted(const QString &chatId, const QVariantList &messageIds);
void chats(const QVariantMap &chats);
private:
typedef void (TDLibReceiver::*Handler)(const QVariantMap &);
@ -101,6 +102,7 @@ private:
void processUpdateChatNotificationSettings(const QVariantMap &receivedInformation);
void processUpdateMessageContent(const QVariantMap &receivedInformation);
void processUpdateDeleteMessages(const QVariantMap &receivedInformation);
void processChats(const QVariantMap &receivedInformation);
};
#endif // TDLIBRECEIVER_H

View file

@ -72,6 +72,7 @@ TDLibWrapper::TDLibWrapper(QObject *parent) : QObject(parent), settings("harbour
connect(this->tdLibReceiver, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SLOT(handleChatNotificationSettingsUpdated(QString, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(messageContentUpdated(QString, QString, QVariantMap)), this, SLOT(handleMessageContentUpdated(QString, QString, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(messagesDeleted(QString, QVariantList)), this, SLOT(handleMessagesDeleted(QString, QVariantList)));
connect(this->tdLibReceiver, SIGNAL(chats(QVariantMap)), this, SLOT(handleChats(QVariantMap)));
this->tdLibReceiver->start();
@ -724,6 +725,11 @@ void TDLibWrapper::handleMessagesDeleted(const QString &chatId, const QVariantLi
emit messagesDeleted(chatId, messageIds);
}
void TDLibWrapper::handleChats(const QVariantMap &chats)
{
emit this->chatsReceived(chats);
}
void TDLibWrapper::setInitialParameters()
{
qDebug() << "[TDLibWrapper] Sending initial parameters to TD Lib";

View file

@ -133,6 +133,7 @@ signals:
void chatNotificationSettingsUpdated(const QString &chatId, const QVariantMap chatNotificationSettings);
void messageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent);
void messagesDeleted(const QString &chatId, const QVariantList &messageIds);
void chatsReceived(const QVariantMap &chats);
public slots:
void handleVersionDetected(const QString &version);
@ -162,6 +163,7 @@ public slots:
void handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings);
void handleMessageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent);
void handleMessagesDeleted(const QString &chatId, const QVariantList &messageIds);
void handleChats(const QVariantMap &chats);
private:
void *tdLibClient;

View file

@ -294,19 +294,19 @@
</message>
<message>
<source>Register User</source>
<translation type="unfinished"></translation>
<translation>Registriere Benutzer</translation>
</message>
<message>
<source>Enter your First Name</source>
<translation type="unfinished"></translation>
<translation>Bitte geben Sie ihren Vornamen ein</translation>
</message>
<message>
<source>Enter your Last Name</source>
<translation type="unfinished"></translation>
<translation>Bitte geben Sie ihren Vornamen ein</translation>
</message>
<message>
<source>User Registration</source>
<translation type="unfinished"></translation>
<translation>Benutzerregistrierung</translation>
</message>
</context>
<context>
@ -417,6 +417,10 @@
<source>Settings</source>
<translation>Einstellungen</translation>
</message>
<message>
<source>You don&apos;t have any chats yet.</source>
<translation>Sie haben noch keine Chats.</translation>
</message>
</context>
<context>
<name>SettingsPage</name>

View file

@ -417,6 +417,10 @@
<source>Settings</source>
<translation>Ajustes</translation>
</message>
<message>
<source>You don&apos;t have any chats yet.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPage</name>

View file

@ -417,6 +417,10 @@
<source>Settings</source>
<translation>Beállítások</translation>
</message>
<message>
<source>You don&apos;t have any chats yet.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPage</name>

View file

@ -417,6 +417,10 @@
<source>Settings</source>
<translation>Ustawienia</translation>
</message>
<message>
<source>You don&apos;t have any chats yet.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPage</name>

View file

@ -417,6 +417,10 @@
<source>Settings</source>
<translation></translation>
</message>
<message>
<source>You don&apos;t have any chats yet.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPage</name>

View file

@ -417,6 +417,10 @@
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You don&apos;t have any chats yet.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPage</name>