on 2e79fe0 help sign in
unity8/plugins/Cursor/CursorImageInfo.h
76 lines 2.2 kB history raw
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#ifndef CURSOR_IMAGE_INFO_H
18#define CURSOR_IMAGE_INFO_H
20#include "CursorImageProvider.h"
22#include <QObject>
23#include <QString>
24#include <QTimer>
26class CursorImageInfo : public QObject
28 Q_OBJECT
30 Q_PROPERTY(QString themeName READ themeName WRITE setThemeName NOTIFY themeNameChanged)
31 Q_PROPERTY(QString cursorName READ cursorName WRITE setCursorName NOTIFY cursorNameChanged)
33 Q_PROPERTY(QPoint hotspot READ hotspot NOTIFY hotspotChanged)
34 Q_PROPERTY(qreal frameWidth READ frameWidth NOTIFY frameWidthChanged)
35 Q_PROPERTY(qreal frameHeight READ frameHeight NOTIFY frameHeightChanged)
36 Q_PROPERTY(int frameCount READ frameCount NOTIFY frameCountChanged)
37 Q_PROPERTY(int frameDuration READ frameDuration NOTIFY frameDurationChanged)
39public:
40 CursorImageInfo(QObject *parent = nullptr);
42 QString themeName() const { return m_themeName; }
43 void setThemeName(const QString &);
45 QString cursorName() const { return m_cursorName; }
46 void setCursorName(const QString &);
48 QPoint hotspot() const;
49 qreal frameWidth() const;
50 qreal frameHeight() const;
51 int frameCount() const;
52 int frameDuration() const;
54Q_SIGNALS:
55 void themeNameChanged();
56 void cursorNameChanged();
57 void hotspotChanged();
58 void frameWidthChanged();
59 void frameHeightChanged();
60 void frameCountChanged();
61 void frameDurationChanged();
63private Q_SLOTS:
64 void update();
66private:
67 void scheduleUpdate();
68 QTimer m_updateTimer;
70 QString m_themeName;
71 QString m_cursorName;
73 CursorImage *m_cursorImage{nullptr};
74};
76#endif // CURSOR_IMAGE_INFO_H