-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 | 12 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.h | 1 |
4 files changed, 34 insertions, 0 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 @@ -51,12 +51,14 @@ using namespace Opie::Ui; using namespace Opie::Ui; DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) : QMainWindow(parent, name, WStyle_ContextHelp) { // init members + connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), + this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) ); m_pDrawPadCanvas = new DrawPadCanvas(this, this); connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); setCentralWidget(m_pDrawPadCanvas); @@ -660,6 +662,23 @@ void DrawPad::saveConfig() config.writeEntry("PagePosition", (int)m_pDrawPadCanvas->pagePosition()); config.writeEntry("AntiAliasing", antiAliasing()); config.writeEntry("PenWidth", (int)m_pen.width()); config.writeEntry("PenColor", m_pen.color().name()); config.writeEntry("BrushColor", m_brush.color().name()); } + + +/* + * Import a Thumbnail from SCAP or similiar + */ +void DrawPad::slotAppMessage( const QCString& str, const QByteArray& ar ) { + QDataStream stream(ar, IO_ReadOnly ); + /* + * import the pixmap + */ + if ( str == "importPixmap(QPixmap)" ) { + QPixmap pix; + stream >> pix;; + m_pDrawPadCanvas->importPixmap( pix ); + QPEApplication::setKeepRunning(); + } +} 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 @@ -45,12 +45,14 @@ public: private slots: void newPage(); void clearPage(); void deletePage(); + void slotAppMessage( const QCString&, const QByteArray& ); + void setPointTool(); void setLineTool(); void setRectangleTool(); void setFilledRectangleTool(); void setEllipseTool(); void setFilledEllipseTool(); 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 @@ -262,12 +262,24 @@ void DrawPadCanvas::importPage(const QString& fileName) resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); viewport()->update(); emit pagesChanged(); } +void DrawPadCanvas::importPixmap( const QPixmap& pix ) { + Page* importedPage = new Page(); + + (*importedPage->pixmap()) = pix; + m_pages.insert(m_pages.at()+1, importedPage ); + resizeContents(m_pages.current()->pixmap()->width(), + m_pages.current()->pixmap()->height() ); + viewport()->update(); + + emit pagesChanged(); +} + void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,const QString& format) { if (fromPage == toPage) { DocLnk docLnk; MimeType mimeType(format); 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 @@ -33,12 +33,13 @@ public: void load(QIODevice* ioDevice); void initialPage(); void save(QIODevice* ioDevice); void importPage(const QString& fileName); void exportPage(uint fromPage, uint toPage, const QString& name, const QString& format); + void importPixmap( const QPixmap& ); bool goPreviousPageEnabled(); bool goNextPageEnabled(); Page* currentPage(); QList<Page> pages(); |