diff --git a/src/libs/core/tinitcorelib.cpp b/src/libs/core/tinitcorelib.cpp index bc6af81d1a4158058093e32dfe8b69f85e6693d1..c23b639bef53b8f216fefc01a776b80d3c50858f 100644 --- a/src/libs/core/tinitcorelib.cpp +++ b/src/libs/core/tinitcorelib.cpp @@ -32,17 +32,27 @@ #include <QtCore/qdir.h> #if defined (Q_OS_ANDROID) #include "Android/tandroid.h" + #include <QtWidgets/qstylefactory.h> #endif Tglobals* Tcore::m_gl = 0; +#if defined (Q_OS_ANDROID) + QStyle* Tcore::androidStyle = nullptr; +#endif bool initCoreLibrary() { if (Tcore::gl() == 0) { qDebug() << "Tglobals was not created. Construct it first!"; return false; } + +#if defined (Q_OS_ANDROID) + if (Tcore::androidStyle == nullptr) + Tcore::androidStyle = QStyleFactory::create(QStringLiteral("android")); +#endif + Tcolor::setShadow(qApp->palette()); #if defined(Q_OS_MAC) TpushButton::setCheckColor(Tcore::gl()->S->pointerColor, qApp->palette().base().color()); diff --git a/src/libs/core/tinitcorelib.h b/src/libs/core/tinitcorelib.h index 35c765513de43b55b05611cf82d589b9f58bbcfe..d061dcf7b4b4f55e5be71704ab08111bfd6168f5 100755 --- a/src/libs/core/tinitcorelib.h +++ b/src/libs/core/tinitcorelib.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2014-2015 by Tomasz Bojczuk * + * Copyright (C) 2014-2016 by Tomasz Bojczuk * * seelook@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -22,8 +22,10 @@ #include "nootkacoreglobal.h" #include "tglobals.h" + class QTranslator; class QApplication; +class QStyle; /** * Internal instance of Tglobals pointer used by in initCoreLibrary. * @@ -36,6 +38,9 @@ class NOOTKACORE_EXPORT Tcore public: static Tglobals* gl() { return m_gl; } /** static global pointer to Tglobals */ +#if defined (Q_OS_ANDROID) + static QStyle* androidStyle; +#endif protected: static void setGlobals(Tglobals *g) { m_gl = g; } diff --git a/src/libs/widgets/widgets/tsettingsdialogbase.cpp b/src/libs/widgets/widgets/tsettingsdialogbase.cpp index 4ad25ce79faf753ec320825cb98ec0af1f21cad1..da18d568c56a289c76ab3cdce9d08465565e3cb9 100755 --- a/src/libs/widgets/widgets/tsettingsdialogbase.cpp +++ b/src/libs/widgets/widgets/tsettingsdialogbase.cpp @@ -25,6 +25,7 @@ #include <tmenuwidget.h> #include <graphics/tdropshadoweffect.h> #include <ttouchmenu.h> + #include <tinitcorelib.h> #endif #include <QtWidgets/QtWidgets> @@ -214,17 +215,19 @@ void TsettingsDialogBase::closeEvent(QCloseEvent *event) { void TsettingsDialogBase::markChanges(QWidget *container) { - foreach(QCheckBox *chB, container->findChildren<QCheckBox*>()) + for(QCheckBox *chB : container->findChildren<QCheckBox*>()) connect(chB, &QCheckBox::clicked, menuButton, &TmenuWidget::animate); - foreach(QGroupBox *grB, container->findChildren<QGroupBox*>()) + for(QGroupBox *grB : container->findChildren<QGroupBox*>()) connect(grB, &QGroupBox::clicked, menuButton, &TmenuWidget::animate); - foreach(QPushButton *butt, container->findChildren<QPushButton*>()) + for(QPushButton *butt : container->findChildren<QPushButton*>()) connect(butt, &QPushButton::clicked, menuButton, &TmenuWidget::animate); - foreach(QRadioButton *radio, container->findChildren<QRadioButton*>()) + for(QRadioButton *radio : container->findChildren<QRadioButton*>()) { connect(radio, &QCheckBox::clicked, menuButton, &TmenuWidget::animate); - foreach(QComboBox *combo, container->findChildren<QComboBox*>()) + radio->setStyle(Tcore::androidStyle); + } + for(QComboBox *combo : container->findChildren<QComboBox*>()) connect(combo, SIGNAL(currentIndexChanged(int)), menuButton, SLOT(animate())); - foreach(QSpinBox *spin, container->findChildren<QSpinBox*>()) + for(QSpinBox *spin : container->findChildren<QSpinBox*>()) connect(spin, SIGNAL(valueChanged(int)), menuButton, SLOT(animate())); } diff --git a/src/main.cpp b/src/main.cpp index bca1d6cbcfeb9d51cd3e98fd241750f2b602cefa..7157c7450fa998c01a60bc325e411627e42e84e9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -137,6 +137,10 @@ int main(int argc, char *argv[]) qApp->quit(); // HACK: calling QApplication::quick() solves hang on x86 when Qt uses native (usually obsolete) SSL libraries #endif } while (resetConfig); + +#if defined (Q_OS_ANDROID) + Tcore::androidStyle->deleteLater(); +#endif delete a; return exitCode; } diff --git a/src/ttouchstyle.cpp b/src/ttouchstyle.cpp index 52c545edfb493fb17a06d12b672df4626570dba1..644c57af94df22539964c476bc5b54dc245582ed 100644 --- a/src/ttouchstyle.cpp +++ b/src/ttouchstyle.cpp @@ -61,11 +61,11 @@ int TtouchStyle::styleHint(QStyle::StyleHint hint, const QStyleOption* option, int TtouchStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption* option, const QWidget* widget) const { switch (metric) { case PM_SmallIconSize: - return Tmtr::fingerPixels() * 0.7; // small icon size + return qRound(Tmtr::fingerPixels() * 0.7); // small icon size case PM_IndicatorHeight: // check box size case PM_IndicatorWidth: - return Tmtr::fingerPixels() * 0.5; + return qRound(Tmtr::fingerPixels() * 0.5); case PM_LayoutLeftMargin: case PM_LayoutRightMargin: case PM_LayoutBottomMargin: @@ -77,7 +77,7 @@ int TtouchStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption* opt case PM_ExclusiveIndicatorHeight: // radio button ellipse size case PM_ExclusiveIndicatorWidth: - return Tmtr::fingerPixels() * 0.4; + return qRound(Tmtr::fingerPixels() * 0.4); // case PM_MenuTearoffHeight: // return Tmtr::fingerPixels();