summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-24 23:54:38 (UTC)
committer sandman <sandman>2002-09-24 23:54:38 (UTC)
commit64110f43896391053f662186228a4fad2280f717 (patch) (unidiff)
treeb2f94a61a8de8b95a29c88d513525e7478b1d8c9
parent5ae62a1def1d21c4827560607b208033d6054ed0 (diff)
downloadopie-64110f43896391053f662186228a4fad2280f717.zip
opie-64110f43896391053f662186228a4fad2280f717.tar.gz
opie-64110f43896391053f662186228a4fad2280f717.tar.bz2
beta version - not fully functional
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/launcher.pro7
-rw-r--r--core/settings/launcher/launchersettings.cpp2
-rw-r--r--core/settings/launcher/tabconfig.h25
-rw-r--r--core/settings/launcher/tabdialog.cpp381
-rw-r--r--core/settings/launcher/tabdialog.h40
-rw-r--r--core/settings/launcher/tabssettings.cpp170
-rw-r--r--core/settings/launcher/tabssettings.h31
7 files changed, 571 insertions, 85 deletions
diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro
index a46a22f..484b159 100644
--- a/core/settings/launcher/launcher.pro
+++ b/core/settings/launcher/launcher.pro
@@ -1,17 +1,20 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = launchersettings.h \ 4HEADERS = launchersettings.h \
5 tabssettings.h \ 5 tabssettings.h \
6 taskbarsettings.h 6 taskbarsettings.h \
7 tabconfig.h \
8 tabdialog.h
7 9
8SOURCES = main.cpp \ 10SOURCES = main.cpp \
9 launchersettings.cpp \ 11 launchersettings.cpp \
10 tabssettings.cpp \ 12 tabssettings.cpp \
11 taskbarsettings.cpp 13 taskbarsettings.cpp \
14 tabdialog.cpp
12 15
13INCLUDEPATH += $(OPIEDIR)/include 16INCLUDEPATH += $(OPIEDIR)/include
14DEPENDPATH += $(OPIEDIR)/include 17DEPENDPATH += $(OPIEDIR)/include
15LIBS += -lqpe -lopie 18LIBS += -lqpe -lopie
16TARGET = launchersettings 19TARGET = launchersettings
17 20
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp
index b794519..bcb9913 100644
--- a/core/settings/launcher/launchersettings.cpp
+++ b/core/settings/launcher/launchersettings.cpp
@@ -19,12 +19,14 @@ LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false
19 19
20 m_tabs = new TabsSettings ( tw ); 20 m_tabs = new TabsSettings ( tw );
21 m_taskbar = new TaskbarSettings ( tw ); 21 m_taskbar = new TaskbarSettings ( tw );
22 22
23 tw-> addTab ( m_taskbar, "appearance/styletabicon.png", tr( "Taskbar" )); 23 tw-> addTab ( m_taskbar, "appearance/styletabicon.png", tr( "Taskbar" ));
24 tw-> addTab ( m_tabs, "appearance/styletabicon.png", tr( "Tabs" )); 24 tw-> addTab ( m_tabs, "appearance/styletabicon.png", tr( "Tabs" ));
25
26 tw-> setCurrentTab ( m_taskbar );
25} 27}
26 28
27void LauncherSettings::accept ( ) 29void LauncherSettings::accept ( )
28{ 30{
29 m_taskbar-> accept ( ); 31 m_taskbar-> accept ( );
30 m_tabs-> accept ( ); 32 m_tabs-> accept ( );
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
new file mode 100644
index 0000000..52ae81f
--- a/dev/null
+++ b/core/settings/launcher/tabconfig.h
@@ -0,0 +1,25 @@
1#ifndef __TABCONFIG_H__
2#define __TABCONFIG_H__
3
4struct TabConfig {
5 enum ViewMode {
6 Icon,
7 List
8 };
9 enum BackgroundType {
10 Ruled,
11 SolidColor,
12 Image
13 };
14
15 ViewMode m_view;
16 BackgroundType m_bg_type;
17 QString m_bg_image;
18 QString m_bg_color;
19 QString m_text_color;
20 QString m_font_family;
21 int m_font_size;
22 bool m_changed;
23};
24
25#endif
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
new file mode 100644
index 0000000..7b01cc7
--- a/dev/null
+++ b/core/settings/launcher/tabdialog.cpp
@@ -0,0 +1,381 @@
1
2#include <qpe/resource.h>
3#include <qpe/config.h>
4
5#include <qlayout.h>
6#include <qvbox.h>
7#include <qtabbar.h>
8#include <qiconview.h>
9#include <qapplication.h>
10#include <qlabel.h>
11#include <qradiobutton.h>
12#include <qbuttongroup.h>
13
14#include <opie/ofontselector.h>
15#include <opie/otabwidget.h>
16#include <opie/ocolorbutton.h>
17
18#include "tabdialog.h"
19
20
21class SampleItem : public QIconViewItem {
22public:
23 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text )
24 {
25 m_large = pix;
26 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 ));
27 }
28
29 void sizeChange ( )
30 {
31 calcRect ( );
32 repaint ( );
33 }
34
35 QPixmap *pixmap ( ) const
36 {
37 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right )
38 return (QPixmap *) &m_small;
39 else
40 return (QPixmap *) &m_large;
41 }
42private:
43 QPixmap m_large, m_small;
44};
45
46class SampleView : public QIconView {
47public:
48 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name )
49 {
50 setItemsMovable ( false );
51 setAutoArrange ( true );
52 setSorting ( true );
53 setFrameStyle ( QFrame::NoFrame );
54 setSpacing ( 4 );
55 setMargin ( 0 );
56 setSelectionMode ( QIconView::NoSelection );
57 setBackgroundMode ( PaletteBase );
58 setViewMode ( TabConfig::Icon );
59 calculateGrid ( Bottom );
60
61
62 new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" ));
63 new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" ));
64 new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" ));
65
66 setBackgroundType ( TabConfig::Ruled, QString::null );
67
68 setMaximumHeight ( firstItem ( )-> height ( ) + 16 );
69 }
70
71 void setViewMode ( TabConfig::ViewMode m )
72 {
73 viewport ( )-> setUpdatesEnabled ( false );
74
75 switch ( m ) {
76 case TabConfig::List:
77 setItemTextPos( QIconView::Right );
78 break;
79 case TabConfig::Icon:
80 setItemTextPos( QIconView::Bottom );
81 break;
82 }
83 // hideOrShowItems ( false );
84
85 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( ))
86 ((SampleItem *) it )-> sizeChange ( );
87 arrangeItemsInGrid ( true );
88 viewport ( )-> setUpdatesEnabled ( true );
89 update ( );
90 }
91
92
93 void setBackgroundType( TabConfig::BackgroundType t, const QString &val )
94 {
95 switch ( t ) {
96 case TabConfig::Ruled: {
97 QPixmap bg ( width ( ), 9 );
98 QPainter painter ( &bg );
99 for ( int i = 0; i < 3; i++ ) {
100 painter. setPen ( white );
101 painter. drawLine ( 0, i*3, width()-1, i*3 );
102 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 );
103 painter. setPen ( colorGroup().background().light(105) );
104 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 );
105 }
106 painter.end ( );
107 setBackgroundPixmap ( bg );
108 break;
109 }
110
111 case TabConfig::SolidColor: {
112 setBackgroundPixmap ( QPixmap ( ));
113 if ( val. isEmpty ( ))
114 setBackgroundColor ( colorGroup ( ). base ( ));
115 else
116 setBackgroundColor ( val );
117 break;
118 }
119
120 case TabConfig::Image: {
121 qDebug( "Loading image: %s", val.latin1() );
122 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val ));
123 if ( bg. isNull ( )) {
124 QImageIO imgio;
125 imgio. setFileName ( val );
126 QSize ds = qApp-> desktop ( )-> size ( );
127 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr
128 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( ));
129 imgio. read ( );
130 bg = imgio. image ( );
131 }
132 setBackgroundPixmap ( bg );
133 break;
134 }
135 }
136 m_bgtype = t;
137 viewport ( )-> update ( );
138 }
139
140 void setTextColor ( const QColor &tc )
141 {
142 m_textcolor = tc;
143 QColorGroup cg = colorGroup ( );
144 cg. setColor ( QColorGroup::Text, tc );
145 setPalette ( QPalette ( cg, cg, cg ));
146 viewport ( )-> update ( );
147 }
148
149 void setViewFont ( const QFont &f )
150 {
151 setFont ( f );
152 }
153
154 void setItemTextPos ( ItemTextPos pos )
155 {
156 calculateGrid ( pos );
157 QIconView::setItemTextPos( pos );
158 }
159
160 void calculateGrid ( ItemTextPos pos )
161 {
162 int dw = QApplication::desktop ( )-> width ( );
163 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( );
164 if ( pos == Bottom ) {
165 int cols = 3;
166 if ( viewerWidth <= 200 )
167 cols = 2;
168 else if ( viewerWidth >= 400 )
169 cols = viewerWidth/96;
170 setSpacing ( 4 );
171 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
172 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 );
173 }
174 else {
175 int cols = 2;
176 if ( viewerWidth < 150 )
177 cols = 1;
178 else if ( viewerWidth >= 400 )
179 cols = viewerWidth / 150;
180 setSpacing ( 2 );
181 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
182 setGridY ( fontMetrics ( ). height ( ) + 2 );
183 }
184 }
185
186 void paletteChange( const QPalette &p )
187 {
188 unsetPalette ( );
189 QIconView::paletteChange ( p );
190 if ( m_bgtype == TabConfig::Ruled )
191 setBackgroundType ( TabConfig::Ruled, QString::null );
192 QColorGroup cg = colorGroup ( );
193 cg.setColor ( QColorGroup::Text, m_textcolor );
194 setPalette ( QPalette ( cg, cg, cg ));
195 }
196
197 void setBackgroundPixmap ( const QPixmap &pm )
198 {
199 m_bgpix = pm;
200 }
201
202 void setBackgroundColor ( const QColor &c )
203 {
204 m_bgcolor = c;
205 }
206
207 void drawBackground ( QPainter *p, const QRect &r )
208 {
209 if ( !m_bgpix. isNull ( )) {
210 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ),
211 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( )));
212 }
213 else
214 p-> fillRect ( r, m_bgcolor );
215 }
216
217private:
218 QColor m_textcolor;
219 QColor m_bgcolor;
220 QPixmap m_bgpix;
221 TabConfig::BackgroundType m_bgtype;
222};
223
224
225
226TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl )
227 : QDialog ( parent, name, modal, fl )
228{
229 setCaption ( tr( "Edit Tab" ));
230
231 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
232
233 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
234 QWidget *bgtab;
235
236 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" ));
237 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" ));
238 tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) );
239
240 tw-> setCurrentTab ( bgtab );
241
242 QWidget *sample = new QVBox ( this );
243 QTabBar *tb = new QTabBar ( sample );
244 QString name ( tr( "Previewing %1" ). arg ( tabname ));
245
246 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
247
248 m_sample = new SampleView ( sample );
249
250 lay-> addWidget ( tw, 10 );
251 lay-> addWidget ( sample, 1 );
252}
253
254
255TabDialog::~TabDialog ( )
256{
257}
258
259QWidget *TabDialog::createFontTab ( QWidget *parent )
260{
261 Config config ( "qpe" );
262 config. setGroup ( "Appearance" );
263
264 QString familyStr = config.readEntry( "FontFamily", "Helvetica" );
265 QString styleStr = config.readEntry( "FontStyle", "Regular" );
266 int size = config.readNumEntry( "FontSize", 10 );
267
268 m_fontselect = new OFontSelector ( parent, "FontTab" );
269 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
270
271 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
272 this, SLOT( fontClicked ( const QFont & )));
273
274 return m_fontselect;
275}
276
277QWidget *TabDialog::createBgTab ( QWidget *parent )
278{
279 QWidget *tab = new QWidget( parent, "AdvancedTab" );
280 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
281
282 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
283 gridLayout-> setColStretch ( 1, 10 );
284
285 QLabel* label = new QLabel( tr( "Type:" ), tab );
286 gridLayout-> addWidget ( label, 0, 0 );
287 m_bgtype = new QButtonGroup( tab, "buttongroup" );
288 m_bgtype-> hide ( );
289 m_bgtype-> setExclusive ( true );
290
291 QRadioButton *rb;
292 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
293 m_bgtype-> insert ( rb, TabConfig::Ruled );
294 gridLayout-> addWidget( rb, 0, 1 );
295
296 QHBoxLayout *hb = new QHBoxLayout ( );
297 hb-> setSpacing ( 4 );
298
299 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
300 m_bgtype-> insert ( rb, TabConfig::SolidColor );
301 hb-> addWidget ( rb );
302
303 m_solidcolor = new OColorButton ( tab );
304 connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( colorClicked ( const QColor & )));
305 hb-> addWidget ( m_solidcolor );
306 hb-> addStretch ( 10 );
307
308 gridLayout-> addLayout ( hb, 1, 1 );
309
310 rb = new QRadioButton( tr( "Image" ), tab, "image" );
311 m_bgtype-> insert ( rb, TabConfig::Image );
312 gridLayout-> addWidget( rb, 3, 1 );
313
314 QPushButton *p;
315
316 connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int )));
317
318 vertLayout-> addStretch ( 10 );
319
320 return tab;
321}
322
323QWidget *TabDialog::createIconTab ( QWidget *parent )
324{
325 QWidget *tab = new QWidget( parent, "AdvancedTab" );
326 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
327
328 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
329 gridLayout-> setColStretch ( 1, 10 );
330
331 QLabel* label = new QLabel( tr( "Size:" ), tab );
332 gridLayout-> addWidget ( label, 0, 0 );
333 m_iconsize = new QButtonGroup( tab, "buttongroup" );
334 m_iconsize-> hide ( );
335 m_iconsize-> setExclusive ( true );
336
337 QRadioButton *rb;
338 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
339 m_iconsize-> insert ( rb, TabConfig::List );
340 gridLayout-> addWidget( rb, 0, 1 );
341
342 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" );
343 m_iconsize-> insert ( rb, TabConfig::Icon );
344 gridLayout-> addWidget( rb, 1, 1 );
345
346 connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int )));
347
348 vertLayout-> addStretch ( 10 );
349
350 return tab;
351}
352
353
354void TabDialog::iconSizeClicked ( int s )
355{
356 m_sample-> setViewMode ((TabConfig::ViewMode) s );
357}
358
359void TabDialog::fontClicked ( const QFont &f )
360{
361 m_sample-> setViewFont ( f );
362}
363
364void TabDialog::bgTypeClicked ( int t )
365{
366 QString s;
367
368 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
369 //m_imagebrowse-> setEnabled ( t == TabConfig::Image );
370 //m_imagedefault-> setEnabled ( t == TabConfig::Image );
371
372 if ( t == TabConfig::SolidColor )
373 s = m_solidcolor-> color ( ). name ( );
374
375 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
376}
377
378void TabDialog::colorClicked ( const QColor &col )
379{
380 m_sample-> setBackgroundType ( TabConfig::SolidColor, col. name ( ));
381}
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h
new file mode 100644
index 0000000..d602573
--- a/dev/null
+++ b/core/settings/launcher/tabdialog.h
@@ -0,0 +1,40 @@
1#ifndef __TABDIALOG_H__
2#define __TABDIALOG_H__
3
4#include <qdialog.h>
5#include "tabconfig.h"
6
7class QButtonGroup;
8class OFontSelector;
9class SampleView;
10class OColorButton;
11
12class TabDialog : public QDialog {
13 Q_OBJECT
14public:
15 TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags = 0 );
16 virtual ~TabDialog ( );
17
18protected slots:
19 void iconSizeClicked ( int );
20 void fontClicked ( const QFont & );
21 void bgTypeClicked ( int );
22 void colorClicked ( const QColor & );
23
24private:
25 QWidget *createBgTab ( QWidget *parent );
26 QWidget *createFontTab ( QWidget *parent );
27 QWidget *createIconTab ( QWidget *parent );
28
29
30private:
31 SampleView *m_sample;
32 QButtonGroup *m_iconsize;
33 OFontSelector *m_fontselect;
34 OColorButton *m_solidcolor;
35
36 QButtonGroup *m_bgtype;
37};
38
39
40#endif \ No newline at end of file
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 292c615..fc2d2c9 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -24,154 +24,202 @@
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26#include <qpe/mimetype.h> 26#include <qpe/mimetype.h>
27#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29 29
30#include <qlistview.h> 30#include <qlistbox.h>
31#include <qheader.h> 31#include <qpushbutton.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qwhatsthis.h> 34#include <qwhatsthis.h>
35 35
36#include "tabdialog.h"
37
36#include <stdlib.h> 38#include <stdlib.h>
39#include <qmessagebox.h>
40
41
37 42
38TabsSettings::TabsSettings ( QWidget *parent, const char *name ) 43TabsSettings::TabsSettings ( QWidget *parent, const char *name )
39 : QWidget ( parent, name ) 44 : QWidget ( parent, name )
40{ 45{
41 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 46 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
42 47
43 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); 48 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
44 lay-> addWidget ( l ); 49 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
45 50
46 m_list = new QListView ( this ); 51 m_list = new QListBox ( this );
47 m_list-> addColumn ( "foobar" ); 52 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
48 m_list-> header ( )-> hide ( );
49
50 lay-> addWidget ( m_list );
51 53
52 QWhatsThis::add ( m_list, tr( "foobar" )); 54 QWhatsThis::add ( m_list, tr( "foobar" ));
55
56 QPushButton *p;
57 p = new QPushButton ( tr( "New" ), this );
58 lay-> addWidget ( p, 1, 1 );
59 connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
60
61 p = new QPushButton ( tr( "Edit" ), this );
62 lay-> addWidget ( p, 2, 1 );
63 connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
64
65 p = new QPushButton ( tr( "Delete" ), this );
66 lay-> addWidget ( p, 3, 1 );
67 connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
68
69 lay-> setRowStretch ( 4, 10 );
53 70
54 init ( ); 71 init ( );
55} 72}
56 73
57void TabsSettings::init ( ) 74void TabsSettings::init ( )
58{ 75{
59 QListViewItem *lvi;
60
61 AppLnkSet rootFolder( MimeType::appsFolderName ( )); 76 AppLnkSet rootFolder( MimeType::appsFolderName ( ));
62 QStringList types = rootFolder. types ( ); 77 QStringList types = rootFolder. types ( );
78
63 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 79 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
64 lvi = new QListViewItem ( m_list, rootFolder. typeName ( *it )); 80 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
65 lvi-> setPixmap ( 0, rootFolder. typePixmap ( *it ));
66 m_ids << *it; 81 m_ids << *it;
67 } 82 }
68 QImage img ( Resource::loadImage ( "DocsIcon" )); 83 QImage img ( Resource::loadImage ( "DocsIcon" ));
69 QPixmap pix; 84 QPixmap pix;
70 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); 85 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
71 lvi = new QListViewItem ( m_list, tr( "Documents" )); 86 m_list-> insertItem ( pix, tr( "Documents" ));
72 lvi-> setPixmap ( 0, pix );
73 m_ids += "Documents"; // No tr 87 m_ids += "Documents"; // No tr
74 88
75 readTabSettings ( ); 89 readTabSettings ( );
76} 90}
77 91
78void TabsSettings::readTabSettings ( ) 92void TabsSettings::readTabSettings ( )
79{ 93{
80 Config cfg ( "Launcher" ); 94 Config cfg ( "Launcher" );
81 QString grp ( "Tab %1" ); // No tr 95 QString grp ( "Tab %1" ); // No tr
82 m_tabs. clear ( ); 96 m_tabs. clear ( );
83 97
84 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 98 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
85 TabSettings ts; 99 TabConfig tc;
86 ts. m_view = Icon; 100 tc. m_view = TabConfig::Icon;
87 ts. m_bg_type = Ruled; 101 tc. m_bg_type = TabConfig::Ruled;
88 ts. m_changed = false; 102 tc. m_changed = false;
89 103
90 cfg. setGroup ( grp. arg ( *it )); 104 cfg. setGroup ( grp. arg ( *it ));
91 105
92 QString view = cfg. readEntry ( "View", "Icon" ); 106 QString view = cfg. readEntry ( "View", "Icon" );
93 if ( view == "List" ) // No tr 107 if ( view == "List" ) // No tr
94 ts. m_view = List; 108 tc. m_view = TabConfig::List;
95 109
96 QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" ); 110 QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" );
97 if ( bgType == "SolidColor" ) 111 if ( bgType == "SolidColor" )
98 ts. m_bg_type = SolidColor; 112 tc. m_bg_type = TabConfig::SolidColor;
99 else if ( bgType == "Image" ) // No tr 113 else if ( bgType == "Image" ) // No tr
100 ts. m_bg_type = Image; 114 tc. m_bg_type = TabConfig::Image;
101 115
102 ts. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" ); 116 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" );
103 ts. m_bg_color = cfg. readEntry ( "BackgroundColor" ); 117 tc. m_bg_color = cfg. readEntry ( "BackgroundColor" );
104 ts. m_text_color = cfg. readEntry ( "TextColor" ); 118 tc. m_text_color = cfg. readEntry ( "TextColor" );
105 QStringList f = cfg. readListEntry ( "Font", ',' ); 119 QStringList f = cfg. readListEntry ( "Font", ',' );
106 if ( f. count ( ) == 4 ) { 120 if ( f. count ( ) == 4 ) {
107 ts. m_font_family = f [0]; 121 tc. m_font_family = f [0];
108 ts. m_font_size = f [1]. toInt ( ); 122 tc. m_font_size = f [1]. toInt ( );
109 } else { 123 } else {
110 ts. m_font_family = font ( ). family ( ); 124 tc. m_font_family = font ( ). family ( );
111 ts. m_font_size = font ( ). pointSize ( ); 125 tc. m_font_size = font ( ). pointSize ( );
112 } 126 }
113 m_tabs [*it] = ts; 127 m_tabs [*it] = tc;
114 } 128 }
115} 129}
116 130
117 131
118void TabsSettings::accept ( ) 132void TabsSettings::accept ( )
119{ 133{
120 Config cfg ( "Launcher" ); 134 Config cfg ( "Launcher" );
121 135
122 // Launcher Tab 136 // Launcher Tab
123 QString grp ( "Tab %1" ); // No tr 137 QString grp ( "Tab %1" ); // No tr
124 138
125 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 139 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
126 TabSettings &tab = m_tabs [*it]; 140 TabConfig &tc = m_tabs [*it];
127 141
128 cfg. setGroup ( grp. arg ( *it )); 142 cfg. setGroup ( grp. arg ( *it ));
129 if ( !tab. m_changed ) 143 if ( !tc. m_changed )
130 continue; 144 continue;
131 switch ( tab. m_view ) { 145 switch ( tc. m_view ) {
132 case Icon: 146 case TabConfig::Icon:
133 cfg.writeEntry ( "View", "Icon" ); 147 cfg.writeEntry ( "View", "Icon" );
134 break; 148 break;
135 case List: 149 case TabConfig::List:
136 cfg.writeEntry ( "View", "List" ); 150 cfg.writeEntry ( "View", "List" );
137 break; 151 break;
138 } 152 }
139 153
140 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); 154 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
141 e << *it << tab. m_view; 155 e << *it << tc. m_view;
142 156
143 cfg. writeEntry ( "BackgroundImage", tab. m_bg_image ); 157 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
144 cfg. writeEntry ( "BackgroundColor", tab. m_bg_color ); 158 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
145 cfg. writeEntry ( "TextColor", tab. m_text_color ); 159 cfg. writeEntry ( "TextColor", tc. m_text_color );
146 160
147 QString f = tab. m_font_family + "," + QString::number ( tab. m_font_size ) + ",50,0"; 161 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + ",50,0";
148 cfg. writeEntry ( "Font", f ); 162 cfg. writeEntry ( "Font", f );
149 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); 163 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
150 164
151 switch ( tab. m_bg_type ) { 165 switch ( tc. m_bg_type ) {
152 case Ruled: 166 case TabConfig::Ruled:
153 cfg.writeEntry( "BackgroundType", "Ruled" ); 167 cfg.writeEntry( "BackgroundType", "Ruled" );
154 be << *it << tab. m_bg_type << QString(""); 168 be << *it << tc. m_bg_type << QString("");
155 break; 169 break;
156 case SolidColor: 170 case TabConfig::SolidColor:
157 cfg.writeEntry( "BackgroundType", "SolidColor" ); 171 cfg.writeEntry( "BackgroundType", "SolidColor" );
158 be << *it << tab. m_bg_type << tab. m_bg_color; 172 be << *it << tc. m_bg_type << tc. m_bg_color;
159 break; 173 break;
160 case Image: 174 case TabConfig::Image:
161 cfg.writeEntry( "BackgroundType", "Image" ); 175 cfg.writeEntry( "BackgroundType", "Image" );
162 be << *it << tab. m_bg_type << tab. m_bg_image; 176 be << *it << tc. m_bg_type << tc. m_bg_image;
163 break; 177 break;
164 } 178 }
165 179
166 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); 180 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
167 te << *it << tab. m_text_color; 181 te << *it << tc. m_text_color;
168 182
169 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); 183 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
170 fe << *it << tab. m_font_family; 184 fe << *it << tc. m_font_family;
171 fe << tab. m_font_size; 185 fe << tc. m_font_size;
172 fe << 50 << 0; 186 fe << 50 << 0;
173 187
174 tab. m_changed = false; 188 tc. m_changed = false;
175 } 189 }
176} 190}
177 191
192void TabsSettings::newClicked ( )
193{
194 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
195}
196
197void TabsSettings::deleteClicked ( )
198{
199 int ind = m_list-> currentItem ( );
200
201 if ( ind < 0 )
202 return;
203
204 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
205}
206
207void TabsSettings::editClicked ( )
208{
209 int ind = m_list-> currentItem ( );
210
211 if ( ind < 0 )
212 return;
213
214 TabConfig tc = m_tabs [m_ids [ind]];
215
216 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
217
218 d-> showMaximized ( );
219 if ( d-> exec ( ) == QDialog::Accepted ) {
220 tc. m_changed = true;
221 m_tabs [m_ids [ind]] = tc;
222 }
223
224 delete d;
225}
diff --git a/core/settings/launcher/tabssettings.h b/core/settings/launcher/tabssettings.h
index 17b6e25..76cae68 100644
--- a/core/settings/launcher/tabssettings.h
+++ b/core/settings/launcher/tabssettings.h
@@ -1,52 +1,39 @@
1#ifndef __TABS_SETTINGS_H__ 1#ifndef __TABS_SETTINGS_H__
2#define __TABS_SETTINGS_H__ 2#define __TABS_SETTINGS_H__
3 3
4#include <qwidget.h> 4#include <qwidget.h>
5#include <qmap.h> 5#include <qmap.h>
6 6
7class QListView; 7#include "tabconfig.h"
8
9class QListBox;
8 10
9 11
10class TabsSettings : public QWidget { 12class TabsSettings : public QWidget {
11 Q_OBJECT 13 Q_OBJECT
12 14
13public: 15public:
14 TabsSettings ( QWidget *parent = 0, const char *name = 0 ); 16 TabsSettings ( QWidget *parent = 0, const char *name = 0 );
15 17
16 void accept ( ); 18 void accept ( );
17 19
18 enum ViewMode { 20protected slots:
19 Icon, 21 void newClicked ( );
20 List 22 void deleteClicked ( );
21 }; 23 void editClicked ( );
22 enum BackgroundType {
23 Ruled,
24 SolidColor,
25 Image
26 };
27 struct TabSettings {
28 ViewMode m_view;
29 BackgroundType m_bg_type;
30 QString m_bg_image;
31 QString m_bg_color;
32 QString m_text_color;
33 QString m_font_family;
34 int m_font_size;
35 bool m_changed;
36 };
37 24
38protected: 25protected:
39 void init ( ); 26 void init ( );
40 void readTabSettings ( ); 27 void readTabSettings ( );
41 28
42private: 29private:
43 QListView *m_list; 30 QListBox *m_list;
44 //QString currentTab; 31 //QString currentTab;
45 QStringList m_ids; 32 QStringList m_ids;
46 QMap <QString, TabSettings> m_tabs; 33 QMap <QString, TabConfig> m_tabs;
47}; 34};
48 35
49 36
50 37
51 38
52#endif 39#endif