File indexing completed on 2024-05-12 16:23:41

0001 /*
0002  *  SPDX-FileCopyrightText: 2020 Jonah BrĂ¼chert <jbb@kaidan.im>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-only
0005  */
0006 
0007 #include <QByteArray>
0008 #include <QString>
0009 #include <QtGlobal>
0010 
0011 #include "settingshelper.h"
0012 
0013 inline bool parseQuickControlsMobile()
0014 {
0015     if (qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE")) {
0016         const QByteArray str = qgetenv("QT_QUICK_CONTROLS_MOBILE");
0017         return str == "1" || str == "true";
0018     }
0019 
0020     if (qEnvironmentVariable("XDG_CURRENT_DESKTOP").contains(QStringLiteral("Phosh"), Qt::CaseInsensitive)) {
0021         return true;
0022     }
0023 
0024     return false;
0025 }
0026 
0027 bool SettingsHelper::isMobile()
0028 {
0029     static bool mobile = parseQuickControlsMobile();
0030     return mobile;
0031 }