1 /* Webcamoid, webcam capture application. 2 * Copyright (C) 2015 Gonzalo Exequiel Pedone 3 * 4 * Webcamoid 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 * Webcamoid 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 Webcamoid. If not, see <http://www.gnu.org/licenses/>. 16 * 17 * Web-Site: http://webcamoid.github.io/ 18 */ 19 20 #ifndef MEDIATOOLS_H 21 #define MEDIATOOLS_H 22 23 #include <akelement.h> 24 25 class MediaToolsPrivate; 26 class QQmlApplicationEngine; 27 class AkCaps; 28 29 class MediaTools: public QObject 30 { 31 Q_OBJECT 32 Q_PROPERTY(int windowWidth 33 READ windowWidth 34 WRITE setWindowWidth 35 RESET resetWindowWidth 36 NOTIFY windowWidthChanged) 37 Q_PROPERTY(int windowHeight 38 READ windowHeight 39 WRITE setWindowHeight 40 RESET resetWindowHeight 41 NOTIFY windowHeightChanged) 42 Q_PROPERTY(bool enableVirtualCamera 43 READ enableVirtualCamera 44 WRITE setEnableVirtualCamera 45 RESET resetEnableVirtualCamera 46 NOTIFY enableVirtualCameraChanged) 47 Q_PROPERTY(AkElement::ElementState virtualCameraState 48 READ virtualCameraState 49 WRITE setVirtualCameraState 50 RESET resetVirtualCameraState 51 NOTIFY virtualCameraStateChanged) 52 53 public: 54 MediaTools(QObject *parent=nullptr); 55 ~MediaTools(); 56 57 Q_INVOKABLE int windowWidth() const; 58 Q_INVOKABLE int windowHeight() const; 59 Q_INVOKABLE bool enableVirtualCamera() const; 60 Q_INVOKABLE AkElement::ElementState virtualCameraState() const; 61 Q_INVOKABLE QString applicationName() const; 62 Q_INVOKABLE QString applicationVersion() const; 63 Q_INVOKABLE QString qtVersion() const; 64 Q_INVOKABLE QString copyrightNotice() const; 65 Q_INVOKABLE QString projectUrl() const; 66 Q_INVOKABLE QString projectLicenseUrl() const; 67 Q_INVOKABLE QString projectDownloadsUrl() const; 68 Q_INVOKABLE QString projectIssuesUrl() const; 69 Q_INVOKABLE QString fileNameFromUri(const QString &uri) const; 70 Q_INVOKABLE bool matches(const QString &pattern, const QStringList &strings) const; 71 Q_INVOKABLE QString currentTime() const; 72 Q_INVOKABLE QStringList standardLocations(const QString &type) const; 73 Q_INVOKABLE QString saveFileDialog(const QString &caption="", 74 const QString &fileName="", 75 const QString &directory="", 76 const QString &suffix="", 77 const QString &filters="") const; 78 Q_INVOKABLE QString readFile(const QString &fileName) const; 79 Q_INVOKABLE QString urlToLocalFile(const QUrl &url) const; 80 Q_INVOKABLE bool embedVirtualCameraControls(const QString &where, 81 const QString &name=""); 82 Q_INVOKABLE void removeInterface(const QString &where, 83 QQmlApplicationEngine *engine=nullptr); 84 static QString convertToAbsolute(const QString &path); 85 86 private: 87 MediaToolsPrivate *d; 88 89 signals: 90 void windowWidthChanged(int windowWidth); 91 void windowHeightChanged(int windowHeight); 92 void enableVirtualCameraChanged(bool enableVirtualCamera); 93 void virtualCameraStateChanged(AkElement::ElementState virtualCameraState); 94 void error(const QString &message); 95 void interfaceLoaded(); 96 97 public slots: 98 void setWindowWidth(int windowWidth); 99 void setWindowHeight(int windowHeight); 100 void setEnableVirtualCamera(bool enableVirtualCamera); 101 void setVirtualCameraState(AkElement::ElementState virtualCameraState); 102 void resetWindowWidth(); 103 void resetWindowHeight(); 104 void resetEnableVirtualCamera(); 105 void resetVirtualCameraState(); 106 void loadConfigs(); 107 void saveConfigs(); 108 void show(); 109 110 private slots: 111 void updateVCamCaps(const AkCaps &videoCaps); 112 void updateVCamState(); 113 }; 114 115 #endif // MEDIATOOLS_H 116