diff options
author | Christian Strømme <christian.stromme@digia.com> | 2014-01-30 13:16:03 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-07 10:24:19 +0100 |
commit | 2c9ca420bf3f8b32977a88e7923f18cc7557c613 (patch) | |
tree | 47adf53b131f529dd0fd0c8e9dc2a684e082b598 /src/androidextras | |
parent | 5c5b80e150896fc526836fa4ce96ac19d505c820 (diff) |
Add new method to get the main Android activity.
There were no public APIs the user could use to get access to
their applications main activity, and thus far the only solution have
been to access undocumented and private APIs.
[ChangeLog][QtAndroidExtras] Added functionality to get the Android main
activity.
Change-Id: Ifd4121e8bc643360ed7a7038ffae9e872b59db71
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/androidextras')
-rw-r--r-- | src/androidextras/android/android.pri | 4 | ||||
-rw-r--r-- | src/androidextras/android/qandroidfunctions.cpp | 69 | ||||
-rw-r--r-- | src/androidextras/android/qandroidfunctions.h | 61 | ||||
-rw-r--r-- | src/androidextras/androidextras.pro | 2 | ||||
-rw-r--r-- | src/androidextras/doc/qtandroidextras.qdocconf | 8 | ||||
-rw-r--r-- | src/androidextras/doc/src/qtandroidextras-index.qdoc | 2 |
6 files changed, 142 insertions, 4 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 |