summaryrefslogtreecommitdiff
authorleseb <leseb>2002-04-30 08:54:28 (UTC)
committer leseb <leseb>2002-04-30 08:54:28 (UTC)
commit713aa4385e859c9300ee2a5b0086fbaabf3b3a33 (patch) (unidiff)
treeee835511cd9e024ccb1ceb4fa19e7be5db71ff9e
parentace7b43b1c978950ca38e8bd962f4b52d34ac307 (diff)
downloadopie-713aa4385e859c9300ee2a5b0086fbaabf3b3a33.zip
opie-713aa4385e859c9300ee2a5b0086fbaabf3b3a33.tar.gz
opie-713aa4385e859c9300ee2a5b0086fbaabf3b3a33.tar.bz2
Clean code + fix 2 new introduced bugs
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp58
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
@@ -1,101 +1,100 @@
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 "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
46DrawPad::DrawPad(QWidget* parent, const char* name) 45DrawPad::DrawPad(QWidget* parent, const char* name)
47 : QMainWindow(parent, name) 46 : QMainWindow(parent, name)
48{ 47{
49 // init members 48 // init members
50 49
51 m_pDrawPadCanvas = new DrawPadCanvas(this, this); 50 m_pDrawPadCanvas = new DrawPadCanvas(this, this);
52 51
53 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateNavigationToolButtons())); 52 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateNavigationToolButtons()));
54 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateCaption())); 53 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateCaption()));
55 connect(m_pDrawPadCanvas, SIGNAL(pageBackupsChanged()), this, SLOT(updateUndoRedoToolButtons())); 54 connect(m_pDrawPadCanvas, SIGNAL(pageBackupsChanged()), this, SLOT(updateUndoRedoToolButtons()));
56 55
57 setCentralWidget(m_pDrawPadCanvas); 56 setCentralWidget(m_pDrawPadCanvas);
58 57
59 // init menu 58 // init menu
60 59
61 setToolBarsMovable(false); 60 setToolBarsMovable(false);
62 61
63 QPEToolBar* menuToolBar = new QPEToolBar(this); 62 QPEToolBar* menuToolBar = new QPEToolBar(this);
64 QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar); 63 QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar);
65 64
66 QPopupMenu *toolsPopupMenu = new QPopupMenu(menuBar); 65 QPopupMenu *toolsPopupMenu = new QPopupMenu(menuBar);
67 66
68 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); 67 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
69 connect(deleteAllAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deleteAll())); 68 connect(deleteAllAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deleteAll()));
70 deleteAllAction->addTo(toolsPopupMenu); 69 deleteAllAction->addTo(toolsPopupMenu);
71 70
72 toolsPopupMenu->insertSeparator(); 71 toolsPopupMenu->insertSeparator();
73 72
74 QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); 73 QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this);
75 connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); 74 connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage()));
76 importPageAction->addTo(toolsPopupMenu); 75 importPageAction->addTo(toolsPopupMenu);
77 76
78 QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); 77 QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this);
79 connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); 78 connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage()));
80 exportPageAction->addTo(toolsPopupMenu); 79 exportPageAction->addTo(toolsPopupMenu);
81 80
82 menuBar->insertItem(tr("Tools"), toolsPopupMenu); 81 menuBar->insertItem(tr("Tools"), toolsPopupMenu);
83 82
84 // init page toolbar 83 // init page toolbar
85 84
86 QPEToolBar* pageToolBar = new QPEToolBar(this); 85 QPEToolBar* pageToolBar = new QPEToolBar(this);
87 86
88 QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this); 87 QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this);
89 connect(newPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(newPage())); 88 connect(newPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(newPage()));
90 newPageAction->addTo(pageToolBar); 89 newPageAction->addTo(pageToolBar);
91 90
92 QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); 91 QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this);
93 connect(clearPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(clearPage())); 92 connect(clearPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(clearPage()));
94 clearPageAction->addTo(pageToolBar); 93 clearPageAction->addTo(pageToolBar);
95 94
96 QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadIconSet("trash"), QString::null, 0, this); 95 QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadIconSet("trash"), QString::null, 0, this);
97 connect(deletePageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deletePage())); 96 connect(deletePageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deletePage()));
98 deletePageAction->addTo(pageToolBar); 97 deletePageAction->addTo(pageToolBar);
99 98
100 QPEToolBar* emptyToolBar = new QPEToolBar(this); 99 QPEToolBar* emptyToolBar = new QPEToolBar(this);
101 emptyToolBar->setHorizontalStretchable(true); 100 emptyToolBar->setHorizontalStretchable(true);
@@ -157,177 +156,148 @@ DrawPad::DrawPad(QWidget* parent, const char* name)
157 connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); 156 connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool()));
158 m_pRectangleToolAction->addTo(rectanglePopupMenu); 157 m_pRectangleToolAction->addTo(rectanglePopupMenu);
159 158
160 m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadIconSet("drawpad/filledrectangle.png"), "", 0, this); 159 m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadIconSet("drawpad/filledrectangle.png"), "", 0, this);
161 connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); 160 connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool()));
162 m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); 161 m_pFilledRectangleToolAction->addTo(rectanglePopupMenu);
163 162
164 m_pRectangleToolButton->setPopup(rectanglePopupMenu); 163 m_pRectangleToolButton->setPopup(rectanglePopupMenu);
165 m_pRectangleToolButton->setPopupDelay(0); 164 m_pRectangleToolButton->setPopupDelay(0);
166 165
167 m_pEllipseToolButton = new QToolButton(drawModeToolBar); 166 m_pEllipseToolButton = new QToolButton(drawModeToolBar);
168 m_pEllipseToolButton->setToggleButton(true); 167 m_pEllipseToolButton->setToggleButton(true);
169 168
170 QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); 169 QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton);
171 170
172 m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadIconSet("drawpad/ellipse.png"), "", 0, this); 171 m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadIconSet("drawpad/ellipse.png"), "", 0, this);
173 connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); 172 connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool()));
174 m_pEllipseToolAction->addTo(ellipsePopupMenu); 173 m_pEllipseToolAction->addTo(ellipsePopupMenu);
175 174
176 m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadIconSet("drawpad/filledellipse.png"), "", 0, this); 175 m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadIconSet("drawpad/filledellipse.png"), "", 0, this);
177 connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); 176 connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool()));
178 m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); 177 m_pFilledEllipseToolAction->addTo(ellipsePopupMenu);
179 178
180 m_pEllipseToolButton->setPopup(ellipsePopupMenu); 179 m_pEllipseToolButton->setPopup(ellipsePopupMenu);
181 m_pEllipseToolButton->setPopupDelay(0); 180 m_pEllipseToolButton->setPopupDelay(0);
182 181
183 m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadIconSet("drawpad/text.png"), QString::null, 0, this); 182 m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadIconSet("drawpad/text.png"), QString::null, 0, this);
184 m_pTextToolAction->setToggleAction(true); 183 m_pTextToolAction->setToggleAction(true);
185 connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); 184 connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool()));
186 m_pTextToolAction->addTo(drawModeToolBar); 185 m_pTextToolAction->addTo(drawModeToolBar);
187 186
188 m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadIconSet("drawpad/fill.png"), QString::null, 0, this); 187 m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadIconSet("drawpad/fill.png"), QString::null, 0, this);
189 m_pFillToolAction->setToggleAction(true); 188 m_pFillToolAction->setToggleAction(true);
190 connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); 189 connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool()));
191 m_pFillToolAction->addTo(drawModeToolBar); 190 m_pFillToolAction->addTo(drawModeToolBar);
192 191
193 m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadIconSet("drawpad/erase.png"), QString::null, 0, this); 192 m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadIconSet("drawpad/erase.png"), QString::null, 0, this);
194 m_pEraseToolAction->setToggleAction(true); 193 m_pEraseToolAction->setToggleAction(true);
195 connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); 194 connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool()));
196 m_pEraseToolAction->addTo(drawModeToolBar); 195 m_pEraseToolAction->addTo(drawModeToolBar);
197 196
198 m_pTool = 0; 197 m_pTool = 0;
199 setRectangleTool(); 198 setRectangleTool();
200 setEllipseTool(); 199 setEllipseTool();
201 setPointTool(); 200 setPointTool();
202 201
203 emptyToolBar = new QPEToolBar(this); 202 emptyToolBar = new QPEToolBar(this);
204 emptyToolBar->setHorizontalStretchable(true); 203 emptyToolBar->setHorizontalStretchable(true);
205 emptyToolBar->addSeparator(); 204 emptyToolBar->addSeparator();
206 205
207 // init draw parameters toolbar 206 // init draw parameters toolbar
208 207
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}
282 252
283DrawPad::~DrawPad() 253DrawPad::~DrawPad()
284{ 254{
285 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 255 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
286 256
287 if (file.open(IO_WriteOnly)) { 257 if (file.open(IO_WriteOnly)) {
288 m_pDrawPadCanvas->save(&file); 258 m_pDrawPadCanvas->save(&file);
289 file.close(); 259 file.close();
290 } 260 }
291} 261}
292 262
293void DrawPad::setPointTool() 263void DrawPad::setPointTool()
294{ 264{
295 if (m_pTool) { 265 if (m_pTool) {
296 delete m_pTool; 266 delete m_pTool;
297 } 267 }
298 268
299 m_pTool = new PointTool(this, m_pDrawPadCanvas); 269 m_pTool = new PointTool(this, m_pDrawPadCanvas);
300 270
301 m_pLineToolButton->setIconSet(m_pPointToolAction->iconSet()); 271 m_pLineToolButton->setIconSet(m_pPointToolAction->iconSet());
302 QToolTip::add(m_pLineToolButton, m_pPointToolAction->text()); 272 QToolTip::add(m_pLineToolButton, m_pPointToolAction->text());
303 273
304 disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); 274 disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0);
305 connect(m_pLineToolButton, SIGNAL(clicked()), m_pPointToolAction, SIGNAL(activated())); 275 connect(m_pLineToolButton, SIGNAL(clicked()), m_pPointToolAction, SIGNAL(activated()));
306 276
307 m_pLineToolButton->setOn(true); 277 m_pLineToolButton->setOn(true);
308 m_pRectangleToolButton->setOn(false); 278 m_pRectangleToolButton->setOn(false);
309 m_pEllipseToolButton->setOn(false); 279 m_pEllipseToolButton->setOn(false);
310 m_pTextToolAction->setOn(false); 280 m_pTextToolAction->setOn(false);
311 m_pFillToolAction->setOn(false); 281 m_pFillToolAction->setOn(false);
312 m_pEraseToolAction->setOn(false); 282 m_pEraseToolAction->setOn(false);
313} 283}
314 284
315void DrawPad::setLineTool() 285void DrawPad::setLineTool()
316{ 286{
317 if (m_pTool) { 287 if (m_pTool) {
318 delete m_pTool; 288 delete m_pTool;
319 } 289 }
320 290
321 m_pTool = new LineTool(this, m_pDrawPadCanvas); 291 m_pTool = new LineTool(this, m_pDrawPadCanvas);
322 292
323 m_pLineToolButton->setIconSet(m_pLineToolAction->iconSet()); 293 m_pLineToolButton->setIconSet(m_pLineToolAction->iconSet());
324 QToolTip::add(m_pLineToolButton, m_pLineToolAction->text()); 294 QToolTip::add(m_pLineToolButton, m_pLineToolAction->text());
325 295
326 disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); 296 disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0);
327 connect(m_pLineToolButton, SIGNAL(clicked()), m_pLineToolAction, SIGNAL(activated())); 297 connect(m_pLineToolButton, SIGNAL(clicked()), m_pLineToolAction, SIGNAL(activated()));
328 298
329 m_pLineToolButton->setOn(true); 299 m_pLineToolButton->setOn(true);
330 m_pRectangleToolButton->setOn(false); 300 m_pRectangleToolButton->setOn(false);
331 m_pEllipseToolButton->setOn(false); 301 m_pEllipseToolButton->setOn(false);
332 m_pTextToolAction->setOn(false); 302 m_pTextToolAction->setOn(false);
333 m_pFillToolAction->setOn(false); 303 m_pFillToolAction->setOn(false);