CuteLogger
Fast and simple logging solution for Qt based applications
qmlapplication.h
1 /*
2  * Copyright (c) 2014-2022 Meltytech, LLC
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, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef QMLAPPLICATION_H
19 #define QMLAPPLICATION_H
20 
21 #include <QObject>
22 #include <QDir>
23 #include <QPoint>
24 #include <QColor>
25 #include <QRect>
26 
27 namespace Mlt {
28 class Producer;
29 }
30 
31 class QmlApplication : public QObject
32 {
33  Q_OBJECT
34  Q_PROPERTY(Qt::WindowModality dialogModality READ dialogModality CONSTANT);
35  Q_PROPERTY(QPoint mousePos READ mousePos);
36  Q_PROPERTY(QColor toolTipBaseColor READ toolTipBaseColor NOTIFY paletteChanged)
37  Q_PROPERTY(QColor toolTipTextColor READ toolTipTextColor NOTIFY paletteChanged)
38  Q_PROPERTY(QString OS READ OS CONSTANT)
39  Q_PROPERTY(QRect mainWinRect READ mainWinRect);
40  Q_PROPERTY(bool hasFiltersOnClipboard READ hasFiltersOnClipboard NOTIFY filtersCopied)
41  Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio CONSTANT)
42  Q_PROPERTY(int maxTextureSize READ maxTextureSize CONSTANT)
43  Q_PROPERTY(QStringList wipes READ wipes CONSTANT)
44 
45 public:
46  static QmlApplication &singleton();
47  static Qt::WindowModality dialogModality();
48  static QPoint mousePos();
49  static QColor toolTipBaseColor();
50  static QColor toolTipTextColor();
51  static QString OS();
52  static QRect mainWinRect();
53  static bool hasFiltersOnClipboard();
54  Q_INVOKABLE static void copyFilters();
55  Q_INVOKABLE static void pasteFilters();
56  Q_INVOKABLE static QString timecode(int frames);
57  Q_INVOKABLE static int audioChannels();
58  Q_INVOKABLE static QString getNextProjectFile(const QString &filename);
59  Q_INVOKABLE static bool isProjectFolder();
60  static qreal devicePixelRatio();
61  Q_INVOKABLE void showStatusMessage(const QString &message, int timeoutSeconds = 15);
62  static int maxTextureSize();
63  Q_INVOKABLE static bool confirmOutputFilter();
64  static QDir dataDir();
65  Q_INVOKABLE static QColor contrastingColor(QString color);
66  static QStringList wipes();
67  Q_INVOKABLE static bool addWipe(const QString &filePath);
68 
69 signals:
70  void paletteChanged();
71  void filtersCopied();
72  void filtersPasted(Mlt::Producer *);
73 
74 private:
75  explicit QmlApplication();
76  QmlApplication(QmlApplication const &);
77  void operator=(QmlApplication const &);
78 };
79 
80 #endif // QMLAPPLICATION_H