summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-08 00:42:01 (UTC)
committer zecke <zecke>2004-04-08 00:42:01 (UTC)
commit5afca2540a2d6bf733c89ea97748496a679bc576 (patch) (side-by-side diff)
tree3e4e419ccc0e1b1cb71cc2cf7e75d36f9301de81
parent8c54ad421c7bee65b2a1442ce85c09f2eff3efc6 (diff)
downloadopie-5afca2540a2d6bf733c89ea97748496a679bc576.zip
opie-5afca2540a2d6bf733c89ea97748496a679bc576.tar.gz
opie-5afca2540a2d6bf733c89ea97748496a679bc576.tar.bz2
Import a QPixmap via QCOP
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
@@ -53,8 +53,10 @@ 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()));
@@ -662,4 +664,21 @@ void DrawPad::saveConfig()
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
@@ -47,8 +47,10 @@ private slots:
void newPage();
void clearPage();
void deletePage();
+ void slotAppMessage( const QCString&, const QByteArray& );
+
void setPointTool();
void setLineTool();
void setRectangleTool();
void setFilledRectangleTool();
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
@@ -179,9 +179,9 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
m_pages = drawPadCanvasXmlHandler.pages();
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)));
m_pages.current()->pixmap()->fill(Qt::white);
}
@@ -193,9 +193,9 @@ 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)));
//236, 232)); no more fixed sizes
@@ -264,8 +264,20 @@ void DrawPadCanvas::importPage(const QString& fileName)
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;
@@ -352,9 +364,9 @@ void DrawPadCanvas::selectPage(uint pagePosition)
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)));
m_pages.current()->pixmap()->fill(Qt::white);
@@ -388,9 +400,9 @@ void DrawPadCanvas::deletePage()
{
m_pages.remove(m_pages.current());
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)));
m_pages.current()->pixmap()->fill(Qt::white);
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
@@ -22,9 +22,9 @@
class DrawPad;
class Page;
class DrawPadCanvas : public QScrollView
-{
+{
Q_OBJECT
public:
DrawPadCanvas(DrawPad* drawPad, QWidget* parent = 0, const char* name = 0);
@@ -35,8 +35,9 @@ public:
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();
@@ -55,9 +56,9 @@ public slots:
void clearPage();
void deletePage();
void movePageUp();
void movePageDown();
-
+
void undo();
void redo();
void goFirstPage();