summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/settings/launcher/tabconfig.h1
-rw-r--r--core/settings/launcher/tabdialog.cpp34
-rw-r--r--core/settings/launcher/tabdialog.h5
-rw-r--r--core/settings/launcher/tabssettings.cpp4
4 files changed, 32 insertions, 12 deletions
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
index 52ae81f..8f21eb4 100644
--- a/core/settings/launcher/tabconfig.h
+++ b/core/settings/launcher/tabconfig.h
@@ -15,11 +15,12 @@ struct TabConfig {
15 ViewMode m_view; 15 ViewMode m_view;
16 BackgroundType m_bg_type; 16 BackgroundType m_bg_type;
17 QString m_bg_image; 17 QString m_bg_image;
18 QString m_bg_color; 18 QString m_bg_color;
19 QString m_text_color; 19 QString m_text_color;
20 QString m_font_family; 20 QString m_font_family;
21 QString m_font_style;
21 int m_font_size; 22 int m_font_size;
22 bool m_changed; 23 bool m_changed;
23}; 24};
24 25
25#endif 26#endif
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index 7b01cc7..ca48e66 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -221,13 +221,13 @@ private:
221 TabConfig::BackgroundType m_bgtype; 221 TabConfig::BackgroundType m_bgtype;
222}; 222};
223 223
224 224
225 225
226TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) 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 ) 227 : QDialog ( parent, name, modal, fl ), m_tc ( tc )
228{ 228{
229 setCaption ( tr( "Edit Tab" )); 229 setCaption ( tr( "Edit Tab" ));
230 230
231 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 231 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
232 232
233 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 233 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
@@ -246,30 +246,30 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig
246 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); 246 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
247 247
248 m_sample = new SampleView ( sample ); 248 m_sample = new SampleView ( sample );
249 249
250 lay-> addWidget ( tw, 10 ); 250 lay-> addWidget ( tw, 10 );
251 lay-> addWidget ( sample, 1 ); 251 lay-> addWidget ( sample, 1 );
252
253 m_iconsize-> setButton ( tc. m_view );
254 iconSizeClicked ( tc. m_view );
255 m_bgtype-> setButton ( tc. m_bg_type );
256 m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
257 bgTypeClicked ( tc. m_bg_type );
258 m_fontselect-> setSelectedFont ( tc. m_font_family, tc. m_font_style, tc. m_font_size );
259 fontClicked ( m_fontselect-> selectedFont ( ));
252} 260}
253 261
254 262
255TabDialog::~TabDialog ( ) 263TabDialog::~TabDialog ( )
256{ 264{
257} 265}
258 266
259QWidget *TabDialog::createFontTab ( QWidget *parent ) 267QWidget *TabDialog::createFontTab ( QWidget *parent )
260{ 268{
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 = new OFontSelector ( parent, "FontTab" );
269 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
270 270
271 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 271 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
272 this, SLOT( fontClicked ( const QFont & ))); 272 this, SLOT( fontClicked ( const QFont & )));
273 273
274 return m_fontselect; 274 return m_fontselect;
275} 275}
@@ -296,25 +296,25 @@ QWidget *TabDialog::createBgTab ( QWidget *parent )
296 QHBoxLayout *hb = new QHBoxLayout ( ); 296 QHBoxLayout *hb = new QHBoxLayout ( );
297 hb-> setSpacing ( 4 ); 297 hb-> setSpacing ( 4 );
298 298
299 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); 299 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
300 m_bgtype-> insert ( rb, TabConfig::SolidColor ); 300 m_bgtype-> insert ( rb, TabConfig::SolidColor );
301 hb-> addWidget ( rb ); 301 hb-> addWidget ( rb );
302 hb-> addSpacing ( 10 );
302 303
303 m_solidcolor = new OColorButton ( tab ); 304 m_solidcolor = new OColorButton ( tab );
304 connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( colorClicked ( const QColor & ))); 305 connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( colorClicked ( const QColor & )));
305 hb-> addWidget ( m_solidcolor ); 306 hb-> addWidget ( m_solidcolor );
306 hb-> addStretch ( 10 );
307 307
308 gridLayout-> addLayout ( hb, 1, 1 ); 308 gridLayout-> addLayout ( hb, 1, 1 );
309 309
310 rb = new QRadioButton( tr( "Image" ), tab, "image" ); 310 rb = new QRadioButton( tr( "Image" ), tab, "image" );
311 m_bgtype-> insert ( rb, TabConfig::Image ); 311 m_bgtype-> insert ( rb, TabConfig::Image );
312 gridLayout-> addWidget( rb, 3, 1 ); 312 gridLayout-> addWidget( rb, 3, 1 );
313 313
314 QPushButton *p; 314 //QPushButton *p;
315 315
316 connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); 316 connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int )));
317 317
318 vertLayout-> addStretch ( 10 ); 318 vertLayout-> addStretch ( 10 );
319 319
320 return tab; 320 return tab;
@@ -376,6 +376,18 @@ void TabDialog::bgTypeClicked ( int t )
376} 376}
377 377
378void TabDialog::colorClicked ( const QColor &col ) 378void TabDialog::colorClicked ( const QColor &col )
379{ 379{
380 m_sample-> setBackgroundType ( TabConfig::SolidColor, col. name ( )); 380 m_sample-> setBackgroundType ( TabConfig::SolidColor, col. name ( ));
381} 381}
382
383void TabDialog::accept ( )
384{
385 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 ( ));
387 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( );
388 m_tc. m_font_family = m_fontselect-> fontFamily ( );
389 m_tc. m_font_size = m_fontselect-> fontSize ( );
390 m_tc. m_font_style = m_fontselect-> fontStyle ( );
391
392 QDialog::accept ( );
393}
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h
index d602573..e1935fd 100644
--- a/core/settings/launcher/tabdialog.h
+++ b/core/settings/launcher/tabdialog.h
@@ -12,12 +12,15 @@ class OColorButton;
12class TabDialog : public QDialog { 12class TabDialog : public QDialog {
13 Q_OBJECT 13 Q_OBJECT
14public: 14public:
15 TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags = 0 ); 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 ( ); 16 virtual ~TabDialog ( );
17 17
18public slots:
19 virtual void accept ( );
20
18protected slots: 21protected slots:
19 void iconSizeClicked ( int ); 22 void iconSizeClicked ( int );
20 void fontClicked ( const QFont & ); 23 void fontClicked ( const QFont & );
21 void bgTypeClicked ( int ); 24 void bgTypeClicked ( int );
22 void colorClicked ( const QColor & ); 25 void colorClicked ( const QColor & );
23 26
@@ -31,10 +34,12 @@ private:
31 SampleView *m_sample; 34 SampleView *m_sample;
32 QButtonGroup *m_iconsize; 35 QButtonGroup *m_iconsize;
33 OFontSelector *m_fontselect; 36 OFontSelector *m_fontselect;
34 OColorButton *m_solidcolor; 37 OColorButton *m_solidcolor;
35 38
36 QButtonGroup *m_bgtype; 39 QButtonGroup *m_bgtype;
40
41 TabConfig &m_tc;
37}; 42};
38 43
39 44
40#endif \ No newline at end of file 45#endif \ No newline at end of file
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index fc2d2c9..ae78733 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -117,15 +117,17 @@ void TabsSettings::readTabSettings ( )
117 tc. m_bg_color = cfg. readEntry ( "BackgroundColor" ); 117 tc. m_bg_color = cfg. readEntry ( "BackgroundColor" );
118 tc. m_text_color = cfg. readEntry ( "TextColor" ); 118 tc. m_text_color = cfg. readEntry ( "TextColor" );
119 QStringList f = cfg. readListEntry ( "Font", ',' ); 119 QStringList f = cfg. readListEntry ( "Font", ',' );
120 if ( f. count ( ) == 4 ) { 120 if ( f. count ( ) == 4 ) {
121 tc. m_font_family = f [0]; 121 tc. m_font_family = f [0];
122 tc. m_font_size = f [1]. toInt ( ); 122 tc. m_font_size = f [1]. toInt ( );
123 tc. m_font_style = f [2];
123 } else { 124 } else {
124 tc. m_font_family = font ( ). family ( ); 125 tc. m_font_family = font ( ). family ( );
125 tc. m_font_size = font ( ). pointSize ( ); 126 tc. m_font_size = font ( ). pointSize ( );
127 tc. m_font_style = "Regular";
126 } 128 }
127 m_tabs [*it] = tc; 129 m_tabs [*it] = tc;
128 } 130 }
129} 131}
130 132
131 133
@@ -155,13 +157,13 @@ void TabsSettings::accept ( )
155 e << *it << tc. m_view; 157 e << *it << tc. m_view;
156 158
157 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); 159 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
158 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); 160 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
159 cfg. writeEntry ( "TextColor", tc. m_text_color ); 161 cfg. writeEntry ( "TextColor", tc. m_text_color );
160 162
161 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + ",50,0"; 163 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + tc. m_font_style + ",0";
162 cfg. writeEntry ( "Font", f ); 164 cfg. writeEntry ( "Font", f );
163 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); 165 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
164 166
165 switch ( tc. m_bg_type ) { 167 switch ( tc. m_bg_type ) {
166 case TabConfig::Ruled: 168 case TabConfig::Ruled:
167 cfg.writeEntry( "BackgroundType", "Ruled" ); 169 cfg.writeEntry( "BackgroundType", "Ruled" );