From f471ef268375706e30d43816e6d3300527e098eb Mon Sep 17 00:00:00 2001 From: Santhosh Manikandan S Date: Thu, 14 Jan 2021 23:07:09 +0530 Subject: [PATCH] 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 --- qml/pages/OverviewPage.qml | 30 +++++------------------------- src/tdlibwrapper.cpp | 2 +- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 17c4f32..a1435d3 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -162,6 +162,7 @@ Page { } break; case TelegramAPI.AuthorizationReady: + loadingBusyIndicator.text = qsTr("Loading chat list..."); overviewPage.loading = false; overviewPage.initializationCompleted = true; overviewPage.updateContent(); @@ -176,6 +177,7 @@ Page { overviewPage.loading = false; chatListCreatedTimer.stop(); updateSecondaryContentTimer.stop(); + loadingBusyIndicator.text = qsTr("Logging out") overviewPage.logoutLoading = true; chatListModel.reset(); break; @@ -368,34 +370,12 @@ Page { spacing: Theme.paddingMedium anchors.verticalCenter: chatListView.verticalCenter - opacity: overviewPage.chatListCreated ? 0 : 1 + opacity: overviewPage.chatListCreated && !overviewPage.logoutLoading ? 0 : 1 Behavior on opacity { FadeAnimation {} } - 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 + visible: !overviewPage.chatListCreated || overviewPage.logoutLoading BusyLabel { - text: qsTr("Logging out") + id: loadingBusyIndicator running: true } } diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 9ad3a99..577e625 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -1300,7 +1300,7 @@ void TDLibWrapper::handleAuthorizationStateChanged(const QString &authorizationS } td_json_client_destroy(this->tdLibClient); this->tdLibReceiver->terminate(); - QDir appPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.local/share/harbour-fernschreiber"); + QDir appPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); appPath.removeRecursively(); this->tdLibClient = td_json_client_create(); initializeTDLibReciever();