Friendiqa v0.2
This commit is contained in:
parent
74fb551755
commit
a3be940192
123 changed files with 9156 additions and 2455 deletions
59
source-linux/qml/genericqml/ImagePicker.qml
Normal file
59
source-linux/qml/genericqml/ImagePicker.qml
Normal file
|
@ -0,0 +1,59 @@
|
|||
import QtQuick 2.0
|
||||
import AndroidNative 1.0
|
||||
|
||||
Item {
|
||||
|
||||
/// Set it to true if multiple images should be picked.
|
||||
property bool multiple: false
|
||||
|
||||
/// If it is true, it will broadcast the taked photo to other application (e.g Let it show in Google Photos)
|
||||
property bool broadcast: true
|
||||
|
||||
/// The URL of the image chosen. If multiple images are picked, it will be equal to the first image.
|
||||
property string imageUrl: ""
|
||||
|
||||
/// A list of images chosen
|
||||
property var imageUrls: []
|
||||
|
||||
/// It is emitted whatever photo(s) are picked/taken.
|
||||
signal ready();
|
||||
|
||||
function pickImage() {
|
||||
SystemDispatcher.dispatch(m_PICK_IMAGE_MESSAGE,{ multiple: multiple});
|
||||
}
|
||||
|
||||
function takePhoto() {
|
||||
SystemDispatcher.dispatch(m_TAKE_PHOTO_MESSAGE,{
|
||||
broadcast: broadcast
|
||||
})
|
||||
}
|
||||
|
||||
property string m_PICK_IMAGE_MESSAGE: "androidnative.ImagePicker.pickImage";
|
||||
|
||||
property string m_TAKE_PHOTO_MESSAGE: "androidnative.ImagePicker.takePhoto";
|
||||
|
||||
property string m_CHOSEN_MESSAGE: "androidnative.ImagePicker.chosen";
|
||||
|
||||
|
||||
Connections {
|
||||
target: SystemDispatcher
|
||||
onDispatched: {
|
||||
if (type === m_CHOSEN_MESSAGE) {
|
||||
//imageUrls = message.imageUrls;
|
||||
//imageUrl = imageUrls[0];
|
||||
var h=[];
|
||||
for (var n in message.imageUrls){
|
||||
h.push("file://"+ decodeURIComponent(message.imageUrls[n]).substring(5))
|
||||
}
|
||||
imageUrls=h;
|
||||
imageUrl=h[0];
|
||||
ready();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
SystemDispatcher.loadClass("androidnative.ImagePicker");
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue