mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-19 03:42:52 +08:00
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera
This commit is contained in:
commit
05e3eed60e
@ -1,3 +1,24 @@
|
|||||||
|
<!--
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
-->
|
||||||
|
|
||||||
# Contributing to Apache Cordova
|
# Contributing to Apache Cordova
|
||||||
|
|
||||||
Anyone can contribute to Cordova. And we need your contributions.
|
Anyone can contribute to Cordova. And we need your contributions.
|
||||||
|
@ -80,3 +80,23 @@
|
|||||||
* CB-6212: [iOS] fix warnings compiled under arm64 64-bit
|
* CB-6212: [iOS] fix warnings compiled under arm64 64-bit
|
||||||
* [BlackBerry10] Add rim xml namespaces declaration
|
* [BlackBerry10] Add rim xml namespaces declaration
|
||||||
* Add NOTICE file
|
* Add NOTICE file
|
||||||
|
|
||||||
|
### 0.3.0 (Jun 05, 2014)
|
||||||
|
* CB-2083 documented saveToPhotoAlbum quirk on WP8
|
||||||
|
* CB-5895 documented saveToPhotoAlbum quirk on WP8
|
||||||
|
* Remove deprecated symbols for iOS < 6
|
||||||
|
* documentation translation: cordova-plugin-camera
|
||||||
|
* Lisa testing pulling in plugins for plugin: cordova-plugin-camera
|
||||||
|
* Lisa testing pulling in plugins for plugin: cordova-plugin-camera
|
||||||
|
* Lisa testing pulling in plugins for plugin: cordova-plugin-camera
|
||||||
|
* Lisa testing pulling in plugins for plugin: cordova-plugin-camera
|
||||||
|
* ubuntu: use application directory for images
|
||||||
|
* CB-6795 Add license
|
||||||
|
* Little fix in code formatting
|
||||||
|
* CB-6613 Use WinJS functionality to get base64-encoded content of image instead of File plugin functionality
|
||||||
|
* CB-6612 camera.getPicture now always returns encoded JPEG image
|
||||||
|
* Removed invalid note from CB-5398
|
||||||
|
* CB-6576 - Returns a specific error message when app has no access to library.
|
||||||
|
* CB-6491 add CONTRIBUTING.md
|
||||||
|
* CB-6546 android: Fix a couple bugs with allowEdit pull request
|
||||||
|
* CB-6546 android: Add support for allowEdit Camera option
|
||||||
|
@ -291,6 +291,9 @@ Optional parameters to customize the camera settings.
|
|||||||
|
|
||||||
- Ignores the `cameraDirection` parameter.
|
- Ignores the `cameraDirection` parameter.
|
||||||
|
|
||||||
|
- Ignores the `saveToPhotoAlbum` parameter. IMPORTANT: All images taken with the wp7/8 cordova camera API are always copied to the phone's camera roll. Depending on the user's settings, this could also mean the image is auto-uploaded to their OneDrive. This could potentially mean the image is available to a wider audience than your app intended. If this a blocker for your application, you will need to implement the CameraCaptureTask as documented on msdn : [http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006.aspx](http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006.aspx)
|
||||||
|
You may also comment or up-vote the related issue in the [issue tracker](https://issues.apache.org/jira/browse/CB-2083)
|
||||||
|
|
||||||
- Ignores the `mediaType` property of `cameraOptions` as the Windows Phone SDK does not provide a way to choose videos from PHOTOLIBRARY.
|
- Ignores the `mediaType` property of `cameraOptions` as the Windows Phone SDK does not provide a way to choose videos from PHOTOLIBRARY.
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||||
id="org.apache.cordova.camera"
|
id="org.apache.cordova.camera"
|
||||||
version="0.2.10-dev">
|
version="0.3.1-dev">
|
||||||
<name>Camera</name>
|
<name>Camera</name>
|
||||||
<description>Cordova Camera Plugin</description>
|
<description>Cordova Camera Plugin</description>
|
||||||
<license>Apache 2.0</license>
|
<license>Apache 2.0</license>
|
||||||
|
@ -151,13 +151,7 @@ static NSSet* org_apache_cordova_validArrowDirections;
|
|||||||
NSDictionary* options = [command.arguments objectAtIndex:10 withDefault:nil];
|
NSDictionary* options = [command.arguments objectAtIndex:10 withDefault:nil];
|
||||||
[self displayPopover:options];
|
[self displayPopover:options];
|
||||||
} else {
|
} else {
|
||||||
SEL selector = NSSelectorFromString(@"presentViewController:animated:completion:");
|
[self.viewController presentViewController:cameraPicker animated:YES completion:nil];
|
||||||
if ([self.viewController respondsToSelector:selector]) {
|
|
||||||
[self.viewController presentViewController:cameraPicker animated:YES completion:nil];
|
|
||||||
} else {
|
|
||||||
// deprecated as of iOS >= 6.0
|
|
||||||
[self.viewController presentModalViewController:cameraPicker animated:YES];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.hasPendingOperation = YES;
|
self.hasPendingOperation = YES;
|
||||||
}
|
}
|
||||||
@ -266,11 +260,7 @@ static NSSet* org_apache_cordova_validArrowDirections;
|
|||||||
cameraPicker.popoverController.delegate = nil;
|
cameraPicker.popoverController.delegate = nil;
|
||||||
cameraPicker.popoverController = nil;
|
cameraPicker.popoverController = nil;
|
||||||
} else {
|
} else {
|
||||||
if ([cameraPicker respondsToSelector:@selector(presentingViewController)]) {
|
[[cameraPicker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
|
||||||
[[cameraPicker presentingViewController] dismissModalViewControllerAnimated:YES];
|
|
||||||
} else {
|
|
||||||
[[cameraPicker parentViewController] dismissModalViewControllerAnimated:YES];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CDVPluginResult* result = nil;
|
CDVPluginResult* result = nil;
|
||||||
@ -386,12 +376,7 @@ static NSSet* org_apache_cordova_validArrowDirections;
|
|||||||
{
|
{
|
||||||
CDVCameraPicker* cameraPicker = (CDVCameraPicker*)picker;
|
CDVCameraPicker* cameraPicker = (CDVCameraPicker*)picker;
|
||||||
|
|
||||||
if ([cameraPicker respondsToSelector:@selector(presentingViewController)]) {
|
[[cameraPicker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
|
||||||
[[cameraPicker presentingViewController] dismissModalViewControllerAnimated:YES];
|
|
||||||
} else {
|
|
||||||
[[cameraPicker parentViewController] dismissModalViewControllerAnimated:YES];
|
|
||||||
}
|
|
||||||
// popoverControllerDidDismissPopover:(id)popoverController is called if popover is cancelled
|
|
||||||
|
|
||||||
CDVPluginResult* result;
|
CDVPluginResult* result;
|
||||||
if ([ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusAuthorized) {
|
if ([ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusAuthorized) {
|
||||||
|
@ -40,7 +40,6 @@ Rectangle {
|
|||||||
console.log(errorString);
|
console.log(errorString);
|
||||||
}
|
}
|
||||||
videoRecorder.audioBitRate: 128000
|
videoRecorder.audioBitRate: 128000
|
||||||
videoRecorder.mediaContainer: "mp4"
|
|
||||||
imageCapture {
|
imageCapture {
|
||||||
onImageSaved: {
|
onImageSaved: {
|
||||||
root.exec("Camera", "onImageSaved", [path]);
|
root.exec("Camera", "onImageSaved", [path]);
|
||||||
@ -100,7 +99,7 @@ Rectangle {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
camera.imageCapture.capture();
|
camera.imageCapture.captureToLocation(ui.parent.plugin('Camera').generateLocation("jpg"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ function createObject() { \
|
|||||||
component.statusChanged.connect(finishCreation); \
|
component.statusChanged.connect(finishCreation); \
|
||||||
} \
|
} \
|
||||||
function finishCreation() { \
|
function finishCreation() { \
|
||||||
CordovaWrapper.object = component.createObject(root, \
|
CordovaWrapper.global.cameraPluginWidget = component.createObject(root, \
|
||||||
{root: root, cordova: cordova}); \
|
{root: root, cordova: cordova}); \
|
||||||
} \
|
} \
|
||||||
createObject()";
|
createObject()";
|
||||||
@ -68,18 +68,15 @@ bool Camera::preprocessImage(QString &path) {
|
|||||||
|
|
||||||
const char *type;
|
const char *type;
|
||||||
if (convertToPNG) {
|
if (convertToPNG) {
|
||||||
newImage.setFileTemplate("imgXXXXXX.png");
|
path = generateLocation("png");
|
||||||
type = "png";
|
type = "png";
|
||||||
} else {
|
} else {
|
||||||
newImage.setFileTemplate("imgXXXXXX.jpg");
|
path = generateLocation("jpg");
|
||||||
type = "jpg";
|
type = "jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
newImage.open();
|
image.save(path, type, quality);
|
||||||
newImage.setAutoRemove(false);
|
|
||||||
image.save(newImage.fileName(), type, quality);
|
|
||||||
|
|
||||||
path = newImage.fileName();
|
|
||||||
oldImage.remove();
|
oldImage.remove();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -98,7 +95,7 @@ void Camera::onImageSaved(QString path) {
|
|||||||
cbParams = QString("\"%1\"").arg(content.data());
|
cbParams = QString("\"%1\"").arg(content.data());
|
||||||
image.remove();
|
image.remove();
|
||||||
} else {
|
} else {
|
||||||
cbParams = CordovaInternal::format(QUrl::fromLocalFile(absolutePath).toString());
|
cbParams = CordovaInternal::format(QString("file://localhost") + absolutePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +133,7 @@ void Camera::takePicture(int scId, int ecId, int quality, int destinationType, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Camera::cancel() {
|
void Camera::cancel() {
|
||||||
m_cordova->execQML("CordovaWrapper.object.destroy()");
|
m_cordova->execQML("CordovaWrapper.global.cameraPluginWidget.destroy()");
|
||||||
this->cb(_lastEcId, "canceled");
|
this->cb(_lastEcId, "canceled");
|
||||||
|
|
||||||
_lastEcId = _lastScId = 0;
|
_lastEcId = _lastScId = 0;
|
||||||
|
@ -54,6 +54,16 @@ public slots:
|
|||||||
|
|
||||||
void onImageSaved(QString path);
|
void onImageSaved(QString path);
|
||||||
|
|
||||||
|
QString generateLocation(const QString &extension) {
|
||||||
|
int i = 1;
|
||||||
|
for (;;++i) {
|
||||||
|
QString path = QString("%1/.local/share/%2/persistent/%3.%4").arg(QDir::homePath())
|
||||||
|
.arg(QCoreApplication::applicationName()).arg(i).arg(extension);
|
||||||
|
|
||||||
|
if (!QFileInfo(path).exists())
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
bool preprocessImage(QString &path);
|
bool preprocessImage(QString &path);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user