From 02c89dddaf8d938a9d95b467e0192765d53d0b07 Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Mon, 30 Jul 2012 11:23:26 -0400
Subject: [PATCH] [ #13265 ] Merge resolution and qsize into one class,
 deduplicate the code

---
 src/videodevice.h     | 23 ++++++++---------------
 src/videorenderer.cpp |  6 +++---
 2 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/src/videodevice.h b/src/videodevice.h
index a391423a..4a6bc60b 100644
--- a/src/videodevice.h
+++ b/src/videodevice.h
@@ -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);}
+   const QString toString() const { return QString::number(width())+"x"+QString::number(height());}
 
-   //Attributes
-   uint width;
-   uint height;
-
-   //Operator
-   bool operator==(const Resolution& other) {
-      return (other.width == width && other.height == height);
-   }
 };
 
 ///VideoDevice: V4L devices used to record video for video call
diff --git a/src/videorenderer.cpp b/src/videorenderer.cpp
index 78947b80..97e532d2 100644
--- a/src/videorenderer.cpp
+++ b/src/videorenderer.cpp
@@ -46,9 +46,9 @@ VideoRenderer::VideoRenderer(QString shmPath, Resolution res): QObject(0),
    m_pShmArea((SHMHeader*)MAP_FAILED), m_ShmAreaLen(0), m_BufferGen(0),
    m_isRendering(false),m_pTimer(nullptr),m_Res(res)
 {
-   m_ShmPath = shmPath    ;
-   m_Width   = res.width  ;
-   m_Height  = res.height ;
+   m_ShmPath = shmPath      ;
+   m_Width   = res.width()  ;
+   m_Height  = res.height() ;
 }
 
 ///Destructor
-- 
GitLab