From 99b070124b3a0df48e03a47bfcad42e7fb284525 Mon Sep 17 00:00:00 2001 From: molan-git Date: Thu, 4 Jun 2020 19:44:12 +0200 Subject: [PATCH] small ui-adjustments --- qml/lib/API.js | 2 - qml/pages/ConversationPage.qml | 2 +- qml/pages/LoginPage.qml | 3 +- qml/pages/MainPage.qml | 14 +++---- qml/pages/ProfilePage.qml | 3 +- qml/pages/SettingsPage.qml | 5 +-- qml/pages/components/MyList.qml | 1 + qml/pages/components/VisualContainer.qml | 48 ++++++++++++++++++++++-- 8 files changed, 58 insertions(+), 20 deletions(-) diff --git a/qml/lib/API.js b/qml/lib/API.js index 3dce882..ea84804 100644 --- a/qml/lib/API.js +++ b/qml/lib/API.js @@ -88,7 +88,6 @@ var tootParser = function(data){ ret.display_name = data.account.display_name ret.avatar_static = data.account.avatar_static - ret.favourited = data.favourited ? true : false ret.favourites_count = data.favourites_count ? data.favourites_count : 0 @@ -100,7 +99,6 @@ var tootParser = function(data){ ret.sensitive = data.sensitive ? true : false ret.visibility = data.visibility ? data.visibility : false - console.log(ret) } var test = 1; diff --git a/qml/pages/ConversationPage.qml b/qml/pages/ConversationPage.qml index 8e6d197..db97654 100644 --- a/qml/pages/ConversationPage.qml +++ b/qml/pages/ConversationPage.qml @@ -259,7 +259,7 @@ Page { property string selection opacity: 0.7 icon { - color: Theme.highlightColor + color: Theme.secondaryColor width: Theme.iconSizeSmallPlus fillMode: Image.PreserveAspectFit source: "../../qml/images/emojiselect.svg" diff --git a/qml/pages/LoginPage.qml b/qml/pages/LoginPage.qml index 7751cdf..b35ad7a 100644 --- a/qml/pages/LoginPage.qml +++ b/qml/pages/LoginPage.qml @@ -31,14 +31,13 @@ Page { focus: true label: qsTr("Enter a valid Mastodon instance URL") text: "https://" - placeholderText: "https://mastodon.social" width: parent.width validator: RegExpValidator { regExp: /^(ftp|http|https):\/\/[^ "]+$/ } EnterKey.enabled: instance.acceptableInput; EnterKey.highlighted: instance.acceptableInput; EnterKey.iconSource: "image://theme/icon-m-accept" EnterKey.onClicked: { - Logic.api = new Logic.MastodonAPI({ instance: instance.text, api_user_token: "" }); + Logic.api = Logic.mastodonAPI({ instance: instance.text, api_user_token: "" }); Logic.api.registerApplication("Tooter", 'http://localhost/harbour-tooter', // redirect uri, we will need this later on ["read", "write", "follow"], //scopes diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml index f275b8d..acd1a89 100644 --- a/qml/pages/MainPage.qml +++ b/qml/pages/MainPage.qml @@ -32,7 +32,7 @@ Page { VisualItemModel { id: visualModel MyList{ - id: tlHome; + id: tlHome title: qsTr("Home") type: "timelines/home" mdl: Logic.modelTLhome @@ -42,35 +42,35 @@ Page { } MyList{ - id: tlNotifications; + id: tlNotifications title: qsTr("Notifications") type: "notifications" notifier: true mdl: Logic.modelTLnotifications width: parent.itemWidth height: parent.itemHeight - onOpenDrawer: infoPanel.open = setDrawer + onOpenDrawer: infoPanel.open = setDrawer } MyList{ - id: tlLocal; + id: tlLocal title: qsTr("Local") type: "timelines/public?local=true" //params: ["local", true] mdl: Logic.modelTLlocal width: parent.itemWidth height: parent.itemHeight - onOpenDrawer: infoPanel.open = setDrawer + onOpenDrawer: infoPanel.open = setDrawer } MyList{ - id: tlPublic; + id: tlPublic title: qsTr("Federated") type: "timelines/public" mdl: Logic.modelTLpublic width: parent.itemWidth height: parent.itemHeight - onOpenDrawer: infoPanel.open = setDrawer + onOpenDrawer: infoPanel.open = setDrawer } Item { diff --git a/qml/pages/ProfilePage.qml b/qml/pages/ProfilePage.qml index b6e9d78..e2318af 100644 --- a/qml/pages/ProfilePage.qml +++ b/qml/pages/ProfilePage.qml @@ -15,7 +15,7 @@ Page { property string profileBackground: "" property string note: "" property string url: "" - property int user_id + property string user_id: "" property int statuses_count property int following_count property int followers_count @@ -175,7 +175,6 @@ Page { id: txtContainer width: parent.width height: Math.min( txtNote.height, parent.height * 0.55 ) - //color: "transparent" visible: { if ((note.text === "") || ( note.text === "

" )) { false diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index 70a6dd6..876929c 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -46,7 +46,7 @@ Page { height: txtRemoveAccount.height + btnRemoveAccount.height + Theme.paddingLarge anchors { left: parent.left - leftMargin: Theme.paddingLarge + leftMargin: Theme.horizontalPageMargin right: parent.right rightMargin: Theme.paddingLarge } @@ -99,9 +99,8 @@ Page { color: Theme.highlightColor anchors { left: parent.left - leftMargin: Theme.paddingLarge * 1.9 right: parent.right - rightMargin: Theme.paddingLarge * 1.2 + rightMargin: Theme.paddingLarge + icnRemoveAccount } } } diff --git a/qml/pages/components/MyList.qml b/qml/pages/components/MyList.qml index adad1ea..e3b1d14 100644 --- a/qml/pages/components/MyList.qml +++ b/qml/pages/components/MyList.qml @@ -22,6 +22,7 @@ SilicaListView { property variant vars property variant conf property bool notifier: false + model: mdl signal notify (string what, int num) diff --git a/qml/pages/components/VisualContainer.qml b/qml/pages/components/VisualContainer.qml index 5382131..b86e715 100644 --- a/qml/pages/components/VisualContainer.qml +++ b/qml/pages/components/VisualContainer.qml @@ -13,6 +13,7 @@ BackgroundItem { height: mnu.height + miniHeader.height + (typeof attachments !== "undefined" && attachments.count ? media.height + Theme.paddingLarge + Theme.paddingMedium: Theme.paddingLarge) + lblContent.height + Theme.paddingLarge + (miniStatus.visible ? miniStatus.height : 0) Rectangle { + id: bgDirect x: 0 y: 0 visible: status_visibility == 'direct' @@ -22,6 +23,20 @@ BackgroundItem { color: Theme.highlightBackgroundColor } + /* Rectangle { + id: bgDelegate + x: 0 + y: 0 + visible: status_visibility !== 'direct' + width: parent.width + height: parent.height + opacity: 0.15 + gradient: Gradient { + GradientStop { position: 0.7; color: "transparent" } + GradientStop { position: 1.0; color: Theme.highlightDimmerColor } + } + } */ + MiniStatus { id: miniStatus anchors { @@ -117,13 +132,16 @@ BackgroundItem { Text { id: lblContent + visible: model.type !== "follow" text: content.replace(new RegExp(" paintedHeight ? contentWarningLabel.paintedHeight : paintedHeight) : 0 + height: if (model.type === "follow") { + Theme.paddingLarge + } else content.length ? (contentWarningLabel.paintedHeight > paintedHeight ? contentWarningLabel.paintedHeight : paintedHeight) : 0 anchors { left: miniHeader.left leftMargin: Theme.paddingMedium @@ -210,7 +228,7 @@ BackgroundItem { id: mnu MenuItem { - enabled: model.type !== "follow" + visible: model.type !== "follow" text: typeof model.reblogged !== "undefined" && model.reblogged ? qsTr("Unboost") : qsTr("Boost") onClicked: { var status = typeof model.reblogged !== "undefined" && model.reblogged @@ -250,7 +268,7 @@ BackgroundItem { } MenuItem { - enabled: model.type !== "follow" + visible: model.type !== "follow" text: typeof model.favourited !== "undefined" && model.favourited ? qsTr("Unfavorite") : qsTr("Favorite") onClicked: { var status = typeof model.favourited !== "undefined" && model.favourited @@ -288,6 +306,30 @@ BackgroundItem { } } } + + MenuItem { + visible: model.type === "follow" + text: qsTr("Mention") + onClicked: { + pageStack.push(Qt.resolvedUrl("../ConversationPage.qml"), { + headerTitle: "Mention", + description: "@"+reblog_account_acct, + type: "new" + }) + } + + Image { + id: icMT + anchors { + leftMargin: Theme.horizontalPageMargin + left: parent.left + verticalCenter: parent.verticalCenter + } + width: Theme.iconSizeExtraSmall + height: width + source: "image://theme/icon-s-chat?" + (!model.favourited ? Theme.highlightColor : Theme.primaryColor) + } + } } onClicked: {