author | mickeyl <mickeyl> | 2005-01-11 16:46:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-11 16:46:50 (UTC) |
commit | f82173157bdba4fa99afde9cc999bfe9b511ce07 (patch) (unidiff) | |
tree | 5285a7aef75f2acf78c40d8a992193d029c55446 /core | |
parent | 0619c844b8a3054c6d6e480ba1c90e3f42e63873 (diff) | |
download | opie-f82173157bdba4fa99afde9cc999bfe9b511ce07.zip opie-f82173157bdba4fa99afde9cc999bfe9b511ce07.tar.gz opie-f82173157bdba4fa99afde9cc999bfe9b511ce07.tar.bz2 |
number of icon columns now also customizable through LauncherSettings
-rw-r--r-- | core/settings/launcher/tabconfig.h | 1 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 14 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.h | 2 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 3 |
4 files changed, 18 insertions, 2 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 | |||
@@ -40,12 +40,13 @@ struct TabConfig { | |||
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; |
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 | |||
@@ -48,12 +48,13 @@ | |||
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 | ||
56 | using namespace Opie::Ui; | 57 | using namespace Opie::Ui; |
57 | class SampleItem : public QIconViewItem { | 58 | class SampleItem : public QIconViewItem { |
58 | public: | 59 | public: |
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 ) |
@@ -77,12 +78,14 @@ public: | |||
77 | } | 78 | } |
78 | 79 | ||
79 | private: | 80 | private: |
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 | |||
83 | class SampleView : public QIconView { | 86 | class SampleView : public QIconView { |
84 | public: | 87 | public: |
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 ); |
@@ -191,12 +194,13 @@ public: | |||
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; |
@@ -413,24 +417,29 @@ QWidget *TabDialog::createIconTab ( QWidget *parent ) | |||
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 | ||
@@ -503,12 +512,13 @@ void TabDialog::bgDefaultClicked ( ) | |||
503 | 512 | ||
504 | void TabDialog::accept ( ) | 513 | void 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 ) { |
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 | |||
@@ -34,12 +34,13 @@ | |||
34 | class QButtonGroup; | 34 | class QButtonGroup; |
35 | namespace Opie {namespace Ui {class OFontSelector;}} | 35 | namespace Opie {namespace Ui {class OFontSelector;}} |
36 | class SampleView; | 36 | class SampleView; |
37 | namespace Opie {class OColorButton;} | 37 | namespace Opie {class OColorButton;} |
38 | class QPushButton; | 38 | class QPushButton; |
39 | class QCheckBox; | 39 | class QCheckBox; |
40 | class QSpinBox; | ||
40 | 41 | ||
41 | 42 | ||
42 | class TabDialog : public QDialog { | 43 | class TabDialog : public QDialog { |
43 | Q_OBJECT | 44 | Q_OBJECT |
44 | public: | 45 | public: |
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 ); |
@@ -66,12 +67,13 @@ private: | |||
66 | private: | 67 | private: |
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; |
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 | |||
@@ -132,12 +132,13 @@ void TabsSettings::readTabSettings ( Config &cfg ) | |||
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; |
@@ -165,12 +166,13 @@ void TabsSettings::readTabSettings ( Config &cfg ) | |||
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 ( ); |
@@ -227,12 +229,13 @@ void TabsSettings::accept ( ) | |||
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 ); |