-rw-r--r-- | core/settings/launcher/tabconfig.h | 13 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 45 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.h | 2 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 69 | ||||
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 3 |
5 files changed, 86 insertions, 46 deletions
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h index eebfd36..9086341 100644 --- a/core/settings/launcher/tabconfig.h +++ b/core/settings/launcher/tabconfig.h | |||
@@ -1,66 +1,71 @@ | |||
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 | #ifndef __TABCONFIG_H__ | 27 | #ifndef __TABCONFIG_H__ |
28 | #define __TABCONFIG_H__ | 28 | #define __TABCONFIG_H__ |
29 | 29 | ||
30 | struct TabConfig { | 30 | struct TabConfig { |
31 | enum ViewMode { | 31 | enum ViewMode { |
32 | Icon, | 32 | Icon, |
33 | List | 33 | List |
34 | }; | 34 | }; |
35 | enum BackgroundType { | 35 | enum BackgroundType { |
36 | Ruled, | 36 | Ruled, |
37 | SolidColor, | 37 | SolidColor, |
38 | Image | 38 | Image |
39 | }; | 39 | }; |
40 | 40 | ||
41 | ViewMode m_view; | 41 | ViewMode m_view; |
42 | BackgroundType m_bg_type; | 42 | BackgroundType m_bg_type; |
43 | QString m_bg_image; | 43 | QString m_bg_image; |
44 | QString m_bg_color; | 44 | QString m_bg_color; |
45 | QString m_text_color; | 45 | QString m_text_color; |
46 | bool m_font_use; | ||
46 | QString m_font_family; | 47 | QString m_font_family; |
47 | int m_font_size; | 48 | int m_font_size; |
48 | int m_font_weight; | 49 | int m_font_weight; |
49 | bool m_font_italic; | 50 | bool m_font_italic; |
50 | bool m_changed; | 51 | bool m_changed; |
51 | 52 | ||
52 | bool operator == ( const TabConfig &tc ) | 53 | bool operator == ( const TabConfig &tc ) |
53 | { | 54 | { |
54 | return ( m_view == tc. m_view ) && | 55 | return ( m_view == tc. m_view ) && |
55 | ( m_bg_type == tc. m_bg_type ) && | 56 | ( m_bg_type == tc. m_bg_type ) && |
56 | ( m_bg_image == tc. m_bg_image ) && | 57 | ( m_bg_image == tc. m_bg_image ) && |
57 | ( m_bg_color == tc. m_bg_color ) && | 58 | ( m_bg_color == tc. m_bg_color ) && |
58 | ( m_text_color == tc. m_text_color ) && | 59 | ( m_text_color == tc. m_text_color ) && |
59 | ( m_font_family == tc. m_font_family ) && | 60 | ( m_font_use == tc. m_font_use ) && |
60 | ( m_font_size == tc. m_font_size ) && | 61 | ( m_font_use ? ( |
61 | ( m_font_weight == tc. m_font_weight ) && | 62 | ( m_font_family == tc. m_font_family ) && |
62 | ( m_font_italic == tc. m_font_italic ); | 63 | ( m_font_size == tc. m_font_size ) && |
64 | ( m_font_weight == tc. m_font_weight ) && | ||
65 | ( m_font_italic == tc. m_font_italic ) | ||
66 | ) : true ); | ||
67 | |||
63 | } | 68 | } |
64 | }; | 69 | }; |
65 | 70 | ||
66 | #endif | 71 | #endif |
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index a90ba7d..d20412a 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -1,105 +1,106 @@ | |||
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 <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
31 | 31 | ||
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qvbox.h> | 33 | #include <qvbox.h> |
34 | #include <qtabbar.h> | 34 | #include <qtabbar.h> |
35 | #include <qiconview.h> | 35 | #include <qiconview.h> |
36 | #include <qapplication.h> | 36 | #include <qapplication.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qradiobutton.h> | 38 | #include <qradiobutton.h> |
39 | #include <qbuttongroup.h> | 39 | #include <qbuttongroup.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
42 | #include <qcheckbox.h> | ||
42 | 43 | ||
43 | #include <opie/ofontselector.h> | 44 | #include <opie/ofontselector.h> |
44 | #include <opie/otabwidget.h> | 45 | #include <opie/otabwidget.h> |
45 | #include <opie/ocolorbutton.h> | 46 | #include <opie/ocolorbutton.h> |
46 | #include <opie/ofiledialog.h> | 47 | #include <opie/ofiledialog.h> |
47 | 48 | ||
48 | #include "tabdialog.h" | 49 | #include "tabdialog.h" |
49 | 50 | ||
50 | 51 | ||
51 | class SampleItem : public QIconViewItem { | 52 | class SampleItem : public QIconViewItem { |
52 | public: | 53 | public: |
53 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) | 54 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) |
54 | { | 55 | { |
55 | m_large = pix; | 56 | m_large = pix; |
56 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); | 57 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); |
57 | } | 58 | } |
58 | 59 | ||
59 | void sizeChange ( ) | 60 | void sizeChange ( ) |
60 | { | 61 | { |
61 | calcRect ( ); | 62 | calcRect ( ); |
62 | repaint ( ); | 63 | repaint ( ); |
63 | } | 64 | } |
64 | 65 | ||
65 | QPixmap *pixmap ( ) const | 66 | QPixmap *pixmap ( ) const |
66 | { | 67 | { |
67 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) | 68 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) |
68 | return (QPixmap *) &m_small; | 69 | return (QPixmap *) &m_small; |
69 | else | 70 | else |
70 | return (QPixmap *) &m_large; | 71 | return (QPixmap *) &m_large; |
71 | } | 72 | } |
72 | 73 | ||
73 | private: | 74 | private: |
74 | QPixmap m_large, m_small; | 75 | QPixmap m_large, m_small; |
75 | }; | 76 | }; |
76 | 77 | ||
77 | class SampleView : public QIconView { | 78 | class SampleView : public QIconView { |
78 | public: | 79 | public: |
79 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) | 80 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) |
80 | { | 81 | { |
81 | setItemsMovable ( false ); | 82 | setItemsMovable ( false ); |
82 | setAutoArrange ( true ); | 83 | setAutoArrange ( true ); |
83 | setSorting ( true ); | 84 | setSorting ( true ); |
84 | setFrameStyle ( QFrame::NoFrame ); | 85 | setFrameStyle ( QFrame::NoFrame ); |
85 | setSpacing ( 4 ); | 86 | setSpacing ( 4 ); |
86 | setMargin ( 0 ); | 87 | setMargin ( 0 ); |
87 | setSelectionMode ( QIconView::NoSelection ); | 88 | setSelectionMode ( QIconView::NoSelection ); |
88 | setBackgroundMode ( PaletteBase ); | 89 | setBackgroundMode ( PaletteBase ); |
89 | setViewMode ( TabConfig::Icon ); | 90 | setViewMode ( TabConfig::Icon ); |
90 | calculateGrid ( Bottom ); | 91 | calculateGrid ( Bottom ); |
91 | 92 | ||
92 | 93 | ||
93 | new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" )); | 94 | new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" )); |
94 | new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); | 95 | new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); |
95 | new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); | 96 | new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); |
96 | 97 | ||
97 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 98 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
98 | 99 | ||
99 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); | 100 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); |
100 | } | 101 | } |
101 | 102 | ||
102 | void setViewMode ( TabConfig::ViewMode m ) | 103 | void setViewMode ( TabConfig::ViewMode m ) |
103 | { | 104 | { |
104 | viewport ( )-> setUpdatesEnabled ( false ); | 105 | viewport ( )-> setUpdatesEnabled ( false ); |
105 | 106 | ||
@@ -206,296 +207,310 @@ public: | |||
206 | int cols = 2; | 207 | int cols = 2; |
207 | if ( viewerWidth < 150 ) | 208 | if ( viewerWidth < 150 ) |
208 | cols = 1; | 209 | cols = 1; |
209 | else if ( viewerWidth >= 400 ) | 210 | else if ( viewerWidth >= 400 ) |
210 | cols = viewerWidth / 150; | 211 | cols = viewerWidth / 150; |
211 | setSpacing ( 2 ); | 212 | setSpacing ( 2 ); |
212 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 213 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
213 | setGridY ( fontMetrics ( ). height ( ) + 2 ); | 214 | setGridY ( fontMetrics ( ). height ( ) + 2 ); |
214 | } | 215 | } |
215 | } | 216 | } |
216 | 217 | ||
217 | void paletteChange( const QPalette &p ) | 218 | void paletteChange( const QPalette &p ) |
218 | { | 219 | { |
219 | static bool excllock = false; | 220 | static bool excllock = false; |
220 | 221 | ||
221 | if ( excllock ) | 222 | if ( excllock ) |
222 | return; | 223 | return; |
223 | excllock = true; | 224 | excllock = true; |
224 | 225 | ||
225 | unsetPalette ( ); | 226 | unsetPalette ( ); |
226 | QIconView::paletteChange ( p ); | 227 | QIconView::paletteChange ( p ); |
227 | if ( m_bgtype == TabConfig::Ruled ) | 228 | if ( m_bgtype == TabConfig::Ruled ) |
228 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 229 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
229 | QColorGroup cg = colorGroup ( ); | 230 | QColorGroup cg = colorGroup ( ); |
230 | cg.setColor ( QColorGroup::Text, m_textcolor ); | 231 | cg.setColor ( QColorGroup::Text, m_textcolor ); |
231 | setPalette ( QPalette ( cg, cg, cg )); | 232 | setPalette ( QPalette ( cg, cg, cg )); |
232 | 233 | ||
233 | excllock = false; | 234 | excllock = false; |
234 | } | 235 | } |
235 | 236 | ||
236 | void setBackgroundPixmap ( const QPixmap &pm ) | 237 | void setBackgroundPixmap ( const QPixmap &pm ) |
237 | { | 238 | { |
238 | m_bgpix = pm; | 239 | m_bgpix = pm; |
239 | } | 240 | } |
240 | 241 | ||
241 | void setBackgroundColor ( const QColor &c ) | 242 | void setBackgroundColor ( const QColor &c ) |
242 | { | 243 | { |
243 | m_bgcolor = c; | 244 | m_bgcolor = c; |
244 | } | 245 | } |
245 | 246 | ||
246 | void drawBackground ( QPainter *p, const QRect &r ) | 247 | void drawBackground ( QPainter *p, const QRect &r ) |
247 | { | 248 | { |
248 | if ( !m_bgpix. isNull ( )) { | 249 | if ( !m_bgpix. isNull ( )) { |
249 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 250 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
250 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 251 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
251 | } | 252 | } |
252 | else | 253 | else |
253 | p-> fillRect ( r, m_bgcolor ); | 254 | p-> fillRect ( r, m_bgcolor ); |
254 | } | 255 | } |
255 | 256 | ||
256 | private: | 257 | private: |
257 | QColor m_textcolor; | 258 | QColor m_textcolor; |
258 | QColor m_bgcolor; | 259 | QColor m_bgcolor; |
259 | QPixmap m_bgpix; | 260 | QPixmap m_bgpix; |
260 | TabConfig::BackgroundType m_bgtype; | 261 | TabConfig::BackgroundType m_bgtype; |
261 | }; | 262 | }; |
262 | 263 | ||
263 | 264 | ||
264 | 265 | ||
265 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) | 266 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) |
266 | : QDialog ( parent, name, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) | 267 | : QDialog ( parent, name, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) |
267 | { | 268 | { |
268 | setCaption ( tr( "Edit Tab" )); | 269 | setCaption ( tr( "Edit Tab" )); |
269 | 270 | ||
270 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 271 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); |
271 | 272 | ||
272 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 273 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
273 | QWidget *bgtab; | 274 | QWidget *bgtab; |
274 | 275 | ||
275 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); | 276 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); |
276 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); | 277 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); |
277 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); | 278 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); |
278 | 279 | ||
279 | tw-> setCurrentTab ( bgtab ); | 280 | tw-> setCurrentTab ( bgtab ); |
280 | 281 | ||
281 | QWidget *sample = new QVBox ( this ); | 282 | QWidget *sample = new QVBox ( this ); |
282 | QTabBar *tb = new QTabBar ( sample ); | 283 | QTabBar *tb = new QTabBar ( sample ); |
283 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 284 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
284 | 285 | ||
285 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); | 286 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); |
286 | 287 | ||
287 | m_sample = new SampleView ( sample ); | 288 | m_sample = new SampleView ( sample ); |
288 | 289 | ||
289 | lay-> addWidget ( tw, 10 ); | 290 | lay-> addWidget ( tw, 10 ); |
290 | lay-> addWidget ( sample, 1 ); | 291 | lay-> addWidget ( sample, 1 ); |
291 | 292 | ||
292 | m_iconsize-> setButton ( tc. m_view ); | 293 | m_iconsize-> setButton ( tc. m_view ); |
293 | iconSizeClicked ( tc. m_view ); | 294 | iconSizeClicked ( tc. m_view ); |
294 | m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); | 295 | m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); |
295 | iconColorClicked ( m_iconcolor-> color ( )); | 296 | iconColorClicked ( m_iconcolor-> color ( )); |
296 | m_bgtype-> setButton ( tc. m_bg_type ); | 297 | m_bgtype-> setButton ( tc. m_bg_type ); |
297 | m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); | 298 | m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); |
298 | m_bgimage = tc. m_bg_image; | 299 | m_bgimage = tc. m_bg_image; |
299 | bgTypeClicked ( tc. m_bg_type ); | 300 | bgTypeClicked ( tc. m_bg_type ); |
301 | 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 )); | 302 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
303 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); | ||
301 | fontClicked ( m_fontselect-> selectedFont ( )); | 304 | fontClicked ( m_fontselect-> selectedFont ( )); |
302 | 305 | ||
303 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); | 306 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); |
304 | } | 307 | } |
305 | 308 | ||
306 | 309 | ||
307 | TabDialog::~TabDialog ( ) | 310 | TabDialog::~TabDialog ( ) |
308 | { | 311 | { |
309 | } | 312 | } |
310 | 313 | ||
311 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 314 | QWidget *TabDialog::createFontTab ( QWidget *parent ) |
312 | { | 315 | { |
313 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); | 316 | QWidget *tab = new QWidget ( parent, "FontTab" ); |
317 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); | ||
318 | |||
319 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); | ||
320 | vertLayout-> addWidget ( m_fontuse ); | ||
321 | |||
322 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); | ||
323 | vertLayout-> addWidget ( m_fontselect ); | ||
314 | 324 | ||
325 | connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool ))); | ||
315 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), | 326 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), |
316 | this, SLOT( fontClicked ( const QFont & ))); | 327 | this, SLOT( fontClicked ( const QFont & ))); |
317 | 328 | ||
318 | return m_fontselect; | 329 | return tab; |
319 | } | 330 | } |
320 | 331 | ||
321 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 332 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
322 | { | 333 | { |
323 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 334 | QWidget *tab = new QWidget( parent, "BgTab" ); |
324 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 335 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
325 | 336 | ||
326 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 337 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
327 | gridLayout-> setColStretch ( 1, 10 ); | 338 | gridLayout-> setColStretch ( 1, 10 ); |
328 | 339 | ||
329 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 340 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
330 | gridLayout-> addWidget ( label, 0, 0 ); | 341 | gridLayout-> addWidget ( label, 0, 0 ); |
331 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 342 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
332 | m_bgtype-> hide ( ); | 343 | m_bgtype-> hide ( ); |
333 | m_bgtype-> setExclusive ( true ); | 344 | m_bgtype-> setExclusive ( true ); |
334 | 345 | ||
335 | QRadioButton *rb; | 346 | QRadioButton *rb; |
336 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 347 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
337 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 348 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
338 | gridLayout-> addWidget( rb, 0, 1 ); | 349 | gridLayout-> addWidget( rb, 0, 1 ); |
339 | 350 | ||
340 | QHBoxLayout *hb = new QHBoxLayout ( ); | 351 | QHBoxLayout *hb = new QHBoxLayout ( ); |
341 | hb-> setSpacing ( 4 ); | 352 | hb-> setSpacing ( 3 ); |
342 | 353 | ||
343 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); | 354 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); |
344 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); | 355 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); |
345 | hb-> addWidget ( rb ); | 356 | hb-> addWidget ( rb ); |
346 | hb-> addSpacing ( 10 ); | 357 | hb-> addSpacing ( 10 ); |
347 | 358 | ||
348 | m_solidcolor = new OColorButton ( tab ); | 359 | m_solidcolor = new OColorButton ( tab ); |
349 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); | 360 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); |
350 | hb-> addWidget ( m_solidcolor ); | 361 | hb-> addWidget ( m_solidcolor ); |
351 | hb-> addStretch ( 10 ); | 362 | hb-> addStretch ( 10 ); |
352 | 363 | ||
353 | gridLayout-> addLayout ( hb, 1, 1 ); | 364 | gridLayout-> addLayout ( hb, 1, 1 ); |
354 | 365 | ||
355 | hb = new QHBoxLayout ( ); | 366 | hb = new QHBoxLayout ( ); |
356 | hb-> setSpacing ( 4 ); | 367 | hb-> setSpacing ( 3 ); |
357 | 368 | ||
358 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); | 369 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); |
359 | m_bgtype-> insert ( rb, TabConfig::Image ); | 370 | m_bgtype-> insert ( rb, TabConfig::Image ); |
360 | hb-> addWidget( rb ); | 371 | hb-> addWidget( rb ); |
361 | hb-> addSpacing ( 10 ); | 372 | hb-> addSpacing ( 10 ); |
362 | 373 | ||
363 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); | 374 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); |
364 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); | 375 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); |
365 | hb-> addWidget ( m_imagebrowse ); | 376 | hb-> addWidget ( m_imagebrowse ); |
366 | hb-> addStretch ( 10 ); | 377 | hb-> addStretch ( 10 ); |
367 | 378 | ||
368 | gridLayout-> addLayout ( hb, 2, 1 ); | 379 | gridLayout-> addLayout ( hb, 2, 1 ); |
369 | 380 | ||
370 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); | 381 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); |
371 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); | 382 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); |
372 | gridLayout-> addWidget ( p, 3, 1 ); | 383 | gridLayout-> addWidget ( p, 3, 1 ); |
373 | 384 | ||
374 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); | 385 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); |
375 | 386 | ||
376 | vertLayout-> addStretch ( 10 ); | 387 | vertLayout-> addStretch ( 10 ); |
377 | 388 | ||
378 | return tab; | 389 | return tab; |
379 | } | 390 | } |
380 | 391 | ||
381 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 392 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
382 | { | 393 | { |
383 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 394 | QWidget *tab = new QWidget( parent, "IconTab" ); |
384 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 395 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
385 | 396 | ||
386 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 397 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
387 | gridLayout-> setColStretch ( 1, 10 ); | 398 | gridLayout-> setColStretch ( 1, 10 ); |
388 | 399 | ||
389 | QLabel* label = new QLabel( tr( "Size:" ), tab ); | 400 | QLabel* label = new QLabel( tr( "Size:" ), tab ); |
390 | gridLayout-> addWidget ( label, 0, 0 ); | 401 | gridLayout-> addWidget ( label, 0, 0 ); |
391 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); | 402 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); |
392 | m_iconsize-> hide ( ); | 403 | m_iconsize-> hide ( ); |
393 | m_iconsize-> setExclusive ( true ); | 404 | m_iconsize-> setExclusive ( true ); |
394 | 405 | ||
395 | QRadioButton *rb; | 406 | QRadioButton *rb; |
396 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); | 407 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); |
397 | m_iconsize-> insert ( rb, TabConfig::List ); | 408 | m_iconsize-> insert ( rb, TabConfig::List ); |
398 | gridLayout-> addWidget( rb, 0, 1 ); | 409 | gridLayout-> addWidget( rb, 0, 1 ); |
399 | 410 | ||
400 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); | 411 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); |
401 | m_iconsize-> insert ( rb, TabConfig::Icon ); | 412 | m_iconsize-> insert ( rb, TabConfig::Icon ); |
402 | gridLayout-> addWidget( rb, 1, 1 ); | 413 | gridLayout-> addWidget( rb, 1, 1 ); |
403 | 414 | ||
404 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); | 415 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); |
405 | 416 | ||
406 | //vertLayout-> addSpacing ( 8 ); | 417 | //vertLayout-> addSpacing ( 8 ); |
407 | 418 | ||
408 | //gridLayout = new QGridLayout ( vertLayout ); | 419 | //gridLayout = new QGridLayout ( vertLayout ); |
409 | gridLayout-> addRowSpacing ( 2, 8 ); | 420 | gridLayout-> addRowSpacing ( 2, 8 ); |
410 | 421 | ||
411 | label = new QLabel ( tr( "Color:" ), tab ); | 422 | label = new QLabel ( tr( "Color:" ), tab ); |
412 | gridLayout-> addWidget ( label, 3, 0 ); | 423 | gridLayout-> addWidget ( label, 3, 0 ); |
413 | 424 | ||
414 | m_iconcolor = new OColorButton ( tab ); | 425 | m_iconcolor = new OColorButton ( tab ); |
415 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); | 426 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); |
416 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); | 427 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); |
417 | 428 | ||
418 | vertLayout-> addStretch ( 10 ); | 429 | vertLayout-> addStretch ( 10 ); |
419 | 430 | ||
420 | return tab; | 431 | return tab; |
421 | } | 432 | } |
422 | 433 | ||
423 | 434 | ||
424 | void TabDialog::iconSizeClicked ( int s ) | 435 | void TabDialog::iconSizeClicked ( int s ) |
425 | { | 436 | { |
426 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); | 437 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); |
427 | } | 438 | } |
428 | 439 | ||
429 | void TabDialog::fontClicked ( const QFont &f ) | 440 | void TabDialog::fontClicked ( const QFont &f ) |
430 | { | 441 | { |
431 | m_sample-> setViewFont ( f ); | 442 | m_sample-> setViewFont ( f ); |
432 | } | 443 | } |
433 | 444 | ||
434 | void TabDialog::bgTypeClicked ( int t ) | 445 | void TabDialog::bgTypeClicked ( int t ) |
435 | { | 446 | { |
436 | QString s; | 447 | QString s; |
437 | 448 | ||
438 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) | 449 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) |
439 | m_bgtype-> setButton ( t ); | 450 | m_bgtype-> setButton ( t ); |
440 | 451 | ||
441 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); | 452 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); |
442 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); | 453 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); |
443 | 454 | ||
444 | if ( t == TabConfig::SolidColor ) | 455 | if ( t == TabConfig::SolidColor ) |
445 | s = m_solidcolor-> color ( ). name ( ); | 456 | s = m_solidcolor-> color ( ). name ( ); |
446 | else if ( t == TabConfig::Image ) | 457 | else if ( t == TabConfig::Image ) |
447 | s = Resource::findPixmap ( m_bgimage ); | 458 | s = Resource::findPixmap ( m_bgimage ); |
448 | 459 | ||
449 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); | 460 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); |
450 | } | 461 | } |
451 | 462 | ||
452 | void TabDialog::bgColorClicked ( const QColor & ) | 463 | void TabDialog::bgColorClicked ( const QColor & ) |
453 | { | 464 | { |
454 | bgTypeClicked ( TabConfig::SolidColor ); | 465 | bgTypeClicked ( TabConfig::SolidColor ); |
455 | } | 466 | } |
456 | 467 | ||
457 | void TabDialog::iconColorClicked ( const QColor &col ) | 468 | void TabDialog::iconColorClicked ( const QColor &col ) |
458 | { | 469 | { |
459 | m_sample-> setTextColor ( col ); | 470 | m_sample-> setTextColor ( col ); |
460 | } | 471 | } |
461 | 472 | ||
462 | void TabDialog::bgImageClicked ( ) | 473 | void TabDialog::bgImageClicked ( ) |
463 | { | 474 | { |
464 | // ### use OFileSelector here ### | 475 | // ### use OFileSelector here ### |
465 | // this is just a quick c&p from the old appearance app | 476 | // this is just a quick c&p from the old appearance app |
466 | 477 | ||
467 | MimeTypes types; | 478 | MimeTypes types; |
468 | QStringList list; | 479 | QStringList list; |
469 | list << "image/*"; | 480 | list << "image/*"; |
470 | types. insert ( "Images", list ); | 481 | types. insert ( "Images", list ); |
471 | 482 | ||
472 | QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); | 483 | QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); |
473 | if ( !file. isEmpty ( )) { | 484 | if ( !file. isEmpty ( )) { |
474 | m_bgimage = DocLnk ( file ). file ( ); | 485 | m_bgimage = DocLnk ( file ). file ( ); |
475 | bgTypeClicked ( TabConfig::Image ); | 486 | bgTypeClicked ( TabConfig::Image ); |
476 | } | 487 | } |
477 | } | 488 | } |
478 | 489 | ||
479 | void TabDialog::bgDefaultClicked ( ) | 490 | void TabDialog::bgDefaultClicked ( ) |
480 | { | 491 | { |
481 | m_bgimage = "launcher/opie-background"; | 492 | m_bgimage = "launcher/opie-background"; |
482 | bgTypeClicked ( TabConfig::Image ); | 493 | bgTypeClicked ( TabConfig::Image ); |
483 | } | 494 | } |
484 | 495 | ||
485 | void TabDialog::accept ( ) | 496 | void TabDialog::accept ( ) |
486 | { | 497 | { |
487 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); | 498 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); |
488 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); | 499 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); |
489 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); | 500 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); |
490 | m_tc. m_bg_image = m_bgimage; | 501 | m_tc. m_bg_image = m_bgimage; |
491 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); | 502 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); |
503 | |||
504 | m_tc. m_font_use = m_fontuse-> isChecked ( ); | ||
505 | |||
506 | if ( m_tc. m_font_use ) { | ||
507 | QFont f = m_fontselect-> selectedFont ( ); | ||
492 | 508 | ||
493 | QFont f = m_fontselect-> selectedFont ( ); | 509 | m_tc. m_font_family = f. family ( ); |
494 | 510 | m_tc. m_font_size = f. pointSize ( ); | |
495 | m_tc. m_font_family = f. family ( ); | 511 | m_tc. m_font_weight = f. weight ( ); |
496 | m_tc. m_font_size = f. pointSize ( ); | 512 | m_tc. m_font_italic = f. italic ( ); |
497 | m_tc. m_font_weight = f. weight ( ); | 513 | } |
498 | m_tc. m_font_italic = f. italic ( ); | ||
499 | 514 | ||
500 | QDialog::accept ( ); | 515 | QDialog::accept ( ); |
501 | } | 516 | } |
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h index b0afd47..892a3ad 100644 --- a/core/settings/launcher/tabdialog.h +++ b/core/settings/launcher/tabdialog.h | |||
@@ -1,79 +1,81 @@ | |||
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 | #ifndef __TABDIALOG_H__ | 28 | #ifndef __TABDIALOG_H__ |
29 | #define __TABDIALOG_H__ | 29 | #define __TABDIALOG_H__ |
30 | 30 | ||
31 | #include <qdialog.h> | 31 | #include <qdialog.h> |
32 | #include "tabconfig.h" | 32 | #include "tabconfig.h" |
33 | 33 | ||
34 | class QButtonGroup; | 34 | class QButtonGroup; |
35 | class OFontSelector; | 35 | class OFontSelector; |
36 | class SampleView; | 36 | class SampleView; |
37 | class OColorButton; | 37 | class OColorButton; |
38 | class QPushButton; | 38 | class QPushButton; |
39 | class QCheckBox; | ||
39 | 40 | ||
40 | 41 | ||
41 | class TabDialog : public QDialog { | 42 | class TabDialog : public QDialog { |
42 | Q_OBJECT | 43 | Q_OBJECT |
43 | public: | 44 | public: |
44 | TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags = 0 ); | 45 | TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags = 0 ); |
45 | virtual ~TabDialog ( ); | 46 | virtual ~TabDialog ( ); |
46 | 47 | ||
47 | public slots: | 48 | public slots: |
48 | virtual void accept ( ); | 49 | virtual void accept ( ); |
49 | 50 | ||
50 | protected slots: | 51 | protected slots: |
51 | void iconSizeClicked ( int ); | 52 | void iconSizeClicked ( int ); |
52 | void fontClicked ( const QFont & ); | 53 | void fontClicked ( const QFont & ); |
53 | void bgTypeClicked ( int ); | 54 | void bgTypeClicked ( int ); |
54 | void bgColorClicked ( const QColor & ); | 55 | void bgColorClicked ( const QColor & ); |
55 | void iconColorClicked ( const QColor & ); | 56 | void iconColorClicked ( const QColor & ); |
56 | void bgImageClicked ( ); | 57 | void bgImageClicked ( ); |
57 | void bgDefaultClicked ( ); | 58 | void bgDefaultClicked ( ); |
58 | 59 | ||
59 | private: | 60 | private: |
60 | QWidget *createBgTab ( QWidget *parent ); | 61 | QWidget *createBgTab ( QWidget *parent ); |
61 | QWidget *createFontTab ( QWidget *parent ); | 62 | QWidget *createFontTab ( QWidget *parent ); |
62 | QWidget *createIconTab ( QWidget *parent ); | 63 | QWidget *createIconTab ( QWidget *parent ); |
63 | 64 | ||
64 | 65 | ||
65 | private: | 66 | private: |
66 | SampleView *m_sample; | 67 | SampleView *m_sample; |
67 | QButtonGroup *m_iconsize; | 68 | QButtonGroup *m_iconsize; |
68 | OFontSelector *m_fontselect; | 69 | OFontSelector *m_fontselect; |
69 | OColorButton *m_solidcolor; | 70 | OColorButton *m_solidcolor; |
70 | OColorButton *m_iconcolor; | 71 | OColorButton *m_iconcolor; |
71 | QPushButton *m_imagebrowse; | 72 | QPushButton *m_imagebrowse; |
72 | QString m_bgimage; | 73 | QString m_bgimage; |
73 | QButtonGroup *m_bgtype; | 74 | QButtonGroup *m_bgtype; |
75 | QCheckBox *m_fontuse; | ||
74 | 76 | ||
75 | TabConfig &m_tc; | 77 | TabConfig &m_tc; |
76 | }; | 78 | }; |
77 | 79 | ||
78 | 80 | ||
79 | #endif \ No newline at end of file | 81 | #endif \ No newline at end of file |
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index a5afaf2..9d6e8c1 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp | |||
@@ -1,293 +1,310 @@ | |||
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/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | 36 | ||
37 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
38 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
42 | #include <qcheckbox.h> | 42 | #include <qcheckbox.h> |
43 | 43 | ||
44 | #include "tabdialog.h" | 44 | #include "tabdialog.h" |
45 | 45 | ||
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
48 | 48 | ||
49 | 49 | ||
50 | #define GLOBALID "_launchersettings_global_dummy_" | 50 | #define GLOBALID ".global." |
51 | 51 | ||
52 | 52 | ||
53 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) | 53 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) |
54 | : QWidget ( parent, name ) | 54 | : QWidget ( parent, name ) |
55 | { | 55 | { |
56 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); | 56 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); |
57 | 57 | ||
58 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); | 58 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); |
59 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); | 59 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); |
60 | 60 | ||
61 | m_list = new QListBox ( this ); | 61 | m_list = new QListBox ( this ); |
62 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); | 62 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); |
63 | 63 | ||
64 | QWhatsThis::add ( m_list, tr( "foobar" )); | 64 | QWhatsThis::add ( m_list, tr( "foobar" )); |
65 | 65 | ||
66 | QPushButton *p1, *p2, *p3; | 66 | QPushButton *p1, *p2, *p3; |
67 | p1 = new QPushButton ( tr( "New" ), this ); | 67 | p1 = new QPushButton ( tr( "New" ), this ); |
68 | lay-> addWidget ( p1, 1, 1 ); | 68 | lay-> addWidget ( p1, 1, 1 ); |
69 | connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); | 69 | connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); |
70 | 70 | ||
71 | p2 = new QPushButton ( tr( "Edit" ), this ); | 71 | p2 = new QPushButton ( tr( "Edit" ), this ); |
72 | lay-> addWidget ( p2, 2, 1 ); | 72 | lay-> addWidget ( p2, 2, 1 ); |
73 | connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); | 73 | connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); |
74 | 74 | ||
75 | p3 = new QPushButton ( tr( "Delete" ), this ); | 75 | p3 = new QPushButton ( tr( "Delete" ), this ); |
76 | lay-> addWidget ( p3, 3, 1 ); | 76 | lay-> addWidget ( p3, 3, 1 ); |
77 | connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); | 77 | connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); |
78 | 78 | ||
79 | lay-> setRowStretch ( 4, 10 ); | 79 | lay-> setRowStretch ( 4, 10 ); |
80 | 80 | ||
81 | m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this ); | 81 | m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this ); |
82 | lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 ); | 82 | lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 ); |
83 | 83 | ||
84 | p1-> setEnabled ( false ); | 84 | p1-> setEnabled ( false ); |
85 | p3-> setEnabled ( false ); | 85 | p3-> setEnabled ( false ); |
86 | 86 | ||
87 | init ( ); | 87 | init ( ); |
88 | 88 | ||
89 | QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); | 89 | QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); |
90 | 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>." )); | 90 | 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>." )); |
91 | QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); | 91 | QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); |
92 | QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); | 92 | QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); |
93 | QWhatsThis::add ( m_busyblink, tr( "Activate this, if you want a blinking busy indicator for starting applications in the Launcher." )); | 93 | QWhatsThis::add ( m_busyblink, tr( "Activate this, if you want a blinking busy indicator for starting applications in the Launcher." )); |
94 | } | 94 | } |
95 | 95 | ||
96 | void TabsSettings::init ( ) | 96 | void TabsSettings::init ( ) |
97 | { | 97 | { |
98 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); | 98 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); |
99 | QStringList types = rootFolder. types ( ); | 99 | QStringList types = rootFolder. types ( ); |
100 | 100 | ||
101 | m_list-> insertItem ( tr( "All Tabs" )); | 101 | m_list-> insertItem ( tr( "All Tabs" )); |
102 | m_ids << GLOBALID; | 102 | m_ids << GLOBALID; |
103 | 103 | ||
104 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 104 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
105 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); | 105 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); |
106 | m_ids << *it; | 106 | m_ids << *it; |
107 | } | 107 | } |
108 | QImage img ( Resource::loadImage ( "DocsIcon" )); | 108 | QImage img ( Resource::loadImage ( "DocsIcon" )); |
109 | QPixmap pix; | 109 | QPixmap pix; |
110 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); | 110 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); |
111 | m_list-> insertItem ( pix, tr( "Documents" )); | 111 | m_list-> insertItem ( pix, tr( "Documents" )); |
112 | m_ids += "Documents"; // No tr | 112 | m_ids += "Documents"; // No tr |
113 | 113 | ||
114 | Config cfg ( "Launcher" ); | 114 | Config cfg ( "Launcher" ); |
115 | 115 | ||
116 | readTabSettings ( cfg ); | 116 | readTabSettings ( cfg ); |
117 | 117 | ||
118 | cfg. setGroup ( "GUI" ); | 118 | cfg. setGroup ( "GUI" ); |
119 | m_busyblink-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "blink" ); | 119 | m_busyblink-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "blink" ); |
120 | } | 120 | } |
121 | 121 | ||
122 | void TabsSettings::readTabSettings ( Config &cfg ) | 122 | void TabsSettings::readTabSettings ( Config &cfg ) |
123 | { | 123 | { |
124 | QString grp ( "Tab %1" ); // No tr | 124 | QString grp ( "Tab %1" ); // No tr |
125 | m_tabs. clear ( ); | 125 | m_tabs. clear ( ); |
126 | 126 | ||
127 | TabConfig global_def; | ||
128 | global_def. m_view = TabConfig::Icon; | ||
129 | global_def. m_bg_type = TabConfig::Ruled; | ||
130 | global_def. m_bg_image = "launcher/opie-background"; | ||
131 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); | ||
132 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); | ||
133 | global_def. m_font_use = false; | ||
134 | global_def. m_font_family = font ( ). family ( ); | ||
135 | global_def. m_font_size = font ( ). pointSize ( ); | ||
136 | global_def. m_font_weight = 50; | ||
137 | global_def. m_font_italic = false; | ||
138 | global_def. m_changed = false; | ||
139 | |||
140 | |||
127 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 141 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
128 | TabConfig tc; | 142 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; |
129 | tc. m_view = TabConfig::Icon; | ||
130 | tc. m_bg_type = TabConfig::Ruled; | ||
131 | tc. m_changed = false; | ||
132 | 143 | ||
133 | cfg. setGroup ( grp. arg ( *it )); | 144 | cfg. setGroup ( grp. arg ( *it )); |
134 | if ( *it == GLOBALID ) | ||
135 | cfg. clearGroup ( ); | ||
136 | 145 | ||
137 | QString view = cfg. readEntry ( "View", "Icon" ); | 146 | QString view = cfg. readEntry ( "View" ); |
147 | if ( view == "Icon" ) // No tr | ||
148 | tc. m_view = TabConfig::Icon; | ||
138 | if ( view == "List" ) // No tr | 149 | if ( view == "List" ) // No tr |
139 | tc. m_view = TabConfig::List; | 150 | tc. m_view = TabConfig::List; |
140 | 151 | ||
141 | QString bgType = cfg. readEntry ( "BackgroundType", "Image" ); | 152 | QString bgType = cfg. readEntry ( "BackgroundType" ); |
142 | if ( bgType == "SolidColor" ) | 153 | if ( bgType == "Image" ) |
154 | tc. m_bg_type = TabConfig::Image; | ||
155 | else if ( bgType == "SolidColor" ) | ||
143 | tc. m_bg_type = TabConfig::SolidColor; | 156 | tc. m_bg_type = TabConfig::SolidColor; |
144 | else if ( bgType == "Image" ) // No tr | 157 | else if ( bgType == "Image" ) // No tr |
145 | tc. m_bg_type = TabConfig::Image; | 158 | tc. m_bg_type = TabConfig::Image; |
146 | 159 | ||
147 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" ); | 160 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); |
148 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( )); | 161 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); |
149 | tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( )); | 162 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); |
150 | QStringList f = cfg. readListEntry ( "Font", ',' ); | 163 | QStringList f = cfg. readListEntry ( "Font", ',' ); |
151 | if ( f. count ( ) == 4 ) { | 164 | if ( f. count ( ) == 4 ) { |
165 | tc. m_font_use = true; | ||
152 | tc. m_font_family = f [0]; | 166 | tc. m_font_family = f [0]; |
153 | tc. m_font_size = f [1]. toInt ( ); | 167 | tc. m_font_size = f [1]. toInt ( ); |
154 | tc. m_font_weight = f [2]. toInt ( ); | 168 | tc. m_font_weight = f [2]. toInt ( ); |
155 | tc. m_font_italic = ( f [3]. toInt ( )); | 169 | tc. m_font_italic = ( f [3]. toInt ( )); |
156 | } else { | 170 | } |
157 | tc. m_font_family = font ( ). family ( ); | ||
158 | tc. m_font_size = font ( ). pointSize ( ); | ||
159 | tc. m_font_weight = 50; | ||
160 | tc. m_font_italic = false; | ||
161 | } | ||
162 | |||
163 | m_tabs [*it] = tc; | 171 | m_tabs [*it] = tc; |
164 | } | 172 | } |
165 | 173 | ||
166 | // if all tabs have the same config, then initialize the GLOBALID tab to these values | 174 | // if all tabs have the same config, then initialize the GLOBALID tab to these values |
167 | 175 | ||
168 | TabConfig *first = 0; | 176 | TabConfig *first = 0; |
169 | bool same = true; | 177 | bool same = true; |
170 | 178 | ||
171 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 179 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
172 | if ( *it == GLOBALID ) | 180 | if ( *it == GLOBALID ) |
173 | continue; | 181 | continue; |
174 | else if ( !first ) | 182 | else if ( !first ) |
175 | first = &m_tabs [*it]; | 183 | first = &m_tabs [*it]; |
176 | else | 184 | else |
177 | same &= ( *first == m_tabs [*it] ); | 185 | same &= ( *first == m_tabs [*it] ); |
178 | } | 186 | } |
179 | if ( same ) | 187 | if ( same ) { |
180 | m_tabs [GLOBALID] = *first; | 188 | m_tabs [GLOBALID] = *first; |
189 | m_tabs [GLOBALID]. m_changed = true; | ||
190 | } | ||
181 | } | 191 | } |
182 | 192 | ||
183 | 193 | ||
184 | void TabsSettings::accept ( ) | 194 | void TabsSettings::accept ( ) |
185 | { | 195 | { |
186 | Config cfg ( "Launcher" ); | 196 | Config cfg ( "Launcher" ); |
187 | 197 | ||
188 | // Launcher Tab | 198 | // Launcher Tab |
189 | QString grp ( "Tab %1" ); // No tr | 199 | QString grp ( "Tab %1" ); // No tr |
190 | 200 | ||
191 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 201 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
192 | TabConfig &tc = m_tabs [*it]; | 202 | TabConfig &tc = m_tabs [*it]; |
193 | 203 | ||
194 | if ( !tc. m_changed || ( *it == GLOBALID )) | 204 | if ( !tc. m_changed ) |
195 | continue; | 205 | continue; |
196 | 206 | ||
197 | cfg. setGroup ( grp. arg ( *it )); | 207 | cfg. setGroup ( grp. arg ( *it )); |
198 | switch ( tc. m_view ) { | 208 | switch ( tc. m_view ) { |
199 | case TabConfig::Icon: | 209 | case TabConfig::Icon: |
200 | cfg.writeEntry ( "View", "Icon" ); | 210 | cfg.writeEntry ( "View", "Icon" ); |
201 | break; | 211 | break; |
202 | case TabConfig::List: | 212 | case TabConfig::List: |
203 | cfg.writeEntry ( "View", "List" ); | 213 | cfg.writeEntry ( "View", "List" ); |
204 | break; | 214 | break; |
205 | } | 215 | } |
206 | 216 | ||
207 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); | 217 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); |
208 | e << *it << tc. m_view; | 218 | e << *it << tc. m_view; |
209 | 219 | ||
210 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); | 220 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); |
211 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); | 221 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); |
212 | cfg. writeEntry ( "TextColor", tc. m_text_color ); | 222 | cfg. writeEntry ( "TextColor", tc. m_text_color ); |
213 | 223 | ||
214 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); | 224 | if ( tc. m_font_use ) { |
215 | cfg. writeEntry ( "Font", f ); | 225 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); |
226 | cfg. writeEntry ( "Font", f ); | ||
227 | } | ||
228 | else | ||
229 | cfg. removeEntry ( "Font" ); | ||
230 | |||
216 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); | 231 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); |
217 | 232 | ||
218 | switch ( tc. m_bg_type ) { | 233 | switch ( tc. m_bg_type ) { |
219 | case TabConfig::Ruled: | 234 | case TabConfig::Ruled: |
220 | cfg.writeEntry( "BackgroundType", "Ruled" ); | 235 | cfg.writeEntry( "BackgroundType", "Ruled" ); |
221 | be << *it << tc. m_bg_type << QString(""); | 236 | be << *it << tc. m_bg_type << QString(""); |
222 | break; | 237 | break; |
223 | case TabConfig::SolidColor: | 238 | case TabConfig::SolidColor: |
224 | cfg.writeEntry( "BackgroundType", "SolidColor" ); | 239 | cfg.writeEntry( "BackgroundType", "SolidColor" ); |
225 | be << *it << tc. m_bg_type << tc. m_bg_color; | 240 | be << *it << tc. m_bg_type << tc. m_bg_color; |
226 | break; | 241 | break; |
227 | case TabConfig::Image: | 242 | case TabConfig::Image: |
228 | cfg.writeEntry( "BackgroundType", "Image" ); | 243 | cfg.writeEntry( "BackgroundType", "Image" ); |
229 | be << *it << tc. m_bg_type << tc. m_bg_image; | 244 | be << *it << tc. m_bg_type << tc. m_bg_image; |
230 | break; | 245 | break; |
231 | } | 246 | } |
232 | 247 | ||
233 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); | 248 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); |
234 | te << *it << tc. m_text_color; | 249 | te << *it << tc. m_text_color; |
235 | 250 | ||
236 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 251 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); |
237 | fe << *it << tc. m_font_family; | 252 | fe << *it; |
253 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); | ||
238 | fe << tc. m_font_size; | 254 | fe << tc. m_font_size; |
239 | fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 ); | 255 | fe << tc. m_font_weight; |
256 | fe << ( tc. m_font_italic ? 1 : 0 ); | ||
240 | 257 | ||
241 | tc. m_changed = false; | 258 | tc. m_changed = false; |
242 | } | 259 | } |
243 | cfg. setGroup ( "GUI" ); | 260 | cfg. setGroup ( "GUI" ); |
244 | QString busytype = QString ( m_busyblink-> isChecked ( ) ? "blink" : "" ); | 261 | QString busytype = QString ( m_busyblink-> isChecked ( ) ? "blink" : "" ); |
245 | 262 | ||
246 | cfg. writeEntry ( "BusyType", busytype ); | 263 | cfg. writeEntry ( "BusyType", busytype ); |
247 | { | 264 | { |
248 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); | 265 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); |
249 | e << busytype; | 266 | e << busytype; |
250 | } | 267 | } |
251 | } | 268 | } |
252 | 269 | ||
253 | void TabsSettings::newClicked ( ) | 270 | void TabsSettings::newClicked ( ) |
254 | { | 271 | { |
255 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 272 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
256 | } | 273 | } |
257 | 274 | ||
258 | void TabsSettings::deleteClicked ( ) | 275 | void TabsSettings::deleteClicked ( ) |
259 | { | 276 | { |
260 | int ind = m_list-> currentItem ( ); | 277 | int ind = m_list-> currentItem ( ); |
261 | 278 | ||
262 | if ( ind < 0 ) | 279 | if ( ind < 0 ) |
263 | return; | 280 | return; |
264 | 281 | ||
265 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 282 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
266 | } | 283 | } |
267 | 284 | ||
268 | void TabsSettings::editClicked ( ) | 285 | void TabsSettings::editClicked ( ) |
269 | { | 286 | { |
270 | int ind = m_list-> currentItem ( ); | 287 | int ind = m_list-> currentItem ( ); |
271 | 288 | ||
272 | if ( ind < 0 ) | 289 | if ( ind < 0 ) |
273 | return; | 290 | return; |
274 | 291 | ||
275 | TabConfig tc = m_tabs [m_ids [ind]]; | 292 | TabConfig tc = m_tabs [m_ids [ind]]; |
276 | 293 | ||
277 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); | 294 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); |
278 | 295 | ||
279 | d-> showMaximized ( ); | 296 | d-> showMaximized ( ); |
280 | if ( d-> exec ( ) == QDialog::Accepted ) { | 297 | if ( d-> exec ( ) == QDialog::Accepted ) { |
281 | tc. m_changed = true; | 298 | tc. m_changed = true; |
282 | m_tabs [m_ids [ind]] = tc; | 299 | m_tabs [m_ids [ind]] = tc; |
283 | 300 | ||
284 | if ( m_ids [ind] == GLOBALID ) { | 301 | if ( m_ids [ind] == GLOBALID ) { |
285 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 302 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
286 | if ( *it != GLOBALID ) | 303 | if ( *it != GLOBALID ) |
287 | m_tabs [*it] = tc; | 304 | m_tabs [*it] = tc; |
288 | } | 305 | } |
289 | } | 306 | } |
290 | } | 307 | } |
291 | 308 | ||
292 | delete d; | 309 | delete d; |
293 | } | 310 | } |
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp index 5bc5ad2..b3e302a 100644 --- a/core/settings/launcher/taskbarsettings.cpp +++ b/core/settings/launcher/taskbarsettings.cpp | |||
@@ -74,82 +74,83 @@ void TaskbarSettings::init ( ) | |||
74 | cfg. setGroup ( "Applets" ); | 74 | cfg. setGroup ( "Applets" ); |
75 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); | 75 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); |
76 | 76 | ||
77 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; | 77 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; |
78 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); | 78 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); |
79 | 79 | ||
80 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { | 80 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { |
81 | QString name; | 81 | QString name; |
82 | QPixmap icon; | 82 | QPixmap icon; |
83 | TaskbarNamedAppletInterface *iface = 0; | 83 | TaskbarNamedAppletInterface *iface = 0; |
84 | 84 | ||
85 | QLibrary *lib = new QLibrary ( path + "/" + *it ); | 85 | QLibrary *lib = new QLibrary ( path + "/" + *it ); |
86 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); | 86 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); |
87 | if ( iface ) { | 87 | if ( iface ) { |
88 | QString lang = getenv( "LANG" ); | 88 | QString lang = getenv( "LANG" ); |
89 | QTranslator *trans = new QTranslator ( qApp ); | 89 | QTranslator *trans = new QTranslator ( qApp ); |
90 | QString type = (*it). left ((*it). find (".")); | 90 | QString type = (*it). left ((*it). find (".")); |
91 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; | 91 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; |
92 | if ( trans-> load ( tfn )) | 92 | if ( trans-> load ( tfn )) |
93 | qApp-> installTranslator ( trans ); | 93 | qApp-> installTranslator ( trans ); |
94 | else | 94 | else |
95 | delete trans; | 95 | delete trans; |
96 | name = iface-> name ( ); | 96 | name = iface-> name ( ); |
97 | icon = iface-> icon ( ); | 97 | icon = iface-> icon ( ); |
98 | iface-> release ( ); | 98 | iface-> release ( ); |
99 | } | 99 | } |
100 | if ( !iface ) { | 100 | if ( !iface ) { |
101 | lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); | 101 | lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); |
102 | 102 | ||
103 | if ( iface ) { | 103 | if ( iface ) { |
104 | name = (*it). mid ( 3 ); | 104 | name = (*it). mid ( 3 ); |
105 | int sep = name. find( ".so" ); | 105 | int sep = name. find( ".so" ); |
106 | if ( sep > 0 ) | 106 | if ( sep > 0 ) |
107 | name. truncate ( sep ); | 107 | name. truncate ( sep ); |
108 | sep = name. find ( "applet" ); | 108 | sep = name. find ( "applet" ); |
109 | if ( sep == (int) name.length ( ) - 6 ) | 109 | if ( sep == (int) name.length ( ) - 6 ) |
110 | name. truncate ( sep ); | 110 | name. truncate ( sep ); |
111 | name[0] = name[0]. upper ( ); | 111 | name[0] = name[0]. upper ( ); |
112 | iface-> release ( ); | 112 | iface-> release ( ); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | if ( iface ) { | 116 | if ( iface ) { |
117 | QCheckListItem *item; | 117 | QCheckListItem *item; |
118 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 118 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); |
119 | if ( !icon. isNull ( )) | 119 | if ( !icon. isNull ( )) |
120 | item-> setPixmap ( 0, icon ); | 120 | item-> setPixmap ( 0, icon ); |
121 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 121 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); |
122 | m_applets [*it] = item; | 122 | m_applets [*it] = item; |
123 | } | 123 | } |
124 | lib-> unload ( ); | 124 | lib-> unload ( ); |
125 | delete lib; | 125 | delete lib; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | void TaskbarSettings::appletChanged() | 129 | void TaskbarSettings::appletChanged() |
130 | { | 130 | { |
131 | m_applets_changed = true; | 131 | m_applets_changed = true; |
132 | } | 132 | } |
133 | 133 | ||
134 | void TaskbarSettings::accept ( ) | 134 | void TaskbarSettings::accept ( ) |
135 | { | 135 | { |
136 | Config cfg ( "Taskbar" ); | 136 | Config cfg ( "Taskbar" ); |
137 | cfg. setGroup ( "Applets" ); | 137 | cfg. setGroup ( "Applets" ); |
138 | |||
138 | if ( m_applets_changed ) { | 139 | if ( m_applets_changed ) { |
139 | QStringList exclude; | 140 | QStringList exclude; |
140 | QMap <QString, QCheckListItem *>::Iterator it; | 141 | QMap <QString, QCheckListItem *>::Iterator it; |
141 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { | 142 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { |
142 | if ( !(*it)-> isOn ( )) | 143 | if ( !(*it)-> isOn ( )) |
143 | exclude << it. key ( ); | 144 | exclude << it. key ( ); |
144 | } | 145 | } |
145 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); | 146 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); |
146 | } | 147 | } |
147 | cfg. writeEntry ( "SafeMode", false ); | 148 | cfg. writeEntry ( "SafeMode", false ); |
148 | cfg. write ( ); | 149 | cfg. write ( ); |
149 | 150 | ||
150 | if ( m_applets_changed ) { | 151 | if ( m_applets_changed ) { |
151 | QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); | 152 | QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); |
152 | m_applets_changed = false; | 153 | m_applets_changed = false; |
153 | } | 154 | } |
154 | } | 155 | } |
155 | 156 | ||