summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index 459f1a8..4db6208 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -195,142 +195,142 @@ DrawPad::DrawPad(QWidget* parent, const char* name)
195 195
196 m_pRectangleToolButton->setPopup(rectanglePopupMenu); 196 m_pRectangleToolButton->setPopup(rectanglePopupMenu);
197 m_pRectangleToolButton->setPopupDelay(0); 197 m_pRectangleToolButton->setPopupDelay(0);
198 198
199 m_pEllipseToolButton = new QToolButton(drawModeToolBar); 199 m_pEllipseToolButton = new QToolButton(drawModeToolBar);
200 m_pEllipseToolButton->setToggleButton(true); 200 m_pEllipseToolButton->setToggleButton(true);
201 QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) ); 201 QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) );
202 202
203 QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); 203 QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton);
204 204
205 m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this); 205 m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this);
206 connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); 206 connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool()));
207 m_pEllipseToolAction->addTo(ellipsePopupMenu); 207 m_pEllipseToolAction->addTo(ellipsePopupMenu);
208 208
209 m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this); 209 m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this);
210 connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); 210 connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool()));
211 m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); 211 m_pFilledEllipseToolAction->addTo(ellipsePopupMenu);
212 212
213 m_pEllipseToolButton->setPopup(ellipsePopupMenu); 213 m_pEllipseToolButton->setPopup(ellipsePopupMenu);
214 m_pEllipseToolButton->setPopupDelay(0); 214 m_pEllipseToolButton->setPopupDelay(0);
215 215
216 m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this); 216 m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this);
217 m_pTextToolAction->setToggleAction(true); 217 m_pTextToolAction->setToggleAction(true);
218 connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); 218 connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool()));
219 m_pTextToolAction->addTo(drawModeToolBar); 219 m_pTextToolAction->addTo(drawModeToolBar);
220 m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); 220 m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) );
221 221
222 m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this); 222 m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this);
223 m_pFillToolAction->setToggleAction(true); 223 m_pFillToolAction->setToggleAction(true);
224 connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); 224 connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool()));
225 m_pFillToolAction->addTo(drawModeToolBar); 225 m_pFillToolAction->addTo(drawModeToolBar);
226 m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); 226 m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) );
227 227
228 m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this); 228 m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this);
229 m_pEraseToolAction->setToggleAction(true); 229 m_pEraseToolAction->setToggleAction(true);
230 connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); 230 connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool()));
231 m_pEraseToolAction->addTo(drawModeToolBar); 231 m_pEraseToolAction->addTo(drawModeToolBar);
232 m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); 232 m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) );
233 233
234 m_pTool = 0; 234 m_pTool = 0;
235 setRectangleTool(); 235 setRectangleTool();
236 setEllipseTool(); 236 setEllipseTool();
237 setPointTool(); 237 setPointTool();
238 238
239 emptyToolBar = new QPEToolBar(this); 239 emptyToolBar = new QPEToolBar(this);
240 emptyToolBar->setHorizontalStretchable(true); 240 emptyToolBar->setHorizontalStretchable(true);
241 emptyToolBar->addSeparator(); 241 emptyToolBar->addSeparator();
242 242
243 // init draw parameters toolbar 243 // init draw parameters toolbar
244 244
245 QPEToolBar* drawParametersToolBar = new QPEToolBar(this); 245 QPEToolBar* drawParametersToolBar = new QPEToolBar(this);
246 246
247 m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); 247 m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar);
248 connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); 248 connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int)));
249 249
250 QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width")); 250 QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width"));
251 m_pPenWidthSpinBox->setValue(1); 251 m_pPenWidthSpinBox->setValue(1);
252 m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus); 252 m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus);
253 QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) ); 253 QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) );
254 254
255 m_pPenColorToolButton = new QToolButton(drawParametersToolBar); 255 m_pPenColorToolButton = new QToolButton(drawParametersToolBar);
256 m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor")); 256 m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor"));
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 ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(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 ColorPopupMenu* brushColorPopupMenu = new ColorPopupMenu(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 // init pages 281 // init pages
282 282
283 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 283 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
284 284
285 if (file.open(IO_ReadOnly)) { 285 if (file.open(IO_ReadOnly)) {
286 m_pDrawPadCanvas->load(&file); 286 m_pDrawPadCanvas->load(&file);
287 file.close(); 287 file.close();
288 } else { 288 } else {
289 m_pDrawPadCanvas->initialPage(); 289 m_pDrawPadCanvas->initialPage();
290 } 290 }
291 291
292 loadConfig(); 292 loadConfig();
293} 293}
294 294
295DrawPad::~DrawPad() 295DrawPad::~DrawPad()
296{ 296{
297 saveConfig(); 297 saveConfig();
298 298
299 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 299 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
300 300
301 if (file.open(IO_WriteOnly)) { 301 if (file.open(IO_WriteOnly)) {
302 m_pDrawPadCanvas->save(&file); 302 m_pDrawPadCanvas->save(&file);
303 file.close(); 303 file.close();
304 } 304 }
305} 305}
306 306
307bool DrawPad::antiAliasing() 307bool DrawPad::antiAliasing()
308{ 308{
309 return (m_pAntiAliasingAction->isOn()); 309 return (m_pAntiAliasingAction->isOn());
310} 310}
311 311
312void DrawPad::newPage() 312void DrawPad::newPage()
313{ 313{
314 QRect rect = m_pDrawPadCanvas->contentsRect(); 314 QRect rect = m_pDrawPadCanvas->contentsRect();
315 315
316 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); 316 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this);
317 317
318 if (newPageDialog.exec() == QDialog::Accepted) { 318 if (newPageDialog.exec() == QDialog::Accepted) {
319 m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(), 319 m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(),
320 newPageDialog.selectedHeight(), newPageDialog.selectedColor()); 320 newPageDialog.selectedHeight(), newPageDialog.selectedColor());
321 } 321 }
322} 322}
323 323
324void DrawPad::clearPage() 324void DrawPad::clearPage()
325{ 325{
326 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), 326 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"),
327 QMessageBox::Information, QMessageBox::Yes, 327 QMessageBox::Information, QMessageBox::Yes,
328 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 328 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
329 QMessageBox::NoButton, this); 329 QMessageBox::NoButton, this);
330 330
331 messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); 331 messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
332 messageBox.setButtonText(QMessageBox::No, tr("No")); 332 messageBox.setButtonText(QMessageBox::No, tr("No"));
333 333
334 if (messageBox.exec() == QMessageBox::Yes) { 334 if (messageBox.exec() == QMessageBox::Yes) {
335 m_pDrawPadCanvas->clearPage(); 335 m_pDrawPadCanvas->clearPage();
336 } 336 }