2017-01-26 21:55:31 +01:00
import QtQuick 2.0
import QtQuick . Controls 1.2
Package {
Item { id: stackItem ; Package.name: 'stack' ; z: stackItem . PathView . z ; width: 16.5 * mm ; height: 16.5 * mm }
Item { id: listItem ; Package.name: 'list' ; width: root . width - 1 * mm ; height: root . height - 8 * mm ; }
Item { id: gridItem ; Package.name: 'grid' ; }
Item {
id: photoWrapper
width: 16.5 * mm ; height: 16.5 * mm
z: stackItem . PathView . z
property string hqphotolink: photoLink
Rectangle {
id: placeHolder
color: 'lightblue' ; antialiasing: true
anchors.fill: parent
2017-01-29 17:26:09 +01:00
}
BusyIndicator { anchors.centerIn: parent ; running: realImage . status != Image . Ready }
Image {
id: realImage ;
width: photoWrapper . width ; height: photoWrapper . height
antialiasing: true ;
asynchronous: true
cache: false
fillMode: Image . PreserveAspectFit ;
source: imageLocation
}
Rectangle {
id:phototextRectangle
color: "black"
z: 3
opacity: 0.5
width: phototext . contentWidth
height: phototext . contentHeight
anchors.bottom: photoWrapper . bottom
}
Text {
id:phototext
z: 4
text: photoDescription . trim ( )
width: 15 * mm
anchors.bottom: photoWrapper . bottom
color: "white"
font.pixelSize: 2 * mm
wrapMode: Text . Wrap
}
MouseArea {
width: realImage . paintedWidth ; height: realImage . paintedHeight ; anchors.centerIn: realImage
2017-11-07 21:57:40 +01:00
onPressAndHold: { print ( "Pressed" ) ;
var menuString = "import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('image','" + imageLocation + "');photoModel.remove(index)}}}" ;
print ( menuString ) ;
var imagemenuObject = Qt . createQmlObject ( menuString , photoWrapper , "imagemenuOutput" )
imagemenuObject . popup ( )
}
onClicked: {
2017-01-29 17:26:09 +01:00
if ( albumWrapper . state == 'inGrid' ) {
gridItem . GridView . view . currentIndex = index ;
2017-11-07 21:57:40 +01:00
albumWrapper . state = 'fullscreen' ;
listItem . ListView . view . currentIndex = index
2017-01-29 17:26:09 +01:00
} else {
gridItem . GridView . view . currentIndex = index ;
albumWrapper . state = 'inGrid'
2017-01-26 21:55:31 +01:00
}
2017-01-29 17:26:09 +01:00
}
}
2017-03-25 23:36:14 +01:00
PinchArea {
id:imagePinch
pinch.target: realImage
anchors.fill: realImage
pinch.minimumScale: 0.1
pinch.maximumScale: 10
enabled: false
}
2017-01-26 21:55:31 +01:00
2017-03-25 23:36:14 +01:00
// onStateChanged: print("State"+photoWrapper.state+index)
2017-01-29 17:26:09 +01:00
states: [
State {
name: 'stacked' ; when: albumWrapper . state == ''
2017-01-26 21:55:31 +01:00
ParentChange { target: photoWrapper ; parent: stackItem ; } //x: 1*mm; y: 1*mm }
2017-01-29 17:26:09 +01:00
PropertyChanges { target: photoWrapper ; opacity: stackItem . PathView . onPath ? 1.0 : 0.0 }
PropertyChanges { target: phototext ; opacity: 0.0 }
PropertyChanges { target: phototextRectangle ; opacity: 0.0 }
} ,
State {
2017-01-26 21:55:31 +01:00
name: 'inGrid' ; when: albumWrapper . state == 'inGrid'
ParentChange { target: photoWrapper ; parent: gridItem ; x: 1 * mm ; y: 1 * mm ; }
PropertyChanges { target: phototext ; opacity: 1.0 }
PropertyChanges { target: phototextRectangle ; opacity: 0.5 }
PropertyChanges { target: placeHolder ; opacity: 1.0 }
} ,
State {
name: 'fullscreen' ; when: albumWrapper . state == 'fullscreen'
ParentChange {
target: photoWrapper ; parent: listItem ; x: 1 ; y: 1 ;
width: root . width - mm ; height: root . height - 8 * mm
}
PropertyChanges { target: placeHolder ; opacity: 0.0 }
2017-01-29 17:26:09 +01:00
PropertyChanges { target: realImage ; source: photoWrapper . hqphotolink }
2017-01-26 21:55:31 +01:00
PropertyChanges { target: phototext ; anchors.bottom: realImage . bottom }
PropertyChanges { target: phototext ; width: realImage . width }
PropertyChanges { target: phototextRectangle ; anchors.bottom: realImage . bottom }
2017-03-25 23:36:14 +01:00
PropertyChanges { target: imagePinch ; enabled: true }
// PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) }
2017-01-26 21:55:31 +01:00
}
2017-01-29 17:26:09 +01:00
]
}
2017-01-26 21:55:31 +01:00
}