File: settingshelper.cpp

package info (click to toggle)
angelfish 25.08.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,720 kB
  • sloc: cpp: 2,751; xml: 607; javascript: 273; makefile: 16; sh: 11; sql: 7
file content (31 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 *  SPDX-FileCopyrightText: 2020 Jonah BrĂ¼chert <jbb@kaidan.im>
 *
 *  SPDX-License-Identifier: LGPL-2.0-only
 */

#include <QByteArray>
#include <QString>
#include <QtGlobal>

#include "settingshelper.h"

inline bool parseQuickControlsMobile()
{
    if (qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE")) {
        const QByteArray str = qgetenv("QT_QUICK_CONTROLS_MOBILE");
        return str == "1" || str == "true";
    }

    if (qEnvironmentVariable("XDG_CURRENT_DESKTOP").contains(QStringLiteral("Phosh"), Qt::CaseInsensitive)) {
        return true;
    }

    return false;
}

bool SettingsHelper::isMobile()
{
    static bool mobile = parseQuickControlsMobile();
    return mobile;
}