From 473c60345198f7fb8f40dfb6bd4ebad64813f6c3 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 2 Jan 2021 16:10:01 +0100 Subject: [PATCH] Reorganize title bar, introduce interaction hint --- qml/pages/OverviewPage.qml | 75 ++++++++++++--------- src/appsettings.cpp | 15 +++++ src/appsettings.h | 5 ++ translations/harbour-fernschreiber-de.ts | 4 ++ translations/harbour-fernschreiber-en.ts | 4 ++ translations/harbour-fernschreiber-es.ts | 4 ++ translations/harbour-fernschreiber-fi.ts | 4 ++ translations/harbour-fernschreiber-hu.ts | 4 ++ translations/harbour-fernschreiber-it.ts | 4 ++ translations/harbour-fernschreiber-pl.ts | 4 ++ translations/harbour-fernschreiber-ru.ts | 4 ++ translations/harbour-fernschreiber-sv.ts | 4 ++ translations/harbour-fernschreiber-zh_CN.ts | 4 ++ translations/harbour-fernschreiber.ts | 4 ++ 14 files changed, 109 insertions(+), 30 deletions(-) diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 404f0d3..178bc2c 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -66,6 +66,13 @@ Page { overviewPage.chatListCreated = true; chatListView.scrollToTop(); updateSecondaryContentTimer.start(); + var remainingInteractionHints = appSettings.remainingInteractionHints; + Debug.log("Remaining interaction hints: " + remainingInteractionHints); + if (remainingInteractionHints > 0) { + interactionHintTimer.start(); + titleInteractionHint.visible = true; + appSettings.remainingInteractionHints = remainingInteractionHints - 1; + } } } @@ -164,7 +171,6 @@ Page { if (chatSearchField.text === "") { chatSearchField.visible = false; pageHeader.visible = true; - searchChatButton.visible = overviewPage.connectionState === TelegramAPI.ConnectionReady; } chatSearchField.focus = false; overviewPage.focus = true; @@ -254,43 +260,34 @@ Page { Row { id: headerRow - width: parent.width - Theme.horizontalPageMargin - - GlassItem { - id: pageStatus - width: Theme.itemSizeMedium - height: Theme.itemSizeMedium - color: "red" - falloffRadius: 0.1 - radius: 0.2 - cache: false - } + width: parent.width PageHeader { id: pageHeader title: qsTr("Fernschreiber") - width: visible ? ( parent.width - pageStatus.width - searchChatButton.width ) : 0 + leftMargin: Theme.itemSizeMedium opacity: visible ? 1 : 0 Behavior on opacity { FadeAnimation {} } - } - IconButton { - id: searchChatButton - width: visible ? height : 0 - opacity: visible ? 1 : 0 - Behavior on opacity { NumberAnimation {} } - anchors.verticalCenter: parent.verticalCenter - icon { - source: "image://theme/icon-m-search?" + Theme.highlightColor - asynchronous: true + GlassItem { + id: pageStatus + width: Theme.itemSizeMedium + height: Theme.itemSizeMedium + color: "red" + falloffRadius: 0.1 + radius: 0.2 + cache: false } - visible: overviewPage.connectionState === TelegramAPI.ConnectionReady - onClicked: { - chatSearchField.focus = true; - chatSearchField.visible = true; - pageHeader.visible = false; - searchChatButton.visible = false; + + MouseArea { + anchors.fill: parent + onClicked: { + chatSearchField.focus = true; + chatSearchField.visible = true; + pageHeader.visible = false; + } } + } SearchField { @@ -298,7 +295,7 @@ Page { visible: false opacity: visible ? 1 : 0 Behavior on opacity { FadeAnimation {} } - width: visible ? ( parent.width - pageStatus.width ) : 0 + width: parent.width height: pageHeader.height placeholderText: qsTr("Filter your chats...") canHide: text === "" @@ -372,4 +369,22 @@ Page { } } } + + Timer { + id: interactionHintTimer + running: false + interval: 4000 + onTriggered: { + titleInteractionHint.visible = false; + } + } + + InteractionHintLabel { + id: titleInteractionHint + text: qsTr("Tap on the title bar to filter your chats") + visible: false + Behavior on opacity { FadeAnimation {} } + opacity: visible ? 1 : 0 + } + } diff --git a/src/appsettings.cpp b/src/appsettings.cpp index 0924a42..f71a5dd 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -29,6 +29,7 @@ namespace { const QString KEY_NOTIFICATION_TURNS_DISPLAY_ON("notificationTurnsDisplayOn"); const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback"); const QString KEY_STORAGE_OPTIMIZER("storageOptimizer"); + const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints"); } AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings") @@ -146,3 +147,17 @@ void AppSettings::setStorageOptimizer(bool enable) emit storageOptimizerChanged(); } } + +int AppSettings::remainingInteractionHints() const +{ + return settings.value(KEY_REMAINING_INTERACTION_HINTS, 3).toInt(); +} + +void AppSettings::setRemainingInteractionHints(int remainingHints) +{ + if (remainingInteractionHints() != remainingHints) { + LOG(KEY_REMAINING_INTERACTION_HINTS << remainingHints); + settings.setValue(KEY_REMAINING_INTERACTION_HINTS, remainingHints); + emit remainingInteractionHintsChanged(); + } +} diff --git a/src/appsettings.h b/src/appsettings.h index a040e60..bc840e6 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -31,6 +31,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool notificationTurnsDisplayOn READ notificationTurnsDisplayOn WRITE setNotificationTurnsDisplayOn NOTIFY notificationTurnsDisplayOnChanged) Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged) Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged) + Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged) public: enum NotificationFeedback { @@ -67,6 +68,9 @@ public: bool storageOptimizer() const; void setStorageOptimizer(bool enable); + int remainingInteractionHints() const; + void setRemainingInteractionHints(int remainingHints); + signals: void sendByEnterChanged(); void focusTextAreaAfterSendChanged(); @@ -76,6 +80,7 @@ signals: void notificationTurnsDisplayOnChanged(); void notificationFeedbackChanged(); void storageOptimizerChanged(); + void remainingInteractionHintsChanged(); private: QSettings settings; diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 7ee069f..6f48ced 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1080,6 +1080,10 @@ Download failed. Download fehlgeschlagen. + + Tap on the title bar to filter your chats + Tippen Sie auf die Titelleiste, um Ihre Chats zu filtern + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 71052b7..80176dd 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1080,6 +1080,10 @@ Download failed. Download failed. + + Tap on the title bar to filter your chats + Tap on the title bar to filter your chats + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index a1fa860..fb92263 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1069,6 +1069,10 @@ Download failed. Error al bajar + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 4e3d076..28a7e7b 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1081,6 +1081,10 @@ Download failed. Lataus epäonnistui. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index a5019b4..8e8ae19 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1069,6 +1069,10 @@ Download failed. A letöltés nem sikerült. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 36b4c54..a9da297 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1080,6 +1080,10 @@ Download failed. Download non riuscito. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index ee55b91..efbb142 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1091,6 +1091,10 @@ Download failed. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 7784a23..98cbd44 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1091,6 +1091,10 @@ Download failed. Ошибка скачивания. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 03cbe8a..63861bb 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1080,6 +1080,10 @@ Download failed. Nerladdning misslyckades. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 69b6f31..97d8fcd 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1069,6 +1069,10 @@ Download failed. 下载失败。 + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 14c006b..3e6ccf4 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1080,6 +1080,10 @@ Download failed. Download failed. + + Tap on the title bar to filter your chats + + PinnedMessageItem