author | drw <drw> | 2002-04-26 00:51:19 (UTC) |
---|---|---|
committer | drw <drw> | 2002-04-26 00:51:19 (UTC) |
commit | 97e07ec8e7345d90913791edba813d4b72aa33a9 (patch) (unidiff) | |
tree | 468906df1cbe3db449c771071482d9a79d3f39f0 /noncore/graphics | |
parent | a111f57eedcf27623e9bff2816c83d3287272aff (diff) | |
download | opie-97e07ec8e7345d90913791edba813d4b72aa33a9.zip opie-97e07ec8e7345d90913791edba813d4b72aa33a9.tar.gz opie-97e07ec8e7345d90913791edba813d4b72aa33a9.tar.bz2 |
Use new ColorPopupMenu and ColorDialog found in libopie
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 77 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 4 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.pro | 10 |
3 files changed, 43 insertions, 48 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 7e6fc53..77fee98 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -13,8 +13,8 @@ | |||
13 | 13 | ||
14 | #include "drawpad.h" | 14 | #include "drawpad.h" |
15 | 15 | ||
16 | #include "colordialog.h" | 16 | //#include "colordialog.h" |
17 | #include "colorpanel.h" | 17 | //#include "colorpanel.h" |
18 | #include "drawpadcanvas.h" | 18 | #include "drawpadcanvas.h" |
19 | #include "ellipsetool.h" | 19 | #include "ellipsetool.h" |
20 | #include "erasetool.h" | 20 | #include "erasetool.h" |
@@ -33,6 +33,8 @@ | |||
33 | #include <qpe/qpemenubar.h> | 33 | #include <qpe/qpemenubar.h> |
34 | #include <qpe/qpetoolbar.h> | 34 | #include <qpe/qpetoolbar.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <opie/colordialog.h> | ||
37 | #include <opie/colorpopupmenu.h> | ||
36 | 38 | ||
37 | #include <qaction.h> | 39 | #include <qaction.h> |
38 | #include <qfile.h> | 40 | #include <qfile.h> |
@@ -216,44 +218,55 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
216 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); | 218 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); |
217 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor.png")); | 219 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor.png")); |
218 | 220 | ||
219 | QPopupMenu* penColorPopupMenu = new QPopupMenu(m_pPenColorToolButton); | 221 | ColorPopupMenu* colorPopupMenu = new ColorPopupMenu( Qt::black, m_pPenColorToolButton ); |
222 | m_pPenColorToolButton->setPopup( colorPopupMenu ); | ||
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& ) ) ); | ||
220 | 226 | ||
221 | ColorPanel* penColorPanel = new ColorPanel(penColorPopupMenu); | 227 | // QPopupMenu* penColorPopupMenu = new QPopupMenu(m_pPenColorToolButton); |
222 | connect(penColorPanel, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); | ||
223 | 228 | ||
224 | penColorPopupMenu->insertItem(penColorPanel); | 229 | // ColorPanel* penColorPanel = new ColorPanel(penColorPopupMenu); |
225 | penColorPopupMenu->insertSeparator(); | 230 | // connect(penColorPanel, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); |
226 | 231 | ||
227 | QAction* choosePenColorAction = new QAction(tr("More"), tr("More..."), 0, this); | 232 | // penColorPopupMenu->insertItem(penColorPanel); |
228 | connect(choosePenColorAction, SIGNAL(activated()), this, SLOT(choosePenColor())); | 233 | // penColorPopupMenu->insertSeparator(); |
229 | choosePenColorAction->addTo(penColorPopupMenu); | ||
230 | 234 | ||
231 | QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); | 235 | // QAction* choosePenColorAction = new QAction(tr("More"), tr("More..."), 0, this); |
232 | m_pPenColorToolButton->setPopup(penColorPopupMenu); | 236 | // connect(choosePenColorAction, SIGNAL(activated()), this, SLOT(choosePenColor())); |
233 | m_pPenColorToolButton->setPopupDelay(0); | 237 | // choosePenColorAction->addTo(penColorPopupMenu); |
234 | 238 | ||
235 | penColorPanel->buttonSelected(Qt::black); | 239 | // m_pPenColorToolButton->setPopup(colorPopupMenu); |
240 | // m_pPenColorToolButton->setPopupDelay(0); | ||
241 | |||
242 | // penColorPanel->buttonSelected(Qt::black); | ||
236 | 243 | ||
237 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); | 244 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); |
238 | m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor.png")); | 245 | m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor.png")); |
239 | 246 | ||
240 | QPopupMenu* brushColorPopupMenu = new QPopupMenu(m_pBrushColorToolButton); | ||
241 | 247 | ||
242 | ColorPanel* brushColorPanel = new ColorPanel(brushColorPopupMenu); | 248 | colorPopupMenu = new ColorPopupMenu( Qt::white, m_pBrushColorToolButton ); |
243 | connect(brushColorPanel, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); | 249 | m_pBrushColorToolButton->setPopup( colorPopupMenu ); |
250 | m_pBrushColorToolButton->setPopupDelay( 0 ); | ||
251 | QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); | ||
252 | connect( colorPopupMenu, SIGNAL( colorSelected( const QColor& ) ), this, SLOT( changeeBrushColor( const QColor& ) ) ); | ||
244 | 253 | ||
245 | brushColorPopupMenu->insertItem(brushColorPanel); | 254 | // QPopupMenu* brushColorPopupMenu = new QPopupMenu(m_pBrushColorToolButton); |
246 | brushColorPopupMenu->insertSeparator(); | ||
247 | 255 | ||
248 | QAction* chooseBrushColorAction = new QAction(tr("More"), tr("More..."), 0, this); | 256 | // ColorPanel* brushColorPanel = new ColorPanel(brushColorPopupMenu); |
249 | connect(chooseBrushColorAction, SIGNAL(activated()), this, SLOT(chooseBrushColor())); | 257 | // connect(brushColorPanel, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); |
250 | chooseBrushColorAction->addTo(brushColorPopupMenu); | ||
251 | 258 | ||
252 | QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); | 259 | // brushColorPopupMenu->insertItem(brushColorPanel); |
253 | m_pBrushColorToolButton->setPopup(brushColorPopupMenu); | 260 | // brushColorPopupMenu->insertSeparator(); |
254 | m_pBrushColorToolButton->setPopupDelay(0); | 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); | ||
255 | 268 | ||
256 | brushColorPanel->buttonSelected(Qt::white); | 269 | // brushColorPanel->buttonSelected(Qt::white); |
257 | 270 | ||
258 | // init pages | 271 | // init pages |
259 | 272 | ||
@@ -486,18 +499,6 @@ void DrawPad::changeBrushColor(const QColor& color) | |||
486 | m_pBrushColorToolButton->popup()->hide(); | 499 | m_pBrushColorToolButton->popup()->hide(); |
487 | } | 500 | } |
488 | 501 | ||
489 | void DrawPad::choosePenColor() | ||
490 | { | ||
491 | QColor newPenColor = QColorDialog::getColor(m_pen.color()); | ||
492 | changePenColor(newPenColor); | ||
493 | } | ||
494 | |||
495 | void DrawPad::chooseBrushColor() | ||
496 | { | ||
497 | QColor newBrushColor = QColorDialog::getColor(m_brush.color()); | ||
498 | changeBrushColor(newBrushColor); | ||
499 | } | ||
500 | |||
501 | void DrawPad::updateUndoRedoToolButtons() | 502 | void DrawPad::updateUndoRedoToolButtons() |
502 | { | 503 | { |
503 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->undoEnabled()); | 504 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->undoEnabled()); |
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index e4fd831..0dcd5c9 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h | |||
@@ -27,7 +27,7 @@ class QToolButton; | |||
27 | class QWidgetStack; | 27 | class QWidgetStack; |
28 | 28 | ||
29 | class DrawPad : public QMainWindow | 29 | class DrawPad : public QMainWindow |
30 | { | 30 | { |
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | 32 | ||
33 | public: | 33 | public: |
@@ -52,8 +52,6 @@ private slots: | |||
52 | void changePenWidth(int value); | 52 | void changePenWidth(int value); |
53 | void changePenColor(const QColor& color); | 53 | void changePenColor(const QColor& color); |
54 | void changeBrushColor(const QColor& color); | 54 | void changeBrushColor(const QColor& color); |
55 | void choosePenColor(); | ||
56 | void chooseBrushColor(); | ||
57 | 55 | ||
58 | void updateUndoRedoToolButtons(); | 56 | void updateUndoRedoToolButtons(); |
59 | void updateNavigationToolButtons(); | 57 | void updateNavigationToolButtons(); |
diff --git a/noncore/graphics/drawpad/drawpad.pro b/noncore/graphics/drawpad/drawpad.pro index 00eb00d..3b120c9 100644 --- a/noncore/graphics/drawpad/drawpad.pro +++ b/noncore/graphics/drawpad/drawpad.pro | |||
@@ -1,8 +1,6 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = colordialog.h \ | 3 | HEADERS = drawpad.h \ |
4 | colorpanel.h \ | ||
5 | drawpad.h \ | ||
6 | drawpadcanvas.h \ | 4 | drawpadcanvas.h \ |
7 | ellipsetool.h \ | 5 | ellipsetool.h \ |
8 | erasetool.h \ | 6 | erasetool.h \ |
@@ -18,9 +16,7 @@ HEADERS = colordialog.h \ | |||
18 | shapetool.h \ | 16 | shapetool.h \ |
19 | texttool.h \ | 17 | texttool.h \ |
20 | tool.h | 18 | tool.h |
21 | SOURCES = colordialog.cpp \ | 19 | SOURCES = drawpad.cpp \ |
22 | colorpanel.cpp \ | ||
23 | drawpad.cpp \ | ||
24 | drawpadcanvas.cpp \ | 20 | drawpadcanvas.cpp \ |
25 | ellipsetool.cpp \ | 21 | ellipsetool.cpp \ |
26 | erasetool.cpp \ | 22 | erasetool.cpp \ |
@@ -40,7 +36,7 @@ SOURCES = colordialog.cpp \ | |||
40 | INCLUDEPATH+= $(OPIEDIR)/include \ | 36 | INCLUDEPATH+= $(OPIEDIR)/include \ |
41 | $(QTDIR)/src/3rdparty/zlib | 37 | $(QTDIR)/src/3rdparty/zlib |
42 | DEPENDPATH+= $(OPIEDIR)/include | 38 | DEPENDPATH+= $(OPIEDIR)/include |
43 | LIBS += -lqpe | 39 | LIBS += -lqpe -lopie |
44 | DESTDIR = $(OPIEDIR)/bin | 40 | DESTDIR = $(OPIEDIR)/bin |
45 | TARGET = drawpad | 41 | TARGET = drawpad |
46 | 42 | ||