~verzegnassi-stefano/+junk/pdf-viewer

« back to all changes in this revision

Viewing changes to src/plugin/libreofficetoolkit-qml-plugin/ucunits.h

  • Committer: Stefano Verzegnassi
  • Date: 2016-04-15 10:51:55 UTC
  • Revision ID: stefano92.100@gmail.com-20160415105155-swsdn420t6n85b2i
 * Removed all the not necessary stuff, including the LibreOffice Viewer and the Plain Text Viewer
* 2014 WelcomePage is back again

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2012 Canonical Ltd.
3
 
 *
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.
7
 
 *
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.
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
 
 * Author: Florian Boucault <florian.boucault@canonical.com>
17
 
 */
18
 
 
19
 
#ifndef UBUNTU_COMPONENTS_UNITS_H
20
 
#define UBUNTU_COMPONENTS_UNITS_H
21
 
 
22
 
#include <QObject>
23
 
#include <QtCore/QHash>
24
 
#include <QtCore/QUrl>
25
 
 
26
 
class UCUnits : public QObject
27
 
{
28
 
    Q_OBJECT
29
 
    Q_PROPERTY(float gridUnit READ gridUnit WRITE setGridUnit NOTIFY gridUnitChanged)
30
 
 
31
 
public:
32
 
    static UCUnits& instance() {
33
 
        static UCUnits instance;
34
 
        return instance;
35
 
    }
36
 
 
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);
41
 
 
42
 
    // getters
43
 
    float gridUnit();
44
 
 
45
 
    // setters
46
 
    void setGridUnit(float gridUnit);
47
 
 
48
 
Q_SIGNALS:
49
 
    void gridUnitChanged();
50
 
 
51
 
protected:
52
 
    QString suffixForGridUnit(float gridUnit);
53
 
    float gridUnitSuffixFromFileName(const QString &fileName);
54
 
 
55
 
private:
56
 
    float m_devicePixelRatio;
57
 
    float m_gridUnit;
58
 
};
59
 
 
60
 
#endif // UBUNTU_COMPONENTS_UNITS_H