-rw-r--r-- | core/settings/launcher/tabconfig.h | 1 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 34 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.h | 5 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 4 |
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 | |||
@@ -1,25 +1,26 @@ | |||
1 | #ifndef __TABCONFIG_H__ | 1 | #ifndef __TABCONFIG_H__ |
2 | #define __TABCONFIG_H__ | 2 | #define __TABCONFIG_H__ |
3 | 3 | ||
4 | struct TabConfig { | 4 | struct TabConfig { |
5 | enum ViewMode { | 5 | enum ViewMode { |
6 | Icon, | 6 | Icon, |
7 | List | 7 | List |
8 | }; | 8 | }; |
9 | enum BackgroundType { | 9 | enum BackgroundType { |
10 | Ruled, | 10 | Ruled, |
11 | SolidColor, | 11 | SolidColor, |
12 | Image | 12 | Image |
13 | }; | 13 | }; |
14 | 14 | ||
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 | |||
@@ -163,219 +163,231 @@ public: | |||
163 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); | 163 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); |
164 | if ( pos == Bottom ) { | 164 | if ( pos == Bottom ) { |
165 | int cols = 3; | 165 | int cols = 3; |
166 | if ( viewerWidth <= 200 ) | 166 | if ( viewerWidth <= 200 ) |
167 | cols = 2; | 167 | cols = 2; |
168 | else if ( viewerWidth >= 400 ) | 168 | else if ( viewerWidth >= 400 ) |
169 | cols = viewerWidth/96; | 169 | cols = viewerWidth/96; |
170 | setSpacing ( 4 ); | 170 | setSpacing ( 4 ); |
171 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 171 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
172 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); | 172 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); |
173 | } | 173 | } |
174 | else { | 174 | else { |
175 | int cols = 2; | 175 | int cols = 2; |
176 | if ( viewerWidth < 150 ) | 176 | if ( viewerWidth < 150 ) |
177 | cols = 1; | 177 | cols = 1; |
178 | else if ( viewerWidth >= 400 ) | 178 | else if ( viewerWidth >= 400 ) |
179 | cols = viewerWidth / 150; | 179 | cols = viewerWidth / 150; |
180 | setSpacing ( 2 ); | 180 | setSpacing ( 2 ); |
181 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 181 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
182 | setGridY ( fontMetrics ( ). height ( ) + 2 ); | 182 | setGridY ( fontMetrics ( ). height ( ) + 2 ); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | void paletteChange( const QPalette &p ) | 186 | void paletteChange( const QPalette &p ) |
187 | { | 187 | { |
188 | unsetPalette ( ); | 188 | unsetPalette ( ); |
189 | QIconView::paletteChange ( p ); | 189 | QIconView::paletteChange ( p ); |
190 | if ( m_bgtype == TabConfig::Ruled ) | 190 | if ( m_bgtype == TabConfig::Ruled ) |
191 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 191 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
192 | QColorGroup cg = colorGroup ( ); | 192 | QColorGroup cg = colorGroup ( ); |
193 | cg.setColor ( QColorGroup::Text, m_textcolor ); | 193 | cg.setColor ( QColorGroup::Text, m_textcolor ); |
194 | setPalette ( QPalette ( cg, cg, cg )); | 194 | setPalette ( QPalette ( cg, cg, cg )); |
195 | } | 195 | } |
196 | 196 | ||
197 | void setBackgroundPixmap ( const QPixmap &pm ) | 197 | void setBackgroundPixmap ( const QPixmap &pm ) |
198 | { | 198 | { |
199 | m_bgpix = pm; | 199 | m_bgpix = pm; |
200 | } | 200 | } |
201 | 201 | ||
202 | void setBackgroundColor ( const QColor &c ) | 202 | void setBackgroundColor ( const QColor &c ) |
203 | { | 203 | { |
204 | m_bgcolor = c; | 204 | m_bgcolor = c; |
205 | } | 205 | } |
206 | 206 | ||
207 | void drawBackground ( QPainter *p, const QRect &r ) | 207 | void drawBackground ( QPainter *p, const QRect &r ) |
208 | { | 208 | { |
209 | if ( !m_bgpix. isNull ( )) { | 209 | if ( !m_bgpix. isNull ( )) { |
210 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 210 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
211 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 211 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
212 | } | 212 | } |
213 | else | 213 | else |
214 | p-> fillRect ( r, m_bgcolor ); | 214 | p-> fillRect ( r, m_bgcolor ); |
215 | } | 215 | } |
216 | 216 | ||
217 | private: | 217 | private: |
218 | QColor m_textcolor; | 218 | QColor m_textcolor; |
219 | QColor m_bgcolor; | 219 | QColor m_bgcolor; |
220 | QPixmap m_bgpix; | 220 | QPixmap m_bgpix; |
221 | TabConfig::BackgroundType m_bgtype; | 221 | TabConfig::BackgroundType m_bgtype; |
222 | }; | 222 | }; |
223 | 223 | ||
224 | 224 | ||
225 | 225 | ||
226 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) | 226 | 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 ) | 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 ); |
234 | QWidget *bgtab; | 234 | QWidget *bgtab; |
235 | 235 | ||
236 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); | 236 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); |
237 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); | 237 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); |
238 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); | 238 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); |
239 | 239 | ||
240 | tw-> setCurrentTab ( bgtab ); | 240 | tw-> setCurrentTab ( bgtab ); |
241 | 241 | ||
242 | QWidget *sample = new QVBox ( this ); | 242 | QWidget *sample = new QVBox ( this ); |
243 | QTabBar *tb = new QTabBar ( sample ); | 243 | QTabBar *tb = new QTabBar ( sample ); |
244 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 244 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
245 | 245 | ||
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 | ||
255 | TabDialog::~TabDialog ( ) | 263 | TabDialog::~TabDialog ( ) |
256 | { | 264 | { |
257 | } | 265 | } |
258 | 266 | ||
259 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 267 | QWidget *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 | } |
276 | 276 | ||
277 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 277 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
278 | { | 278 | { |
279 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 279 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); |
280 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 280 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); |
281 | 281 | ||
282 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 282 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
283 | gridLayout-> setColStretch ( 1, 10 ); | 283 | gridLayout-> setColStretch ( 1, 10 ); |
284 | 284 | ||
285 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 285 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
286 | gridLayout-> addWidget ( label, 0, 0 ); | 286 | gridLayout-> addWidget ( label, 0, 0 ); |
287 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 287 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
288 | m_bgtype-> hide ( ); | 288 | m_bgtype-> hide ( ); |
289 | m_bgtype-> setExclusive ( true ); | 289 | m_bgtype-> setExclusive ( true ); |
290 | 290 | ||
291 | QRadioButton *rb; | 291 | QRadioButton *rb; |
292 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 292 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
293 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 293 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
294 | gridLayout-> addWidget( rb, 0, 1 ); | 294 | gridLayout-> addWidget( rb, 0, 1 ); |
295 | 295 | ||
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; |
321 | } | 321 | } |
322 | 322 | ||
323 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 323 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
324 | { | 324 | { |
325 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 325 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); |
326 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 326 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); |
327 | 327 | ||
328 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 328 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
329 | gridLayout-> setColStretch ( 1, 10 ); | 329 | gridLayout-> setColStretch ( 1, 10 ); |
330 | 330 | ||
331 | QLabel* label = new QLabel( tr( "Size:" ), tab ); | 331 | QLabel* label = new QLabel( tr( "Size:" ), tab ); |
332 | gridLayout-> addWidget ( label, 0, 0 ); | 332 | gridLayout-> addWidget ( label, 0, 0 ); |
333 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); | 333 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); |
334 | m_iconsize-> hide ( ); | 334 | m_iconsize-> hide ( ); |
335 | m_iconsize-> setExclusive ( true ); | 335 | m_iconsize-> setExclusive ( true ); |
336 | 336 | ||
337 | QRadioButton *rb; | 337 | QRadioButton *rb; |
338 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); | 338 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); |
339 | m_iconsize-> insert ( rb, TabConfig::List ); | 339 | m_iconsize-> insert ( rb, TabConfig::List ); |
340 | gridLayout-> addWidget( rb, 0, 1 ); | 340 | gridLayout-> addWidget( rb, 0, 1 ); |
341 | 341 | ||
342 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); | 342 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); |
343 | m_iconsize-> insert ( rb, TabConfig::Icon ); | 343 | m_iconsize-> insert ( rb, TabConfig::Icon ); |
344 | gridLayout-> addWidget( rb, 1, 1 ); | 344 | gridLayout-> addWidget( rb, 1, 1 ); |
345 | 345 | ||
346 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); | 346 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); |
347 | 347 | ||
348 | vertLayout-> addStretch ( 10 ); | 348 | vertLayout-> addStretch ( 10 ); |
349 | 349 | ||
350 | return tab; | 350 | return tab; |
351 | } | 351 | } |
352 | 352 | ||
353 | 353 | ||
354 | void TabDialog::iconSizeClicked ( int s ) | 354 | void TabDialog::iconSizeClicked ( int s ) |
355 | { | 355 | { |
356 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); | 356 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); |
357 | } | 357 | } |
358 | 358 | ||
359 | void TabDialog::fontClicked ( const QFont &f ) | 359 | void TabDialog::fontClicked ( const QFont &f ) |
360 | { | 360 | { |
361 | m_sample-> setViewFont ( f ); | 361 | m_sample-> setViewFont ( f ); |
362 | } | 362 | } |
363 | 363 | ||
364 | void TabDialog::bgTypeClicked ( int t ) | 364 | void TabDialog::bgTypeClicked ( int t ) |
365 | { | 365 | { |
366 | QString s; | 366 | QString s; |
367 | 367 | ||
368 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); | 368 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); |
369 | //m_imagebrowse-> setEnabled ( t == TabConfig::Image ); | 369 | //m_imagebrowse-> setEnabled ( t == TabConfig::Image ); |
370 | //m_imagedefault-> setEnabled ( t == TabConfig::Image ); | 370 | //m_imagedefault-> setEnabled ( t == TabConfig::Image ); |
371 | 371 | ||
372 | if ( t == TabConfig::SolidColor ) | 372 | if ( t == TabConfig::SolidColor ) |
373 | s = m_solidcolor-> color ( ). name ( ); | 373 | s = m_solidcolor-> color ( ). name ( ); |
374 | 374 | ||
375 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); | 375 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); |
376 | } | 376 | } |
377 | 377 | ||
378 | void TabDialog::colorClicked ( const QColor &col ) | 378 | void 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 | |||
383 | void 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 | |||
@@ -1,40 +1,45 @@ | |||
1 | #ifndef __TABDIALOG_H__ | 1 | #ifndef __TABDIALOG_H__ |
2 | #define __TABDIALOG_H__ | 2 | #define __TABDIALOG_H__ |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | #include "tabconfig.h" | 5 | #include "tabconfig.h" |
6 | 6 | ||
7 | class QButtonGroup; | 7 | class QButtonGroup; |
8 | class OFontSelector; | 8 | class OFontSelector; |
9 | class SampleView; | 9 | class SampleView; |
10 | class OColorButton; | 10 | class OColorButton; |
11 | 11 | ||
12 | class TabDialog : public QDialog { | 12 | class TabDialog : public QDialog { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
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 | ||
18 | public slots: | ||
19 | virtual void accept ( ); | ||
20 | |||
18 | protected slots: | 21 | protected 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 | ||
24 | private: | 27 | private: |
25 | QWidget *createBgTab ( QWidget *parent ); | 28 | QWidget *createBgTab ( QWidget *parent ); |
26 | QWidget *createFontTab ( QWidget *parent ); | 29 | QWidget *createFontTab ( QWidget *parent ); |
27 | QWidget *createIconTab ( QWidget *parent ); | 30 | QWidget *createIconTab ( QWidget *parent ); |
28 | 31 | ||
29 | 32 | ||
30 | private: | 33 | 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 | |||
@@ -59,167 +59,169 @@ TabsSettings::TabsSettings ( QWidget *parent, const char *name ) | |||
59 | connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); | 59 | connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); |
60 | 60 | ||
61 | p = new QPushButton ( tr( "Edit" ), this ); | 61 | p = new QPushButton ( tr( "Edit" ), this ); |
62 | lay-> addWidget ( p, 2, 1 ); | 62 | lay-> addWidget ( p, 2, 1 ); |
63 | connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); | 63 | connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); |
64 | 64 | ||
65 | p = new QPushButton ( tr( "Delete" ), this ); | 65 | p = new QPushButton ( tr( "Delete" ), this ); |
66 | lay-> addWidget ( p, 3, 1 ); | 66 | lay-> addWidget ( p, 3, 1 ); |
67 | connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); | 67 | connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); |
68 | 68 | ||
69 | lay-> setRowStretch ( 4, 10 ); | 69 | lay-> setRowStretch ( 4, 10 ); |
70 | 70 | ||
71 | init ( ); | 71 | init ( ); |
72 | } | 72 | } |
73 | 73 | ||
74 | void TabsSettings::init ( ) | 74 | void TabsSettings::init ( ) |
75 | { | 75 | { |
76 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); | 76 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); |
77 | QStringList types = rootFolder. types ( ); | 77 | QStringList types = rootFolder. types ( ); |
78 | 78 | ||
79 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 79 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
80 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); | 80 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); |
81 | m_ids << *it; | 81 | m_ids << *it; |
82 | } | 82 | } |
83 | QImage img ( Resource::loadImage ( "DocsIcon" )); | 83 | QImage img ( Resource::loadImage ( "DocsIcon" )); |
84 | QPixmap pix; | 84 | QPixmap pix; |
85 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); | 85 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); |
86 | m_list-> insertItem ( pix, tr( "Documents" )); | 86 | m_list-> insertItem ( pix, tr( "Documents" )); |
87 | m_ids += "Documents"; // No tr | 87 | m_ids += "Documents"; // No tr |
88 | 88 | ||
89 | readTabSettings ( ); | 89 | readTabSettings ( ); |
90 | } | 90 | } |
91 | 91 | ||
92 | void TabsSettings::readTabSettings ( ) | 92 | void TabsSettings::readTabSettings ( ) |
93 | { | 93 | { |
94 | Config cfg ( "Launcher" ); | 94 | Config cfg ( "Launcher" ); |
95 | QString grp ( "Tab %1" ); // No tr | 95 | QString grp ( "Tab %1" ); // No tr |
96 | m_tabs. clear ( ); | 96 | m_tabs. clear ( ); |
97 | 97 | ||
98 | 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 ) { |
99 | TabConfig tc; | 99 | TabConfig tc; |
100 | tc. m_view = TabConfig::Icon; | 100 | tc. m_view = TabConfig::Icon; |
101 | tc. m_bg_type = TabConfig::Ruled; | 101 | tc. m_bg_type = TabConfig::Ruled; |
102 | tc. m_changed = false; | 102 | tc. m_changed = false; |
103 | 103 | ||
104 | cfg. setGroup ( grp. arg ( *it )); | 104 | cfg. setGroup ( grp. arg ( *it )); |
105 | 105 | ||
106 | QString view = cfg. readEntry ( "View", "Icon" ); | 106 | QString view = cfg. readEntry ( "View", "Icon" ); |
107 | if ( view == "List" ) // No tr | 107 | if ( view == "List" ) // No tr |
108 | tc. m_view = TabConfig::List; | 108 | tc. m_view = TabConfig::List; |
109 | 109 | ||
110 | QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" ); | 110 | QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" ); |
111 | if ( bgType == "SolidColor" ) | 111 | if ( bgType == "SolidColor" ) |
112 | tc. m_bg_type = TabConfig::SolidColor; | 112 | tc. m_bg_type = TabConfig::SolidColor; |
113 | else if ( bgType == "Image" ) // No tr | 113 | else if ( bgType == "Image" ) // No tr |
114 | tc. m_bg_type = TabConfig::Image; | 114 | tc. m_bg_type = TabConfig::Image; |
115 | 115 | ||
116 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" ); | 116 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" ); |
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 | ||
132 | void TabsSettings::accept ( ) | 134 | void TabsSettings::accept ( ) |
133 | { | 135 | { |
134 | Config cfg ( "Launcher" ); | 136 | Config cfg ( "Launcher" ); |
135 | 137 | ||
136 | // Launcher Tab | 138 | // Launcher Tab |
137 | QString grp ( "Tab %1" ); // No tr | 139 | QString grp ( "Tab %1" ); // No tr |
138 | 140 | ||
139 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 141 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
140 | TabConfig &tc = m_tabs [*it]; | 142 | TabConfig &tc = m_tabs [*it]; |
141 | 143 | ||
142 | cfg. setGroup ( grp. arg ( *it )); | 144 | cfg. setGroup ( grp. arg ( *it )); |
143 | if ( !tc. m_changed ) | 145 | if ( !tc. m_changed ) |
144 | continue; | 146 | continue; |
145 | switch ( tc. m_view ) { | 147 | switch ( tc. m_view ) { |
146 | case TabConfig::Icon: | 148 | case TabConfig::Icon: |
147 | cfg.writeEntry ( "View", "Icon" ); | 149 | cfg.writeEntry ( "View", "Icon" ); |
148 | break; | 150 | break; |
149 | case TabConfig::List: | 151 | case TabConfig::List: |
150 | cfg.writeEntry ( "View", "List" ); | 152 | cfg.writeEntry ( "View", "List" ); |
151 | break; | 153 | break; |
152 | } | 154 | } |
153 | 155 | ||
154 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); | 156 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); |
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" ); |
168 | be << *it << tc. m_bg_type << QString(""); | 170 | be << *it << tc. m_bg_type << QString(""); |
169 | break; | 171 | break; |
170 | case TabConfig::SolidColor: | 172 | case TabConfig::SolidColor: |
171 | cfg.writeEntry( "BackgroundType", "SolidColor" ); | 173 | cfg.writeEntry( "BackgroundType", "SolidColor" ); |
172 | be << *it << tc. m_bg_type << tc. m_bg_color; | 174 | be << *it << tc. m_bg_type << tc. m_bg_color; |
173 | break; | 175 | break; |
174 | case TabConfig::Image: | 176 | case TabConfig::Image: |
175 | cfg.writeEntry( "BackgroundType", "Image" ); | 177 | cfg.writeEntry( "BackgroundType", "Image" ); |
176 | be << *it << tc. m_bg_type << tc. m_bg_image; | 178 | be << *it << tc. m_bg_type << tc. m_bg_image; |
177 | break; | 179 | break; |
178 | } | 180 | } |
179 | 181 | ||
180 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); | 182 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); |
181 | te << *it << tc. m_text_color; | 183 | te << *it << tc. m_text_color; |
182 | 184 | ||
183 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 185 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); |
184 | fe << *it << tc. m_font_family; | 186 | fe << *it << tc. m_font_family; |
185 | fe << tc. m_font_size; | 187 | fe << tc. m_font_size; |
186 | fe << 50 << 0; | 188 | fe << 50 << 0; |
187 | 189 | ||
188 | tc. m_changed = false; | 190 | tc. m_changed = false; |
189 | } | 191 | } |
190 | } | 192 | } |
191 | 193 | ||
192 | void TabsSettings::newClicked ( ) | 194 | void TabsSettings::newClicked ( ) |
193 | { | 195 | { |
194 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 196 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
195 | } | 197 | } |
196 | 198 | ||
197 | void TabsSettings::deleteClicked ( ) | 199 | void TabsSettings::deleteClicked ( ) |
198 | { | 200 | { |
199 | int ind = m_list-> currentItem ( ); | 201 | int ind = m_list-> currentItem ( ); |
200 | 202 | ||
201 | if ( ind < 0 ) | 203 | if ( ind < 0 ) |
202 | return; | 204 | return; |
203 | 205 | ||
204 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 206 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
205 | } | 207 | } |
206 | 208 | ||
207 | void TabsSettings::editClicked ( ) | 209 | void TabsSettings::editClicked ( ) |
208 | { | 210 | { |
209 | int ind = m_list-> currentItem ( ); | 211 | int ind = m_list-> currentItem ( ); |
210 | 212 | ||
211 | if ( ind < 0 ) | 213 | if ( ind < 0 ) |
212 | return; | 214 | return; |
213 | 215 | ||
214 | TabConfig tc = m_tabs [m_ids [ind]]; | 216 | TabConfig tc = m_tabs [m_ids [ind]]; |
215 | 217 | ||
216 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); | 218 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); |
217 | 219 | ||
218 | d-> showMaximized ( ); | 220 | d-> showMaximized ( ); |
219 | if ( d-> exec ( ) == QDialog::Accepted ) { | 221 | if ( d-> exec ( ) == QDialog::Accepted ) { |
220 | tc. m_changed = true; | 222 | tc. m_changed = true; |
221 | m_tabs [m_ids [ind]] = tc; | 223 | m_tabs [m_ids [ind]] = tc; |
222 | } | 224 | } |
223 | 225 | ||
224 | delete d; | 226 | delete d; |
225 | } | 227 | } |