From 571ef7b79cafe801e24ebe117fcfa259e74c2045 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 17 Jun 2022 16:08:27 +0200 Subject: [PATCH] Add a new progress bar in the form of spinner. Allow to cancel a file transfer. Open folder if the file cannot be directly open (don't work if the system accept but reject it). --- CHANGELOG.md | 2 + linphone-app/assets/languages/da.ts | 13 +++ linphone-app/assets/languages/de.ts | 13 +++ linphone-app/assets/languages/en.ts | 13 +++ linphone-app/assets/languages/es.ts | 13 +++ linphone-app/assets/languages/fr_FR.ts | 13 +++ linphone-app/assets/languages/hu.ts | 13 +++ linphone-app/assets/languages/it.ts | 13 +++ linphone-app/assets/languages/ja.ts | 13 +++ linphone-app/assets/languages/lt.ts | 13 +++ linphone-app/assets/languages/pt_BR.ts | 13 +++ linphone-app/assets/languages/ru.ts | 13 +++ linphone-app/assets/languages/sv.ts | 13 +++ linphone-app/assets/languages/tr.ts | 13 +++ linphone-app/assets/languages/uk.ts | 13 +++ linphone-app/assets/languages/zh_CN.ts | 13 +++ linphone-app/resources.qrc | 2 + .../src/components/content/ContentModel.cpp | 20 +++- .../src/components/content/ContentModel.hpp | 1 + .../other/colors/ColorListModel.hpp | 4 + .../Common/Indicators/RoundProgressBar.qml | 85 +++++++++++++++++ .../Indicators/RoundProgressBarStyle.qml | 18 ++++ linphone-app/ui/modules/Common/Styles/qmldir | 1 + linphone-app/ui/modules/Common/qmldir | 1 + .../modules/Linphone/Chat/ChatFileMessage.qml | 94 ++++++------------- .../modules/Linphone/Chat/ChatFilePreview.qml | 2 +- linphone-app/ui/views/App/Main/MainWindow.qml | 3 +- 27 files changed, 359 insertions(+), 69 deletions(-) create mode 100644 linphone-app/ui/modules/Common/Indicators/RoundProgressBar.qml create mode 100644 linphone-app/ui/modules/Common/Styles/Indicators/RoundProgressBarStyle.qml diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d407e5a2..591358206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Option to set the display name in "using an account" tab of assistant. - Long pressed buttons. - Phone dialpad on main window. +- Animated file in chats/notifications. +- Round progress bar for transferring a file and allow to cancel it. ### Fixed - Crash on exit. diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index 774e805a7..de7361f5d 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -550,6 +550,19 @@ Server url ikke konfigureret. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index 69ce3efc2..4aaa53255 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -550,6 +550,19 @@ Server URL ist nicht konfiguriert. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index 7c582b2a2..a3ed1ed0f 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -550,6 +550,19 @@ Server URL not configured. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + Cancel + + + fileTransferDownload + 'Download' : Message link to download a file + Download + + ChatForwardMessage diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index a97a11223..96ea98593 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -550,6 +550,19 @@ URL del servidor no configurada. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index 954a3c8cd..e6269d8f3 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -550,6 +550,19 @@ URL du serveur non configurée. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index 7e77301db..7499385ff 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -549,6 +549,19 @@ A kiszolgáló URL-je nincs konfigurálva. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index 5e11d6559..557d2c588 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -550,6 +550,19 @@ URL del server non configurato. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index 0f36ce552..7605d0724 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -549,6 +549,19 @@ %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index d75218fd5..de08168e4 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -551,6 +551,19 @@ Nesukonfigūruotas serverio url. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index 1a16e0c18..c48a71e9f 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -550,6 +550,19 @@ URL do servidor não configurado. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index 1c5125e42..c3c4a844d 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -551,6 +551,19 @@ %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index 614330084..6145b2adc 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -550,6 +550,19 @@ Serverwebbadressen är inte konfigurerad. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index 508904de5..adbebc387 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -549,6 +549,19 @@ Sunucu url'si yapılandırılmadı. %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index b6a601919..cfaacf37a 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -551,6 +551,19 @@ %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index 530ed1b41..b6b78deba 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -549,6 +549,19 @@ %1 is someone. The state is that the message hasn't been delivered because of an error. + + ChatFileMessage + + fileTransferCancel + 'Cancel' : Message link to cancel a transfer (upload/download) + + + + fileTransferDownload + 'Download' : Message link to download a file + + + ChatForwardMessage diff --git a/linphone-app/resources.qrc b/linphone-app/resources.qrc index 52e8ef4c4..0ef6bd957 100644 --- a/linphone-app/resources.qrc +++ b/linphone-app/resources.qrc @@ -218,6 +218,7 @@ ui/modules/Common/Image/Icon.qml ui/modules/Common/Image/RoundedImage.qml ui/modules/Common/Indicators/MediaProgressBar.qml + ui/modules/Common/Indicators/RoundProgressBar.qml ui/modules/Common/Indicators/VuMeter.qml ui/modules/Common/Menus/ApplicationMenuEntry.qml ui/modules/Common/Menus/ApplicationMenu.qml @@ -270,6 +271,7 @@ ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml ui/modules/Common/Styles/Form/TransparentTextInputStyle.qml ui/modules/Common/Styles/Indicators/MediaProgressBarStyle.qml + ui/modules/Common/Styles/Indicators/RoundProgressBarStyle.qml ui/modules/Common/Styles/Indicators/VuMeterStyle.qml ui/modules/Common/Styles/Menus/ApplicationMenuStyle.qml ui/modules/Common/Styles/Menus/DropDownStaticMenuStyle.qml diff --git a/linphone-app/src/components/content/ContentModel.cpp b/linphone-app/src/components/content/ContentModel.cpp index 4c040a8d7..1a5ce8531 100644 --- a/linphone-app/src/components/content/ContentModel.cpp +++ b/linphone-app/src/components/content/ContentModel.cpp @@ -234,10 +234,11 @@ void ContentModel::downloadFile(){ case LinphoneEnums::ChatMessageStateDisplayed: case LinphoneEnums::ChatMessageStateFileTransferDone: break; - + case LinphoneEnums::ChatMessageStateFileTransferInProgress: + return; default: qWarning() << QStringLiteral("Wrong message state when requesting downloading, state=%1.").arg(mChatMessageModel->getState()); - } + } bool soFarSoGood; QString filename = getName();//mFileTransfertContent->getName(); const QString safeFilePath = Utils::getSafeFilePath( @@ -261,6 +262,15 @@ void ContentModel::downloadFile(){ qWarning() << QStringLiteral("Unable to download file of entry %1.").arg(filename); } } +void ContentModel::cancelDownloadFile(){ + if(mChatMessageModel && mChatMessageModel->getChatMessage()) { + if(mChatMessageModel->isOutgoing() ){ + mChatMessageModel->deleteEvent();// Uploading is cancelling : Delete event to have clean history. + emit mChatMessageModel->remove(mChatMessageModel); + }else + mChatMessageModel->getChatMessage()->cancelFileTransfer(); + } +} void ContentModel::openFile (bool showDirectory) { if (mChatMessageModel && ((!mWasDownloaded && !mChatMessageModel->isOutgoing()) || mContent->getFilePath() == "")) { @@ -268,9 +278,13 @@ void ContentModel::openFile (bool showDirectory) { }else{ QFileInfo info( Utils::coreStringToAppString(mContent->getFilePath())); showDirectory = showDirectory || !info.exists(); - QDesktopServices::openUrl( + if(!QDesktopServices::openUrl( QUrl(QStringLiteral("file:///%1").arg(showDirectory ? info.absolutePath() : info.absoluteFilePath())) + ) && !showDirectory){ + QDesktopServices::openUrl( + QUrl(QStringLiteral("file:///%1").arg(info.absolutePath())) ); + } } } diff --git a/linphone-app/src/components/content/ContentModel.hpp b/linphone-app/src/components/content/ContentModel.hpp index 507966acb..dbe51c544 100644 --- a/linphone-app/src/components/content/ContentModel.hpp +++ b/linphone-app/src/components/content/ContentModel.hpp @@ -78,6 +78,7 @@ public: void removeDownloadedFile(); Q_INVOKABLE void downloadFile(); + Q_INVOKABLE void cancelDownloadFile(); Q_INVOKABLE void openFile (bool showDirectory = false); diff --git a/linphone-app/src/components/other/colors/ColorListModel.hpp b/linphone-app/src/components/other/colors/ColorListModel.hpp index 32a3f3bf8..1b8b2a3a5 100644 --- a/linphone-app/src/components/other/colors/ColorListModel.hpp +++ b/linphone-app/src/components/other/colors/ColorListModel.hpp @@ -126,6 +126,10 @@ class ColorListModel : public ProxyListModel { ADD_COLOR("telkeypad_bg", "#4D5B66", "Background for phone keypad") ADD_COLOR("telkeypad_fg", "#E4E4E4", "Foreground for phone keypad") ADD_COLOR("telkeypad_h", "#B1B1B1", "Foreground for phone keypad") + + ADD_COLOR("progress_bg", "black", "Background of round progress bar") + ADD_COLOR("progress_remaining_fg", "white", "Remaining progression color") + // Keywords: 'mKeywordsMap' // s=standard, ma=main, l=list, sc=screen, me=menu diff --git a/linphone-app/ui/modules/Common/Indicators/RoundProgressBar.qml b/linphone-app/ui/modules/Common/Indicators/RoundProgressBar.qml new file mode 100644 index 000000000..64cfd6bcf --- /dev/null +++ b/linphone-app/ui/modules/Common/Indicators/RoundProgressBar.qml @@ -0,0 +1,85 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.2 +import QtQuick.Shapes 1.15 + +import Units 1.0 + +import Common.Styles 1.0 + + +ProgressBar{ + id: mainItem + property string text: value + '%' + implicitHeight: 35 + implicitWidth: 35 + to: 100 + value: 0 + background: Rectangle { + color: RoundProgressBarStyle.backgroundColor + radius: width + } + Timer{ + id: animationTest + repeat: true + onTriggered: value = (value + 1) % to + interval: 5 + } + contentItem: + Item{ + Shape { + id: shape + anchors.fill: parent + anchors.margins: RoundProgressBarStyle.borderWidth + + property real progressionRadius : Math.min(shape.width / 2, shape.height / 2) - RoundProgressBarStyle.progressionWidth / 2 + + layer.enabled: true + layer.samples: 8 + layer.smooth: true + vendorExtensionsEnabled: false + + ShapePath { + id: pathDial + strokeColor: RoundProgressBarStyle.progressRemainColor + fillColor: 'transparent' + strokeWidth: RoundProgressBarStyle.progressionWidth + capStyle: Qt.RoundCap + + PathAngleArc { + radiusX: shape.progressionRadius + radiusY: shape.progressionRadius + centerX: shape.width / 2 + centerY: shape.height / 2 + startAngle: -90 // top start + sweepAngle: 360 + } + } + + ShapePath { + id: pathProgress + strokeColor: RoundProgressBarStyle.progressColor + fillColor: 'transparent' + strokeWidth: RoundProgressBarStyle.progressionWidth + capStyle: Qt.RoundCap + + PathAngleArc { + radiusX: shape.progressionRadius + radiusY: shape.progressionRadius + centerX: shape.width / 2 + centerY: shape.height / 2 + startAngle: -90 // top start + sweepAngle: (360/ mainItem.to * mainItem.value) + } + } + } + Text{ + anchors.centerIn: parent + text: mainItem.text + color: RoundProgressBarStyle.progressRemainColor + font.pointSize: RoundProgressBarStyle.pointSize + font.bold: true + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } +} diff --git a/linphone-app/ui/modules/Common/Styles/Indicators/RoundProgressBarStyle.qml b/linphone-app/ui/modules/Common/Styles/Indicators/RoundProgressBarStyle.qml new file mode 100644 index 000000000..1acdd4b83 --- /dev/null +++ b/linphone-app/ui/modules/Common/Styles/Indicators/RoundProgressBarStyle.qml @@ -0,0 +1,18 @@ +pragma Singleton +import QtQml 2.2 + +import ColorsList 1.0 +import Units 1.0 + +// ============================================================================= + +QtObject { + property string sectionName: 'RoundProgressBar' + + property color backgroundColor: ColorsList.add(sectionName+'_bg', 'progress_bg').color + property color progressRemainColor: ColorsList.add(sectionName+'_remaining_fg', 'progress_remaining_fg').color + property color progressColor: ColorsList.add(sectionName+'_fg', 'i').color + property int progressionWidth : 3 + property int borderWidth: 2 + property int pointSize: Units.dp * 7 +} diff --git a/linphone-app/ui/modules/Common/Styles/qmldir b/linphone-app/ui/modules/Common/Styles/qmldir index d7c4a0e26..5d861f5c3 100644 --- a/linphone-app/ui/modules/Common/Styles/qmldir +++ b/linphone-app/ui/modules/Common/Styles/qmldir @@ -45,6 +45,7 @@ singleton TabButtonStyle 1.0 Form/Tab/TabButtonStyle.qml singleton TabContainerStyle 1.0 Form/Tab/TabContainerStyle.qml singleton MediaProgressBarStyle 1.0 Indicators/MediaProgressBarStyle.qml +singleton RoundProgressBarStyle 1.0 Indicators/RoundProgressBarStyle.qml singleton VuMeterStyle 1.0 Indicators/VuMeterStyle.qml singleton ApplicationMenuStyle 1.0 Menus/ApplicationMenuStyle.qml diff --git a/linphone-app/ui/modules/Common/qmldir b/linphone-app/ui/modules/Common/qmldir index 3ee1deb84..0820bdc7f 100644 --- a/linphone-app/ui/modules/Common/qmldir +++ b/linphone-app/ui/modules/Common/qmldir @@ -70,6 +70,7 @@ Icon 1.0 Image/Icon.qml RoundedImage 1.0 Image/RoundedImage.qml MediaProgressBar 1.0 Indicators/MediaProgressBar.qml +RoundProgressBar 1.0 Indicators/RoundProgressBar.qml VuMeter 1.0 Indicators/VuMeter.qml ApplicationMenu 1.0 Menus/ApplicationMenu.qml diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatFileMessage.qml b/linphone-app/ui/modules/Linphone/Chat/ChatFileMessage.qml index f3e7ad5de..a0d432b36 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatFileMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatFileMessage.qml @@ -50,6 +50,7 @@ Row { readonly property bool isUploaded: chatMessageModel && chatMessageModel.state == LinphoneEnums.ChatMessageStateDelivered readonly property bool isDelivered: chatMessageModel && chatMessageModel.state == LinphoneEnums.ChatMessageStateDeliveredToUser readonly property bool isRead: chatMessageModel && chatMessageModel.state == LinphoneEnums.ChatMessageStateDisplayed + readonly property bool isTransferring: chatMessageModel && (chatMessageModel.state == LinphoneEnums.ChatMessageStateFileTransferInProgress || chatMessageModel.state == LinphoneEnums.ChatMessageStateInProgress ) property string thumbnail : mainRow.contentModel ? mainRow.contentModel.thumbnail : '' color: 'transparent' @@ -137,15 +138,32 @@ Row { anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.bottomMargin: ChatStyle.entry.message.file.spacing - width: parent.width - ChatStyle.entry.message.file.spacing + width: parent.width - 2*ChatStyle.entry.message.file.spacing color: ChatStyle.entry.message.file.extension.text.color font.bold: true font.pointSize: ChatStyle.entry.message.file.extension.text.pointSize - elide: Text.ElideRight + clip: true text: (mainRow.contentModel?Utils.getExtension(mainRow.contentModel.name).toUpperCase():'') horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } + RoundProgressBar { + id: progressBar + anchors.centerIn: parent + property int fileSize: mainRow.contentModel ? mainRow.contentModel.fileSize : 0 + to: 100 + value: mainRow.contentModel ? (fileSize>0 ? Math.floor(100 * mainRow.contentModel.fileOffset / fileSize) : 0) : to + visible: rectangle.isTransferring && value != 0 + /* Change format? Current is % + text: if(mainRow.contentModel){ + var fileSize = Utils.formatSize(mainRow.contentModel.fileSize) + return progressBar.visible + ? Utils.formatSize(mainRow.contentModel.fileOffset) + '/' + fileSize + : fileSize + }else + return '' + */ + } } Text { id: fileName @@ -166,15 +184,20 @@ Row { Layout.fillWidth: true Layout.fillHeight: true Layout.preferredHeight: visible ? ChatStyle.entry.message.file.download.height : 0 - text: mainRow.contentModel ? 'Download ('+Utils.formatSize(mainRow.contentModel.fileSize)+')' : '' + //: 'Cancel' : Message link to cancel a transfer (upload/download) + text: mainRow.contentModel ? rectangle.isTransferring ? qsTr('fileTransferCancel') + //: 'Download' : Message link to download a file + : qsTr('fileTransferDownload') +' ('+Utils.formatSize(mainRow.contentModel.fileSize)+')' + : '' font.underline: true font.pointSize: ChatStyle.entry.message.file.download.pointSize color:ChatStyle.entry.message.file.extension.text.color - visible: !progressBar.visible && (mainRow.contentModel? !mainRow.contentModel.wasDownloaded : false) + visible: (mainRow.contentModel? (!mainItem.isOutgoing && !mainRow.contentModel.wasDownloaded) || rectangle.isTransferring : false) horizontalAlignment: Qt.AlignCenter verticalAlignment: Qt.AlignCenter } } + } } Loader { @@ -237,66 +260,9 @@ Row { } ] } - - // --------------------------------------------------------------------- - // Upload or file status. - // --------------------------------------------------------------------- - Item{ - anchors.left: thumbnailProvider.right - anchors.right: parent.right - anchors.bottom: thumbnailProvider.bottom - anchors.top: thumbnailProvider.top - anchors.leftMargin: ChatStyle.entry.message.file.spacing - - Column { - anchors.fill: parent - - spacing: ChatStyle.entry.message.file.status.spacing - - ProgressBar { - id: progressBar - - height: ChatStyle.entry.message.file.status.bar.height - width: visible ? parent.width : 0 - - to: (mainRow.contentModel ? mainRow.contentModel.fileSize : 0) - value: mainRow.contentModel ? mainRow.contentModel.fileOffset || to : to - visible: value != to - background: Rectangle { - color: ChatStyle.entry.message.file.status.bar.background.color - radius: ChatStyle.entry.message.file.status.bar.radius - } - - contentItem: Item { - Rectangle { - color: ChatStyle.entry.message.file.status.bar.contentItem.color - height: parent.height - width: progressBar.visualPosition * parent.width - - radius: ChatStyle.entry.message.file.status.bar.radius - } - } - } - /* - Text { - visible: progressBar.value != progressBar.to - color: fileName.color - elide: Text.ElideRight - font.pointSize: fileName.font.pointSize - text: { - if(mainRow.contentModel){ - var fileSize = Utils.formatSize(mainRow.contentModel.fileSize) - return progressBar.visible - ? Utils.formatSize(mainRow.contentModel.fileOffset) + '/' + fileSize - : fileSize - }else - return '' - } - }*/ - } - } } + MouseArea { function handleMouseMove (mouse) { thumbnailProvider.state = Utils.pointIsInItem(this, thumbnailProvider, mouse) @@ -308,7 +274,9 @@ Row { visible: true onClicked: { - if (Utils.pointIsInItem(this, thumbnailProvider, mouse)) { + if(rectangle.isTransferring) + mainRow.contentModel.cancelDownloadFile() + else if (Utils.pointIsInItem(this, thumbnailProvider, mouse)) { mainRow.contentModel.openFile() } else if (mainRow.contentModel && mainRow.contentModel.wasDownloaded) { mainRow.contentModel.openFile(true)// Show directory diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatFilePreview.qml b/linphone-app/ui/modules/Linphone/Chat/ChatFilePreview.qml index 5349357ee..b327f15c6 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatFilePreview.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatFilePreview.qml @@ -47,7 +47,7 @@ Item{ FileView{ height:mainListView.height-ChatFilePreviewStyle.filePreview.heightMargins width: height * ChatFilePreviewStyle.filePreview.format - anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenter: parent ? parent.verticalCenter : ScrollableListView.verticalCenter anchors.verticalCenterOffset: 7 thumbnail: $modelData.thumbnail name: $modelData.name diff --git a/linphone-app/ui/views/App/Main/MainWindow.qml b/linphone-app/ui/views/App/Main/MainWindow.qml index 32db51c54..cd12852eb 100644 --- a/linphone-app/ui/views/App/Main/MainWindow.qml +++ b/linphone-app/ui/views/App/Main/MainWindow.qml @@ -206,8 +206,7 @@ ApplicationWindow { colorSet: MainWindowStyle.buttons.telKeyad onClicked: telKeypad.visible = !telKeypad.visible toggled: telKeypad.visible - } - + } ActionButton { Layout.leftMargin: 30 isCustom: true