summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad
Side-by-side diff
Diffstat (limited to 'noncore/graphics/drawpad') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp6
-rw-r--r--noncore/graphics/drawpad/drawpad.h1
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp20
-rw-r--r--noncore/graphics/drawpad/exportdialog.cpp11
-rw-r--r--noncore/graphics/drawpad/importdialog.cpp14
-rw-r--r--noncore/graphics/drawpad/importdialog.h4
-rw-r--r--noncore/graphics/drawpad/main.cpp2
-rw-r--r--noncore/graphics/drawpad/opie-drawpad.control2
-rw-r--r--noncore/graphics/drawpad/texttool.h1
9 files changed, 44 insertions, 17 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index 4db6208..aac6bc1 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -269,36 +269,42 @@ DrawPad::DrawPad(QWidget* parent, const char* name)
m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor"));
QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) );
OColorPopupMenu* brushColorPopupMenu = new OColorPopupMenu(Qt::white, m_pBrushColorToolButton);
connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&)));
QToolTip::add(m_pBrushColorToolButton, tr("Fill Color"));
m_pBrushColorToolButton->setPopup(brushColorPopupMenu);
m_pBrushColorToolButton->setPopupDelay(0);
changeBrushColor(Qt::white);
+}
+
+
+void DrawPad::finishStartup()
+{
// init pages
QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
if (file.open(IO_ReadOnly)) {
m_pDrawPadCanvas->load(&file);
file.close();
} else {
m_pDrawPadCanvas->initialPage();
}
loadConfig();
+
}
DrawPad::~DrawPad()
{
saveConfig();
QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
if (file.open(IO_WriteOnly)) {
m_pDrawPadCanvas->save(&file);
file.close();
}
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h
index 7306228..2cae700 100644
--- a/noncore/graphics/drawpad/drawpad.h
+++ b/noncore/graphics/drawpad/drawpad.h
@@ -31,24 +31,25 @@ class DrawPad : public QMainWindow
{
Q_OBJECT
public:
DrawPad(QWidget* parent = 0, const char* name = 0);
~DrawPad();
Tool* tool() { return m_pTool; }
QPen pen() { return m_pen; }
QBrush brush() { return m_brush; }
bool antiAliasing();
+ void finishStartup();
private slots:
void newPage();
void clearPage();
void deletePage();
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 025bebb..dec498b 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -173,37 +173,43 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
textStream.setCodec(QTextCodec::codecForName("UTF-8"));
QXmlInputSource xmlInputSource(textStream);
QXmlSimpleReader xmlSimpleReader;
DrawPadCanvasXmlHandler drawPadCanvasXmlHandler;
xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler);
xmlSimpleReader.parse(xmlInputSource);
m_pages = drawPadCanvasXmlHandler.pages();
if (m_pages.isEmpty()) {
- m_pages.append(new Page("", contentsRect().size()));
+ 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);
}
resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
viewport()->update();
emit pagesChanged();
}
void DrawPadCanvas::initialPage()
{
- m_pages.append(new Page("", 236, 232));
+ 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
+
m_pages.current()->pixmap()->fill(Qt::white);
resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
viewport()->update();
emit pagesChanged();
}
void DrawPadCanvas::save(QIODevice* ioDevice)
{
QTextStream textStream(ioDevice);
textStream.setCodec(QTextCodec::codecForName("UTF-8"));
@@ -340,25 +346,28 @@ void DrawPadCanvas::selectPage(uint pagePosition)
m_pages.at(pagePosition - 1);
resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
viewport()->update();
emit pagesChanged();
}
void DrawPadCanvas::deleteAll()
{
m_pages.clear();
- m_pages.append(new Page("", contentsRect().size()));
+ 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);
resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
viewport()->update();
emit pagesChanged();
}
void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color)
{
m_pages.insert(m_pages.at() + 1, new Page(title, width, height));
m_pages.current()->pixmap()->fill(color);
@@ -373,25 +382,28 @@ void DrawPadCanvas::clearPage()
{
m_pages.current()->pixmap()->fill(Qt::white);
resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
viewport()->update();
}
void DrawPadCanvas::deletePage()
{
m_pages.remove(m_pages.current());
if (m_pages.isEmpty()) {
- m_pages.append(new Page("", contentsRect().size()));
+ 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);
}
resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
viewport()->update();
emit pagesChanged();
}
void DrawPadCanvas::movePageUp()
{
int index = m_pages.at();
diff --git a/noncore/graphics/drawpad/exportdialog.cpp b/noncore/graphics/drawpad/exportdialog.cpp
index 5b11c0e..adbd612 100644
--- a/noncore/graphics/drawpad/exportdialog.cpp
+++ b/noncore/graphics/drawpad/exportdialog.cpp
@@ -4,25 +4,25 @@
* *
* (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 "exportdialog.h"
-#include <qpe/fileselector.h>
+#include <opie/ofileselector.h>
#include <qbuttongroup.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qimage.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <stdlib.h>
@@ -57,27 +57,30 @@ ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const c
m_pToPageSpinBox->setValue(pageAt);
QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this);
QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox);
QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox);
m_pNameLineEdit = new QLineEdit(exportGroupBox);
m_pFormatComboBox = new QComboBox(exportGroupBox);
m_pFormatComboBox->insertStrList(QImageIO::outputFormats());
- FileSelector* fileSelector = new FileSelector("image/*", this, "fileselector");
- fileSelector->setNewVisible(false);
- fileSelector->setCloseVisible(false);
+ MimeTypes types; types.insert( tr("All Images"), "image/*" );
+ OFileSelector* fileSelector = new OFileSelector(this, OFileSelector::FileSelector,
+ OFileSelector::Normal,
+ QString::null, QString::null,
+ types );
+ fileSelector->setNameVisible( false );
QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
selectionButtonGroup->layout()->setSpacing(4);
exportGroupBox->layout()->setSpacing(4);
QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2);
QHBoxLayout* rangeLayout = new QHBoxLayout();
QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2);
selectionLayout->addWidget(selectAllRadioButton, 0, 0);
selectionLayout->addWidget(selectCurrentRadioButton, 1, 0);
selectionLayout->addWidget(selectRangeRadioButton, 0, 1);
selectionLayout->addLayout(rangeLayout, 1, 1);
diff --git a/noncore/graphics/drawpad/importdialog.cpp b/noncore/graphics/drawpad/importdialog.cpp
index 1c447cb..9a59a20 100644
--- a/noncore/graphics/drawpad/importdialog.cpp
+++ b/noncore/graphics/drawpad/importdialog.cpp
@@ -5,41 +5,45 @@
* (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 "importdialog.h"
#include <qpe/applnk.h>
-#include <qpe/fileselector.h>
+#include <opie/ofileselector.h>
#include <qcheckbox.h>
#include <qimage.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
ImportDialog::ImportDialog(QWidget* parent, const char* name)
: QDialog(parent, name, true)
{
setCaption(tr("DrawPad - Import"));
- m_pFileSelector = new FileSelector("image/*", this, "fileselector");
+ MimeTypes types; types.insert( tr("All images"),"image/*" );
+ m_pFileSelector = new OFileSelector(this,
+ OFileSelector::FileSelector,
+ OFileSelector::Normal,
+ QString::null,
+ QString::null, types );
+ m_pFileSelector->setNameVisible( false );
connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged()));
- m_pFileSelector->setNewVisible(false);
- m_pFileSelector->setCloseVisible(false);
m_pPreviewLabel = new QLabel(this);
m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
m_pPreviewLabel->setFixedSize(114, 114);
m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid);
m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this);
m_pAutomaticPreviewCheckBox->setChecked(true);
QPushButton* previewPushButton = new QPushButton(tr("Preview"), this);
connect(previewPushButton, SIGNAL(clicked()), this, SLOT(preview()));
@@ -59,25 +63,25 @@ ImportDialog::ImportDialog(QWidget* parent, const char* name)
mainLayout->addLayout(previewLayout);
preview();
}
ImportDialog::~ImportDialog()
{
}
const DocLnk* ImportDialog::selected()
{
// FIXME change from pointer to reference -zecke
- DocLnk *lnk = new DocLnk( m_pFileSelector->selectedDocument() );
+ DocLnk *lnk = new DocLnk( m_pFileSelector->selectedDocument() );
return lnk;
}
void ImportDialog::fileChanged()
{
if (m_pAutomaticPreviewCheckBox->isChecked()) {
preview();
}
}
void ImportDialog::preview()
{
diff --git a/noncore/graphics/drawpad/importdialog.h b/noncore/graphics/drawpad/importdialog.h
index ef51d7c..ed655a5 100644
--- a/noncore/graphics/drawpad/importdialog.h
+++ b/noncore/graphics/drawpad/importdialog.h
@@ -8,38 +8,38 @@
* 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 IMPORTDIALOG_H
#define IMPORTDIALOG_H
#include <qdialog.h>
class DocLnk;
-class FileSelector;
+class OFileSelector;
class QCheckBox;
class QLabel;
class ImportDialog : public QDialog
{
Q_OBJECT
public:
ImportDialog(QWidget* parent = 0, const char* name = 0);
~ImportDialog();
const DocLnk* selected();
private slots:
void fileChanged();
void preview();
private:
- FileSelector* m_pFileSelector;
+ OFileSelector* m_pFileSelector;
QLabel* m_pPreviewLabel;
QCheckBox* m_pAutomaticPreviewCheckBox;
};
#endif // IMPORTDIALOG_H
diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp
index ec628cc..12f8084 100644
--- a/noncore/graphics/drawpad/main.cpp
+++ b/noncore/graphics/drawpad/main.cpp
@@ -12,16 +12,16 @@
***************************************************************************/
#include "drawpad.h"
#include <qpe/qpeapplication.h>
int main(int argc, char **argv)
{
QPEApplication a(argc, argv);
DrawPad mw; // = new DrawPad();;
a.showMainWidget(&mw );
-
+ mw.finishStartup();
return a.exec();
}
diff --git a/noncore/graphics/drawpad/opie-drawpad.control b/noncore/graphics/drawpad/opie-drawpad.control
index 1c22186..5095b52 100644
--- a/noncore/graphics/drawpad/opie-drawpad.control
+++ b/noncore/graphics/drawpad/opie-drawpad.control
@@ -1,12 +1,12 @@
Package: opie-drawpad
Files: bin/drawpad apps/1Pim/drawpad.desktop pics/drawpad
Priority: optional
Section: opie/applications
Maintainer: Sébastien Prud'homme <prudhomme@laposte.net>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
Depends: task-opie-minimal, libopie1
Description: A note taking program with basic draw tools
DrawPad is an easy note taking program for Zaurus. It can also
be used to draw simple images. DrawPad was developed for the Opie
project, an alternative to the standard Zaurus environment.
+Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/graphics/drawpad/texttool.h b/noncore/graphics/drawpad/texttool.h
index 3187675..17556a1 100644
--- a/noncore/graphics/drawpad/texttool.h
+++ b/noncore/graphics/drawpad/texttool.h
@@ -13,24 +13,25 @@
#ifndef TEXTTOOL_H
#define TEXTTOOL_H
#include "tool.h"
#include <qdialog.h>
class QLineEdit;
class TextToolDialog : public QDialog
{
+ Q_OBJECT
public:
TextToolDialog(QWidget* parent = 0, const char* name = 0);
~TextToolDialog();
QString text();
private:
QLineEdit* m_pLineEdit;
};
class TextTool : public Tool
{