summaryrefslogtreecommitdiff
path: root/core
authormickeyl <mickeyl>2005-01-11 16:46:50 (UTC)
committer mickeyl <mickeyl>2005-01-11 16:46:50 (UTC)
commitf82173157bdba4fa99afde9cc999bfe9b511ce07 (patch) (unidiff)
tree5285a7aef75f2acf78c40d8a992193d029c55446 /core
parent0619c844b8a3054c6d6e480ba1c90e3f42e63873 (diff)
downloadopie-f82173157bdba4fa99afde9cc999bfe9b511ce07.zip
opie-f82173157bdba4fa99afde9cc999bfe9b511ce07.tar.gz
opie-f82173157bdba4fa99afde9cc999bfe9b511ce07.tar.bz2
number of icon columns now also customizable through LauncherSettings
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/tabconfig.h1
-rw-r--r--core/settings/launcher/tabdialog.cpp14
-rw-r--r--core/settings/launcher/tabdialog.h16
-rw-r--r--core/settings/launcher/tabssettings.cpp3
4 files changed, 25 insertions, 9 deletions
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
index 84ba073..7844673 100644
--- a/core/settings/launcher/tabconfig.h
+++ b/core/settings/launcher/tabconfig.h
@@ -22,48 +22,49 @@
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#ifndef __TABCONFIG_H__ 27#ifndef __TABCONFIG_H__
28#define __TABCONFIG_H__ 28#define __TABCONFIG_H__
29 29
30struct TabConfig { 30struct TabConfig {
31 enum ViewMode { 31 enum ViewMode {
32 Icon, 32 Icon,
33 List 33 List
34 }; 34 };
35 enum BackgroundType { 35 enum BackgroundType {
36 Ruled, 36 Ruled,
37 SolidColor, 37 SolidColor,
38 Image 38 Image
39 }; 39 };
40 40
41 ViewMode m_view; 41 ViewMode m_view;
42 BackgroundType m_bg_type; 42 BackgroundType m_bg_type;
43 QString m_last_directory; 43 QString m_last_directory;
44 QString m_bg_image; 44 QString m_bg_image;
45 QString m_bg_color; 45 QString m_bg_color;
46 int m_iconcolumns;
46 QString m_text_color; 47 QString m_text_color;
47 bool m_font_use; 48 bool m_font_use;
48 QString m_font_family; 49 QString m_font_family;
49 int m_font_size; 50 int m_font_size;
50 int m_font_weight; 51 int m_font_weight;
51 bool m_font_italic; 52 bool m_font_italic;
52 bool m_changed; 53 bool m_changed;
53 54
54 bool operator == ( const TabConfig &tc ) 55 bool operator == ( const TabConfig &tc )
55 { 56 {
56 return ( m_view == tc. m_view ) && 57 return ( m_view == tc. m_view ) &&
57 ( m_bg_type == tc. m_bg_type ) && 58 ( m_bg_type == tc. m_bg_type ) &&
58 ( m_bg_image == tc. m_bg_image ) && 59 ( m_bg_image == tc. m_bg_image ) &&
59 ( m_bg_color == tc. m_bg_color ) && 60 ( m_bg_color == tc. m_bg_color ) &&
60 ( m_text_color == tc. m_text_color ) && 61 ( m_text_color == tc. m_text_color ) &&
61 ( m_font_use == tc. m_font_use ) && 62 ( m_font_use == tc. m_font_use ) &&
62 ( m_font_use ? ( 63 ( m_font_use ? (
63 ( m_font_family == tc. m_font_family ) && 64 ( m_font_family == tc. m_font_family ) &&
64 ( m_font_size == tc. m_font_size ) && 65 ( m_font_size == tc. m_font_size ) &&
65 ( m_font_weight == tc. m_font_weight ) && 66 ( m_font_weight == tc. m_font_weight ) &&
66 ( m_font_italic == tc. m_font_italic ) 67 ( m_font_italic == tc. m_font_italic )
67 ) : true ); 68 ) : true );
68 69
69 } 70 }
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index cef92d9..abe310f 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -30,77 +30,80 @@
30/* OPIE */ 30/* OPIE */
31 31
32#include <opie2/ofontselector.h> 32#include <opie2/ofontselector.h>
33#include <opie2/otabwidget.h> 33#include <opie2/otabwidget.h>
34#include <opie2/ocolorbutton.h> 34#include <opie2/ocolorbutton.h>
35#include <opie2/ofiledialog.h> 35#include <opie2/ofiledialog.h>
36#include <opie2/odebug.h> 36#include <opie2/odebug.h>
37 37
38/* QPE */ 38/* QPE */
39#include <qpe/resource.h> 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 55
55 56
56using namespace Opie::Ui; 57using namespace Opie::Ui;
57class SampleItem : public QIconViewItem { 58class SampleItem : public QIconViewItem {
58public: 59public:
59 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 )
60 { 61 {
61 m_large = pix; 62 m_large = pix;
62 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 ));
63 } 64 }
64 65
65 void sizeChange ( ) 66 void sizeChange ( )
66 { 67 {
67 calcRect ( ); 68 calcRect ( );
68 repaint ( ); 69 repaint ( );
69 } 70 }
70 71
71 QPixmap *pixmap ( ) const 72 QPixmap *pixmap ( ) const
72 { 73 {
73 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) 74 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right )
74 return (QPixmap *) &m_small; 75 return (QPixmap *) &m_small;
75 else 76 else
76 return (QPixmap *) &m_large; 77 return (QPixmap *) &m_large;
77 } 78 }
78 79
79private: 80private:
80 QPixmap m_large, m_small; 81 QPixmap m_large, m_small;
81}; 82};
82 83
84//FIXME: Why not derive SampleView from LauncherView ???
85
83class SampleView : public QIconView { 86class SampleView : public QIconView {
84public: 87public:
85 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) 88 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name )
86 { 89 {
87 setItemsMovable ( false ); 90 setItemsMovable ( false );
88 setAutoArrange ( true ); 91 setAutoArrange ( true );
89 setSorting ( true ); 92 setSorting ( true );
90 setFrameStyle ( QFrame::NoFrame ); 93 setFrameStyle ( QFrame::NoFrame );
91 setSpacing ( 4 ); 94 setSpacing ( 4 );
92 setMargin ( 0 ); 95 setMargin ( 0 );
93 setSelectionMode ( QIconView::NoSelection ); 96 setSelectionMode ( QIconView::NoSelection );
94 setBackgroundMode ( PaletteBase ); 97 setBackgroundMode ( PaletteBase );
95 setViewMode ( TabConfig::Icon ); 98 setViewMode ( TabConfig::Icon );
96 calculateGrid ( Bottom ); 99 calculateGrid ( Bottom );
97 100
98 101
99 new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); 102 new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" ));
100 new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); 103 new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" ));
101 new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); 104 new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" ));
102 105
103 setBackgroundType ( TabConfig::Ruled, QString::null ); 106 setBackgroundType ( TabConfig::Ruled, QString::null );
104 107
105 setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); 108 setMaximumHeight ( firstItem ( )-> height ( ) + 16 );
106 } 109 }
@@ -173,48 +176,49 @@ public:
173 m_bgtype = t; 176 m_bgtype = t;
174 viewport ( )-> update ( ); 177 viewport ( )-> update ( );
175 } 178 }
176 179
177 void setTextColor ( const QColor &tc ) 180 void setTextColor ( const QColor &tc )
178 { 181 {
179 m_textcolor = tc; 182 m_textcolor = tc;
180 QColorGroup cg = colorGroup ( ); 183 QColorGroup cg = colorGroup ( );
181 cg. setColor ( QColorGroup::Text, tc ); 184 cg. setColor ( QColorGroup::Text, tc );
182 setPalette ( QPalette ( cg, cg, cg )); 185 setPalette ( QPalette ( cg, cg, cg ));
183 viewport ( )-> update ( ); 186 viewport ( )-> update ( );
184 } 187 }
185 188
186 void setViewFont ( const QFont &f ) 189 void setViewFont ( const QFont &f )
187 { 190 {
188 setFont ( f ); 191 setFont ( f );
189 } 192 }
190 193
191 void setItemTextPos ( ItemTextPos pos ) 194 void setItemTextPos ( ItemTextPos pos )
192 { 195 {
193 calculateGrid ( pos ); 196 calculateGrid ( pos );
194 QIconView::setItemTextPos( pos ); 197 QIconView::setItemTextPos( pos );
195 } 198 }
196 199
200 //FIXME: Add per-tab column handling from launcherview.cpp
197 void calculateGrid ( ItemTextPos pos ) 201 void calculateGrid ( ItemTextPos pos )
198 { 202 {
199 int dw = QApplication::desktop ( )-> width ( ); 203 int dw = QApplication::desktop ( )-> width ( );
200 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); 204 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( );
201 if ( pos == Bottom ) { 205 if ( pos == Bottom ) {
202 int cols = 3; 206 int cols = 3;
203 if ( viewerWidth <= 200 ) 207 if ( viewerWidth <= 200 )
204 cols = 2; 208 cols = 2;
205 else if ( viewerWidth >= 400 ) 209 else if ( viewerWidth >= 400 )
206 cols = viewerWidth/96; 210 cols = viewerWidth/96;
207 setSpacing ( 4 ); 211 setSpacing ( 4 );
208 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 212 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
209 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); 213 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 );
210 } 214 }
211 else { 215 else {
212 int cols = 2; 216 int cols = 2;
213 if ( viewerWidth < 150 ) 217 if ( viewerWidth < 150 )
214 cols = 1; 218 cols = 1;
215 else if ( viewerWidth >= 400 ) 219 else if ( viewerWidth >= 400 )
216 cols = viewerWidth / 150; 220 cols = viewerWidth / 150;
217 setSpacing ( 2 ); 221 setSpacing ( 2 );
218 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 222 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
219 setGridY ( fontMetrics ( ). height ( ) + 2 ); 223 setGridY ( fontMetrics ( ). height ( ) + 2 );
220 } 224 }
@@ -395,60 +399,65 @@ QWidget *TabDialog::createBgTab ( QWidget *parent )
395} 399}
396 400
397QWidget *TabDialog::createIconTab ( QWidget *parent ) 401QWidget *TabDialog::createIconTab ( QWidget *parent )
398{ 402{
399 QWidget *tab = new QWidget( parent, "IconTab" ); 403 QWidget *tab = new QWidget( parent, "IconTab" );
400 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 404 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
401 405
402 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 406 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
403 gridLayout-> setColStretch ( 1, 10 ); 407 gridLayout-> setColStretch ( 1, 10 );
404 408
405 QLabel* label = new QLabel( tr( "Size:" ), tab ); 409 QLabel* label = new QLabel( tr( "Size:" ), tab );
406 gridLayout-> addWidget ( label, 0, 0 ); 410 gridLayout-> addWidget ( label, 0, 0 );
407 m_iconsize = new QButtonGroup( tab, "buttongroup" ); 411 m_iconsize = new QButtonGroup( tab, "buttongroup" );
408 m_iconsize-> hide ( ); 412 m_iconsize-> hide ( );
409 m_iconsize-> setExclusive ( true ); 413 m_iconsize-> setExclusive ( true );
410 414
411 QRadioButton *rb; 415 QRadioButton *rb;
412 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); 416 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
413 m_iconsize-> insert ( rb, TabConfig::List ); 417 m_iconsize-> insert ( rb, TabConfig::List );
414 gridLayout-> addWidget( rb, 0, 1 ); 418 gridLayout-> addWidget( rb, 0, 1 );
415 419
416 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); 420 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" );
417 m_iconsize-> insert ( rb, TabConfig::Icon ); 421 m_iconsize-> insert ( rb, TabConfig::Icon );
418 gridLayout-> addWidget( rb, 1, 1 ); 422 gridLayout-> addWidget( rb, 1, 1 );
419
420 connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); 423 connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int)));
421
422 gridLayout-> addRowSpacing ( 2, 8 ); 424 gridLayout-> addRowSpacing ( 2, 8 );
423 425
424 label = new QLabel ( tr( "Color:" ), tab ); 426 label = new QLabel ( tr( "Color:" ), tab );
425 gridLayout-> addWidget ( label, 3, 0 ); 427 gridLayout-> addWidget ( label, 3, 0 );
428 gridLayout-> addRowSpacing ( 3, 8 );
426 429
427 m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) ); 430 m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) );
428 connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&))); 431 connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&)));
429 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); 432 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft );
430 433
434 label = new QLabel( tr( "Columns:" ), tab );
435 gridLayout->addWidget( label, 4, 0 );
436 m_iconcolumns = new QSpinBox( 0, 10, 1, tab, "iconspinbox" );
437 m_iconcolumns->setSpecialValueText( tr( "Automatic" ) );
438 gridLayout->addWidget( m_iconcolumns, 4, 1, AlignLeft );
439
431 vertLayout-> addStretch ( 10 ); 440 vertLayout-> addStretch ( 10 );
432 441
433 if ( m_tc.m_last_directory == QString::null ) { 442 if ( m_tc.m_last_directory == QString::null ) {
434 m_tc.m_last_directory = QPEApplication::documentDir(); 443 m_tc.m_last_directory = QPEApplication::documentDir();
435 } 444 }
436 445
437 return tab; 446 return tab;
438} 447}
439 448
440 449
441void TabDialog::iconSizeClicked ( int s ) 450void TabDialog::iconSizeClicked ( int s )
442{ 451{
443 m_sample-> setViewMode ((TabConfig::ViewMode) s ); 452 m_sample-> setViewMode ((TabConfig::ViewMode) s );
444} 453}
445 454
446void TabDialog::fontClicked ( const QFont &f ) 455void TabDialog::fontClicked ( const QFont &f )
447{ 456{
448 m_sample-> setViewFont ( f ); 457 m_sample-> setViewFont ( f );
449} 458}
450 459
451void TabDialog::bgTypeClicked ( int t ) 460void TabDialog::bgTypeClicked ( int t )
452{ 461{
453 QString s; 462 QString s;
454 463
@@ -485,40 +494,41 @@ void TabDialog::bgImageClicked ( )
485 QStringList list; 494 QStringList list;
486 list << "image/*"; 495 list << "image/*";
487 types. insert ( "Images", list ); 496 types. insert ( "Images", list );
488 497
489 QString file = OFileDialog::getOpenFileName ( 1, m_tc.m_last_directory, QString::null, types ); 498 QString file = OFileDialog::getOpenFileName ( 1, m_tc.m_last_directory, QString::null, types );
490 499
491 if ( !file. isEmpty ( )) { 500 if ( !file. isEmpty ( )) {
492 m_tc.m_last_directory = QFileInfo( file ).dirPath(); 501 m_tc.m_last_directory = QFileInfo( file ).dirPath();
493 m_bgimage = DocLnk ( file ). file ( ); 502 m_bgimage = DocLnk ( file ). file ( );
494 bgTypeClicked ( TabConfig::Image ); 503 bgTypeClicked ( TabConfig::Image );
495 } 504 }
496} 505}
497 506
498void TabDialog::bgDefaultClicked ( ) 507void TabDialog::bgDefaultClicked ( )
499{ 508{
500 m_bgimage = "launcher/opie-background"; 509 m_bgimage = "launcher/opie-background";
501 bgTypeClicked ( TabConfig::Image ); 510 bgTypeClicked ( TabConfig::Image );
502} 511}
503 512
504void TabDialog::accept ( ) 513void TabDialog::accept ( )
505{ 514{
506 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); 515 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( ));
507 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); 516 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( ));
508 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); 517 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( );
518 m_tc. m_iconcolumns = m_iconcolumns-> value( );
509 m_tc. m_bg_image = m_bgimage; 519 m_tc. m_bg_image = m_bgimage;
510 m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); 520 m_tc. m_text_color = m_iconcolor-> color ( ). name ( );
511 521
512 m_tc. m_font_use = m_fontuse-> isChecked ( ); 522 m_tc. m_font_use = m_fontuse-> isChecked ( );
513 523
514 if ( m_tc. m_font_use ) { 524 if ( m_tc. m_font_use ) {
515 QFont f = m_fontselect-> selectedFont ( ); 525 QFont f = m_fontselect-> selectedFont ( );
516 526
517 m_tc. m_font_family = f. family ( ); 527 m_tc. m_font_family = f. family ( );
518 m_tc. m_font_size = f. pointSize ( ); 528 m_tc. m_font_size = f. pointSize ( );
519 m_tc. m_font_weight = f. weight ( ); 529 m_tc. m_font_weight = f. weight ( );
520 m_tc. m_font_italic = f. italic ( ); 530 m_tc. m_font_italic = f. italic ( );
521 } 531 }
522 532
523 QDialog::accept ( ); 533 QDialog::accept ( );
524} 534}
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h
index 46b7ae9..9381237 100644
--- a/core/settings/launcher/tabdialog.h
+++ b/core/settings/launcher/tabdialog.h
@@ -1,81 +1,83 @@
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#ifndef __TABDIALOG_H__ 28#ifndef __TABDIALOG_H__
29#define __TABDIALOG_H__ 29#define __TABDIALOG_H__
30 30
31#include <qdialog.h> 31#include <qdialog.h>
32#include "tabconfig.h" 32#include "tabconfig.h"
33 33
34class QButtonGroup; 34class QButtonGroup;
35namespace Opie {namespace Ui {class OFontSelector;}} 35namespace Opie {namespace Ui {class OFontSelector;}}
36class SampleView; 36class SampleView;
37namespace Opie {class OColorButton;} 37namespace Opie {class OColorButton;}
38class QPushButton; 38class QPushButton;
39class QCheckBox; 39class QCheckBox;
40class QSpinBox;
40 41
41 42
42class TabDialog : public QDialog { 43class TabDialog : public QDialog {
43 Q_OBJECT 44 Q_OBJECT
44public: 45public:
45 TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *dname = 0, bool modal = false, WFlags = 0 ); 46 TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *dname = 0, bool modal = false, WFlags = 0 );
46 virtual ~TabDialog ( ); 47 virtual ~TabDialog ( );
47 48
48public slots: 49public slots:
49 virtual void accept ( ); 50 virtual void accept ( );
50 51
51protected slots: 52protected slots:
52 void iconSizeClicked ( int ); 53 void iconSizeClicked ( int );
53 void fontClicked ( const QFont & ); 54 void fontClicked ( const QFont & );
54 void bgTypeClicked ( int ); 55 void bgTypeClicked ( int );
55 void bgColorClicked ( const QColor & ); 56 void bgColorClicked ( const QColor & );
56 void iconColorClicked ( const QColor & ); 57 void iconColorClicked ( const QColor & );
57 void bgImageClicked ( ); 58 void bgImageClicked ( );
58 void bgDefaultClicked ( ); 59 void bgDefaultClicked ( );
59 60
60private: 61private:
61 QWidget *createBgTab ( QWidget *parent ); 62 QWidget *createBgTab ( QWidget *parent );
62 QWidget *createFontTab ( QWidget *parent ); 63 QWidget *createFontTab ( QWidget *parent );
63 QWidget *createIconTab ( QWidget *parent ); 64 QWidget *createIconTab ( QWidget *parent );
64 65
65 66
66private: 67private:
67 SampleView *m_sample; 68 SampleView *m_sample;
68 QButtonGroup *m_iconsize; 69 QButtonGroup *m_iconsize;
69 Opie::Ui::OFontSelector *m_fontselect; 70 Opie::Ui::OFontSelector *m_fontselect;
70 Opie::OColorButton *m_solidcolor; 71 Opie::OColorButton *m_solidcolor;
71 Opie::OColorButton *m_iconcolor; 72 Opie::OColorButton *m_iconcolor;
73 QSpinBox *m_iconcolumns;
72 QPushButton *m_imagebrowse; 74 QPushButton *m_imagebrowse;
73 QString m_bgimage; 75 QString m_bgimage;
74 QButtonGroup *m_bgtype; 76 QButtonGroup *m_bgtype;
75 QCheckBox *m_fontuse; 77 QCheckBox *m_fontuse;
76 78
77 TabConfig &m_tc; 79 TabConfig &m_tc;
78}; 80};
79 81
80 82
81#endif 83#endif
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 5ac625b..ab64331 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -114,81 +114,83 @@ void TabsSettings::init ( )
114 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); 114 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
115 m_list-> insertItem ( pix, tr( "Documents" )); 115 m_list-> insertItem ( pix, tr( "Documents" ));
116 m_ids += "Documents"; // No tr 116 m_ids += "Documents"; // No tr
117 117
118 Config cfg ( "Launcher" ); 118 Config cfg ( "Launcher" );
119 119
120 readTabSettings ( cfg ); 120 readTabSettings ( cfg );
121 121
122 cfg. setGroup ( "GUI" ); 122 cfg. setGroup ( "GUI" );
123 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); 123 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" );
124 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); 124 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) );
125} 125}
126 126
127 127
128void TabsSettings::readTabSettings ( Config &cfg ) 128void TabsSettings::readTabSettings ( Config &cfg )
129{ 129{
130 QString grp ( "Tab %1" ); // No tr 130 QString grp ( "Tab %1" ); // No tr
131 m_tabs. clear ( ); 131 m_tabs. clear ( );
132 132
133 TabConfig global_def; 133 TabConfig global_def;
134 global_def. m_view = TabConfig::Icon; 134 global_def. m_view = TabConfig::Icon;
135 global_def. m_bg_type = TabConfig::Ruled; 135 global_def. m_bg_type = TabConfig::Ruled;
136 global_def. m_bg_image = "launcher/opie-background"; 136 global_def. m_bg_image = "launcher/opie-background";
137 global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); 137 global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( );
138 global_def. m_iconcolumns = 0; // automatic
138 global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); 139 global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( );
139 global_def. m_font_use = false; 140 global_def. m_font_use = false;
140 global_def. m_font_family = font ( ). family ( ); 141 global_def. m_font_family = font ( ). family ( );
141 global_def. m_font_size = font ( ). pointSize ( ); 142 global_def. m_font_size = font ( ). pointSize ( );
142 global_def. m_font_weight = 50; 143 global_def. m_font_weight = 50;
143 global_def. m_font_italic = false; 144 global_def. m_font_italic = false;
144 global_def. m_changed = false; 145 global_def. m_changed = false;
145 146
146 Config cfg2 = Config( "Launchersettings" ); 147 Config cfg2 = Config( "Launchersettings" );
147 148
148 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 149 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
149 TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; 150 TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def;
150 151
151 cfg. setGroup ( grp. arg ( *it )); 152 cfg. setGroup ( grp. arg ( *it ));
152 cfg2. setGroup( grp. arg ( *it )); 153 cfg2. setGroup( grp. arg ( *it ));
153 154
154 QString view = cfg. readEntry ( "View" ); 155 QString view = cfg. readEntry ( "View" );
155 if ( view == "Icon" ) // No tr 156 if ( view == "Icon" ) // No tr
156 tc. m_view = TabConfig::Icon; 157 tc. m_view = TabConfig::Icon;
157 if ( view == "List" ) // No tr 158 if ( view == "List" ) // No tr
158 tc. m_view = TabConfig::List; 159 tc. m_view = TabConfig::List;
159 160
160 QString bgType = cfg. readEntry ( "BackgroundType" ); 161 QString bgType = cfg. readEntry ( "BackgroundType" );
161 if ( bgType == "Image" ) 162 if ( bgType == "Image" )
162 tc. m_bg_type = TabConfig::Image; 163 tc. m_bg_type = TabConfig::Image;
163 else if ( bgType == "SolidColor" ) 164 else if ( bgType == "SolidColor" )
164 tc. m_bg_type = TabConfig::SolidColor; 165 tc. m_bg_type = TabConfig::SolidColor;
165 else if ( bgType == "Image" ) // No tr 166 else if ( bgType == "Image" ) // No tr
166 tc. m_bg_type = TabConfig::Image; 167 tc. m_bg_type = TabConfig::Image;
167 168
168 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); 169 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image );
169 tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" ); 170 tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" );
170 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); 171 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color );
172 tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns );
171 tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); 173 tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color );
172 QStringList f = cfg. readListEntry ( "Font", ',' ); 174 QStringList f = cfg. readListEntry ( "Font", ',' );
173 if ( f. count ( ) == 4 ) { 175 if ( f. count ( ) == 4 ) {
174 tc. m_font_use = true; 176 tc. m_font_use = true;
175 tc. m_font_family = f [0]; 177 tc. m_font_family = f [0];
176 tc. m_font_size = f [1]. toInt ( ); 178 tc. m_font_size = f [1]. toInt ( );
177 tc. m_font_weight = f [2]. toInt ( ); 179 tc. m_font_weight = f [2]. toInt ( );
178 tc. m_font_italic = ( f [3]. toInt ( )); 180 tc. m_font_italic = ( f [3]. toInt ( ));
179 } 181 }
180 m_tabs [*it] = tc; 182 m_tabs [*it] = tc;
181 } 183 }
182 184
183 // if all tabs have the same config, then initialize the GLOBALID tab to these values 185 // if all tabs have the same config, then initialize the GLOBALID tab to these values
184 186
185 TabConfig *first = 0; 187 TabConfig *first = 0;
186 bool same = true; 188 bool same = true;
187 189
188 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 190 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
189 if ( *it == GLOBALID ) 191 if ( *it == GLOBALID )
190 continue; 192 continue;
191 else if ( !first ) 193 else if ( !first )
192 first = &m_tabs [*it]; 194 first = &m_tabs [*it];
193 else 195 else
194 same &= ( *first == m_tabs [*it] ); 196 same &= ( *first == m_tabs [*it] );
@@ -209,48 +211,49 @@ void TabsSettings::accept ( )
209 QString grp ( "Tab %1" ); // No tr 211 QString grp ( "Tab %1" ); // No tr
210 212
211 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 213 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
212 TabConfig &tc = m_tabs [*it]; 214 TabConfig &tc = m_tabs [*it];
213 215
214 if ( !tc. m_changed ) 216 if ( !tc. m_changed )
215 continue; 217 continue;
216 218
217 cfg. setGroup ( grp. arg ( *it )); 219 cfg. setGroup ( grp. arg ( *it ));
218 cfg2. setGroup ( grp. arg ( *it )); 220 cfg2. setGroup ( grp. arg ( *it ));
219 switch ( tc. m_view ) { 221 switch ( tc. m_view ) {
220 case TabConfig::Icon: 222 case TabConfig::Icon:
221 cfg.writeEntry ( "View", "Icon" ); 223 cfg.writeEntry ( "View", "Icon" );
222 break; 224 break;
223 case TabConfig::List: 225 case TabConfig::List:
224 cfg.writeEntry ( "View", "List" ); 226 cfg.writeEntry ( "View", "List" );
225 break; 227 break;
226 } 228 }
227 229
228 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); 230 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
229 e << *it << tc. m_view; 231 e << *it << tc. m_view;
230 232
231 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); 233 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
232 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); 234 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
235 cfg. writeEntry ( "Columns", tc. m_iconcolumns );
233 cfg. writeEntry ( "TextColor", tc. m_text_color ); 236 cfg. writeEntry ( "TextColor", tc. m_text_color );
234 cfg2. writeEntry ( "DefaultDir", tc.m_last_directory ); 237 cfg2. writeEntry ( "DefaultDir", tc.m_last_directory );
235 238
236 if ( tc. m_font_use ) { 239 if ( tc. m_font_use ) {
237 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); 240 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" );
238 cfg. writeEntry ( "Font", f ); 241 cfg. writeEntry ( "Font", f );
239 } 242 }
240 else 243 else
241 cfg. removeEntry ( "Font" ); 244 cfg. removeEntry ( "Font" );
242 245
243 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); 246 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
244 247
245 switch ( tc. m_bg_type ) { 248 switch ( tc. m_bg_type ) {
246 case TabConfig::Ruled: 249 case TabConfig::Ruled:
247 cfg.writeEntry( "BackgroundType", "Ruled" ); 250 cfg.writeEntry( "BackgroundType", "Ruled" );
248 be << *it << tc. m_bg_type << QString(""); 251 be << *it << tc. m_bg_type << QString("");
249 break; 252 break;
250 case TabConfig::SolidColor: 253 case TabConfig::SolidColor:
251 cfg.writeEntry( "BackgroundType", "SolidColor" ); 254 cfg.writeEntry( "BackgroundType", "SolidColor" );
252 be << *it << tc. m_bg_type << tc. m_bg_color; 255 be << *it << tc. m_bg_type << tc. m_bg_color;
253 break; 256 break;
254 case TabConfig::Image: 257 case TabConfig::Image:
255 cfg.writeEntry( "BackgroundType", "Image" ); 258 cfg.writeEntry( "BackgroundType", "Image" );
256 be << *it << tc. m_bg_type << tc. m_bg_image; 259 be << *it << tc. m_bg_type << tc. m_bg_image;