1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(video): Add video settings interface

This commit is contained in:
Diadlo 2017-10-22 19:39:11 +03:00
parent 44258b01f5
commit bc05d531a3
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 52 additions and 18 deletions

View File

@ -312,6 +312,7 @@ set(${PROJECT_NAME}_SOURCES
src/video/genericnetcamview.h src/video/genericnetcamview.h
src/video/groupnetcamview.cpp src/video/groupnetcamview.cpp
src/video/groupnetcamview.h src/video/groupnetcamview.h
src/video/ivideosettings.h
src/video/netcamview.cpp src/video/netcamview.cpp
src/video/netcamview.h src/video/netcamview.h
src/video/videoframe.cpp src/video/videoframe.cpp

View File

@ -25,6 +25,7 @@
#include "src/core/icoresettings.h" #include "src/core/icoresettings.h"
#include "src/core/toxencrypt.h" #include "src/core/toxencrypt.h"
#include "src/core/toxfile.h" #include "src/core/toxfile.h"
#include "src/video/ivideosettings.h"
#include <QDate> #include <QDate>
#include <QFlags> #include <QFlags>
@ -42,7 +43,7 @@ namespace Db {
enum class syncType; enum class syncType;
} }
class Settings : public QObject, public ICoreSettings, public IAudioSettings class Settings : public QObject, public ICoreSettings, public IAudioSettings, public IVideoSettings
{ {
Q_OBJECT Q_OBJECT
@ -225,13 +226,6 @@ signals:
void dbSyncTypeChanged(Db::syncType type); void dbSyncTypeChanged(Db::syncType type);
void blackListChanged(QStringList& blist); void blackListChanged(QStringList& blist);
// Video
void videoDevChanged(const QString& name);
void camVideoResChanged(const QRect& resolution);
void screenRegionChanged(const QRect& region);
void screenGrabbedChanged(bool enabled);
void camVideoFPSChanged(quint16 fps);
public: public:
bool getMakeToxPortable() const; bool getMakeToxPortable() const;
void setMakeToxPortable(bool newValue); void setMakeToxPortable(bool newValue);
@ -379,20 +373,26 @@ public:
SIGNAL_IMPL(Settings, enableTestSoundChanged, bool newValue) SIGNAL_IMPL(Settings, enableTestSoundChanged, bool newValue)
SIGNAL_IMPL(Settings, enableBackend2Changed, bool enabled) SIGNAL_IMPL(Settings, enableBackend2Changed, bool enabled)
QString getVideoDev() const; QString getVideoDev() const override;
void setVideoDev(const QString& deviceSpecifier); void setVideoDev(const QString& deviceSpecifier) override;
QRect getScreenRegion() const; QRect getScreenRegion() const override;
void setScreenRegion(const QRect& value); void setScreenRegion(const QRect& value) override;
bool getScreenGrabbed() const; bool getScreenGrabbed() const override;
void setScreenGrabbed(bool value); void setScreenGrabbed(bool value) override;
QRect getCamVideoRes() const; QRect getCamVideoRes() const override;
void setCamVideoRes(QRect newValue); void setCamVideoRes(QRect newValue) override;
unsigned short getCamVideoFPS() const; unsigned short getCamVideoFPS() const override;
void setCamVideoFPS(unsigned short newValue); void setCamVideoFPS(unsigned short newValue) override;
SIGNAL_IMPL(Settings, videoDevChanged, const QString& device)
SIGNAL_IMPL(Settings, screenRegionChanged, const QRect& region)
SIGNAL_IMPL(Settings, screenGrabbedChanged, bool enabled)
SIGNAL_IMPL(Settings, camVideoResChanged, const QRect& region)
SIGNAL_IMPL(Settings, camVideoFPSChanged, unsigned short fps)
bool isAnimationEnabled() const; bool isAnimationEnabled() const;
void setAnimationEnabled(bool newValue); void setAnimationEnabled(bool newValue);

View File

@ -0,0 +1,33 @@
#ifndef I_VIDEO_SETTINGS_H
#define I_VIDEO_SETTINGS_H
#include "src/model/interface.h"
#include <QString>
#include <QRect>
class IVideoSettings {
public:
virtual QString getVideoDev() const = 0;
virtual void setVideoDev(const QString& deviceSpecifier) = 0;
virtual QRect getScreenRegion() const = 0;
virtual void setScreenRegion(const QRect& value) = 0;
virtual bool getScreenGrabbed() const = 0;
virtual void setScreenGrabbed(bool value) = 0;
virtual QRect getCamVideoRes() const = 0;
virtual void setCamVideoRes(QRect newValue) = 0;
virtual unsigned short getCamVideoFPS() const = 0;
virtual void setCamVideoFPS(unsigned short newValue) = 0;
DECLARE_SIGNAL(videoDevChanged, const QString& device);
DECLARE_SIGNAL(screenRegionChanged, const QRect& region);
DECLARE_SIGNAL(screenGrabbedChanged, bool enabled);
DECLARE_SIGNAL(camVideoResChanged, const QRect& region);
DECLARE_SIGNAL(camVideoFPSChanged, unsigned short fps);
};
#endif // I_VIDEO_SETTINGS_H