Skip to content
Snippets Groups Projects
Commit 02c89ddd authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

[ #13265 ] Merge resolution and qsize into one class, deduplicate the code

parent 482beac5
No related branches found
No related tags found
No related merge requests found
......@@ -31,28 +31,21 @@ typedef QString VideoChannel;
typedef QString VideoRate;
///@struct Resolution Equivalent of "640x480"
struct LIB_EXPORT Resolution {
class LIB_EXPORT Resolution : public QSize {
public:
//Constructor
explicit Resolution(uint _width, uint _height):width(_width),height(_height){}
explicit Resolution(uint _width, uint _height):QSize(_width,_height){}
Resolution(QString size) {
if (size.split("x").size() == 2) {
width=size.split("x")[0].toInt();
height=size.split("x")[1].toInt();
setWidth(size.split("x")[0].toInt());
setHeight(size.split("x")[1].toInt());
}
}
Resolution(const Resolution& res):width(res.width),height(res.height){}
Resolution(const QSize& size):width(size.width()),height(size.height()){}
Resolution(const Resolution& res):QSize(res.width(),res.height()){}
Resolution(const QSize& size):QSize(size){}
//Getter
const QString toString() const { return QString::number(width)+"x"+QString::number(height);}
//Attributes
uint width;
uint height;
const QString toString() const { return QString::number(width())+"x"+QString::number(height());}
//Operator
bool operator==(const Resolution& other) {
return (other.width == width && other.height == height);
}
};
///VideoDevice: V4L devices used to record video for video call
......
......@@ -47,8 +47,8 @@ VideoRenderer::VideoRenderer(QString shmPath, Resolution res): QObject(0),
m_isRendering(false),m_pTimer(nullptr),m_Res(res)
{
m_ShmPath = shmPath ;
m_Width = res.width ;
m_Height = res.height ;
m_Width = res.width() ;
m_Height = res.height() ;
}
///Destructor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment