2
* Copyright 2012 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
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/>.
16
* Author: Florian Boucault <florian.boucault@canonical.com>
19
#ifndef UBUNTU_COMPONENTS_UNITS_H
20
#define UBUNTU_COMPONENTS_UNITS_H
23
#include <QtCore/QHash>
24
#include <QtCore/QUrl>
26
class UCUnits : public QObject
29
Q_PROPERTY(float gridUnit READ gridUnit WRITE setGridUnit NOTIFY gridUnitChanged)
32
static UCUnits& instance() {
33
static UCUnits instance;
37
explicit UCUnits(QObject *parent = 0);
38
Q_INVOKABLE float dp(float value);
39
Q_INVOKABLE float gu(float value);
40
QString resolveResource(const QUrl& url);
46
void setGridUnit(float gridUnit);
49
void gridUnitChanged();
52
QString suffixForGridUnit(float gridUnit);
53
float gridUnitSuffixFromFileName(const QString &fileName);
56
float m_devicePixelRatio;
60
#endif // UBUNTU_COMPONENTS_UNITS_H