Diffstat (limited to 'core/settings/launcher/tabdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
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 | |||
@@ -215,67 +215,67 @@ public: | |||
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 | ||
@@ -290,37 +290,37 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) | |||
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 ); |
@@ -370,12 +370,24 @@ void TabDialog::bgTypeClicked ( int t ) | |||
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 | } | ||