MauiKit Controls

platform.cpp
1#include "platform.h"
2
3#ifdef Q_OS_ANDROID
4#include "mauiandroid.h"
5#elif defined Q_OS_MAC
6//#include "mauimacos.h"
7#elif defined Q_OS_WIN
8#include "mauiwindows.h"
9#elif defined Q_OS_IOS
10#include "mauiios.h"
11#else
12#include "mauilinux.h"
13#endif
14
15#include <QCoreApplication>
16
17Platform *Platform::m_instance = nullptr;
18
19Platform *Platform::qmlAttachedProperties(QObject *object)
20{
21 Q_UNUSED(object)
22 return Platform::instance();
23}
24
25Platform::Platform(QObject *parent)
26 : AbstractPlatform(parent)
27 ,
28#ifdef Q_OS_ANDROID
29 m_platform(new MAUIAndroid(this))
30#elif defined Q_OS_MAC
31 m_platform(nullptr)
32#elif defined Q_OS_WIN
33 m_platform(new MAUIWindows(this))
34#elif defined Q_OS_IOS
35 m_platform(new MAUIIOS(this))
36#else
37 m_platform(MAUIKDE::instance())
38#endif
39{
40 connect(m_platform, &AbstractPlatform::shareFilesRequest, this, &Platform::shareFilesRequest);
41
42 connect(qApp, &QCoreApplication::aboutToQuit, this, []()
43 {
44 qDebug() << "Lets remove MauiApp singleton instance";
45 delete m_instance;
46 m_instance = nullptr;
47 });
48}
49
50void Platform::shareFiles(const QList<QUrl> &urls)
51{
52 m_platform->shareFiles(urls);
53}
54
55void Platform::shareText(const QString &text)
56{
57 m_platform->shareText(text);
58}
59
60bool Platform::hasKeyboard()
61{
62 return m_platform->hasKeyboard();
63}
64
65bool Platform::hasMouse()
66{
67 return m_platform->hasMouse();
68}
69
70
71bool Platform::darkModeEnabled()
72{
73 return m_platform->darkModeEnabled();
74}
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:41
The MAUIKDE class.
Definition mauilinux.h:34
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:46:39 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.