summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp19
-rw-r--r--noncore/graphics/drawpad/drawpad.h2
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp20
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.h5
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*/ )
{
// init members
+ connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
+ this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) );
m_pDrawPadCanvas = new DrawPadCanvas(this, this);
@@ -664,2 +666,19 @@ void DrawPad::saveConfig()
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
@@ -49,4 +49,6 @@ private slots:
void deletePage();
+ void slotAppMessage( const QCString&, const QByteArray& );
+
void setPointTool();
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)
if (m_pages.isEmpty()) {
- m_pages.append(new Page("",
+ m_pages.append(new Page("",
clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
@@ -195,5 +195,5 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
void DrawPadCanvas::initialPage()
{
- m_pages.append(new Page("",
+ m_pages.append(new Page("",
clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
@@ -266,4 +266,16 @@ void DrawPadCanvas::importPage(const QString& fileName)
}
+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)
{
@@ -354,5 +366,5 @@ void DrawPadCanvas::deleteAll()
m_pages.clear();
- m_pages.append(new Page("",
+ m_pages.append(new Page("",
clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
@@ -390,5 +402,5 @@ void DrawPadCanvas::deletePage()
if (m_pages.isEmpty()) {
- m_pages.append(new Page("",
+ m_pages.append(new Page("",
clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
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;
class DrawPadCanvas : public QScrollView
-{
+{
Q_OBJECT
@@ -37,4 +37,5 @@ public:
void importPage(const QString& fileName);
void exportPage(uint fromPage, uint toPage, const QString& name, const QString& format);
+ void importPixmap( const QPixmap& );
bool goPreviousPageEnabled();
@@ -57,5 +58,5 @@ public slots:
void movePageUp();
void movePageDown();
-
+
void undo();
void redo();