| 1 | /* |
| 2 | * Copyright (C) 2016-2017 Canonical, Ltd. |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify it under |
| 5 | * the terms of the GNU Lesser General Public License version 3, as published by |
| 6 | * the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
| 10 | * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * Lesser General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | #include <QVariant> |
| 18 | #include <QtThemeSupport/private/qgenericunixthemes_p.h> |
| 19 | #include <QGuiApplication> |
| 20 | #include <QScreen> |
| 21 | |
| 22 | class LomiriThemecxx . . $ LomiriTheme# : public QGenericUnixThemecxx . . $ QGenericUnixTheme# |
| 23 | { |
| 24 | public: |
| 25 | LomiriThemecxx . . $ LomiriTheme#LomiriTheme(49f6e7a06ebc5aa8).() |
| 26 | : mSystemFontcxx . . $ QFont#QFont(7ae16150a604556).(QStringLiteralcxx . . $ LomiriTheme#LomiriTheme(49f6e7a06ebc5aa8).$anonymous_type_0#`operator()`(6ef7b6c27b00b43d).Size.("Ubuntu Regular"), 10), |
| 27 | mFixedFontcxx . . $ QFont#QFont(7ae16150a604556).(QStringLiteralcxx . . $ LomiriTheme#LomiriTheme(49f6e7a06ebc5aa8).$anonymous_type_2#`operator()`(6ef7b6c27b00b43d).Size.("Ubuntu Mono Regular"), 13) |
| 28 | { |
| 29 | mSystemFontcxx . . $ LomiriTheme#mSystemFont..setStyleHintcxx . . $ QFont#setStyleHint(5f69bb8fd37dc5d9).(QFontcxx . . $ QFont#::Systemcxx . . $ QFont#System.); |
| 30 | mFixedFontcxx . . $ LomiriTheme#mFixedFont..setStyleHintcxx . . $ QFont#setStyleHint(5f69bb8fd37dc5d9).(QFontcxx . . $ QFont#::TypeWritercxx . . $ QFont#TypeWriter.); |
| 31 | } |
| 32 | ~cxx . . $ LomiriTheme#`~LomiriTheme`(49f6e7a06ebc5aa8).LomiriThemecxx . . $ LomiriTheme#() = default; |
| 33 | |
| 34 | QVariantcxx . . $ QVariant# themeHintcxx . . $ LomiriTheme#themeHint(af8e98146adee28a).(ThemeHintcxx . . $ QPlatformTheme#ThemeHint# hint) const override |
| 35 | { |
| 36 | switch (hint) { |
| 37 | case QPlatformThemecxx . . $ QPlatformTheme#::SystemIconThemeNamecxx . . $ QPlatformTheme#SystemIconThemeName.: { |
| 38 | QByteArraycxx . . $ QByteArray# iconTheme = qgetenvcxx . . $ QByteArray#QByteArray(3203d9f8f38841a4).("QTUBUNTU_ICON_THEME"); |
| 39 | if (iconTheme.isEmptycxx . . $ QByteArray#isEmpty(50ce9a9e25b4a850).()) { |
| 40 | returncxx . . $ QVariant#QVariant(7157b2bac2a9068). QStringLiteralcxx . . $ QStringDataPtr#("suru"); |
| 41 | } else { |
| 42 | returncxx . . $ QVariant#QVariant(7157b2bac2a9068). iconThemecxx . . $ QVariant#QVariant(45672f3c6961a244).; |
| 43 | } |
| 44 | } |
| 45 | case QPlatformThemecxx . . $ QPlatformTheme#::MouseDoubleClickDistancecxx . . $ QPlatformTheme#MouseDoubleClickDistance.: { |
| 46 | // Impl mostly yoinked from the QAndroidPlatformTheme |
| 47 | QScreencxx . . $ QScreen# *screen = qGuiAppcxx . . $ QCoreApplication#instance(d43115d48568c255).->primaryScreencxx . . $ QGuiApplication#primaryScreen(ef9790f12f08a894).(); |
| 48 | if (screen) { |
| 49 | qrealcxx . . $ qreal# dotsPerInch = screen->physicalDotsPerInchcxx . . $ QScreen#physicalDotsPerInch(21b6c25e127938e2).(); |
| 50 | // Allow 15% of an inch between taps when double clicking |
| 51 | returncxx . . $ QVariant#QVariant(7157b2bac2a9068). qRoundcxx . . $ QVariant#QVariant(d4f767463ce0a6b3).(dotsPerInch * 0.15); |
| 52 | } else { |
| 53 | returncxx . . $ QVariant#QVariant(7157b2bac2a9068). 5cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).; |
| 54 | } |
| 55 | } |
| 56 | case QPlatformThemecxx . . $ QPlatformTheme#::TouchDoubleTapDistancecxx . . $ QPlatformTheme#TouchDoubleTapDistance.: { |
| 57 | bool ok = false; |
| 58 | int dist = themeHintcxx . . $ LomiriTheme#themeHint(af8e98146adee28a).(QPlatformThemecxx . . $ QPlatformTheme#::MouseDoubleClickDistancecxx . . $ QPlatformTheme#MouseDoubleClickDistance.).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(&ok) * 2; |
| 59 | return QVariantcxx . . $ QVariant#QVariant(7157b2bac2a9068).(ok ? dist : 10); |
| 60 | } |
| 61 | default: |
| 62 | break; |
| 63 | } |
| 64 | return QGenericUnixThemecxx . . $ QGenericUnixTheme#::themeHintcxx . . $ QGenericUnixTheme#themeHint(af8e98146adee28a).(hint); |
| 65 | } |
| 66 | |
| 67 | const QFontcxx . . $ QFont# *fontcxx . . $ LomiriTheme#font(552e5eceffd2b8b6).(Fontcxx . . $ QPlatformTheme#Font# type) const override |
| 68 | { |
| 69 | switch (type) { |
| 70 | case QPlatformThemecxx . . $ QPlatformTheme#::SystemFontcxx . . $ QPlatformTheme#SystemFont.: |
| 71 | return &mSystemFontcxx . . $ LomiriTheme#mSystemFont.; |
| 72 | case QPlatformThemecxx . . $ QPlatformTheme#::FixedFontcxx . . $ QPlatformTheme#FixedFont.: |
| 73 | return &mFixedFontcxx . . $ LomiriTheme#mFixedFont.; |
| 74 | default: |
| 75 | return nullptr; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | private: |
| 80 | QFontcxx . . $ QFont# mSystemFontcxx . . $ LomiriTheme#mSystemFont., mFixedFontcxx . . $ LomiriTheme#mFixedFont.; |
| 81 | }; |