ScreenToolsController.cc 1.74 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
Don Gagne's avatar
Don Gagne committed
9 10 11


/// @file
Gus Grubba's avatar
Gus Grubba committed
12
/// @author Gus Grubba <gus@auterion.com>
Don Gagne's avatar
Don Gagne committed
13 14

#include "ScreenToolsController.h"
15
#include <QFontDatabase>
dogmaphobic's avatar
dogmaphobic committed
16
#include <QScreen>
17

Gus Grubba's avatar
Gus Grubba committed
18 19
#include "SettingsManager.h"

20 21 22
#if defined(__ios__)
#include <sys/utsname.h>
#endif
Don Gagne's avatar
Don Gagne committed
23 24 25

ScreenToolsController::ScreenToolsController()
{
26

Don Gagne's avatar
Don Gagne committed
27
}
28

29 30 31 32 33 34
bool
ScreenToolsController::hasTouch() const
{
    return QTouchDevice::devices().count() > 0 || isMobile();
}

35
QString
36
ScreenToolsController::iOSDevice() const
37 38 39 40 41 42 43 44 45
{
#if defined(__ios__)
    struct utsname systemInfo;
    uname(&systemInfo);
    return QString(systemInfo.machine);
#else
    return QString();
#endif
}
46 47 48 49 50 51

QString
ScreenToolsController::fixedFontFamily() const
{
    return QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
}
Gus Grubba's avatar
Gus Grubba committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

QString
ScreenToolsController::normalFontFamily() const
{
    //-- See App.SettinsGroup.json for index
    int langID = qgcApp()->toolbox()->settingsManager()->appSettings()->language()->rawValue().toInt();
    if(langID == 6 /*Korean*/) {
        return QString("fonts/NanumGothic-Regular");
    } else {
        return QString("opensans");
    }
}

QString
ScreenToolsController::boldFontFamily() const
{
    //-- See App.SettinsGroup.json for index
    int langID = qgcApp()->toolbox()->settingsManager()->appSettings()->language()->rawValue().toInt();
    if(langID == 6 /*Korean*/) {
        return QString("NanumGothic-Bold");
    } else {
        return QString("opensans-demibold");
    }
}