File indexing completed on 2024-05-12 04:46:54

0001 #include "platform.h"
0002 
0003 #ifdef Q_OS_ANDROID
0004 #include "mauiandroid.h"
0005 #elif defined Q_OS_MAC
0006 //#include "mauimacos.h"
0007 #elif defined Q_OS_WIN
0008 #include "mauiwindows.h"
0009 #elif defined Q_OS_IOS
0010 #include "mauiios.h"
0011 #else
0012 #include "mauilinux.h"
0013 #endif
0014 
0015 #include <QCoreApplication>
0016 
0017 Platform *Platform::m_instance = nullptr;
0018 
0019 Platform *Platform::qmlAttachedProperties(QObject *object)
0020 {
0021     Q_UNUSED(object)
0022     return Platform::instance();
0023 }
0024 
0025 Platform::Platform(QObject *parent)
0026     : AbstractPlatform(parent)
0027     ,
0028 #ifdef Q_OS_ANDROID
0029     m_platform(new MAUIAndroid(this))
0030 #elif defined Q_OS_MAC
0031     m_platform(nullptr)
0032 #elif defined Q_OS_WIN
0033     m_platform(new MAUIWindows(this))
0034 #elif defined Q_OS_IOS
0035     m_platform(new MAUIIOS(this))
0036 #else
0037     m_platform(MAUIKDE::instance())
0038 #endif
0039 {
0040     connect(m_platform, &AbstractPlatform::shareFilesRequest, this, &Platform::shareFilesRequest);
0041 
0042     connect(qApp, &QCoreApplication::aboutToQuit, this, []()
0043     {
0044         qDebug() << "Lets remove MauiApp singleton instance";
0045         delete m_instance;
0046         m_instance = nullptr;
0047     });
0048 }
0049 
0050 void Platform::shareFiles(const QList<QUrl> &urls)
0051 {
0052     m_platform->shareFiles(urls);
0053 }
0054 
0055 void Platform::shareText(const QString &text)
0056 {
0057     m_platform->shareText(text);
0058 }
0059 
0060 bool Platform::hasKeyboard()
0061 {
0062     return m_platform->hasKeyboard();
0063 }
0064 
0065 bool Platform::hasMouse()
0066 {
0067     return m_platform->hasMouse();
0068 }
0069 
0070 
0071 bool Platform::darkModeEnabled()
0072 {
0073     return m_platform->darkModeEnabled();
0074 }