1 /*
2  * This file is part of the KDE project
3  * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #include "CQCanvasBase.h"
21 
22 class CQCanvasBase::Private
23 {
24 public:
Private()25     Private() : canvasController(0), zoomController(0) { }
26 
27     QString source;
28     CQCanvasController *canvasController;
29     KoZoomController* zoomController;
30 };
31 
CQCanvasBase(QDeclarativeItem * parent)32 CQCanvasBase::CQCanvasBase(QDeclarativeItem* parent)
33     : QDeclarativeItem(parent), d(new Private)
34 {
35 }
36 
~CQCanvasBase()37 CQCanvasBase::~CQCanvasBase()
38 {
39     delete d;
40 }
41 
canvasController() const42 CQCanvasController* CQCanvasBase::canvasController() const
43 {
44     return d->canvasController;
45 }
46 
zoomController() const47 KoZoomController* CQCanvasBase::zoomController() const
48 {
49     return d->zoomController;
50 }
51 
source() const52 QString CQCanvasBase::source() const
53 {
54     return d->source;
55 }
56 
setSource(const QString & source)57 void CQCanvasBase::setSource(const QString& source)
58 {
59     if (source != d->source) {
60         d->source = source;
61         openFile(d->source);
62         emit sourceChanged();
63     }
64 }
65 
shapeTransparency() const66 qreal CQCanvasBase::shapeTransparency() const
67 {
68     return 0;
69 }
70 
setShapeTransparency(qreal newTransparency)71 void CQCanvasBase::setShapeTransparency(qreal newTransparency)
72 {
73     Q_UNUSED(newTransparency);
74     emit shapeTransparencyChanged();
75 }
76 
setCanvasController(CQCanvasController * controller)77 void CQCanvasBase::setCanvasController(CQCanvasController* controller)
78 {
79     if (d->canvasController != controller) {
80         d->canvasController = controller;
81         emit canvasControllerChanged();
82     }
83 }
84 
setZoomController(KoZoomController * controller)85 void CQCanvasBase::setZoomController(KoZoomController* controller)
86 {
87     d->zoomController = controller;
88 }
89