mediatools.h
6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/* Webcamoid, webcam capture application.
* Copyright (C) 2015 Gonzalo Exequiel Pedone
*
* Webcamoid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Webcamoid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Webcamoid. If not, see <http://www.gnu.org/licenses/>.
*
* Web-Site: http://webcamoid.github.io/
*/
#ifndef MEDIATOOLS_H
#define MEDIATOOLS_H
#include <iak/akelement.h>
class MediaToolsPrivate;
class QQmlApplicationEngine;
class AkCaps;
class CliOptions;
class MediaTools: public QObject
{
Q_OBJECT
Q_PROPERTY(int windowWidth
READ windowWidth
WRITE setWindowWidth
RESET resetWindowWidth
NOTIFY windowWidthChanged)
Q_PROPERTY(int windowHeight
READ windowHeight
WRITE setWindowHeight
RESET resetWindowHeight
NOTIFY windowHeightChanged)
Q_PROPERTY(QString applicationName
READ applicationName
CONSTANT)
Q_PROPERTY(QString applicationVersion
READ applicationVersion
CONSTANT)
Q_PROPERTY(bool isDailyBuild
READ isDailyBuild
CONSTANT)
Q_PROPERTY(QString qtVersion
READ qtVersion
CONSTANT)
Q_PROPERTY(QString copyrightNotice
READ copyrightNotice
CONSTANT)
Q_PROPERTY(QString projectUrl
READ projectUrl
CONSTANT)
Q_PROPERTY(QString projectLicenseUrl
READ projectLicenseUrl
CONSTANT)
Q_PROPERTY(QString projectDownloadsUrl
READ projectDownloadsUrl
CONSTANT)
Q_PROPERTY(QString projectIssuesUrl
READ projectIssuesUrl
CONSTANT)
Q_PROPERTY(QString projectGitCommit
READ projectGitCommit
CONSTANT)
Q_PROPERTY(QString projectGitShortCommit
READ projectGitShortCommit
CONSTANT)
Q_PROPERTY(QString projectGitCommitUrl
READ projectGitCommitUrl
CONSTANT)
Q_PROPERTY(QString projectDonationsUrl
READ projectDonationsUrl
CONSTANT)
Q_PROPERTY(QString log
READ log
NOTIFY logUpdated)
Q_PROPERTY(QString documentsDirectory
READ documentsDirectory
WRITE setDocumentsDirectory
RESET resetDocumentsDirectory
NOTIFY documentsDirectoryChanged)
Q_PROPERTY(int adBannerWidth
READ adBannerWidth
NOTIFY adBannerWidthChanged)
Q_PROPERTY(int adBannerHeight
READ adBannerHeight
NOTIFY adBannerHeightChanged)
public:
enum AdType {
AdType_Banner,
AdType_AdaptiveBanner,
AdType_Appopen,
AdType_Interstitial,
AdType_Rewarded,
AdType_RewardedInterstitial
};
Q_ENUM(AdType)
MediaTools(QObject *parent=nullptr);
~MediaTools();
Q_INVOKABLE int windowWidth() const;
Q_INVOKABLE int windowHeight() const;
Q_INVOKABLE QString applicationName() const;
Q_INVOKABLE QString applicationVersion() const;
Q_INVOKABLE bool isDailyBuild() const;
Q_INVOKABLE QString qtVersion() const;
Q_INVOKABLE QString copyrightNotice() const;
Q_INVOKABLE QString projectUrl() const;
Q_INVOKABLE QString projectLicenseUrl() const;
Q_INVOKABLE QString projectDownloadsUrl() const;
Q_INVOKABLE QString projectIssuesUrl() const;
Q_INVOKABLE QString projectGitCommit() const;
Q_INVOKABLE QString projectGitShortCommit() const;
Q_INVOKABLE QString projectGitCommitUrl() const;
Q_INVOKABLE QString projectDonationsUrl() const;
Q_INVOKABLE QString fileNameFromUri(const QString &uri) const;
Q_INVOKABLE bool matches(const QString &pattern,
const QStringList &strings) const;
Q_INVOKABLE QString currentTime() const;
Q_INVOKABLE QString currentTime(const QString &format) const;
Q_INVOKABLE QStringList standardLocations(const QString &type) const;
Q_INVOKABLE static QString readFile(const QString &fileName);
Q_INVOKABLE QString urlToLocalFile(const QUrl &url) const;
Q_INVOKABLE bool openUrlExternally(const QUrl &url);
Q_INVOKABLE static QString convertToAbsolute(const QString &path);
Q_INVOKABLE static void messageHandler(QtMsgType type,
const QMessageLogContext &context,
const QString &msg);
Q_INVOKABLE QString log() const;
Q_INVOKABLE QString documentsDirectory() const;
Q_INVOKABLE int adBannerWidth() const;
Q_INVOKABLE int adBannerHeight() const;
private:
MediaToolsPrivate *d;
signals:
void windowWidthChanged(int windowWidth);
void windowHeightChanged(int windowHeight);
void interfaceLoaded();
void newInstanceOpened();
void logUpdated(const QString &messageType, const QString &lastLine);
void documentsDirectoryChanged(const QString &documentsDirectory);
void adBannerWidthChanged(int adBannerWidth);
void adBannerHeightChanged(int adBannerHeight);
public slots:
bool init(const CliOptions &cliOptions);
void setWindowWidth(int windowWidth);
void setWindowHeight(int windowHeight);
void setDocumentsDirectory(const QString &documentsDirectory);
void resetWindowWidth();
void resetWindowHeight();
void resetDocumentsDirectory();
void loadConfigs();
void saveConfigs();
void show();
bool showAd(AdType adType);
void printLog();
void saveLog();
void makedirs(const QString &path);
void restartApp();
};
Q_DECLARE_METATYPE(MediaTools::AdType)
#endif // MEDIATOOLS_H