1. Merged "Loading Chat Lists" and "Logging Out" BusyIndicator to one

2. Use QT in-built API to get the application storage location rather than
hardcoding the path when clearing tdlib files
This commit is contained in:
Santhosh Manikandan S 2021-01-14 23:07:09 +05:30
parent de9112cc8a
commit f471ef2683
2 changed files with 6 additions and 26 deletions

View file

@ -162,6 +162,7 @@ Page {
} }
break; break;
case TelegramAPI.AuthorizationReady: case TelegramAPI.AuthorizationReady:
loadingBusyIndicator.text = qsTr("Loading chat list...");
overviewPage.loading = false; overviewPage.loading = false;
overviewPage.initializationCompleted = true; overviewPage.initializationCompleted = true;
overviewPage.updateContent(); overviewPage.updateContent();
@ -176,6 +177,7 @@ Page {
overviewPage.loading = false; overviewPage.loading = false;
chatListCreatedTimer.stop(); chatListCreatedTimer.stop();
updateSecondaryContentTimer.stop(); updateSecondaryContentTimer.stop();
loadingBusyIndicator.text = qsTr("Logging out")
overviewPage.logoutLoading = true; overviewPage.logoutLoading = true;
chatListModel.reset(); chatListModel.reset();
break; break;
@ -368,34 +370,12 @@ Page {
spacing: Theme.paddingMedium spacing: Theme.paddingMedium
anchors.verticalCenter: chatListView.verticalCenter anchors.verticalCenter: chatListView.verticalCenter
opacity: overviewPage.chatListCreated ? 0 : 1 opacity: overviewPage.chatListCreated && !overviewPage.logoutLoading ? 0 : 1
Behavior on opacity { FadeAnimation {} } Behavior on opacity { FadeAnimation {} }
visible: !overviewPage.chatListCreated && !overviewPage.logoutLoading visible: !overviewPage.chatListCreated || overviewPage.logoutLoading
InfoLabel {
id: loadingLabel
text: qsTr("Loading chat list...")
}
BusyIndicator {
id: loadingBusyIndicator
anchors.horizontalCenter: parent.horizontalCenter
running: !overviewPage.chatListCreated
size: BusyIndicatorSize.Large
}
}
Column {
width: parent.width
spacing: Theme.paddingMedium
anchors.verticalCenter: chatListView.verticalCenter
opacity: overviewPage.logoutLoading ? 1 : 0
Behavior on opacity { FadeAnimation {} }
visible: overviewPage.logoutLoading
BusyLabel { BusyLabel {
text: qsTr("Logging out") id: loadingBusyIndicator
running: true running: true
} }
} }

View file

@ -1300,7 +1300,7 @@ void TDLibWrapper::handleAuthorizationStateChanged(const QString &authorizationS
} }
td_json_client_destroy(this->tdLibClient); td_json_client_destroy(this->tdLibClient);
this->tdLibReceiver->terminate(); this->tdLibReceiver->terminate();
QDir appPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.local/share/harbour-fernschreiber"); QDir appPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
appPath.removeRecursively(); appPath.removeRecursively();
this->tdLibClient = td_json_client_create(); this->tdLibClient = td_json_client_create();
initializeTDLibReciever(); initializeTDLibReciever();