summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad
Unidiff
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
@@ -257,60 +257,66 @@ DrawPad::DrawPad(QWidget* parent, const char* name)
257 QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); 257 QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) );
258 258
259 OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, m_pPenColorToolButton); 259 OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, m_pPenColorToolButton);
260 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); 260 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&)));
261 261
262 QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); 262 QToolTip::add(m_pPenColorToolButton, tr("Pen Color"));
263 m_pPenColorToolButton->setPopup(penColorPopupMenu); 263 m_pPenColorToolButton->setPopup(penColorPopupMenu);
264 m_pPenColorToolButton->setPopupDelay(0); 264 m_pPenColorToolButton->setPopupDelay(0);
265 265
266 changePenColor(Qt::black); 266 changePenColor(Qt::black);
267 267
268 m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); 268 m_pBrushColorToolButton = new QToolButton(drawParametersToolBar);
269 m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor")); 269 m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor"));
270 QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); 270 QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) );
271 271
272 OColorPopupMenu* brushColorPopupMenu = new OColorPopupMenu(Qt::white, m_pBrushColorToolButton); 272 OColorPopupMenu* brushColorPopupMenu = new OColorPopupMenu(Qt::white, m_pBrushColorToolButton);
273 connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); 273 connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&)));
274 274
275 QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); 275 QToolTip::add(m_pBrushColorToolButton, tr("Fill Color"));
276 m_pBrushColorToolButton->setPopup(brushColorPopupMenu); 276 m_pBrushColorToolButton->setPopup(brushColorPopupMenu);
277 m_pBrushColorToolButton->setPopupDelay(0); 277 m_pBrushColorToolButton->setPopupDelay(0);
278 278
279 changeBrushColor(Qt::white); 279 changeBrushColor(Qt::white);
280 280
281}
282
283
284void DrawPad::finishStartup()
285{
281 // init pages 286 // init pages
282 287
283 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 288 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
284 289
285 if (file.open(IO_ReadOnly)) { 290 if (file.open(IO_ReadOnly)) {
286 m_pDrawPadCanvas->load(&file); 291 m_pDrawPadCanvas->load(&file);
287 file.close(); 292 file.close();
288 } else { 293 } else {
289 m_pDrawPadCanvas->initialPage(); 294 m_pDrawPadCanvas->initialPage();
290 } 295 }
291 296
292 loadConfig(); 297 loadConfig();
298
293} 299}
294 300
295DrawPad::~DrawPad() 301DrawPad::~DrawPad()
296{ 302{
297 saveConfig(); 303 saveConfig();
298 304
299 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 305 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
300 306
301 if (file.open(IO_WriteOnly)) { 307 if (file.open(IO_WriteOnly)) {
302 m_pDrawPadCanvas->save(&file); 308 m_pDrawPadCanvas->save(&file);
303 file.close(); 309 file.close();
304 } 310 }
305} 311}
306 312
307bool DrawPad::antiAliasing() 313bool DrawPad::antiAliasing()
308{ 314{
309 return (m_pAntiAliasingAction->isOn()); 315 return (m_pAntiAliasingAction->isOn());
310} 316}
311 317
312void DrawPad::newPage() 318void DrawPad::newPage()
313{ 319{
314 QRect rect = m_pDrawPadCanvas->contentsRect(); 320 QRect rect = m_pDrawPadCanvas->contentsRect();
315 321
316 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); 322 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this);
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
@@ -19,48 +19,49 @@
19#include <qpen.h> 19#include <qpen.h>
20 20
21class DrawPadCanvas; 21class DrawPadCanvas;
22class Tool; 22class Tool;
23 23
24class QAction; 24class QAction;
25class QColor; 25class QColor;
26class QSpinBox; 26class QSpinBox;
27class QToolButton; 27class QToolButton;
28class QWidgetStack; 28class QWidgetStack;
29 29
30class DrawPad : public QMainWindow 30class DrawPad : public QMainWindow
31{ 31{
32 Q_OBJECT 32 Q_OBJECT
33 33
34public: 34public:
35 DrawPad(QWidget* parent = 0, const char* name = 0); 35 DrawPad(QWidget* parent = 0, const char* name = 0);
36 ~DrawPad(); 36 ~DrawPad();
37 37
38 Tool* tool() { return m_pTool; } 38 Tool* tool() { return m_pTool; }
39 QPen pen() { return m_pen; } 39 QPen pen() { return m_pen; }
40 QBrush brush() { return m_brush; } 40 QBrush brush() { return m_brush; }
41 41
42 bool antiAliasing(); 42 bool antiAliasing();
43 void finishStartup();
43 44
44private slots: 45private slots:
45 void newPage(); 46 void newPage();
46 void clearPage(); 47 void clearPage();
47 void deletePage(); 48 void deletePage();
48 49
49 void setPointTool(); 50 void setPointTool();
50 void setLineTool(); 51 void setLineTool();
51 void setRectangleTool(); 52 void setRectangleTool();
52 void setFilledRectangleTool(); 53 void setFilledRectangleTool();
53 void setEllipseTool(); 54 void setEllipseTool();
54 void setFilledEllipseTool(); 55 void setFilledEllipseTool();
55 void setTextTool(); 56 void setTextTool();
56 void setFillTool(); 57 void setFillTool();
57 void setEraseTool(); 58 void setEraseTool();
58 59
59 void changePenWidth(int value); 60 void changePenWidth(int value);
60 void changePenColor(const QColor& color); 61 void changePenColor(const QColor& color);
61 void changeBrushColor(const QColor& color); 62 void changeBrushColor(const QColor& color);
62 63
63 void updateView(); 64 void updateView();
64 65
65 void deleteAll(); 66 void deleteAll();
66 void importPage(); 67 void importPage();
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
@@ -161,61 +161,67 @@ DrawPadCanvas::DrawPadCanvas(DrawPad* drawPad, QWidget* parent, const char* name
161 m_pages.setAutoDelete(true); 161 m_pages.setAutoDelete(true);
162 162
163 viewport()->setBackgroundMode(QWidget::NoBackground); 163 viewport()->setBackgroundMode(QWidget::NoBackground);
164} 164}
165 165
166DrawPadCanvas::~DrawPadCanvas() 166DrawPadCanvas::~DrawPadCanvas()
167{ 167{
168} 168}
169 169
170void DrawPadCanvas::load(QIODevice* ioDevice) 170void DrawPadCanvas::load(QIODevice* ioDevice)
171{ 171{
172 QTextStream textStream(ioDevice); 172 QTextStream textStream(ioDevice);
173 textStream.setCodec(QTextCodec::codecForName("UTF-8")); 173 textStream.setCodec(QTextCodec::codecForName("UTF-8"));
174 174
175 QXmlInputSource xmlInputSource(textStream); 175 QXmlInputSource xmlInputSource(textStream);
176 QXmlSimpleReader xmlSimpleReader; 176 QXmlSimpleReader xmlSimpleReader;
177 DrawPadCanvasXmlHandler drawPadCanvasXmlHandler; 177 DrawPadCanvasXmlHandler drawPadCanvasXmlHandler;
178 178
179 xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler); 179 xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler);
180 xmlSimpleReader.parse(xmlInputSource); 180 xmlSimpleReader.parse(xmlInputSource);
181 181
182 m_pages = drawPadCanvasXmlHandler.pages(); 182 m_pages = drawPadCanvasXmlHandler.pages();
183 183
184 if (m_pages.isEmpty()) { 184 if (m_pages.isEmpty()) {
185 m_pages.append(new Page("", contentsRect().size())); 185 m_pages.append(new Page("",
186 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
187 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
186 m_pages.current()->pixmap()->fill(Qt::white); 188 m_pages.current()->pixmap()->fill(Qt::white);
187 } 189 }
188 190
189 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 191 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
190 viewport()->update(); 192 viewport()->update();
191 193
192 emit pagesChanged(); 194 emit pagesChanged();
193} 195}
194 196
195void DrawPadCanvas::initialPage() 197void DrawPadCanvas::initialPage()
196{ 198{
197 m_pages.append(new Page("", 236, 232)); 199 m_pages.append(new Page("",
200 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
201 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
202 //236, 232)); no more fixed sizes
203
198 m_pages.current()->pixmap()->fill(Qt::white); 204 m_pages.current()->pixmap()->fill(Qt::white);
199 205
200 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 206 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
201 viewport()->update(); 207 viewport()->update();
202 208
203 emit pagesChanged(); 209 emit pagesChanged();
204} 210}
205 211
206void DrawPadCanvas::save(QIODevice* ioDevice) 212void DrawPadCanvas::save(QIODevice* ioDevice)
207{ 213{
208 QTextStream textStream(ioDevice); 214 QTextStream textStream(ioDevice);
209 textStream.setCodec(QTextCodec::codecForName("UTF-8")); 215 textStream.setCodec(QTextCodec::codecForName("UTF-8"));
210 216
211 textStream << "<drawpad>" << endl; 217 textStream << "<drawpad>" << endl;
212 textStream << " <images>" << endl; 218 textStream << " <images>" << endl;
213 219
214 QListIterator<Page> bufferIterator(m_pages); 220 QListIterator<Page> bufferIterator(m_pages);
215 221
216 for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) { 222 for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) {
217 textStream << " <image>" << endl; 223 textStream << " <image>" << endl;
218 textStream << " <title>" << bufferIterator.current()->title() << "</title>" << endl; 224 textStream << " <title>" << bufferIterator.current()->title() << "</title>" << endl;
219 225
220 int intDate = QDateTime(QDate(1970, 1, 1)).secsTo(bufferIterator.current()->lastModified()); 226 int intDate = QDateTime(QDate(1970, 1, 1)).secsTo(bufferIterator.current()->lastModified());
221 textStream << " <date>" << intDate << "</date>" << endl; 227 textStream << " <date>" << intDate << "</date>" << endl;
@@ -328,82 +334,88 @@ void DrawPadCanvas::selectPage(Page* page)
328 emit pagesChanged(); 334 emit pagesChanged();
329} 335}
330 336
331void DrawPadCanvas::backupPage() 337void DrawPadCanvas::backupPage()
332{ 338{
333 m_pages.current()->backup(); 339 m_pages.current()->backup();
334 340
335 emit pagesChanged(); 341 emit pagesChanged();
336} 342}
337 343
338void DrawPadCanvas::selectPage(uint pagePosition) 344void DrawPadCanvas::selectPage(uint pagePosition)
339{ 345{
340 m_pages.at(pagePosition - 1); 346 m_pages.at(pagePosition - 1);
341 347
342 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 348 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
343 viewport()->update(); 349 viewport()->update();
344 350
345 emit pagesChanged(); 351 emit pagesChanged();
346} 352}
347 353
348void DrawPadCanvas::deleteAll() 354void DrawPadCanvas::deleteAll()
349{ 355{
350 m_pages.clear(); 356 m_pages.clear();
351 357
352 m_pages.append(new Page("", contentsRect().size())); 358 m_pages.append(new Page("",
359 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
360 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
361
353 m_pages.current()->pixmap()->fill(Qt::white); 362 m_pages.current()->pixmap()->fill(Qt::white);
354 363
355 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 364 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
356 viewport()->update(); 365 viewport()->update();
357 366
358 emit pagesChanged(); 367 emit pagesChanged();
359} 368}
360 369
361void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color) 370void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color)
362{ 371{
363 m_pages.insert(m_pages.at() + 1, new Page(title, width, height)); 372 m_pages.insert(m_pages.at() + 1, new Page(title, width, height));
364 m_pages.current()->pixmap()->fill(color); 373 m_pages.current()->pixmap()->fill(color);
365 374
366 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 375 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
367 viewport()->update(); 376 viewport()->update();
368 377
369 emit pagesChanged(); 378 emit pagesChanged();
370} 379}
371 380
372void DrawPadCanvas::clearPage() 381void DrawPadCanvas::clearPage()
373{ 382{
374 m_pages.current()->pixmap()->fill(Qt::white); 383 m_pages.current()->pixmap()->fill(Qt::white);
375 384
376 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 385 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
377 viewport()->update(); 386 viewport()->update();
378} 387}
379 388
380void DrawPadCanvas::deletePage() 389void DrawPadCanvas::deletePage()
381{ 390{
382 m_pages.remove(m_pages.current()); 391 m_pages.remove(m_pages.current());
383 392
384 if (m_pages.isEmpty()) { 393 if (m_pages.isEmpty()) {
385 m_pages.append(new Page("", contentsRect().size())); 394 m_pages.append(new Page("",
395 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
396 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
397
386 m_pages.current()->pixmap()->fill(Qt::white); 398 m_pages.current()->pixmap()->fill(Qt::white);
387 } 399 }
388 400
389 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 401 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
390 viewport()->update(); 402 viewport()->update();
391 403
392 emit pagesChanged(); 404 emit pagesChanged();
393} 405}
394 406
395void DrawPadCanvas::movePageUp() 407void DrawPadCanvas::movePageUp()
396{ 408{
397 int index = m_pages.at(); 409 int index = m_pages.at();
398 Page* page = m_pages.take(); 410 Page* page = m_pages.take();
399 m_pages.insert(index - 1, page); 411 m_pages.insert(index - 1, page);
400 412
401 emit pagesChanged(); 413 emit pagesChanged();
402} 414}
403 415
404void DrawPadCanvas::movePageDown() 416void DrawPadCanvas::movePageDown()
405{ 417{
406 int index = m_pages.at(); 418 int index = m_pages.at();
407 Page* page = m_pages.take(); 419 Page* page = m_pages.take();
408 m_pages.insert(index + 1, page); 420 m_pages.insert(index + 1, page);
409 421
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
@@ -1,40 +1,40 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "exportdialog.h" 14#include "exportdialog.h"
15 15
16#include <qpe/fileselector.h> 16#include <opie/ofileselector.h>
17 17
18#include <qbuttongroup.h> 18#include <qbuttongroup.h>
19#include <qcombobox.h> 19#include <qcombobox.h>
20#include <qgroupbox.h> 20#include <qgroupbox.h>
21#include <qimage.h> 21#include <qimage.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qlineedit.h> 24#include <qlineedit.h>
25#include <qradiobutton.h> 25#include <qradiobutton.h>
26#include <qspinbox.h> 26#include <qspinbox.h>
27 27
28#include <stdlib.h> 28#include <stdlib.h>
29 29
30ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name) 30ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name)
31 : QDialog(parent, name, true) 31 : QDialog(parent, name, true)
32{ 32{
33 setCaption(tr("DrawPad - Export")); 33 setCaption(tr("DrawPad - Export"));
34 34
35 m_pageAt = pageAt; 35 m_pageAt = pageAt;
36 m_pageCount = pageCount; 36 m_pageCount = pageCount;
37 37
38 QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this); 38 QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this);
39 connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int))); 39 connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int)));
40 40
@@ -45,51 +45,54 @@ ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const c
45 QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup); 45 QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup);
46 46
47 m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); 47 m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup);
48 connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int))); 48 connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int)));
49 49
50 m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); 50 m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup);
51 connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int))); 51 connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int)));
52 52
53 selectionButtonGroup->setButton(1); 53 selectionButtonGroup->setButton(1);
54 selectionChanged(1); 54 selectionChanged(1);
55 55
56 m_pFromPageSpinBox->setValue(pageAt); 56 m_pFromPageSpinBox->setValue(pageAt);
57 m_pToPageSpinBox->setValue(pageAt); 57 m_pToPageSpinBox->setValue(pageAt);
58 58
59 QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this); 59 QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this);
60 60
61 QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox); 61 QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox);
62 QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox); 62 QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox);
63 63
64 m_pNameLineEdit = new QLineEdit(exportGroupBox); 64 m_pNameLineEdit = new QLineEdit(exportGroupBox);
65 65
66 m_pFormatComboBox = new QComboBox(exportGroupBox); 66 m_pFormatComboBox = new QComboBox(exportGroupBox);
67 m_pFormatComboBox->insertStrList(QImageIO::outputFormats()); 67 m_pFormatComboBox->insertStrList(QImageIO::outputFormats());
68 68
69 FileSelector* fileSelector = new FileSelector("image/*", this, "fileselector"); 69 MimeTypes types; types.insert( tr("All Images"), "image/*" );
70 fileSelector->setNewVisible(false); 70 OFileSelector* fileSelector = new OFileSelector(this, OFileSelector::FileSelector,
71 fileSelector->setCloseVisible(false); 71 OFileSelector::Normal,
72 QString::null, QString::null,
73 types );
74 fileSelector->setNameVisible( false );
72 75
73 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); 76 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
74 selectionButtonGroup->layout()->setSpacing(4); 77 selectionButtonGroup->layout()->setSpacing(4);
75 exportGroupBox->layout()->setSpacing(4); 78 exportGroupBox->layout()->setSpacing(4);
76 QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2); 79 QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2);
77 QHBoxLayout* rangeLayout = new QHBoxLayout(); 80 QHBoxLayout* rangeLayout = new QHBoxLayout();
78 QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2); 81 QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2);
79 82
80 selectionLayout->addWidget(selectAllRadioButton, 0, 0); 83 selectionLayout->addWidget(selectAllRadioButton, 0, 0);
81 selectionLayout->addWidget(selectCurrentRadioButton, 1, 0); 84 selectionLayout->addWidget(selectCurrentRadioButton, 1, 0);
82 selectionLayout->addWidget(selectRangeRadioButton, 0, 1); 85 selectionLayout->addWidget(selectRangeRadioButton, 0, 1);
83 selectionLayout->addLayout(rangeLayout, 1, 1); 86 selectionLayout->addLayout(rangeLayout, 1, 1);
84 87
85 rangeLayout->addWidget(m_pFromPageSpinBox); 88 rangeLayout->addWidget(m_pFromPageSpinBox);
86 rangeLayout->addWidget(toLabel); 89 rangeLayout->addWidget(toLabel);
87 rangeLayout->addWidget(m_pToPageSpinBox); 90 rangeLayout->addWidget(m_pToPageSpinBox);
88 91
89 exportLayout->addWidget(nameLabel, 0, 0); 92 exportLayout->addWidget(nameLabel, 0, 0);
90 exportLayout->addWidget(formatLabel, 1, 0); 93 exportLayout->addWidget(formatLabel, 1, 0);
91 94
92 exportLayout->addWidget(m_pNameLineEdit, 0, 1); 95 exportLayout->addWidget(m_pNameLineEdit, 0, 1);
93 exportLayout->addWidget(m_pFormatComboBox, 1, 1); 96 exportLayout->addWidget(m_pFormatComboBox, 1, 1);
94 97
95 exportLayout->setColStretch(1, 1); 98 exportLayout->setColStretch(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
@@ -1,95 +1,99 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "importdialog.h" 14#include "importdialog.h"
15 15
16#include <qpe/applnk.h> 16#include <qpe/applnk.h>
17#include <qpe/fileselector.h> 17#include <opie/ofileselector.h>
18 18
19#include <qcheckbox.h> 19#include <qcheckbox.h>
20#include <qimage.h> 20#include <qimage.h>
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24 24
25ImportDialog::ImportDialog(QWidget* parent, const char* name) 25ImportDialog::ImportDialog(QWidget* parent, const char* name)
26 : QDialog(parent, name, true) 26 : QDialog(parent, name, true)
27{ 27{
28 setCaption(tr("DrawPad - Import")); 28 setCaption(tr("DrawPad - Import"));
29 29
30 m_pFileSelector = new FileSelector("image/*", this, "fileselector"); 30 MimeTypes types; types.insert( tr("All images"),"image/*" );
31 m_pFileSelector = new OFileSelector(this,
32 OFileSelector::FileSelector,
33 OFileSelector::Normal,
34 QString::null,
35 QString::null, types );
36 m_pFileSelector->setNameVisible( false );
31 connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged())); 37 connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged()));
32 m_pFileSelector->setNewVisible(false);
33 m_pFileSelector->setCloseVisible(false);
34 38
35 m_pPreviewLabel = new QLabel(this); 39 m_pPreviewLabel = new QLabel(this);
36 m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); 40 m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
37 m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 41 m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
38 m_pPreviewLabel->setFixedSize(114, 114); 42 m_pPreviewLabel->setFixedSize(114, 114);
39 m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid); 43 m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid);
40 44
41 m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this); 45 m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this);
42 m_pAutomaticPreviewCheckBox->setChecked(true); 46 m_pAutomaticPreviewCheckBox->setChecked(true);
43 47
44 QPushButton* previewPushButton = new QPushButton(tr("Preview"), this); 48 QPushButton* previewPushButton = new QPushButton(tr("Preview"), this);
45 connect(previewPushButton, SIGNAL(clicked()), this, SLOT(preview())); 49 connect(previewPushButton, SIGNAL(clicked()), this, SLOT(preview()));
46 50
47 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); 51 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
48 QHBoxLayout* previewLayout = new QHBoxLayout(4); 52 QHBoxLayout* previewLayout = new QHBoxLayout(4);
49 QVBoxLayout* previewSecondLayout = new QVBoxLayout(4); 53 QVBoxLayout* previewSecondLayout = new QVBoxLayout(4);
50 54
51 previewSecondLayout->addWidget(m_pAutomaticPreviewCheckBox); 55 previewSecondLayout->addWidget(m_pAutomaticPreviewCheckBox);
52 previewSecondLayout->addWidget(previewPushButton); 56 previewSecondLayout->addWidget(previewPushButton);
53 previewSecondLayout->addStretch(); 57 previewSecondLayout->addStretch();
54 58
55 previewLayout->addWidget(m_pPreviewLabel); 59 previewLayout->addWidget(m_pPreviewLabel);
56 previewLayout->addLayout(previewSecondLayout); 60 previewLayout->addLayout(previewSecondLayout);
57 61
58 mainLayout->addWidget(m_pFileSelector); 62 mainLayout->addWidget(m_pFileSelector);
59 mainLayout->addLayout(previewLayout); 63 mainLayout->addLayout(previewLayout);
60 64
61 preview(); 65 preview();
62} 66}
63 67
64ImportDialog::~ImportDialog() 68ImportDialog::~ImportDialog()
65{ 69{
66} 70}
67 71
68const DocLnk* ImportDialog::selected() 72const DocLnk* ImportDialog::selected()
69{ 73{
70 // FIXME change from pointer to reference -zecke 74 // FIXME change from pointer to reference -zecke
71 DocLnk *lnk = new DocLnk( m_pFileSelector->selectedDocument() ); 75 DocLnk *lnk = new DocLnk( m_pFileSelector->selectedDocument() );
72 return lnk; 76 return lnk;
73} 77}
74 78
75void ImportDialog::fileChanged() 79void ImportDialog::fileChanged()
76{ 80{
77 if (m_pAutomaticPreviewCheckBox->isChecked()) { 81 if (m_pAutomaticPreviewCheckBox->isChecked()) {
78 preview(); 82 preview();
79 } 83 }
80} 84}
81 85
82void ImportDialog::preview() 86void ImportDialog::preview()
83{ 87{
84 const DocLnk* docLnk = selected(); 88 const DocLnk* docLnk = selected();
85 89
86 if (docLnk) { 90 if (docLnk) {
87 QImage image(docLnk->file()); 91 QImage image(docLnk->file());
88 92
89 int previewWidth = m_pPreviewLabel->contentsRect().width(); 93 int previewWidth = m_pPreviewLabel->contentsRect().width();
90 int previewHeight = m_pPreviewLabel->contentsRect().height(); 94 int previewHeight = m_pPreviewLabel->contentsRect().height();
91 95
92 float widthScale = 1.0; 96 float widthScale = 1.0;
93 float heightScale = 1.0; 97 float heightScale = 1.0;
94 98
95 if (previewWidth < image.width()) { 99 if (previewWidth < image.width()) {
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
@@ -1,45 +1,45 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#ifndef IMPORTDIALOG_H 14#ifndef IMPORTDIALOG_H
15#define IMPORTDIALOG_H 15#define IMPORTDIALOG_H
16 16
17#include <qdialog.h> 17#include <qdialog.h>
18 18
19class DocLnk; 19class DocLnk;
20class FileSelector; 20class OFileSelector;
21 21
22class QCheckBox; 22class QCheckBox;
23class QLabel; 23class QLabel;
24 24
25class ImportDialog : public QDialog 25class ImportDialog : public QDialog
26{ 26{
27 Q_OBJECT 27 Q_OBJECT
28 28
29public: 29public:
30 ImportDialog(QWidget* parent = 0, const char* name = 0); 30 ImportDialog(QWidget* parent = 0, const char* name = 0);
31 ~ImportDialog(); 31 ~ImportDialog();
32 32
33 const DocLnk* selected(); 33 const DocLnk* selected();
34 34
35private slots: 35private slots:
36 void fileChanged(); 36 void fileChanged();
37 void preview(); 37 void preview();
38 38
39private: 39private:
40 FileSelector* m_pFileSelector; 40 OFileSelector* m_pFileSelector;
41 QLabel* m_pPreviewLabel; 41 QLabel* m_pPreviewLabel;
42 QCheckBox* m_pAutomaticPreviewCheckBox; 42 QCheckBox* m_pAutomaticPreviewCheckBox;
43}; 43};
44 44
45#endif // IMPORTDIALOG_H 45#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
@@ -1,27 +1,27 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "drawpad.h" 14#include "drawpad.h"
15 15
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17 17
18int main(int argc, char **argv) 18int main(int argc, char **argv)
19{ 19{
20 QPEApplication a(argc, argv); 20 QPEApplication a(argc, argv);
21 21
22 DrawPad mw; // = new DrawPad();; 22 DrawPad mw; // = new DrawPad();;
23 a.showMainWidget(&mw ); 23 a.showMainWidget(&mw );
24 24 mw.finishStartup();
25 25
26 return a.exec(); 26 return a.exec();
27} 27}
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 @@
1Package: opie-drawpad 1Package: opie-drawpad
2Files: bin/drawpad apps/1Pim/drawpad.desktop pics/drawpad 2Files: bin/drawpad apps/1Pim/drawpad.desktop pics/drawpad
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Maintainer: Sébastien Prud'homme <prudhomme@laposte.net> 5Maintainer: Sébastien Prud'homme <prudhomme@laposte.net>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION
8Depends: task-opie-minimal, libopie1 7Depends: task-opie-minimal, libopie1
9Description: A note taking program with basic draw tools 8Description: A note taking program with basic draw tools
10 DrawPad is an easy note taking program for Zaurus. It can also 9 DrawPad is an easy note taking program for Zaurus. It can also
11 be used to draw simple images. DrawPad was developed for the Opie 10 be used to draw simple images. DrawPad was developed for the Opie
12 project, an alternative to the standard Zaurus environment. 11 project, an alternative to the standard Zaurus environment.
12Version: $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
@@ -1,46 +1,47 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#ifndef TEXTTOOL_H 14#ifndef TEXTTOOL_H
15#define TEXTTOOL_H 15#define TEXTTOOL_H
16 16
17#include "tool.h" 17#include "tool.h"
18 18
19#include <qdialog.h> 19#include <qdialog.h>
20 20
21class QLineEdit; 21class QLineEdit;
22 22
23class TextToolDialog : public QDialog 23class TextToolDialog : public QDialog
24{ 24{
25 Q_OBJECT
25public: 26public:
26 TextToolDialog(QWidget* parent = 0, const char* name = 0); 27 TextToolDialog(QWidget* parent = 0, const char* name = 0);
27 ~TextToolDialog(); 28 ~TextToolDialog();
28 29
29 QString text(); 30 QString text();
30 31
31private: 32private:
32 QLineEdit* m_pLineEdit; 33 QLineEdit* m_pLineEdit;
33}; 34};
34 35
35class TextTool : public Tool 36class TextTool : public Tool
36{ 37{
37public: 38public:
38 TextTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas); 39 TextTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
39 ~TextTool(); 40 ~TextTool();
40 41
41 void mousePressEvent(QMouseEvent* e); 42 void mousePressEvent(QMouseEvent* e);
42 void mouseReleaseEvent(QMouseEvent* e); 43 void mouseReleaseEvent(QMouseEvent* e);
43 void mouseMoveEvent(QMouseEvent* e); 44 void mouseMoveEvent(QMouseEvent* e);
44}; 45};
45 46
46#endif // TEXTTOOL_H 47#endif // TEXTTOOL_H