summaryrefslogtreecommitdiff
path: root/noncore/graphics
Unidiff
Diffstat (limited to 'noncore/graphics') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp85
-rw-r--r--noncore/graphics/drawpad/thumbnailview.cpp22
2 files changed, 77 insertions, 30 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index c0f42d9..158a5ed 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -11,53 +11,53 @@
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "drawpad.h" 14#include "drawpad.h"
15 15
16#include "drawpadcanvas.h" 16#include "drawpadcanvas.h"
17#include "ellipsetool.h" 17#include "ellipsetool.h"
18#include "erasetool.h" 18#include "erasetool.h"
19#include "exportdialog.h" 19#include "exportdialog.h"
20#include "filledellipsetool.h" 20#include "filledellipsetool.h"
21#include "filledrectangletool.h" 21#include "filledrectangletool.h"
22#include "filltool.h" 22#include "filltool.h"
23#include "importdialog.h" 23#include "importdialog.h"
24#include "linetool.h" 24#include "linetool.h"
25#include "newpagedialog.h" 25#include "newpagedialog.h"
26#include "page.h" 26#include "page.h"
27#include "pageinformationdialog.h" 27#include "pageinformationdialog.h"
28#include "pointtool.h" 28#include "pointtool.h"
29#include "rectangletool.h" 29#include "rectangletool.h"
30#include "texttool.h" 30#include "texttool.h"
31#include "thumbnailview.h" 31#include "thumbnailview.h"
32 32
33#include <opie2/qcolordialog.h> 33#include <opie2/qcolordialog.h>
34#include <opie2/ocolorpopupmenu.h> 34#include <opie2/ocolorpopupmenu.h>
35#include <opie2/oresource.h>
35 36
36#include <qpe/applnk.h> 37#include <qpe/applnk.h>
37#include <qpe/config.h> 38#include <qpe/config.h>
38#include <qtoolbar.h> 39#include <qtoolbar.h>
39#include <qpe/resource.h>
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41 41
42#include <qmenubar.h> 42#include <qmenubar.h>
43#include <qaction.h> 43#include <qaction.h>
44#include <qfile.h> 44#include <qfile.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qspinbox.h> 46#include <qspinbox.h>
47#include <qtoolbutton.h> 47#include <qtoolbutton.h>
48#include <qtooltip.h> 48#include <qtooltip.h>
49#include <qwhatsthis.h> 49#include <qwhatsthis.h>
50 50
51using namespace Opie::Ui; 51using namespace Opie::Ui;
52DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) 52DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ )
53 : QMainWindow(parent, name, WStyle_ContextHelp) 53 : QMainWindow(parent, name, WStyle_ContextHelp)
54{ 54{
55 // init members 55 // init members
56 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 56 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
57 this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) ); 57 this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) );
58 58
59 m_pDrawPadCanvas = new DrawPadCanvas(this, this); 59 m_pDrawPadCanvas = new DrawPadCanvas(this, this);
60 60
61 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); 61 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));
62 62
63 setCentralWidget(m_pDrawPadCanvas); 63 setCentralWidget(m_pDrawPadCanvas);
@@ -86,210 +86,247 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ )
86 exportPageAction->addTo(toolsPopupMenu); 86 exportPageAction->addTo(toolsPopupMenu);
87 87
88 toolsPopupMenu->insertSeparator(); 88 toolsPopupMenu->insertSeparator();
89 89
90 QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); 90 QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this);
91 connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); 91 connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView()));
92 thumbnailViewAction->addTo(toolsPopupMenu); 92 thumbnailViewAction->addTo(toolsPopupMenu);
93 93
94 QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); 94 QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this);
95 connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); 95 connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation()));
96 pageInformationAction->addTo(toolsPopupMenu); 96 pageInformationAction->addTo(toolsPopupMenu);
97 97
98 toolsPopupMenu->insertSeparator(); 98 toolsPopupMenu->insertSeparator();
99 99
100 m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); 100 m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this);
101 m_pAntiAliasingAction->setToggleAction(true); 101 m_pAntiAliasingAction->setToggleAction(true);
102 m_pAntiAliasingAction->addTo(toolsPopupMenu); 102 m_pAntiAliasingAction->addTo(toolsPopupMenu);
103 103
104 menuBar->insertItem(tr("Tools"), toolsPopupMenu); 104 menuBar->insertItem(tr("Tools"), toolsPopupMenu);
105 105
106 // init page toolbar 106 // init page toolbar
107 107
108 QToolBar* pageToolBar = new QToolBar(this); 108 QToolBar* pageToolBar = new QToolBar(this);
109 109
110 QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); 110 QAction* newPageAction = new QAction(tr("New Page"), Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
111 QString::null, 0, this);
111 connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); 112 connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage()));
112 newPageAction->addTo(pageToolBar); 113 newPageAction->addTo(pageToolBar);
113 newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); 114 newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) );
114 115
115 QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); 116 QAction* clearPageAction = new QAction(tr("Clear Page"),
117 Opie::Core::OResource::loadPixmap("drawpad/clear", Opie::Core::OResource::SmallIcon),
118 QString::null, 0, this);
116 connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); 119 connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage()));
117 clearPageAction->addTo(pageToolBar); 120 clearPageAction->addTo(pageToolBar);
118 clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); 121 clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) );
119 122
120 QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); 123 QAction* deletePageAction = new QAction(tr("Delete Page"),
124 Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),
125 QString::null, 0, this);
121 connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); 126 connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage()));
122 deletePageAction->addTo(pageToolBar); 127 deletePageAction->addTo(pageToolBar);
123 deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); 128 deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) );
124 129
125 QToolBar* emptyToolBar = new QToolBar(this); 130 QToolBar* emptyToolBar = new QToolBar(this);
126 emptyToolBar->setHorizontalStretchable(true); 131 emptyToolBar->setHorizontalStretchable(true);
127 132
128 // init navigation toolbar 133 // init navigation toolbar
129 134
130 QToolBar* navigationToolBar = new QToolBar(this); 135 QToolBar* navigationToolBar = new QToolBar(this);
131 136
132 m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); 137 m_pUndoAction = new QAction(tr("Undo"), Opie::Core::OResource::loadPixmap("undo", Opie::Core::OResource::SmallIcon),
138 QString::null, 0, this);
133 connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); 139 connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo()));
134 m_pUndoAction->addTo(navigationToolBar); 140 m_pUndoAction->addTo(navigationToolBar);
135 m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); 141 m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) );
136 142
137 m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); 143 m_pRedoAction = new QAction(tr("Redo"), Opie::Core::OResource::loadPixmap("redo", Opie::Core::OResource::SmallIcon),
144 QString::null, 0, this);
138 connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); 145 connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo()));
139 m_pRedoAction->addTo(navigationToolBar); 146 m_pRedoAction->addTo(navigationToolBar);
140 m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); 147 m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) );
141 148
142 m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); 149 m_pFirstPageAction = new QAction(tr("First Page"),
150 Opie::Core::OResource::loadPixmap("fastback", Opie::Core::OResource::SmallIcon),
151 QString::null, 0, this);
143 connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); 152 connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage()));
144 m_pFirstPageAction->addTo(navigationToolBar); 153 m_pFirstPageAction->addTo(navigationToolBar);
145 m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); 154 m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) );
146 155
147 m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); 156 m_pPreviousPageAction = new QAction(tr("Previous Page"),
157 Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon),
158 QString::null, 0, this);
148 connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); 159 connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage()));
149 m_pPreviousPageAction->addTo(navigationToolBar); 160 m_pPreviousPageAction->addTo(navigationToolBar);
150 m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); 161 m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) );
151 162
152 m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); 163 m_pNextPageAction = new QAction(tr("Next Page"),
164 Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon),
165 QString::null, 0, this);
153 connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); 166 connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage()));
154 m_pNextPageAction->addTo(navigationToolBar); 167 m_pNextPageAction->addTo(navigationToolBar);
155 m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); 168 m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) );
156 169
157 m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); 170 m_pLastPageAction = new QAction(tr("Last Page"),
171 Opie::Core::OResource::loadPixmap("fastforward", Opie::Core::OResource::SmallIcon),
172 QString::null, 0, this);
158 connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); 173 connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage()));
159 m_pLastPageAction->addTo(navigationToolBar); 174 m_pLastPageAction->addTo(navigationToolBar);
160 m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); 175 m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) );
161 176
162 // init draw mode toolbar 177 // init draw mode toolbar
163 178
164 QToolBar* drawModeToolBar = new QToolBar(this); 179 QToolBar* drawModeToolBar = new QToolBar(this);
165 180
166 m_pLineToolButton = new QToolButton(drawModeToolBar); 181 m_pLineToolButton = new QToolButton(drawModeToolBar);
167 m_pLineToolButton->setToggleButton(true); 182 m_pLineToolButton->setToggleButton(true);
168 QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); 183 QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) );
169 184
170 185
171 QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); 186 QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton);
172 187
173 m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); 188 m_pPointToolAction = new QAction(tr("Draw Point"),
189 Opie::Core::OResource::loadPixmap("drawpad/point", Opie::Core::OResource::SmallIcon),
190 "", 0, this);
174 connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); 191 connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool()));
175 m_pPointToolAction->addTo(linePopupMenu); 192 m_pPointToolAction->addTo(linePopupMenu);
176 193
177 m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); 194 m_pLineToolAction = new QAction(tr("Draw Line"),
195 Opie::Core::OResource::loadPixmap("drawpad/line", Opie::Core::OResource::SmallIcon),
196 "", 0, this);
178 connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); 197 connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool()));
179 m_pLineToolAction->addTo(linePopupMenu); 198 m_pLineToolAction->addTo(linePopupMenu);
180 199
181 m_pLineToolButton->setPopup(linePopupMenu); 200 m_pLineToolButton->setPopup(linePopupMenu);
182 m_pLineToolButton->setPopupDelay(0); 201 m_pLineToolButton->setPopupDelay(0);
183 202
184 m_pRectangleToolButton = new QToolButton(drawModeToolBar); 203 m_pRectangleToolButton = new QToolButton(drawModeToolBar);
185 m_pRectangleToolButton->setToggleButton(true); 204 m_pRectangleToolButton->setToggleButton(true);
186 QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); 205 QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) );
187 206
188 QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); 207 QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton);
189 208
190 m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); 209 m_pRectangleToolAction = new QAction(tr("Draw Rectangle"),
210 Opie::Core::OResource::loadPixmap("drawpad/rectangle", Opie::Core::OResource::SmallIcon),
211 "", 0, this);
191 connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); 212 connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool()));
192 m_pRectangleToolAction->addTo(rectanglePopupMenu); 213 m_pRectangleToolAction->addTo(rectanglePopupMenu);
193 214
194 m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); 215 m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"),
216 Opie::Core::OResource::loadPixmap("drawpad/filledrectangle",
217 Opie::Core::OResource::SmallIcon), "", 0, this);
195 connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); 218 connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool()));
196 m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); 219 m_pFilledRectangleToolAction->addTo(rectanglePopupMenu);
197 220
198 m_pRectangleToolButton->setPopup(rectanglePopupMenu); 221 m_pRectangleToolButton->setPopup(rectanglePopupMenu);
199 m_pRectangleToolButton->setPopupDelay(0); 222 m_pRectangleToolButton->setPopupDelay(0);
200 223
201 m_pEllipseToolButton = new QToolButton(drawModeToolBar); 224 m_pEllipseToolButton = new QToolButton(drawModeToolBar);
202 m_pEllipseToolButton->setToggleButton(true); 225 m_pEllipseToolButton->setToggleButton(true);
203 QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) ); 226 QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) );
204 227
205 QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); 228 QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton);
206 229
207 m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this); 230 m_pEllipseToolAction = new QAction(tr("Draw Ellipse"),
231 Opie::Core::OResource::loadPixmap("drawpad/ellipse", Opie::Core::OResource::SmallIcon),
232 "", 0, this);
208 connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); 233 connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool()));
209 m_pEllipseToolAction->addTo(ellipsePopupMenu); 234 m_pEllipseToolAction->addTo(ellipsePopupMenu);
210 235
211 m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this); 236 m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"),
237 Opie::Core::OResource::loadPixmap("drawpad/filledellipse",
238 Opie::Core::OResource::SmallIcon), "", 0, this);
212 connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); 239 connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool()));
213 m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); 240 m_pFilledEllipseToolAction->addTo(ellipsePopupMenu);
214 241
215 m_pEllipseToolButton->setPopup(ellipsePopupMenu); 242 m_pEllipseToolButton->setPopup(ellipsePopupMenu);
216 m_pEllipseToolButton->setPopupDelay(0); 243 m_pEllipseToolButton->setPopupDelay(0);
217 244
218 m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this); 245 m_pTextToolAction = new QAction(tr("Insert Text"),
246 Opie::Core::OResource::loadPixmap("drawpad/text", Opie::Core::OResource::SmallIcon),
247 QString::null, 0, this);
219 m_pTextToolAction->setToggleAction(true); 248 m_pTextToolAction->setToggleAction(true);
220 connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); 249 connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool()));
221 m_pTextToolAction->addTo(drawModeToolBar); 250 m_pTextToolAction->addTo(drawModeToolBar);
222 m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); 251 m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) );
223 252
224 m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this); 253 m_pFillToolAction = new QAction(tr("Fill Region"),
254 Opie::Core::OResource::loadPixmap("drawpad/fill", Opie::Core::OResource::SmallIcon),
255 QString::null, 0, this);
225 m_pFillToolAction->setToggleAction(true); 256 m_pFillToolAction->setToggleAction(true);
226 connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); 257 connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool()));
227 m_pFillToolAction->addTo(drawModeToolBar); 258 m_pFillToolAction->addTo(drawModeToolBar);
228 m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); 259 m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) );
229 260
230 m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this); 261 m_pEraseToolAction = new QAction(tr("Erase Point"),
262 Opie::Core::OResource::loadPixmap("drawpad/erase", Opie::Core::OResource::SmallIcon),
263 QString::null, 0, this);
231 m_pEraseToolAction->setToggleAction(true); 264 m_pEraseToolAction->setToggleAction(true);
232 connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); 265 connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool()));
233 m_pEraseToolAction->addTo(drawModeToolBar); 266 m_pEraseToolAction->addTo(drawModeToolBar);
234 m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); 267 m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) );
235 268
236 m_pTool = 0; 269 m_pTool = 0;
237 setRectangleTool(); 270 setRectangleTool();
238 setEllipseTool(); 271 setEllipseTool();
239 setPointTool(); 272 setPointTool();
240 273
241 emptyToolBar = new QToolBar(this); 274 emptyToolBar = new QToolBar(this);
242 emptyToolBar->setHorizontalStretchable(true); 275 emptyToolBar->setHorizontalStretchable(true);
243 emptyToolBar->addSeparator(); 276 emptyToolBar->addSeparator();
244 277
245 // init draw parameters toolbar 278 // init draw parameters toolbar
246 279
247 QToolBar* drawParametersToolBar = new QToolBar(this); 280 QToolBar* drawParametersToolBar = new QToolBar(this);
248 281
249 m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); 282 m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar);
250 connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); 283 connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int)));
251 284
252 QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width")); 285 QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width"));
253 m_pPenWidthSpinBox->setValue(1); 286 m_pPenWidthSpinBox->setValue(1);
254 m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus); 287 m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus);
255 QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) ); 288 QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) );
256 289
290 bool useBigIcon = qApp->desktop()->size().width() > 330;
291
257 m_pPenColorToolButton = new QToolButton(drawParametersToolBar); 292 m_pPenColorToolButton = new QToolButton(drawParametersToolBar);
258 m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor")); 293 m_pPenColorToolButton->setUsesBigPixmap( useBigIcon );
294 m_pPenColorToolButton->setPixmap(Opie::Core::OResource::loadPixmap("drawpad/pencolor", Opie::Core::OResource::SmallIcon));
259 QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); 295 QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) );
260 296
261 Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton); 297 Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton);
262 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); 298 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&)));
263 299
264 QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); 300 QToolTip::add(m_pPenColorToolButton, tr("Pen Color"));
265 m_pPenColorToolButton->setPopup(penColorPopupMenu); 301 m_pPenColorToolButton->setPopup(penColorPopupMenu);
266 m_pPenColorToolButton->setPopupDelay(0); 302 m_pPenColorToolButton->setPopupDelay(0);
267 303
268 changePenColor(Qt::black); 304 changePenColor(Qt::black);
269 305
270 m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); 306 m_pBrushColorToolButton = new QToolButton(drawParametersToolBar);
271 m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor")); 307 m_pBrushColorToolButton->setUsesBigPixmap( useBigIcon );
308 m_pBrushColorToolButton->setPixmap(Opie::Core::OResource::loadPixmap("drawpad/brushcolor", Opie::Core::OResource::SmallIcon));
272 QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); 309 QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) );
273 310
274 Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton); 311 Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton);
275 connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); 312 connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&)));
276 313
277 QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); 314 QToolTip::add(m_pBrushColorToolButton, tr("Fill Color"));
278 m_pBrushColorToolButton->setPopup(brushColorPopupMenu); 315 m_pBrushColorToolButton->setPopup(brushColorPopupMenu);
279 m_pBrushColorToolButton->setPopupDelay(0); 316 m_pBrushColorToolButton->setPopupDelay(0);
280 317
281 changeBrushColor(Qt::white); 318 changeBrushColor(Qt::white);
282 319
283 // delay the rest of the initialization and do it from within the mainloop 320 // delay the rest of the initialization and do it from within the mainloop
284 // if we don't do this, the widget layout may not be constructed upon 321 // if we don't do this, the widget layout may not be constructed upon
285 // and we will end up with a wrong QScrollview page size (Mickeyl) 322 // and we will end up with a wrong QScrollview page size (Mickeyl)
286 QTimer::singleShot( 100, this, SLOT( finishStartup() ) ); 323 QTimer::singleShot( 100, this, SLOT( finishStartup() ) );
287} 324}
288 325
289 326
290void DrawPad::finishStartup() 327void DrawPad::finishStartup()
291{ 328{
292 // init pages 329 // init pages
293 330
294 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 331 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
295 332
@@ -533,61 +570,63 @@ void DrawPad::setEraseTool()
533 delete m_pTool; 570 delete m_pTool;
534 } 571 }
535 572
536 m_pTool = new EraseTool(this, m_pDrawPadCanvas); 573 m_pTool = new EraseTool(this, m_pDrawPadCanvas);
537 574
538 m_pLineToolButton->setOn(false); 575 m_pLineToolButton->setOn(false);
539 m_pRectangleToolButton->setOn(false); 576 m_pRectangleToolButton->setOn(false);
540 m_pEllipseToolButton->setOn(false); 577 m_pEllipseToolButton->setOn(false);
541 m_pTextToolAction->setOn(false); 578 m_pTextToolAction->setOn(false);
542 m_pFillToolAction->setOn(false); 579 m_pFillToolAction->setOn(false);
543 m_pEraseToolAction->setOn(true); 580 m_pEraseToolAction->setOn(true);
544} 581}
545 582
546void DrawPad::changePenWidth(int value) 583void DrawPad::changePenWidth(int value)
547{ 584{
548 m_pen.setWidth(value); 585 m_pen.setWidth(value);
549} 586}
550 587
551void DrawPad::changePenColor(const QColor& color) 588void DrawPad::changePenColor(const QColor& color)
552{ 589{
553 m_pen.setColor(color); 590 m_pen.setColor(color);
554 591
555 QPainter painter; 592 QPainter painter;
556 painter.begin(m_pPenColorToolButton->pixmap()); 593 painter.begin(m_pPenColorToolButton->pixmap());
557 painter.fillRect(QRect(0, 12, 14, 2), m_pen.color()); 594 int size = AppLnk::smallIconSize();
595 painter.fillRect(QRect(0, 6*size/7+1, size, size/7), m_pen.color());
558 painter.end(); 596 painter.end();
559 597
560 m_pPenColorToolButton->popup()->hide(); 598 m_pPenColorToolButton->popup()->hide();
561} 599}
562 600
563void DrawPad::changeBrushColor(const QColor& color) 601void DrawPad::changeBrushColor(const QColor& color)
564{ 602{
565 m_brush = QBrush(color); 603 m_brush = QBrush(color);
566 604
567 QPainter painter; 605 QPainter painter;
568 painter.begin(m_pBrushColorToolButton->pixmap()); 606 painter.begin(m_pBrushColorToolButton->pixmap());
569 painter.fillRect(QRect(0, 12, 14, 2), m_brush.color()); 607 int size = AppLnk::smallIconSize();
608 painter.fillRect(QRect(0, 6*size/7+1, size, size/7), m_brush.color());
570 painter.end(); 609 painter.end();
571 610
572 m_pBrushColorToolButton->popup()->hide(); 611 m_pBrushColorToolButton->popup()->hide();
573} 612}
574 613
575void DrawPad::updateView() 614void DrawPad::updateView()
576{ 615{
577 uint pagePosition = m_pDrawPadCanvas->pagePosition(); 616 uint pagePosition = m_pDrawPadCanvas->pagePosition();
578 uint pageCount = m_pDrawPadCanvas->pageCount(); 617 uint pageCount = m_pDrawPadCanvas->pageCount();
579 618
580 setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) ); 619 setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) );
581 620
582 m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); 621 m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled());
583 m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled()); 622 m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled());
584 623
585 m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); 624 m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled());
586 m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); 625 m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled());
587 m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); 626 m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled());
588 m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); 627 m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled());
589} 628}
590 629
591void DrawPad::deleteAll() 630void DrawPad::deleteAll()
592{ 631{
593 QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), 632 QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"),
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp
index 1ccf484..d190ffe 100644
--- a/noncore/graphics/drawpad/thumbnailview.cpp
+++ b/noncore/graphics/drawpad/thumbnailview.cpp
@@ -1,46 +1,47 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "thumbnailview.h" 14#include "thumbnailview.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "newpagedialog.h" 18#include "newpagedialog.h"
19#include "page.h" 19#include "page.h"
20 20
21#include <opie2/oresource.h>
22
21#include <qpe/config.h> 23#include <qpe/config.h>
22#include <qpe/resource.h>
23#include <qpe/timestring.h> 24#include <qpe/timestring.h>
24 25
25#include <qapplication.h> 26#include <qapplication.h>
26#include <qlayout.h> 27#include <qlayout.h>
27#include <qmessagebox.h> 28#include <qmessagebox.h>
28#include <qtoolbutton.h> 29#include <qtoolbutton.h>
29#include <qwhatsthis.h> 30#include <qwhatsthis.h>
30 31
31#define THUMBNAIL_SIZE 48 32#define THUMBNAIL_SIZE 48
32 33
33PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) 34PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent)
34 : QListBoxItem(parent) 35 : QListBoxItem(parent)
35{ 36{
36 m_pPage = page; 37 m_pPage = page;
37 38
38 QImage image = m_pPage->pixmap()->convertToImage(); 39 QImage image = m_pPage->pixmap()->convertToImage();
39 40
40 int previewWidth = THUMBNAIL_SIZE; 41 int previewWidth = THUMBNAIL_SIZE;
41 int previewHeight = THUMBNAIL_SIZE; 42 int previewHeight = THUMBNAIL_SIZE;
42 43
43 float widthScale = 1.0; 44 float widthScale = 1.0;
44 float heightScale = 1.0; 45 float heightScale = 1.0;
45 46
46 if (previewWidth < image.width()) { 47 if (previewWidth < image.width()) {
@@ -218,74 +219,81 @@ Page* PageListBox::selected() const
218{ 219{
219 Page* page; 220 Page* page;
220 221
221 PageListBoxItem* selectedItem = (PageListBoxItem*)item(currentItem()); 222 PageListBoxItem* selectedItem = (PageListBoxItem*)item(currentItem());
222 223
223 if (selectedItem) { 224 if (selectedItem) {
224 page = selectedItem->page(); 225 page = selectedItem->page();
225 } else { 226 } else {
226 page = NULL; 227 page = NULL;
227 } 228 }
228 229
229 return page; 230 return page;
230} 231}
231 232
232ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) 233ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name)
233 : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel | Qt::WStyle_ContextHelp) 234 : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel | Qt::WStyle_ContextHelp)
234{ 235{
235 inLoop = false; 236 inLoop = false;
236 237
237 m_pDrawPad = drawPad; 238 m_pDrawPad = drawPad;
238 m_pDrawPadCanvas = drawPadCanvas; 239 m_pDrawPadCanvas = drawPadCanvas;
239 240
240 setCaption(tr("DrawPad - Thumbnail View")); 241 setCaption(tr("DrawPad - Thumbnail View"));
241 242
243 bool useBigIcon = qApp->desktop()->size().width() > 330;
244
242 QToolButton* newPageButton = new QToolButton(this); 245 QToolButton* newPageButton = new QToolButton(this);
243 newPageButton->setIconSet(Resource::loadIconSet("new")); 246 newPageButton->setUsesBigPixmap( useBigIcon );
247 newPageButton->setPixmap(Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon));
244 newPageButton->setAutoRaise(true); 248 newPageButton->setAutoRaise(true);
245 connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage())); 249 connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage()));
246 QWhatsThis::add( newPageButton, tr( "Click here to add a new sheet." ) ); 250 QWhatsThis::add( newPageButton, tr( "Click here to add a new sheet." ) );
247 251
248 QToolButton* clearPageButton = new QToolButton(this); 252 QToolButton* clearPageButton = new QToolButton(this);
249 clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear")); 253 clearPageButton->setUsesBigPixmap( useBigIcon );
254 clearPageButton->setPixmap(Opie::Core::OResource::loadPixmap("drawpad/clear", Opie::Core::OResource::SmallIcon));
250 clearPageButton->setAutoRaise(true); 255 clearPageButton->setAutoRaise(true);
251 connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage())); 256 connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage()));
252 QWhatsThis::add( clearPageButton, tr( "Click here to erase the current sheet." ) ); 257 QWhatsThis::add( clearPageButton, tr( "Click here to erase the current sheet." ) );
253 258
254 QToolButton* deletePageButton = new QToolButton(this); 259 QToolButton* deletePageButton = new QToolButton(this);
255 deletePageButton->setIconSet(Resource::loadIconSet("trash")); 260 deletePageButton->setUsesBigPixmap( useBigIcon );
261 deletePageButton->setPixmap(Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon));
256 deletePageButton->setAutoRaise(true); 262 deletePageButton->setAutoRaise(true);
257 connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); 263 connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage()));
258 QWhatsThis::add( deletePageButton, tr( "Click here to remove the current sheet." ) ); 264 QWhatsThis::add( deletePageButton, tr( "Click here to remove the current sheet." ) );
259 265
260 m_pMovePageUpButton = new QToolButton(this); 266 m_pMovePageUpButton = new QToolButton(this);
261 m_pMovePageUpButton->setIconSet(Resource::loadIconSet("up")); 267 m_pMovePageUpButton->setUsesBigPixmap( useBigIcon );
268 m_pMovePageUpButton->setPixmap(Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon));
262 m_pMovePageUpButton->setAutoRaise(true); 269 m_pMovePageUpButton->setAutoRaise(true);
263 connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp())); 270 connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp()));
264 QWhatsThis::add( m_pMovePageUpButton, tr( "Click here to move the current sheet up one position in the list." ) ); 271 QWhatsThis::add( m_pMovePageUpButton, tr( "Click here to move the current sheet up one position in the list." ) );
265 272
266 m_pMovePageDownButton = new QToolButton(this); 273 m_pMovePageDownButton = new QToolButton(this);
267 m_pMovePageDownButton->setIconSet(Resource::loadIconSet("down")); 274 m_pMovePageDownButton->setUsesBigPixmap( useBigIcon );
275 m_pMovePageDownButton->setPixmap(Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon));
268 m_pMovePageDownButton->setAutoRaise(true); 276 m_pMovePageDownButton->setAutoRaise(true);
269 connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown())); 277 connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown()));
270 QWhatsThis::add( m_pMovePageDownButton, tr( "Click here to move the current sheet down one position in the list." ) ); 278 QWhatsThis::add( m_pMovePageDownButton, tr( "Click here to move the current sheet down one position in the list." ) );
271 279
272 m_pPageListBox = new PageListBox(m_pDrawPadCanvas, this); 280 m_pPageListBox = new PageListBox(m_pDrawPadCanvas, this);
273 connect(m_pPageListBox, SIGNAL(selectionChanged()), this, SLOT(changePage())); 281 connect(m_pPageListBox, SIGNAL(selectionChanged()), this, SLOT(changePage()));
274 282
275 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); 283 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
276 QHBoxLayout* buttonLayout = new QHBoxLayout(0); 284 QHBoxLayout* buttonLayout = new QHBoxLayout(0);
277 285
278 buttonLayout->addWidget(newPageButton); 286 buttonLayout->addWidget(newPageButton);
279 buttonLayout->addWidget(clearPageButton); 287 buttonLayout->addWidget(clearPageButton);
280 buttonLayout->addWidget(deletePageButton); 288 buttonLayout->addWidget(deletePageButton);
281 buttonLayout->addStretch(); 289 buttonLayout->addStretch();
282 buttonLayout->addWidget(m_pMovePageUpButton); 290 buttonLayout->addWidget(m_pMovePageUpButton);
283 buttonLayout->addWidget(m_pMovePageDownButton); 291 buttonLayout->addWidget(m_pMovePageDownButton);
284 292
285 mainLayout->addLayout(buttonLayout); 293 mainLayout->addLayout(buttonLayout);
286 mainLayout->addWidget(m_pPageListBox); 294 mainLayout->addWidget(m_pPageListBox);
287 295
288 updateView(); 296 updateView();
289} 297}
290 298
291ThumbnailView::~ThumbnailView() 299ThumbnailView::~ThumbnailView()