-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 4 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.pro | 7 | ||||
-rw-r--r-- | noncore/graphics/drawpad/main.cpp | 12 |
4 files changed, 10 insertions, 18 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index aac6bc1..ac08e15 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -1,412 +1,413 @@ | |||
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 "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 <opie/colordialog.h> | 33 | #include <opie/colordialog.h> |
34 | #include <opie/colorpopupmenu.h> | 34 | #include <opie/colorpopupmenu.h> |
35 | 35 | ||
36 | #include <qpe/applnk.h> | 36 | #include <qpe/applnk.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #include <qpe/qpemenubar.h> | 39 | #include <qpe/qpemenubar.h> |
40 | #include <qpe/qpetoolbar.h> | 40 | #include <qpe/qpetoolbar.h> |
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | 42 | ||
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 <qpainter.h> | 46 | #include <qpainter.h> |
47 | #include <qspinbox.h> | 47 | #include <qspinbox.h> |
48 | #include <qtoolbutton.h> | 48 | #include <qtoolbutton.h> |
49 | #include <qtooltip.h> | 49 | #include <qtooltip.h> |
50 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
51 | 51 | ||
52 | DrawPad::DrawPad(QWidget* parent, const char* name) | 52 | DrawPad::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 | 56 | ||
57 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); | 57 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); |
58 | 58 | ||
59 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); | 59 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); |
60 | 60 | ||
61 | setCentralWidget(m_pDrawPadCanvas); | 61 | setCentralWidget(m_pDrawPadCanvas); |
62 | 62 | ||
63 | // init menu | 63 | // init menu |
64 | 64 | ||
65 | setToolBarsMovable(false); | 65 | setToolBarsMovable(false); |
66 | 66 | ||
67 | QPEToolBar* menuToolBar = new QPEToolBar(this); | 67 | QPEToolBar* menuToolBar = new QPEToolBar(this); |
68 | QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar); | 68 | QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar); |
69 | 69 | ||
70 | QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); | 70 | QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); |
71 | 71 | ||
72 | QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); | 72 | QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); |
73 | connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); | 73 | connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); |
74 | deleteAllAction->addTo(toolsPopupMenu); | 74 | deleteAllAction->addTo(toolsPopupMenu); |
75 | 75 | ||
76 | toolsPopupMenu->insertSeparator(); | 76 | toolsPopupMenu->insertSeparator(); |
77 | 77 | ||
78 | QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); | 78 | QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); |
79 | connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); | 79 | connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); |
80 | importPageAction->addTo(toolsPopupMenu); | 80 | importPageAction->addTo(toolsPopupMenu); |
81 | 81 | ||
82 | QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); | 82 | QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); |
83 | connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); | 83 | connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); |
84 | exportPageAction->addTo(toolsPopupMenu); | 84 | exportPageAction->addTo(toolsPopupMenu); |
85 | 85 | ||
86 | toolsPopupMenu->insertSeparator(); | 86 | toolsPopupMenu->insertSeparator(); |
87 | 87 | ||
88 | QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); | 88 | QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); |
89 | connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); | 89 | connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); |
90 | thumbnailViewAction->addTo(toolsPopupMenu); | 90 | thumbnailViewAction->addTo(toolsPopupMenu); |
91 | 91 | ||
92 | QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); | 92 | QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); |
93 | connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); | 93 | connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); |
94 | pageInformationAction->addTo(toolsPopupMenu); | 94 | pageInformationAction->addTo(toolsPopupMenu); |
95 | 95 | ||
96 | toolsPopupMenu->insertSeparator(); | 96 | toolsPopupMenu->insertSeparator(); |
97 | 97 | ||
98 | m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); | 98 | m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); |
99 | m_pAntiAliasingAction->setToggleAction(true); | 99 | m_pAntiAliasingAction->setToggleAction(true); |
100 | m_pAntiAliasingAction->addTo(toolsPopupMenu); | 100 | m_pAntiAliasingAction->addTo(toolsPopupMenu); |
101 | 101 | ||
102 | menuBar->insertItem(tr("Tools"), toolsPopupMenu); | 102 | menuBar->insertItem(tr("Tools"), toolsPopupMenu); |
103 | 103 | ||
104 | // init page toolbar | 104 | // init page toolbar |
105 | 105 | ||
106 | QPEToolBar* pageToolBar = new QPEToolBar(this); | 106 | QPEToolBar* pageToolBar = new QPEToolBar(this); |
107 | 107 | ||
108 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); | 108 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); |
109 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); | 109 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); |
110 | newPageAction->addTo(pageToolBar); | 110 | newPageAction->addTo(pageToolBar); |
111 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); | 111 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); |
112 | 112 | ||
113 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); | 113 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); |
114 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); | 114 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); |
115 | clearPageAction->addTo(pageToolBar); | 115 | clearPageAction->addTo(pageToolBar); |
116 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); | 116 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); |
117 | 117 | ||
118 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); | 118 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); |
119 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); | 119 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); |
120 | deletePageAction->addTo(pageToolBar); | 120 | deletePageAction->addTo(pageToolBar); |
121 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); | 121 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); |
122 | 122 | ||
123 | QPEToolBar* emptyToolBar = new QPEToolBar(this); | 123 | QPEToolBar* emptyToolBar = new QPEToolBar(this); |
124 | emptyToolBar->setHorizontalStretchable(true); | 124 | emptyToolBar->setHorizontalStretchable(true); |
125 | 125 | ||
126 | // init navigation toolbar | 126 | // init navigation toolbar |
127 | 127 | ||
128 | QPEToolBar* navigationToolBar = new QPEToolBar(this); | 128 | QPEToolBar* navigationToolBar = new QPEToolBar(this); |
129 | 129 | ||
130 | m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); | 130 | m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); |
131 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); | 131 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); |
132 | m_pUndoAction->addTo(navigationToolBar); | 132 | m_pUndoAction->addTo(navigationToolBar); |
133 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); | 133 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); |
134 | 134 | ||
135 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); | 135 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); |
136 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); | 136 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); |
137 | m_pRedoAction->addTo(navigationToolBar); | 137 | m_pRedoAction->addTo(navigationToolBar); |
138 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); | 138 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); |
139 | 139 | ||
140 | 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); |
141 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); | 141 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); |
142 | m_pFirstPageAction->addTo(navigationToolBar); | 142 | m_pFirstPageAction->addTo(navigationToolBar); |
143 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); | 143 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); |
144 | 144 | ||
145 | 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); |
146 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); | 146 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); |
147 | m_pPreviousPageAction->addTo(navigationToolBar); | 147 | m_pPreviousPageAction->addTo(navigationToolBar); |
148 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); | 148 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); |
149 | 149 | ||
150 | 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); |
151 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); | 151 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); |
152 | m_pNextPageAction->addTo(navigationToolBar); | 152 | m_pNextPageAction->addTo(navigationToolBar); |
153 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); | 153 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); |
154 | 154 | ||
155 | 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); |
156 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); | 156 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); |
157 | m_pLastPageAction->addTo(navigationToolBar); | 157 | m_pLastPageAction->addTo(navigationToolBar); |
158 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); | 158 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); |
159 | 159 | ||
160 | // init draw mode toolbar | 160 | // init draw mode toolbar |
161 | 161 | ||
162 | QPEToolBar* drawModeToolBar = new QPEToolBar(this); | 162 | QPEToolBar* drawModeToolBar = new QPEToolBar(this); |
163 | 163 | ||
164 | m_pLineToolButton = new QToolButton(drawModeToolBar); | 164 | m_pLineToolButton = new QToolButton(drawModeToolBar); |
165 | 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." ) ); | 166 | QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); |
167 | 167 | ||
168 | 168 | ||
169 | QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); | 169 | QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); |
170 | 170 | ||
171 | m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); | 171 | m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); |
172 | connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); | 172 | connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); |
173 | m_pPointToolAction->addTo(linePopupMenu); | 173 | m_pPointToolAction->addTo(linePopupMenu); |
174 | 174 | ||
175 | m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); | 175 | m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); |
176 | connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); | 176 | connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); |
177 | m_pLineToolAction->addTo(linePopupMenu); | 177 | m_pLineToolAction->addTo(linePopupMenu); |
178 | 178 | ||
179 | m_pLineToolButton->setPopup(linePopupMenu); | 179 | m_pLineToolButton->setPopup(linePopupMenu); |
180 | m_pLineToolButton->setPopupDelay(0); | 180 | m_pLineToolButton->setPopupDelay(0); |
181 | 181 | ||
182 | m_pRectangleToolButton = new QToolButton(drawModeToolBar); | 182 | m_pRectangleToolButton = new QToolButton(drawModeToolBar); |
183 | 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." ) ); | 184 | QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); |
185 | 185 | ||
186 | QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); | 186 | QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); |
187 | 187 | ||
188 | m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); | 188 | m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); |
189 | connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); | 189 | connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); |
190 | m_pRectangleToolAction->addTo(rectanglePopupMenu); | 190 | m_pRectangleToolAction->addTo(rectanglePopupMenu); |
191 | 191 | ||
192 | m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); | 192 | m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); |
193 | connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); | 193 | connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); |
194 | m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); | 194 | m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); |
195 | 195 | ||
196 | m_pRectangleToolButton->setPopup(rectanglePopupMenu); | 196 | m_pRectangleToolButton->setPopup(rectanglePopupMenu); |
197 | m_pRectangleToolButton->setPopupDelay(0); | 197 | m_pRectangleToolButton->setPopupDelay(0); |
198 | 198 | ||
199 | m_pEllipseToolButton = new QToolButton(drawModeToolBar); | 199 | m_pEllipseToolButton = new QToolButton(drawModeToolBar); |
200 | 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." ) ); | 201 | QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) ); |
202 | 202 | ||
203 | QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); | 203 | QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); |
204 | 204 | ||
205 | m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this); | 205 | m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this); |
206 | connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); | 206 | connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); |
207 | m_pEllipseToolAction->addTo(ellipsePopupMenu); | 207 | m_pEllipseToolAction->addTo(ellipsePopupMenu); |
208 | 208 | ||
209 | m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this); | 209 | m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this); |
210 | connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); | 210 | connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); |
211 | m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); | 211 | m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); |
212 | 212 | ||
213 | m_pEllipseToolButton->setPopup(ellipsePopupMenu); | 213 | m_pEllipseToolButton->setPopup(ellipsePopupMenu); |
214 | m_pEllipseToolButton->setPopupDelay(0); | 214 | m_pEllipseToolButton->setPopupDelay(0); |
215 | 215 | ||
216 | m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this); | 216 | m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this); |
217 | m_pTextToolAction->setToggleAction(true); | 217 | m_pTextToolAction->setToggleAction(true); |
218 | connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); | 218 | connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); |
219 | m_pTextToolAction->addTo(drawModeToolBar); | 219 | m_pTextToolAction->addTo(drawModeToolBar); |
220 | m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); | 220 | m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); |
221 | 221 | ||
222 | m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this); | 222 | m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this); |
223 | m_pFillToolAction->setToggleAction(true); | 223 | m_pFillToolAction->setToggleAction(true); |
224 | connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); | 224 | connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); |
225 | m_pFillToolAction->addTo(drawModeToolBar); | 225 | m_pFillToolAction->addTo(drawModeToolBar); |
226 | m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); | 226 | m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); |
227 | 227 | ||
228 | m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this); | 228 | m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this); |
229 | m_pEraseToolAction->setToggleAction(true); | 229 | m_pEraseToolAction->setToggleAction(true); |
230 | connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); | 230 | connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); |
231 | m_pEraseToolAction->addTo(drawModeToolBar); | 231 | m_pEraseToolAction->addTo(drawModeToolBar); |
232 | m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); | 232 | m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); |
233 | 233 | ||
234 | m_pTool = 0; | 234 | m_pTool = 0; |
235 | setRectangleTool(); | 235 | setRectangleTool(); |
236 | setEllipseTool(); | 236 | setEllipseTool(); |
237 | setPointTool(); | 237 | setPointTool(); |
238 | 238 | ||
239 | emptyToolBar = new QPEToolBar(this); | 239 | emptyToolBar = new QPEToolBar(this); |
240 | emptyToolBar->setHorizontalStretchable(true); | 240 | emptyToolBar->setHorizontalStretchable(true); |
241 | emptyToolBar->addSeparator(); | 241 | emptyToolBar->addSeparator(); |
242 | 242 | ||
243 | // init draw parameters toolbar | 243 | // init draw parameters toolbar |
244 | 244 | ||
245 | QPEToolBar* drawParametersToolBar = new QPEToolBar(this); | 245 | QPEToolBar* drawParametersToolBar = new QPEToolBar(this); |
246 | 246 | ||
247 | m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); | 247 | m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); |
248 | connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); | 248 | connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); |
249 | 249 | ||
250 | QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width")); | 250 | QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width")); |
251 | m_pPenWidthSpinBox->setValue(1); | 251 | m_pPenWidthSpinBox->setValue(1); |
252 | 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." ) ); | 253 | QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) ); |
254 | 254 | ||
255 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); | 255 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); |
256 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor")); | 256 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor")); |
257 | QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); | 257 | QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); |
258 | 258 | ||
259 | OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, m_pPenColorToolButton); | 259 | OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, m_pPenColorToolButton); |
260 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); | 260 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); |
261 | 261 | ||
262 | QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); | 262 | QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); |
263 | m_pPenColorToolButton->setPopup(penColorPopupMenu); | 263 | m_pPenColorToolButton->setPopup(penColorPopupMenu); |
264 | m_pPenColorToolButton->setPopupDelay(0); | 264 | m_pPenColorToolButton->setPopupDelay(0); |
265 | 265 | ||
266 | changePenColor(Qt::black); | 266 | changePenColor(Qt::black); |
267 | 267 | ||
268 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); | 268 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); |
269 | m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor")); | 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." ) ); | 270 | QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); |
271 | 271 | ||
272 | OColorPopupMenu* brushColorPopupMenu = new OColorPopupMenu(Qt::white, m_pBrushColorToolButton); | 272 | OColorPopupMenu* brushColorPopupMenu = new OColorPopupMenu(Qt::white, m_pBrushColorToolButton); |
273 | connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); | 273 | connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); |
274 | 274 | ||
275 | QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); | 275 | QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); |
276 | m_pBrushColorToolButton->setPopup(brushColorPopupMenu); | 276 | m_pBrushColorToolButton->setPopup(brushColorPopupMenu); |
277 | m_pBrushColorToolButton->setPopupDelay(0); | 277 | m_pBrushColorToolButton->setPopupDelay(0); |
278 | 278 | ||
279 | changeBrushColor(Qt::white); | 279 | changeBrushColor(Qt::white); |
280 | 280 | ||
281 | finishStartup(); | ||
281 | } | 282 | } |
282 | 283 | ||
283 | 284 | ||
284 | void DrawPad::finishStartup() | 285 | void DrawPad::finishStartup() |
285 | { | 286 | { |
286 | // init pages | 287 | // init pages |
287 | 288 | ||
288 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); | 289 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); |
289 | 290 | ||
290 | if (file.open(IO_ReadOnly)) { | 291 | if (file.open(IO_ReadOnly)) { |
291 | m_pDrawPadCanvas->load(&file); | 292 | m_pDrawPadCanvas->load(&file); |
292 | file.close(); | 293 | file.close(); |
293 | } else { | 294 | } else { |
294 | m_pDrawPadCanvas->initialPage(); | 295 | m_pDrawPadCanvas->initialPage(); |
295 | } | 296 | } |
296 | 297 | ||
297 | loadConfig(); | 298 | loadConfig(); |
298 | 299 | ||
299 | } | 300 | } |
300 | 301 | ||
301 | DrawPad::~DrawPad() | 302 | DrawPad::~DrawPad() |
302 | { | 303 | { |
303 | saveConfig(); | 304 | saveConfig(); |
304 | 305 | ||
305 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); | 306 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); |
306 | 307 | ||
307 | if (file.open(IO_WriteOnly)) { | 308 | if (file.open(IO_WriteOnly)) { |
308 | m_pDrawPadCanvas->save(&file); | 309 | m_pDrawPadCanvas->save(&file); |
309 | file.close(); | 310 | file.close(); |
310 | } | 311 | } |
311 | } | 312 | } |
312 | 313 | ||
313 | bool DrawPad::antiAliasing() | 314 | bool DrawPad::antiAliasing() |
314 | { | 315 | { |
315 | return (m_pAntiAliasingAction->isOn()); | 316 | return (m_pAntiAliasingAction->isOn()); |
316 | } | 317 | } |
317 | 318 | ||
318 | void DrawPad::newPage() | 319 | void DrawPad::newPage() |
319 | { | 320 | { |
320 | QRect rect = m_pDrawPadCanvas->contentsRect(); | 321 | QRect rect = m_pDrawPadCanvas->contentsRect(); |
321 | 322 | ||
322 | NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); | 323 | NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); |
323 | 324 | ||
324 | if (newPageDialog.exec() == QDialog::Accepted) { | 325 | if (newPageDialog.exec() == QDialog::Accepted) { |
325 | m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(), | 326 | m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(), |
326 | newPageDialog.selectedHeight(), newPageDialog.selectedColor()); | 327 | newPageDialog.selectedHeight(), newPageDialog.selectedColor()); |
327 | } | 328 | } |
328 | } | 329 | } |
329 | 330 | ||
330 | void DrawPad::clearPage() | 331 | void DrawPad::clearPage() |
331 | { | 332 | { |
332 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), | 333 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), |
333 | QMessageBox::Information, QMessageBox::Yes, | 334 | QMessageBox::Information, QMessageBox::Yes, |
334 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 335 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
335 | QMessageBox::NoButton, this); | 336 | QMessageBox::NoButton, this); |
336 | 337 | ||
337 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 338 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
338 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 339 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
339 | 340 | ||
340 | if (messageBox.exec() == QMessageBox::Yes) { | 341 | if (messageBox.exec() == QMessageBox::Yes) { |
341 | m_pDrawPadCanvas->clearPage(); | 342 | m_pDrawPadCanvas->clearPage(); |
342 | } | 343 | } |
343 | } | 344 | } |
344 | 345 | ||
345 | void DrawPad::deletePage() | 346 | void DrawPad::deletePage() |
346 | { | 347 | { |
347 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), | 348 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), |
348 | QMessageBox::Information, QMessageBox::Yes, | 349 | QMessageBox::Information, QMessageBox::Yes, |
349 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 350 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
350 | QMessageBox::NoButton, this); | 351 | QMessageBox::NoButton, this); |
351 | 352 | ||
352 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 353 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
353 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 354 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
354 | 355 | ||
355 | if (messageBox.exec() == QMessageBox::Yes) { | 356 | if (messageBox.exec() == QMessageBox::Yes) { |
356 | m_pDrawPadCanvas->deletePage(); | 357 | m_pDrawPadCanvas->deletePage(); |
357 | } | 358 | } |
358 | } | 359 | } |
359 | 360 | ||
360 | void DrawPad::setPointTool() | 361 | void DrawPad::setPointTool() |
361 | { | 362 | { |
362 | if (m_pTool) { | 363 | if (m_pTool) { |
363 | delete m_pTool; | 364 | delete m_pTool; |
364 | } | 365 | } |
365 | 366 | ||
366 | m_pTool = new PointTool(this, m_pDrawPadCanvas); | 367 | m_pTool = new PointTool(this, m_pDrawPadCanvas); |
367 | 368 | ||
368 | m_pLineToolButton->setIconSet(m_pPointToolAction->iconSet()); | 369 | m_pLineToolButton->setIconSet(m_pPointToolAction->iconSet()); |
369 | QToolTip::add(m_pLineToolButton, m_pPointToolAction->text()); | 370 | QToolTip::add(m_pLineToolButton, m_pPointToolAction->text()); |
370 | 371 | ||
371 | disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); | 372 | disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); |
372 | connect(m_pLineToolButton, SIGNAL(clicked()), m_pPointToolAction, SIGNAL(activated())); | 373 | connect(m_pLineToolButton, SIGNAL(clicked()), m_pPointToolAction, SIGNAL(activated())); |
373 | 374 | ||
374 | m_pLineToolButton->setOn(true); | 375 | m_pLineToolButton->setOn(true); |
375 | m_pRectangleToolButton->setOn(false); | 376 | m_pRectangleToolButton->setOn(false); |
376 | m_pEllipseToolButton->setOn(false); | 377 | m_pEllipseToolButton->setOn(false); |
377 | m_pTextToolAction->setOn(false); | 378 | m_pTextToolAction->setOn(false); |
378 | m_pFillToolAction->setOn(false); | 379 | m_pFillToolAction->setOn(false); |
379 | m_pEraseToolAction->setOn(false); | 380 | m_pEraseToolAction->setOn(false); |
380 | } | 381 | } |
381 | 382 | ||
382 | void DrawPad::setLineTool() | 383 | void DrawPad::setLineTool() |
383 | { | 384 | { |
384 | if (m_pTool) { | 385 | if (m_pTool) { |
385 | delete m_pTool; | 386 | delete m_pTool; |
386 | } | 387 | } |
387 | 388 | ||
388 | m_pTool = new LineTool(this, m_pDrawPadCanvas); | 389 | m_pTool = new LineTool(this, m_pDrawPadCanvas); |
389 | 390 | ||
390 | m_pLineToolButton->setIconSet(m_pLineToolAction->iconSet()); | 391 | m_pLineToolButton->setIconSet(m_pLineToolAction->iconSet()); |
391 | QToolTip::add(m_pLineToolButton, m_pLineToolAction->text()); | 392 | QToolTip::add(m_pLineToolButton, m_pLineToolAction->text()); |
392 | 393 | ||
393 | disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); | 394 | disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); |
394 | connect(m_pLineToolButton, SIGNAL(clicked()), m_pLineToolAction, SIGNAL(activated())); | 395 | connect(m_pLineToolButton, SIGNAL(clicked()), m_pLineToolAction, SIGNAL(activated())); |
395 | 396 | ||
396 | m_pLineToolButton->setOn(true); | 397 | m_pLineToolButton->setOn(true); |
397 | m_pRectangleToolButton->setOn(false); | 398 | m_pRectangleToolButton->setOn(false); |
398 | m_pEllipseToolButton->setOn(false); | 399 | m_pEllipseToolButton->setOn(false); |
399 | m_pTextToolAction->setOn(false); | 400 | m_pTextToolAction->setOn(false); |
400 | m_pFillToolAction->setOn(false); | 401 | m_pFillToolAction->setOn(false); |
401 | m_pEraseToolAction->setOn(false); | 402 | m_pEraseToolAction->setOn(false); |
402 | } | 403 | } |
403 | 404 | ||
404 | void DrawPad::setRectangleTool() | 405 | void DrawPad::setRectangleTool() |
405 | { | 406 | { |
406 | if (m_pTool) { | 407 | if (m_pTool) { |
407 | delete m_pTool; | 408 | delete m_pTool; |
408 | } | 409 | } |
409 | 410 | ||
410 | m_pTool = new RectangleTool(this, m_pDrawPadCanvas); | 411 | m_pTool = new RectangleTool(this, m_pDrawPadCanvas); |
411 | 412 | ||
412 | m_pRectangleToolButton->setIconSet(m_pRectangleToolAction->iconSet()); | 413 | m_pRectangleToolButton->setIconSet(m_pRectangleToolAction->iconSet()); |
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index 2cae700..48d5225 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h | |||
@@ -1,111 +1,113 @@ | |||
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 | #ifndef DRAWPAD_H | 14 | #ifndef DRAWPAD_H |
15 | #define DRAWPAD_H | 15 | #define DRAWPAD_H |
16 | 16 | ||
17 | #include <qmainwindow.h> | 17 | #include <qmainwindow.h> |
18 | 18 | ||
19 | #include <qpen.h> | 19 | #include <qpen.h> |
20 | 20 | ||
21 | class DrawPadCanvas; | 21 | class DrawPadCanvas; |
22 | class Tool; | 22 | class Tool; |
23 | 23 | ||
24 | class QAction; | 24 | class QAction; |
25 | class QColor; | 25 | class QColor; |
26 | class QSpinBox; | 26 | class QSpinBox; |
27 | class QToolButton; | 27 | class QToolButton; |
28 | class QWidgetStack; | 28 | class QWidgetStack; |
29 | 29 | ||
30 | class DrawPad : public QMainWindow | 30 | class DrawPad : public QMainWindow |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | 33 | ||
34 | public: | 34 | public: |
35 | DrawPad(QWidget* parent = 0, const char* name = 0); | 35 | DrawPad(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
36 | ~DrawPad(); | 36 | ~DrawPad(); |
37 | 37 | ||
38 | static QString appName() { return QString::fromLatin1("drawpad"); } | ||
39 | |||
38 | Tool* tool() { return m_pTool; } | 40 | Tool* tool() { return m_pTool; } |
39 | QPen pen() { return m_pen; } | 41 | QPen pen() { return m_pen; } |
40 | QBrush brush() { return m_brush; } | 42 | QBrush brush() { return m_brush; } |
41 | 43 | ||
42 | bool antiAliasing(); | 44 | bool antiAliasing(); |
43 | void finishStartup(); | 45 | void finishStartup(); |
44 | 46 | ||
45 | private slots: | 47 | private slots: |
46 | void newPage(); | 48 | void newPage(); |
47 | void clearPage(); | 49 | void clearPage(); |
48 | void deletePage(); | 50 | void deletePage(); |
49 | 51 | ||
50 | void setPointTool(); | 52 | void setPointTool(); |
51 | void setLineTool(); | 53 | void setLineTool(); |
52 | void setRectangleTool(); | 54 | void setRectangleTool(); |
53 | void setFilledRectangleTool(); | 55 | void setFilledRectangleTool(); |
54 | void setEllipseTool(); | 56 | void setEllipseTool(); |
55 | void setFilledEllipseTool(); | 57 | void setFilledEllipseTool(); |
56 | void setTextTool(); | 58 | void setTextTool(); |
57 | void setFillTool(); | 59 | void setFillTool(); |
58 | void setEraseTool(); | 60 | void setEraseTool(); |
59 | 61 | ||
60 | void changePenWidth(int value); | 62 | void changePenWidth(int value); |
61 | void changePenColor(const QColor& color); | 63 | void changePenColor(const QColor& color); |
62 | void changeBrushColor(const QColor& color); | 64 | void changeBrushColor(const QColor& color); |
63 | 65 | ||
64 | void updateView(); | 66 | void updateView(); |
65 | 67 | ||
66 | void deleteAll(); | 68 | void deleteAll(); |
67 | void importPage(); | 69 | void importPage(); |
68 | void exportPage(); | 70 | void exportPage(); |
69 | void thumbnailView(); | 71 | void thumbnailView(); |
70 | void pageInformation(); | 72 | void pageInformation(); |
71 | 73 | ||
72 | private: | 74 | private: |
73 | void loadConfig(); | 75 | void loadConfig(); |
74 | void saveConfig(); | 76 | void saveConfig(); |
75 | 77 | ||
76 | DrawPadCanvas* m_pDrawPadCanvas; | 78 | DrawPadCanvas* m_pDrawPadCanvas; |
77 | 79 | ||
78 | Tool* m_pTool; | 80 | Tool* m_pTool; |
79 | QPen m_pen; | 81 | QPen m_pen; |
80 | QBrush m_brush; | 82 | QBrush m_brush; |
81 | 83 | ||
82 | QAction* m_pAntiAliasingAction; | 84 | QAction* m_pAntiAliasingAction; |
83 | 85 | ||
84 | QAction* m_pUndoAction; | 86 | QAction* m_pUndoAction; |
85 | QAction* m_pRedoAction; | 87 | QAction* m_pRedoAction; |
86 | 88 | ||
87 | QAction* m_pFirstPageAction; | 89 | QAction* m_pFirstPageAction; |
88 | QAction* m_pPreviousPageAction; | 90 | QAction* m_pPreviousPageAction; |
89 | QAction* m_pNextPageAction; | 91 | QAction* m_pNextPageAction; |
90 | QAction* m_pLastPageAction; | 92 | QAction* m_pLastPageAction; |
91 | 93 | ||
92 | QAction* m_pPointToolAction; | 94 | QAction* m_pPointToolAction; |
93 | QAction* m_pLineToolAction; | 95 | QAction* m_pLineToolAction; |
94 | QAction* m_pRectangleToolAction; | 96 | QAction* m_pRectangleToolAction; |
95 | QAction* m_pFilledRectangleToolAction; | 97 | QAction* m_pFilledRectangleToolAction; |
96 | QAction* m_pEllipseToolAction; | 98 | QAction* m_pEllipseToolAction; |
97 | QAction* m_pFilledEllipseToolAction; | 99 | QAction* m_pFilledEllipseToolAction; |
98 | QAction* m_pTextToolAction; | 100 | QAction* m_pTextToolAction; |
99 | QAction* m_pFillToolAction; | 101 | QAction* m_pFillToolAction; |
100 | QAction* m_pEraseToolAction; | 102 | QAction* m_pEraseToolAction; |
101 | 103 | ||
102 | QToolButton* m_pLineToolButton; | 104 | QToolButton* m_pLineToolButton; |
103 | QToolButton* m_pRectangleToolButton; | 105 | QToolButton* m_pRectangleToolButton; |
104 | QToolButton* m_pEllipseToolButton; | 106 | QToolButton* m_pEllipseToolButton; |
105 | QToolButton* m_pPenColorToolButton; | 107 | QToolButton* m_pPenColorToolButton; |
106 | QToolButton* m_pBrushColorToolButton; | 108 | QToolButton* m_pBrushColorToolButton; |
107 | 109 | ||
108 | QSpinBox* m_pPenWidthSpinBox; | 110 | QSpinBox* m_pPenWidthSpinBox; |
109 | }; | 111 | }; |
110 | 112 | ||
111 | #endif // DRAWPAD_H | 113 | #endif // DRAWPAD_H |
diff --git a/noncore/graphics/drawpad/drawpad.pro b/noncore/graphics/drawpad/drawpad.pro index bfe6ac4..03cf7aa 100644 --- a/noncore/graphics/drawpad/drawpad.pro +++ b/noncore/graphics/drawpad/drawpad.pro | |||
@@ -1,69 +1,66 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = drawpad.h \ | 2 | HEADERS = drawpad.h \ |
4 | drawpadcanvas.h \ | 3 | drawpadcanvas.h \ |
5 | ellipsetool.h \ | 4 | ellipsetool.h \ |
6 | erasetool.h \ | 5 | erasetool.h \ |
7 | exportdialog.h \ | 6 | exportdialog.h \ |
8 | filltool.h \ | 7 | filltool.h \ |
9 | filledellipsetool.h \ | 8 | filledellipsetool.h \ |
10 | filledrectangletool.h \ | 9 | filledrectangletool.h \ |
11 | importdialog.h \ | 10 | importdialog.h \ |
12 | linetool.h \ | 11 | linetool.h \ |
13 | newpagedialog.h \ | 12 | newpagedialog.h \ |
14 | page.h \ | 13 | page.h \ |
15 | pageinformationdialog.h \ | 14 | pageinformationdialog.h \ |
16 | pointtool.h \ | 15 | pointtool.h \ |
17 | rectangletool.h \ | 16 | rectangletool.h \ |
18 | shapetool.h \ | 17 | shapetool.h \ |
19 | texttool.h \ | 18 | texttool.h \ |
20 | thumbnailview.h \ | 19 | thumbnailview.h \ |
21 | tool.h | 20 | tool.h |
22 | SOURCES = drawpad.cpp \ | 21 | SOURCES = drawpad.cpp \ |
23 | drawpadcanvas.cpp \ | 22 | drawpadcanvas.cpp \ |
24 | ellipsetool.cpp \ | 23 | ellipsetool.cpp \ |
25 | erasetool.cpp \ | 24 | erasetool.cpp \ |
26 | exportdialog.cpp \ | 25 | exportdialog.cpp \ |
27 | filltool.cpp \ | 26 | filltool.cpp \ |
28 | filledellipsetool.cpp \ | 27 | filledellipsetool.cpp \ |
29 | filledrectangletool.cpp \ | 28 | filledrectangletool.cpp \ |
30 | importdialog.cpp \ | 29 | importdialog.cpp \ |
31 | linetool.cpp \ | 30 | linetool.cpp \ |
32 | main.cpp \ | 31 | main.cpp \ |
33 | newpagedialog.cpp \ | 32 | newpagedialog.cpp \ |
34 | page.cpp \ | 33 | page.cpp \ |
35 | pageinformationdialog.cpp \ | 34 | pageinformationdialog.cpp \ |
36 | pointtool.cpp \ | 35 | pointtool.cpp \ |
37 | rectangletool.cpp \ | 36 | rectangletool.cpp \ |
38 | shapetool.cpp \ | 37 | shapetool.cpp \ |
39 | texttool.cpp \ | 38 | texttool.cpp \ |
40 | thumbnailview.cpp \ | 39 | thumbnailview.cpp \ |
41 | tool.cpp | 40 | tool.cpp |
42 | INCLUDEPATH+= $(OPIEDIR)/include | 41 | INCLUDEPATH+= $(OPIEDIR)/include |
43 | DEPENDPATH+= $(OPIEDIR)/include | 42 | DEPENDPATH+= $(OPIEDIR)/include |
44 | LIBS += -lqpe -lopie | 43 | LIBS += -lqpe -lopie |
45 | DESTDIR = $(OPIEDIR)/bin | 44 | |
46 | TARGET = drawpad | 45 | TARGET = drawpad |
47 | 46 | ||
48 | TRANSLATIONS = ../../../i18n/de/drawpad.ts \ | 47 | TRANSLATIONS = ../../../i18n/de/drawpad.ts \ |
49 | ../../../i18n/nl/drawpad.ts \ | 48 | ../../../i18n/nl/drawpad.ts \ |
50 | ../../../i18n/da/drawpad.ts \ | 49 | ../../../i18n/da/drawpad.ts \ |
51 | ../../../i18n/xx/drawpad.ts \ | 50 | ../../../i18n/xx/drawpad.ts \ |
52 | ../../../i18n/en/drawpad.ts \ | 51 | ../../../i18n/en/drawpad.ts \ |
53 | ../../../i18n/es/drawpad.ts \ | 52 | ../../../i18n/es/drawpad.ts \ |
54 | ../../../i18n/fr/drawpad.ts \ | 53 | ../../../i18n/fr/drawpad.ts \ |
55 | ../../../i18n/hu/drawpad.ts \ | 54 | ../../../i18n/hu/drawpad.ts \ |
56 | ../../../i18n/ja/drawpad.ts \ | 55 | ../../../i18n/ja/drawpad.ts \ |
57 | ../../../i18n/ko/drawpad.ts \ | 56 | ../../../i18n/ko/drawpad.ts \ |
58 | ../../../i18n/no/drawpad.ts \ | 57 | ../../../i18n/no/drawpad.ts \ |
59 | ../../../i18n/pl/drawpad.ts \ | 58 | ../../../i18n/pl/drawpad.ts \ |
60 | ../../../i18n/pt/drawpad.ts \ | 59 | ../../../i18n/pt/drawpad.ts \ |
61 | ../../../i18n/pt_BR/drawpad.ts \ | 60 | ../../../i18n/pt_BR/drawpad.ts \ |
62 | ../../../i18n/sl/drawpad.ts \ | 61 | ../../../i18n/sl/drawpad.ts \ |
63 | ../../../i18n/zh_CN/drawpad.ts \ | 62 | ../../../i18n/zh_CN/drawpad.ts \ |
64 | ../../../i18n/it/drawpad.ts \ | 63 | ../../../i18n/it/drawpad.ts \ |
65 | ../../../i18n/zh_TW/drawpad.ts | 64 | ../../../i18n/zh_TW/drawpad.ts |
66 | 65 | ||
67 | |||
68 | |||
69 | include ( $(OPIEDIR)/include.pro ) | 66 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp index 12f8084..87bc621 100644 --- a/noncore/graphics/drawpad/main.cpp +++ b/noncore/graphics/drawpad/main.cpp | |||
@@ -1,27 +1,19 @@ | |||
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 "drawpad.h" | 14 | #include "drawpad.h" |
15 | 15 | ||
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | #include <opie/oapplicationfactory.h> | ||
17 | 18 | ||
18 | int main(int argc, char **argv) | 19 | OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) |
19 | { | ||
20 | QPEApplication a(argc, argv); | ||
21 | |||
22 | DrawPad mw; // = new DrawPad();; | ||
23 | a.showMainWidget(&mw ); | ||
24 | mw.finishStartup(); | ||
25 | |||
26 | return a.exec(); | ||
27 | } | ||