author | leseb <leseb> | 2002-04-30 08:54:28 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-04-30 08:54:28 (UTC) |
commit | 713aa4385e859c9300ee2a5b0086fbaabf3b3a33 (patch) (unidiff) | |
tree | ee835511cd9e024ccb1ceb4fa19e7be5db71ff9e | |
parent | ace7b43b1c978950ca38e8bd962f4b52d34ac307 (diff) | |
download | opie-713aa4385e859c9300ee2a5b0086fbaabf3b3a33.zip opie-713aa4385e859c9300ee2a5b0086fbaabf3b3a33.tar.gz opie-713aa4385e859c9300ee2a5b0086fbaabf3b3a33.tar.bz2 |
Clean code + fix 2 new introduced bugs
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 58 |
1 files changed, 14 insertions, 44 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 77fee98..74787e5 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -4,46 +4,45 @@ | |||
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 "colordialog.h" | ||
17 | //#include "colorpanel.h" | ||
18 | #include "drawpadcanvas.h" | 16 | #include "drawpadcanvas.h" |
19 | #include "ellipsetool.h" | 17 | #include "ellipsetool.h" |
20 | #include "erasetool.h" | 18 | #include "erasetool.h" |
21 | #include "exportdialog.h" | 19 | #include "exportdialog.h" |
22 | #include "filledellipsetool.h" | 20 | #include "filledellipsetool.h" |
23 | #include "filledrectangletool.h" | 21 | #include "filledrectangletool.h" |
24 | #include "filltool.h" | 22 | #include "filltool.h" |
25 | #include "importdialog.h" | 23 | #include "importdialog.h" |
26 | #include "linetool.h" | 24 | #include "linetool.h" |
27 | #include "pointtool.h" | 25 | #include "pointtool.h" |
28 | #include "rectangletool.h" | 26 | #include "rectangletool.h" |
29 | #include "texttool.h" | 27 | #include "texttool.h" |
30 | 28 | ||
29 | #include <opie/colordialog.h> | ||
30 | #include <opie/colorpopupmenu.h> | ||
31 | |||
31 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
32 | #include <qpe/global.h> | 33 | #include <qpe/global.h> |
33 | #include <qpe/qpemenubar.h> | 34 | #include <qpe/qpemenubar.h> |
34 | #include <qpe/qpetoolbar.h> | 35 | #include <qpe/qpetoolbar.h> |
35 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
36 | #include <opie/colordialog.h> | ||
37 | #include <opie/colorpopupmenu.h> | ||
38 | 37 | ||
39 | #include <qaction.h> | 38 | #include <qaction.h> |
40 | #include <qfile.h> | 39 | #include <qfile.h> |
41 | #include <qpainter.h> | 40 | #include <qpainter.h> |
42 | #include <qspinbox.h> | 41 | #include <qspinbox.h> |
43 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
44 | #include <qtooltip.h> | 43 | #include <qtooltip.h> |
45 | 44 | ||
46 | DrawPad::DrawPad(QWidget* parent, const char* name) | 45 | DrawPad::DrawPad(QWidget* parent, const char* name) |
47 | : QMainWindow(parent, name) | 46 | : QMainWindow(parent, name) |
48 | { | 47 | { |
49 | // init members | 48 | // init members |
@@ -209,73 +208,44 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
209 | QPEToolBar* drawParametersToolBar = new QPEToolBar(this); | 208 | QPEToolBar* drawParametersToolBar = new QPEToolBar(this); |
210 | 209 | ||
211 | QSpinBox* penWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); | 210 | QSpinBox* penWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); |
212 | connect(penWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); | 211 | connect(penWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); |
213 | 212 | ||
214 | QToolTip::add(penWidthSpinBox, tr("Pen Width")); | 213 | QToolTip::add(penWidthSpinBox, tr("Pen Width")); |
215 | penWidthSpinBox->setValue(1); | 214 | penWidthSpinBox->setValue(1); |
216 | penWidthSpinBox->setFocusPolicy(QWidget::NoFocus); | 215 | penWidthSpinBox->setFocusPolicy(QWidget::NoFocus); |
217 | 216 | ||
218 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); | 217 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); |
219 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor.png")); | 218 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor.png")); |
220 | 219 | ||
221 | ColorPopupMenu* colorPopupMenu = new ColorPopupMenu( Qt::black, m_pPenColorToolButton ); | 220 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, m_pPenColorToolButton); |
222 | m_pPenColorToolButton->setPopup( colorPopupMenu ); | 221 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); |
223 | m_pPenColorToolButton->setPopupDelay( 0 ); | ||
224 | QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); | ||
225 | connect( colorPopupMenu, SIGNAL( colorSelected( const QColor& ) ), this, SLOT( changePenColor( const QColor& ) ) ); | ||
226 | |||
227 | // QPopupMenu* penColorPopupMenu = new QPopupMenu(m_pPenColorToolButton); | ||
228 | |||
229 | // ColorPanel* penColorPanel = new ColorPanel(penColorPopupMenu); | ||
230 | // connect(penColorPanel, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); | ||
231 | 222 | ||
232 | // penColorPopupMenu->insertItem(penColorPanel); | 223 | QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); |
233 | // penColorPopupMenu->insertSeparator(); | 224 | m_pPenColorToolButton->setPopup(penColorPopupMenu); |
234 | 225 | m_pPenColorToolButton->setPopupDelay(0); | |
235 | // QAction* choosePenColorAction = new QAction(tr("More"), tr("More..."), 0, this); | ||
236 | // connect(choosePenColorAction, SIGNAL(activated()), this, SLOT(choosePenColor())); | ||
237 | // choosePenColorAction->addTo(penColorPopupMenu); | ||
238 | |||
239 | // m_pPenColorToolButton->setPopup(colorPopupMenu); | ||
240 | // m_pPenColorToolButton->setPopupDelay(0); | ||
241 | 226 | ||
242 | // penColorPanel->buttonSelected(Qt::black); | 227 | changePenColor(Qt::black); |
243 | 228 | ||
244 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); | 229 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); |
245 | m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor.png")); | 230 | m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor.png")); |
246 | 231 | ||
232 | ColorPopupMenu* brushColorPopupMenu = new ColorPopupMenu(Qt::white, m_pBrushColorToolButton); | ||
233 | connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); | ||
247 | 234 | ||
248 | colorPopupMenu = new ColorPopupMenu( Qt::white, m_pBrushColorToolButton ); | ||
249 | m_pBrushColorToolButton->setPopup( colorPopupMenu ); | ||
250 | m_pBrushColorToolButton->setPopupDelay( 0 ); | ||
251 | QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); | 235 | QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); |
252 | connect( colorPopupMenu, SIGNAL( colorSelected( const QColor& ) ), this, SLOT( changeeBrushColor( const QColor& ) ) ); | 236 | m_pBrushColorToolButton->setPopup(brushColorPopupMenu); |
253 | 237 | m_pBrushColorToolButton->setPopupDelay(0); | |
254 | // QPopupMenu* brushColorPopupMenu = new QPopupMenu(m_pBrushColorToolButton); | ||
255 | |||
256 | // ColorPanel* brushColorPanel = new ColorPanel(brushColorPopupMenu); | ||
257 | // connect(brushColorPanel, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); | ||
258 | |||
259 | // brushColorPopupMenu->insertItem(brushColorPanel); | ||
260 | // brushColorPopupMenu->insertSeparator(); | ||
261 | |||
262 | // QAction* chooseBrushColorAction = new QAction(tr("More"), tr("More..."), 0, this); | ||
263 | // connect(chooseBrushColorAction, SIGNAL(activated()), this, SLOT(chooseBrushColor())); | ||
264 | // chooseBrushColorAction->addTo(brushColorPopupMenu); | ||
265 | |||
266 | // m_pBrushColorToolButton->setPopup(brushColorPopupMenu); | ||
267 | // m_pBrushColorToolButton->setPopupDelay(0); | ||
268 | 238 | ||
269 | // brushColorPanel->buttonSelected(Qt::white); | 239 | changeBrushColor(Qt::white); |
270 | 240 | ||
271 | // init pages | 241 | // init pages |
272 | 242 | ||
273 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); | 243 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); |
274 | 244 | ||
275 | if (file.open(IO_ReadOnly)) { | 245 | if (file.open(IO_ReadOnly)) { |
276 | m_pDrawPadCanvas->load(&file); | 246 | m_pDrawPadCanvas->load(&file); |
277 | file.close(); | 247 | file.close(); |
278 | } else { | 248 | } else { |
279 | m_pDrawPadCanvas->initialPage(); | 249 | m_pDrawPadCanvas->initialPage(); |
280 | } | 250 | } |
281 | } | 251 | } |