From 68da4be7be2a7a6c43d79ed4965c220a7f1f9559 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 17 Jul 2020 05:58:23 -0400 Subject: [PATCH] Make GIFs openable externally + real pause button --- src/gui/Base/HImage.qml | 28 +++++++------------- src/gui/Pages/Chat/RoomPane/SettingsView.qml | 2 +- src/gui/Pages/Chat/Timeline/EventImage.qml | 1 - src/icons/thin/play-overlay.svg | 4 --- src/themes/Glass.qpl | 3 --- src/themes/Midnight.qpl | 3 --- 6 files changed, 11 insertions(+), 30 deletions(-) delete mode 100644 src/icons/thin/play-overlay.svg diff --git a/src/gui/Base/HImage.qml b/src/gui/Base/HImage.qml index 3baaaefd..16128476 100644 --- a/src/gui/Base/HImage.qml +++ b/src/gui/Base/HImage.qml @@ -11,7 +11,6 @@ Image { property bool animate: true property bool animated: utils.urlExtension(image.source).toLowerCase() === "gif" - property bool enabledAnimatedPausing: true property alias radius: roundMask.radius property alias showProgressBar: progressBarLoader.active @@ -74,24 +73,17 @@ Image { value: 1 } - TapHandler { - enabled: image.enabledAnimatedPausing - onTapped: parent.userPaused = ! parent.userPaused - gesturePolicy: TapHandler.ReleaseWithinBounds - } + HButton { + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.leftMargin: theme.spacing / 2 + anchors.bottomMargin: theme.spacing / 2 - HIcon { - anchors.centerIn: parent - svgName: "play-overlay" - colorize: "transparent" - dimension: Math.min( - parent.width - theme.spacing * 2, - parent.height - theme.spacing * 2, - theme.controls.image.maxPauseIndicatorSize, - ) - scale: parent.status === Image.Ready && parent.paused ? 1 : 0 - - Behavior on scale { HNumberAnimation { overshoot: 4 } } + enableRadius: true + icon.name: parent.userPaused ? "player-play" : "player-pause" + iconItem.small: true + visible: parent.width > width * 2 && parent.height > height * 2 + onClicked: parent.userPaused = ! parent.userPaused } } } diff --git a/src/gui/Pages/Chat/RoomPane/SettingsView.qml b/src/gui/Pages/Chat/RoomPane/SettingsView.qml index f015f261..99168c9a 100644 --- a/src/gui/Pages/Chat/RoomPane/SettingsView.qml +++ b/src/gui/Pages/Chat/RoomPane/SettingsView.qml @@ -110,7 +110,6 @@ HFlickableColumnPage { HLabeledItem { id: topicArea elementsOpacity: topicAreaIn.opacity - enabled: chat.roomInfo.can_set_topic label.text: qsTr("Topic:") Layout.fillWidth: true @@ -127,6 +126,7 @@ HFlickableColumnPage { id: topicAreaIn placeholderText: qsTr("This room is about...") defaultText: chat.roomInfo.plain_topic + enabled: chat.roomInfo.can_set_topic focusItemOnTab: encryptCheckBox.checked ? diff --git a/src/gui/Pages/Chat/Timeline/EventImage.qml b/src/gui/Pages/Chat/Timeline/EventImage.qml index 2269f249..d69d56b3 100644 --- a/src/gui/Pages/Chat/Timeline/EventImage.qml +++ b/src/gui/Pages/Chat/Timeline/EventImage.qml @@ -66,7 +66,6 @@ HMxcImage { width: fitSize.width height: fitSize.height horizontalAlignment: Image.AlignLeft - enabledAnimatedPausing: ! eventList.selectedCount title: thumbnail ? loader.thumbnailTitle : loader.title animated: loader.singleMediaInfo.media_mime === "image/gif" || diff --git a/src/icons/thin/play-overlay.svg b/src/icons/thin/play-overlay.svg deleted file mode 100644 index b15abad6..00000000 --- a/src/icons/thin/play-overlay.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/themes/Glass.qpl b/src/themes/Glass.qpl index b96021ff..32114cef 100644 --- a/src/themes/Glass.qpl +++ b/src/themes/Glass.qpl @@ -244,9 +244,6 @@ controls: color border: "black" color pressedBorder: colors.strongAccentElement - image: - int maxPauseIndicatorSize: 64 - avatar: int size: baseElementsHeight int compactSize: baseElementsHeight / 2 diff --git a/src/themes/Midnight.qpl b/src/themes/Midnight.qpl index e0a8be03..edb88fcc 100644 --- a/src/themes/Midnight.qpl +++ b/src/themes/Midnight.qpl @@ -250,9 +250,6 @@ controls: color border: "black" color pressedBorder: colors.strongAccentElement - image: - int maxPauseIndicatorSize: 64 - avatar: int size: baseElementsHeight int compactSize: baseElementsHeight / 2