-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 61 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 50 |
2 files changed, 56 insertions, 55 deletions
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index 555e64e..c6bdf8f 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -1,418 +1,421 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "tabdialog.h" | 28 | #include "tabdialog.h" |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | 31 | ||
32 | #include <opie2/ofontselector.h> | ||
33 | #include <opie2/otabwidget.h> | ||
34 | #include <opie2/ocolorbutton.h> | 32 | #include <opie2/ocolorbutton.h> |
35 | #include <opie2/ofiledialog.h> | ||
36 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | #include <opie2/ofiledialog.h> | ||
35 | #include <opie2/ofontselector.h> | ||
36 | #include <opie2/oresource.h> | ||
37 | #include <opie2/otabwidget.h> | ||
37 | 38 | ||
38 | /* QPE */ | 39 | /* QPE */ |
39 | #include <qpe/resource.h> | ||
40 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qvbox.h> | 44 | #include <qvbox.h> |
45 | #include <qtabbar.h> | 45 | #include <qtabbar.h> |
46 | #include <qiconview.h> | 46 | #include <qiconview.h> |
47 | #include <qapplication.h> | 47 | #include <qapplication.h> |
48 | #include <qlabel.h> | 48 | #include <qlabel.h> |
49 | #include <qfileinfo.h> | 49 | #include <qfileinfo.h> |
50 | #include <qradiobutton.h> | 50 | #include <qradiobutton.h> |
51 | #include <qbuttongroup.h> | 51 | #include <qbuttongroup.h> |
52 | #include <qwhatsthis.h> | 52 | #include <qwhatsthis.h> |
53 | #include <qcheckbox.h> | 53 | #include <qcheckbox.h> |
54 | #include <qspinbox.h> | 54 | #include <qspinbox.h> |
55 | 55 | ||
56 | 56 | ||
57 | using namespace Opie::Ui; | 57 | using namespace Opie::Ui; |
58 | class SampleItem : public QIconViewItem { | 58 | class SampleItem : public QIconViewItem { |
59 | public: | 59 | public: |
60 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) | 60 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) |
61 | { | 61 | { |
62 | m_large = pix; | 62 | m_large = pix; |
63 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); | 63 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); |
64 | } | 64 | } |
65 | 65 | ||
66 | void sizeChange ( ) | 66 | void sizeChange ( ) |
67 | { | 67 | { |
68 | calcRect ( ); | 68 | calcRect ( ); |
69 | repaint ( ); | 69 | repaint ( ); |
70 | } | 70 | } |
71 | 71 | ||
72 | QPixmap *pixmap ( ) const | 72 | QPixmap *pixmap ( ) const |
73 | { | 73 | { |
74 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) | 74 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) |
75 | return (QPixmap *) &m_small; | 75 | return (QPixmap *) &m_small; |
76 | else | 76 | else |
77 | return (QPixmap *) &m_large; | 77 | return (QPixmap *) &m_large; |
78 | } | 78 | } |
79 | 79 | ||
80 | private: | 80 | private: |
81 | QPixmap m_large, m_small; | 81 | QPixmap m_large, m_small; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | //FIXME: Why not derive SampleView from LauncherView ??? | 84 | //FIXME: Why not derive SampleView from LauncherView ??? |
85 | 85 | ||
86 | class SampleView : public QIconView { | 86 | class SampleView : public QIconView { |
87 | public: | 87 | public: |
88 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) | 88 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) |
89 | { | 89 | { |
90 | setItemsMovable ( false ); | 90 | setItemsMovable ( false ); |
91 | setAutoArrange ( true ); | 91 | setAutoArrange ( true ); |
92 | setSorting ( true ); | 92 | setSorting ( true ); |
93 | setFrameStyle ( QFrame::NoFrame ); | 93 | setFrameStyle ( QFrame::NoFrame ); |
94 | setSpacing ( 4 ); | 94 | setSpacing ( 4 ); |
95 | setMargin ( 0 ); | 95 | setMargin ( 0 ); |
96 | setSelectionMode ( QIconView::NoSelection ); | 96 | setSelectionMode ( QIconView::NoSelection ); |
97 | setBackgroundMode ( PaletteBase ); | 97 | setBackgroundMode ( PaletteBase ); |
98 | setViewMode ( TabConfig::Icon ); | 98 | setViewMode ( TabConfig::Icon ); |
99 | calculateGrid ( Bottom ); | 99 | calculateGrid ( Bottom ); |
100 | 100 | ||
101 | 101 | ||
102 | new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); | 102 | new SampleItem ( this, QObject::tr( "Sample 1" ), |
103 | new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); | 103 | Opie::Core::OResource::loadPixmap ( "datebook/DateBook", Opie::Core::OResource::BigIcon )); |
104 | new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); | 104 | new SampleItem ( this, QObject::tr( "Sample 2" ), |
105 | Opie::Core::OResource::loadPixmap ( "Calibrate", Opie::Core::OResource::BigIcon )); | ||
106 | new SampleItem ( this, QObject::tr( "Sample 3" ), | ||
107 | Opie::Core::OResource::loadPixmap ( "UnknownDocument", Opie::Core::OResource::BigIcon )); | ||
105 | 108 | ||
106 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 109 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
107 | 110 | ||
108 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); | 111 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); |
109 | } | 112 | } |
110 | 113 | ||
111 | void setViewMode ( TabConfig::ViewMode m ) | 114 | void setViewMode ( TabConfig::ViewMode m ) |
112 | { | 115 | { |
113 | viewport ( )-> setUpdatesEnabled ( false ); | 116 | viewport ( )-> setUpdatesEnabled ( false ); |
114 | 117 | ||
115 | switch ( m ) { | 118 | switch ( m ) { |
116 | case TabConfig::List: | 119 | case TabConfig::List: |
117 | setItemTextPos( QIconView::Right ); | 120 | setItemTextPos( QIconView::Right ); |
118 | break; | 121 | break; |
119 | case TabConfig::Icon: | 122 | case TabConfig::Icon: |
120 | setItemTextPos( QIconView::Bottom ); | 123 | setItemTextPos( QIconView::Bottom ); |
121 | break; | 124 | break; |
122 | } | 125 | } |
123 | // hideOrShowItems ( false ); | 126 | // hideOrShowItems ( false ); |
124 | 127 | ||
125 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) | 128 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) |
126 | ((SampleItem *) it )-> sizeChange ( ); | 129 | ((SampleItem *) it )-> sizeChange ( ); |
127 | arrangeItemsInGrid ( true ); | 130 | arrangeItemsInGrid ( true ); |
128 | viewport ( )-> setUpdatesEnabled ( true ); | 131 | viewport ( )-> setUpdatesEnabled ( true ); |
129 | update ( ); | 132 | update ( ); |
130 | } | 133 | } |
131 | 134 | ||
132 | 135 | ||
133 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) | 136 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) |
134 | { | 137 | { |
135 | switch ( t ) { | 138 | switch ( t ) { |
136 | case TabConfig::Ruled: { | 139 | case TabConfig::Ruled: { |
137 | QPixmap bg ( width ( ), 9 ); | 140 | QPixmap bg ( width ( ), 9 ); |
138 | QPainter painter ( &bg ); | 141 | QPainter painter ( &bg ); |
139 | for ( int i = 0; i < 3; i++ ) { | 142 | for ( int i = 0; i < 3; i++ ) { |
140 | painter. setPen ( white ); | 143 | painter. setPen ( white ); |
141 | painter. drawLine ( 0, i*3, width()-1, i*3 ); | 144 | painter. drawLine ( 0, i*3, width()-1, i*3 ); |
142 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); | 145 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); |
143 | painter. setPen ( colorGroup().background().light(105) ); | 146 | painter. setPen ( colorGroup().background().light(105) ); |
144 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); | 147 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); |
145 | } | 148 | } |
146 | painter.end ( ); | 149 | painter.end ( ); |
147 | setBackgroundPixmap ( bg ); | 150 | setBackgroundPixmap ( bg ); |
148 | break; | 151 | break; |
149 | } | 152 | } |
150 | 153 | ||
151 | case TabConfig::SolidColor: { | 154 | case TabConfig::SolidColor: { |
152 | setBackgroundPixmap ( QPixmap ( )); | 155 | setBackgroundPixmap ( QPixmap ( )); |
153 | if ( val. isEmpty ( )) | 156 | if ( val. isEmpty ( )) |
154 | setBackgroundColor ( colorGroup ( ). base ( )); | 157 | setBackgroundColor ( colorGroup ( ). base ( )); |
155 | else | 158 | else |
156 | setBackgroundColor ( val ); | 159 | setBackgroundColor ( val ); |
157 | break; | 160 | break; |
158 | } | 161 | } |
159 | 162 | ||
160 | case TabConfig::Image: { | 163 | case TabConfig::Image: { |
161 | odebug << "Loading image: " << val << "" << oendl; | 164 | odebug << "Loading image: " << val << "" << oendl; |
162 | QPixmap bg = Resource::loadPixmap ( val ); | 165 | QPixmap bg = Opie::Core::OResource::loadPixmap ( val ); |
163 | if ( bg. isNull () ) | 166 | if ( bg. isNull () ) |
164 | bg = QPixmap( val ); | 167 | bg = QPixmap( val ); |
165 | setBackgroundPixmap ( bg ); | 168 | setBackgroundPixmap ( bg ); |
166 | break; | 169 | break; |
167 | } | 170 | } |
168 | } | 171 | } |
169 | m_bgtype = t; | 172 | m_bgtype = t; |
170 | viewport ( )-> update ( ); | 173 | viewport ( )-> update ( ); |
171 | } | 174 | } |
172 | 175 | ||
173 | void setTextColor ( const QColor &tc ) | 176 | void setTextColor ( const QColor &tc ) |
174 | { | 177 | { |
175 | m_textcolor = tc; | 178 | m_textcolor = tc; |
176 | QColorGroup cg = colorGroup ( ); | 179 | QColorGroup cg = colorGroup ( ); |
177 | cg. setColor ( QColorGroup::Text, tc ); | 180 | cg. setColor ( QColorGroup::Text, tc ); |
178 | setPalette ( QPalette ( cg, cg, cg )); | 181 | setPalette ( QPalette ( cg, cg, cg )); |
179 | viewport ( )-> update ( ); | 182 | viewport ( )-> update ( ); |
180 | } | 183 | } |
181 | 184 | ||
182 | void setViewFont ( const QFont &f ) | 185 | void setViewFont ( const QFont &f ) |
183 | { | 186 | { |
184 | setFont ( f ); | 187 | setFont ( f ); |
185 | } | 188 | } |
186 | 189 | ||
187 | void setItemTextPos ( ItemTextPos pos ) | 190 | void setItemTextPos ( ItemTextPos pos ) |
188 | { | 191 | { |
189 | calculateGrid ( pos ); | 192 | calculateGrid ( pos ); |
190 | QIconView::setItemTextPos( pos ); | 193 | QIconView::setItemTextPos( pos ); |
191 | } | 194 | } |
192 | 195 | ||
193 | //FIXME: Add per-tab column handling from launcherview.cpp | 196 | //FIXME: Add per-tab column handling from launcherview.cpp |
194 | void calculateGrid ( ItemTextPos pos ) | 197 | void calculateGrid ( ItemTextPos pos ) |
195 | { | 198 | { |
196 | int dw = QApplication::desktop ( )-> width ( ); | 199 | int dw = QApplication::desktop ( )-> width ( ); |
197 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); | 200 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); |
198 | if ( pos == Bottom ) { | 201 | if ( pos == Bottom ) { |
199 | int cols = 3; | 202 | int cols = 3; |
200 | if ( viewerWidth <= 200 ) | 203 | if ( viewerWidth <= 200 ) |
201 | cols = 2; | 204 | cols = 2; |
202 | else if ( viewerWidth >= 400 ) | 205 | else if ( viewerWidth >= 400 ) |
203 | cols = viewerWidth/96; | 206 | cols = viewerWidth/96; |
204 | setSpacing ( 4 ); | 207 | setSpacing ( 4 ); |
205 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 208 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
206 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); | 209 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); |
207 | } | 210 | } |
208 | else { | 211 | else { |
209 | int cols = 2; | 212 | int cols = 2; |
210 | if ( viewerWidth < 150 ) | 213 | if ( viewerWidth < 150 ) |
211 | cols = 1; | 214 | cols = 1; |
212 | else if ( viewerWidth >= 400 ) | 215 | else if ( viewerWidth >= 400 ) |
213 | cols = viewerWidth / 150; | 216 | cols = viewerWidth / 150; |
214 | setSpacing ( 2 ); | 217 | setSpacing ( 2 ); |
215 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 218 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
216 | setGridY ( fontMetrics ( ). height ( ) + 2 ); | 219 | setGridY ( fontMetrics ( ). height ( ) + 2 ); |
217 | } | 220 | } |
218 | } | 221 | } |
219 | 222 | ||
220 | void paletteChange( const QPalette &p ) | 223 | void paletteChange( const QPalette &p ) |
221 | { | 224 | { |
222 | static bool excllock = false; | 225 | static bool excllock = false; |
223 | 226 | ||
224 | if ( excllock ) | 227 | if ( excllock ) |
225 | return; | 228 | return; |
226 | excllock = true; | 229 | excllock = true; |
227 | 230 | ||
228 | unsetPalette ( ); | 231 | unsetPalette ( ); |
229 | QIconView::paletteChange ( p ); | 232 | QIconView::paletteChange ( p ); |
230 | if ( m_bgtype == TabConfig::Ruled ) | 233 | if ( m_bgtype == TabConfig::Ruled ) |
231 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 234 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
232 | QColorGroup cg = colorGroup ( ); | 235 | QColorGroup cg = colorGroup ( ); |
233 | cg.setColor ( QColorGroup::Text, m_textcolor ); | 236 | cg.setColor ( QColorGroup::Text, m_textcolor ); |
234 | setPalette ( QPalette ( cg, cg, cg )); | 237 | setPalette ( QPalette ( cg, cg, cg )); |
235 | 238 | ||
236 | excllock = false; | 239 | excllock = false; |
237 | } | 240 | } |
238 | 241 | ||
239 | void setBackgroundPixmap ( const QPixmap &pm ) | 242 | void setBackgroundPixmap ( const QPixmap &pm ) |
240 | { | 243 | { |
241 | m_bgpix = pm; | 244 | m_bgpix = pm; |
242 | } | 245 | } |
243 | 246 | ||
244 | void setBackgroundColor ( const QColor &c ) | 247 | void setBackgroundColor ( const QColor &c ) |
245 | { | 248 | { |
246 | m_bgcolor = c; | 249 | m_bgcolor = c; |
247 | } | 250 | } |
248 | 251 | ||
249 | void drawBackground ( QPainter *p, const QRect &r ) | 252 | void drawBackground ( QPainter *p, const QRect &r ) |
250 | { | 253 | { |
251 | if ( !m_bgpix. isNull ( )) { | 254 | if ( !m_bgpix. isNull ( )) { |
252 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 255 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
253 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 256 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
254 | } | 257 | } |
255 | else | 258 | else |
256 | p-> fillRect ( r, m_bgcolor ); | 259 | p-> fillRect ( r, m_bgcolor ); |
257 | } | 260 | } |
258 | 261 | ||
259 | private: | 262 | private: |
260 | QColor m_textcolor; | 263 | QColor m_textcolor; |
261 | QColor m_bgcolor; | 264 | QColor m_bgcolor; |
262 | QPixmap m_bgpix; | 265 | QPixmap m_bgpix; |
263 | TabConfig::BackgroundType m_bgtype; | 266 | TabConfig::BackgroundType m_bgtype; |
264 | }; | 267 | }; |
265 | 268 | ||
266 | 269 | ||
267 | 270 | ||
268 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) | 271 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) |
269 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) | 272 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) |
270 | { | 273 | { |
271 | setCaption ( tr( "Edit Tab" )); | 274 | setCaption ( tr( "Edit Tab" )); |
272 | 275 | ||
273 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); | 276 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); |
274 | 277 | ||
275 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 278 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
276 | QWidget *bgtab; | 279 | QWidget *bgtab; |
277 | 280 | ||
278 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); | 281 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); |
279 | tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); | 282 | tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); |
280 | tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); | 283 | tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); |
281 | 284 | ||
282 | tw-> setCurrentTab ( bgtab ); | 285 | tw-> setCurrentTab ( bgtab ); |
283 | 286 | ||
284 | QWidget *sample = new QVBox ( this ); | 287 | QWidget *sample = new QVBox ( this ); |
285 | QTabBar *tb = new QTabBar ( sample ); | 288 | QTabBar *tb = new QTabBar ( sample ); |
286 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 289 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
287 | 290 | ||
288 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); | 291 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); |
289 | 292 | ||
290 | m_sample = new SampleView ( sample ); | 293 | m_sample = new SampleView ( sample ); |
291 | 294 | ||
292 | lay-> addWidget ( tw, 10 ); | 295 | lay-> addWidget ( tw, 10 ); |
293 | lay-> addWidget ( sample, 1 ); | 296 | lay-> addWidget ( sample, 1 ); |
294 | 297 | ||
295 | m_bgimage = tc. m_bg_image; | 298 | m_bgimage = tc. m_bg_image; |
296 | m_bgtype-> setButton ( tc. m_bg_type ); | 299 | m_bgtype-> setButton ( tc. m_bg_type ); |
297 | bgTypeClicked( tc.m_bg_type ); | 300 | bgTypeClicked( tc.m_bg_type ); |
298 | 301 | ||
299 | m_fontuse-> setChecked ( tc. m_font_use ); | 302 | m_fontuse-> setChecked ( tc. m_font_use ); |
300 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); | 303 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
301 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); | 304 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); |
302 | fontClicked ( m_fontselect-> selectedFont ( )); | 305 | fontClicked ( m_fontselect-> selectedFont ( )); |
303 | 306 | ||
304 | m_iconsize-> setButton ( tc. m_view ); | 307 | m_iconsize-> setButton ( tc. m_view ); |
305 | iconSizeClicked ( tc. m_view ); | 308 | iconSizeClicked ( tc. m_view ); |
306 | iconColorClicked ( m_iconcolor-> color ( )); | 309 | iconColorClicked ( m_iconcolor-> color ( )); |
307 | m_iconcolumns->setValue( tc. m_iconcolumns ); | 310 | m_iconcolumns->setValue( tc. m_iconcolumns ); |
308 | 311 | ||
309 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); | 312 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); |
310 | } | 313 | } |
311 | 314 | ||
312 | 315 | ||
313 | TabDialog::~TabDialog ( ) | 316 | TabDialog::~TabDialog ( ) |
314 | { | 317 | { |
315 | } | 318 | } |
316 | 319 | ||
317 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 320 | QWidget *TabDialog::createFontTab ( QWidget *parent ) |
318 | { | 321 | { |
319 | QWidget *tab = new QWidget ( parent, "FontTab" ); | 322 | QWidget *tab = new QWidget ( parent, "FontTab" ); |
320 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); | 323 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); |
321 | 324 | ||
322 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); | 325 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); |
323 | vertLayout-> addWidget ( m_fontuse ); | 326 | vertLayout-> addWidget ( m_fontuse ); |
324 | 327 | ||
325 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); | 328 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); |
326 | vertLayout-> addWidget ( m_fontselect ); | 329 | vertLayout-> addWidget ( m_fontselect ); |
327 | 330 | ||
328 | connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); | 331 | connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); |
329 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), | 332 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), |
330 | this, SLOT( fontClicked(const QFont&))); | 333 | this, SLOT( fontClicked(const QFont&))); |
331 | 334 | ||
332 | return tab; | 335 | return tab; |
333 | } | 336 | } |
334 | 337 | ||
335 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 338 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
336 | { | 339 | { |
337 | QWidget *tab = new QWidget( parent, "BgTab" ); | 340 | QWidget *tab = new QWidget( parent, "BgTab" ); |
338 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 341 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
339 | 342 | ||
340 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 343 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
341 | gridLayout-> setColStretch ( 1, 10 ); | 344 | gridLayout-> setColStretch ( 1, 10 ); |
342 | 345 | ||
343 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 346 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
344 | gridLayout-> addWidget ( label, 0, 0 ); | 347 | gridLayout-> addWidget ( label, 0, 0 ); |
345 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 348 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
346 | m_bgtype-> hide ( ); | 349 | m_bgtype-> hide ( ); |
347 | m_bgtype-> setExclusive ( true ); | 350 | m_bgtype-> setExclusive ( true ); |
348 | connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); | 351 | connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); |
349 | 352 | ||
350 | QRadioButton *rb; | 353 | QRadioButton *rb; |
351 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 354 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
352 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 355 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
353 | gridLayout-> addWidget( rb, 0, 1 ); | 356 | gridLayout-> addWidget( rb, 0, 1 ); |
354 | 357 | ||
355 | QHBoxLayout *hb = new QHBoxLayout ( ); | 358 | QHBoxLayout *hb = new QHBoxLayout ( ); |
356 | hb-> setSpacing ( 3 ); | 359 | hb-> setSpacing ( 3 ); |
357 | 360 | ||
358 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); | 361 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); |
359 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); | 362 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); |
360 | hb-> addWidget ( rb ); | 363 | hb-> addWidget ( rb ); |
361 | hb-> addSpacing ( 10 ); | 364 | hb-> addSpacing ( 10 ); |
362 | 365 | ||
363 | m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); | 366 | m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); |
364 | connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); | 367 | connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); |
365 | hb-> addWidget ( m_solidcolor ); | 368 | hb-> addWidget ( m_solidcolor ); |
366 | hb-> addStretch ( 10 ); | 369 | hb-> addStretch ( 10 ); |
367 | 370 | ||
368 | gridLayout-> addLayout ( hb, 1, 1 ); | 371 | gridLayout-> addLayout ( hb, 1, 1 ); |
369 | 372 | ||
370 | hb = new QHBoxLayout ( ); | 373 | hb = new QHBoxLayout ( ); |
371 | hb-> setSpacing ( 3 ); | 374 | hb-> setSpacing ( 3 ); |
372 | 375 | ||
373 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); | 376 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); |
374 | m_bgtype-> insert ( rb, TabConfig::Image ); | 377 | m_bgtype-> insert ( rb, TabConfig::Image ); |
375 | hb-> addWidget( rb ); | 378 | hb-> addWidget( rb ); |
376 | hb-> addSpacing ( 10 ); | 379 | hb-> addSpacing ( 10 ); |
377 | 380 | ||
378 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); | 381 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); |
379 | connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked())); | 382 | connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked())); |
380 | hb-> addWidget ( m_imagebrowse ); | 383 | hb-> addWidget ( m_imagebrowse ); |
381 | hb-> addStretch ( 10 ); | 384 | hb-> addStretch ( 10 ); |
382 | 385 | ||
383 | gridLayout-> addLayout ( hb, 2, 1 ); | 386 | gridLayout-> addLayout ( hb, 2, 1 ); |
384 | 387 | ||
385 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); | 388 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); |
386 | connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); | 389 | connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); |
387 | gridLayout-> addWidget ( p, 3, 1 ); | 390 | gridLayout-> addWidget ( p, 3, 1 ); |
388 | 391 | ||
389 | vertLayout-> addStretch ( 10 ); | 392 | vertLayout-> addStretch ( 10 ); |
390 | 393 | ||
391 | return tab; | 394 | return tab; |
392 | } | 395 | } |
393 | 396 | ||
394 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 397 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
395 | { | 398 | { |
396 | QWidget *tab = new QWidget( parent, "IconTab" ); | 399 | QWidget *tab = new QWidget( parent, "IconTab" ); |
397 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 400 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
398 | 401 | ||
399 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 402 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
400 | gridLayout-> setColStretch ( 1, 10 ); | 403 | gridLayout-> setColStretch ( 1, 10 ); |
401 | 404 | ||
402 | QLabel* label = new QLabel( tr( "Size:" ), tab ); | 405 | QLabel* label = new QLabel( tr( "Size:" ), tab ); |
403 | gridLayout-> addWidget ( label, 0, 0 ); | 406 | gridLayout-> addWidget ( label, 0, 0 ); |
404 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); | 407 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); |
405 | m_iconsize-> hide ( ); | 408 | m_iconsize-> hide ( ); |
406 | m_iconsize-> setExclusive ( true ); | 409 | m_iconsize-> setExclusive ( true ); |
407 | 410 | ||
408 | QRadioButton *rb; | 411 | QRadioButton *rb; |
409 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); | 412 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); |
410 | m_iconsize-> insert ( rb, TabConfig::List ); | 413 | m_iconsize-> insert ( rb, TabConfig::List ); |
411 | gridLayout-> addWidget( rb, 0, 1 ); | 414 | gridLayout-> addWidget( rb, 0, 1 ); |
412 | 415 | ||
413 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); | 416 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); |
414 | m_iconsize-> insert ( rb, TabConfig::Icon ); | 417 | m_iconsize-> insert ( rb, TabConfig::Icon ); |
415 | gridLayout-> addWidget( rb, 1, 1 ); | 418 | gridLayout-> addWidget( rb, 1, 1 ); |
416 | connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); | 419 | connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); |
417 | gridLayout-> addRowSpacing ( 2, 8 ); | 420 | gridLayout-> addRowSpacing ( 2, 8 ); |
418 | 421 | ||
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index fca6b20..e7660ef 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp | |||
@@ -1,339 +1,337 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "tabssettings.h" | 28 | #include "tabssettings.h" |
29 | 29 | ||
30 | #include <qpe/resource.h> | 30 | #include <opie2/oresource.h> |
31 | |||
31 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
32 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
33 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
34 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
35 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
36 | 37 | ||
37 | #include <qlistbox.h> | 38 | #include <qlistbox.h> |
38 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
39 | #include <qlayout.h> | 40 | #include <qlayout.h> |
40 | #include <qlabel.h> | 41 | #include <qlabel.h> |
41 | #include <qwhatsthis.h> | 42 | #include <qwhatsthis.h> |
42 | #include <qcheckbox.h> | 43 | #include <qcheckbox.h> |
43 | 44 | ||
44 | #include "tabdialog.h" | 45 | #include "tabdialog.h" |
45 | 46 | ||
46 | #include <stdlib.h> | 47 | #include <stdlib.h> |
47 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
48 | 49 | ||
49 | 50 | ||
50 | #define GLOBALID ".global." | 51 | #define GLOBALID ".global." |
51 | 52 | ||
52 | 53 | ||
53 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) | 54 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) |
54 | : QWidget ( parent, name ) | 55 | : QWidget ( parent, name ) |
55 | { | 56 | { |
56 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); | 57 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); |
57 | 58 | ||
58 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); | 59 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); |
59 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); | 60 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); |
60 | 61 | ||
61 | m_list = new QListBox ( this ); | 62 | m_list = new QListBox ( this ); |
62 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); | 63 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); |
63 | 64 | ||
64 | QWhatsThis::add ( m_list, tr( "foobar" )); | 65 | QWhatsThis::add ( m_list, tr( "foobar" )); |
65 | 66 | ||
66 | QPushButton *p1, *p2, *p3; | 67 | QPushButton *p1, *p2, *p3; |
67 | p1 = new QPushButton ( tr( "New" ), this ); | 68 | p1 = new QPushButton ( tr( "New" ), this ); |
68 | lay-> addWidget ( p1, 1, 1 ); | 69 | lay-> addWidget ( p1, 1, 1 ); |
69 | connect ( p1, SIGNAL( clicked()), this, SLOT( newClicked())); | 70 | connect ( p1, SIGNAL( clicked()), this, SLOT( newClicked())); |
70 | 71 | ||
71 | p2 = new QPushButton ( tr( "Edit" ), this ); | 72 | p2 = new QPushButton ( tr( "Edit" ), this ); |
72 | lay-> addWidget ( p2, 2, 1 ); | 73 | lay-> addWidget ( p2, 2, 1 ); |
73 | connect ( p2, SIGNAL( clicked()), this, SLOT( editClicked())); | 74 | connect ( p2, SIGNAL( clicked()), this, SLOT( editClicked())); |
74 | 75 | ||
75 | p3 = new QPushButton ( tr( "Delete" ), this ); | 76 | p3 = new QPushButton ( tr( "Delete" ), this ); |
76 | lay-> addWidget ( p3, 3, 1 ); | 77 | lay-> addWidget ( p3, 3, 1 ); |
77 | connect ( p3, SIGNAL( clicked()), this, SLOT( deleteClicked())); | 78 | connect ( p3, SIGNAL( clicked()), this, SLOT( deleteClicked())); |
78 | 79 | ||
79 | lay-> setRowStretch ( 4, 10 ); | 80 | lay-> setRowStretch ( 4, 10 ); |
80 | 81 | ||
81 | m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); | 82 | m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); |
82 | lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); | 83 | lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); |
83 | 84 | ||
84 | m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); | 85 | m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); |
85 | lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); | 86 | lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); |
86 | 87 | ||
87 | m_staticbackground = new QCheckBox( tr( "Enable static background pixmap" ), this ); | 88 | m_staticbackground = new QCheckBox( tr( "Enable static background pixmap" ), this ); |
88 | lay->addMultiCellWidget( m_staticbackground, 7, 7, 0, 1 ); | 89 | lay->addMultiCellWidget( m_staticbackground, 7, 7, 0, 1 ); |
89 | 90 | ||
90 | p1-> setEnabled ( false ); | 91 | p1-> setEnabled ( false ); |
91 | p3-> setEnabled ( false ); | 92 | p3-> setEnabled ( false ); |
92 | 93 | ||
93 | init ( ); | 94 | init ( ); |
94 | 95 | ||
95 | QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); | 96 | QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); |
96 | QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); | 97 | QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); |
97 | QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); | 98 | QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); |
98 | QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); | 99 | QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); |
99 | QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); | 100 | QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); |
100 | QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); | 101 | QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); |
101 | QWhatsThis::add ( m_staticbackground, tr( "Activate this, if you want the background pixmap not to scroll with the icons." )); | 102 | QWhatsThis::add ( m_staticbackground, tr( "Activate this, if you want the background pixmap not to scroll with the icons." )); |
102 | } | 103 | } |
103 | 104 | ||
104 | void TabsSettings::init ( ) | 105 | void TabsSettings::init ( ) |
105 | { | 106 | { |
106 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); | 107 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); |
107 | QStringList types = rootFolder. types ( ); | 108 | QStringList types = rootFolder. types ( ); |
108 | 109 | ||
109 | m_list-> insertItem ( tr( "All Tabs" )); | 110 | m_list-> insertItem ( tr( "All Tabs" )); |
110 | m_ids << GLOBALID; | 111 | m_ids << GLOBALID; |
111 | 112 | ||
112 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 113 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
113 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); | 114 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); |
114 | m_ids << *it; | 115 | m_ids << *it; |
115 | } | 116 | } |
116 | QImage img ( Resource::loadImage ( "DocsIcon" )); | 117 | m_list-> insertItem ( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ), tr( "Documents" ) ); |
117 | QPixmap pix; | ||
118 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); | ||
119 | m_list-> insertItem ( pix, tr( "Documents" )); | ||
120 | m_ids += "Documents"; // No tr | 118 | m_ids += "Documents"; // No tr |
121 | 119 | ||
122 | Config cfg ( "Launcher" ); | 120 | Config cfg ( "Launcher" ); |
123 | 121 | ||
124 | readTabSettings ( cfg ); | 122 | readTabSettings ( cfg ); |
125 | 123 | ||
126 | cfg. setGroup ( "GUI" ); | 124 | cfg. setGroup ( "GUI" ); |
127 | m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); | 125 | m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); |
128 | m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); | 126 | m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); |
129 | m_staticbackground->setChecked( cfg.readBoolEntry( "StaticBackground", true ) ); | 127 | m_staticbackground->setChecked( cfg.readBoolEntry( "StaticBackground", true ) ); |
130 | } | 128 | } |
131 | 129 | ||
132 | 130 | ||
133 | void TabsSettings::readTabSettings ( Config &cfg ) | 131 | void TabsSettings::readTabSettings ( Config &cfg ) |
134 | { | 132 | { |
135 | QString grp ( "Tab %1" ); // No tr | 133 | QString grp ( "Tab %1" ); // No tr |
136 | m_tabs. clear ( ); | 134 | m_tabs. clear ( ); |
137 | 135 | ||
138 | TabConfig global_def; | 136 | TabConfig global_def; |
139 | global_def. m_view = TabConfig::Icon; | 137 | global_def. m_view = TabConfig::Icon; |
140 | global_def. m_bg_type = TabConfig::Ruled; | 138 | global_def. m_bg_type = TabConfig::Ruled; |
141 | global_def. m_bg_image = "launcher/opie-background"; | 139 | global_def. m_bg_image = "launcher/opie-background"; |
142 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); | 140 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); |
143 | global_def. m_iconcolumns = 0; // automatic | 141 | global_def. m_iconcolumns = 0; // automatic |
144 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); | 142 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); |
145 | global_def. m_font_use = false; | 143 | global_def. m_font_use = false; |
146 | global_def. m_font_family = font ( ). family ( ); | 144 | global_def. m_font_family = font ( ). family ( ); |
147 | global_def. m_font_size = font ( ). pointSize ( ); | 145 | global_def. m_font_size = font ( ). pointSize ( ); |
148 | global_def. m_font_weight = 50; | 146 | global_def. m_font_weight = 50; |
149 | global_def. m_font_italic = false; | 147 | global_def. m_font_italic = false; |
150 | global_def. m_changed = false; | 148 | global_def. m_changed = false; |
151 | 149 | ||
152 | Config cfg2 = Config( "Launchersettings" ); | 150 | Config cfg2 = Config( "Launchersettings" ); |
153 | 151 | ||
154 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 152 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
155 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; | 153 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; |
156 | 154 | ||
157 | cfg. setGroup ( grp. arg ( *it )); | 155 | cfg. setGroup ( grp. arg ( *it )); |
158 | cfg2. setGroup( grp. arg ( *it )); | 156 | cfg2. setGroup( grp. arg ( *it )); |
159 | 157 | ||
160 | QString view = cfg. readEntry ( "View" ); | 158 | QString view = cfg. readEntry ( "View" ); |
161 | if ( view == "Icon" ) // No tr | 159 | if ( view == "Icon" ) // No tr |
162 | tc. m_view = TabConfig::Icon; | 160 | tc. m_view = TabConfig::Icon; |
163 | if ( view == "List" ) // No tr | 161 | if ( view == "List" ) // No tr |
164 | tc. m_view = TabConfig::List; | 162 | tc. m_view = TabConfig::List; |
165 | 163 | ||
166 | QString bgType = cfg. readEntry ( "BackgroundType" ); | 164 | QString bgType = cfg. readEntry ( "BackgroundType" ); |
167 | if ( bgType == "Image" ) | 165 | if ( bgType == "Image" ) |
168 | tc. m_bg_type = TabConfig::Image; | 166 | tc. m_bg_type = TabConfig::Image; |
169 | else if ( bgType == "SolidColor" ) | 167 | else if ( bgType == "SolidColor" ) |
170 | tc. m_bg_type = TabConfig::SolidColor; | 168 | tc. m_bg_type = TabConfig::SolidColor; |
171 | else if ( bgType == "Image" ) // No tr | 169 | else if ( bgType == "Image" ) // No tr |
172 | tc. m_bg_type = TabConfig::Image; | 170 | tc. m_bg_type = TabConfig::Image; |
173 | 171 | ||
174 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); | 172 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); |
175 | tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" ); | 173 | tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" ); |
176 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); | 174 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); |
177 | tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns ); | 175 | tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns ); |
178 | qDebug( "m_iconcolumns for %s = %d", (const char*) *it, tc.m_iconcolumns ); | 176 | qDebug( "m_iconcolumns for %s = %d", (const char*) *it, tc.m_iconcolumns ); |
179 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); | 177 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); |
180 | QStringList f = cfg. readListEntry ( "Font", ',' ); | 178 | QStringList f = cfg. readListEntry ( "Font", ',' ); |
181 | if ( f. count ( ) == 4 ) { | 179 | if ( f. count ( ) == 4 ) { |
182 | tc. m_font_use = true; | 180 | tc. m_font_use = true; |
183 | tc. m_font_family = f [0]; | 181 | tc. m_font_family = f [0]; |
184 | tc. m_font_size = f [1]. toInt ( ); | 182 | tc. m_font_size = f [1]. toInt ( ); |
185 | tc. m_font_weight = f [2]. toInt ( ); | 183 | tc. m_font_weight = f [2]. toInt ( ); |
186 | tc. m_font_italic = ( f [3]. toInt ( )); | 184 | tc. m_font_italic = ( f [3]. toInt ( )); |
187 | } | 185 | } |
188 | m_tabs [*it] = tc; | 186 | m_tabs [*it] = tc; |
189 | } | 187 | } |
190 | 188 | ||
191 | // if all tabs have the same config, then initialize the GLOBALID tab to these values | 189 | // if all tabs have the same config, then initialize the GLOBALID tab to these values |
192 | 190 | ||
193 | TabConfig *first = 0; | 191 | TabConfig *first = 0; |
194 | bool same = true; | 192 | bool same = true; |
195 | 193 | ||
196 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 194 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
197 | if ( *it == GLOBALID ) | 195 | if ( *it == GLOBALID ) |
198 | continue; | 196 | continue; |
199 | else if ( !first ) | 197 | else if ( !first ) |
200 | first = &m_tabs [*it]; | 198 | first = &m_tabs [*it]; |
201 | else | 199 | else |
202 | same &= ( *first == m_tabs [*it] ); | 200 | same &= ( *first == m_tabs [*it] ); |
203 | } | 201 | } |
204 | if ( same ) { | 202 | if ( same ) { |
205 | m_tabs [GLOBALID] = *first; | 203 | m_tabs [GLOBALID] = *first; |
206 | m_tabs [GLOBALID]. m_changed = true; | 204 | m_tabs [GLOBALID]. m_changed = true; |
207 | } | 205 | } |
208 | } | 206 | } |
209 | 207 | ||
210 | 208 | ||
211 | void TabsSettings::accept ( ) | 209 | void TabsSettings::accept ( ) |
212 | { | 210 | { |
213 | Config cfg ( "Launcher" ); | 211 | Config cfg ( "Launcher" ); |
214 | Config cfg2 ( "Launchersettings" ); | 212 | Config cfg2 ( "Launchersettings" ); |
215 | 213 | ||
216 | // Launcher Tab | 214 | // Launcher Tab |
217 | QString grp ( "Tab %1" ); // No tr | 215 | QString grp ( "Tab %1" ); // No tr |
218 | 216 | ||
219 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 217 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
220 | TabConfig &tc = m_tabs [*it]; | 218 | TabConfig &tc = m_tabs [*it]; |
221 | 219 | ||
222 | if ( !tc. m_changed ) | 220 | if ( !tc. m_changed ) |
223 | continue; | 221 | continue; |
224 | 222 | ||
225 | cfg. setGroup ( grp. arg ( *it )); | 223 | cfg. setGroup ( grp. arg ( *it )); |
226 | cfg2. setGroup ( grp. arg ( *it )); | 224 | cfg2. setGroup ( grp. arg ( *it )); |
227 | switch ( tc. m_view ) { | 225 | switch ( tc. m_view ) { |
228 | case TabConfig::Icon: | 226 | case TabConfig::Icon: |
229 | cfg.writeEntry ( "View", "Icon" ); | 227 | cfg.writeEntry ( "View", "Icon" ); |
230 | break; | 228 | break; |
231 | case TabConfig::List: | 229 | case TabConfig::List: |
232 | cfg.writeEntry ( "View", "List" ); | 230 | cfg.writeEntry ( "View", "List" ); |
233 | break; | 231 | break; |
234 | } | 232 | } |
235 | 233 | ||
236 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); | 234 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); |
237 | e << *it << tc. m_view; | 235 | e << *it << tc. m_view; |
238 | 236 | ||
239 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); | 237 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); |
240 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); | 238 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); |
241 | cfg. writeEntry ( "Columns", tc. m_iconcolumns ); | 239 | cfg. writeEntry ( "Columns", tc. m_iconcolumns ); |
242 | cfg. writeEntry ( "TextColor", tc. m_text_color ); | 240 | cfg. writeEntry ( "TextColor", tc. m_text_color ); |
243 | cfg2. writeEntry ( "DefaultDir", tc.m_last_directory ); | 241 | cfg2. writeEntry ( "DefaultDir", tc.m_last_directory ); |
244 | 242 | ||
245 | if ( tc. m_font_use ) { | 243 | if ( tc. m_font_use ) { |
246 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); | 244 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); |
247 | cfg. writeEntry ( "Font", f ); | 245 | cfg. writeEntry ( "Font", f ); |
248 | } | 246 | } |
249 | else | 247 | else |
250 | cfg. removeEntry ( "Font" ); | 248 | cfg. removeEntry ( "Font" ); |
251 | 249 | ||
252 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); | 250 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); |
253 | 251 | ||
254 | switch ( tc. m_bg_type ) { | 252 | switch ( tc. m_bg_type ) { |
255 | case TabConfig::Ruled: | 253 | case TabConfig::Ruled: |
256 | cfg.writeEntry( "BackgroundType", "Ruled" ); | 254 | cfg.writeEntry( "BackgroundType", "Ruled" ); |
257 | be << *it << tc. m_bg_type << QString(""); | 255 | be << *it << tc. m_bg_type << QString(""); |
258 | break; | 256 | break; |
259 | case TabConfig::SolidColor: | 257 | case TabConfig::SolidColor: |
260 | cfg.writeEntry( "BackgroundType", "SolidColor" ); | 258 | cfg.writeEntry( "BackgroundType", "SolidColor" ); |
261 | be << *it << tc. m_bg_type << tc. m_bg_color; | 259 | be << *it << tc. m_bg_type << tc. m_bg_color; |
262 | break; | 260 | break; |
263 | case TabConfig::Image: | 261 | case TabConfig::Image: |
264 | cfg.writeEntry( "BackgroundType", "Image" ); | 262 | cfg.writeEntry( "BackgroundType", "Image" ); |
265 | be << *it << tc. m_bg_type << tc. m_bg_image; | 263 | be << *it << tc. m_bg_type << tc. m_bg_image; |
266 | break; | 264 | break; |
267 | } | 265 | } |
268 | 266 | ||
269 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); | 267 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); |
270 | te << *it << tc. m_text_color; | 268 | te << *it << tc. m_text_color; |
271 | 269 | ||
272 | QCopEnvelope ic( "QPE/Launcher", "setIconColumns(QString,int)" ); | 270 | QCopEnvelope ic( "QPE/Launcher", "setIconColumns(QString,int)" ); |
273 | ic << *it << tc. m_iconcolumns; | 271 | ic << *it << tc. m_iconcolumns; |
274 | 272 | ||
275 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 273 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); |
276 | fe << *it; | 274 | fe << *it; |
277 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); | 275 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); |
278 | fe << tc. m_font_size; | 276 | fe << tc. m_font_size; |
279 | fe << tc. m_font_weight; | 277 | fe << tc. m_font_weight; |
280 | fe << ( tc. m_font_italic ? 1 : 0 ); | 278 | fe << ( tc. m_font_italic ? 1 : 0 ); |
281 | 279 | ||
282 | tc. m_changed = false; | 280 | tc. m_changed = false; |
283 | } | 281 | } |
284 | cfg. setGroup ( "GUI" ); | 282 | cfg. setGroup ( "GUI" ); |
285 | QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); | 283 | QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); |
286 | cfg. writeEntry ( "BusyType", busytype ); | 284 | cfg. writeEntry ( "BusyType", busytype ); |
287 | cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); | 285 | cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); |
288 | cfg. writeEntry ( "StaticBackground", m_staticbackground->isChecked( ) ); | 286 | cfg. writeEntry ( "StaticBackground", m_staticbackground->isChecked( ) ); |
289 | 287 | ||
290 | { | 288 | { |
291 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); | 289 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); |
292 | e << busytype; | 290 | e << busytype; |
293 | } | 291 | } |
294 | { | 292 | { |
295 | QCopEnvelope e ( "QPE/Launcher", "setStaticBackground(bool)" ); | 293 | QCopEnvelope e ( "QPE/Launcher", "setStaticBackground(bool)" ); |
296 | e << m_staticbackground->isChecked(); | 294 | e << m_staticbackground->isChecked(); |
297 | } | 295 | } |
298 | } | 296 | } |
299 | 297 | ||
300 | void TabsSettings::newClicked ( ) | 298 | void TabsSettings::newClicked ( ) |
301 | { | 299 | { |
302 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 300 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
303 | } | 301 | } |
304 | 302 | ||
305 | void TabsSettings::deleteClicked ( ) | 303 | void TabsSettings::deleteClicked ( ) |
306 | { | 304 | { |
307 | int ind = m_list-> currentItem ( ); | 305 | int ind = m_list-> currentItem ( ); |
308 | 306 | ||
309 | if ( ind < 0 ) | 307 | if ( ind < 0 ) |
310 | return; | 308 | return; |
311 | 309 | ||
312 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 310 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
313 | } | 311 | } |
314 | 312 | ||
315 | void TabsSettings::editClicked ( ) | 313 | void TabsSettings::editClicked ( ) |
316 | { | 314 | { |
317 | int ind = m_list-> currentItem ( ); | 315 | int ind = m_list-> currentItem ( ); |
318 | 316 | ||
319 | if ( ind < 0 ) | 317 | if ( ind < 0 ) |
320 | return; | 318 | return; |
321 | 319 | ||
322 | TabConfig tc = m_tabs [m_ids [ind]]; | 320 | TabConfig tc = m_tabs [m_ids [ind]]; |
323 | 321 | ||
324 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); | 322 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); |
325 | 323 | ||
326 | if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) { | 324 | if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) { |
327 | tc. m_changed = true; | 325 | tc. m_changed = true; |
328 | m_tabs [m_ids [ind]] = tc; | 326 | m_tabs [m_ids [ind]] = tc; |
329 | 327 | ||
330 | if ( m_ids [ind] == GLOBALID ) { | 328 | if ( m_ids [ind] == GLOBALID ) { |
331 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 329 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
332 | if ( *it != GLOBALID ) | 330 | if ( *it != GLOBALID ) |
333 | m_tabs [*it] = tc; | 331 | m_tabs [*it] = tc; |
334 | } | 332 | } |
335 | } | 333 | } |
336 | } | 334 | } |
337 | 335 | ||
338 | delete d; | 336 | delete d; |
339 | } | 337 | } |