author | simon <simon> | 2002-04-30 06:10:58 (UTC) |
---|---|---|
committer | simon <simon> | 2002-04-30 06:10:58 (UTC) |
commit | 06be684b1ad4f17fdb5e9ea55560c1d6e4b4bf7d (patch) (unidiff) | |
tree | 3eeba0a5403e1c0e3d4933b8065731fb9c47a511 | |
parent | ed745f7e21eb32fbf5d9a3f1734d79b25cfa629c (diff) | |
download | opie-06be684b1ad4f17fdb5e9ea55560c1d6e4b4bf7d.zip opie-06be684b1ad4f17fdb5e9ea55560c1d6e4b4bf7d.tar.gz opie-06be684b1ad4f17fdb5e9ea55560c1d6e4b4bf7d.tar.bz2 |
- no default arguments in method implementations
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | libopie/colorpopupmenu.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 294f37c..5609211 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -1,199 +1,199 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2002 zecke | 3 | ** Copyright (C) 2002 zecke |
4 | ** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de) | 4 | ** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de) |
5 | ** | 5 | ** |
6 | ** This file is part of Qtopia Environment. | 6 | ** This file is part of Qtopia Environment. |
7 | ** | 7 | ** |
8 | ** This file may be distributed and/or modified under the terms of the | 8 | ** This file may be distributed and/or modified under the terms of the |
9 | ** GNU General Public License version 2 as published by the Free Software | 9 | ** GNU General Public License version 2 as published by the Free Software |
10 | ** Foundation and appearing in the file LICENSE.GPL included in the | 10 | ** Foundation and appearing in the file LICENSE.GPL included in the |
11 | ** packaging of this file. | 11 | ** packaging of this file. |
12 | ** | 12 | ** |
13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
15 | ** | 15 | ** |
16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
17 | ** | 17 | ** |
18 | ** Contact info@trolltech.com if any conditions of this licensing are | 18 | ** Contact info@trolltech.com if any conditions of this licensing are |
19 | ** not clear to you. | 19 | ** not clear to you. |
20 | ** | 20 | ** |
21 | **********************************************************************/ | 21 | **********************************************************************/ |
22 | 22 | ||
23 | #define QTOPIA_INTERNAL_FD | 23 | #define QTOPIA_INTERNAL_FD |
24 | 24 | ||
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | #include "todoentryimpl.h" | 26 | #include "todoentryimpl.h" |
27 | #include "todotable.h" | 27 | #include "todotable.h" |
28 | #include "todolabel.h" | 28 | #include "todolabel.h" |
29 | 29 | ||
30 | #include <opie/tododb.h> | 30 | #include <opie/tododb.h> |
31 | #include <opie/todovcalresource.h> | 31 | #include <opie/todovcalresource.h> |
32 | #include <opie/ofontmenu.h> | 32 | #include <opie/ofontmenu.h> |
33 | 33 | ||
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <qpe/finddialog.h> | 36 | #include <qpe/finddialog.h> |
37 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
38 | #include <qpe/ir.h> | 38 | #include <qpe/ir.h> |
39 | #include <qpe/qpemenubar.h> | 39 | #include <qpe/qpemenubar.h> |
40 | #include <qpe/qpemessagebox.h> | 40 | #include <qpe/qpemessagebox.h> |
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | //#include <qpe/task.h> | 42 | //#include <qpe/task.h> |
43 | #include <qpe/qpetoolbar.h> | 43 | #include <qpe/qpetoolbar.h> |
44 | 44 | ||
45 | #include <qaction.h> | 45 | #include <qaction.h> |
46 | #include <qarray.h> | 46 | #include <qarray.h> |
47 | #include <qdatastream.h> | 47 | #include <qdatastream.h> |
48 | #include <qdatetime.h> | 48 | #include <qdatetime.h> |
49 | #include <qfile.h> | 49 | #include <qfile.h> |
50 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qpopupmenu.h> | 51 | #include <qpopupmenu.h> |
52 | #include <qwidgetstack.h> | 52 | #include <qwidgetstack.h> |
53 | 53 | ||
54 | #include <sys/stat.h> | 54 | #include <sys/stat.h> |
55 | #include <sys/types.h> | 55 | #include <sys/types.h> |
56 | #include <fcntl.h> | 56 | #include <fcntl.h> |
57 | #include <unistd.h> | 57 | #include <unistd.h> |
58 | 58 | ||
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | 60 | ||
61 | static QString todolistXMLFilename() | 61 | static QString todolistXMLFilename() |
62 | { | 62 | { |
63 | return Global::applicationFileName("todolist","todolist.xml"); | 63 | return Global::applicationFileName("todolist","todolist.xml"); |
64 | } | 64 | } |
65 | 65 | ||
66 | static QString categoriesXMLFilename() | 66 | static QString categoriesXMLFilename() |
67 | { | 67 | { |
68 | return Global::applicationFileName("todolist","categories.xml"); | 68 | return Global::applicationFileName("todolist","categories.xml"); |
69 | } | 69 | } |
70 | 70 | ||
71 | TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 71 | TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f ) : |
72 | QMainWindow( parent, name, f ), syncing(FALSE) | 72 | QMainWindow( parent, name, f ), syncing(FALSE) |
73 | { | 73 | { |
74 | // QTime t; | 74 | // QTime t; |
75 | // t.start(); | 75 | // t.start(); |
76 | mView = 0l; | 76 | mView = 0l; |
77 | mStack = new QWidgetStack(this, "main stack"); | 77 | mStack = new QWidgetStack(this, "main stack"); |
78 | setCaption( tr("Todo") ); | 78 | setCaption( tr("Todo") ); |
79 | QString str; | 79 | QString str; |
80 | table = new TodoTable( this ); | 80 | table = new TodoTable( this ); |
81 | table->setColumnWidth( 2, 10 ); | 81 | table->setColumnWidth( 2, 10 ); |
82 | table->setPaintingEnabled( FALSE ); | 82 | table->setPaintingEnabled( FALSE ); |
83 | table->setUpdatesEnabled( FALSE ); | 83 | table->setUpdatesEnabled( FALSE ); |
84 | table->viewport()->setUpdatesEnabled( FALSE ); | 84 | table->viewport()->setUpdatesEnabled( FALSE ); |
85 | 85 | ||
86 | { | 86 | { |
87 | str = todolistXMLFilename(); | 87 | str = todolistXMLFilename(); |
88 | if ( str.isNull() ) | 88 | if ( str.isNull() ) |
89 | QMessageBox::critical( this, | 89 | QMessageBox::critical( this, |
90 | tr("Out of Space"), | 90 | tr("Out of Space"), |
91 | tr("Unable to create startup files\n" | 91 | tr("Unable to create startup files\n" |
92 | "Free up some space\n" | 92 | "Free up some space\n" |
93 | "before you enter any data") ); | 93 | "before you enter any data") ); |
94 | else | 94 | else |
95 | table->load( str ); | 95 | table->load( str ); |
96 | } | 96 | } |
97 | 97 | ||
98 | // repeat for categories... | 98 | // repeat for categories... |
99 | str = categoriesXMLFilename(); | 99 | str = categoriesXMLFilename(); |
100 | if ( str.isNull() ) | 100 | if ( str.isNull() ) |
101 | QMessageBox::critical( this, | 101 | QMessageBox::critical( this, |
102 | tr( "Out of Space" ), | 102 | tr( "Out of Space" ), |
103 | tr( "Unable to create startup files\n" | 103 | tr( "Unable to create startup files\n" |
104 | "Free up some space\n" | 104 | "Free up some space\n" |
105 | "before you enter any data") ); | 105 | "before you enter any data") ); |
106 | 106 | ||
107 | mStack->addWidget(table, 1 ); | 107 | mStack->addWidget(table, 1 ); |
108 | mStack->raiseWidget( 1 ); | 108 | mStack->raiseWidget( 1 ); |
109 | setCentralWidget( mStack ); | 109 | setCentralWidget( mStack ); |
110 | setToolBarsMovable( FALSE ); | 110 | setToolBarsMovable( FALSE ); |
111 | 111 | ||
112 | // qDebug("after load: t=%d", t.elapsed() ); | 112 | // qDebug("after load: t=%d", t.elapsed() ); |
113 | 113 | ||
114 | Config config( "todo" ); | 114 | Config config( "todo" ); |
115 | config.setGroup( "View" ); | 115 | config.setGroup( "View" ); |
116 | bool complete = config.readBoolEntry( "ShowComplete", true ); | 116 | bool complete = config.readBoolEntry( "ShowComplete", true ); |
117 | table->setShowCompleted( complete ); | 117 | table->setShowCompleted( complete ); |
118 | 118 | ||
119 | bool showdeadline = config.readBoolEntry("ShowDeadLine", true); | 119 | bool showdeadline = config.readBoolEntry("ShowDeadLine", true); |
120 | table->setShowDeadline (showdeadline); | 120 | table->setShowDeadline (showdeadline); |
121 | 121 | ||
122 | QString category = config.readEntry( "Category", QString::null ); | 122 | QString category = config.readEntry( "Category", QString::null ); |
123 | table->setShowCategory( category ); | 123 | table->setShowCategory( category ); |
124 | 124 | ||
125 | QPEToolBar *bar = new QPEToolBar( this ); | 125 | QPEToolBar *bar = new QPEToolBar( this ); |
126 | bar->setHorizontalStretchable( TRUE ); | 126 | bar->setHorizontalStretchable( TRUE ); |
127 | 127 | ||
128 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 128 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
129 | 129 | ||
130 | catMenu = new QPopupMenu( this ); | 130 | catMenu = new QPopupMenu( this ); |
131 | QPopupMenu *edit = new QPopupMenu( this ); | 131 | QPopupMenu *edit = new QPopupMenu( this ); |
132 | QPopupMenu *options = new QPopupMenu(this ); | 132 | QPopupMenu *options = new QPopupMenu(this ); |
133 | 133 | ||
134 | contextMenu = new QPopupMenu( this ); | 134 | contextMenu = new QPopupMenu( this ); |
135 | 135 | ||
136 | bar = new QPEToolBar( this ); | 136 | bar = new QPEToolBar( this ); |
137 | 137 | ||
138 | QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ), | 138 | QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ), |
139 | QString::null, 0, this, 0 ); | 139 | QString::null, 0, this, 0 ); |
140 | connect( a, SIGNAL( activated() ), | 140 | connect( a, SIGNAL( activated() ), |
141 | this, SLOT( slotNew() ) ); | 141 | this, SLOT( slotNew() ) ); |
142 | a->addTo( bar ); | 142 | a->addTo( bar ); |
143 | a->addTo( edit ); | 143 | a->addTo( edit ); |
144 | 144 | ||
145 | a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ), | 145 | a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ), |
146 | QString::null, 0, this, 0 ); | 146 | QString::null, 0, this, 0 ); |
147 | connect( a, SIGNAL( activated() ), | 147 | connect( a, SIGNAL( activated() ), |
148 | this, SLOT( slotEdit() ) ); | 148 | this, SLOT( slotEdit() ) ); |
149 | a->addTo( bar ); | 149 | a->addTo( bar ); |
150 | a->addTo( edit ); | 150 | a->addTo( edit ); |
151 | a->addTo( contextMenu ); | 151 | a->addTo( contextMenu ); |
152 | a->setEnabled( FALSE ); | 152 | a->setEnabled( FALSE ); |
153 | editAction = a; | 153 | editAction = a; |
154 | 154 | ||
155 | a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); | 155 | a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); |
156 | a->addTo( edit ); | 156 | a->addTo( edit ); |
157 | a->addTo( contextMenu ); | 157 | a->addTo( contextMenu ); |
158 | connect( a, SIGNAL( activated() ), | 158 | connect( a, SIGNAL( activated() ), |
159 | this, SLOT(slotShowDetails() ) ); | 159 | this, SLOT(slotShowDetails() ) ); |
160 | 160 | ||
161 | edit->insertSeparator(); | 161 | edit->insertSeparator(); |
162 | 162 | ||
163 | a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ), | 163 | a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ), |
164 | QString::null, 0, this, 0 ); | 164 | QString::null, 0, this, 0 ); |
165 | connect( a, SIGNAL( activated() ), | 165 | connect( a, SIGNAL( activated() ), |
166 | this, SLOT( slotDelete() ) ); | 166 | this, SLOT( slotDelete() ) ); |
167 | a->addTo( bar ); | 167 | a->addTo( bar ); |
168 | a->addTo( edit ); | 168 | a->addTo( edit ); |
169 | a->addTo( contextMenu ); | 169 | a->addTo( contextMenu ); |
170 | a->setEnabled( FALSE ); | 170 | a->setEnabled( FALSE ); |
171 | deleteAction = a; | 171 | deleteAction = a; |
172 | 172 | ||
173 | // delete All in category is missing.... | 173 | // delete All in category is missing.... |
174 | // set All Done | 174 | // set All Done |
175 | // set All Done in category | 175 | // set All Done in category |
176 | 176 | ||
177 | a = new QAction( QString::null, tr( "Delete all..."), 0, this, 0 ); | 177 | a = new QAction( QString::null, tr( "Delete all..."), 0, this, 0 ); |
178 | connect(a, SIGNAL( activated() ), | 178 | connect(a, SIGNAL( activated() ), |
179 | this, SLOT( slotDeleteAll() ) ); | 179 | this, SLOT( slotDeleteAll() ) ); |
180 | a->addTo(edit ); | 180 | a->addTo(edit ); |
181 | a->setEnabled( FALSE ); | 181 | a->setEnabled( FALSE ); |
182 | deleteAllAction = a; | 182 | deleteAllAction = a; |
183 | 183 | ||
184 | edit->insertSeparator(); | 184 | edit->insertSeparator(); |
185 | a = new QAction( QString::null, tr("Duplicate" ), 0, this, 0 ); | 185 | a = new QAction( QString::null, tr("Duplicate" ), 0, this, 0 ); |
186 | connect(a, SIGNAL( activated() ), | 186 | connect(a, SIGNAL( activated() ), |
187 | this, SLOT( slotDuplicate() ) ); | 187 | this, SLOT( slotDuplicate() ) ); |
188 | a->addTo(edit ); | 188 | a->addTo(edit ); |
189 | a->setEnabled( FALSE ); | 189 | a->setEnabled( FALSE ); |
190 | duplicateAction = a; | 190 | duplicateAction = a; |
191 | edit->insertSeparator(); | 191 | edit->insertSeparator(); |
192 | 192 | ||
193 | 193 | ||
194 | 194 | ||
195 | if ( Ir::supported() ) { | 195 | if ( Ir::supported() ) { |
196 | a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), | 196 | a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), |
197 | QString::null, 0, this, 0 ); | 197 | QString::null, 0, this, 0 ); |
198 | connect( a, SIGNAL( activated() ), | 198 | connect( a, SIGNAL( activated() ), |
199 | this, SLOT( slotBeam() ) ); | 199 | this, SLOT( slotBeam() ) ); |
diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp index 9b50a8b..17e2c0a 100644 --- a/libopie/colorpopupmenu.cpp +++ b/libopie/colorpopupmenu.cpp | |||
@@ -1,165 +1,165 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** ColorPopupMenu | 2 | ** ColorPopupMenu |
3 | ** | 3 | ** |
4 | ** Popup menu for selecting colors | 4 | ** Popup menu for selecting colors |
5 | ** | 5 | ** |
6 | ** Based on colorpanel by S. Prud'homme <prudhomme@laposte.net> | 6 | ** Based on colorpanel by S. Prud'homme <prudhomme@laposte.net> |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2002, Dan Williams | 8 | ** Copyright (C) 2002, Dan Williams |
9 | ** williamsdr@acm.org | 9 | ** williamsdr@acm.org |
10 | ** http://draknor.net | 10 | ** http://draknor.net |
11 | ** | 11 | ** |
12 | ** This file may be distributed and/or modified under the terms of the | 12 | ** This file may be distributed and/or modified under the terms of the |
13 | ** GNU General Public License version 2 as published by the Free Software | 13 | ** GNU General Public License version 2 as published by the Free Software |
14 | ** Foundation and appearing in the file LICENSE.GPL included in the | 14 | ** Foundation and appearing in the file LICENSE.GPL included in the |
15 | ** packaging of this file. | 15 | ** packaging of this file. |
16 | ** | 16 | ** |
17 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 17 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
18 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 18 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include "colorpopupmenu.h" | 22 | #include "colorpopupmenu.h" |
23 | #include "colordialog.h" | 23 | #include "colordialog.h" |
24 | 24 | ||
25 | #include <qaction.h> | 25 | #include <qaction.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qpainter.h> | 27 | #include <qpainter.h> |
28 | 28 | ||
29 | ColorPanelButton::ColorPanelButton( const QColor& color, QWidget* parent, const char* name ) | 29 | ColorPanelButton::ColorPanelButton( const QColor& color, QWidget* parent, const char* name ) |
30 | : QFrame( parent, name ) | 30 | : QFrame( parent, name ) |
31 | { | 31 | { |
32 | m_color = color; | 32 | m_color = color; |
33 | 33 | ||
34 | setFixedSize( 16, 16 ); | 34 | setFixedSize( 16, 16 ); |
35 | setActive( FALSE ); | 35 | setActive( FALSE ); |
36 | } | 36 | } |
37 | 37 | ||
38 | ColorPanelButton::~ColorPanelButton() | 38 | ColorPanelButton::~ColorPanelButton() |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | void ColorPanelButton::setActive( bool active ) | 42 | void ColorPanelButton::setActive( bool active ) |
43 | { | 43 | { |
44 | m_active = active; | 44 | m_active = active; |
45 | 45 | ||
46 | if ( m_active ) { | 46 | if ( m_active ) { |
47 | setFrameStyle( Panel | Sunken ); | 47 | setFrameStyle( Panel | Sunken ); |
48 | } else { | 48 | } else { |
49 | setFrameStyle( NoFrame ); | 49 | setFrameStyle( NoFrame ); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | void ColorPanelButton::enterEvent( QEvent* e ) | 53 | void ColorPanelButton::enterEvent( QEvent* e ) |
54 | { | 54 | { |
55 | Q_UNUSED( e ) | 55 | Q_UNUSED( e ) |
56 | 56 | ||
57 | if ( !m_active ) { | 57 | if ( !m_active ) { |
58 | setFrameStyle( Panel | Sunken ); | 58 | setFrameStyle( Panel | Sunken ); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | void ColorPanelButton::leaveEvent( QEvent* e ) | 62 | void ColorPanelButton::leaveEvent( QEvent* e ) |
63 | { | 63 | { |
64 | Q_UNUSED( e ) | 64 | Q_UNUSED( e ) |
65 | 65 | ||
66 | if ( !m_active ) { | 66 | if ( !m_active ) { |
67 | setFrameStyle( NoFrame ); | 67 | setFrameStyle( NoFrame ); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | void ColorPanelButton::paintEvent( QPaintEvent* e ) | 71 | void ColorPanelButton::paintEvent( QPaintEvent* e ) |
72 | { | 72 | { |
73 | QFrame::paintEvent( e ); | 73 | QFrame::paintEvent( e ); |
74 | 74 | ||
75 | QPainter painter; | 75 | QPainter painter; |
76 | painter.begin( this ); | 76 | painter.begin( this ); |
77 | painter.fillRect( 2, 2, 12, 12, m_color ); | 77 | painter.fillRect( 2, 2, 12, 12, m_color ); |
78 | painter.setPen( Qt::black ); | 78 | painter.setPen( Qt::black ); |
79 | painter.drawRect( 2, 2, 12, 12 ); | 79 | painter.drawRect( 2, 2, 12, 12 ); |
80 | painter.end(); | 80 | painter.end(); |
81 | } | 81 | } |
82 | 82 | ||
83 | void ColorPanelButton::mouseReleaseEvent( QMouseEvent* e ) | 83 | void ColorPanelButton::mouseReleaseEvent( QMouseEvent* e ) |
84 | { | 84 | { |
85 | Q_UNUSED( e ) | 85 | Q_UNUSED( e ) |
86 | 86 | ||
87 | emit selected( m_color ); | 87 | emit selected( m_color ); |
88 | } | 88 | } |
89 | 89 | ||
90 | ColorPopupMenu::ColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ) | 90 | ColorPopupMenu::ColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) |
91 | : QPopupMenu( parent, name ) | 91 | : QPopupMenu( parent, name ) |
92 | { | 92 | { |
93 | m_color = color; | 93 | m_color = color; |
94 | 94 | ||
95 | colorPanel = new QWidget( this ); | 95 | colorPanel = new QWidget( this ); |
96 | 96 | ||
97 | colorLayout = new QGridLayout(colorPanel, 5, 6); | 97 | colorLayout = new QGridLayout(colorPanel, 5, 6); |
98 | 98 | ||
99 | addColor(QColor(255, 255, 255), 0, 1); | 99 | addColor(QColor(255, 255, 255), 0, 1); |
100 | addColor(QColor(192, 192, 192), 0, 2); | 100 | addColor(QColor(192, 192, 192), 0, 2); |
101 | addColor(QColor(128, 128, 128), 0, 3); | 101 | addColor(QColor(128, 128, 128), 0, 3); |
102 | addColor(QColor(64, 64, 64), 0, 4); | 102 | addColor(QColor(64, 64, 64), 0, 4); |
103 | addColor(QColor(0, 0, 0), 0, 5); | 103 | addColor(QColor(0, 0, 0), 0, 5); |
104 | 104 | ||
105 | addColor(QColor(255, 0, 0), 1, 0); | 105 | addColor(QColor(255, 0, 0), 1, 0); |
106 | addColor(QColor(255, 128, 0), 1, 1); | 106 | addColor(QColor(255, 128, 0), 1, 1); |
107 | addColor(QColor(255, 255, 0), 1, 2); | 107 | addColor(QColor(255, 255, 0), 1, 2); |
108 | addColor(QColor(128, 255, 0), 1, 3); | 108 | addColor(QColor(128, 255, 0), 1, 3); |
109 | addColor(QColor(0, 255, 0), 1, 4); | 109 | addColor(QColor(0, 255, 0), 1, 4); |
110 | addColor(QColor(0, 255, 128), 1, 5); | 110 | addColor(QColor(0, 255, 128), 1, 5); |
111 | 111 | ||
112 | addColor(QColor(128, 0, 0), 2, 0); | 112 | addColor(QColor(128, 0, 0), 2, 0); |
113 | addColor(QColor(128, 64, 0), 2, 1); | 113 | addColor(QColor(128, 64, 0), 2, 1); |
114 | addColor(QColor(128, 128, 0), 2, 2); | 114 | addColor(QColor(128, 128, 0), 2, 2); |
115 | addColor(QColor(64, 128, 0), 2, 3); | 115 | addColor(QColor(64, 128, 0), 2, 3); |
116 | addColor(QColor(0, 128, 0), 2, 4); | 116 | addColor(QColor(0, 128, 0), 2, 4); |
117 | addColor(QColor(0, 128, 64), 2, 5); | 117 | addColor(QColor(0, 128, 64), 2, 5); |
118 | 118 | ||
119 | addColor(QColor(0, 255, 255), 3, 0); | 119 | addColor(QColor(0, 255, 255), 3, 0); |
120 | addColor(QColor(0, 128, 255), 3, 1); | 120 | addColor(QColor(0, 128, 255), 3, 1); |
121 | addColor(QColor(0, 0, 255), 3, 2); | 121 | addColor(QColor(0, 0, 255), 3, 2); |
122 | addColor(QColor(128, 0, 255), 3, 3); | 122 | addColor(QColor(128, 0, 255), 3, 3); |
123 | addColor(QColor(255, 0, 255), 3, 4); | 123 | addColor(QColor(255, 0, 255), 3, 4); |
124 | addColor(QColor(255, 0, 128), 3, 5); | 124 | addColor(QColor(255, 0, 128), 3, 5); |
125 | 125 | ||
126 | addColor(QColor(0, 128, 128), 4, 0); | 126 | addColor(QColor(0, 128, 128), 4, 0); |
127 | addColor(QColor(0, 64, 128), 4, 1); | 127 | addColor(QColor(0, 64, 128), 4, 1); |
128 | addColor(QColor(0, 0, 128), 4, 2); | 128 | addColor(QColor(0, 0, 128), 4, 2); |
129 | addColor(QColor(64, 0, 128), 4, 3); | 129 | addColor(QColor(64, 0, 128), 4, 3); |
130 | addColor(QColor(128, 0, 128), 4, 4); | 130 | addColor(QColor(128, 0, 128), 4, 4); |
131 | addColor(QColor(128, 0, 64), 4, 5); | 131 | addColor(QColor(128, 0, 64), 4, 5); |
132 | 132 | ||
133 | insertItem( colorPanel ); | 133 | insertItem( colorPanel ); |
134 | insertSeparator(); | 134 | insertSeparator(); |
135 | QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); | 135 | QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); |
136 | connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); | 136 | connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); |
137 | chooseColorAction->addTo( this ); | 137 | chooseColorAction->addTo( this ); |
138 | activateItemAt( 0 ); | 138 | activateItemAt( 0 ); |
139 | } | 139 | } |
140 | 140 | ||
141 | ColorPopupMenu::~ColorPopupMenu() | 141 | ColorPopupMenu::~ColorPopupMenu() |
142 | { | 142 | { |
143 | } | 143 | } |
144 | 144 | ||
145 | void ColorPopupMenu::addColor( const QColor& color, int row, int col ) | 145 | void ColorPopupMenu::addColor( const QColor& color, int row, int col ) |
146 | { | 146 | { |
147 | ColorPanelButton* panelButton = new ColorPanelButton( color, colorPanel ); | 147 | ColorPanelButton* panelButton = new ColorPanelButton( color, colorPanel ); |
148 | connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); | 148 | connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); |
149 | colorLayout->addWidget( panelButton, row, col ); | 149 | colorLayout->addWidget( panelButton, row, col ); |
150 | } | 150 | } |
151 | 151 | ||
152 | void ColorPopupMenu::buttonSelected( const QColor& color ) | 152 | void ColorPopupMenu::buttonSelected( const QColor& color ) |
153 | { | 153 | { |
154 | m_color = color; | 154 | m_color = color; |
155 | emit colorSelected( color ); | 155 | emit colorSelected( color ); |
156 | hide(); | 156 | hide(); |
157 | } | 157 | } |
158 | 158 | ||
159 | void ColorPopupMenu::moreColorClicked() | 159 | void ColorPopupMenu::moreColorClicked() |
160 | { | 160 | { |
161 | QColor color = OColorDialog::getColor( m_color ); | 161 | QColor color = OColorDialog::getColor( m_color ); |
162 | m_color = color; | 162 | m_color = color; |
163 | emit colorSelected( color ); | 163 | emit colorSelected( color ); |
164 | hide(); | 164 | hide(); |
165 | } | 165 | } |