Friendiqa v0.2
This commit is contained in:
parent
74fb551755
commit
a3be940192
123 changed files with 9156 additions and 2455 deletions
186
source-android/qml/genericqml/ImagePickerLinux.qml
Normal file
186
source-android/qml/genericqml/ImagePickerLinux.qml
Normal file
|
@ -0,0 +1,186 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations including
|
||||
// the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for all
|
||||
// of the code used other than OpenSSL. If you modify file(s) with this
|
||||
// exception, you may extend this exception to your version of the
|
||||
// file(s), but you are not obligated to do so. If you do not wish to do
|
||||
// so, delete this exception statement from your version. If you delete
|
||||
// this exception statement from all source files in the program, then
|
||||
// also delete it here.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import Qt.labs.folderlistmodel 2.1
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
id:imageDialog
|
||||
z:2
|
||||
border.color: "grey"
|
||||
width: parent.width-4*mm
|
||||
height:parent.height-12*mm
|
||||
x:2*mm
|
||||
y:10*mm
|
||||
property string directory: ""
|
||||
property bool multiple: false
|
||||
property string imageUrl: ""
|
||||
property var imageUrls: []
|
||||
signal ready();
|
||||
function pickImage() {}
|
||||
|
||||
Text{
|
||||
id:directoryText
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
width: imageDialog.width-15*mm
|
||||
height:contentHeight
|
||||
wrapMode: Text.Wrap
|
||||
text: directory
|
||||
}
|
||||
BlueButton{
|
||||
id:closeButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked:{ready();imageDialog.destroy()}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: imageView
|
||||
x:0.5*mm
|
||||
y: Math.max(directoryText.height, closeButton.height)+mm
|
||||
width: imageDialog.width-2*mm
|
||||
height: imageDialog.height-imageView.y-4*mm
|
||||
clip: true
|
||||
model: imageModel
|
||||
delegate: imageItem
|
||||
}
|
||||
|
||||
FolderListModel{
|
||||
id: imageModel
|
||||
nameFilters: ["*.png", "*.jpg",".jpeg","*.JPG","*.gif"]
|
||||
sortField: FolderListModel.Time
|
||||
sortReversed:false
|
||||
showDotAndDotDot: true
|
||||
showDirs: true
|
||||
showDirsFirst: true
|
||||
folder:directory
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: imageBusy
|
||||
anchors.horizontalCenter: imageView.horizontalCenter
|
||||
anchors.top:imageView.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running:false
|
||||
}
|
||||
|
||||
Component{
|
||||
id:imageItem
|
||||
Item{
|
||||
width:imageView.width
|
||||
height:folderImage.height+2*mm
|
||||
Rectangle{
|
||||
id:imagetextRectangle
|
||||
color:"black"
|
||||
x:mm
|
||||
z:3
|
||||
opacity: fileIsDir?0:0.5
|
||||
width:imagetext.contentWidth
|
||||
height: imagetext.contentHeight
|
||||
anchors.bottom: folderImage.bottom
|
||||
}
|
||||
Text {
|
||||
id:imagetext
|
||||
x:fileIsDir?11*mm:mm
|
||||
z:4
|
||||
text: fileName
|
||||
width: fileIsDir?parent.width - 12*mm :imageView.width-mm
|
||||
anchors.bottom: folderImage.bottom
|
||||
color: fileIsDir?"black":"white"
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode:Text.Wrap
|
||||
}
|
||||
Text {
|
||||
id:selected
|
||||
anchors.right:parent.right
|
||||
visible: attachImageURLs.indexOf(fileURL)>-1
|
||||
z:4
|
||||
text: "\u2713"
|
||||
width: 10*mm
|
||||
anchors.top: folderImage.top
|
||||
color: "green"
|
||||
font.pixelSize: 10*mm
|
||||
}
|
||||
|
||||
Image{id:folderImage
|
||||
width: fileIsDir?10*mm: imageView.width-mm
|
||||
fillMode:Image.PreserveAspectFit
|
||||
source:fileIsDir?"qrc:/images/folder-blue.png":fileURL
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
if (fileName==".."){
|
||||
imageModel.folder=imageModel.parentFolder;
|
||||
directory=imageModel.parentFolder
|
||||
}
|
||||
else if (fileIsDir){
|
||||
imageModel.folder=fileURL;
|
||||
directory=fileURL
|
||||
}
|
||||
else{
|
||||
if (multiple!=true){
|
||||
//attachImageURLs.push(fileURL);
|
||||
//attachImage(fileURL);
|
||||
imageUrls.push(fileURL);
|
||||
imageUrl=fileURL;
|
||||
ready();
|
||||
imageDialog.destroy()
|
||||
}
|
||||
else {
|
||||
if(selected.visible==true){
|
||||
imageUrls.splice(imageUrls.indexOf(fileURL,1))
|
||||
selected.visible=false
|
||||
}
|
||||
else{
|
||||
imageUrls.push(fileURL);
|
||||
selected.visible=true;
|
||||
|
||||
}
|
||||
imageUrl=fileURL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue