summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp15
-rw-r--r--noncore/graphics/drawpad/drawpad.h1
-rw-r--r--noncore/graphics/drawpad/drawpad.pro4
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp64
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.h11
-rw-r--r--noncore/graphics/drawpad/erasetool.cpp2
-rw-r--r--noncore/graphics/drawpad/filltool.cpp2
-rw-r--r--noncore/graphics/drawpad/page.cpp33
-rw-r--r--noncore/graphics/drawpad/page.h29
-rw-r--r--noncore/graphics/drawpad/pointtool.cpp2
-rw-r--r--noncore/graphics/drawpad/shapetool.cpp2
-rw-r--r--noncore/graphics/drawpad/texttool.cpp2
-rw-r--r--noncore/graphics/drawpad/thumbnailview.cpp121
-rw-r--r--noncore/graphics/drawpad/thumbnailview.h40
14 files changed, 285 insertions, 43 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index 74787e5..b325323 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -27,2 +27,3 @@
#include "texttool.h"
+#include "thumbnailview.h"
@@ -80,2 +81,8 @@ DrawPad::DrawPad(QWidget* parent, const char* name)
+ toolsPopupMenu->insertSeparator();
+
+ QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this);
+ connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView()));
+ thumbnailViewAction->addTo(toolsPopupMenu);
+
menuBar->insertItem(tr("Tools"), toolsPopupMenu);
@@ -521 +528,9 @@ void DrawPad::exportPage()
}
+
+void DrawPad::thumbnailView()
+{
+ ThumbnailView thumbnailView(m_pDrawPadCanvas->pages(), this);
+
+ thumbnailView.showMaximized();
+ thumbnailView.exec();
+}
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h
index 0dcd5c9..b0b3666 100644
--- a/noncore/graphics/drawpad/drawpad.h
+++ b/noncore/graphics/drawpad/drawpad.h
@@ -61,2 +61,3 @@ private slots:
void exportPage();
+ void thumbnailView();
diff --git a/noncore/graphics/drawpad/drawpad.pro b/noncore/graphics/drawpad/drawpad.pro
index 9360256..9a640d2 100644
--- a/noncore/graphics/drawpad/drawpad.pro
+++ b/noncore/graphics/drawpad/drawpad.pro
@@ -13,2 +13,3 @@ HEADERS = drawpad.h \
newpagedialog.h \
+ page.h \
pointtool.h \
@@ -17,2 +18,3 @@ HEADERS = drawpad.h \
texttool.h \
+ thumbnailview.h \
tool.h
@@ -30,2 +32,3 @@ SOURCES = drawpad.cpp \
newpagedialog.cpp \
+ page.cpp \
pointtool.cpp \
@@ -34,2 +37,3 @@ SOURCES = drawpad.cpp \
texttool.cpp \
+ thumbnailview.cpp \
tool.cpp
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index 9f1e50b..79bef35 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -17,2 +17,3 @@
#include "newpagedialog.h"
+#include "page.h"
#include "tool.h"
@@ -27,3 +28,2 @@
#include <qpainter.h>
-#include <qpixmap.h>
#include <qtextcodec.h>
@@ -40,3 +40,3 @@ public:
- QList<QPixmap> pixmaps();
+ QList<Page> pages();
@@ -57,3 +57,3 @@ private:
QString m_dataFormat;
- QList<QPixmap> m_pixmaps;
+ QList<Page> m_pages;
};
@@ -69,5 +69,5 @@ DrawPadCanvasXmlHandler::~DrawPadCanvasXmlHandler()
-QList<QPixmap> DrawPadCanvasXmlHandler::pixmaps()
+QList<Page> DrawPadCanvasXmlHandler::pages()
{
- return m_pixmaps;
+ return m_pages;
}
@@ -149,5 +149,5 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch)
- QPixmap* pixmap = new QPixmap(image.width(), image.height());
- pixmap->convertFromImage(image);
- m_pixmaps.append(pixmap);
+ Page* page = new Page(image.width(), image.height());
+ page->convertFromImage(image);
+ m_pages.append(page);
}
@@ -183,6 +183,6 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
- m_pages = drawPadCanvasXmlHandler.pixmaps();
+ m_pages = drawPadCanvasXmlHandler.pages();
if (m_pages.isEmpty()) {
- m_pages.append(new QPixmap(contentsRect().size()));
+ m_pages.append(new Page(contentsRect().size()));
m_pages.current()->fill(Qt::white);
@@ -191,3 +191,3 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -202,3 +202,3 @@ void DrawPadCanvas::initialPage()
{
- m_pages.append(new QPixmap(236, 232));
+ m_pages.append(new Page(236, 232));
m_pages.current()->fill(Qt::white);
@@ -206,3 +206,3 @@ void DrawPadCanvas::initialPage()
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -223,3 +223,3 @@ void DrawPadCanvas::save(QIODevice* ioDevice)
- QListIterator<QPixmap> bufferIterator(m_pages);
+ QListIterator<Page> bufferIterator(m_pages);
@@ -258,9 +258,9 @@ void DrawPadCanvas::importPage(const QString& fileName)
{
- QPixmap* importedPixmap = new QPixmap();
+ Page* importedPage = new Page();
- importedPixmap->load(fileName);
- m_pages.insert(m_pages.at() + 1, importedPixmap);
+ importedPage->load(fileName);
+ m_pages.insert(m_pages.at() + 1, importedPage);
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -310,3 +310,3 @@ void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,c
-QPixmap* DrawPadCanvas::currentPage()
+Page* DrawPadCanvas::currentPage()
{
@@ -315,3 +315,3 @@ QPixmap* DrawPadCanvas::currentPage()
-QList<QPixmap> DrawPadCanvas::pages()
+QList<Page> DrawPadCanvas::pages()
{
@@ -341,3 +341,3 @@ void DrawPadCanvas::backupPage()
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -359,3 +359,3 @@ void DrawPadCanvas::deleteAll()
- m_pages.append(new QPixmap(contentsRect().size()));
+ m_pages.append(new Page(contentsRect().size()));
m_pages.current()->fill(Qt::white);
@@ -363,3 +363,3 @@ void DrawPadCanvas::deleteAll()
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -381,4 +381,4 @@ void DrawPadCanvas::newPage()
if (newPageDialog.exec() == QDialog::Accepted) {
- m_pages.insert(m_pages.at() + 1, new QPixmap(newPageDialog.selectedWidth(),
- newPageDialog.selectedHeight()));
+ m_pages.insert(m_pages.at() + 1, new Page(newPageDialog.selectedWidth(),
+ newPageDialog.selectedHeight()));
m_pages.current()->fill(newPageDialog.selectedColor());
@@ -386,3 +386,3 @@ void DrawPadCanvas::newPage()
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -427,3 +427,3 @@ void DrawPadCanvas::deletePage()
if (m_pages.isEmpty()) {
- m_pages.append(new QPixmap(contentsRect().size()));
+ m_pages.append(new Page(contentsRect().size()));
m_pages.current()->fill(Qt::white);
@@ -432,3 +432,3 @@ void DrawPadCanvas::deletePage()
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -484,3 +484,3 @@ void DrawPadCanvas::goFirstPage()
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -497,3 +497,3 @@ void DrawPadCanvas::goPreviousPage()
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -510,3 +510,3 @@ void DrawPadCanvas::goNextPage()
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
@@ -523,3 +523,3 @@ void DrawPadCanvas::goLastPage()
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h
index e05ce8a..47763f9 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.h
+++ b/noncore/graphics/drawpad/drawpadcanvas.h
@@ -22,4 +22,3 @@
class DrawPad;
-
-class QPixmap;
+class Page;
@@ -45,4 +44,4 @@ public:
- QPixmap* currentPage();
- QList<QPixmap> pages();
+ Page* currentPage();
+ QList<Page> pages();
uint pagePosition();
@@ -78,4 +77,4 @@ private:
DrawPad* m_pDrawPad;
- QList<QPixmap> m_pages;
- QList<QPixmap> m_pageBackups;
+ QList<Page> m_pages;
+ QList<Page> m_pageBackups;
};
diff --git a/noncore/graphics/drawpad/erasetool.cpp b/noncore/graphics/drawpad/erasetool.cpp
index 828994b..f77e038 100644
--- a/noncore/graphics/drawpad/erasetool.cpp
+++ b/noncore/graphics/drawpad/erasetool.cpp
@@ -17,5 +17,5 @@
#include "drawpadcanvas.h"
+#include "page.h"
#include <qpainter.h>
-#include <qpixmap.h>
diff --git a/noncore/graphics/drawpad/filltool.cpp b/noncore/graphics/drawpad/filltool.cpp
index 004da02..d323cc2 100644
--- a/noncore/graphics/drawpad/filltool.cpp
+++ b/noncore/graphics/drawpad/filltool.cpp
@@ -17,5 +17,5 @@
#include "drawpadcanvas.h"
+#include "page.h"
#include <qimage.h>
-#include <qpixmap.h>
diff --git a/noncore/graphics/drawpad/page.cpp b/noncore/graphics/drawpad/page.cpp
new file mode 100644
index 0000000..35ec0e0
--- a/dev/null
+++ b/noncore/graphics/drawpad/page.cpp
@@ -0,0 +1,33 @@
+/***************************************************************************
+ * *
+ * DrawPad - a drawing program for Opie Environment *
+ * *
+ * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "page.h"
+
+Page::Page()
+ : QPixmap()
+{
+}
+
+Page::Page(int w, int h)
+ : QPixmap(w, h)
+{
+}
+
+Page::Page(const QSize& size)
+ : QPixmap(size)
+{
+}
+
+Page::~Page()
+{
+}
diff --git a/noncore/graphics/drawpad/page.h b/noncore/graphics/drawpad/page.h
new file mode 100644
index 0000000..888f552
--- a/dev/null
+++ b/noncore/graphics/drawpad/page.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * *
+ * DrawPad - a drawing program for Opie Environment *
+ * *
+ * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef PAGE_H
+#define PAGE_H
+
+#include <qpixmap.h>
+
+class Page : public QPixmap
+{
+public:
+ Page();
+ Page(int w, int h);
+ Page(const QSize& size);
+
+ ~Page();
+};
+
+#endif // PAGE_H
diff --git a/noncore/graphics/drawpad/pointtool.cpp b/noncore/graphics/drawpad/pointtool.cpp
index e281284..656044b 100644
--- a/noncore/graphics/drawpad/pointtool.cpp
+++ b/noncore/graphics/drawpad/pointtool.cpp
@@ -17,5 +17,5 @@
#include "drawpadcanvas.h"
+#include "page.h"
#include <qpainter.h>
-#include <qpixmap.h>
diff --git a/noncore/graphics/drawpad/shapetool.cpp b/noncore/graphics/drawpad/shapetool.cpp
index bc5d9c0..8870a78 100644
--- a/noncore/graphics/drawpad/shapetool.cpp
+++ b/noncore/graphics/drawpad/shapetool.cpp
@@ -17,5 +17,5 @@
#include "drawpadcanvas.h"
+#include "page.h"
#include <qpainter.h>
-#include <qpixmap.h>
diff --git a/noncore/graphics/drawpad/texttool.cpp b/noncore/graphics/drawpad/texttool.cpp
index 37b4801..34c8a76 100644
--- a/noncore/graphics/drawpad/texttool.cpp
+++ b/noncore/graphics/drawpad/texttool.cpp
@@ -17,2 +17,3 @@
#include "drawpadcanvas.h"
+#include "page.h"
@@ -21,3 +22,2 @@
#include <qpainter.h>
-#include <qpixmap.h>
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp
new file mode 100644
index 0000000..10ade90
--- a/dev/null
+++ b/noncore/graphics/drawpad/thumbnailview.cpp
@@ -0,0 +1,121 @@
+/***************************************************************************
+ * *
+ * DrawPad - a drawing program for Opie Environment *
+ * *
+ * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "thumbnailview.h"
+
+#include "page.h"
+
+#include <qpe/resource.h>
+
+#include <qheader.h>
+#include <qimage.h>
+#include <qlayout.h>
+#include <qlistview.h>
+#include <qtoolbutton.h>
+
+ThumbnailView::ThumbnailView(QList<Page> pages, QWidget* parent, const char* name)
+ : QDialog(parent, name, true)
+{
+ setCaption(tr("Thumbnail"));
+
+ QToolButton* newPageButton = new QToolButton(this);
+ newPageButton->setIconSet(Resource::loadIconSet("new"));
+ newPageButton->setAutoRaise(true);
+
+ QToolButton* clearPageButton = new QToolButton(this);
+ clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear"));
+ clearPageButton->setAutoRaise(true);
+
+ QToolButton* deletePageButton = new QToolButton(this);
+ deletePageButton->setIconSet(Resource::loadIconSet("trash"));
+ deletePageButton->setAutoRaise(true);
+
+ QToolButton* movePageUpButton = new QToolButton(this);
+ movePageUpButton->setIconSet(Resource::loadIconSet("up"));
+ movePageUpButton->setAutoRaise(true);
+
+ QToolButton* movePageDownButton = new QToolButton(this);
+ movePageDownButton->setIconSet(Resource::loadIconSet("down"));
+ movePageDownButton->setAutoRaise(true);
+
+ m_pListView = new QListView(this);
+
+ m_pListView->header()->hide();
+ m_pListView->setAllColumnsShowFocus(true);
+
+ m_pListView->addColumn(tr("Thumbnail"));
+ m_pListView->addColumn(tr("Information"));
+
+ m_pListView->setColumnAlignment(0, Qt::AlignHCenter | Qt::AlignVCenter);
+ m_pListView->setColumnAlignment(1, Qt::AlignTop);
+
+ QListIterator<Page> iterator(pages);
+
+ for (; iterator.current(); ++iterator) {
+ QImage image = iterator.current()->convertToImage();
+
+ int previewWidth = 64;
+ int previewHeight = 64;
+
+ float widthScale = 1.0;
+ float heightScale = 1.0;
+
+ if (previewWidth < image.width()) {
+ widthScale = (float)previewWidth / float(image.width());
+ }
+
+ if (previewHeight < image.height()) {
+ heightScale = (float)previewHeight / float(image.height());
+ }
+
+ float scale = (widthScale < heightScale ? widthScale : heightScale);
+ QImage previewImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale));
+
+ QPixmap previewPixmap;
+ previewPixmap.convertFromImage(previewImage);
+
+ QPixmap pixmap(64, 64);
+
+ pixmap.fill(colorGroup().mid());
+ bitBlt(&pixmap, (pixmap.width() - previewPixmap.width()) / 2,
+ (pixmap.height() - previewPixmap.height()) / 2, &previewPixmap);
+
+ QListViewItem* item = new QListViewItem(m_pListView);
+ item->setPixmap(0, pixmap);
+ }
+
+ QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
+ QHBoxLayout* buttonLayout = new QHBoxLayout(0);
+
+ buttonLayout->addWidget(newPageButton);
+ buttonLayout->addWidget(clearPageButton);
+ buttonLayout->addWidget(deletePageButton);
+ buttonLayout->addStretch();
+ buttonLayout->addWidget(movePageUpButton);
+ buttonLayout->addWidget(movePageDownButton);
+
+ mainLayout->addLayout(buttonLayout);
+ mainLayout->addWidget(m_pListView);
+}
+
+ThumbnailView::~ThumbnailView()
+{
+}
+
+void ThumbnailView::resizeEvent(QResizeEvent* e)
+{
+ QDialog::resizeEvent(e);
+
+ m_pListView->setColumnWidth(1, m_pListView->contentsRect().width() - m_pListView->columnWidth(0)
+ - m_pListView->verticalScrollBar()->width());
+}
diff --git a/noncore/graphics/drawpad/thumbnailview.h b/noncore/graphics/drawpad/thumbnailview.h
new file mode 100644
index 0000000..c74730d
--- a/dev/null
+++ b/noncore/graphics/drawpad/thumbnailview.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * *
+ * DrawPad - a drawing program for Opie Environment *
+ * *
+ * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef THUMBNAILVIEW_H
+#define THUMBNAILVIEW_H
+
+#include <qdialog.h>
+
+#include <qlist.h>
+
+class QListView;
+
+class Page;
+
+class ThumbnailView : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ThumbnailView(QList<Page> pages, QWidget* parent = 0, const char* name = 0);
+ ~ThumbnailView();
+
+protected:
+ void resizeEvent(QResizeEvent* e);
+
+private:
+ QListView* m_pListView;
+};
+
+#endif // THUMBNAILVIEW_H