summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosfileenginefactory.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-01-14 15:05:22 +0100
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-02-15 11:11:52 +0000
commit66a61c7d2cfc55eca56c410489f84ab3a2a8ac16 (patch)
treef90d7906230c6e651ec049af5bc935c0181f09f4 /src/plugins/platforms/ios/qiosfileenginefactory.h
parent0b7ec36816edd6093af37e005b20fe9561b4944e (diff)
iOS: add a file engine to support loading assets/photos
This patch will add a new file engine that lets the app load images from the asset library using QFile. The engine will recognize file names with the scheme 'assets-library', which is the same scheme returned by UIImagePickerController. This patch will be the first of a set of patches that lets the user open a native image picker dialog by using a QFileDialog with directory set to QStandardPaths::PictureLocation. This patch will ensure that the url returned from the dialog can be loaded using QFile. AssetsLibrary, which is used in this patch, is actually deprecated in favor of the new Photos framework. But since the latter is only supported from iOS8, we choose to use the former framework for now. Change-Id: If2a6eb394ae4df55fb4e9e1dc245a1574d38618a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosfileenginefactory.h')
-rw-r--r--src/plugins/platforms/ios/qiosfileenginefactory.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosfileenginefactory.h b/src/plugins/platforms/ios/qiosfileenginefactory.h
new file mode 100644
index 0000000000..cba5818e51
--- /dev/null
+++ b/src/plugins/platforms/ios/qiosfileenginefactory.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QIOSFILEENGINEFACTORY_H
+#define QIOSFILEENGINEFACTORY_H
+
+#include <QtCore/qstandardpaths.h>
+#include <QtCore/private/qabstractfileengine_p.h>
+#include "qiosfileengineassetslibrary.h"
+
+class QIOSFileEngineFactory : public QAbstractFileEngineHandler
+{
+public:
+ QAbstractFileEngine* create(const QString &fileName) const
+ {
+ static QLatin1String assetsScheme("assets-library:");
+
+ if (fileName.toLower().startsWith(assetsScheme))
+ return new QIOSFileEngineAssetsLibrary(fileName);
+
+ return 0;
+ }
+};
+
+#endif // QIOSFILEENGINEFACTORY_H