diff options
author | Javier S. Pedro <dev.git@javispedro.com> | 2014-09-13 22:40:39 +0200 |
---|---|---|
committer | Javier S. Pedro <dev.git@javispedro.com> | 2014-09-13 22:40:39 +0200 |
commit | 85fb48bc51fed06a50b6178727fdf9e96aea4fc4 (patch) | |
tree | e5aa942addaf99bb29c73f5e946cf250ca8b80f8 /src/widgetinfo.cpp | |
parent | ed40a7f1cbc1da5ae21c58882df241fc0071c2f7 (diff) | |
download | salmeta-85fb48bc51fed06a50b6178727fdf9e96aea4fc4.tar.gz salmeta-85fb48bc51fed06a50b6178727fdf9e96aea4fc4.zip |
UI can now add some widgets around
Diffstat (limited to 'src/widgetinfo.cpp')
-rw-r--r-- | src/widgetinfo.cpp | 80 |
1 files changed, 48 insertions, 32 deletions
diff --git a/src/widgetinfo.cpp b/src/widgetinfo.cpp index 477b61c..d23da8f 100644 --- a/src/widgetinfo.cpp +++ b/src/widgetinfo.cpp @@ -1,83 +1,99 @@ #include "widgetinfo.h" -WidgetInfo::WidgetInfo(QObject *parent) - : QObject(parent) +struct WidgetInfoData : public QSharedData { + QUrl url; + QString desc; + bool invert; + short page; + WidgetInfo::WidgetSize size; + WidgetInfo::WidgetPosition pos; +}; +WidgetInfo::WidgetInfo() + : d(new WidgetInfoData) +{ +} + +WidgetInfo::WidgetInfo(const WidgetInfo &other) + : d(other.d) +{ +} + +WidgetInfo::~WidgetInfo() +{ +} + +WidgetInfo& WidgetInfo::operator =(const WidgetInfo &other) +{ + if (this != &other) { + d = other.d; + } + + return *this; } bool WidgetInfo::valid() const { - return !_url.isEmpty(); + return !d->url.isEmpty(); } QUrl WidgetInfo::url() const { - return _url; + return d->url; } void WidgetInfo::setUrl(const QUrl &url) { - if (url != _url) { - const bool cur_valid = valid(); + d->url = url; +} - _url = url; - emit urlChanged(); +QString WidgetInfo::description() const +{ + return d->desc; +} - if (cur_valid != valid()) { - emit validChanged(); - } - } +void WidgetInfo::setDescription(const QString &desc) +{ + d->desc = desc; } bool WidgetInfo::invert() const { - return _invert; + return d->invert; } void WidgetInfo::setInvert(bool invert) { - if (invert != _invert) { - _invert = invert; - emit invertChanged(); - } + d->invert = invert; } int WidgetInfo::page() const { - return _page; + return d->page; } void WidgetInfo::setPage(int page) { - if (page != _page) { - _page = page; - emit pageChanged(); - } + d->page = page; } WidgetInfo::WidgetSize WidgetInfo::size() const { - return _size; + return d->size; } void WidgetInfo::setSize(const WidgetSize &size) { - if (size != _size) { - _size = size; - emit sizeChanged(); - } + d->size = size; } WidgetInfo::WidgetPosition WidgetInfo::position() const { - return _pos; + return d->pos; } void WidgetInfo::setPosition(const WidgetPosition &pos) { - if (pos != _pos) { - _pos = pos; - emit positionChanged(); - } + d->pos = pos; } |