Diffstat (limited to 'core/settings/launcher/tabdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index 555e64e..c6bdf8f 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -1,63 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "tabdialog.h" | 28 | #include "tabdialog.h" |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | 31 | ||
32 | #include <opie2/ofontselector.h> | ||
33 | #include <opie2/otabwidget.h> | ||
34 | #include <opie2/ocolorbutton.h> | 32 | #include <opie2/ocolorbutton.h> |
35 | #include <opie2/ofiledialog.h> | ||
36 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | #include <opie2/ofiledialog.h> | ||
35 | #include <opie2/ofontselector.h> | ||
36 | #include <opie2/oresource.h> | ||
37 | #include <opie2/otabwidget.h> | ||
37 | 38 | ||
38 | /* QPE */ | 39 | /* QPE */ |
39 | #include <qpe/resource.h> | ||
40 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qvbox.h> | 44 | #include <qvbox.h> |
45 | #include <qtabbar.h> | 45 | #include <qtabbar.h> |
46 | #include <qiconview.h> | 46 | #include <qiconview.h> |
47 | #include <qapplication.h> | 47 | #include <qapplication.h> |
48 | #include <qlabel.h> | 48 | #include <qlabel.h> |
49 | #include <qfileinfo.h> | 49 | #include <qfileinfo.h> |
50 | #include <qradiobutton.h> | 50 | #include <qradiobutton.h> |
51 | #include <qbuttongroup.h> | 51 | #include <qbuttongroup.h> |
52 | #include <qwhatsthis.h> | 52 | #include <qwhatsthis.h> |
53 | #include <qcheckbox.h> | 53 | #include <qcheckbox.h> |
54 | #include <qspinbox.h> | 54 | #include <qspinbox.h> |
55 | 55 | ||
56 | 56 | ||
57 | using namespace Opie::Ui; | 57 | using namespace Opie::Ui; |
58 | class SampleItem : public QIconViewItem { | 58 | class SampleItem : public QIconViewItem { |
59 | public: | 59 | public: |
60 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) | 60 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) |
61 | { | 61 | { |
62 | m_large = pix; | 62 | m_large = pix; |
63 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); | 63 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); |
@@ -78,51 +78,54 @@ public: | |||
78 | } | 78 | } |
79 | 79 | ||
80 | private: | 80 | private: |
81 | QPixmap m_large, m_small; | 81 | QPixmap m_large, m_small; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | //FIXME: Why not derive SampleView from LauncherView ??? | 84 | //FIXME: Why not derive SampleView from LauncherView ??? |
85 | 85 | ||
86 | class SampleView : public QIconView { | 86 | class SampleView : public QIconView { |
87 | public: | 87 | public: |
88 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) | 88 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) |
89 | { | 89 | { |
90 | setItemsMovable ( false ); | 90 | setItemsMovable ( false ); |
91 | setAutoArrange ( true ); | 91 | setAutoArrange ( true ); |
92 | setSorting ( true ); | 92 | setSorting ( true ); |
93 | setFrameStyle ( QFrame::NoFrame ); | 93 | setFrameStyle ( QFrame::NoFrame ); |
94 | setSpacing ( 4 ); | 94 | setSpacing ( 4 ); |
95 | setMargin ( 0 ); | 95 | setMargin ( 0 ); |
96 | setSelectionMode ( QIconView::NoSelection ); | 96 | setSelectionMode ( QIconView::NoSelection ); |
97 | setBackgroundMode ( PaletteBase ); | 97 | setBackgroundMode ( PaletteBase ); |
98 | setViewMode ( TabConfig::Icon ); | 98 | setViewMode ( TabConfig::Icon ); |
99 | calculateGrid ( Bottom ); | 99 | calculateGrid ( Bottom ); |
100 | 100 | ||
101 | 101 | ||
102 | new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); | 102 | new SampleItem ( this, QObject::tr( "Sample 1" ), |
103 | new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); | 103 | Opie::Core::OResource::loadPixmap ( "datebook/DateBook", Opie::Core::OResource::BigIcon )); |
104 | new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); | 104 | new SampleItem ( this, QObject::tr( "Sample 2" ), |
105 | Opie::Core::OResource::loadPixmap ( "Calibrate", Opie::Core::OResource::BigIcon )); | ||
106 | new SampleItem ( this, QObject::tr( "Sample 3" ), | ||
107 | Opie::Core::OResource::loadPixmap ( "UnknownDocument", Opie::Core::OResource::BigIcon )); | ||
105 | 108 | ||
106 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 109 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
107 | 110 | ||
108 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); | 111 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); |
109 | } | 112 | } |
110 | 113 | ||
111 | void setViewMode ( TabConfig::ViewMode m ) | 114 | void setViewMode ( TabConfig::ViewMode m ) |
112 | { | 115 | { |
113 | viewport ( )-> setUpdatesEnabled ( false ); | 116 | viewport ( )-> setUpdatesEnabled ( false ); |
114 | 117 | ||
115 | switch ( m ) { | 118 | switch ( m ) { |
116 | case TabConfig::List: | 119 | case TabConfig::List: |
117 | setItemTextPos( QIconView::Right ); | 120 | setItemTextPos( QIconView::Right ); |
118 | break; | 121 | break; |
119 | case TabConfig::Icon: | 122 | case TabConfig::Icon: |
120 | setItemTextPos( QIconView::Bottom ); | 123 | setItemTextPos( QIconView::Bottom ); |
121 | break; | 124 | break; |
122 | } | 125 | } |
123 | // hideOrShowItems ( false ); | 126 | // hideOrShowItems ( false ); |
124 | 127 | ||
125 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) | 128 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) |
126 | ((SampleItem *) it )-> sizeChange ( ); | 129 | ((SampleItem *) it )-> sizeChange ( ); |
127 | arrangeItemsInGrid ( true ); | 130 | arrangeItemsInGrid ( true ); |
128 | viewport ( )-> setUpdatesEnabled ( true ); | 131 | viewport ( )-> setUpdatesEnabled ( true ); |
@@ -138,49 +141,49 @@ public: | |||
138 | QPainter painter ( &bg ); | 141 | QPainter painter ( &bg ); |
139 | for ( int i = 0; i < 3; i++ ) { | 142 | for ( int i = 0; i < 3; i++ ) { |
140 | painter. setPen ( white ); | 143 | painter. setPen ( white ); |
141 | painter. drawLine ( 0, i*3, width()-1, i*3 ); | 144 | painter. drawLine ( 0, i*3, width()-1, i*3 ); |
142 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); | 145 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); |
143 | painter. setPen ( colorGroup().background().light(105) ); | 146 | painter. setPen ( colorGroup().background().light(105) ); |
144 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); | 147 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); |
145 | } | 148 | } |
146 | painter.end ( ); | 149 | painter.end ( ); |
147 | setBackgroundPixmap ( bg ); | 150 | setBackgroundPixmap ( bg ); |
148 | break; | 151 | break; |
149 | } | 152 | } |
150 | 153 | ||
151 | case TabConfig::SolidColor: { | 154 | case TabConfig::SolidColor: { |
152 | setBackgroundPixmap ( QPixmap ( )); | 155 | setBackgroundPixmap ( QPixmap ( )); |
153 | if ( val. isEmpty ( )) | 156 | if ( val. isEmpty ( )) |
154 | setBackgroundColor ( colorGroup ( ). base ( )); | 157 | setBackgroundColor ( colorGroup ( ). base ( )); |
155 | else | 158 | else |
156 | setBackgroundColor ( val ); | 159 | setBackgroundColor ( val ); |
157 | break; | 160 | break; |
158 | } | 161 | } |
159 | 162 | ||
160 | case TabConfig::Image: { | 163 | case TabConfig::Image: { |
161 | odebug << "Loading image: " << val << "" << oendl; | 164 | odebug << "Loading image: " << val << "" << oendl; |
162 | QPixmap bg = Resource::loadPixmap ( val ); | 165 | QPixmap bg = Opie::Core::OResource::loadPixmap ( val ); |
163 | if ( bg. isNull () ) | 166 | if ( bg. isNull () ) |
164 | bg = QPixmap( val ); | 167 | bg = QPixmap( val ); |
165 | setBackgroundPixmap ( bg ); | 168 | setBackgroundPixmap ( bg ); |
166 | break; | 169 | break; |
167 | } | 170 | } |
168 | } | 171 | } |
169 | m_bgtype = t; | 172 | m_bgtype = t; |
170 | viewport ( )-> update ( ); | 173 | viewport ( )-> update ( ); |
171 | } | 174 | } |
172 | 175 | ||
173 | void setTextColor ( const QColor &tc ) | 176 | void setTextColor ( const QColor &tc ) |
174 | { | 177 | { |
175 | m_textcolor = tc; | 178 | m_textcolor = tc; |
176 | QColorGroup cg = colorGroup ( ); | 179 | QColorGroup cg = colorGroup ( ); |
177 | cg. setColor ( QColorGroup::Text, tc ); | 180 | cg. setColor ( QColorGroup::Text, tc ); |
178 | setPalette ( QPalette ( cg, cg, cg )); | 181 | setPalette ( QPalette ( cg, cg, cg )); |
179 | viewport ( )-> update ( ); | 182 | viewport ( )-> update ( ); |
180 | } | 183 | } |
181 | 184 | ||
182 | void setViewFont ( const QFont &f ) | 185 | void setViewFont ( const QFont &f ) |
183 | { | 186 | { |
184 | setFont ( f ); | 187 | setFont ( f ); |
185 | } | 188 | } |
186 | 189 | ||