-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 19 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 2 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 20 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.h | 5 |
4 files changed, 40 insertions, 6 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 3331193..d9d0ce0 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -55,4 +55,6 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) | |||
55 | { | 55 | { |
56 | // init members | 56 | // init members |
57 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | ||
58 | this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) ); | ||
57 | 59 | ||
58 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); | 60 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); |
@@ -664,2 +666,19 @@ void DrawPad::saveConfig() | |||
664 | config.writeEntry("BrushColor", m_brush.color().name()); | 666 | config.writeEntry("BrushColor", m_brush.color().name()); |
665 | } | 667 | } |
668 | |||
669 | |||
670 | /* | ||
671 | * Import a Thumbnail from SCAP or similiar | ||
672 | */ | ||
673 | void DrawPad::slotAppMessage( const QCString& str, const QByteArray& ar ) { | ||
674 | QDataStream stream(ar, IO_ReadOnly ); | ||
675 | /* | ||
676 | * import the pixmap | ||
677 | */ | ||
678 | if ( str == "importPixmap(QPixmap)" ) { | ||
679 | QPixmap pix; | ||
680 | stream >> pix;; | ||
681 | m_pDrawPadCanvas->importPixmap( pix ); | ||
682 | QPEApplication::setKeepRunning(); | ||
683 | } | ||
684 | } | ||
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index 8ba6e58..ba9e47d 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h | |||
@@ -49,4 +49,6 @@ private slots: | |||
49 | void deletePage(); | 49 | void deletePage(); |
50 | 50 | ||
51 | void slotAppMessage( const QCString&, const QByteArray& ); | ||
52 | |||
51 | void setPointTool(); | 53 | void setPointTool(); |
52 | void setLineTool(); | 54 | void setLineTool(); |
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 446096c..423ef26 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp | |||
@@ -181,5 +181,5 @@ void DrawPadCanvas::load(QIODevice* ioDevice) | |||
181 | 181 | ||
182 | if (m_pages.isEmpty()) { | 182 | if (m_pages.isEmpty()) { |
183 | m_pages.append(new Page("", | 183 | m_pages.append(new Page("", |
184 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), | 184 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), |
185 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); | 185 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); |
@@ -195,5 +195,5 @@ void DrawPadCanvas::load(QIODevice* ioDevice) | |||
195 | void DrawPadCanvas::initialPage() | 195 | void DrawPadCanvas::initialPage() |
196 | { | 196 | { |
197 | m_pages.append(new Page("", | 197 | m_pages.append(new Page("", |
198 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), | 198 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), |
199 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); | 199 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); |
@@ -266,4 +266,16 @@ void DrawPadCanvas::importPage(const QString& fileName) | |||
266 | } | 266 | } |
267 | 267 | ||
268 | void DrawPadCanvas::importPixmap( const QPixmap& pix ) { | ||
269 | Page* importedPage = new Page(); | ||
270 | |||
271 | (*importedPage->pixmap()) = pix; | ||
272 | m_pages.insert(m_pages.at()+1, importedPage ); | ||
273 | resizeContents(m_pages.current()->pixmap()->width(), | ||
274 | m_pages.current()->pixmap()->height() ); | ||
275 | viewport()->update(); | ||
276 | |||
277 | emit pagesChanged(); | ||
278 | } | ||
279 | |||
268 | void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,const QString& format) | 280 | void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,const QString& format) |
269 | { | 281 | { |
@@ -354,5 +366,5 @@ void DrawPadCanvas::deleteAll() | |||
354 | m_pages.clear(); | 366 | m_pages.clear(); |
355 | 367 | ||
356 | m_pages.append(new Page("", | 368 | m_pages.append(new Page("", |
357 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), | 369 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), |
358 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); | 370 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); |
@@ -390,5 +402,5 @@ void DrawPadCanvas::deletePage() | |||
390 | 402 | ||
391 | if (m_pages.isEmpty()) { | 403 | if (m_pages.isEmpty()) { |
392 | m_pages.append(new Page("", | 404 | m_pages.append(new Page("", |
393 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), | 405 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), |
394 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); | 406 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); |
diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h index 80a2a7e..2b3d4a5 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.h +++ b/noncore/graphics/drawpad/drawpadcanvas.h | |||
@@ -24,5 +24,5 @@ class Page; | |||
24 | 24 | ||
25 | class DrawPadCanvas : public QScrollView | 25 | class DrawPadCanvas : public QScrollView |
26 | { | 26 | { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | 28 | ||
@@ -37,4 +37,5 @@ public: | |||
37 | void importPage(const QString& fileName); | 37 | void importPage(const QString& fileName); |
38 | void exportPage(uint fromPage, uint toPage, const QString& name, const QString& format); | 38 | void exportPage(uint fromPage, uint toPage, const QString& name, const QString& format); |
39 | void importPixmap( const QPixmap& ); | ||
39 | 40 | ||
40 | bool goPreviousPageEnabled(); | 41 | bool goPreviousPageEnabled(); |
@@ -57,5 +58,5 @@ public slots: | |||
57 | void movePageUp(); | 58 | void movePageUp(); |
58 | void movePageDown(); | 59 | void movePageDown(); |
59 | 60 | ||
60 | void undo(); | 61 | void undo(); |
61 | void redo(); | 62 | void redo(); |