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 | |
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 | |||
@@ -15,4 +15,4 @@ | |||
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" |
@@ -35,2 +35,4 @@ | |||
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <opie/colordialog.h> | ||
37 | #include <opie/colorpopupmenu.h> | ||
36 | 38 | ||
@@ -218,19 +220,24 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
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 | ||
@@ -239,19 +246,25 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
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 | ||
@@ -488,14 +501,2 @@ void DrawPad::changeBrushColor(const QColor& color) | |||
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() |
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 | |||
@@ -29,3 +29,3 @@ class QWidgetStack; | |||
29 | class DrawPad : public QMainWindow | 29 | class DrawPad : public QMainWindow |
30 | { | 30 | { |
31 | Q_OBJECT | 31 | Q_OBJECT |
@@ -54,4 +54,2 @@ private slots: | |||
54 | void changeBrushColor(const QColor& color); | 54 | void changeBrushColor(const QColor& color); |
55 | void choosePenColor(); | ||
56 | void chooseBrushColor(); | ||
57 | 55 | ||
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 | |||
@@ -2,5 +2,3 @@ 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 \ |
@@ -20,5 +18,3 @@ HEADERS = colordialog.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 \ |
@@ -42,3 +38,3 @@ INCLUDEPATH += $(OPIEDIR)/include \ | |||
42 | DEPENDPATH+= $(OPIEDIR)/include | 38 | DEPENDPATH+= $(OPIEDIR)/include |
43 | LIBS += -lqpe | 39 | LIBS += -lqpe -lopie |
44 | DESTDIR = $(OPIEDIR)/bin | 40 | DESTDIR = $(OPIEDIR)/bin |