Skip to content

Commit dfd4ac2

Browse files
committed
WIP feat: can't zoom in sent images in chat on Desktop and Mobile
1 parent edd1ebe commit dfd4ac2

19 files changed

Lines changed: 351 additions & 85 deletions

File tree

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
import QtQml
5+
6+
import StatusQ
7+
import StatusQ.Core
8+
import StatusQ.Core.Utils
9+
import StatusQ.Controls
10+
import StatusQ.Components
11+
import StatusQ.Core.Theme
12+
13+
import Models
14+
import Storybook
15+
16+
import SortFilterProxyModel
17+
18+
import utils
19+
import shared.status
20+
21+
SplitView {
22+
id: root
23+
24+
orientation: Qt.Vertical
25+
26+
Logs { id: logs }
27+
28+
Item {
29+
id: popupContainer
30+
SplitView.fillHeight: true
31+
SplitView.fillWidth: true
32+
33+
Rectangle {
34+
anchors.fill: parent
35+
36+
color: Theme.palette.background
37+
border.width: 1
38+
}
39+
40+
Image {
41+
id: localImage
42+
anchors.centerIn: parent
43+
source: ModelsData.icons.status
44+
visible: false
45+
}
46+
47+
StatusImageModal {
48+
parent: popupContainer
49+
modal: false
50+
visible: true
51+
closePolicy: Popup.NoAutoClose
52+
53+
Binding on url {
54+
value: urlGroup.checkedButton.url
55+
when: !ctrlLocalImage.checked
56+
}
57+
58+
Binding on image {
59+
value: localImage
60+
when: ctrlLocalImage.checked
61+
}
62+
}
63+
}
64+
65+
LogsAndControlsPanel {
66+
id: logsAndControlsPanel
67+
68+
SplitView.minimumHeight: 320
69+
SplitView.preferredHeight: 320
70+
71+
logsView.logText: logs.logText
72+
73+
ButtonGroup {
74+
id: urlGroup
75+
buttons: buttonsColumn.children
76+
}
77+
78+
ColumnLayout {
79+
id: buttonsColumn
80+
anchors.fill: parent
81+
82+
UrlRadioButton {
83+
id: ctrlLocalImage
84+
text: "Local Image (Status)"
85+
url: ""
86+
checked: true
87+
}
88+
UrlRadioButton {
89+
text: "Local image URL (Socks)"
90+
url: ModelsData.icons.socks
91+
}
92+
UrlRadioButton {
93+
text: "Remote JPEG"
94+
url: "https://www.deepsilver.com/media/nuhnnymt/kcd2_re_desktop_3840x2160.jpg"
95+
}
96+
UrlRadioButton {
97+
text: "Remote GIF"
98+
url: "https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExZjdtY2dpbnFxczViM2wwMWNjaW43NXdza214eGFuMHg1Y3pjaG9layZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/804TNmnYLfNao/giphy.gif"
99+
}
100+
UrlRadioButton {
101+
text: "Remote SVG"
102+
url: "https://upload.wikimedia.org/wikipedia/commons/7/7b/Znak_Moravy.svg"
103+
}
104+
UrlRadioButton {
105+
text: "Empty image/url"
106+
url: ""
107+
}
108+
UrlRadioButton {
109+
text: "Non existing image"
110+
url: "file://tmp/not/here/foobar.jpg"
111+
}
112+
}
113+
}
114+
115+
component UrlRadioButton: RadioButton {
116+
property url url
117+
}
118+
}
119+
120+
// category: Popups
121+
// status: good

ui/StatusQ/src/StatusQ/Components/LoadingErrorComponent.qml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import QtQuick
22
import QtQuick.Controls
3+
import QtQuick.Layouts
34

45
import StatusQ.Core
56
import StatusQ.Core.Theme
@@ -29,19 +30,19 @@ Control {
2930
id: root
3031

3132
/*!
32-
\qmlproperty bool LoadingComponent::radius
33+
\qmlproperty int LoadingErrorComponent::radius
3334
This property lets user set custom radius
3435
*/
3536
property int radius: 4
3637

3738
/*!
38-
\qmlproperty string LoadingComponent::text
39+
\qmlproperty string LoadingErrorComponent::text
3940
This property lets user set error message
4041
*/
4142
property string text: qsTr("Failed\nto load")
4243

4344
/*!
44-
\qmlproperty string LoadingComponent::icon
45+
\qmlproperty string LoadingErrorComponent::icon
4546
This property lets user set error icon
4647
*/
4748
property alias icon: errorIcon.icon
@@ -63,10 +64,14 @@ Control {
6364
color: Theme.palette.directColor7
6465
}
6566
StatusBaseText {
67+
width: root.availableWidth
6668
anchors.horizontalCenter: parent.horizontalCenter
6769
horizontalAlignment: Qt.AlignHCenter
6870
color: Theme.palette.directColor6
6971
text: root.text
72+
maximumLineCount: 3
73+
wrapMode: Text.Wrap
74+
elide: Text.ElideRight
7075
}
7176
}
7277
}

ui/StatusQ/src/StatusQ/Components/StatusAnimatedImage.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ AnimatedImage {
4343
*/
4444
readonly property bool isError: status === AnimatedImage.Error
4545

46+
readonly property bool isEmpty: status === AnimatedImage.Null
47+
4648
fillMode: AnimatedImage.PreserveAspectFit
4749
}

ui/StatusQ/src/StatusQ/Controls/StatusScrollBar.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ T.ScrollBar {
5252
opacity: enabled && (root.hovered || root.active || (root.policy === T.ScrollBar.AlwaysOn)) ? 1.0 : 0.0
5353
radius: Math.min(width, height) / 2
5454

55-
Behavior on opacity { NumberAnimation { duration: 100 } }
55+
Behavior on opacity { NumberAnimation { duration: ThemeUtils.AnimationDuration.Fast } }
5656
}
5757
}
58-

ui/app/AppLayouts/Chat/views/ChatColumnView.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ Item {
521521
onRemovePaymentRequestPreview: (index) => d.activeChatContentModule.inputAreaModule.removePaymentRequestPreviewData(index)
522522

523523
onOpenGifPopupRequest: (params, cbOnGifSelected, cbOnClose) => root.openGifPopupRequest(params, cbOnGifSelected, cbOnClose)
524-
onImageClicked: image => Global.openImagePopup(image, "", false)
524+
onImageClicked: image => Global.openImagePopup(image, "")
525525
onLinkClicked: link => Global.requestOpenLink(link)
526526
}
527527

ui/app/AppLayouts/Wallet/views/collectibles/CollectibleDetailView.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ Item {
364364
manualMaxDimension: 240
365365
interactive: !isError && !isEmpty
366366
enabled: interactive
367-
onImageClicked: (image, plain) => Global.openImagePopup(image, "", plain)
367+
onImageClicked: (image, plain) => Global.openImagePopup(image, "")
368368
onVideoClicked: (url) => Global.openVideoPopup(url)
369369
onOpenImageContextMenu: (url, isGif, x, y) => imageContextMenu.createObject(this, { imageSource: url, isGif: isGif, isVideo: false }).popup(x, y)
370370
onOpenVideoContextMenu: (url, x, y) => imageContextMenu.createObject(this, { imageSource: url, url: url, isVideo: true, isGif: false }).popup(x, y)

ui/app/mainui/Popups.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ QtObject {
158158
openPopup(downloadPageComponent, popupProperties)
159159
}
160160

161-
function openImagePopup(image, url, plain) {
162-
openPopup(imagePopupComponent, {image: image, url: url, plain: plain})
161+
function openImagePopup(image, url) {
162+
openPopup(imagePopupComponent, {image, url})
163163
}
164164

165165
function openVideoPopup(url) {
166-
openPopup(videoPopupComponent, { url: url })
166+
openPopup(videoPopupComponent, { url })
167167
}
168168

169169
function openProfilePopup(publicKey: string, parentPopup, cb) {

ui/app/mainui/sectionLoaders/PopupsLoader.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ Loader {
182182
function onOpenDownloadModalRequested(available, version, url) {
183183
root.invoke(() => root.item.openDownloadModal(available, version, url))
184184
}
185-
function onOpenImagePopup(image, url, plain) {
186-
root.invoke(() => root.item.openImagePopup(image, url, plain))
185+
function onOpenImagePopup(image, url) {
186+
root.invoke(() => root.item.openImagePopup(image, url))
187187
}
188188
function onOpenVideoPopup(url) {
189189
root.invoke(() => root.item.openVideoPopup(url))

ui/i18n/qml_base_en.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17155,6 +17155,17 @@ to load</source>
1715517155
<translation type="unfinished"></translation>
1715617156
</message>
1715717157
</context>
17158+
<context>
17159+
<name>StatusImageModal</name>
17160+
<message>
17161+
<source>Failed to load %1</source>
17162+
<translation type="unfinished"></translation>
17163+
</message>
17164+
<message>
17165+
<source>empty image</source>
17166+
<translation type="unfinished"></translation>
17167+
</message>
17168+
</context>
1715817169
<context>
1715917170
<name>StatusImageSelector</name>
1716017171
<message>

ui/i18n/qml_base_lokalise_en.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20890,6 +20890,19 @@
2089020890
<translation>Enable third-party services</translation>
2089120891
</message>
2089220892
</context>
20893+
<context>
20894+
<name>StatusImageModal</name>
20895+
<message>
20896+
<source>Failed to load %1</source>
20897+
<comment>StatusImageModal</comment>
20898+
<translation>Failed to load %1</translation>
20899+
</message>
20900+
<message>
20901+
<source>empty image</source>
20902+
<comment>StatusImageModal</comment>
20903+
<translation>empty image</translation>
20904+
</message>
20905+
</context>
2089320906
<context>
2089420907
<name>StatusImageSelector</name>
2089520908
<message>

0 commit comments

Comments
 (0)