-rw-r--r-- | core/settings/launcher/launchersettings.cpp | 26 | ||||
-rw-r--r-- | core/settings/launcher/launchersettings.h | 27 | ||||
-rw-r--r-- | core/settings/launcher/main.cpp | 45 | ||||
-rw-r--r-- | core/settings/launcher/tabconfig.h | 26 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 121 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.h | 38 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 49 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.h | 26 | ||||
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 46 | ||||
-rw-r--r-- | core/settings/launcher/taskbarsettings.h | 27 |
10 files changed, 360 insertions, 71 deletions
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp index bcb9913..7a020a0 100644 --- a/core/settings/launcher/launchersettings.cpp +++ b/core/settings/launcher/launchersettings.cpp | |||
@@ -1,41 +1,67 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
1 | 27 | ||
2 | #include <qlayout.h> | 28 | #include <qlayout.h> |
3 | 29 | ||
4 | #include <opie/otabwidget.h> | 30 | #include <opie/otabwidget.h> |
5 | 31 | ||
6 | #include "launchersettings.h" | 32 | #include "launchersettings.h" |
7 | #include "tabssettings.h" | 33 | #include "tabssettings.h" |
8 | #include "taskbarsettings.h" | 34 | #include "taskbarsettings.h" |
9 | 35 | ||
10 | 36 | ||
11 | LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false ) | 37 | LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false ) |
12 | { | 38 | { |
13 | setCaption ( tr( "Launcher Settings" )); | 39 | setCaption ( tr( "Launcher Settings" )); |
14 | 40 | ||
15 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 41 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
16 | 42 | ||
17 | OTabWidget *tw = new OTabWidget ( this, "otab" ); | 43 | OTabWidget *tw = new OTabWidget ( this, "otab" ); |
18 | lay-> addWidget ( tw ); | 44 | lay-> addWidget ( tw ); |
19 | 45 | ||
20 | m_tabs = new TabsSettings ( tw ); | 46 | m_tabs = new TabsSettings ( tw ); |
21 | m_taskbar = new TaskbarSettings ( tw ); | 47 | m_taskbar = new TaskbarSettings ( tw ); |
22 | 48 | ||
23 | tw-> addTab ( m_taskbar, "appearance/styletabicon.png", tr( "Taskbar" )); | 49 | tw-> addTab ( m_taskbar, "appearance/styletabicon.png", tr( "Taskbar" )); |
24 | tw-> addTab ( m_tabs, "appearance/styletabicon.png", tr( "Tabs" )); | 50 | tw-> addTab ( m_tabs, "appearance/styletabicon.png", tr( "Tabs" )); |
25 | 51 | ||
26 | tw-> setCurrentTab ( m_taskbar ); | 52 | tw-> setCurrentTab ( m_taskbar ); |
27 | } | 53 | } |
28 | 54 | ||
29 | void LauncherSettings::accept ( ) | 55 | void LauncherSettings::accept ( ) |
30 | { | 56 | { |
31 | m_taskbar-> accept ( ); | 57 | m_taskbar-> accept ( ); |
32 | m_tabs-> accept ( ); | 58 | m_tabs-> accept ( ); |
33 | 59 | ||
34 | QDialog::accept ( ); | 60 | QDialog::accept ( ); |
35 | } | 61 | } |
36 | 62 | ||
37 | void LauncherSettings::done ( int r ) | 63 | void LauncherSettings::done ( int r ) |
38 | { | 64 | { |
39 | QDialog::done ( r ); | 65 | QDialog::done ( r ); |
40 | close ( ); | 66 | close ( ); |
41 | } | 67 | } |
diff --git a/core/settings/launcher/launchersettings.h b/core/settings/launcher/launchersettings.h index c91c765..09ea933 100644 --- a/core/settings/launcher/launchersettings.h +++ b/core/settings/launcher/launchersettings.h | |||
@@ -1,23 +1,50 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
1 | #ifndef __LAUNCHER_SETTINGS_H__ | 28 | #ifndef __LAUNCHER_SETTINGS_H__ |
2 | #define __LAUNCHER_SETTINGS_H__ | 29 | #define __LAUNCHER_SETTINGS_H__ |
3 | 30 | ||
4 | #include <qdialog.h> | 31 | #include <qdialog.h> |
5 | 32 | ||
6 | class TabsSettings; | 33 | class TabsSettings; |
7 | class TaskbarSettings; | 34 | class TaskbarSettings; |
8 | 35 | ||
9 | class LauncherSettings : public QDialog { | 36 | class LauncherSettings : public QDialog { |
10 | Q_OBJECT | 37 | Q_OBJECT |
11 | 38 | ||
12 | public: | 39 | public: |
13 | LauncherSettings ( ); | 40 | LauncherSettings ( ); |
14 | 41 | ||
15 | virtual void accept ( ); | 42 | virtual void accept ( ); |
16 | virtual void done ( int r ); | 43 | virtual void done ( int r ); |
17 | 44 | ||
18 | private: | 45 | private: |
19 | TabsSettings *m_tabs; | 46 | TabsSettings *m_tabs; |
20 | TaskbarSettings *m_taskbar; | 47 | TaskbarSettings *m_taskbar; |
21 | }; | 48 | }; |
22 | 49 | ||
23 | #endif | 50 | #endif |
diff --git a/core/settings/launcher/main.cpp b/core/settings/launcher/main.cpp index ca7102d..dbcd624 100644 --- a/core/settings/launcher/main.cpp +++ b/core/settings/launcher/main.cpp | |||
@@ -1,35 +1,42 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | =. This file is part of the OPIE Project |
3 | ** | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | ** This file is part of the Qtopia Environment. | 4 | .>+-= |
5 | ** | 5 | _;:, .> :=|. This file is free software; you can |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | ** packaging of this file. | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ** | 10 | ._= =} : or (at your option) any later version. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .%`+i> _;_. |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | ** | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | : .. .:, . . . without even the implied warranty of |
15 | ** | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ** not clear to you. | 17 | ..}^=.= = ; Public License for more details. |
18 | ** | 18 | ++= -. .` .: |
19 | **********************************************************************/ | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
20 | 27 | ||
21 | #include "launchersettings.h" | 28 | #include "launchersettings.h" |
22 | 29 | ||
23 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
24 | 31 | ||
25 | 32 | ||
26 | int main ( int argc, char** argv ) | 33 | int main ( int argc, char** argv ) |
27 | { | 34 | { |
28 | QPEApplication a ( argc,argv ); | 35 | QPEApplication a ( argc,argv ); |
29 | 36 | ||
30 | LauncherSettings dlg; | 37 | LauncherSettings dlg; |
31 | a. showMainWidget ( &dlg ); | 38 | a. showMainWidget ( &dlg ); |
32 | 39 | ||
33 | return a. exec ( ); | 40 | return a. exec ( ); |
34 | } | 41 | } |
35 | 42 | ||
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h index 8f21eb4..1c2e94d 100644 --- a/core/settings/launcher/tabconfig.h +++ b/core/settings/launcher/tabconfig.h | |||
@@ -1,26 +1,52 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
1 | #ifndef __TABCONFIG_H__ | 27 | #ifndef __TABCONFIG_H__ |
2 | #define __TABCONFIG_H__ | 28 | #define __TABCONFIG_H__ |
3 | 29 | ||
4 | struct TabConfig { | 30 | struct TabConfig { |
5 | enum ViewMode { | 31 | enum ViewMode { |
6 | Icon, | 32 | Icon, |
7 | List | 33 | List |
8 | }; | 34 | }; |
9 | enum BackgroundType { | 35 | enum BackgroundType { |
10 | Ruled, | 36 | Ruled, |
11 | SolidColor, | 37 | SolidColor, |
12 | Image | 38 | Image |
13 | }; | 39 | }; |
14 | 40 | ||
15 | ViewMode m_view; | 41 | ViewMode m_view; |
16 | BackgroundType m_bg_type; | 42 | BackgroundType m_bg_type; |
17 | QString m_bg_image; | 43 | QString m_bg_image; |
18 | QString m_bg_color; | 44 | QString m_bg_color; |
19 | QString m_text_color; | 45 | QString m_text_color; |
20 | QString m_font_family; | 46 | QString m_font_family; |
21 | QString m_font_style; | 47 | QString m_font_style; |
22 | int m_font_size; | 48 | int m_font_size; |
23 | bool m_changed; | 49 | bool m_changed; |
24 | }; | 50 | }; |
25 | 51 | ||
26 | #endif | 52 | #endif |
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index ca48e66..86202f0 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -1,393 +1,494 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
1 | 27 | ||
2 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
3 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | #include <qpe/applnk.h> | ||
4 | 31 | ||
5 | #include <qlayout.h> | 32 | #include <qlayout.h> |
6 | #include <qvbox.h> | 33 | #include <qvbox.h> |
7 | #include <qtabbar.h> | 34 | #include <qtabbar.h> |
8 | #include <qiconview.h> | 35 | #include <qiconview.h> |
9 | #include <qapplication.h> | 36 | #include <qapplication.h> |
10 | #include <qlabel.h> | 37 | #include <qlabel.h> |
11 | #include <qradiobutton.h> | 38 | #include <qradiobutton.h> |
12 | #include <qbuttongroup.h> | 39 | #include <qbuttongroup.h> |
40 | #include <qpushbutton.h> | ||
13 | 41 | ||
14 | #include <opie/ofontselector.h> | 42 | #include <opie/ofontselector.h> |
15 | #include <opie/otabwidget.h> | 43 | #include <opie/otabwidget.h> |
16 | #include <opie/ocolorbutton.h> | 44 | #include <opie/ocolorbutton.h> |
45 | #include <opie/ofiledialog.h> | ||
17 | 46 | ||
18 | #include "tabdialog.h" | 47 | #include "tabdialog.h" |
19 | 48 | ||
20 | 49 | ||
21 | class SampleItem : public QIconViewItem { | 50 | class SampleItem : public QIconViewItem { |
22 | public: | 51 | public: |
23 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) | 52 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) |
24 | { | 53 | { |
25 | m_large = pix; | 54 | m_large = pix; |
26 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); | 55 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); |
27 | } | 56 | } |
28 | 57 | ||
29 | void sizeChange ( ) | 58 | void sizeChange ( ) |
30 | { | 59 | { |
31 | calcRect ( ); | 60 | calcRect ( ); |
32 | repaint ( ); | 61 | repaint ( ); |
33 | } | 62 | } |
34 | 63 | ||
35 | QPixmap *pixmap ( ) const | 64 | QPixmap *pixmap ( ) const |
36 | { | 65 | { |
37 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) | 66 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) |
38 | return (QPixmap *) &m_small; | 67 | return (QPixmap *) &m_small; |
39 | else | 68 | else |
40 | return (QPixmap *) &m_large; | 69 | return (QPixmap *) &m_large; |
41 | } | 70 | } |
71 | |||
42 | private: | 72 | private: |
43 | QPixmap m_large, m_small; | 73 | QPixmap m_large, m_small; |
44 | }; | 74 | }; |
45 | 75 | ||
46 | class SampleView : public QIconView { | 76 | class SampleView : public QIconView { |
47 | public: | 77 | public: |
48 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) | 78 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) |
49 | { | 79 | { |
50 | setItemsMovable ( false ); | 80 | setItemsMovable ( false ); |
51 | setAutoArrange ( true ); | 81 | setAutoArrange ( true ); |
52 | setSorting ( true ); | 82 | setSorting ( true ); |
53 | setFrameStyle ( QFrame::NoFrame ); | 83 | setFrameStyle ( QFrame::NoFrame ); |
54 | setSpacing ( 4 ); | 84 | setSpacing ( 4 ); |
55 | setMargin ( 0 ); | 85 | setMargin ( 0 ); |
56 | setSelectionMode ( QIconView::NoSelection ); | 86 | setSelectionMode ( QIconView::NoSelection ); |
57 | setBackgroundMode ( PaletteBase ); | 87 | setBackgroundMode ( PaletteBase ); |
58 | setViewMode ( TabConfig::Icon ); | 88 | setViewMode ( TabConfig::Icon ); |
59 | calculateGrid ( Bottom ); | 89 | calculateGrid ( Bottom ); |
60 | 90 | ||
61 | 91 | ||
62 | new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" )); | 92 | new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" )); |
63 | new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); | 93 | new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); |
64 | new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); | 94 | new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); |
65 | 95 | ||
66 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 96 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
67 | 97 | ||
68 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); | 98 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); |
69 | } | 99 | } |
70 | 100 | ||
71 | void setViewMode ( TabConfig::ViewMode m ) | 101 | void setViewMode ( TabConfig::ViewMode m ) |
72 | { | 102 | { |
73 | viewport ( )-> setUpdatesEnabled ( false ); | 103 | viewport ( )-> setUpdatesEnabled ( false ); |
74 | 104 | ||
75 | switch ( m ) { | 105 | switch ( m ) { |
76 | case TabConfig::List: | 106 | case TabConfig::List: |
77 | setItemTextPos( QIconView::Right ); | 107 | setItemTextPos( QIconView::Right ); |
78 | break; | 108 | break; |
79 | case TabConfig::Icon: | 109 | case TabConfig::Icon: |
80 | setItemTextPos( QIconView::Bottom ); | 110 | setItemTextPos( QIconView::Bottom ); |
81 | break; | 111 | break; |
82 | } | 112 | } |
83 | // hideOrShowItems ( false ); | 113 | // hideOrShowItems ( false ); |
84 | 114 | ||
85 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) | 115 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) |
86 | ((SampleItem *) it )-> sizeChange ( ); | 116 | ((SampleItem *) it )-> sizeChange ( ); |
87 | arrangeItemsInGrid ( true ); | 117 | arrangeItemsInGrid ( true ); |
88 | viewport ( )-> setUpdatesEnabled ( true ); | 118 | viewport ( )-> setUpdatesEnabled ( true ); |
89 | update ( ); | 119 | update ( ); |
90 | } | 120 | } |
91 | 121 | ||
92 | 122 | ||
93 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) | 123 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) |
94 | { | 124 | { |
95 | switch ( t ) { | 125 | switch ( t ) { |
96 | case TabConfig::Ruled: { | 126 | case TabConfig::Ruled: { |
97 | QPixmap bg ( width ( ), 9 ); | 127 | QPixmap bg ( width ( ), 9 ); |
98 | QPainter painter ( &bg ); | 128 | QPainter painter ( &bg ); |
99 | for ( int i = 0; i < 3; i++ ) { | 129 | for ( int i = 0; i < 3; i++ ) { |
100 | painter. setPen ( white ); | 130 | painter. setPen ( white ); |
101 | painter. drawLine ( 0, i*3, width()-1, i*3 ); | 131 | painter. drawLine ( 0, i*3, width()-1, i*3 ); |
102 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); | 132 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); |
103 | painter. setPen ( colorGroup().background().light(105) ); | 133 | painter. setPen ( colorGroup().background().light(105) ); |
104 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); | 134 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); |
105 | } | 135 | } |
106 | painter.end ( ); | 136 | painter.end ( ); |
107 | setBackgroundPixmap ( bg ); | 137 | setBackgroundPixmap ( bg ); |
108 | break; | 138 | break; |
109 | } | 139 | } |
110 | 140 | ||
111 | case TabConfig::SolidColor: { | 141 | case TabConfig::SolidColor: { |
112 | setBackgroundPixmap ( QPixmap ( )); | 142 | setBackgroundPixmap ( QPixmap ( )); |
113 | if ( val. isEmpty ( )) | 143 | if ( val. isEmpty ( )) |
114 | setBackgroundColor ( colorGroup ( ). base ( )); | 144 | setBackgroundColor ( colorGroup ( ). base ( )); |
115 | else | 145 | else |
116 | setBackgroundColor ( val ); | 146 | setBackgroundColor ( val ); |
117 | break; | 147 | break; |
118 | } | 148 | } |
119 | 149 | ||
120 | case TabConfig::Image: { | 150 | case TabConfig::Image: { |
121 | qDebug( "Loading image: %s", val.latin1() ); | 151 | qDebug( "Loading image: %s", val.latin1() ); |
122 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); | 152 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); |
123 | if ( bg. isNull ( )) { | 153 | if ( bg. isNull ( )) { |
124 | QImageIO imgio; | 154 | QImageIO imgio; |
125 | imgio. setFileName ( val ); | 155 | imgio. setFileName ( val ); |
126 | QSize ds = qApp-> desktop ( )-> size ( ); | 156 | QSize ds = qApp-> desktop ( )-> size ( ); |
127 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr | 157 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr |
128 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); | 158 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); |
129 | imgio. read ( ); | 159 | imgio. read ( ); |
130 | bg = imgio. image ( ); | 160 | bg = imgio. image ( ); |
131 | } | 161 | } |
132 | setBackgroundPixmap ( bg ); | 162 | setBackgroundPixmap ( bg ); |
133 | break; | 163 | break; |
134 | } | 164 | } |
135 | } | 165 | } |
136 | m_bgtype = t; | 166 | m_bgtype = t; |
137 | viewport ( )-> update ( ); | 167 | viewport ( )-> update ( ); |
138 | } | 168 | } |
139 | 169 | ||
140 | void setTextColor ( const QColor &tc ) | 170 | void setTextColor ( const QColor &tc ) |
141 | { | 171 | { |
142 | m_textcolor = tc; | 172 | m_textcolor = tc; |
143 | QColorGroup cg = colorGroup ( ); | 173 | QColorGroup cg = colorGroup ( ); |
144 | cg. setColor ( QColorGroup::Text, tc ); | 174 | cg. setColor ( QColorGroup::Text, tc ); |
145 | setPalette ( QPalette ( cg, cg, cg )); | 175 | setPalette ( QPalette ( cg, cg, cg )); |
146 | viewport ( )-> update ( ); | 176 | viewport ( )-> update ( ); |
147 | } | 177 | } |
148 | 178 | ||
149 | void setViewFont ( const QFont &f ) | 179 | void setViewFont ( const QFont &f ) |
150 | { | 180 | { |
151 | setFont ( f ); | 181 | setFont ( f ); |
152 | } | 182 | } |
153 | 183 | ||
154 | void setItemTextPos ( ItemTextPos pos ) | 184 | void setItemTextPos ( ItemTextPos pos ) |
155 | { | 185 | { |
156 | calculateGrid ( pos ); | 186 | calculateGrid ( pos ); |
157 | QIconView::setItemTextPos( pos ); | 187 | QIconView::setItemTextPos( pos ); |
158 | } | 188 | } |
159 | 189 | ||
160 | void calculateGrid ( ItemTextPos pos ) | 190 | void calculateGrid ( ItemTextPos pos ) |
161 | { | 191 | { |
162 | int dw = QApplication::desktop ( )-> width ( ); | 192 | int dw = QApplication::desktop ( )-> width ( ); |
163 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); | 193 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); |
164 | if ( pos == Bottom ) { | 194 | if ( pos == Bottom ) { |
165 | int cols = 3; | 195 | int cols = 3; |
166 | if ( viewerWidth <= 200 ) | 196 | if ( viewerWidth <= 200 ) |
167 | cols = 2; | 197 | cols = 2; |
168 | else if ( viewerWidth >= 400 ) | 198 | else if ( viewerWidth >= 400 ) |
169 | cols = viewerWidth/96; | 199 | cols = viewerWidth/96; |
170 | setSpacing ( 4 ); | 200 | setSpacing ( 4 ); |
171 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 201 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
172 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); | 202 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); |
173 | } | 203 | } |
174 | else { | 204 | else { |
175 | int cols = 2; | 205 | int cols = 2; |
176 | if ( viewerWidth < 150 ) | 206 | if ( viewerWidth < 150 ) |
177 | cols = 1; | 207 | cols = 1; |
178 | else if ( viewerWidth >= 400 ) | 208 | else if ( viewerWidth >= 400 ) |
179 | cols = viewerWidth / 150; | 209 | cols = viewerWidth / 150; |
180 | setSpacing ( 2 ); | 210 | setSpacing ( 2 ); |
181 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 211 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
182 | setGridY ( fontMetrics ( ). height ( ) + 2 ); | 212 | setGridY ( fontMetrics ( ). height ( ) + 2 ); |
183 | } | 213 | } |
184 | } | 214 | } |
185 | 215 | ||
186 | void paletteChange( const QPalette &p ) | 216 | void paletteChange( const QPalette &p ) |
187 | { | 217 | { |
218 | static bool excllock = false; | ||
219 | |||
220 | if ( excllock ) | ||
221 | return; | ||
222 | excllock = true; | ||
223 | |||
188 | unsetPalette ( ); | 224 | unsetPalette ( ); |
189 | QIconView::paletteChange ( p ); | 225 | QIconView::paletteChange ( p ); |
190 | if ( m_bgtype == TabConfig::Ruled ) | 226 | if ( m_bgtype == TabConfig::Ruled ) |
191 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 227 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
192 | QColorGroup cg = colorGroup ( ); | 228 | QColorGroup cg = colorGroup ( ); |
193 | cg.setColor ( QColorGroup::Text, m_textcolor ); | 229 | cg.setColor ( QColorGroup::Text, m_textcolor ); |
194 | setPalette ( QPalette ( cg, cg, cg )); | 230 | setPalette ( QPalette ( cg, cg, cg )); |
231 | |||
232 | excllock = false; | ||
195 | } | 233 | } |
196 | 234 | ||
197 | void setBackgroundPixmap ( const QPixmap &pm ) | 235 | void setBackgroundPixmap ( const QPixmap &pm ) |
198 | { | 236 | { |
199 | m_bgpix = pm; | 237 | m_bgpix = pm; |
200 | } | 238 | } |
201 | 239 | ||
202 | void setBackgroundColor ( const QColor &c ) | 240 | void setBackgroundColor ( const QColor &c ) |
203 | { | 241 | { |
204 | m_bgcolor = c; | 242 | m_bgcolor = c; |
205 | } | 243 | } |
206 | 244 | ||
207 | void drawBackground ( QPainter *p, const QRect &r ) | 245 | void drawBackground ( QPainter *p, const QRect &r ) |
208 | { | 246 | { |
209 | if ( !m_bgpix. isNull ( )) { | 247 | if ( !m_bgpix. isNull ( )) { |
210 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 248 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
211 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 249 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
212 | } | 250 | } |
213 | else | 251 | else |
214 | p-> fillRect ( r, m_bgcolor ); | 252 | p-> fillRect ( r, m_bgcolor ); |
215 | } | 253 | } |
216 | 254 | ||
217 | private: | 255 | private: |
218 | QColor m_textcolor; | 256 | QColor m_textcolor; |
219 | QColor m_bgcolor; | 257 | QColor m_bgcolor; |
220 | QPixmap m_bgpix; | 258 | QPixmap m_bgpix; |
221 | TabConfig::BackgroundType m_bgtype; | 259 | TabConfig::BackgroundType m_bgtype; |
222 | }; | 260 | }; |
223 | 261 | ||
224 | 262 | ||
225 | 263 | ||
226 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) | 264 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) |
227 | : QDialog ( parent, name, modal, fl ), m_tc ( tc ) | 265 | : QDialog ( parent, name, modal, fl ), m_tc ( tc ) |
228 | { | 266 | { |
229 | setCaption ( tr( "Edit Tab" )); | 267 | setCaption ( tr( "Edit Tab" )); |
230 | 268 | ||
231 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 269 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
232 | 270 | ||
233 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 271 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
234 | QWidget *bgtab; | 272 | QWidget *bgtab; |
235 | 273 | ||
236 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); | 274 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); |
237 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); | 275 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); |
238 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); | 276 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); |
239 | 277 | ||
240 | tw-> setCurrentTab ( bgtab ); | 278 | tw-> setCurrentTab ( bgtab ); |
241 | 279 | ||
242 | QWidget *sample = new QVBox ( this ); | 280 | QWidget *sample = new QVBox ( this ); |
243 | QTabBar *tb = new QTabBar ( sample ); | 281 | QTabBar *tb = new QTabBar ( sample ); |
244 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 282 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
245 | 283 | ||
246 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); | 284 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); |
247 | 285 | ||
248 | m_sample = new SampleView ( sample ); | 286 | m_sample = new SampleView ( sample ); |
249 | 287 | ||
250 | lay-> addWidget ( tw, 10 ); | 288 | lay-> addWidget ( tw, 10 ); |
251 | lay-> addWidget ( sample, 1 ); | 289 | lay-> addWidget ( sample, 1 ); |
252 | 290 | ||
253 | m_iconsize-> setButton ( tc. m_view ); | 291 | m_iconsize-> setButton ( tc. m_view ); |
254 | iconSizeClicked ( tc. m_view ); | 292 | iconSizeClicked ( tc. m_view ); |
293 | m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); | ||
294 | iconColorClicked ( m_iconcolor-> color ( )); | ||
255 | m_bgtype-> setButton ( tc. m_bg_type ); | 295 | m_bgtype-> setButton ( tc. m_bg_type ); |
256 | m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); | 296 | m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); |
297 | m_bgimage = tc. m_bg_image; | ||
257 | bgTypeClicked ( tc. m_bg_type ); | 298 | bgTypeClicked ( tc. m_bg_type ); |
258 | m_fontselect-> setSelectedFont ( tc. m_font_family, tc. m_font_style, tc. m_font_size ); | 299 | m_fontselect-> setSelectedFont ( tc. m_font_family, tc. m_font_style, tc. m_font_size ); |
259 | fontClicked ( m_fontselect-> selectedFont ( )); | 300 | fontClicked ( m_fontselect-> selectedFont ( )); |
260 | } | 301 | } |
261 | 302 | ||
262 | 303 | ||
263 | TabDialog::~TabDialog ( ) | 304 | TabDialog::~TabDialog ( ) |
264 | { | 305 | { |
265 | } | 306 | } |
266 | 307 | ||
267 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 308 | QWidget *TabDialog::createFontTab ( QWidget *parent ) |
268 | { | 309 | { |
269 | m_fontselect = new OFontSelector ( parent, "FontTab" ); | 310 | m_fontselect = new OFontSelector ( parent, "FontTab" ); |
270 | 311 | ||
271 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), | 312 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), |
272 | this, SLOT( fontClicked ( const QFont & ))); | 313 | this, SLOT( fontClicked ( const QFont & ))); |
273 | 314 | ||
274 | return m_fontselect; | 315 | return m_fontselect; |
275 | } | 316 | } |
276 | 317 | ||
277 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 318 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
278 | { | 319 | { |
279 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 320 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); |
280 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 321 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); |
281 | 322 | ||
282 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 323 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
283 | gridLayout-> setColStretch ( 1, 10 ); | 324 | gridLayout-> setColStretch ( 1, 10 ); |
284 | 325 | ||
285 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 326 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
286 | gridLayout-> addWidget ( label, 0, 0 ); | 327 | gridLayout-> addWidget ( label, 0, 0 ); |
287 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 328 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
288 | m_bgtype-> hide ( ); | 329 | m_bgtype-> hide ( ); |
289 | m_bgtype-> setExclusive ( true ); | 330 | m_bgtype-> setExclusive ( true ); |
290 | 331 | ||
291 | QRadioButton *rb; | 332 | QRadioButton *rb; |
292 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 333 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
293 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 334 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
294 | gridLayout-> addWidget( rb, 0, 1 ); | 335 | gridLayout-> addWidget( rb, 0, 1 ); |
295 | 336 | ||
296 | QHBoxLayout *hb = new QHBoxLayout ( ); | 337 | QHBoxLayout *hb = new QHBoxLayout ( ); |
297 | hb-> setSpacing ( 4 ); | 338 | hb-> setSpacing ( 4 ); |
298 | 339 | ||
299 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); | 340 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); |
300 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); | 341 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); |
301 | hb-> addWidget ( rb ); | 342 | hb-> addWidget ( rb ); |
302 | hb-> addSpacing ( 10 ); | 343 | hb-> addSpacing ( 10 ); |
303 | 344 | ||
304 | m_solidcolor = new OColorButton ( tab ); | 345 | m_solidcolor = new OColorButton ( tab ); |
305 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( colorClicked ( const QColor & ))); | 346 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); |
306 | hb-> addWidget ( m_solidcolor ); | 347 | hb-> addWidget ( m_solidcolor ); |
348 | hb-> addStretch ( 10 ); | ||
307 | 349 | ||
308 | gridLayout-> addLayout ( hb, 1, 1 ); | 350 | gridLayout-> addLayout ( hb, 1, 1 ); |
309 | 351 | ||
310 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); | 352 | hb = new QHBoxLayout ( ); |
353 | hb-> setSpacing ( 4 ); | ||
354 | |||
355 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); | ||
311 | m_bgtype-> insert ( rb, TabConfig::Image ); | 356 | m_bgtype-> insert ( rb, TabConfig::Image ); |
312 | gridLayout-> addWidget( rb, 3, 1 ); | 357 | hb-> addWidget( rb ); |
358 | hb-> addSpacing ( 10 ); | ||
359 | |||
360 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); | ||
361 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); | ||
362 | hb-> addWidget ( m_imagebrowse ); | ||
363 | hb-> addStretch ( 10 ); | ||
364 | |||
365 | gridLayout-> addLayout ( hb, 2, 1 ); | ||
313 | 366 | ||
314 | //QPushButton *p; | 367 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); |
368 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); | ||
369 | gridLayout-> addWidget ( p, 3, 1 ); | ||
315 | 370 | ||
316 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); | 371 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); |
317 | 372 | ||
318 | vertLayout-> addStretch ( 10 ); | 373 | vertLayout-> addStretch ( 10 ); |
319 | 374 | ||
320 | return tab; | 375 | return tab; |
321 | } | 376 | } |
322 | 377 | ||
323 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 378 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
324 | { | 379 | { |
325 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 380 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); |
326 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 381 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); |
327 | 382 | ||
328 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 383 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
329 | gridLayout-> setColStretch ( 1, 10 ); | 384 | gridLayout-> setColStretch ( 1, 10 ); |
330 | 385 | ||
331 | QLabel* label = new QLabel( tr( "Size:" ), tab ); | 386 | QLabel* label = new QLabel( tr( "Size:" ), tab ); |
332 | gridLayout-> addWidget ( label, 0, 0 ); | 387 | gridLayout-> addWidget ( label, 0, 0 ); |
333 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); | 388 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); |
334 | m_iconsize-> hide ( ); | 389 | m_iconsize-> hide ( ); |
335 | m_iconsize-> setExclusive ( true ); | 390 | m_iconsize-> setExclusive ( true ); |
336 | 391 | ||
337 | QRadioButton *rb; | 392 | QRadioButton *rb; |
338 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); | 393 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); |
339 | m_iconsize-> insert ( rb, TabConfig::List ); | 394 | m_iconsize-> insert ( rb, TabConfig::List ); |
340 | gridLayout-> addWidget( rb, 0, 1 ); | 395 | gridLayout-> addWidget( rb, 0, 1 ); |
341 | 396 | ||
342 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); | 397 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); |
343 | m_iconsize-> insert ( rb, TabConfig::Icon ); | 398 | m_iconsize-> insert ( rb, TabConfig::Icon ); |
344 | gridLayout-> addWidget( rb, 1, 1 ); | 399 | gridLayout-> addWidget( rb, 1, 1 ); |
345 | 400 | ||
346 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); | 401 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); |
347 | 402 | ||
403 | //vertLayout-> addSpacing ( 8 ); | ||
404 | |||
405 | //gridLayout = new QGridLayout ( vertLayout ); | ||
406 | gridLayout-> addRowSpacing ( 2, 8 ); | ||
407 | |||
408 | label = new QLabel ( tr( "Color:" ), tab ); | ||
409 | gridLayout-> addWidget ( label, 3, 0 ); | ||
410 | |||
411 | m_iconcolor = new OColorButton ( tab ); | ||
412 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); | ||
413 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); | ||
414 | |||
348 | vertLayout-> addStretch ( 10 ); | 415 | vertLayout-> addStretch ( 10 ); |
349 | 416 | ||
350 | return tab; | 417 | return tab; |
351 | } | 418 | } |
352 | 419 | ||
353 | 420 | ||
354 | void TabDialog::iconSizeClicked ( int s ) | 421 | void TabDialog::iconSizeClicked ( int s ) |
355 | { | 422 | { |
356 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); | 423 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); |
357 | } | 424 | } |
358 | 425 | ||
359 | void TabDialog::fontClicked ( const QFont &f ) | 426 | void TabDialog::fontClicked ( const QFont &f ) |
360 | { | 427 | { |
361 | m_sample-> setViewFont ( f ); | 428 | m_sample-> setViewFont ( f ); |
362 | } | 429 | } |
363 | 430 | ||
364 | void TabDialog::bgTypeClicked ( int t ) | 431 | void TabDialog::bgTypeClicked ( int t ) |
365 | { | 432 | { |
366 | QString s; | 433 | QString s; |
367 | 434 | ||
435 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) | ||
436 | m_bgtype-> setButton ( t ); | ||
437 | |||
368 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); | 438 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); |
369 | //m_imagebrowse-> setEnabled ( t == TabConfig::Image ); | 439 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); |
370 | //m_imagedefault-> setEnabled ( t == TabConfig::Image ); | ||
371 | 440 | ||
372 | if ( t == TabConfig::SolidColor ) | 441 | if ( t == TabConfig::SolidColor ) |
373 | s = m_solidcolor-> color ( ). name ( ); | 442 | s = m_solidcolor-> color ( ). name ( ); |
443 | else if ( t == TabConfig::Image ) | ||
444 | s = m_bgimage; | ||
374 | 445 | ||
375 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); | 446 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); |
376 | } | 447 | } |
377 | 448 | ||
378 | void TabDialog::colorClicked ( const QColor &col ) | 449 | void TabDialog::bgColorClicked ( const QColor & ) |
450 | { | ||
451 | bgTypeClicked ( TabConfig::SolidColor ); | ||
452 | } | ||
453 | |||
454 | void TabDialog::iconColorClicked ( const QColor &col ) | ||
455 | { | ||
456 | m_sample-> setTextColor ( col ); | ||
457 | } | ||
458 | |||
459 | void TabDialog::bgImageClicked ( ) | ||
460 | { | ||
461 | // ### use OFileSelector here ### | ||
462 | // this is just a quick c&p from the old appearance app | ||
463 | |||
464 | MimeTypes types; | ||
465 | QStringList list; | ||
466 | list << "image/*"; | ||
467 | types. insert ( "Images", list ); | ||
468 | |||
469 | QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); | ||
470 | if ( !file. isEmpty ( )) { | ||
471 | m_bgimage = DocLnk ( file ). file ( ); | ||
472 | bgTypeClicked ( TabConfig::Image ); | ||
473 | } | ||
474 | } | ||
475 | |||
476 | void TabDialog::bgDefaultClicked ( ) | ||
379 | { | 477 | { |
380 | m_sample-> setBackgroundType ( TabConfig::SolidColor, col. name ( )); | 478 | m_bgimage = Resource::findPixmap ( "launcher/opie-background.jpg" ); |
479 | bgTypeClicked ( TabConfig::Image ); | ||
381 | } | 480 | } |
382 | 481 | ||
383 | void TabDialog::accept ( ) | 482 | void TabDialog::accept ( ) |
384 | { | 483 | { |
385 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); | 484 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); |
386 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); | 485 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); |
387 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); | 486 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); |
487 | m_tc. m_bg_image = m_bgimage; | ||
488 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); | ||
388 | m_tc. m_font_family = m_fontselect-> fontFamily ( ); | 489 | m_tc. m_font_family = m_fontselect-> fontFamily ( ); |
389 | m_tc. m_font_size = m_fontselect-> fontSize ( ); | 490 | m_tc. m_font_size = m_fontselect-> fontSize ( ); |
390 | m_tc. m_font_style = m_fontselect-> fontStyle ( ); | 491 | m_tc. m_font_style = m_fontselect-> fontStyle ( ); |
391 | 492 | ||
392 | QDialog::accept ( ); | 493 | QDialog::accept ( ); |
393 | } | 494 | } |
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h index e1935fd..b0afd47 100644 --- a/core/settings/launcher/tabdialog.h +++ b/core/settings/launcher/tabdialog.h | |||
@@ -1,45 +1,79 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
1 | #ifndef __TABDIALOG_H__ | 28 | #ifndef __TABDIALOG_H__ |
2 | #define __TABDIALOG_H__ | 29 | #define __TABDIALOG_H__ |
3 | 30 | ||
4 | #include <qdialog.h> | 31 | #include <qdialog.h> |
5 | #include "tabconfig.h" | 32 | #include "tabconfig.h" |
6 | 33 | ||
7 | class QButtonGroup; | 34 | class QButtonGroup; |
8 | class OFontSelector; | 35 | class OFontSelector; |
9 | class SampleView; | 36 | class SampleView; |
10 | class OColorButton; | 37 | class OColorButton; |
38 | class QPushButton; | ||
39 | |||
11 | 40 | ||
12 | class TabDialog : public QDialog { | 41 | class TabDialog : public QDialog { |
13 | Q_OBJECT | 42 | Q_OBJECT |
14 | public: | 43 | public: |
15 | TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags = 0 ); | 44 | TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags = 0 ); |
16 | virtual ~TabDialog ( ); | 45 | virtual ~TabDialog ( ); |
17 | 46 | ||
18 | public slots: | 47 | public slots: |
19 | virtual void accept ( ); | 48 | virtual void accept ( ); |
20 | 49 | ||
21 | protected slots: | 50 | protected slots: |
22 | void iconSizeClicked ( int ); | 51 | void iconSizeClicked ( int ); |
23 | void fontClicked ( const QFont & ); | 52 | void fontClicked ( const QFont & ); |
24 | void bgTypeClicked ( int ); | 53 | void bgTypeClicked ( int ); |
25 | void colorClicked ( const QColor & ); | 54 | void bgColorClicked ( const QColor & ); |
55 | void iconColorClicked ( const QColor & ); | ||
56 | void bgImageClicked ( ); | ||
57 | void bgDefaultClicked ( ); | ||
26 | 58 | ||
27 | private: | 59 | private: |
28 | QWidget *createBgTab ( QWidget *parent ); | 60 | QWidget *createBgTab ( QWidget *parent ); |
29 | QWidget *createFontTab ( QWidget *parent ); | 61 | QWidget *createFontTab ( QWidget *parent ); |
30 | QWidget *createIconTab ( QWidget *parent ); | 62 | QWidget *createIconTab ( QWidget *parent ); |
31 | 63 | ||
32 | 64 | ||
33 | private: | 65 | private: |
34 | SampleView *m_sample; | 66 | SampleView *m_sample; |
35 | QButtonGroup *m_iconsize; | 67 | QButtonGroup *m_iconsize; |
36 | OFontSelector *m_fontselect; | 68 | OFontSelector *m_fontselect; |
37 | OColorButton *m_solidcolor; | 69 | OColorButton *m_solidcolor; |
38 | 70 | OColorButton *m_iconcolor; | |
71 | QPushButton *m_imagebrowse; | ||
72 | QString m_bgimage; | ||
39 | QButtonGroup *m_bgtype; | 73 | QButtonGroup *m_bgtype; |
40 | 74 | ||
41 | TabConfig &m_tc; | 75 | TabConfig &m_tc; |
42 | }; | 76 | }; |
43 | 77 | ||
44 | 78 | ||
45 | #endif \ No newline at end of file | 79 | #endif \ No newline at end of file |
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index ae78733..0faaea3 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp | |||
@@ -1,227 +1,234 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | =. This file is part of the OPIE Project |
3 | ** | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | ** This file is part of the Qtopia Environment. | 4 | .>+-= |
5 | ** | 5 | _;:, .> :=|. This file is free software; you can |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | ** packaging of this file. | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ** | 10 | ._= =} : or (at your option) any later version. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .%`+i> _;_. |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | ** | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | : .. .:, . . . without even the implied warranty of |
15 | ** | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ** not clear to you. | 17 | ..}^=.= = ; Public License for more details. |
18 | ** | 18 | ++= -. .` .: |
19 | **********************************************************************/ | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
20 | 27 | ||
21 | #include "tabssettings.h" | 28 | #include "tabssettings.h" |
22 | 29 | ||
23 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
25 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
26 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
29 | 36 | ||
30 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
31 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
32 | #include <qlayout.h> | 39 | #include <qlayout.h> |
33 | #include <qlabel.h> | 40 | #include <qlabel.h> |
34 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
35 | 42 | ||
36 | #include "tabdialog.h" | 43 | #include "tabdialog.h" |
37 | 44 | ||
38 | #include <stdlib.h> | 45 | #include <stdlib.h> |
39 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
40 | 47 | ||
41 | 48 | ||
42 | 49 | ||
43 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) | 50 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) |
44 | : QWidget ( parent, name ) | 51 | : QWidget ( parent, name ) |
45 | { | 52 | { |
46 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); | 53 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); |
47 | 54 | ||
48 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); | 55 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); |
49 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); | 56 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); |
50 | 57 | ||
51 | m_list = new QListBox ( this ); | 58 | m_list = new QListBox ( this ); |
52 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); | 59 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); |
53 | 60 | ||
54 | QWhatsThis::add ( m_list, tr( "foobar" )); | 61 | QWhatsThis::add ( m_list, tr( "foobar" )); |
55 | 62 | ||
56 | QPushButton *p; | 63 | QPushButton *p; |
57 | p = new QPushButton ( tr( "New" ), this ); | 64 | p = new QPushButton ( tr( "New" ), this ); |
58 | lay-> addWidget ( p, 1, 1 ); | 65 | lay-> addWidget ( p, 1, 1 ); |
59 | connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); | 66 | connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); |
60 | 67 | ||
61 | p = new QPushButton ( tr( "Edit" ), this ); | 68 | p = new QPushButton ( tr( "Edit" ), this ); |
62 | lay-> addWidget ( p, 2, 1 ); | 69 | lay-> addWidget ( p, 2, 1 ); |
63 | connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); | 70 | connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); |
64 | 71 | ||
65 | p = new QPushButton ( tr( "Delete" ), this ); | 72 | p = new QPushButton ( tr( "Delete" ), this ); |
66 | lay-> addWidget ( p, 3, 1 ); | 73 | lay-> addWidget ( p, 3, 1 ); |
67 | connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); | 74 | connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); |
68 | 75 | ||
69 | lay-> setRowStretch ( 4, 10 ); | 76 | lay-> setRowStretch ( 4, 10 ); |
70 | 77 | ||
71 | init ( ); | 78 | init ( ); |
72 | } | 79 | } |
73 | 80 | ||
74 | void TabsSettings::init ( ) | 81 | void TabsSettings::init ( ) |
75 | { | 82 | { |
76 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); | 83 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); |
77 | QStringList types = rootFolder. types ( ); | 84 | QStringList types = rootFolder. types ( ); |
78 | 85 | ||
79 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 86 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
80 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); | 87 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); |
81 | m_ids << *it; | 88 | m_ids << *it; |
82 | } | 89 | } |
83 | QImage img ( Resource::loadImage ( "DocsIcon" )); | 90 | QImage img ( Resource::loadImage ( "DocsIcon" )); |
84 | QPixmap pix; | 91 | QPixmap pix; |
85 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); | 92 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); |
86 | m_list-> insertItem ( pix, tr( "Documents" )); | 93 | m_list-> insertItem ( pix, tr( "Documents" )); |
87 | m_ids += "Documents"; // No tr | 94 | m_ids += "Documents"; // No tr |
88 | 95 | ||
89 | readTabSettings ( ); | 96 | readTabSettings ( ); |
90 | } | 97 | } |
91 | 98 | ||
92 | void TabsSettings::readTabSettings ( ) | 99 | void TabsSettings::readTabSettings ( ) |
93 | { | 100 | { |
94 | Config cfg ( "Launcher" ); | 101 | Config cfg ( "Launcher" ); |
95 | QString grp ( "Tab %1" ); // No tr | 102 | QString grp ( "Tab %1" ); // No tr |
96 | m_tabs. clear ( ); | 103 | m_tabs. clear ( ); |
97 | 104 | ||
98 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 105 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
99 | TabConfig tc; | 106 | TabConfig tc; |
100 | tc. m_view = TabConfig::Icon; | 107 | tc. m_view = TabConfig::Icon; |
101 | tc. m_bg_type = TabConfig::Ruled; | 108 | tc. m_bg_type = TabConfig::Ruled; |
102 | tc. m_changed = false; | 109 | tc. m_changed = false; |
103 | 110 | ||
104 | cfg. setGroup ( grp. arg ( *it )); | 111 | cfg. setGroup ( grp. arg ( *it )); |
105 | 112 | ||
106 | QString view = cfg. readEntry ( "View", "Icon" ); | 113 | QString view = cfg. readEntry ( "View", "Icon" ); |
107 | if ( view == "List" ) // No tr | 114 | if ( view == "List" ) // No tr |
108 | tc. m_view = TabConfig::List; | 115 | tc. m_view = TabConfig::List; |
109 | 116 | ||
110 | QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" ); | 117 | QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" ); |
111 | if ( bgType == "SolidColor" ) | 118 | if ( bgType == "SolidColor" ) |
112 | tc. m_bg_type = TabConfig::SolidColor; | 119 | tc. m_bg_type = TabConfig::SolidColor; |
113 | else if ( bgType == "Image" ) // No tr | 120 | else if ( bgType == "Image" ) // No tr |
114 | tc. m_bg_type = TabConfig::Image; | 121 | tc. m_bg_type = TabConfig::Image; |
115 | 122 | ||
116 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" ); | 123 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" ); |
117 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor" ); | 124 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( )); |
118 | tc. m_text_color = cfg. readEntry ( "TextColor" ); | 125 | tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( )); |
119 | QStringList f = cfg. readListEntry ( "Font", ',' ); | 126 | QStringList f = cfg. readListEntry ( "Font", ',' ); |
120 | if ( f. count ( ) == 4 ) { | 127 | if ( f. count ( ) == 4 ) { |
121 | tc. m_font_family = f [0]; | 128 | tc. m_font_family = f [0]; |
122 | tc. m_font_size = f [1]. toInt ( ); | 129 | tc. m_font_size = f [1]. toInt ( ); |
123 | tc. m_font_style = f [2]; | 130 | tc. m_font_style = f [2]; |
124 | } else { | 131 | } else { |
125 | tc. m_font_family = font ( ). family ( ); | 132 | tc. m_font_family = font ( ). family ( ); |
126 | tc. m_font_size = font ( ). pointSize ( ); | 133 | tc. m_font_size = font ( ). pointSize ( ); |
127 | tc. m_font_style = "Regular"; | 134 | tc. m_font_style = "Regular"; |
128 | } | 135 | } |
129 | m_tabs [*it] = tc; | 136 | m_tabs [*it] = tc; |
130 | } | 137 | } |
131 | } | 138 | } |
132 | 139 | ||
133 | 140 | ||
134 | void TabsSettings::accept ( ) | 141 | void TabsSettings::accept ( ) |
135 | { | 142 | { |
136 | Config cfg ( "Launcher" ); | 143 | Config cfg ( "Launcher" ); |
137 | 144 | ||
138 | // Launcher Tab | 145 | // Launcher Tab |
139 | QString grp ( "Tab %1" ); // No tr | 146 | QString grp ( "Tab %1" ); // No tr |
140 | 147 | ||
141 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 148 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
142 | TabConfig &tc = m_tabs [*it]; | 149 | TabConfig &tc = m_tabs [*it]; |
143 | 150 | ||
144 | cfg. setGroup ( grp. arg ( *it )); | 151 | cfg. setGroup ( grp. arg ( *it )); |
145 | if ( !tc. m_changed ) | 152 | if ( !tc. m_changed ) |
146 | continue; | 153 | continue; |
147 | switch ( tc. m_view ) { | 154 | switch ( tc. m_view ) { |
148 | case TabConfig::Icon: | 155 | case TabConfig::Icon: |
149 | cfg.writeEntry ( "View", "Icon" ); | 156 | cfg.writeEntry ( "View", "Icon" ); |
150 | break; | 157 | break; |
151 | case TabConfig::List: | 158 | case TabConfig::List: |
152 | cfg.writeEntry ( "View", "List" ); | 159 | cfg.writeEntry ( "View", "List" ); |
153 | break; | 160 | break; |
154 | } | 161 | } |
155 | 162 | ||
156 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); | 163 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); |
157 | e << *it << tc. m_view; | 164 | e << *it << tc. m_view; |
158 | 165 | ||
159 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); | 166 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); |
160 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); | 167 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); |
161 | cfg. writeEntry ( "TextColor", tc. m_text_color ); | 168 | cfg. writeEntry ( "TextColor", tc. m_text_color ); |
162 | 169 | ||
163 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + tc. m_font_style + ",0"; | 170 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + tc. m_font_style + ",0"; |
164 | cfg. writeEntry ( "Font", f ); | 171 | cfg. writeEntry ( "Font", f ); |
165 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); | 172 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); |
166 | 173 | ||
167 | switch ( tc. m_bg_type ) { | 174 | switch ( tc. m_bg_type ) { |
168 | case TabConfig::Ruled: | 175 | case TabConfig::Ruled: |
169 | cfg.writeEntry( "BackgroundType", "Ruled" ); | 176 | cfg.writeEntry( "BackgroundType", "Ruled" ); |
170 | be << *it << tc. m_bg_type << QString(""); | 177 | be << *it << tc. m_bg_type << QString(""); |
171 | break; | 178 | break; |
172 | case TabConfig::SolidColor: | 179 | case TabConfig::SolidColor: |
173 | cfg.writeEntry( "BackgroundType", "SolidColor" ); | 180 | cfg.writeEntry( "BackgroundType", "SolidColor" ); |
174 | be << *it << tc. m_bg_type << tc. m_bg_color; | 181 | be << *it << tc. m_bg_type << tc. m_bg_color; |
175 | break; | 182 | break; |
176 | case TabConfig::Image: | 183 | case TabConfig::Image: |
177 | cfg.writeEntry( "BackgroundType", "Image" ); | 184 | cfg.writeEntry( "BackgroundType", "Image" ); |
178 | be << *it << tc. m_bg_type << tc. m_bg_image; | 185 | be << *it << tc. m_bg_type << tc. m_bg_image; |
179 | break; | 186 | break; |
180 | } | 187 | } |
181 | 188 | ||
182 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); | 189 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); |
183 | te << *it << tc. m_text_color; | 190 | te << *it << tc. m_text_color; |
184 | 191 | ||
185 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 192 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); |
186 | fe << *it << tc. m_font_family; | 193 | fe << *it << tc. m_font_family; |
187 | fe << tc. m_font_size; | 194 | fe << tc. m_font_size; |
188 | fe << 50 << 0; | 195 | fe << 50 << 0; |
189 | 196 | ||
190 | tc. m_changed = false; | 197 | tc. m_changed = false; |
191 | } | 198 | } |
192 | } | 199 | } |
193 | 200 | ||
194 | void TabsSettings::newClicked ( ) | 201 | void TabsSettings::newClicked ( ) |
195 | { | 202 | { |
196 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 203 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
197 | } | 204 | } |
198 | 205 | ||
199 | void TabsSettings::deleteClicked ( ) | 206 | void TabsSettings::deleteClicked ( ) |
200 | { | 207 | { |
201 | int ind = m_list-> currentItem ( ); | 208 | int ind = m_list-> currentItem ( ); |
202 | 209 | ||
203 | if ( ind < 0 ) | 210 | if ( ind < 0 ) |
204 | return; | 211 | return; |
205 | 212 | ||
206 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 213 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
207 | } | 214 | } |
208 | 215 | ||
209 | void TabsSettings::editClicked ( ) | 216 | void TabsSettings::editClicked ( ) |
210 | { | 217 | { |
211 | int ind = m_list-> currentItem ( ); | 218 | int ind = m_list-> currentItem ( ); |
212 | 219 | ||
213 | if ( ind < 0 ) | 220 | if ( ind < 0 ) |
214 | return; | 221 | return; |
215 | 222 | ||
216 | TabConfig tc = m_tabs [m_ids [ind]]; | 223 | TabConfig tc = m_tabs [m_ids [ind]]; |
217 | 224 | ||
218 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); | 225 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); |
219 | 226 | ||
220 | d-> showMaximized ( ); | 227 | d-> showMaximized ( ); |
221 | if ( d-> exec ( ) == QDialog::Accepted ) { | 228 | if ( d-> exec ( ) == QDialog::Accepted ) { |
222 | tc. m_changed = true; | 229 | tc. m_changed = true; |
223 | m_tabs [m_ids [ind]] = tc; | 230 | m_tabs [m_ids [ind]] = tc; |
224 | } | 231 | } |
225 | 232 | ||
226 | delete d; | 233 | delete d; |
227 | } | 234 | } |
diff --git a/core/settings/launcher/tabssettings.h b/core/settings/launcher/tabssettings.h index 76cae68..b17b523 100644 --- a/core/settings/launcher/tabssettings.h +++ b/core/settings/launcher/tabssettings.h | |||
@@ -1,39 +1,65 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
1 | #ifndef __TABS_SETTINGS_H__ | 27 | #ifndef __TABS_SETTINGS_H__ |
2 | #define __TABS_SETTINGS_H__ | 28 | #define __TABS_SETTINGS_H__ |
3 | 29 | ||
4 | #include <qwidget.h> | 30 | #include <qwidget.h> |
5 | #include <qmap.h> | 31 | #include <qmap.h> |
6 | 32 | ||
7 | #include "tabconfig.h" | 33 | #include "tabconfig.h" |
8 | 34 | ||
9 | class QListBox; | 35 | class QListBox; |
10 | 36 | ||
11 | 37 | ||
12 | class TabsSettings : public QWidget { | 38 | class TabsSettings : public QWidget { |
13 | Q_OBJECT | 39 | Q_OBJECT |
14 | 40 | ||
15 | public: | 41 | public: |
16 | TabsSettings ( QWidget *parent = 0, const char *name = 0 ); | 42 | TabsSettings ( QWidget *parent = 0, const char *name = 0 ); |
17 | 43 | ||
18 | void accept ( ); | 44 | void accept ( ); |
19 | 45 | ||
20 | protected slots: | 46 | protected slots: |
21 | void newClicked ( ); | 47 | void newClicked ( ); |
22 | void deleteClicked ( ); | 48 | void deleteClicked ( ); |
23 | void editClicked ( ); | 49 | void editClicked ( ); |
24 | 50 | ||
25 | protected: | 51 | protected: |
26 | void init ( ); | 52 | void init ( ); |
27 | void readTabSettings ( ); | 53 | void readTabSettings ( ); |
28 | 54 | ||
29 | private: | 55 | private: |
30 | QListBox *m_list; | 56 | QListBox *m_list; |
31 | //QString currentTab; | 57 | //QString currentTab; |
32 | QStringList m_ids; | 58 | QStringList m_ids; |
33 | QMap <QString, TabConfig> m_tabs; | 59 | QMap <QString, TabConfig> m_tabs; |
34 | }; | 60 | }; |
35 | 61 | ||
36 | 62 | ||
37 | 63 | ||
38 | 64 | ||
39 | #endif | 65 | #endif |
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp index 7df9a68..6921ee8 100644 --- a/core/settings/launcher/taskbarsettings.cpp +++ b/core/settings/launcher/taskbarsettings.cpp | |||
@@ -1,170 +1,178 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the OPIE Project |
3 | ** | 3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This file is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : or (at your option) any later version. |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ** | 18 | ..}^=.= = ; Public License for more details. |
19 | **********************************************************************/ | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
20 | 28 | ||
21 | #include "taskbarsettings.h" | 29 | #include "taskbarsettings.h" |
22 | 30 | ||
23 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
24 | #include <qpe/qlibrary.h> | 32 | #include <qpe/qlibrary.h> |
25 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/taskbarappletinterface.h> | 34 | #include <qpe/taskbarappletinterface.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
28 | 36 | ||
29 | #include <qdir.h> | 37 | #include <qdir.h> |
30 | #include <qlistview.h> | 38 | #include <qlistview.h> |
31 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
32 | #include <qheader.h> | 40 | #include <qheader.h> |
33 | #include <qlayout.h> | 41 | #include <qlayout.h> |
34 | #include <qlabel.h> | 42 | #include <qlabel.h> |
35 | #include <qwhatsthis.h> | 43 | #include <qwhatsthis.h> |
36 | 44 | ||
37 | #include <stdlib.h> | 45 | #include <stdlib.h> |
38 | 46 | ||
39 | 47 | ||
40 | TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) | 48 | TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) |
41 | : QWidget ( parent, name ) | 49 | : QWidget ( parent, name ) |
42 | { | 50 | { |
43 | m_applets_changed = false; | 51 | m_applets_changed = false; |
44 | 52 | ||
45 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 53 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
46 | 54 | ||
47 | QLabel *l = new QLabel ( tr( "Load applets:" ), this ); | 55 | QLabel *l = new QLabel ( tr( "Load applets:" ), this ); |
48 | lay-> addWidget ( l ); | 56 | lay-> addWidget ( l ); |
49 | 57 | ||
50 | m_list = new QListView ( this ); | 58 | m_list = new QListView ( this ); |
51 | m_list-> addColumn ( "foobar" ); | 59 | m_list-> addColumn ( "foobar" ); |
52 | m_list-> header ( )-> hide ( ); | 60 | m_list-> header ( )-> hide ( ); |
53 | 61 | ||
54 | lay-> addWidget ( m_list ); | 62 | lay-> addWidget ( m_list ); |
55 | 63 | ||
56 | m_omenu = new QCheckBox ( tr( "Show O-Menu" ), this ); | 64 | m_omenu = new QCheckBox ( tr( "Show O-Menu" ), this ); |
57 | lay-> addWidget ( m_omenu ); | 65 | lay-> addWidget ( m_omenu ); |
58 | 66 | ||
59 | m_omenu_tabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); | 67 | m_omenu_tabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); |
60 | lay-> addWidget ( m_omenu_tabs ); | 68 | lay-> addWidget ( m_omenu_tabs ); |
61 | 69 | ||
62 | QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); | 70 | QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); |
63 | QWhatsThis::add( m_omenu_tabs, tr( "Adds the contents of the Launcher as menus in the O-Menu." )); | 71 | QWhatsThis::add( m_omenu_tabs, tr( "Adds the contents of the Launcher as menus in the O-Menu." )); |
64 | QWhatsThis::add( m_omenu, tr( "Check if you want the O-Menu in the taskbar." )); | 72 | QWhatsThis::add( m_omenu, tr( "Check if you want the O-Menu in the taskbar." )); |
65 | 73 | ||
66 | connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); | 74 | connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); |
67 | connect ( m_omenu, SIGNAL( toggled ( bool )), m_omenu_tabs, SLOT( setEnabled ( bool ))); | 75 | connect ( m_omenu, SIGNAL( toggled ( bool )), m_omenu_tabs, SLOT( setEnabled ( bool ))); |
68 | 76 | ||
69 | // This option does not make sense ! (sandman) | 77 | // This option does not make sense ! (sandman) |
70 | m_omenu_tabs-> hide ( ); | 78 | m_omenu_tabs-> hide ( ); |
71 | 79 | ||
72 | init ( ); | 80 | init ( ); |
73 | } | 81 | } |
74 | 82 | ||
75 | void TaskbarSettings::init ( ) | 83 | void TaskbarSettings::init ( ) |
76 | { | 84 | { |
77 | Config cfg ( "Taskbar" ); | 85 | Config cfg ( "Taskbar" ); |
78 | cfg. setGroup ( "Applets" ); | 86 | cfg. setGroup ( "Applets" ); |
79 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); | 87 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); |
80 | 88 | ||
81 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; | 89 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; |
82 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); | 90 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); |
83 | 91 | ||
84 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { | 92 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { |
85 | QString name; | 93 | QString name; |
86 | QPixmap icon; | 94 | QPixmap icon; |
87 | TaskbarNamedAppletInterface *iface = 0; | 95 | TaskbarNamedAppletInterface *iface = 0; |
88 | 96 | ||
89 | QLibrary *lib = new QLibrary ( path + "/" + *it ); | 97 | QLibrary *lib = new QLibrary ( path + "/" + *it ); |
90 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); | 98 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); |
91 | if ( iface ) { | 99 | if ( iface ) { |
92 | 100 | ||
93 | QString lang = getenv( "LANG" ); | 101 | QString lang = getenv( "LANG" ); |
94 | QTranslator *trans = new QTranslator ( qApp ); | 102 | QTranslator *trans = new QTranslator ( qApp ); |
95 | QString type = (*it). left ((*it). find (".")); | 103 | QString type = (*it). left ((*it). find (".")); |
96 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; | 104 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; |
97 | if ( trans-> load ( tfn )) | 105 | if ( trans-> load ( tfn )) |
98 | qApp-> installTranslator ( trans ); | 106 | qApp-> installTranslator ( trans ); |
99 | else | 107 | else |
100 | delete trans; | 108 | delete trans; |
101 | name = iface-> name ( ); | 109 | name = iface-> name ( ); |
102 | icon = iface-> icon ( ); | 110 | icon = iface-> icon ( ); |
103 | iface-> release ( ); | 111 | iface-> release ( ); |
104 | lib-> unload ( ); | 112 | lib-> unload ( ); |
105 | } else { | 113 | } else { |
106 | delete lib; | 114 | delete lib; |
107 | name = (*it). mid ( 3 ); | 115 | name = (*it). mid ( 3 ); |
108 | int sep = name. find( ".so" ); | 116 | int sep = name. find( ".so" ); |
109 | if ( sep > 0 ) | 117 | if ( sep > 0 ) |
110 | name. truncate ( sep ); | 118 | name. truncate ( sep ); |
111 | sep = name. find ( "applet" ); | 119 | sep = name. find ( "applet" ); |
112 | if ( sep == (int) name.length ( ) - 6 ) | 120 | if ( sep == (int) name.length ( ) - 6 ) |
113 | name. truncate ( sep ); | 121 | name. truncate ( sep ); |
114 | name[0] = name[0]. upper ( ); | 122 | name[0] = name[0]. upper ( ); |
115 | } | 123 | } |
116 | QCheckListItem *item; | 124 | QCheckListItem *item; |
117 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 125 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); |
118 | if ( !icon. isNull ( )) | 126 | if ( !icon. isNull ( )) |
119 | item-> setPixmap ( 0, icon ); | 127 | item-> setPixmap ( 0, icon ); |
120 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 128 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); |
121 | m_applets [*it] = item; | 129 | m_applets [*it] = item; |
122 | } | 130 | } |
123 | 131 | ||
124 | cfg. setGroup ( "Menu" ); | 132 | cfg. setGroup ( "Menu" ); |
125 | 133 | ||
126 | m_omenu_tabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true )); | 134 | m_omenu_tabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true )); |
127 | m_omenu-> setChecked ( cfg. readBoolEntry ( "ShowMenu", true )); | 135 | m_omenu-> setChecked ( cfg. readBoolEntry ( "ShowMenu", true )); |
128 | 136 | ||
129 | m_omenu_tabs-> setEnabled ( m_omenu-> isChecked ( )); | 137 | m_omenu_tabs-> setEnabled ( m_omenu-> isChecked ( )); |
130 | } | 138 | } |
131 | 139 | ||
132 | void TaskbarSettings::appletChanged() | 140 | void TaskbarSettings::appletChanged() |
133 | { | 141 | { |
134 | m_applets_changed = true; | 142 | m_applets_changed = true; |
135 | } | 143 | } |
136 | 144 | ||
137 | void TaskbarSettings::accept ( ) | 145 | void TaskbarSettings::accept ( ) |
138 | { | 146 | { |
139 | Config cfg ( "Taskbar" ); | 147 | Config cfg ( "Taskbar" ); |
140 | cfg. setGroup ( "Applets" ); | 148 | cfg. setGroup ( "Applets" ); |
141 | if ( m_applets_changed ) { | 149 | if ( m_applets_changed ) { |
142 | QStringList exclude; | 150 | QStringList exclude; |
143 | QMap <QString, QCheckListItem *>::Iterator it; | 151 | QMap <QString, QCheckListItem *>::Iterator it; |
144 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { | 152 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { |
145 | if ( !(*it)-> isOn ( )) | 153 | if ( !(*it)-> isOn ( )) |
146 | exclude << it. key ( ); | 154 | exclude << it. key ( ); |
147 | } | 155 | } |
148 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); | 156 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); |
149 | } | 157 | } |
150 | cfg. writeEntry ( "SafeMode", false ); | 158 | cfg. writeEntry ( "SafeMode", false ); |
151 | 159 | ||
152 | cfg. setGroup ( "Menu" ); | 160 | cfg. setGroup ( "Menu" ); |
153 | 161 | ||
154 | if ( m_omenu_tabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { | 162 | if ( m_omenu_tabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { |
155 | m_applets_changed = true; | 163 | m_applets_changed = true; |
156 | cfg. writeEntry ( "LauncherTabs", m_omenu_tabs-> isChecked ( )); | 164 | cfg. writeEntry ( "LauncherTabs", m_omenu_tabs-> isChecked ( )); |
157 | } | 165 | } |
158 | 166 | ||
159 | if ( m_omenu-> isChecked ( ) != cfg. readBoolEntry ( "ShowMenu", true )) { | 167 | if ( m_omenu-> isChecked ( ) != cfg. readBoolEntry ( "ShowMenu", true )) { |
160 | m_applets_changed = true; | 168 | m_applets_changed = true; |
161 | cfg. writeEntry ( "ShowMenu", m_omenu-> isChecked ( )); | 169 | cfg. writeEntry ( "ShowMenu", m_omenu-> isChecked ( )); |
162 | } | 170 | } |
163 | cfg. write ( ); | 171 | cfg. write ( ); |
164 | 172 | ||
165 | if ( m_applets_changed ) { | 173 | if ( m_applets_changed ) { |
166 | QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); | 174 | QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); |
167 | m_applets_changed = false; | 175 | m_applets_changed = false; |
168 | } | 176 | } |
169 | } | 177 | } |
170 | 178 | ||
diff --git a/core/settings/launcher/taskbarsettings.h b/core/settings/launcher/taskbarsettings.h index b8c6fbb..2f5242f 100644 --- a/core/settings/launcher/taskbarsettings.h +++ b/core/settings/launcher/taskbarsettings.h | |||
@@ -1,35 +1,62 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
1 | #ifndef __TASKBAR_SETTINGS_H__ | 28 | #ifndef __TASKBAR_SETTINGS_H__ |
2 | #define __TASKBAR_SETTINGS_H__ | 29 | #define __TASKBAR_SETTINGS_H__ |
3 | 30 | ||
4 | #include <qwidget.h> | 31 | #include <qwidget.h> |
5 | #include <qmap.h> | 32 | #include <qmap.h> |
6 | 33 | ||
7 | class QListView; | 34 | class QListView; |
8 | class QCheckListItem; | 35 | class QCheckListItem; |
9 | class QCheckBox; | 36 | class QCheckBox; |
10 | 37 | ||
11 | 38 | ||
12 | class TaskbarSettings : public QWidget { | 39 | class TaskbarSettings : public QWidget { |
13 | Q_OBJECT | 40 | Q_OBJECT |
14 | 41 | ||
15 | public: | 42 | public: |
16 | TaskbarSettings ( QWidget *parent = 0, const char *name = 0 ); | 43 | TaskbarSettings ( QWidget *parent = 0, const char *name = 0 ); |
17 | 44 | ||
18 | void accept ( ); | 45 | void accept ( ); |
19 | 46 | ||
20 | protected slots: | 47 | protected slots: |
21 | void appletChanged ( ); | 48 | void appletChanged ( ); |
22 | 49 | ||
23 | protected: | 50 | protected: |
24 | void init ( ); | 51 | void init ( ); |
25 | 52 | ||
26 | private: | 53 | private: |
27 | QListView *m_list; | 54 | QListView *m_list; |
28 | QCheckBox *m_omenu; | 55 | QCheckBox *m_omenu; |
29 | QCheckBox *m_omenu_tabs; | 56 | QCheckBox *m_omenu_tabs; |
30 | 57 | ||
31 | QMap <QString, QCheckListItem *> m_applets; | 58 | QMap <QString, QCheckListItem *> m_applets; |
32 | bool m_applets_changed; | 59 | bool m_applets_changed; |
33 | }; | 60 | }; |
34 | 61 | ||
35 | #endif | 62 | #endif |