aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/androidextras/android/android.pri4
-rw-r--r--src/androidextras/android/qandroidfunctions.cpp69
-rw-r--r--src/androidextras/android/qandroidfunctions.h61
-rw-r--r--src/androidextras/androidextras.pro2
-rw-r--r--src/androidextras/doc/qtandroidextras.qdocconf8
-rw-r--r--src/androidextras/doc/src/qtandroidextras-index.qdoc2
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/qandroidfunctions/qandroidfunctions.pro4
-rw-r--r--tests/auto/qandroidfunctions/tst_qandroidfunctions.cpp61
9 files changed, 209 insertions, 5 deletions
diff --git a/src/androidextras/android/android.pri b/src/androidextras/android/android.pri
new file mode 100644
index 0000000..5869312
--- /dev/null
+++ b/src/androidextras/android/android.pri
@@ -0,0 +1,4 @@
+SOURCES += \
+ $$PWD/qandroidfunctions.cpp
+HEADERS += \
+ $$PWD/qandroidfunctions.h \ No newline at end of file
diff --git a/src/androidextras/android/qandroidfunctions.cpp b/src/androidextras/android/qandroidfunctions.cpp
new file mode 100644
index 0000000..55bc50a
--- /dev/null
+++ b/src/androidextras/android/qandroidfunctions.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part 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$
+**
+****************************************************************************/
+
+#include "qandroidfunctions.h"
+
+#include <QtCore/private/qjnihelpers_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \namespace QtAndroid
+ \inmodule QtAndroidExtras
+ \since 5.3
+ \brief The QtAndroid namespace provides miscellaneous functions to aid Android development.
+ \inheaderfile QtAndroid
+*/
+
+/*!
+ \since 5.3
+ \fn QAndroidJniObject QtAndroid::androidActivity()
+
+ Returns a handle to this applications main Activity
+
+ \sa QAndroidJniObject
+*/
+QAndroidJniObject QtAndroid::androidActivity()
+{
+ return QtAndroidPrivate::activity();
+}
+
+QT_END_NAMESPACE
diff --git a/src/androidextras/android/qandroidfunctions.h b/src/androidextras/android/qandroidfunctions.h
new file mode 100644
index 0000000..ffd7c3b
--- /dev/null
+++ b/src/androidextras/android/qandroidfunctions.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part 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 QANDROIDFUNCTIONS_H
+#define QANDROIDFUNCTIONS_H
+
+#if 0
+#pragma qt_class(QtAndroid)
+#endif
+
+#include <QtAndroidExtras/qandroidextrasglobal.h>
+#include <QtAndroidExtras/qandroidjniobject.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtAndroid
+{
+ Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject androidActivity();
+}
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDFUNCTIONS_H
diff --git a/src/androidextras/androidextras.pro b/src/androidextras/androidextras.pro
index 24d4371..78bd8eb 100644
--- a/src/androidextras/androidextras.pro
+++ b/src/androidextras/androidextras.pro
@@ -4,5 +4,7 @@ QMAKE_DOCS = \
$$PWD/doc/qtandroidextras.qdocconf
QT -= gui
QT += core-private
+
load(qt_module)
include(jni/jni.pri)
+include(android/android.pri)
diff --git a/src/androidextras/doc/qtandroidextras.qdocconf b/src/androidextras/doc/qtandroidextras.qdocconf
index c1f7806..ab6b5d0 100644
--- a/src/androidextras/doc/qtandroidextras.qdocconf
+++ b/src/androidextras/doc/qtandroidextras.qdocconf
@@ -1,5 +1,7 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+Cpp.ignoretokens += Q_ANDROIDEXTRAS_EXPORT
+
project = QtAndroidExtras
description = Qt Android Extras Reference Documentation
url = http://qt-project.org/doc/qt-$QT_VER
@@ -19,10 +21,10 @@ qhp.QtAndroidExtras.filterAttributes = qtandroidextras $QT_VERSION qtrefdoc
qhp.QtAndroidExtras.customFilters.Qt.name = QtAndroidExtras $QT_VERSION
qhp.QtAndroidExtras.customFilters.Qt.filterAttributes = qtandroidextras $QT_VERSION
-qhp.QtAndroidExtras.subprojects = classes
-qhp.QtAndroidExtras.subprojects.classes.title = C++ Classes
+qhp.QtAndroidExtras.subprojects = classes examples
+qhp.QtAndroidExtras.subprojects.classes.title = C++ Classes and Namespaces
qhp.QtAndroidExtras.subprojects.classes.indexTitle = Qt Android Extras C++ Classes
-qhp.QtAndroidExtras.subprojects.classes.selectors = class fake:headerfile
+qhp.QtAndroidExtras.subprojects.classes.selectors = class function namespace fake:headerfile
qhp.QtAndroidExtras.subprojects.classes.sortPages = true
qhp.QtAndroidExtras.subprojects.examples.title = Examples
qhp.QtAndroidExtras.subprojects.examples.indexTitle = Qt Android Extras Examples
diff --git a/src/androidextras/doc/src/qtandroidextras-index.qdoc b/src/androidextras/doc/src/qtandroidextras-index.qdoc
index 74ca249..c9eaadb 100644
--- a/src/androidextras/doc/src/qtandroidextras-index.qdoc
+++ b/src/androidextras/doc/src/qtandroidextras-index.qdoc
@@ -50,7 +50,7 @@
Links to the API reference materials:
\list
- \li \l{Qt Android Extras C++ Classes}{C++ Classes}
+ \li \l{Qt Android Extras C++ Classes}{C++ Classes and Namespaces}
\endlist
\section1 Examples
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 94b6dd8..bf54603 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -2,4 +2,5 @@ TEMPLATE = subdirs
SUBDIRS += \
cmake \
qandroidjnienvironment \
- qandroidjniobject
+ qandroidjniobject \
+ qandroidfunctions
diff --git a/tests/auto/qandroidfunctions/qandroidfunctions.pro b/tests/auto/qandroidfunctions/qandroidfunctions.pro
new file mode 100644
index 0000000..813b214
--- /dev/null
+++ b/tests/auto/qandroidfunctions/qandroidfunctions.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qandroidfunctions
+QT += testlib androidextras
+SOURCES += tst_qandroidfunctions.cpp
diff --git a/tests/auto/qandroidfunctions/tst_qandroidfunctions.cpp b/tests/auto/qandroidfunctions/tst_qandroidfunctions.cpp
new file mode 100644
index 0000000..9f6bfd9
--- /dev/null
+++ b/tests/auto/qandroidfunctions/tst_qandroidfunctions.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite 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$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtAndroidExtras/QtAndroid>
+
+class tst_QAndroidFunctions : public QObject
+{
+ Q_OBJECT
+private slots:
+ void testAndroidActivity();
+};
+
+void tst_QAndroidFunctions::testAndroidActivity()
+{
+ QAndroidJniObject activity = QtAndroid::androidActivity();
+ QVERIFY(activity.isValid());
+ QVERIFY(activity.callMethod<jboolean>("isTaskRoot"));
+}
+
+QTEST_APPLESS_MAIN(tst_QAndroidFunctions)
+
+#include "tst_qandroidfunctions.moc"