Version 0.003
This commit is contained in:
parent
9f9a9f618c
commit
10dccdcdbb
572 changed files with 3711 additions and 13631 deletions
102
source-linux/qml/photoqml/PhotoComponent.qml
Normal file
102
source-linux/qml/photoqml/PhotoComponent.qml
Normal file
|
@ -0,0 +1,102 @@
|
|||
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
|
||||
}
|
||||
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
|
||||
onClicked: {
|
||||
if (albumWrapper.state == 'inGrid') {
|
||||
gridItem.GridView.view.currentIndex = index;
|
||||
albumWrapper.state = 'fullscreen'
|
||||
} else {
|
||||
gridItem.GridView.view.currentIndex = index;
|
||||
albumWrapper.state = 'inGrid'
|
||||
}
|
||||
}
|
||||
}
|
||||
PinchArea {
|
||||
id:imagePinch
|
||||
pinch.target: realImage
|
||||
anchors.fill: realImage
|
||||
pinch.minimumScale: 0.1
|
||||
pinch.maximumScale: 10
|
||||
enabled: false
|
||||
}
|
||||
|
||||
// onStateChanged: print("State"+photoWrapper.state+index)
|
||||
states: [
|
||||
State {
|
||||
name: 'stacked'; when: albumWrapper.state == ''
|
||||
ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm }
|
||||
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
|
||||
PropertyChanges { target: phototext; opacity: 0.0 }
|
||||
PropertyChanges { target: phototextRectangle; opacity: 0.0 }
|
||||
},
|
||||
State {
|
||||
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 }
|
||||
PropertyChanges { target: realImage; source: photoWrapper.hqphotolink}
|
||||
PropertyChanges { target: phototext; anchors.bottom: realImage.bottom}
|
||||
PropertyChanges { target: phototext; width:realImage.width }
|
||||
PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom }
|
||||
PropertyChanges { target: imagePinch; enabled:true}
|
||||
// PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
183
source-linux/qml/photoqml/PhotoTab.qml
Normal file
183
source-linux/qml/photoqml/PhotoTab.qml
Normal file
|
@ -0,0 +1,183 @@
|
|||
import QtQuick 2.0
|
||||
//import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQml.Models 2.1
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/photoqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
id:fotorectangle
|
||||
|
||||
y:1
|
||||
width:root.width-mm
|
||||
height:root.height-5*mm
|
||||
color: '#fff'
|
||||
property var newimages:[]
|
||||
property int currentimageno: 0
|
||||
|
||||
onNewimagesChanged:{
|
||||
if(newimages.length>0){
|
||||
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
|
||||
for (var i=0;i<newimages.length;i++){
|
||||
if(albums.indexOf(newimages[i].album)==-1){
|
||||
filesystem.Directory=root.login.imagestore+"/albums";
|
||||
filesystem.makeDir(newimages[i].album)}}
|
||||
})
|
||||
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
|
||||
newImagesProgress.visible=true //download first image
|
||||
}
|
||||
}
|
||||
|
||||
onCurrentimagenoChanged:{
|
||||
if(currentimageno<newimages.length){Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab)};
|
||||
if(currentimageno==newimages.length){newImagesProgress.visible=false;showFotos("");
|
||||
newimages=[];currentimageno=0}
|
||||
// download next image
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onDownloaded:{if(data=="picture"){currentimageno=currentimageno+1}}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{if(data=="picture"){print("Error"+data);
|
||||
currentimageno=currentimageno+1}}
|
||||
}
|
||||
|
||||
function showFotos(friend){
|
||||
if(friend=="backButton"){
|
||||
if(!albumgridview.currentItem){root.currentIndex=0}
|
||||
if(albumgridview.currentItem.state=='fullscreen'){
|
||||
albumgridview.currentItem.state = 'inGrid'}
|
||||
else if (albumgridview.currentItem.state == 'inGrid'){albumgridview.currentItem.state=''}
|
||||
else{root.currentIndex=0}
|
||||
}
|
||||
else{
|
||||
try {photogroupModel.clear()}catch (e){print(e)}
|
||||
if (friend){
|
||||
Service.requestFriendsAlbumPictures(login,friend,fotostab,function(albums){
|
||||
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}
|
||||
photoWorker.sendMessage(msg);
|
||||
})
|
||||
phototabstatusButton.text=qsTr(friend.screen_name.toString())+qsTr("'s images")
|
||||
|
||||
}
|
||||
else {
|
||||
Helperjs.readField("album", root.db, "imageData",login.username,function(albums){
|
||||
if (albums[0]) {
|
||||
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
|
||||
photoWorker.sendMessage(msg);
|
||||
}
|
||||
})
|
||||
}}
|
||||
}
|
||||
|
||||
ProgressBar{
|
||||
id: newImagesProgress
|
||||
width: 15*mm
|
||||
height: updatePhotolist.height
|
||||
anchors.top: parent.top
|
||||
anchors.right:updatePhotolist.left
|
||||
anchors.rightMargin:mm
|
||||
visible: false
|
||||
value: currentimageno/newimages.length
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id: updatePhotolist
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right:phototabstatusButton.left
|
||||
anchors.rightMargin:mm
|
||||
text:"\uf021"
|
||||
onClicked: {
|
||||
Service.requestList(root.login,root.db, fotostab,function(obj){
|
||||
newimages=obj;print("newimages"+JSON.stringify(obj))
|
||||
})}}
|
||||
|
||||
BlueButton{
|
||||
id: phototabstatusButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin:2*mm
|
||||
text: qsTr(phototabstatus)
|
||||
onClicked: {phototabmenu.popup()}
|
||||
}
|
||||
Menu {
|
||||
id:phototabmenu
|
||||
MenuItem {
|
||||
text: qsTr("Own Images")
|
||||
onTriggered: {
|
||||
fotostab.phototabstatus="Images";
|
||||
phototabstatusButton.text=qsTr("own images");
|
||||
showFotos("")}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateModel{
|
||||
id: visualphotoModel
|
||||
delegate: PhotogroupComponent{}
|
||||
model: photogroupModel
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: photogroupModel
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: albumgridview
|
||||
cellWidth: 17*mm
|
||||
cellHeight: 17*mm
|
||||
x: mm;y:8*mm
|
||||
width: parent.width-2*mm; height: parent.height-9*mm
|
||||
clip: true
|
||||
model: visualphotoModel.parts.album
|
||||
footer:Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:12*mm
|
||||
height:6*mm
|
||||
Text{
|
||||
font.pixelSize: 1.5*mm
|
||||
anchors.centerIn: parent
|
||||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{anchors.fill:parent
|
||||
onClicked:{
|
||||
var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
|
||||
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){
|
||||
Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
|
||||
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}
|
||||
photoWorker.sendMessage(msg)
|
||||
})}
|
||||
else{Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
|
||||
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
|
||||
photoWorker.sendMessage(msg)})}
|
||||
}}}
|
||||
}
|
||||
|
||||
Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
|
||||
|
||||
ListView { width: parent.width; height:parent.height; model: visualphotoModel.parts.browser; interactive: false }
|
||||
|
||||
BlueButton {
|
||||
id: backButton
|
||||
text: "\uf057"
|
||||
x: parent.width - backButton.width - 3*mm
|
||||
y: -backButton.height - 4*mm
|
||||
z:2
|
||||
onClicked: {photoBackground.opacity=0}
|
||||
}
|
||||
|
||||
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
|
||||
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
|
||||
|
||||
Component.onCompleted: { root.fotoSignal.connect(showFotos);
|
||||
if (fotostab.phototabstatus=="Images"){showFotos("")}
|
||||
}
|
||||
}
|
117
source-linux/qml/photoqml/PhotogroupComponent.qml
Normal file
117
source-linux/qml/photoqml/PhotogroupComponent.qml
Normal file
|
@ -0,0 +1,117 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQml.Models 2.1
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
|
||||
Package {
|
||||
Item {
|
||||
Package.name: 'browser'
|
||||
GridView {
|
||||
id: photosGridView; model: visualModel.parts.grid; width: albumgridview.width; height: albumgridview.height;y:albumgridview.y
|
||||
cellWidth: 16.5*mm; cellHeight: 16.5*mm; interactive: false//anchors.margins:2*mm
|
||||
onCurrentIndexChanged: photosListView.positionViewAtIndex(currentIndex, ListView.Contain)
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Package.name: 'fullscreen'
|
||||
ListView {
|
||||
id: photosListView; model: visualModel.parts.list; orientation: Qt.Horizontal
|
||||
width: albumgridview.width; height: albumgridview.height; //y:albumgridview.y
|
||||
//width: parent.width; height: parent.height;
|
||||
interactive: false
|
||||
onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain)
|
||||
highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Package.name: 'album'
|
||||
id: albumWrapper; width: 16.5*mm; height: 16.5*mm
|
||||
DelegateModel {
|
||||
id: visualModel; delegate: PhotoComponent { }
|
||||
model: photoModel
|
||||
}
|
||||
|
||||
PathView {
|
||||
id: photosPathView;
|
||||
model: visualModel.parts.stack;
|
||||
pathItemCount: 1
|
||||
anchors.centerIn: parent;
|
||||
path: Path {
|
||||
PathAttribute { name: 'z'; value: 9999.0 }
|
||||
PathLine { x: 1; y: 1 }
|
||||
PathAttribute { name: 'z'; value: 0.0 }
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
color:"black"
|
||||
opacity: 0.5
|
||||
width:albumtext.contentWidth
|
||||
height: albumtext.contentHeight
|
||||
anchors.bottom: albumWrapper.bottom
|
||||
}
|
||||
Text {
|
||||
id:albumtext
|
||||
text: albumname
|
||||
width:albumWrapper.width-1*mm
|
||||
height: albumtext.contentHeight
|
||||
wrapMode:Text.Wrap
|
||||
color: "white"
|
||||
font.family: "Monospace"
|
||||
font.pixelSize: 2*mm
|
||||
anchors.bottom: albumWrapper.bottom
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: photoModel
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
try {photoModel.clear()}catch (e){print(e)}
|
||||
if(foreignPicture){
|
||||
Service.requestFriendsPictures(albumlink,fotostab,function(obj){
|
||||
if (obj) {
|
||||
for (var k=0;k<obj.length;k++){
|
||||
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link})
|
||||
}
|
||||
}
|
||||
})}
|
||||
else{
|
||||
Helperjs.readData(db,"imageData",root.login.username,function(obj){
|
||||
if (obj) {
|
||||
for (var k=0;k<obj.length;k++){
|
||||
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":obj[k].filename,"photoLink":obj[k].location+obj[k].filename})
|
||||
}
|
||||
}
|
||||
},"album",albumname)}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: albumWrapper.state = 'inGrid'
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: 'inGrid'
|
||||
PropertyChanges { target: photosGridView; interactive: true }
|
||||
PropertyChanges { target: photoBackground; opacity: 1 }
|
||||
PropertyChanges { target: backButton; onClicked: albumWrapper.state = ''; y: 6 }
|
||||
},
|
||||
State {
|
||||
name: 'fullscreen'; extend: 'inGrid'
|
||||
PropertyChanges { target: photosGridView; interactive: false }
|
||||
PropertyChanges { target: photosListView; interactive: true }
|
||||
PropertyChanges { target: photoBackground; opacity: 1 }
|
||||
PropertyChanges { target: backButton;onClicked:{
|
||||
albumWrapper.state = 'inGrid'}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
} //album Ende
|
||||
} //Package Ende
|
||||
//item Ende
|
Loading…
Add table
Add a link
Reference in a new issue