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

View file

@ -90,6 +90,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren
handlers.insert("updateChatNotificationSettings", &TDLibReceiver::processUpdateChatNotificationSettings); handlers.insert("updateChatNotificationSettings", &TDLibReceiver::processUpdateChatNotificationSettings);
handlers.insert("updateMessageContent", &TDLibReceiver::processUpdateMessageContent); handlers.insert("updateMessageContent", &TDLibReceiver::processUpdateMessageContent);
handlers.insert("updateDeleteMessages", &TDLibReceiver::processUpdateDeleteMessages); handlers.insert("updateDeleteMessages", &TDLibReceiver::processUpdateDeleteMessages);
handlers.insert("chats", &TDLibReceiver::processChats);
} }
void TDLibReceiver::setActive(const bool &active) void TDLibReceiver::setActive(const bool &active)
@ -353,3 +354,8 @@ void TDLibReceiver::processUpdateDeleteMessages(const QVariantMap &receivedInfor
LOG("Some messages were deleted " << chatId); LOG("Some messages were deleted " << chatId);
emit messagesDeleted(chatId, messageIds); 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 chatNotificationSettingsUpdated(const QString &chatId, const QVariantMap updatedChatNotificationSettings);
void messageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent); void messageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent);
void messagesDeleted(const QString &chatId, const QVariantList &messageIds); void messagesDeleted(const QString &chatId, const QVariantList &messageIds);
void chats(const QVariantMap &chats);
private: private:
typedef void (TDLibReceiver::*Handler)(const QVariantMap &); typedef void (TDLibReceiver::*Handler)(const QVariantMap &);
@ -101,6 +102,7 @@ private:
void processUpdateChatNotificationSettings(const QVariantMap &receivedInformation); void processUpdateChatNotificationSettings(const QVariantMap &receivedInformation);
void processUpdateMessageContent(const QVariantMap &receivedInformation); void processUpdateMessageContent(const QVariantMap &receivedInformation);
void processUpdateDeleteMessages(const QVariantMap &receivedInformation); void processUpdateDeleteMessages(const QVariantMap &receivedInformation);
void processChats(const QVariantMap &receivedInformation);
}; };
#endif // TDLIBRECEIVER_H #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(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(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(messagesDeleted(QString, QVariantList)), this, SLOT(handleMessagesDeleted(QString, QVariantList)));
connect(this->tdLibReceiver, SIGNAL(chats(QVariantMap)), this, SLOT(handleChats(QVariantMap)));
this->tdLibReceiver->start(); this->tdLibReceiver->start();
@ -724,6 +725,11 @@ void TDLibWrapper::handleMessagesDeleted(const QString &chatId, const QVariantLi
emit messagesDeleted(chatId, messageIds); emit messagesDeleted(chatId, messageIds);
} }
void TDLibWrapper::handleChats(const QVariantMap &chats)
{
emit this->chatsReceived(chats);
}
void TDLibWrapper::setInitialParameters() void TDLibWrapper::setInitialParameters()
{ {
qDebug() << "[TDLibWrapper] Sending initial parameters to TD Lib"; qDebug() << "[TDLibWrapper] Sending initial parameters to TD Lib";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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