author | drw <drw> | 2003-01-01 20:24:31 (UTC) |
---|---|---|
committer | drw <drw> | 2003-01-01 20:24:31 (UTC) |
commit | 0d5a0d775acbee43ac417e63c64126a4efc50d64 (patch) (unidiff) | |
tree | 0457679736ba2e72539b7538dde63c93a942f797 /noncore/graphics/drawpad/drawpad.cpp | |
parent | 2736ce30d565270495050cec2831d3f31b5c90a0 (diff) | |
download | opie-0d5a0d775acbee43ac417e63c64126a4efc50d64.zip opie-0d5a0d775acbee43ac417e63c64126a4efc50d64.tar.gz opie-0d5a0d775acbee43ac417e63c64126a4efc50d64.tar.bz2 |
Added QWhatsThis and some code optimizations to reduce executable size.
Diffstat (limited to 'noncore/graphics/drawpad/drawpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index b0a414e..53db993 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -48,7 +48,8 @@ | |||
48 | #include <qtoolbutton.h> | 48 | #include <qtoolbutton.h> |
49 | #include <qtooltip.h> | 49 | #include <qtooltip.h> |
50 | #include <qwhatsthis.h> | ||
50 | 51 | ||
51 | DrawPad::DrawPad(QWidget* parent, const char* name) | 52 | DrawPad::DrawPad(QWidget* parent, const char* name) |
52 | : QMainWindow(parent, name) | 53 | : QMainWindow(parent, name, WStyle_ContextHelp) |
53 | { | 54 | { |
54 | // init members | 55 | // init members |
@@ -105,15 +106,18 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
105 | QPEToolBar* pageToolBar = new QPEToolBar(this); | 106 | QPEToolBar* pageToolBar = new QPEToolBar(this); |
106 | 107 | ||
107 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this); | 108 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); |
108 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); | 109 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); |
109 | newPageAction->addTo(pageToolBar); | 110 | newPageAction->addTo(pageToolBar); |
111 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); | ||
110 | 112 | ||
111 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); | 113 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); |
112 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); | 114 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); |
113 | clearPageAction->addTo(pageToolBar); | 115 | clearPageAction->addTo(pageToolBar); |
116 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); | ||
114 | 117 | ||
115 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadIconSet("trash"), QString::null, 0, this); | 118 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); |
116 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); | 119 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); |
117 | deletePageAction->addTo(pageToolBar); | 120 | deletePageAction->addTo(pageToolBar); |
121 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); | ||
118 | 122 | ||
119 | QPEToolBar* emptyToolBar = new QPEToolBar(this); | 123 | QPEToolBar* emptyToolBar = new QPEToolBar(this); |
@@ -127,24 +131,30 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
127 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); | 131 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); |
128 | m_pUndoAction->addTo(navigationToolBar); | 132 | m_pUndoAction->addTo(navigationToolBar); |
133 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); | ||
129 | 134 | ||
130 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("drawpad/redo"), QString::null, 0, this); | 135 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("drawpad/redo"), QString::null, 0, this); |
131 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); | 136 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); |
132 | m_pRedoAction->addTo(navigationToolBar); | 137 | m_pRedoAction->addTo(navigationToolBar); |
138 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); | ||
133 | 139 | ||
134 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); | 140 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); |
135 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); | 141 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); |
136 | m_pFirstPageAction->addTo(navigationToolBar); | 142 | m_pFirstPageAction->addTo(navigationToolBar); |
143 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); | ||
137 | 144 | ||
138 | m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); | 145 | m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); |
139 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); | 146 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); |
140 | m_pPreviousPageAction->addTo(navigationToolBar); | 147 | m_pPreviousPageAction->addTo(navigationToolBar); |
148 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); | ||
141 | 149 | ||
142 | m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); | 150 | m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); |
143 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); | 151 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); |
144 | m_pNextPageAction->addTo(navigationToolBar); | 152 | m_pNextPageAction->addTo(navigationToolBar); |
153 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); | ||
145 | 154 | ||
146 | m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); | 155 | m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); |
147 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); | 156 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); |
148 | m_pLastPageAction->addTo(navigationToolBar); | 157 | m_pLastPageAction->addTo(navigationToolBar); |
158 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); | ||
149 | 159 | ||
150 | // init draw mode toolbar | 160 | // init draw mode toolbar |
@@ -154,12 +164,14 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
154 | m_pLineToolButton = new QToolButton(drawModeToolBar); | 164 | m_pLineToolButton = new QToolButton(drawModeToolBar); |
155 | m_pLineToolButton->setToggleButton(true); | 165 | m_pLineToolButton->setToggleButton(true); |
166 | QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); | ||
167 | |||
156 | 168 | ||
157 | QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); | 169 | QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); |
158 | 170 | ||
159 | m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadIconSet("drawpad/point.png"), "", 0, this); | 171 | m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); |
160 | connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); | 172 | connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); |
161 | m_pPointToolAction->addTo(linePopupMenu); | 173 | m_pPointToolAction->addTo(linePopupMenu); |
162 | 174 | ||
163 | m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadIconSet("drawpad/line.png"), "", 0, this); | 175 | m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); |
164 | connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); | 176 | connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); |
165 | m_pLineToolAction->addTo(linePopupMenu); | 177 | m_pLineToolAction->addTo(linePopupMenu); |
@@ -170,12 +182,13 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
170 | m_pRectangleToolButton = new QToolButton(drawModeToolBar); | 182 | m_pRectangleToolButton = new QToolButton(drawModeToolBar); |
171 | m_pRectangleToolButton->setToggleButton(true); | 183 | m_pRectangleToolButton->setToggleButton(true); |
184 | QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); | ||
172 | 185 | ||
173 | QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); | 186 | QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); |
174 | 187 | ||
175 | m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadIconSet("drawpad/rectangle.png"), "", 0, this); | 188 | m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); |
176 | connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); | 189 | connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); |
177 | m_pRectangleToolAction->addTo(rectanglePopupMenu); | 190 | m_pRectangleToolAction->addTo(rectanglePopupMenu); |
178 | 191 | ||
179 | m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadIconSet("drawpad/filledrectangle.png"), "", 0, this); | 192 | m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); |
180 | connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); | 193 | connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); |
181 | m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); | 194 | m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); |
@@ -186,12 +199,13 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
186 | m_pEllipseToolButton = new QToolButton(drawModeToolBar); | 199 | m_pEllipseToolButton = new QToolButton(drawModeToolBar); |
187 | 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." ) ); | ||
188 | 202 | ||
189 | QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); | 203 | QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); |
190 | 204 | ||
191 | m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadIconSet("drawpad/ellipse.png"), "", 0, this); | 205 | m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this); |
192 | connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); | 206 | connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); |
193 | m_pEllipseToolAction->addTo(ellipsePopupMenu); | 207 | m_pEllipseToolAction->addTo(ellipsePopupMenu); |
194 | 208 | ||
195 | m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadIconSet("drawpad/filledellipse.png"), "", 0, this); | 209 | m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this); |
196 | connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); | 210 | connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); |
197 | m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); | 211 | m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); |
@@ -200,18 +214,21 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
200 | m_pEllipseToolButton->setPopupDelay(0); | 214 | m_pEllipseToolButton->setPopupDelay(0); |
201 | 215 | ||
202 | m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadIconSet("drawpad/text.png"), QString::null, 0, this); | 216 | m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this); |
203 | m_pTextToolAction->setToggleAction(true); | 217 | m_pTextToolAction->setToggleAction(true); |
204 | connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); | 218 | connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); |
205 | m_pTextToolAction->addTo(drawModeToolBar); | 219 | m_pTextToolAction->addTo(drawModeToolBar); |
220 | m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); | ||
206 | 221 | ||
207 | m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadIconSet("drawpad/fill.png"), QString::null, 0, this); | 222 | m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this); |
208 | m_pFillToolAction->setToggleAction(true); | 223 | m_pFillToolAction->setToggleAction(true); |
209 | connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); | 224 | connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); |
210 | m_pFillToolAction->addTo(drawModeToolBar); | 225 | m_pFillToolAction->addTo(drawModeToolBar); |
226 | m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); | ||
211 | 227 | ||
212 | m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadIconSet("drawpad/erase.png"), QString::null, 0, this); | 228 | m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this); |
213 | m_pEraseToolAction->setToggleAction(true); | 229 | m_pEraseToolAction->setToggleAction(true); |
214 | connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); | 230 | connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); |
215 | m_pEraseToolAction->addTo(drawModeToolBar); | 231 | m_pEraseToolAction->addTo(drawModeToolBar); |
232 | m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); | ||
216 | 233 | ||
217 | m_pTool = 0; | 234 | m_pTool = 0; |
@@ -234,7 +251,9 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
234 | m_pPenWidthSpinBox->setValue(1); | 251 | m_pPenWidthSpinBox->setValue(1); |
235 | 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." ) ); | ||
236 | 254 | ||
237 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); | 255 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); |
238 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor.png")); | 256 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor")); |
257 | QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); | ||
239 | 258 | ||
240 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, m_pPenColorToolButton); | 259 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, m_pPenColorToolButton); |
@@ -248,5 +267,6 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
248 | 267 | ||
249 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); | 268 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); |
250 | m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor.png")); | 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." ) ); | ||
251 | 271 | ||
252 | ColorPopupMenu* brushColorPopupMenu = new ColorPopupMenu(Qt::white, m_pBrushColorToolButton); | 272 | ColorPopupMenu* brushColorPopupMenu = new ColorPopupMenu(Qt::white, m_pBrushColorToolButton); |
@@ -546,6 +566,5 @@ void DrawPad::updateView() | |||
546 | uint pageCount = m_pDrawPadCanvas->pageCount(); | 566 | uint pageCount = m_pDrawPadCanvas->pageCount(); |
547 | 567 | ||
548 | setCaption(tr("DrawPad") + " - " + tr("Page") + " " | 568 | setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) ); |
549 | + QString::number(pagePosition) + "/" + QString::number(pageCount)); | ||
550 | 569 | ||
551 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); | 570 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); |