Commit 9c94295b authored by Don Gagne's avatar Don Gagne

Major font rework

Everything is now based off of default font pixel size
parent 890ea6ab
......@@ -267,7 +267,7 @@ HEADERS += \
src/QGCTemporaryFile.h \
src/QmlControls/MavManager.h \
src/QmlControls/ParameterEditorController.h \
src/QmlControls/ScreenTools.h \
src/QmlControls/ScreenToolsController.h \
src/uas/QGCMAVLinkUASFactory.h \
src/uas/FileManager.h \
src/uas/UAS.h \
......@@ -398,7 +398,7 @@ SOURCES += \
src/QGCTemporaryFile.cc \
src/QmlControls/MavManager.cc \
src/QmlControls/ParameterEditorController.cc \
src/QmlControls/ScreenTools.cc \
src/QmlControls/ScreenToolsController.cc \
src/uas/QGCMAVLinkUASFactory.cc \
src/uas/FileManager.cc \
src/uas/UAS.cc \
......
......@@ -15,7 +15,7 @@
<file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file>
<file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/qmldir</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl.Controls.qmldir</file>
<file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
......@@ -26,6 +26,10 @@
<file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file>
<file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file>
<file alias="ScreenToolsFontQuery.qml">src/QmlControls/ScreenToolsFontQuery.qml</file>
<file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file>
<file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
......
......@@ -972,8 +972,8 @@ Item {
spacing: 20
QGCLabel {
text: "FLIGHT MODES CONFIG"
font.pixelSize: ScreenTools.font20;
text: "FLIGHT MODES CONFIG"
font.pixelSize: ScreenTools.largeFontPixelSize
}
QGCLabel {
......
......@@ -179,7 +179,7 @@ QGCView {
antialiasing: true
Connections {
target: ScreenTools
onRepaintRequestedChanged: {
onRepaintRequested: {
arrows.requestPaint();
}
}
......@@ -269,7 +269,7 @@ QGCView {
width: (parent.width / 2) - 5
QGCLabel {
text: "Propeller Function"
font.pixelSize: ScreenTools.font20;
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
width: parent.width
......@@ -282,7 +282,7 @@ QGCView {
width: (parent.width / 2) - 5
QGCLabel {
text: "Magnetometer Distortion"
font.pixelSize: ScreenTools.font20;
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
width: parent.width
......@@ -300,9 +300,9 @@ QGCView {
text: "Show Advanced Settings"
}
QGCLabel {
text: "Advanced Power Settings"
font.pixelSize: ScreenTools.font20;
visible: showAdvanced.checked
text: "Advanced Power Settings"
font.pixelSize: ScreenTools.mediumFontPixelSize
visible: showAdvanced.checked
}
Rectangle {
width: parent.width
......
......@@ -405,16 +405,16 @@ QGCView {
color: qgcPal.windowShade
QGCLabel {
id: orientationCalAreaHelpText
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: ScreenTools.font22;
anchors.top: orientationCalArea.top
anchors.left: orientationCalArea.left
anchors.topMargin: 15
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.bottomMargin: 15
id: orientationCalAreaHelpText
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: ScreenTools.mediumFontPixelSize
anchors.top: orientationCalArea.top
anchors.left: orientationCalArea.left
anchors.topMargin: 15
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.bottomMargin: 15
}
Flow {
......
......@@ -69,13 +69,13 @@
#include "SensorsComponentController.h"
#include "PowerComponentController.h"
#include "RadioComponentController.h"
#include "ScreenToolsController.h"
#ifndef __mobile__
#include "FirmwareUpgradeController.h"
#endif
#include "AutoPilotPlugin.h"
#include "VehicleComponent.h"
#include "ScreenTools.h"
#include "MavManager.h"
#ifdef QGC_RTLAB_ENABLED
......@@ -104,10 +104,10 @@ const char* QGCApplication::_lightStyleFile = ":/res/styles/style-light.css";
* This is called by the QtQuick engine for creating the singleton
**/
static QObject* screenToolsSingletonFactory(QQmlEngine*, QJSEngine*)
static QObject* screenToolsControllerSingletonFactory(QQmlEngine*, QJSEngine*)
{
ScreenTools* screenTools = new ScreenTools;
return screenTools;
ScreenToolsController* screenToolsController = new ScreenToolsController;
return screenToolsController;
}
/**
......@@ -261,6 +261,33 @@ void QGCApplication::_initCommon(void)
{
QSettings settings;
// Register our Qml objects
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterUncreatableType<AutoPilotPlugin>("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Can only reference, cannot create");
qmlRegisterUncreatableType<VehicleComponent>("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Can only reference, cannot create");
qmlRegisterType<ViewWidgetController>("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<ParameterEditorController>("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<CustomCommandWidgetController>("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
qmlRegisterType<FlightModesComponentController>("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
qmlRegisterType<AirframeComponentController>("QGroundControl.Controllers", 1, 0, "AirframeComponentController");
qmlRegisterType<SensorsComponentController>("QGroundControl.Controllers", 1, 0, "SensorsComponentController");
qmlRegisterType<PowerComponentController>("QGroundControl.Controllers", 1, 0, "PowerComponentController");
qmlRegisterType<RadioComponentController>("QGroundControl.Controllers", 1, 0, "RadioComponentController");
qmlRegisterType<ScreenToolsController>("QGroundControl.Controllers", 1, 0, "ScreenToolsController");
#ifndef __mobile__
qmlRegisterType<FirmwareUpgradeController>("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController");
#endif
//-- Create QML Singleton Interfaces
qmlRegisterSingletonType<ScreenToolsController>("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory);
qmlRegisterSingletonType<MavManager>("QGroundControl.MavManager", 1, 0, "MavManager", mavManagerSingletonFactory);
//-- Register Waypoint Interface
qmlRegisterInterface<Waypoint>("Waypoint");
// Show user an upgrade message if the settings version has been bumped up
bool settingsUpgraded = false;
if (settings.contains(_settingsVersionKey)) {
......@@ -314,42 +341,6 @@ void QGCApplication::_initCommon(void)
}
qDebug() << "Saved files location" << savedFilesLocation;
settings.setValue(_savedFilesLocationKey, savedFilesLocation);
// Load application font
QFontDatabase fontDatabase = QFontDatabase();
const QString fontFileName = ":/res/fonts/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app
//const QString fontFamilyName = "Bitstream Vera Sans";
if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toStdString().c_str());
fontDatabase.addApplicationFont(fontFileName);
// Avoid Using setFont(). In the Qt docu you can read the following:
// "Warning: Do not use this function in conjunction with Qt Style Sheets."
// setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
// Register our Qml objects
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterUncreatableType<AutoPilotPlugin>("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Can only reference, cannot create");
qmlRegisterUncreatableType<VehicleComponent>("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Can only reference, cannot create");
qmlRegisterType<ViewWidgetController>("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<ParameterEditorController>("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<CustomCommandWidgetController>("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
qmlRegisterType<FlightModesComponentController>("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
qmlRegisterType<AirframeComponentController>("QGroundControl.Controllers", 1, 0, "AirframeComponentController");
qmlRegisterType<SensorsComponentController>("QGroundControl.Controllers", 1, 0, "SensorsComponentController");
qmlRegisterType<PowerComponentController>("QGroundControl.Controllers", 1, 0, "PowerComponentController");
qmlRegisterType<RadioComponentController>("QGroundControl.Controllers", 1, 0, "RadioComponentController");
#ifndef __mobile__
qmlRegisterType<FirmwareUpgradeController>("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController");
#endif
//-- Create QML Singleton Interfaces
qmlRegisterSingletonType<ScreenTools>("QGroundControl.ScreenTools", 1, 0, "ScreenTools", screenToolsSingletonFactory);
qmlRegisterSingletonType<MavManager>("QGroundControl.MavManager", 1, 0, "MavManager", mavManagerSingletonFactory);
//-- Register Waypoint Interface
qmlRegisterInterface<Waypoint>("Waypoint");
}
bool QGCApplication::_initForNormalAppBoot(void)
......@@ -656,10 +647,12 @@ void QGCApplication::_loadCurrentStyle(void)
}
// Now that we have the styles loaded we need to adjust the font sizes.
QString fSmall = QString("%1px;").arg(ScreenTools::font10_s());
QString fNormal = QString("%1px;").arg(ScreenTools::defaultFontPizelSize_s());
QString fLarge = QString("%1px;").arg(ScreenTools::largeFontPixelSize_s());
QString fSmall = QString("%1px;").arg(ScreenToolsController::smallFontPixelSize_s());
QString fNormal = QString("%1px;").arg(ScreenToolsController::defaultFontPixelSize_s());
QString fLarge = QString("%1px;").arg(ScreenToolsController::largeFontPixelSize_s());
qDebug() << fSmall << fNormal << fLarge;
styles.replace("FONT_SMALL", fSmall);
styles.replace("FONT_NORMAL", fNormal);
......
......@@ -25,7 +25,6 @@
/// @author Don Gagne <don@thegagnes.com>
#include "QGCPalette.h"
#include "ScreenTools.h"
#include <QApplication>
#include <QPalette>
......
......@@ -63,10 +63,10 @@ QGCView {
x: __leftMargin
QGCLabel {
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9))
height: defaultTextHeight + (ScreenTools.defaultFontPizelSize * 0.5)
text: group
verticalAlignment: Text.AlignVCenter
font.pixelSize: ScreenTools.font16;
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
......@@ -84,7 +84,7 @@ QGCView {
Item {
x: __leftMargin
width: parent.width
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9))
height: defaultTextHeight + (ScreenTools.defaultFontPixelSize * 0.5)
QGCLabel {
id: nameLabel
......@@ -142,7 +142,7 @@ QGCView {
height: firstButton.height
QGCLabel {
font.pixelSize: ScreenTools.font20;
font.pixelSize: ScreenTools.largeFontPixelSize
visible: fullMode
text: "PARAMETER EDITOR"
}
......@@ -199,10 +199,10 @@ QGCView {
readonly property int componentId: parseInt(modelData)
QGCLabel {
height: contentHeight + (ScreenTools.pixelSizeFactor * (9))
height: contentHeight + (ScreenTools.defaultFontPixelHeight * 0.5)
text: "Component #: " + componentId.toString()
verticalAlignment: Text.AlignVCenter
font.pixelSize: ScreenTools.font16;
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Repeater {
......@@ -224,7 +224,7 @@ QGCView {
Item {
width: 1
height: ScreenTools.pixelSizeFactor * (3)
height: ScreenTools.defaultFontPixelSize * 0.25
}
} // Column - Group
} // Repeater - Groups
......
......@@ -26,12 +26,12 @@ Button {
Connections {
target: __behavior
onMouseXChanged: {
__lastGlobalMouseX = ScreenTools.mouseX
__lastGlobalMouseY = ScreenTools.mouseY
__lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY()
}
onMouseYChanged: {
__lastGlobalMouseX = ScreenTools.mouseX
__lastGlobalMouseY = ScreenTools.mouseY
__lastGlobalMouseX = ScreenTools.mouseX()
__lastGlobalMouseY = ScreenTools.mouseY()
}
onEntered: { __forceHoverOff; false; hoverTimer.start() }
onExited: { __forceHoverOff; false; hoverTimer.stop() }
......@@ -43,7 +43,7 @@ Button {
repeat: true
onTriggered: {
if (__lastGlobalMouseX != ScreenTools.mouseX || __lastGlobalMouseY != ScreenTools.mouseY) {
if (__lastGlobalMouseX != ScreenTools.mouseX() || __lastGlobalMouseY != ScreenTools.mouseY()) {
__forceHoverOff = true
} else {
__forceHoverOff = false
......@@ -104,7 +104,7 @@ Button {
id: text
antialiasing: true
text: control.text
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
anchors.verticalCenter: parent.verticalCenter
......
......@@ -29,7 +29,7 @@ CheckBox {
id: text
text: control.text
antialiasing: true
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
anchors.centerIn: parent
......
......@@ -11,7 +11,7 @@ ComboBox {
property bool __showHighlight: pressed | hovered
style: ComboBoxStyle {
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
textColor: __showHighlight ?
control.__qgcPal.buttonHighlightText :
control.__qgcPal.buttonText
......
......@@ -10,7 +10,7 @@ Text {
property bool enabled: true
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
color: __qgcPal.text
antialiasing: true
}
......@@ -9,8 +9,8 @@ import QGroundControl.ScreenTools 1.0
Item {
id: root
property bool allowDragging: true
property real minimumWidth: ScreenTools.pixelSizeFactor * (60)
property real minimumHeight: ScreenTools.pixelSizeFactor * (60)
property real minimumWidth: ScreenTools.defaultFontPixelSize * (5)
property real minimumHeight: ScreenTools.defaultFontPixelSize * (5)
property alias tForm: tform
signal resetRequested()
transform: Scale {
......
......@@ -28,7 +28,7 @@ RadioButton {
Text {
id: text
text: control.text
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
antialiasing: true
anchors.centerIn: parent
......
......@@ -50,7 +50,7 @@ TextField {
width: unitsLabelWidthGenerator.width
text: control.unitsLabel
font.pixelSize: ScreenTools.defaultFontPizelSize
font.pixelSize: ScreenTools.defaultFontPixelSize
antialiasing: true
color: control.textColor
......
Module QGroundControl.ScreenTools
singleton ScreenTools 1.0 ScreenTools.qml
pragma Singleton
import QtQuick 2.2
import QtQuick.Controls 1.2
import QGroundControl.ScreenToolsController 1.0
Item {
signal repaintRequested
readonly property real defaultFontPixelSize: _textMeasure.contentHeight * 0.8
readonly property real defaultFontPixelHeight: defaultFontPixelSize
readonly property real defaultFontPixelWidth: _textMeasure.contentWidth
readonly property real smallFontPixelSize: defaultFontPixelSize * ScreenToolsController.smallFontPixelSizeRatio
readonly property real mediumFontPixelSize: defaultFontPixelSize * ScreenToolsController.mediumFontPixelSizeRatio
readonly property real largeFontPixelSize: defaultFontPixelSize * ScreenToolsController.largeFontPixelSizeRatio
property bool isAndroid: ScreenToolsController.isAndroid
property bool isiOS: ScreenToolsController.isiOS
property bool isMobile: ScreenToolsController.isMobile
function mouseX() {
return ScreenToolsController.mouseX()
}
function mouseY() {
return ScreenToolsController.mouseY()
}
Text {
id: _textMeasure
text: "X"
}
Connections {
target: ScreenToolsController
onRepaintRequested: repaintRequested()
}
}
......@@ -24,69 +24,36 @@
/// @file
/// @author Gus Grubba <mavlink@grubba.com>
#include "ScreenTools.h"
#include "ScreenToolsController.h"
#include "MainWindow.h"
// Pixel size, instead of a physical thing is actually a philosophical question when
// it comes to Qt.
// The values below came from actually measuring the elements on the screen on these
// devices. I have yet to find a constant from Qt so these things can be properly
// computed at runtime.
int ScreenToolsController::_qmlDefaultFontPixelSize = -1;
#if defined(Q_OS_OSX)
double ScreenTools::_pixelFactor = 1.0;
#elif defined(__ios__)
double ScreenTools::_pixelFactor = 0.75;
#elif defined(Q_OS_WIN)
double ScreenTools::_pixelFactor = 0.86;
#elif defined(__android__)
double ScreenTools::_pixelFactor = 2.5;
#elif defined(Q_OS_LINUX)
double ScreenTools::_pixelFactor = 1.0;
#endif
const double ScreenToolsController::_smallFontPixelSizeRatio = 0.75;
const double ScreenToolsController::_mediumFontPixelSizeRatio = 1.22;
const double ScreenToolsController::_largeFontPixelSizeRatio = 1.66;
#if defined(__android__)
#define FONT_FACTOR 2
#else
#define FONT_FACTOR 1
#endif
int ScreenTools::_font8 = 8 * FONT_FACTOR;
int ScreenTools::_font9 = 9 * FONT_FACTOR;
int ScreenTools::_font10 = 10 * FONT_FACTOR;
int ScreenTools::_font11 = 11 * FONT_FACTOR;
int ScreenTools::_font12 = 12 * FONT_FACTOR;
int ScreenTools::_font13 = 13 * FONT_FACTOR;
int ScreenTools::_font14 = 14 * FONT_FACTOR;
int ScreenTools::_font15 = 15 * FONT_FACTOR;
int ScreenTools::_font16 = 16 * FONT_FACTOR;
int ScreenTools::_font17 = 17 * FONT_FACTOR;
int ScreenTools::_font18 = 18 * FONT_FACTOR;
int ScreenTools::_font19 = 19 * FONT_FACTOR;
int ScreenTools::_font20 = 20 * FONT_FACTOR;
int ScreenTools::_font21 = 21 * FONT_FACTOR;
int ScreenTools::_font22 = 22 * FONT_FACTOR;
ScreenTools::ScreenTools()
ScreenToolsController::ScreenToolsController()
{
MainWindow* mainWindow = MainWindow::instance();
// Unit tests can run Qml without MainWindow
if (mainWindow) {
connect(mainWindow, &MainWindow::repaintCanvas, this, &ScreenTools::_updateCanvas);
connect(mainWindow, &MainWindow::repaintCanvas, this, &ScreenToolsController::_updateCanvas);
}
}
qreal ScreenTools::adjustPixelSize(qreal pixelSize)
{
return adjustPixelSize_s(pixelSize);
}
qreal ScreenTools::adjustPixelSize_s(qreal pixelSize)
void ScreenToolsController::_updateCanvas()
{
return pixelSize * _pixelFactor;
emit repaintRequested();
}
void ScreenTools::_updateCanvas()
double ScreenToolsController::getQmlDefaultFontPixelSize(void)
{
emit repaintRequestedChanged();
if (_qmlDefaultFontPixelSize == -1) {
QGCQmlWidgetHolder qmlWidgetHolder;
qmlWidgetHolder.setSource(QUrl::fromUserInput("qrc:/qml/ScreenToolsFontQuery.qml"));
}
return _qmlDefaultFontPixelSize;
}
......@@ -24,35 +24,33 @@
/// @file
/// @author Gus Grubba <mavlink@grubba.com>
#ifndef SCREENTOOLS_H
#define SCREENTOOLS_H
#ifndef ScreenToolsController_H
#define ScreenToolsController_H
#include <QObject>
#include "QGCApplication.h"
#include <QQuickItem>
#include <QCursor>
/*!
@brief Screen helper tools for QML widgets
To use its functions, you need to import the module with the following line:
@code
import QGroundControl.ScreenTools 1.0
@endcode
*/
/// This Qml control is used to return screen parameters
class ScreenTools : public QObject
class ScreenToolsController : public QQuickItem
{
Q_OBJECT
public:
ScreenTools();
ScreenToolsController();
Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT)
Q_PROPERTY(bool isiOS READ isiOS CONSTANT)
Q_PROPERTY(bool isMobile READ isMobile CONSTANT)
//! Returns the global mouse X position
Q_PROPERTY(int mouseX READ mouseX)
//! Returns the global mouse Y position
Q_PROPERTY(int mouseY READ mouseY)
//! Used to trigger a \c Canvas element repaint.
/*!
There is a bug as of Qt 5.4 where a Canvas element defined within a QQuickWidget does not receive
......@@ -60,14 +58,14 @@ public:
repainted.
If you use a \c Canvas element inside some QML widget, you can use this code to handle repaint:
@code
import QGroundControl.ScreenTools 1.0
import QGroundControl.ScreenToolsController 1.0
...
Canvas {
id: myCanvas
height: 40
width: 40
Connections {
target: ScreenTools
target: ScreenToolsController
onRepaintRequestedChanged: {
myCanvas.requestPaint();
}
......@@ -80,87 +78,23 @@ public:
@endcode
*/
//! Font sizes
Q_PROPERTY(int font22 READ font22 CONSTANT)
Q_PROPERTY(int font21 READ font21 CONSTANT)
Q_PROPERTY(int font20 READ font20 CONSTANT)
Q_PROPERTY(int font19 READ font19 CONSTANT)
Q_PROPERTY(int font18 READ font18 CONSTANT)
Q_PROPERTY(int font17 READ font17 CONSTANT)
Q_PROPERTY(int font16 READ font16 CONSTANT)
Q_PROPERTY(int font15 READ font15 CONSTANT)
Q_PROPERTY(int font14 READ font14 CONSTANT)
Q_PROPERTY(int font13 READ font13 CONSTANT)
Q_PROPERTY(int font12 READ font12 CONSTANT)
Q_PROPERTY(int font11 READ font11 CONSTANT)
Q_PROPERTY(int font10 READ font10 CONSTANT)
Q_PROPERTY(int font9 READ font9 CONSTANT)
Q_PROPERTY(int font8 READ font8 CONSTANT)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY(int defaultFontPizelSize READ defaultFontPizelSize CONSTANT)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY(int mediumFontPixelSize READ mediumFontPixelSize CONSTANT)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY(int largeFontPixelSize READ largeFontPixelSize CONSTANT)
Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
//! Returns the pixel size factor
Q_PROPERTY(double pixelSizeFactor READ pixelSizeFactor CONSTANT)
// Returns current mouse position
Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); }
Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); }
// Used to calculate font sizes based on default font size
Q_PROPERTY(double smallFontPixelSizeRatio MEMBER _smallFontPixelSizeRatio CONSTANT)
Q_PROPERTY(double mediumFontPixelSizeRatio MEMBER _mediumFontPixelSizeRatio CONSTANT)
Q_PROPERTY(double largeFontPixelSizeRatio MEMBER _largeFontPixelSizeRatio CONSTANT)
//! Utility for adjusting pixel size. Not dynamic (no signals)
Q_INVOKABLE qreal adjustPixelSize(qreal pixelSize);
/// Static version of adjustPixelSize of use in C++ code
static qreal adjustPixelSize_s(qreal pixelSize);
int mouseX () { return QCursor::pos().x(); }
int mouseY () { return QCursor::pos().y(); }
bool repaintRequested () { return true; }
double pixelSizeFactor () { return _pixelFactor; }
int font22 () { return _font22; }
int font21 () { return _font21; }
int font20 () { return _font20; }
int font19 () { return _font19; }
int font18 () { return _font18; }
int font17 () { return _font17; }
int font16 () { return _font16; }
int font15 () { return _font15; }
int font14 () { return _font14; }
int font13 () { return _font13; }
int font12 () { return _font12; }
int font11 () { return _font11; }
int font10 () { return _font10; }
int font9 () { return _font9; }
int font8 () { return _font8; }
int defaultFontPizelSize () { return _font12; }
int mediumFontPixelSize () { return _font16; }
int largeFontPixelSize () { return _font20; }
/// Static version for use in C++ code
static int font22_s () { return _font22; }
static int font21_s () { return _font21; }
static int font20_s () { return _font20; }
static int font19_s () { return _font19; }
static int font18_s () { return _font18; }
static int font17_s () { return _font17; }
static int font16_s () { return _font16; }
static int font15_s () { return _font15; }
static int font14_s () { return _font14; }
static int font13_s () { return _font13; }
static int font12_s () { return _font12; }
static int font11_s () { return _font11; }
static int font10_s () { return _font10; }
static int font9_s () { return _font9; }
static int font8_s () { return _font8; }
static int defaultFontPizelSize_s () { return _font12; }
static int mediumFontPixelSize_s () { return _font16; }
static int largeFontPixelSize_s () { return _font20; }
static double pixelSizeFactor_s () { return _pixelFactor; }
Q_PROPERTY(double qmlDefaultFontPixelSize MEMBER _qmlDefaultFontPixelSize)
static double getQmlDefaultFontPixelSize(void);
static int defaultFontPixelSize_s() { return (int)getQmlDefaultFontPixelSize(); }
static int smallFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _smallFontPixelSizeRatio); }
static int mediumFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _mediumFontPixelSizeRatio); }
static int largeFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _largeFontPixelSizeRatio); }
#if defined (__android__)
bool isAndroid () { return true; }
......@@ -177,30 +111,17 @@ public:
#endif
signals:
void repaintRequestedChanged();
void repaintRequested(void);
private slots:
void _updateCanvas();
private:
// Font Sizes
static int _font8;
static int _font9;