~ubuntu-docviewer-dev/ubuntu-docviewer-app/lo-viewer

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Stefano Verzegnassi
  • Date: 2015-10-10 12:21:13 UTC
  • mfrom: (172.1.5 reboot-lok-qsg-zoom)
  • Revision ID: tarmac-20151010122113-drtgshq9lhxx8noe
[loviewer] Implemented zoom:
* Added a manual zoom mode
* Added an automatic zoom mode (fit zoom to flickable width)
* Added a bottom panel with a zoom selector (which includes a TextField and an OptionSelector).

Approved by Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3, as published
 
6
 * by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 */
 
17
 
 
18
#ifndef LOPARTSMODEL_H
 
19
#define LOPARTSMODEL_H
 
20
 
 
21
#include <QAbstractListModel>
 
22
 
 
23
class LODocument;
 
24
 
 
25
class LOPartEntry
 
26
{
 
27
public:
 
28
    QString name;
 
29
    int index = 0;
 
30
};
 
31
 
 
32
class LOPartsModel : public QAbstractListModel
 
33
{
 
34
    Q_OBJECT
 
35
    Q_DISABLE_COPY(LOPartsModel)
 
36
    Q_PROPERTY(LODocument* document READ document WRITE setDocument NOTIFY documentChanged)
 
37
    Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
 
38
 
 
39
public:
 
40
    enum Roles {
 
41
        NameRole,
 
42
        IndexRole
 
43
    };
 
44
 
 
45
    explicit LOPartsModel(QAbstractListModel *parent = 0);
 
46
    ~LOPartsModel();
 
47
 
 
48
    LODocument* document() { return m_document; }
 
49
    void setDocument(LODocument* document);
 
50
 
 
51
    QHash<int, QByteArray> roleNames() const;
 
52
 
 
53
    int rowCount(const QModelIndex & parent = QModelIndex()) const;
 
54
    QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
 
55
 
 
56
    Q_INVOKABLE QVariantMap get(int index) const;
 
57
 
 
58
Q_SIGNALS:
 
59
    void documentChanged();
 
60
    void countChanged();
 
61
 
 
62
private slots:
 
63
    void fillModel();
 
64
 
 
65
private:
 
66
    LODocument* m_document;
 
67
    QList<LOPartEntry> m_entries;
 
68
};
 
69
 
 
70
#endif // LOPARTSMODEL_H