Commit dd88140a authored by armin's avatar armin

adds busyindicator to download button

parent 6a58cb05
Pipeline #791 passed with stage
in 10 minutes and 1 second
......@@ -171,5 +171,6 @@
<file>qml/pages/channelView/messageTypes/RoomNameChangedMessage.qml</file>
<file>qml/pages/channelView/messageTypes/PrivacyMessage.qml</file>
<file>res/logos/fairchat_logo_400x400.svg</file>
<file>qml/various/DownloadButton.qml</file>
</qresource>
</RCC>
......@@ -94,7 +94,7 @@ Rectangle {
}
}else{
rocketChatController.getFileRessource(model.linkurl)
rocketChatController.getFileRessource(model.linkurl,"temp")
}
}
background: StdImageHighDPI {
......@@ -122,28 +122,16 @@ Rectangle {
source: "qrc:/res/stop.png"
}
}
Button {
id: downloadButton
font.family: Fonts.fontello.name
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
height: 15
onPressed: {
rocketChatController.getFileRessource(model.linkurl,"audio")
}
StdImageHighDPI{
anchors.centerIn: parent
source: "qrc:/res/download.svg";
height: 15
fillMode: Image.PreserveAspectFit
}
background: Rectangle {
anchors.leftMargin: 10
implicitWidth: 15
implicitHeight: 15
color: Colors.white
}
}
DownloadButton{
id: downloadButton
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 10
width: 15
height: 15
url: model.linkurl
backgroundColor: Colors.white
}
StyledText{
anchors.left: audioStop.right
anchors.verticalCenter: parent.verticalCenter
......@@ -237,6 +225,7 @@ Rectangle {
player.source = pathPrefix+path;
player.play()
}else if(url === model.linkurl){
downloadButton.state = "default"
if(Qt.platform.os == "ios"){
rocketChatController.openFileExternally(pathPrefix + path)
}else{
......
......@@ -25,6 +25,7 @@ import QtQuick.Controls 2.2
import "qrc:/qml/style"
import "qrc:/javascript/print.js" as Print
import "qrc:/qml/various"
import "qrc:/qml/pages/channelView/messageTypes"
Item {
anchors.left: parent.left
......@@ -37,41 +38,28 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
spacing: 5
height: 20
StyledText {
width: parent.width-30
text: model.msg
wrapMode: Text.WrapAnywhere
color: Colors.fontColor
}
Button {
DownloadButton{
id: downloadButton
font.family: Fonts.fontello.name
width: 15
height: 15
onPressed: {
console.log(model.linkurl);
rocketChatController.getFileRessource(model.linkurl,"cache")
}
StdImageHighDPI{
anchors.centerIn: parent
source: "qrc:/res/download.svg";
height: 15
fillMode: Image.PreserveAspectFit
}
background: Rectangle {
anchors.leftMargin: 10
implicitWidth: 15
implicitHeight: 15
color: model.ownMessage?Colors.ownMessage:Colors.white
}
url: model.linkurl
backgroundColor: model.ownMessage?Colors.ownMessage:Colors.white
}
}
Connections {
target: rocketChatController
onFileRessourceProcessed: {
if (url === model.linkurl) {
console.log("document"+pathPrefix + path)
downloadButton.state = "default"
if(Qt.platform.os == "ios"){
rocketChatController.openFileExternally(pathPrefix + path)
}else{
......
......@@ -50,26 +50,13 @@ Item {
wrapMode: Text.WrapAnywhere
color: Colors.fontColor
}
Button {
id: downloadButton
font.family: Fonts.fontello.name
height: 15
onPressed: {
rocketChatController.getFileRessource(model.linkurl,"cache")
}
StdImageHighDPI{
anchors.centerIn: parent
source: "qrc:/res/download.svg";
height: 15
fillMode: Image.PreserveAspectFit
}
background: Rectangle {
anchors.leftMargin: 10
implicitWidth: 15
implicitHeight: 15
color: model.ownMessage?Colors.ownMessage:Colors.white
}
}
DownloadButton{
id: downloadButton
width: 15
height: 15
url: model.linkurl
backgroundColor: model.ownMessage?Colors.ownMessage:Colors.white
}
}
Rectangle {
......@@ -157,6 +144,7 @@ Item {
if (url === model.linkurl) {
Print.log("file match")
var linkurl = model.linkurl
downloadButton.state = "default"
if (showInline) {
if(path !== ""){
window.fileCache[model.linkurl] = pathPrefix + path
......
......@@ -120,7 +120,7 @@ Item {
}else{
imageBackground.visible=true
rocketChatController.getFileRessource(model.linkurl)
rocketChatController.getFileRessource(model.linkurl,"temp")
}
}
......@@ -148,30 +148,17 @@ Item {
source: "qrc:/res/stop.png"
}
}
Button {
id: downloadButton
font.family: Fonts.fontello.name
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
height: 15
onPressed: {
rocketChatController.getFileRessource(model.linkurl,"cache")
}
StdImageHighDPI{
anchors.centerIn: parent
source: "qrc:/res/download.svg";
height: 15
fillMode: Image.PreserveAspectFit
}
DownloadButton{
id: downloadButton
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 10
width: 15
height: 15
url: model.linkurl
backgroundColor: Colors.white
}
background: Rectangle {
anchors.leftMargin: 10
implicitWidth: 15
implicitHeight: 15
color: Colors.white
}
}
StyledText{
anchors.left: audioStop.right
anchors.verticalCenter: parent.verticalCenter
......@@ -238,6 +225,7 @@ Item {
busyIndicator.visible = false
player.play()
}else if(url === model.linkurl){
downloadButton.state = "default"
if(Qt.platform.os == "ios"){
rocketChatController.openFileExternally(pathPrefix + path)
}else{
......
import QtQuick 2.12
import QtQuick.Controls 2.12
import "qrc:/qml/style"
import "qrc:/qml/various"
import "qrc:/javascript/print.js" as Print
Button {
property string backgroundColor: Colors.white
property string url
states: [
State{
name: "default"
PropertyChanges{
target: downloadButtonImage
visible: true
}
PropertyChanges{
target: downloadButton
enabled: true
}
PropertyChanges{
target: downloadBusyIndicator
visible: false
}
},
State{
name: "downloading"
PropertyChanges{
target: downloadButtonImage
visible: false
}
PropertyChanges{
target: downloadButton
enabled: false
}
PropertyChanges{
target: downloadBusyIndicator
visible: true
}
}
]
state: "default"
id: downloadButton
font.family: Fonts.fontello.name
height: 30
onPressed: {
downloadButton.state = "downloading"
rocketChatController.getFileRessource(url,"cache")
}
StdImageHighDPI{
id:downloadButtonImage
anchors.centerIn: parent
source: "qrc:/res/download.svg";
height: 15
fillMode: Image.PreserveAspectFit
}
BusyIndicator{
id:downloadBusyIndicator
height: 30
width: 30
anchors.centerIn: parent
visible: false
}
background: Rectangle {
//anchors.leftMargin: 10
implicitWidth: 15
implicitHeight: 15
color: backgroundColor
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment