MauiKit Controls

mauiandroid.h
1/*
2 * Copyright 2018 Camilo Higuita <milo.h@aol.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#pragma once
21
22#include <QObject>
23#include <QQmlEngine>
24
25#include <QAndroidActivityResultReceiver>
26#include <QAndroidJniEnvironment>
27#include <QAndroidJniObject>
28#include <QObject>
29#include <QString>
30#include <QStringList>
31#include <QVariantList>
32#include <QtAndroid>
33
34#include "abstractplatform.h"
35
36/**
37 * @brief The MAUIAndroid class
38 */
39class Q_DECL_EXPORT MAUIAndroid : public AbstractPlatform
40{
41 Q_OBJECT
42 QML_NAMED_ELEMENT(Android)
43 QML_SINGLETON
44// Q_DISABLE_COPY(MAUIAndroid)
45 Q_DISABLE_MOVE(MAUIAndroid)
46
47public:
48 explicit MAUIAndroid(QObject *parent = nullptr);
49
50// static MAUIAndroid *instance()
51// {
52// if (m_instance)
53// return m_instance;
54
55// m_instance = new MAUIAndroid;
56// return m_instance;
57// }
58
59 /**
60 * @brief fileChooser
61 */
62 static void fileChooser();
63
64 static QVariantList transform(const QAndroidJniObject &obj);
65 static QVariantMap createVariantMap(jobject data);
66
67private:
68// static MAUIAndroid *m_instance;
69 void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data);
70
71
72public Q_SLOTS:
73
74 /**
75 * @brief statusbarColor
76 * @param bg
77 * @param light
78 */
79 static void statusbarColor(const QString &bg, const bool &light);
80
81 /**
82 * @brief navBarColor
83 * @param bg
84 * @param light
85 */
86 static void navBarColor(const QString &bg, const bool &light);
87
88 /**
89 * @brief shareFiles
90 * @param urls
91 */
92 void shareFiles(const QList<QUrl> &urls) override final;
93
94 /**
95 * @brief shareText
96 * @param text
97 */
98 void shareText(const QString &text) override final;
99
100 /**
101 * @brief shareLink
102 * @param link
103 */
104 static void shareLink(const QString &link);
105
106 /**
107 * @brief openUrl
108 * @param url
109 */
110 static void openUrl(const QUrl &url);
111
112 /**
113 * @brief homePath
114 * @return
115 */
116 static QString homePath();
117
118 /**
119 * @brief sdDirs
120 * @return
121 */
122 static QStringList sdDirs();
123
124 /**
125 * @brief checkRunTimePermissions
126 * @param permissions
127 * @return
128 */
129 static bool checkRunTimePermissions(const QStringList &permissions);
130
131 bool hasKeyboard() override final;
132 bool hasMouse() override final;
133
135 /**
136 * @brief folderPicked
137 * @param path
138 */
140
141 // AbstractPlatform interface
142public Q_SLOTS:
143 bool darkModeEnabled() override final;
144};
145
146//namespace PATHS
147//{
148//const QString HomePath = MAUIAndroid::homePath();
149//const QString PicturesPath = HomePath + "/" + QAndroidJniObject::getStaticObjectField("android/os/Environment", "DIRECTORY_PICTURES", "Ljava/lang/String;").toString();
150//const QString DownloadsPath = HomePath + "/" + QAndroidJniObject::getStaticObjectField("android/os/Environment", "DIRECTORY_DOWNLOADS", "Ljava/lang/String;").toString();
151//const QString DocumentsPath = HomePath + "/" + QAndroidJniObject::getStaticObjectField("android/os/Environment", "DIRECTORY_DOCUMENTS", "Ljava/lang/String;").toString();
152//const QString MusicPath = HomePath + "/" + QAndroidJniObject::getStaticObjectField("android/os/Environment", "DIRECTORY_MUSIC", "Ljava/lang/String;").toString();
153//const QString VideosPath = HomePath + "/" + QAndroidJniObject::getStaticObjectField("android/os/Environment", "DIRECTORY_MOVIES", "Ljava/lang/String;").toString();
154//}
155
The AbstractPlatform class Defines abstract methods and properties that are common to be implemeted b...
virtual bool hasMouse()=0
hasMouse
virtual void shareText(const QString &urls)=0
shareText
virtual void shareFiles(const QList< QUrl > &urls)=0
shareFiles
virtual bool hasKeyboard()=0
hasKeyboard
The MAUIAndroid class.
Definition mauiandroid.h:40
void folderPicked(QString path)
folderPicked
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.