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");
|
||||
}
|
||||
}
|
||||
|
25
source-android/androidnative.pri/qml/AndroidNative/Toast.qml
Normal file
25
source-android/androidnative.pri/qml/AndroidNative/Toast.qml
Normal file
|
@ -0,0 +1,25 @@
|
|||
import QtQuick 2.0
|
||||
import AndroidNative 1.0
|
||||
|
||||
Item {
|
||||
/// The message that will be displayed when show() is called
|
||||
property string text: ''
|
||||
|
||||
/// If set to true, the toast duration will be long
|
||||
property bool longDuration: false
|
||||
|
||||
readonly property string m_TOAST_MESSAGE: "androidnative.Toast.showToast"
|
||||
|
||||
/// Displays the Toast with the current set text and duration
|
||||
function show() {
|
||||
SystemDispatcher.dispatch(m_TOAST_MESSAGE, {
|
||||
text: text,
|
||||
longLength: longDuration
|
||||
});
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
SystemDispatcher.loadClass("androidnative.Toast");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
import QtQuick 2.0
|
||||
import AndroidNative 1.0
|
||||
|
||||
Item {
|
||||
|
||||
/// Set it to true if multiple videos 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 videos chosen. If multiple videos are picked, it will be equal to the first videos.
|
||||
property string videoUrl: ""
|
||||
|
||||
/// The URL of the thumbnail of video chosen. If multiple videos are picked,
|
||||
// it will be equal to the thumbnail of first video.
|
||||
property string thumbUrl: ""
|
||||
|
||||
/// A list of videos chosen
|
||||
property var videoUrls: []
|
||||
|
||||
/// A list of thumbnails of videos chosen
|
||||
property var thumbUrls: []
|
||||
|
||||
/// It is emitted whatever photo(s) are picked/taken.
|
||||
signal ready();
|
||||
|
||||
function pickVideo() {
|
||||
SystemDispatcher.dispatch(m_PICK_VIDEO_MESSAGE,{ multiple: multiple });
|
||||
}
|
||||
|
||||
function takeVideo() {
|
||||
SystemDispatcher.dispatch(m_TAKE_VIDEO_MESSAGE,{ broadcast: broadcast });
|
||||
}
|
||||
|
||||
property string m_PICK_VIDEO_MESSAGE: "androidnative.VideoPicker.pickVideo";
|
||||
|
||||
property string m_TAKE_VIDEO_MESSAGE: "androidnative.VideoPicker.takeVideo";
|
||||
|
||||
property string m_CHOSEN_MESSAGE: "androidnative.VideoPicker.chosen";
|
||||
|
||||
|
||||
Connections {
|
||||
target: SystemDispatcher
|
||||
onDispatched: {
|
||||
if (type === m_CHOSEN_MESSAGE) {
|
||||
videoUrls = message.videoUrls;
|
||||
videoUrl = videoUrls[0];
|
||||
|
||||
thumbUrls = message.videoThumbUrls;
|
||||
thumbUrl = thumbUrls[0];
|
||||
|
||||
ready();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
SystemDispatcher.loadClass("androidnative.VideoPicker");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ImagePicker 1.0 ImagePicker.qml
|
||||
VideoPicker 1.0 VideoPicker.qml
|
||||
Toast 1.0 Toast.qml
|
Loading…
Add table
Add a link
Reference in a new issue