File indexing completed on 2024-05-05 17:09:07

0001 /*
0002  * This file is part of the KDE project
0003  * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #include "CQCanvasBase.h"
0021 
0022 class CQCanvasBase::Private
0023 {
0024 public:
0025     Private() : canvasController(0), zoomController(0) { }
0026 
0027     QString source;
0028     CQCanvasController *canvasController;
0029     KoZoomController* zoomController;
0030 };
0031 
0032 CQCanvasBase::CQCanvasBase(QDeclarativeItem* parent)
0033     : QDeclarativeItem(parent), d(new Private)
0034 {
0035 }
0036 
0037 CQCanvasBase::~CQCanvasBase()
0038 {
0039     delete d;
0040 }
0041 
0042 CQCanvasController* CQCanvasBase::canvasController() const
0043 {
0044     return d->canvasController;
0045 }
0046 
0047 KoZoomController* CQCanvasBase::zoomController() const
0048 {
0049     return d->zoomController;
0050 }
0051 
0052 QString CQCanvasBase::source() const
0053 {
0054     return d->source;
0055 }
0056 
0057 void CQCanvasBase::setSource(const QString& source)
0058 {
0059     if (source != d->source) {
0060         d->source = source;
0061         openFile(d->source);
0062         emit sourceChanged();
0063     }
0064 }
0065 
0066 qreal CQCanvasBase::shapeTransparency() const
0067 {
0068     return 0;
0069 }
0070 
0071 void CQCanvasBase::setShapeTransparency(qreal newTransparency)
0072 {
0073     Q_UNUSED(newTransparency);
0074     emit shapeTransparencyChanged();
0075 }
0076 
0077 void CQCanvasBase::setCanvasController(CQCanvasController* controller)
0078 {
0079     if (d->canvasController != controller) {
0080         d->canvasController = controller;
0081         emit canvasControllerChanged();
0082     }
0083 }
0084 
0085 void CQCanvasBase::setZoomController(KoZoomController* controller)
0086 {
0087     d->zoomController = controller;
0088 }