author | drw <drw> | 2004-03-02 21:03:59 (UTC) |
---|---|---|
committer | drw <drw> | 2004-03-02 21:03:59 (UTC) |
commit | 0a67659dce57ac1475841838369e924f2441e991 (patch) (unidiff) | |
tree | 394d6b89ba3262033e481020953196123399492a | |
parent | 9631067183b4cafa2ea07d2202bf88f4d42c35e2 (diff) | |
download | opie-0a67659dce57ac1475841838369e924f2441e991.zip opie-0a67659dce57ac1475841838369e924f2441e991.tar.gz opie-0a67659dce57ac1475841838369e924f2441e991.tar.bz2 |
DrawPad: libopie -> libopie2
-rw-r--r-- | noncore/graphics/drawpad/config.in | 2 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 10 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 3 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.pro | 2 | ||||
-rw-r--r-- | noncore/graphics/drawpad/exportdialog.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/drawpad/importdialog.cpp | 8 | ||||
-rw-r--r-- | noncore/graphics/drawpad/importdialog.h | 7 | ||||
-rw-r--r-- | noncore/graphics/drawpad/main.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/drawpad/opie-drawpad.control | 2 |
9 files changed, 21 insertions, 21 deletions
diff --git a/noncore/graphics/drawpad/config.in b/noncore/graphics/drawpad/config.in index 290a642..3ed03a4 100644 --- a/noncore/graphics/drawpad/config.in +++ b/noncore/graphics/drawpad/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config DRAWPAD | 1 | config DRAWPAD |
2 | boolean "opie-drawpad (take simple notes or draw images)" | 2 | boolean "opie-drawpad (take simple notes or draw images)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBQTAUX |
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 9f0e27f..55b23cc 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -1,663 +1,663 @@ | |||
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 <opie2/qcolordialog.h> |
34 | #include <opie/colorpopupmenu.h> | 34 | #include <opie2/ocolorpopupmenu.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/qpetoolbar.h> | 38 | #include <qpe/qpetoolbar.h> |
39 | #include <qpe/resource.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 | ||
51 | DrawPad::DrawPad(QWidget* parent, const char* name, WFlags fl ) | 51 | DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) |
52 | : QMainWindow(parent, name, WStyle_ContextHelp) | 52 | : QMainWindow(parent, name, WStyle_ContextHelp) |
53 | { | 53 | { |
54 | // init members | 54 | // init members |
55 | 55 | ||
56 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); | 56 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); |
57 | 57 | ||
58 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); | 58 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); |
59 | 59 | ||
60 | setCentralWidget(m_pDrawPadCanvas); | 60 | setCentralWidget(m_pDrawPadCanvas); |
61 | 61 | ||
62 | // init menu | 62 | // init menu |
63 | 63 | ||
64 | setToolBarsMovable(false); | 64 | setToolBarsMovable(false); |
65 | 65 | ||
66 | QToolBar* menuToolBar = new QToolBar(this); | 66 | QToolBar* menuToolBar = new QToolBar(this); |
67 | QMenuBar* menuBar = new QMenuBar(menuToolBar); | 67 | QMenuBar* menuBar = new QMenuBar(menuToolBar); |
68 | 68 | ||
69 | QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); | 69 | QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); |
70 | 70 | ||
71 | QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); | 71 | QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); |
72 | connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); | 72 | connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); |
73 | deleteAllAction->addTo(toolsPopupMenu); | 73 | deleteAllAction->addTo(toolsPopupMenu); |
74 | 74 | ||
75 | toolsPopupMenu->insertSeparator(); | 75 | toolsPopupMenu->insertSeparator(); |
76 | 76 | ||
77 | QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); | 77 | QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); |
78 | connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); | 78 | connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); |
79 | importPageAction->addTo(toolsPopupMenu); | 79 | importPageAction->addTo(toolsPopupMenu); |
80 | 80 | ||
81 | QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); | 81 | QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); |
82 | connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); | 82 | connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); |
83 | exportPageAction->addTo(toolsPopupMenu); | 83 | exportPageAction->addTo(toolsPopupMenu); |
84 | 84 | ||
85 | toolsPopupMenu->insertSeparator(); | 85 | toolsPopupMenu->insertSeparator(); |
86 | 86 | ||
87 | QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); | 87 | QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); |
88 | connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); | 88 | connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); |
89 | thumbnailViewAction->addTo(toolsPopupMenu); | 89 | thumbnailViewAction->addTo(toolsPopupMenu); |
90 | 90 | ||
91 | QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); | 91 | QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); |
92 | connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); | 92 | connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); |
93 | pageInformationAction->addTo(toolsPopupMenu); | 93 | pageInformationAction->addTo(toolsPopupMenu); |
94 | 94 | ||
95 | toolsPopupMenu->insertSeparator(); | 95 | toolsPopupMenu->insertSeparator(); |
96 | 96 | ||
97 | m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); | 97 | m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); |
98 | m_pAntiAliasingAction->setToggleAction(true); | 98 | m_pAntiAliasingAction->setToggleAction(true); |
99 | m_pAntiAliasingAction->addTo(toolsPopupMenu); | 99 | m_pAntiAliasingAction->addTo(toolsPopupMenu); |
100 | 100 | ||
101 | menuBar->insertItem(tr("Tools"), toolsPopupMenu); | 101 | menuBar->insertItem(tr("Tools"), toolsPopupMenu); |
102 | 102 | ||
103 | // init page toolbar | 103 | // init page toolbar |
104 | 104 | ||
105 | QToolBar* pageToolBar = new QToolBar(this); | 105 | QToolBar* pageToolBar = new QToolBar(this); |
106 | 106 | ||
107 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); | 107 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); |
108 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); | 108 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); |
109 | newPageAction->addTo(pageToolBar); | 109 | newPageAction->addTo(pageToolBar); |
110 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); | 110 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); |
111 | 111 | ||
112 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); | 112 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); |
113 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); | 113 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); |
114 | clearPageAction->addTo(pageToolBar); | 114 | clearPageAction->addTo(pageToolBar); |
115 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); | 115 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); |
116 | 116 | ||
117 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); | 117 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); |
118 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); | 118 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); |
119 | deletePageAction->addTo(pageToolBar); | 119 | deletePageAction->addTo(pageToolBar); |
120 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); | 120 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); |
121 | 121 | ||
122 | QToolBar* emptyToolBar = new QToolBar(this); | 122 | QToolBar* emptyToolBar = new QToolBar(this); |
123 | emptyToolBar->setHorizontalStretchable(true); | 123 | emptyToolBar->setHorizontalStretchable(true); |
124 | 124 | ||
125 | // init navigation toolbar | 125 | // init navigation toolbar |
126 | 126 | ||
127 | QToolBar* navigationToolBar = new QToolBar(this); | 127 | QToolBar* navigationToolBar = new QToolBar(this); |
128 | 128 | ||
129 | m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); | 129 | m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); |
130 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); | 130 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); |
131 | m_pUndoAction->addTo(navigationToolBar); | 131 | m_pUndoAction->addTo(navigationToolBar); |
132 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); | 132 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); |
133 | 133 | ||
134 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); | 134 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); |
135 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); | 135 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); |
136 | m_pRedoAction->addTo(navigationToolBar); | 136 | m_pRedoAction->addTo(navigationToolBar); |
137 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); | 137 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); |
138 | 138 | ||
139 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); | 139 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); |
140 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); | 140 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); |
141 | m_pFirstPageAction->addTo(navigationToolBar); | 141 | m_pFirstPageAction->addTo(navigationToolBar); |
142 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); | 142 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); |
143 | 143 | ||
144 | m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); | 144 | m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); |
145 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); | 145 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); |
146 | m_pPreviousPageAction->addTo(navigationToolBar); | 146 | m_pPreviousPageAction->addTo(navigationToolBar); |
147 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); | 147 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); |
148 | 148 | ||
149 | m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); | 149 | m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); |
150 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); | 150 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); |
151 | m_pNextPageAction->addTo(navigationToolBar); | 151 | m_pNextPageAction->addTo(navigationToolBar); |
152 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); | 152 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); |
153 | 153 | ||
154 | m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); | 154 | m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); |
155 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); | 155 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); |
156 | m_pLastPageAction->addTo(navigationToolBar); | 156 | m_pLastPageAction->addTo(navigationToolBar); |
157 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); | 157 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); |
158 | 158 | ||
159 | // init draw mode toolbar | 159 | // init draw mode toolbar |
160 | 160 | ||
161 | QToolBar* drawModeToolBar = new QToolBar(this); | 161 | QToolBar* drawModeToolBar = new QToolBar(this); |
162 | 162 | ||
163 | m_pLineToolButton = new QToolButton(drawModeToolBar); | 163 | m_pLineToolButton = new QToolButton(drawModeToolBar); |
164 | m_pLineToolButton->setToggleButton(true); | 164 | m_pLineToolButton->setToggleButton(true); |
165 | QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); | 165 | QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); |
166 | 166 | ||
167 | 167 | ||
168 | QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); | 168 | QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); |
169 | 169 | ||
170 | m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); | 170 | m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); |
171 | connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); | 171 | connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); |
172 | m_pPointToolAction->addTo(linePopupMenu); | 172 | m_pPointToolAction->addTo(linePopupMenu); |
173 | 173 | ||
174 | m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); | 174 | m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); |
175 | connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); | 175 | connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); |
176 | m_pLineToolAction->addTo(linePopupMenu); | 176 | m_pLineToolAction->addTo(linePopupMenu); |
177 | 177 | ||
178 | m_pLineToolButton->setPopup(linePopupMenu); | 178 | m_pLineToolButton->setPopup(linePopupMenu); |
179 | m_pLineToolButton->setPopupDelay(0); | 179 | m_pLineToolButton->setPopupDelay(0); |
180 | 180 | ||
181 | m_pRectangleToolButton = new QToolButton(drawModeToolBar); | 181 | m_pRectangleToolButton = new QToolButton(drawModeToolBar); |
182 | m_pRectangleToolButton->setToggleButton(true); | 182 | m_pRectangleToolButton->setToggleButton(true); |
183 | QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); | 183 | QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); |
184 | 184 | ||
185 | QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); | 185 | QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); |
186 | 186 | ||
187 | m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); | 187 | m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); |
188 | connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); | 188 | connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); |
189 | m_pRectangleToolAction->addTo(rectanglePopupMenu); | 189 | m_pRectangleToolAction->addTo(rectanglePopupMenu); |
190 | 190 | ||
191 | m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); | 191 | m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); |
192 | connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); | 192 | connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); |
193 | m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); | 193 | m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); |
194 | 194 | ||
195 | m_pRectangleToolButton->setPopup(rectanglePopupMenu); | 195 | m_pRectangleToolButton->setPopup(rectanglePopupMenu); |
196 | m_pRectangleToolButton->setPopupDelay(0); | 196 | m_pRectangleToolButton->setPopupDelay(0); |
197 | 197 | ||
198 | m_pEllipseToolButton = new QToolButton(drawModeToolBar); | 198 | m_pEllipseToolButton = new QToolButton(drawModeToolBar); |
199 | m_pEllipseToolButton->setToggleButton(true); | 199 | m_pEllipseToolButton->setToggleButton(true); |
200 | QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) ); | 200 | QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) ); |
201 | 201 | ||
202 | QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); | 202 | QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); |
203 | 203 | ||
204 | m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this); | 204 | m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this); |
205 | connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); | 205 | connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); |
206 | m_pEllipseToolAction->addTo(ellipsePopupMenu); | 206 | m_pEllipseToolAction->addTo(ellipsePopupMenu); |
207 | 207 | ||
208 | m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this); | 208 | m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this); |
209 | connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); | 209 | connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); |
210 | m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); | 210 | m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); |
211 | 211 | ||
212 | m_pEllipseToolButton->setPopup(ellipsePopupMenu); | 212 | m_pEllipseToolButton->setPopup(ellipsePopupMenu); |
213 | m_pEllipseToolButton->setPopupDelay(0); | 213 | m_pEllipseToolButton->setPopupDelay(0); |
214 | 214 | ||
215 | m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this); | 215 | m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this); |
216 | m_pTextToolAction->setToggleAction(true); | 216 | m_pTextToolAction->setToggleAction(true); |
217 | connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); | 217 | connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); |
218 | m_pTextToolAction->addTo(drawModeToolBar); | 218 | m_pTextToolAction->addTo(drawModeToolBar); |
219 | m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); | 219 | m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); |
220 | 220 | ||
221 | m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this); | 221 | m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this); |
222 | m_pFillToolAction->setToggleAction(true); | 222 | m_pFillToolAction->setToggleAction(true); |
223 | connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); | 223 | connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); |
224 | m_pFillToolAction->addTo(drawModeToolBar); | 224 | m_pFillToolAction->addTo(drawModeToolBar); |
225 | m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); | 225 | m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); |
226 | 226 | ||
227 | m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this); | 227 | m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this); |
228 | m_pEraseToolAction->setToggleAction(true); | 228 | m_pEraseToolAction->setToggleAction(true); |
229 | connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); | 229 | connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); |
230 | m_pEraseToolAction->addTo(drawModeToolBar); | 230 | m_pEraseToolAction->addTo(drawModeToolBar); |
231 | m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); | 231 | m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); |
232 | 232 | ||
233 | m_pTool = 0; | 233 | m_pTool = 0; |
234 | setRectangleTool(); | 234 | setRectangleTool(); |
235 | setEllipseTool(); | 235 | setEllipseTool(); |
236 | setPointTool(); | 236 | setPointTool(); |
237 | 237 | ||
238 | emptyToolBar = new QToolBar(this); | 238 | emptyToolBar = new QToolBar(this); |
239 | emptyToolBar->setHorizontalStretchable(true); | 239 | emptyToolBar->setHorizontalStretchable(true); |
240 | emptyToolBar->addSeparator(); | 240 | emptyToolBar->addSeparator(); |
241 | 241 | ||
242 | // init draw parameters toolbar | 242 | // init draw parameters toolbar |
243 | 243 | ||
244 | QToolBar* drawParametersToolBar = new QToolBar(this); | 244 | QToolBar* drawParametersToolBar = new QToolBar(this); |
245 | 245 | ||
246 | m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); | 246 | m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); |
247 | connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); | 247 | connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); |
248 | 248 | ||
249 | QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width")); | 249 | QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width")); |
250 | m_pPenWidthSpinBox->setValue(1); | 250 | m_pPenWidthSpinBox->setValue(1); |
251 | m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus); | 251 | m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus); |
252 | QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) ); | 252 | QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) ); |
253 | 253 | ||
254 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); | 254 | m_pPenColorToolButton = new QToolButton(drawParametersToolBar); |
255 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor")); | 255 | m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor")); |
256 | QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); | 256 | QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); |
257 | 257 | ||
258 | OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, m_pPenColorToolButton); | 258 | Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton); |
259 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); | 259 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); |
260 | 260 | ||
261 | QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); | 261 | QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); |
262 | m_pPenColorToolButton->setPopup(penColorPopupMenu); | 262 | m_pPenColorToolButton->setPopup(penColorPopupMenu); |
263 | m_pPenColorToolButton->setPopupDelay(0); | 263 | m_pPenColorToolButton->setPopupDelay(0); |
264 | 264 | ||
265 | changePenColor(Qt::black); | 265 | changePenColor(Qt::black); |
266 | 266 | ||
267 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); | 267 | m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); |
268 | m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor")); | 268 | m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor")); |
269 | QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); | 269 | QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); |
270 | 270 | ||
271 | OColorPopupMenu* brushColorPopupMenu = new OColorPopupMenu(Qt::white, m_pBrushColorToolButton); | 271 | Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton); |
272 | connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); | 272 | connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); |
273 | 273 | ||
274 | QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); | 274 | QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); |
275 | m_pBrushColorToolButton->setPopup(brushColorPopupMenu); | 275 | m_pBrushColorToolButton->setPopup(brushColorPopupMenu); |
276 | m_pBrushColorToolButton->setPopupDelay(0); | 276 | m_pBrushColorToolButton->setPopupDelay(0); |
277 | 277 | ||
278 | changeBrushColor(Qt::white); | 278 | changeBrushColor(Qt::white); |
279 | 279 | ||
280 | finishStartup(); | 280 | finishStartup(); |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void DrawPad::finishStartup() | 284 | void DrawPad::finishStartup() |
285 | { | 285 | { |
286 | // init pages | 286 | // init pages |
287 | 287 | ||
288 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); | 288 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); |
289 | 289 | ||
290 | if (file.open(IO_ReadOnly)) { | 290 | if (file.open(IO_ReadOnly)) { |
291 | m_pDrawPadCanvas->load(&file); | 291 | m_pDrawPadCanvas->load(&file); |
292 | file.close(); | 292 | file.close(); |
293 | } else { | 293 | } else { |
294 | m_pDrawPadCanvas->initialPage(); | 294 | m_pDrawPadCanvas->initialPage(); |
295 | } | 295 | } |
296 | 296 | ||
297 | loadConfig(); | 297 | loadConfig(); |
298 | 298 | ||
299 | } | 299 | } |
300 | 300 | ||
301 | DrawPad::~DrawPad() | 301 | DrawPad::~DrawPad() |
302 | { | 302 | { |
303 | saveConfig(); | 303 | saveConfig(); |
304 | 304 | ||
305 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); | 305 | QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); |
306 | 306 | ||
307 | if (file.open(IO_WriteOnly)) { | 307 | if (file.open(IO_WriteOnly)) { |
308 | m_pDrawPadCanvas->save(&file); | 308 | m_pDrawPadCanvas->save(&file); |
309 | file.close(); | 309 | file.close(); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
313 | bool DrawPad::antiAliasing() | 313 | bool DrawPad::antiAliasing() |
314 | { | 314 | { |
315 | return (m_pAntiAliasingAction->isOn()); | 315 | return (m_pAntiAliasingAction->isOn()); |
316 | } | 316 | } |
317 | 317 | ||
318 | void DrawPad::newPage() | 318 | void DrawPad::newPage() |
319 | { | 319 | { |
320 | QRect rect = m_pDrawPadCanvas->contentsRect(); | 320 | QRect rect = m_pDrawPadCanvas->contentsRect(); |
321 | 321 | ||
322 | NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); | 322 | NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); |
323 | 323 | ||
324 | if (newPageDialog.exec() == QDialog::Accepted) { | 324 | if (newPageDialog.exec() == QDialog::Accepted) { |
325 | m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(), | 325 | m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(), |
326 | newPageDialog.selectedHeight(), newPageDialog.selectedColor()); | 326 | newPageDialog.selectedHeight(), newPageDialog.selectedColor()); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | void DrawPad::clearPage() | 330 | void DrawPad::clearPage() |
331 | { | 331 | { |
332 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), | 332 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), |
333 | QMessageBox::Information, QMessageBox::Yes, | 333 | QMessageBox::Information, QMessageBox::Yes, |
334 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 334 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
335 | QMessageBox::NoButton, this); | 335 | QMessageBox::NoButton, this); |
336 | 336 | ||
337 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 337 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
338 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 338 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
339 | 339 | ||
340 | if (messageBox.exec() == QMessageBox::Yes) { | 340 | if (messageBox.exec() == QMessageBox::Yes) { |
341 | m_pDrawPadCanvas->clearPage(); | 341 | m_pDrawPadCanvas->clearPage(); |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | void DrawPad::deletePage() | 345 | void DrawPad::deletePage() |
346 | { | 346 | { |
347 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), | 347 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), |
348 | QMessageBox::Information, QMessageBox::Yes, | 348 | QMessageBox::Information, QMessageBox::Yes, |
349 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 349 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
350 | QMessageBox::NoButton, this); | 350 | QMessageBox::NoButton, this); |
351 | 351 | ||
352 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 352 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
353 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 353 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
354 | 354 | ||
355 | if (messageBox.exec() == QMessageBox::Yes) { | 355 | if (messageBox.exec() == QMessageBox::Yes) { |
356 | m_pDrawPadCanvas->deletePage(); | 356 | m_pDrawPadCanvas->deletePage(); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | void DrawPad::setPointTool() | 360 | void DrawPad::setPointTool() |
361 | { | 361 | { |
362 | if (m_pTool) { | 362 | if (m_pTool) { |
363 | delete m_pTool; | 363 | delete m_pTool; |
364 | } | 364 | } |
365 | 365 | ||
366 | m_pTool = new PointTool(this, m_pDrawPadCanvas); | 366 | m_pTool = new PointTool(this, m_pDrawPadCanvas); |
367 | 367 | ||
368 | m_pLineToolButton->setIconSet(m_pPointToolAction->iconSet()); | 368 | m_pLineToolButton->setIconSet(m_pPointToolAction->iconSet()); |
369 | QToolTip::add(m_pLineToolButton, m_pPointToolAction->text()); | 369 | QToolTip::add(m_pLineToolButton, m_pPointToolAction->text()); |
370 | 370 | ||
371 | disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); | 371 | disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); |
372 | connect(m_pLineToolButton, SIGNAL(clicked()), m_pPointToolAction, SIGNAL(activated())); | 372 | connect(m_pLineToolButton, SIGNAL(clicked()), m_pPointToolAction, SIGNAL(activated())); |
373 | 373 | ||
374 | m_pLineToolButton->setOn(true); | 374 | m_pLineToolButton->setOn(true); |
375 | m_pRectangleToolButton->setOn(false); | 375 | m_pRectangleToolButton->setOn(false); |
376 | m_pEllipseToolButton->setOn(false); | 376 | m_pEllipseToolButton->setOn(false); |
377 | m_pTextToolAction->setOn(false); | 377 | m_pTextToolAction->setOn(false); |
378 | m_pFillToolAction->setOn(false); | 378 | m_pFillToolAction->setOn(false); |
379 | m_pEraseToolAction->setOn(false); | 379 | m_pEraseToolAction->setOn(false); |
380 | } | 380 | } |
381 | 381 | ||
382 | void DrawPad::setLineTool() | 382 | void DrawPad::setLineTool() |
383 | { | 383 | { |
384 | if (m_pTool) { | 384 | if (m_pTool) { |
385 | delete m_pTool; | 385 | delete m_pTool; |
386 | } | 386 | } |
387 | 387 | ||
388 | m_pTool = new LineTool(this, m_pDrawPadCanvas); | 388 | m_pTool = new LineTool(this, m_pDrawPadCanvas); |
389 | 389 | ||
390 | m_pLineToolButton->setIconSet(m_pLineToolAction->iconSet()); | 390 | m_pLineToolButton->setIconSet(m_pLineToolAction->iconSet()); |
391 | QToolTip::add(m_pLineToolButton, m_pLineToolAction->text()); | 391 | QToolTip::add(m_pLineToolButton, m_pLineToolAction->text()); |
392 | 392 | ||
393 | disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); | 393 | disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); |
394 | connect(m_pLineToolButton, SIGNAL(clicked()), m_pLineToolAction, SIGNAL(activated())); | 394 | connect(m_pLineToolButton, SIGNAL(clicked()), m_pLineToolAction, SIGNAL(activated())); |
395 | 395 | ||
396 | m_pLineToolButton->setOn(true); | 396 | m_pLineToolButton->setOn(true); |
397 | m_pRectangleToolButton->setOn(false); | 397 | m_pRectangleToolButton->setOn(false); |
398 | m_pEllipseToolButton->setOn(false); | 398 | m_pEllipseToolButton->setOn(false); |
399 | m_pTextToolAction->setOn(false); | 399 | m_pTextToolAction->setOn(false); |
400 | m_pFillToolAction->setOn(false); | 400 | m_pFillToolAction->setOn(false); |
401 | m_pEraseToolAction->setOn(false); | 401 | m_pEraseToolAction->setOn(false); |
402 | } | 402 | } |
403 | 403 | ||
404 | void DrawPad::setRectangleTool() | 404 | void DrawPad::setRectangleTool() |
405 | { | 405 | { |
406 | if (m_pTool) { | 406 | if (m_pTool) { |
407 | delete m_pTool; | 407 | delete m_pTool; |
408 | } | 408 | } |
409 | 409 | ||
410 | m_pTool = new RectangleTool(this, m_pDrawPadCanvas); | 410 | m_pTool = new RectangleTool(this, m_pDrawPadCanvas); |
411 | 411 | ||
412 | m_pRectangleToolButton->setIconSet(m_pRectangleToolAction->iconSet()); | 412 | m_pRectangleToolButton->setIconSet(m_pRectangleToolAction->iconSet()); |
413 | QToolTip::add(m_pRectangleToolButton, m_pRectangleToolAction->text()); | 413 | QToolTip::add(m_pRectangleToolButton, m_pRectangleToolAction->text()); |
414 | 414 | ||
415 | disconnect(m_pRectangleToolButton, SIGNAL(clicked()), 0, 0); | 415 | disconnect(m_pRectangleToolButton, SIGNAL(clicked()), 0, 0); |
416 | connect(m_pRectangleToolButton, SIGNAL(clicked()), m_pRectangleToolAction, SIGNAL(activated())); | 416 | connect(m_pRectangleToolButton, SIGNAL(clicked()), m_pRectangleToolAction, SIGNAL(activated())); |
417 | 417 | ||
418 | m_pLineToolButton->setOn(false); | 418 | m_pLineToolButton->setOn(false); |
419 | m_pRectangleToolButton->setOn(true); | 419 | m_pRectangleToolButton->setOn(true); |
420 | m_pEllipseToolButton->setOn(false); | 420 | m_pEllipseToolButton->setOn(false); |
421 | m_pTextToolAction->setOn(false); | 421 | m_pTextToolAction->setOn(false); |
422 | m_pFillToolAction->setOn(false); | 422 | m_pFillToolAction->setOn(false); |
423 | m_pEraseToolAction->setOn(false); | 423 | m_pEraseToolAction->setOn(false); |
424 | } | 424 | } |
425 | 425 | ||
426 | void DrawPad::setFilledRectangleTool() | 426 | void DrawPad::setFilledRectangleTool() |
427 | { | 427 | { |
428 | if (m_pTool) { | 428 | if (m_pTool) { |
429 | delete m_pTool; | 429 | delete m_pTool; |
430 | } | 430 | } |
431 | 431 | ||
432 | m_pTool = new FilledRectangleTool(this, m_pDrawPadCanvas); | 432 | m_pTool = new FilledRectangleTool(this, m_pDrawPadCanvas); |
433 | 433 | ||
434 | m_pRectangleToolButton->setIconSet(m_pFilledRectangleToolAction->iconSet()); | 434 | m_pRectangleToolButton->setIconSet(m_pFilledRectangleToolAction->iconSet()); |
435 | QToolTip::add(m_pRectangleToolButton, m_pFilledRectangleToolAction->text()); | 435 | QToolTip::add(m_pRectangleToolButton, m_pFilledRectangleToolAction->text()); |
436 | 436 | ||
437 | disconnect(m_pRectangleToolButton, SIGNAL(clicked()), 0, 0); | 437 | disconnect(m_pRectangleToolButton, SIGNAL(clicked()), 0, 0); |
438 | connect(m_pRectangleToolButton, SIGNAL(clicked()), m_pFilledRectangleToolAction, SIGNAL(activated())); | 438 | connect(m_pRectangleToolButton, SIGNAL(clicked()), m_pFilledRectangleToolAction, SIGNAL(activated())); |
439 | 439 | ||
440 | m_pLineToolButton->setOn(false); | 440 | m_pLineToolButton->setOn(false); |
441 | m_pRectangleToolButton->setOn(true); | 441 | m_pRectangleToolButton->setOn(true); |
442 | m_pEllipseToolButton->setOn(false); | 442 | m_pEllipseToolButton->setOn(false); |
443 | m_pTextToolAction->setOn(false); | 443 | m_pTextToolAction->setOn(false); |
444 | m_pFillToolAction->setOn(false); | 444 | m_pFillToolAction->setOn(false); |
445 | m_pEraseToolAction->setOn(false); | 445 | m_pEraseToolAction->setOn(false); |
446 | } | 446 | } |
447 | 447 | ||
448 | void DrawPad::setEllipseTool() | 448 | void DrawPad::setEllipseTool() |
449 | { | 449 | { |
450 | if (m_pTool) { | 450 | if (m_pTool) { |
451 | delete m_pTool; | 451 | delete m_pTool; |
452 | } | 452 | } |
453 | 453 | ||
454 | m_pTool = new EllipseTool(this, m_pDrawPadCanvas); | 454 | m_pTool = new EllipseTool(this, m_pDrawPadCanvas); |
455 | 455 | ||
456 | m_pEllipseToolButton->setIconSet(m_pEllipseToolAction->iconSet()); | 456 | m_pEllipseToolButton->setIconSet(m_pEllipseToolAction->iconSet()); |
457 | QToolTip::add(m_pEllipseToolButton, m_pEllipseToolAction->text()); | 457 | QToolTip::add(m_pEllipseToolButton, m_pEllipseToolAction->text()); |
458 | 458 | ||
459 | disconnect(m_pEllipseToolButton, SIGNAL(clicked()), 0, 0); | 459 | disconnect(m_pEllipseToolButton, SIGNAL(clicked()), 0, 0); |
460 | connect(m_pEllipseToolButton, SIGNAL(clicked()), m_pEllipseToolAction, SIGNAL(activated())); | 460 | connect(m_pEllipseToolButton, SIGNAL(clicked()), m_pEllipseToolAction, SIGNAL(activated())); |
461 | 461 | ||
462 | m_pLineToolButton->setOn(false); | 462 | m_pLineToolButton->setOn(false); |
463 | m_pRectangleToolButton->setOn(false); | 463 | m_pRectangleToolButton->setOn(false); |
464 | m_pEllipseToolButton->setOn(true); | 464 | m_pEllipseToolButton->setOn(true); |
465 | m_pTextToolAction->setOn(false); | 465 | m_pTextToolAction->setOn(false); |
466 | m_pFillToolAction->setOn(false); | 466 | m_pFillToolAction->setOn(false); |
467 | m_pEraseToolAction->setOn(false); | 467 | m_pEraseToolAction->setOn(false); |
468 | } | 468 | } |
469 | 469 | ||
470 | void DrawPad::setFilledEllipseTool() | 470 | void DrawPad::setFilledEllipseTool() |
471 | { | 471 | { |
472 | if (m_pTool) { | 472 | if (m_pTool) { |
473 | delete m_pTool; | 473 | delete m_pTool; |
474 | } | 474 | } |
475 | 475 | ||
476 | m_pTool = new FilledEllipseTool(this, m_pDrawPadCanvas); | 476 | m_pTool = new FilledEllipseTool(this, m_pDrawPadCanvas); |
477 | 477 | ||
478 | m_pEllipseToolButton->setIconSet(m_pFilledEllipseToolAction->iconSet()); | 478 | m_pEllipseToolButton->setIconSet(m_pFilledEllipseToolAction->iconSet()); |
479 | QToolTip::add(m_pEllipseToolButton, m_pFilledEllipseToolAction->text()); | 479 | QToolTip::add(m_pEllipseToolButton, m_pFilledEllipseToolAction->text()); |
480 | 480 | ||
481 | disconnect(m_pEllipseToolButton, SIGNAL(clicked()), 0, 0); | 481 | disconnect(m_pEllipseToolButton, SIGNAL(clicked()), 0, 0); |
482 | connect(m_pEllipseToolButton, SIGNAL(clicked()), m_pFilledEllipseToolAction, SIGNAL(activated())); | 482 | connect(m_pEllipseToolButton, SIGNAL(clicked()), m_pFilledEllipseToolAction, SIGNAL(activated())); |
483 | 483 | ||
484 | m_pLineToolButton->setOn(false); | 484 | m_pLineToolButton->setOn(false); |
485 | m_pRectangleToolButton->setOn(false); | 485 | m_pRectangleToolButton->setOn(false); |
486 | m_pEllipseToolButton->setOn(true); | 486 | m_pEllipseToolButton->setOn(true); |
487 | m_pTextToolAction->setOn(false); | 487 | m_pTextToolAction->setOn(false); |
488 | m_pFillToolAction->setOn(false); | 488 | m_pFillToolAction->setOn(false); |
489 | m_pEraseToolAction->setOn(false); | 489 | m_pEraseToolAction->setOn(false); |
490 | } | 490 | } |
491 | 491 | ||
492 | void DrawPad::setTextTool() | 492 | void DrawPad::setTextTool() |
493 | { | 493 | { |
494 | if (m_pTool) { | 494 | if (m_pTool) { |
495 | delete m_pTool; | 495 | delete m_pTool; |
496 | } | 496 | } |
497 | 497 | ||
498 | m_pTool = new TextTool(this, m_pDrawPadCanvas); | 498 | m_pTool = new TextTool(this, m_pDrawPadCanvas); |
499 | 499 | ||
500 | m_pLineToolButton->setOn(false); | 500 | m_pLineToolButton->setOn(false); |
501 | m_pRectangleToolButton->setOn(false); | 501 | m_pRectangleToolButton->setOn(false); |
502 | m_pEllipseToolButton->setOn(false); | 502 | m_pEllipseToolButton->setOn(false); |
503 | m_pTextToolAction->setOn(true); | 503 | m_pTextToolAction->setOn(true); |
504 | m_pFillToolAction->setOn(false); | 504 | m_pFillToolAction->setOn(false); |
505 | m_pEraseToolAction->setOn(false); | 505 | m_pEraseToolAction->setOn(false); |
506 | } | 506 | } |
507 | 507 | ||
508 | void DrawPad::setFillTool() | 508 | void DrawPad::setFillTool() |
509 | { | 509 | { |
510 | if (m_pTool) { | 510 | if (m_pTool) { |
511 | delete m_pTool; | 511 | delete m_pTool; |
512 | } | 512 | } |
513 | 513 | ||
514 | m_pTool = new FillTool(this, m_pDrawPadCanvas); | 514 | m_pTool = new FillTool(this, m_pDrawPadCanvas); |
515 | 515 | ||
516 | m_pLineToolButton->setOn(false); | 516 | m_pLineToolButton->setOn(false); |
517 | m_pRectangleToolButton->setOn(false); | 517 | m_pRectangleToolButton->setOn(false); |
518 | m_pEllipseToolButton->setOn(false); | 518 | m_pEllipseToolButton->setOn(false); |
519 | m_pTextToolAction->setOn(false); | 519 | m_pTextToolAction->setOn(false); |
520 | m_pFillToolAction->setOn(true); | 520 | m_pFillToolAction->setOn(true); |
521 | m_pEraseToolAction->setOn(false); | 521 | m_pEraseToolAction->setOn(false); |
522 | } | 522 | } |
523 | 523 | ||
524 | void DrawPad::setEraseTool() | 524 | void DrawPad::setEraseTool() |
525 | { | 525 | { |
526 | if (m_pTool) { | 526 | if (m_pTool) { |
527 | delete m_pTool; | 527 | delete m_pTool; |
528 | } | 528 | } |
529 | 529 | ||
530 | m_pTool = new EraseTool(this, m_pDrawPadCanvas); | 530 | m_pTool = new EraseTool(this, m_pDrawPadCanvas); |
531 | 531 | ||
532 | m_pLineToolButton->setOn(false); | 532 | m_pLineToolButton->setOn(false); |
533 | m_pRectangleToolButton->setOn(false); | 533 | m_pRectangleToolButton->setOn(false); |
534 | m_pEllipseToolButton->setOn(false); | 534 | m_pEllipseToolButton->setOn(false); |
535 | m_pTextToolAction->setOn(false); | 535 | m_pTextToolAction->setOn(false); |
536 | m_pFillToolAction->setOn(false); | 536 | m_pFillToolAction->setOn(false); |
537 | m_pEraseToolAction->setOn(true); | 537 | m_pEraseToolAction->setOn(true); |
538 | } | 538 | } |
539 | 539 | ||
540 | void DrawPad::changePenWidth(int value) | 540 | void DrawPad::changePenWidth(int value) |
541 | { | 541 | { |
542 | m_pen.setWidth(value); | 542 | m_pen.setWidth(value); |
543 | } | 543 | } |
544 | 544 | ||
545 | void DrawPad::changePenColor(const QColor& color) | 545 | void DrawPad::changePenColor(const QColor& color) |
546 | { | 546 | { |
547 | m_pen.setColor(color); | 547 | m_pen.setColor(color); |
548 | 548 | ||
549 | QPainter painter; | 549 | QPainter painter; |
550 | painter.begin(m_pPenColorToolButton->pixmap()); | 550 | painter.begin(m_pPenColorToolButton->pixmap()); |
551 | painter.fillRect(QRect(0, 12, 14, 2), m_pen.color()); | 551 | painter.fillRect(QRect(0, 12, 14, 2), m_pen.color()); |
552 | painter.end(); | 552 | painter.end(); |
553 | 553 | ||
554 | m_pPenColorToolButton->popup()->hide(); | 554 | m_pPenColorToolButton->popup()->hide(); |
555 | } | 555 | } |
556 | 556 | ||
557 | void DrawPad::changeBrushColor(const QColor& color) | 557 | void DrawPad::changeBrushColor(const QColor& color) |
558 | { | 558 | { |
559 | m_brush = QBrush(color); | 559 | m_brush = QBrush(color); |
560 | 560 | ||
561 | QPainter painter; | 561 | QPainter painter; |
562 | painter.begin(m_pBrushColorToolButton->pixmap()); | 562 | painter.begin(m_pBrushColorToolButton->pixmap()); |
563 | painter.fillRect(QRect(0, 12, 14, 2), m_brush.color()); | 563 | painter.fillRect(QRect(0, 12, 14, 2), m_brush.color()); |
564 | painter.end(); | 564 | painter.end(); |
565 | 565 | ||
566 | m_pBrushColorToolButton->popup()->hide(); | 566 | m_pBrushColorToolButton->popup()->hide(); |
567 | } | 567 | } |
568 | 568 | ||
569 | void DrawPad::updateView() | 569 | void DrawPad::updateView() |
570 | { | 570 | { |
571 | uint pagePosition = m_pDrawPadCanvas->pagePosition(); | 571 | uint pagePosition = m_pDrawPadCanvas->pagePosition(); |
572 | uint pageCount = m_pDrawPadCanvas->pageCount(); | 572 | uint pageCount = m_pDrawPadCanvas->pageCount(); |
573 | 573 | ||
574 | setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) ); | 574 | setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) ); |
575 | 575 | ||
576 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); | 576 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); |
577 | m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled()); | 577 | m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled()); |
578 | 578 | ||
579 | m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | 579 | m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); |
580 | m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | 580 | m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); |
581 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | 581 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); |
582 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | 582 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); |
583 | } | 583 | } |
584 | 584 | ||
585 | void DrawPad::deleteAll() | 585 | void DrawPad::deleteAll() |
586 | { | 586 | { |
587 | QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), | 587 | QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), |
588 | QMessageBox::Information, QMessageBox::Yes, | 588 | QMessageBox::Information, QMessageBox::Yes, |
589 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 589 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
590 | QMessageBox::NoButton, this); | 590 | QMessageBox::NoButton, this); |
591 | 591 | ||
592 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 592 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
593 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 593 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
594 | 594 | ||
595 | if (messageBox.exec() == QMessageBox::Yes) { | 595 | if (messageBox.exec() == QMessageBox::Yes) { |
596 | m_pDrawPadCanvas->deleteAll(); | 596 | m_pDrawPadCanvas->deleteAll(); |
597 | } | 597 | } |
598 | } | 598 | } |
599 | 599 | ||
600 | void DrawPad::importPage() | 600 | void DrawPad::importPage() |
601 | { | 601 | { |
602 | ImportDialog importDialog(this); | 602 | ImportDialog importDialog(this); |
603 | 603 | ||
604 | if ( QPEApplication::execDialog( &importDialog ) == QDialog::Accepted ) { | 604 | if ( QPEApplication::execDialog( &importDialog ) == QDialog::Accepted ) { |
605 | const DocLnk* docLnk = importDialog.selected(); | 605 | const DocLnk* docLnk = importDialog.selected(); |
606 | 606 | ||
607 | if (docLnk) { | 607 | if (docLnk) { |
608 | m_pDrawPadCanvas->importPage(docLnk->file()); | 608 | m_pDrawPadCanvas->importPage(docLnk->file()); |
609 | delete docLnk; | 609 | delete docLnk; |
610 | } | 610 | } |
611 | } | 611 | } |
612 | } | 612 | } |
613 | 613 | ||
614 | void DrawPad::exportPage() | 614 | void DrawPad::exportPage() |
615 | { | 615 | { |
616 | ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this); | 616 | ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this); |
617 | 617 | ||
618 | if ( QPEApplication::execDialog( &exportDialog ) == QDialog::Accepted ) { | 618 | if ( QPEApplication::execDialog( &exportDialog ) == QDialog::Accepted ) { |
619 | m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(), | 619 | m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(), |
620 | exportDialog.selectedName(), exportDialog.selectedFormat()); | 620 | exportDialog.selectedName(), exportDialog.selectedFormat()); |
621 | } | 621 | } |
622 | } | 622 | } |
623 | 623 | ||
624 | void DrawPad::thumbnailView() | 624 | void DrawPad::thumbnailView() |
625 | { | 625 | { |
626 | ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this); | 626 | ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this); |
627 | 627 | ||
628 | QPEApplication::showWidget( &thumbnailView ); | 628 | QPEApplication::showWidget( &thumbnailView ); |
629 | thumbnailView.exec(); | 629 | thumbnailView.exec(); |
630 | } | 630 | } |
631 | 631 | ||
632 | void DrawPad::pageInformation() | 632 | void DrawPad::pageInformation() |
633 | { | 633 | { |
634 | PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage()); | 634 | PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage()); |
635 | 635 | ||
636 | if (pageInformationDialog.exec() == QDialog::Accepted) { | 636 | if (pageInformationDialog.exec() == QDialog::Accepted) { |
637 | m_pDrawPadCanvas->currentPage()->setTitle(pageInformationDialog.selectedTitle()); | 637 | m_pDrawPadCanvas->currentPage()->setTitle(pageInformationDialog.selectedTitle()); |
638 | } | 638 | } |
639 | } | 639 | } |
640 | 640 | ||
641 | void DrawPad::loadConfig() | 641 | void DrawPad::loadConfig() |
642 | { | 642 | { |
643 | Config config("drawpad"); | 643 | Config config("drawpad"); |
644 | config.setGroup("General"); | 644 | config.setGroup("General"); |
645 | 645 | ||
646 | m_pAntiAliasingAction->setOn(config.readBoolEntry("AntiAliasing", false)); | 646 | m_pAntiAliasingAction->setOn(config.readBoolEntry("AntiAliasing", false)); |
647 | m_pPenWidthSpinBox->setValue(config.readNumEntry("PenWidth", 1)); | 647 | m_pPenWidthSpinBox->setValue(config.readNumEntry("PenWidth", 1)); |
648 | changePenColor(QColor(config.readEntry("PenColor", Qt::black.name()))); | 648 | changePenColor(QColor(config.readEntry("PenColor", Qt::black.name()))); |
649 | changeBrushColor(QColor(config.readEntry("BrushColor", Qt::white.name()))); | 649 | changeBrushColor(QColor(config.readEntry("BrushColor", Qt::white.name()))); |
650 | m_pDrawPadCanvas->selectPage(config.readNumEntry("PagePosition", 1)); | 650 | m_pDrawPadCanvas->selectPage(config.readNumEntry("PagePosition", 1)); |
651 | } | 651 | } |
652 | 652 | ||
653 | void DrawPad::saveConfig() | 653 | void DrawPad::saveConfig() |
654 | { | 654 | { |
655 | Config config("drawpad"); | 655 | Config config("drawpad"); |
656 | config.setGroup("General"); | 656 | config.setGroup("General"); |
657 | 657 | ||
658 | config.writeEntry("PagePosition", (int)m_pDrawPadCanvas->pagePosition()); | 658 | config.writeEntry("PagePosition", (int)m_pDrawPadCanvas->pagePosition()); |
659 | config.writeEntry("AntiAliasing", antiAliasing()); | 659 | config.writeEntry("AntiAliasing", antiAliasing()); |
660 | config.writeEntry("PenWidth", (int)m_pen.width()); | 660 | config.writeEntry("PenWidth", (int)m_pen.width()); |
661 | config.writeEntry("PenColor", m_pen.color().name()); | 661 | config.writeEntry("PenColor", m_pen.color().name()); |
662 | config.writeEntry("BrushColor", m_brush.color().name()); | 662 | config.writeEntry("BrushColor", m_brush.color().name()); |
663 | } | 663 | } |
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index 48d5225..8ba6e58 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h | |||
@@ -1,113 +1,112 @@ | |||
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 | |||
19 | #include <qpen.h> | 18 | #include <qpen.h> |
20 | 19 | ||
21 | class DrawPadCanvas; | 20 | class DrawPadCanvas; |
22 | class Tool; | 21 | class Tool; |
23 | 22 | ||
24 | class QAction; | 23 | class QAction; |
25 | class QColor; | 24 | class QColor; |
26 | class QSpinBox; | 25 | class QSpinBox; |
27 | class QToolButton; | 26 | class QToolButton; |
28 | class QWidgetStack; | 27 | class QWidgetStack; |
29 | 28 | ||
30 | class DrawPad : public QMainWindow | 29 | class DrawPad : public QMainWindow |
31 | { | 30 | { |
32 | Q_OBJECT | 31 | Q_OBJECT |
33 | 32 | ||
34 | public: | 33 | public: |
35 | DrawPad(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 34 | DrawPad(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
36 | ~DrawPad(); | 35 | ~DrawPad(); |
37 | 36 | ||
38 | static QString appName() { return QString::fromLatin1("drawpad"); } | 37 | static QString appName() { return QString::fromLatin1("drawpad"); } |
39 | 38 | ||
40 | Tool* tool() { return m_pTool; } | 39 | Tool* tool() { return m_pTool; } |
41 | QPen pen() { return m_pen; } | 40 | QPen pen() { return m_pen; } |
42 | QBrush brush() { return m_brush; } | 41 | QBrush brush() { return m_brush; } |
43 | 42 | ||
44 | bool antiAliasing(); | 43 | bool antiAliasing(); |
45 | void finishStartup(); | 44 | void finishStartup(); |
46 | 45 | ||
47 | private slots: | 46 | private slots: |
48 | void newPage(); | 47 | void newPage(); |
49 | void clearPage(); | 48 | void clearPage(); |
50 | void deletePage(); | 49 | void deletePage(); |
51 | 50 | ||
52 | void setPointTool(); | 51 | void setPointTool(); |
53 | void setLineTool(); | 52 | void setLineTool(); |
54 | void setRectangleTool(); | 53 | void setRectangleTool(); |
55 | void setFilledRectangleTool(); | 54 | void setFilledRectangleTool(); |
56 | void setEllipseTool(); | 55 | void setEllipseTool(); |
57 | void setFilledEllipseTool(); | 56 | void setFilledEllipseTool(); |
58 | void setTextTool(); | 57 | void setTextTool(); |
59 | void setFillTool(); | 58 | void setFillTool(); |
60 | void setEraseTool(); | 59 | void setEraseTool(); |
61 | 60 | ||
62 | void changePenWidth(int value); | 61 | void changePenWidth(int value); |
63 | void changePenColor(const QColor& color); | 62 | void changePenColor(const QColor& color); |
64 | void changeBrushColor(const QColor& color); | 63 | void changeBrushColor(const QColor& color); |
65 | 64 | ||
66 | void updateView(); | 65 | void updateView(); |
67 | 66 | ||
68 | void deleteAll(); | 67 | void deleteAll(); |
69 | void importPage(); | 68 | void importPage(); |
70 | void exportPage(); | 69 | void exportPage(); |
71 | void thumbnailView(); | 70 | void thumbnailView(); |
72 | void pageInformation(); | 71 | void pageInformation(); |
73 | 72 | ||
74 | private: | 73 | private: |
75 | void loadConfig(); | 74 | void loadConfig(); |
76 | void saveConfig(); | 75 | void saveConfig(); |
77 | 76 | ||
78 | DrawPadCanvas* m_pDrawPadCanvas; | 77 | DrawPadCanvas* m_pDrawPadCanvas; |
79 | 78 | ||
80 | Tool* m_pTool; | 79 | Tool* m_pTool; |
81 | QPen m_pen; | 80 | QPen m_pen; |
82 | QBrush m_brush; | 81 | QBrush m_brush; |
83 | 82 | ||
84 | QAction* m_pAntiAliasingAction; | 83 | QAction* m_pAntiAliasingAction; |
85 | 84 | ||
86 | QAction* m_pUndoAction; | 85 | QAction* m_pUndoAction; |
87 | QAction* m_pRedoAction; | 86 | QAction* m_pRedoAction; |
88 | 87 | ||
89 | QAction* m_pFirstPageAction; | 88 | QAction* m_pFirstPageAction; |
90 | QAction* m_pPreviousPageAction; | 89 | QAction* m_pPreviousPageAction; |
91 | QAction* m_pNextPageAction; | 90 | QAction* m_pNextPageAction; |
92 | QAction* m_pLastPageAction; | 91 | QAction* m_pLastPageAction; |
93 | 92 | ||
94 | QAction* m_pPointToolAction; | 93 | QAction* m_pPointToolAction; |
95 | QAction* m_pLineToolAction; | 94 | QAction* m_pLineToolAction; |
96 | QAction* m_pRectangleToolAction; | 95 | QAction* m_pRectangleToolAction; |
97 | QAction* m_pFilledRectangleToolAction; | 96 | QAction* m_pFilledRectangleToolAction; |
98 | QAction* m_pEllipseToolAction; | 97 | QAction* m_pEllipseToolAction; |
99 | QAction* m_pFilledEllipseToolAction; | 98 | QAction* m_pFilledEllipseToolAction; |
100 | QAction* m_pTextToolAction; | 99 | QAction* m_pTextToolAction; |
101 | QAction* m_pFillToolAction; | 100 | QAction* m_pFillToolAction; |
102 | QAction* m_pEraseToolAction; | 101 | QAction* m_pEraseToolAction; |
103 | 102 | ||
104 | QToolButton* m_pLineToolButton; | 103 | QToolButton* m_pLineToolButton; |
105 | QToolButton* m_pRectangleToolButton; | 104 | QToolButton* m_pRectangleToolButton; |
106 | QToolButton* m_pEllipseToolButton; | 105 | QToolButton* m_pEllipseToolButton; |
107 | QToolButton* m_pPenColorToolButton; | 106 | QToolButton* m_pPenColorToolButton; |
108 | QToolButton* m_pBrushColorToolButton; | 107 | QToolButton* m_pBrushColorToolButton; |
109 | 108 | ||
110 | QSpinBox* m_pPenWidthSpinBox; | 109 | QSpinBox* m_pPenWidthSpinBox; |
111 | }; | 110 | }; |
112 | 111 | ||
113 | #endif // DRAWPAD_H | 112 | #endif // DRAWPAD_H |
diff --git a/noncore/graphics/drawpad/drawpad.pro b/noncore/graphics/drawpad/drawpad.pro index 30b2199..5e6ca6b 100644 --- a/noncore/graphics/drawpad/drawpad.pro +++ b/noncore/graphics/drawpad/drawpad.pro | |||
@@ -1,47 +1,47 @@ | |||
1 | CONFIG = qt warn_on release quick-app | 1 | CONFIG = qt warn_on release quick-app |
2 | HEADERS = drawpad.h \ | 2 | HEADERS = drawpad.h \ |
3 | drawpadcanvas.h \ | 3 | drawpadcanvas.h \ |
4 | ellipsetool.h \ | 4 | ellipsetool.h \ |
5 | erasetool.h \ | 5 | erasetool.h \ |
6 | exportdialog.h \ | 6 | exportdialog.h \ |
7 | filltool.h \ | 7 | filltool.h \ |
8 | filledellipsetool.h \ | 8 | filledellipsetool.h \ |
9 | filledrectangletool.h \ | 9 | filledrectangletool.h \ |
10 | importdialog.h \ | 10 | importdialog.h \ |
11 | linetool.h \ | 11 | linetool.h \ |
12 | newpagedialog.h \ | 12 | newpagedialog.h \ |
13 | page.h \ | 13 | page.h \ |
14 | pageinformationdialog.h \ | 14 | pageinformationdialog.h \ |
15 | pointtool.h \ | 15 | pointtool.h \ |
16 | rectangletool.h \ | 16 | rectangletool.h \ |
17 | shapetool.h \ | 17 | shapetool.h \ |
18 | texttool.h \ | 18 | texttool.h \ |
19 | thumbnailview.h \ | 19 | thumbnailview.h \ |
20 | tool.h | 20 | tool.h |
21 | SOURCES = drawpad.cpp \ | 21 | SOURCES = drawpad.cpp \ |
22 | drawpadcanvas.cpp \ | 22 | drawpadcanvas.cpp \ |
23 | ellipsetool.cpp \ | 23 | ellipsetool.cpp \ |
24 | erasetool.cpp \ | 24 | erasetool.cpp \ |
25 | exportdialog.cpp \ | 25 | exportdialog.cpp \ |
26 | filltool.cpp \ | 26 | filltool.cpp \ |
27 | filledellipsetool.cpp \ | 27 | filledellipsetool.cpp \ |
28 | filledrectangletool.cpp \ | 28 | filledrectangletool.cpp \ |
29 | importdialog.cpp \ | 29 | importdialog.cpp \ |
30 | linetool.cpp \ | 30 | linetool.cpp \ |
31 | main.cpp \ | 31 | main.cpp \ |
32 | newpagedialog.cpp \ | 32 | newpagedialog.cpp \ |
33 | page.cpp \ | 33 | page.cpp \ |
34 | pageinformationdialog.cpp \ | 34 | pageinformationdialog.cpp \ |
35 | pointtool.cpp \ | 35 | pointtool.cpp \ |
36 | rectangletool.cpp \ | 36 | rectangletool.cpp \ |
37 | shapetool.cpp \ | 37 | shapetool.cpp \ |
38 | texttool.cpp \ | 38 | texttool.cpp \ |
39 | thumbnailview.cpp \ | 39 | thumbnailview.cpp \ |
40 | tool.cpp | 40 | tool.cpp |
41 | INCLUDEPATH+= $(OPIEDIR)/include | 41 | INCLUDEPATH+= $(OPIEDIR)/include |
42 | DEPENDPATH+= $(OPIEDIR)/include | 42 | DEPENDPATH+= $(OPIEDIR)/include |
43 | LIBS += -lqpe -lopie | 43 | LIBS += -lqpe -lopiecore2 -lopieui2 -lqtaux2 |
44 | 44 | ||
45 | TARGET = drawpad | 45 | TARGET = drawpad |
46 | 46 | ||
47 | include ( $(OPIEDIR)/include.pro ) | 47 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/graphics/drawpad/exportdialog.cpp b/noncore/graphics/drawpad/exportdialog.cpp index d63f428..169acef 100644 --- a/noncore/graphics/drawpad/exportdialog.cpp +++ b/noncore/graphics/drawpad/exportdialog.cpp | |||
@@ -1,175 +1,175 @@ | |||
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 "exportdialog.h" | 14 | #include "exportdialog.h" |
15 | 15 | ||
16 | #include <opie/ofileselector.h> | 16 | #include <opie2/ofileselector.h> |
17 | 17 | ||
18 | #include <qbuttongroup.h> | 18 | #include <qbuttongroup.h> |
19 | #include <qcombobox.h> | 19 | #include <qcombobox.h> |
20 | #include <qimage.h> | 20 | #include <qimage.h> |
21 | #include <qlabel.h> | 21 | #include <qlabel.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
24 | #include <qradiobutton.h> | 24 | #include <qradiobutton.h> |
25 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
26 | 26 | ||
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | 28 | ||
29 | ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name) | 29 | ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name) |
30 | : QDialog(parent, name, true) | 30 | : QDialog(parent, name, true) |
31 | { | 31 | { |
32 | setCaption(tr("DrawPad - Export")); | 32 | setCaption(tr("DrawPad - Export")); |
33 | 33 | ||
34 | m_pageAt = pageAt; | 34 | m_pageAt = pageAt; |
35 | m_pageCount = pageCount; | 35 | m_pageCount = pageCount; |
36 | 36 | ||
37 | QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this); | 37 | QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this); |
38 | connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int))); | 38 | connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int))); |
39 | 39 | ||
40 | QRadioButton* selectAllRadioButton = new QRadioButton(tr("All"), selectionButtonGroup); | 40 | QRadioButton* selectAllRadioButton = new QRadioButton(tr("All"), selectionButtonGroup); |
41 | QRadioButton* selectCurrentRadioButton = new QRadioButton(tr("Current"), selectionButtonGroup); | 41 | QRadioButton* selectCurrentRadioButton = new QRadioButton(tr("Current"), selectionButtonGroup); |
42 | QRadioButton* selectRangeRadioButton = new QRadioButton(tr("Range"), selectionButtonGroup); | 42 | QRadioButton* selectRangeRadioButton = new QRadioButton(tr("Range"), selectionButtonGroup); |
43 | 43 | ||
44 | QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup); | 44 | QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup); |
45 | 45 | ||
46 | m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); | 46 | m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); |
47 | connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int))); | 47 | connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int))); |
48 | 48 | ||
49 | m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); | 49 | m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); |
50 | connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int))); | 50 | connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int))); |
51 | 51 | ||
52 | selectionButtonGroup->setButton(1); | 52 | selectionButtonGroup->setButton(1); |
53 | selectionChanged(1); | 53 | selectionChanged(1); |
54 | 54 | ||
55 | m_pFromPageSpinBox->setValue(pageAt); | 55 | m_pFromPageSpinBox->setValue(pageAt); |
56 | m_pToPageSpinBox->setValue(pageAt); | 56 | m_pToPageSpinBox->setValue(pageAt); |
57 | 57 | ||
58 | QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this); | 58 | QGroupBox* exportGroupBox = new QGroupBox(0, Qt::Vertical, tr("Export As"), this); |
59 | 59 | ||
60 | QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox); | 60 | QLabel* nameLabel = new QLabel(tr("Name:"), exportGroupBox); |
61 | QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox); | 61 | QLabel* formatLabel = new QLabel(tr("Format:"), exportGroupBox); |
62 | 62 | ||
63 | m_pNameLineEdit = new QLineEdit(exportGroupBox); | 63 | m_pNameLineEdit = new QLineEdit(exportGroupBox); |
64 | 64 | ||
65 | m_pFormatComboBox = new QComboBox(exportGroupBox); | 65 | m_pFormatComboBox = new QComboBox(exportGroupBox); |
66 | m_pFormatComboBox->insertStrList(QImageIO::outputFormats()); | 66 | m_pFormatComboBox->insertStrList(QImageIO::outputFormats()); |
67 | 67 | ||
68 | MimeTypes types; types.insert( tr("All Images"), "image/*" ); | 68 | MimeTypes types; types.insert( tr("All Images"), "image/*" ); |
69 | OFileSelector* fileSelector = new OFileSelector(this, OFileSelector::FileSelector, | 69 | Opie::OFileSelector* fileSelector = new Opie::OFileSelector(this, Opie::OFileSelector::FileSelector, |
70 | OFileSelector::Normal, | 70 | Opie::OFileSelector::Normal, |
71 | QString::null, QString::null, | 71 | QString::null, QString::null, |
72 | types ); | 72 | types ); |
73 | fileSelector->setNameVisible( false ); | 73 | fileSelector->setNameVisible( false ); |
74 | 74 | ||
75 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); | 75 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); |
76 | selectionButtonGroup->layout()->setSpacing(4); | 76 | selectionButtonGroup->layout()->setSpacing(4); |
77 | exportGroupBox->layout()->setSpacing(4); | 77 | exportGroupBox->layout()->setSpacing(4); |
78 | QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2); | 78 | QGridLayout* selectionLayout = new QGridLayout(selectionButtonGroup->layout(), 2, 2); |
79 | QHBoxLayout* rangeLayout = new QHBoxLayout(); | 79 | QHBoxLayout* rangeLayout = new QHBoxLayout(); |
80 | QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2); | 80 | QGridLayout* exportLayout = new QGridLayout(exportGroupBox->layout(), 2, 2); |
81 | 81 | ||
82 | selectionLayout->addWidget(selectAllRadioButton, 0, 0); | 82 | selectionLayout->addWidget(selectAllRadioButton, 0, 0); |
83 | selectionLayout->addWidget(selectCurrentRadioButton, 1, 0); | 83 | selectionLayout->addWidget(selectCurrentRadioButton, 1, 0); |
84 | selectionLayout->addWidget(selectRangeRadioButton, 0, 1); | 84 | selectionLayout->addWidget(selectRangeRadioButton, 0, 1); |
85 | selectionLayout->addLayout(rangeLayout, 1, 1); | 85 | selectionLayout->addLayout(rangeLayout, 1, 1); |
86 | 86 | ||
87 | rangeLayout->addWidget(m_pFromPageSpinBox); | 87 | rangeLayout->addWidget(m_pFromPageSpinBox); |
88 | rangeLayout->addWidget(toLabel); | 88 | rangeLayout->addWidget(toLabel); |
89 | rangeLayout->addWidget(m_pToPageSpinBox); | 89 | rangeLayout->addWidget(m_pToPageSpinBox); |
90 | 90 | ||
91 | exportLayout->addWidget(nameLabel, 0, 0); | 91 | exportLayout->addWidget(nameLabel, 0, 0); |
92 | exportLayout->addWidget(formatLabel, 1, 0); | 92 | exportLayout->addWidget(formatLabel, 1, 0); |
93 | 93 | ||
94 | exportLayout->addWidget(m_pNameLineEdit, 0, 1); | 94 | exportLayout->addWidget(m_pNameLineEdit, 0, 1); |
95 | exportLayout->addWidget(m_pFormatComboBox, 1, 1); | 95 | exportLayout->addWidget(m_pFormatComboBox, 1, 1); |
96 | 96 | ||
97 | exportLayout->setColStretch(1, 1); | 97 | exportLayout->setColStretch(1, 1); |
98 | 98 | ||
99 | mainLayout->addWidget(selectionButtonGroup); | 99 | mainLayout->addWidget(selectionButtonGroup); |
100 | mainLayout->addWidget(exportGroupBox); | 100 | mainLayout->addWidget(exportGroupBox); |
101 | mainLayout->addWidget(fileSelector); | 101 | mainLayout->addWidget(fileSelector); |
102 | 102 | ||
103 | m_pNameLineEdit->setFocus(); | 103 | m_pNameLineEdit->setFocus(); |
104 | } | 104 | } |
105 | 105 | ||
106 | ExportDialog::~ExportDialog() | 106 | ExportDialog::~ExportDialog() |
107 | { | 107 | { |
108 | } | 108 | } |
109 | 109 | ||
110 | uint ExportDialog::selectedFromPage() | 110 | uint ExportDialog::selectedFromPage() |
111 | { | 111 | { |
112 | return (m_pFromPageSpinBox->value()); | 112 | return (m_pFromPageSpinBox->value()); |
113 | } | 113 | } |
114 | 114 | ||
115 | uint ExportDialog::selectedToPage() | 115 | uint ExportDialog::selectedToPage() |
116 | { | 116 | { |
117 | return (m_pToPageSpinBox->value()); | 117 | return (m_pToPageSpinBox->value()); |
118 | } | 118 | } |
119 | 119 | ||
120 | QString ExportDialog::selectedName() | 120 | QString ExportDialog::selectedName() |
121 | { | 121 | { |
122 | return (m_pNameLineEdit->text()); | 122 | return (m_pNameLineEdit->text()); |
123 | } | 123 | } |
124 | 124 | ||
125 | QString ExportDialog::selectedFormat() | 125 | QString ExportDialog::selectedFormat() |
126 | { | 126 | { |
127 | return (m_pFormatComboBox->currentText()); | 127 | return (m_pFormatComboBox->currentText()); |
128 | } | 128 | } |
129 | 129 | ||
130 | void ExportDialog::accept() | 130 | void ExportDialog::accept() |
131 | { | 131 | { |
132 | if (!(m_pNameLineEdit->text().isEmpty())) { | 132 | if (!(m_pNameLineEdit->text().isEmpty())) { |
133 | QDialog::accept(); | 133 | QDialog::accept(); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | void ExportDialog::selectionChanged(int id) | 137 | void ExportDialog::selectionChanged(int id) |
138 | { | 138 | { |
139 | switch (id) { | 139 | switch (id) { |
140 | case 0: | 140 | case 0: |
141 | m_pFromPageSpinBox->setValue(1); | 141 | m_pFromPageSpinBox->setValue(1); |
142 | m_pToPageSpinBox->setValue(m_pageCount); | 142 | m_pToPageSpinBox->setValue(m_pageCount); |
143 | 143 | ||
144 | m_pFromPageSpinBox->setEnabled(false); | 144 | m_pFromPageSpinBox->setEnabled(false); |
145 | m_pToPageSpinBox->setEnabled(false); | 145 | m_pToPageSpinBox->setEnabled(false); |
146 | break; | 146 | break; |
147 | case 1: | 147 | case 1: |
148 | m_pFromPageSpinBox->setValue(m_pageAt); | 148 | m_pFromPageSpinBox->setValue(m_pageAt); |
149 | m_pToPageSpinBox->setValue(m_pageAt); | 149 | m_pToPageSpinBox->setValue(m_pageAt); |
150 | 150 | ||
151 | m_pFromPageSpinBox->setEnabled(false); | 151 | m_pFromPageSpinBox->setEnabled(false); |
152 | m_pToPageSpinBox->setEnabled(false); | 152 | m_pToPageSpinBox->setEnabled(false); |
153 | break; | 153 | break; |
154 | case 2: | 154 | case 2: |
155 | m_pFromPageSpinBox->setEnabled(true); | 155 | m_pFromPageSpinBox->setEnabled(true); |
156 | m_pToPageSpinBox->setEnabled(true); | 156 | m_pToPageSpinBox->setEnabled(true); |
157 | break; | 157 | break; |
158 | default: | 158 | default: |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | void ExportDialog::fromPageChanged(int value) | 163 | void ExportDialog::fromPageChanged(int value) |
164 | { | 164 | { |
165 | if (m_pToPageSpinBox->value() < value) { | 165 | if (m_pToPageSpinBox->value() < value) { |
166 | m_pToPageSpinBox->setValue(value); | 166 | m_pToPageSpinBox->setValue(value); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | void ExportDialog::toPageChanged(int value) | 170 | void ExportDialog::toPageChanged(int value) |
171 | { | 171 | { |
172 | if (m_pFromPageSpinBox->value() > value) { | 172 | if (m_pFromPageSpinBox->value() > value) { |
173 | m_pFromPageSpinBox->setValue(value); | 173 | m_pFromPageSpinBox->setValue(value); |
174 | } | 174 | } |
175 | } | 175 | } |
diff --git a/noncore/graphics/drawpad/importdialog.cpp b/noncore/graphics/drawpad/importdialog.cpp index ce2e7ee..4fc0a0e 100644 --- a/noncore/graphics/drawpad/importdialog.cpp +++ b/noncore/graphics/drawpad/importdialog.cpp | |||
@@ -1,116 +1,116 @@ | |||
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 "importdialog.h" | 14 | #include "importdialog.h" |
15 | 15 | ||
16 | #include <opie/ofileselector.h> | 16 | #include <qpe/mimetype.h> |
17 | 17 | ||
18 | #include <qcheckbox.h> | 18 | #include <qcheckbox.h> |
19 | #include <qimage.h> | 19 | #include <qimage.h> |
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
23 | 23 | ||
24 | ImportDialog::ImportDialog(QWidget* parent, const char* name) | 24 | ImportDialog::ImportDialog(QWidget* parent, const char* name) |
25 | : QDialog(parent, name, true) | 25 | : QDialog(parent, name, true) |
26 | { | 26 | { |
27 | setCaption(tr("DrawPad - Import")); | 27 | setCaption(tr("DrawPad - Import")); |
28 | 28 | ||
29 | MimeTypes types; types.insert( tr("All images"),"image/*" ); | 29 | MimeTypes types; types.insert( tr("All images"),"image/*" ); |
30 | m_pFileSelector = new OFileSelector(this, | 30 | m_pFileSelector = new Opie::OFileSelector(this, |
31 | OFileSelector::FileSelector, | 31 | Opie::OFileSelector::FileSelector, |
32 | OFileSelector::Normal, | 32 | Opie::OFileSelector::Normal, |
33 | QString::null, | 33 | QString::null, |
34 | QString::null, types ); | 34 | QString::null, types ); |
35 | m_pFileSelector->setNameVisible( false ); | 35 | m_pFileSelector->setNameVisible( false ); |
36 | connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged())); | 36 | connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged())); |
37 | 37 | ||
38 | m_pPreviewLabel = new QLabel(this); | 38 | m_pPreviewLabel = new QLabel(this); |
39 | m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 39 | m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
40 | m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); | 40 | m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
41 | m_pPreviewLabel->setFixedSize(114, 114); | 41 | m_pPreviewLabel->setFixedSize(114, 114); |
42 | m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid); | 42 | m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid); |
43 | 43 | ||
44 | m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this); | 44 | m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this); |
45 | m_pAutomaticPreviewCheckBox->setChecked(true); | 45 | m_pAutomaticPreviewCheckBox->setChecked(true); |
46 | 46 | ||
47 | QPushButton* previewPushButton = new QPushButton(tr("Preview"), this); | 47 | QPushButton* previewPushButton = new QPushButton(tr("Preview"), this); |
48 | connect(previewPushButton, SIGNAL(clicked()), this, SLOT(preview())); | 48 | connect(previewPushButton, SIGNAL(clicked()), this, SLOT(preview())); |
49 | 49 | ||
50 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); | 50 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); |
51 | QHBoxLayout* previewLayout = new QHBoxLayout(4); | 51 | QHBoxLayout* previewLayout = new QHBoxLayout(4); |
52 | QVBoxLayout* previewSecondLayout = new QVBoxLayout(4); | 52 | QVBoxLayout* previewSecondLayout = new QVBoxLayout(4); |
53 | 53 | ||
54 | previewSecondLayout->addWidget(m_pAutomaticPreviewCheckBox); | 54 | previewSecondLayout->addWidget(m_pAutomaticPreviewCheckBox); |
55 | previewSecondLayout->addWidget(previewPushButton); | 55 | previewSecondLayout->addWidget(previewPushButton); |
56 | previewSecondLayout->addStretch(); | 56 | previewSecondLayout->addStretch(); |
57 | 57 | ||
58 | previewLayout->addWidget(m_pPreviewLabel); | 58 | previewLayout->addWidget(m_pPreviewLabel); |
59 | previewLayout->addLayout(previewSecondLayout); | 59 | previewLayout->addLayout(previewSecondLayout); |
60 | 60 | ||
61 | mainLayout->addWidget(m_pFileSelector); | 61 | mainLayout->addWidget(m_pFileSelector); |
62 | mainLayout->addLayout(previewLayout); | 62 | mainLayout->addLayout(previewLayout); |
63 | 63 | ||
64 | preview(); | 64 | preview(); |
65 | } | 65 | } |
66 | 66 | ||
67 | ImportDialog::~ImportDialog() | 67 | ImportDialog::~ImportDialog() |
68 | { | 68 | { |
69 | } | 69 | } |
70 | 70 | ||
71 | const DocLnk* ImportDialog::selected() | 71 | const DocLnk* ImportDialog::selected() |
72 | { | 72 | { |
73 | // FIXME change from pointer to reference -zecke | 73 | // FIXME change from pointer to reference -zecke |
74 | DocLnk *lnk = new DocLnk( m_pFileSelector->selectedDocument() ); | 74 | DocLnk *lnk = new DocLnk( m_pFileSelector->selectedDocument() ); |
75 | return lnk; | 75 | return lnk; |
76 | } | 76 | } |
77 | 77 | ||
78 | void ImportDialog::fileChanged() | 78 | void ImportDialog::fileChanged() |
79 | { | 79 | { |
80 | if (m_pAutomaticPreviewCheckBox->isChecked()) { | 80 | if (m_pAutomaticPreviewCheckBox->isChecked()) { |
81 | preview(); | 81 | preview(); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | void ImportDialog::preview() | 85 | void ImportDialog::preview() |
86 | { | 86 | { |
87 | const DocLnk* docLnk = selected(); | 87 | const DocLnk* docLnk = selected(); |
88 | 88 | ||
89 | if (docLnk) { | 89 | if (docLnk) { |
90 | QImage image(docLnk->file()); | 90 | QImage image(docLnk->file()); |
91 | 91 | ||
92 | int previewWidth = m_pPreviewLabel->contentsRect().width(); | 92 | int previewWidth = m_pPreviewLabel->contentsRect().width(); |
93 | int previewHeight = m_pPreviewLabel->contentsRect().height(); | 93 | int previewHeight = m_pPreviewLabel->contentsRect().height(); |
94 | 94 | ||
95 | float widthScale = 1.0; | 95 | float widthScale = 1.0; |
96 | float heightScale = 1.0; | 96 | float heightScale = 1.0; |
97 | 97 | ||
98 | if (previewWidth < image.width()) { | 98 | if (previewWidth < image.width()) { |
99 | widthScale = (float)previewWidth / float(image.width()); | 99 | widthScale = (float)previewWidth / float(image.width()); |
100 | } | 100 | } |
101 | 101 | ||
102 | if (previewHeight < image.height()) { | 102 | if (previewHeight < image.height()) { |
103 | heightScale = (float)previewHeight / float(image.height()); | 103 | heightScale = (float)previewHeight / float(image.height()); |
104 | } | 104 | } |
105 | 105 | ||
106 | float scale = (widthScale < heightScale ? widthScale : heightScale); | 106 | float scale = (widthScale < heightScale ? widthScale : heightScale); |
107 | QImage previewImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale)); | 107 | QImage previewImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale)); |
108 | 108 | ||
109 | QPixmap previewPixmap; | 109 | QPixmap previewPixmap; |
110 | previewPixmap.convertFromImage(previewImage); | 110 | previewPixmap.convertFromImage(previewImage); |
111 | 111 | ||
112 | m_pPreviewLabel->setPixmap(previewPixmap); | 112 | m_pPreviewLabel->setPixmap(previewPixmap); |
113 | 113 | ||
114 | delete docLnk; | 114 | delete docLnk; |
115 | } | 115 | } |
116 | } | 116 | } |
diff --git a/noncore/graphics/drawpad/importdialog.h b/noncore/graphics/drawpad/importdialog.h index ed655a5..16227d2 100644 --- a/noncore/graphics/drawpad/importdialog.h +++ b/noncore/graphics/drawpad/importdialog.h | |||
@@ -1,45 +1,46 @@ | |||
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 IMPORTDIALOG_H | 14 | #ifndef IMPORTDIALOG_H |
15 | #define IMPORTDIALOG_H | 15 | #define IMPORTDIALOG_H |
16 | 16 | ||
17 | #include <opie2/ofileselector.h> | ||
18 | |||
17 | #include <qdialog.h> | 19 | #include <qdialog.h> |
18 | 20 | ||
19 | class DocLnk; | 21 | class DocLnk; |
20 | class OFileSelector; | ||
21 | 22 | ||
22 | class QCheckBox; | 23 | class QCheckBox; |
23 | class QLabel; | 24 | class QLabel; |
24 | 25 | ||
25 | class ImportDialog : public QDialog | 26 | class ImportDialog : public QDialog |
26 | { | 27 | { |
27 | Q_OBJECT | 28 | Q_OBJECT |
28 | 29 | ||
29 | public: | 30 | public: |
30 | ImportDialog(QWidget* parent = 0, const char* name = 0); | 31 | ImportDialog(QWidget* parent = 0, const char* name = 0); |
31 | ~ImportDialog(); | 32 | ~ImportDialog(); |
32 | 33 | ||
33 | const DocLnk* selected(); | 34 | const DocLnk* selected(); |
34 | 35 | ||
35 | private slots: | 36 | private slots: |
36 | void fileChanged(); | 37 | void fileChanged(); |
37 | void preview(); | 38 | void preview(); |
38 | 39 | ||
39 | private: | 40 | private: |
40 | OFileSelector* m_pFileSelector; | 41 | Opie::OFileSelector* m_pFileSelector; |
41 | QLabel* m_pPreviewLabel; | 42 | QLabel* m_pPreviewLabel; |
42 | QCheckBox* m_pAutomaticPreviewCheckBox; | 43 | QCheckBox* m_pAutomaticPreviewCheckBox; |
43 | }; | 44 | }; |
44 | 45 | ||
45 | #endif // IMPORTDIALOG_H | 46 | #endif // IMPORTDIALOG_H |
diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp index c87cc0f..a6c666b 100644 --- a/noncore/graphics/drawpad/main.cpp +++ b/noncore/graphics/drawpad/main.cpp | |||
@@ -1,18 +1,18 @@ | |||
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 <opie/oapplicationfactory.h> | 16 | #include <opie2/oapplicationfactory.h> |
17 | 17 | ||
18 | OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) | 18 | OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) |
diff --git a/noncore/graphics/drawpad/opie-drawpad.control b/noncore/graphics/drawpad/opie-drawpad.control index f0aa0b4..2a403f9 100644 --- a/noncore/graphics/drawpad/opie-drawpad.control +++ b/noncore/graphics/drawpad/opie-drawpad.control | |||
@@ -1,12 +1,12 @@ | |||
1 | Package: opie-drawpad | 1 | Package: opie-drawpad |
2 | Files: plugins/application/libdrawpad.so* bin/drawpad apps/1Pim/drawpad.desktop pics/drawpad | 2 | Files: plugins/application/libdrawpad.so* bin/drawpad apps/1Pim/drawpad.desktop pics/drawpad |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/pim | 4 | Section: opie/pim |
5 | Maintainer: Sébastien Prud'homme <prudhomme@laposte.net> | 5 | Maintainer: Sébastien Prud'homme <prudhomme@laposte.net> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, libopie1 | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libqtaux2 |
8 | Description: A note taking program with basic draw tools | 8 | Description: A note taking program with basic draw tools |
9 | DrawPad is an easy note taking program for Zaurus. It can also | 9 | DrawPad is an easy note taking program for Zaurus. It can also |
10 | be used to draw simple images. DrawPad was developed for the Opie | 10 | be used to draw simple images. DrawPad was developed for the Opie |
11 | project, an alternative to the standard Zaurus environment. | 11 | project, an alternative to the standard Zaurus environment. |
12 | Version: $QPE_VERSION$EXTRAVERSION | 12 | Version: $QPE_VERSION$EXTRAVERSION |