forked from lubuwest/Friendiqa
v0.1
This commit is contained in:
parent
591d55f43a
commit
fb560b54b1
115 changed files with 5537 additions and 0 deletions
|
@ -0,0 +1,53 @@
|
|||
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];
|
||||
ready();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
SystemDispatcher.loadClass("androidnative.ImagePicker");
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue