author | sandman <sandman> | 2002-10-31 03:07:50 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-31 03:07:50 (UTC) |
commit | d9d6cc6b3a537439affc8095dedd046c86f09d9e (patch) (unidiff) | |
tree | 3b18a42dfc9f32eecc799104b3fea201ff8a14ba | |
parent | 035eaf63bb2156ea7facd6b50f8891503d1f7bed (diff) | |
download | opie-d9d6cc6b3a537439affc8095dedd046c86f09d9e.zip opie-d9d6cc6b3a537439affc8095dedd046c86f09d9e.tar.gz opie-d9d6cc6b3a537439affc8095dedd046c86f09d9e.tar.bz2 |
- added a "[x] Use custom font" checkbox -- if this is not checked
(default), then launcher uses the global font for the tabs.
- reworked the internal handling of "All tabs", to make it possible to use
this information for newly added tabs (still missing)
-rw-r--r-- | core/settings/launcher/tabconfig.h | 13 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 45 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.h | 2 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 69 | ||||
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 3 |
5 files changed, 86 insertions, 46 deletions
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h index eebfd36..9086341 100644 --- a/core/settings/launcher/tabconfig.h +++ b/core/settings/launcher/tabconfig.h | |||
@@ -45,2 +45,3 @@ struct TabConfig { | |||
45 | QString m_text_color; | 45 | QString m_text_color; |
46 | bool m_font_use; | ||
46 | QString m_font_family; | 47 | QString m_font_family; |
@@ -58,6 +59,10 @@ struct TabConfig { | |||
58 | ( m_text_color == tc. m_text_color ) && | 59 | ( m_text_color == tc. m_text_color ) && |
59 | ( m_font_family == tc. m_font_family ) && | 60 | ( m_font_use == tc. m_font_use ) && |
60 | ( m_font_size == tc. m_font_size ) && | 61 | ( m_font_use ? ( |
61 | ( m_font_weight == tc. m_font_weight ) && | 62 | ( m_font_family == tc. m_font_family ) && |
62 | ( m_font_italic == tc. m_font_italic ); | 63 | ( m_font_size == tc. m_font_size ) && |
64 | ( m_font_weight == tc. m_font_weight ) && | ||
65 | ( m_font_italic == tc. m_font_italic ) | ||
66 | ) : true ); | ||
67 | |||
63 | } | 68 | } |
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index a90ba7d..d20412a 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -41,2 +41,3 @@ | |||
41 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
42 | #include <qcheckbox.h> | ||
42 | 43 | ||
@@ -269,3 +270,3 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig | |||
269 | 270 | ||
270 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 271 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); |
271 | 272 | ||
@@ -299,3 +300,5 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig | |||
299 | bgTypeClicked ( tc. m_bg_type ); | 300 | bgTypeClicked ( tc. m_bg_type ); |
301 | m_fontuse-> setChecked ( tc. m_font_use ); | ||
300 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); | 302 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
303 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); | ||
301 | fontClicked ( m_fontselect-> selectedFont ( )); | 304 | fontClicked ( m_fontselect-> selectedFont ( )); |
@@ -312,4 +315,12 @@ QWidget *TabDialog::createFontTab ( QWidget *parent ) | |||
312 | { | 315 | { |
313 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); | 316 | QWidget *tab = new QWidget ( parent, "FontTab" ); |
317 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); | ||
318 | |||
319 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); | ||
320 | vertLayout-> addWidget ( m_fontuse ); | ||
321 | |||
322 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); | ||
323 | vertLayout-> addWidget ( m_fontselect ); | ||
314 | 324 | ||
325 | connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool ))); | ||
315 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), | 326 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), |
@@ -317,3 +328,3 @@ QWidget *TabDialog::createFontTab ( QWidget *parent ) | |||
317 | 328 | ||
318 | return m_fontselect; | 329 | return tab; |
319 | } | 330 | } |
@@ -322,4 +333,4 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) | |||
322 | { | 333 | { |
323 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 334 | QWidget *tab = new QWidget( parent, "BgTab" ); |
324 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 335 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
325 | 336 | ||
@@ -340,3 +351,3 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) | |||
340 | QHBoxLayout *hb = new QHBoxLayout ( ); | 351 | QHBoxLayout *hb = new QHBoxLayout ( ); |
341 | hb-> setSpacing ( 4 ); | 352 | hb-> setSpacing ( 3 ); |
342 | 353 | ||
@@ -355,3 +366,3 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) | |||
355 | hb = new QHBoxLayout ( ); | 366 | hb = new QHBoxLayout ( ); |
356 | hb-> setSpacing ( 4 ); | 367 | hb-> setSpacing ( 3 ); |
357 | 368 | ||
@@ -382,4 +393,4 @@ QWidget *TabDialog::createIconTab ( QWidget *parent ) | |||
382 | { | 393 | { |
383 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 394 | QWidget *tab = new QWidget( parent, "IconTab" ); |
384 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 395 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
385 | 396 | ||
@@ -491,9 +502,13 @@ void TabDialog::accept ( ) | |||
491 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); | 502 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); |
503 | |||
504 | m_tc. m_font_use = m_fontuse-> isChecked ( ); | ||
505 | |||
506 | if ( m_tc. m_font_use ) { | ||
507 | QFont f = m_fontselect-> selectedFont ( ); | ||
492 | 508 | ||
493 | QFont f = m_fontselect-> selectedFont ( ); | 509 | m_tc. m_font_family = f. family ( ); |
494 | 510 | m_tc. m_font_size = f. pointSize ( ); | |
495 | m_tc. m_font_family = f. family ( ); | 511 | m_tc. m_font_weight = f. weight ( ); |
496 | m_tc. m_font_size = f. pointSize ( ); | 512 | m_tc. m_font_italic = f. italic ( ); |
497 | m_tc. m_font_weight = f. weight ( ); | 513 | } |
498 | m_tc. m_font_italic = f. italic ( ); | ||
499 | 514 | ||
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h index b0afd47..892a3ad 100644 --- a/core/settings/launcher/tabdialog.h +++ b/core/settings/launcher/tabdialog.h | |||
@@ -38,2 +38,3 @@ class OColorButton; | |||
38 | class QPushButton; | 38 | class QPushButton; |
39 | class QCheckBox; | ||
39 | 40 | ||
@@ -73,2 +74,3 @@ private: | |||
73 | QButtonGroup *m_bgtype; | 74 | QButtonGroup *m_bgtype; |
75 | QCheckBox *m_fontuse; | ||
74 | 76 | ||
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index a5afaf2..9d6e8c1 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp | |||
@@ -49,3 +49,3 @@ | |||
49 | 49 | ||
50 | #define GLOBALID "_launchersettings_global_dummy_" | 50 | #define GLOBALID ".global." |
51 | 51 | ||
@@ -126,13 +126,24 @@ void TabsSettings::readTabSettings ( Config &cfg ) | |||
126 | 126 | ||
127 | TabConfig global_def; | ||
128 | global_def. m_view = TabConfig::Icon; | ||
129 | global_def. m_bg_type = TabConfig::Ruled; | ||
130 | global_def. m_bg_image = "launcher/opie-background"; | ||
131 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); | ||
132 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); | ||
133 | global_def. m_font_use = false; | ||
134 | global_def. m_font_family = font ( ). family ( ); | ||
135 | global_def. m_font_size = font ( ). pointSize ( ); | ||
136 | global_def. m_font_weight = 50; | ||
137 | global_def. m_font_italic = false; | ||
138 | global_def. m_changed = false; | ||
139 | |||
140 | |||
127 | 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 ) { |
128 | TabConfig tc; | 142 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; |
129 | tc. m_view = TabConfig::Icon; | ||
130 | tc. m_bg_type = TabConfig::Ruled; | ||
131 | tc. m_changed = false; | ||
132 | 143 | ||
133 | cfg. setGroup ( grp. arg ( *it )); | 144 | cfg. setGroup ( grp. arg ( *it )); |
134 | if ( *it == GLOBALID ) | ||
135 | cfg. clearGroup ( ); | ||
136 | 145 | ||
137 | QString view = cfg. readEntry ( "View", "Icon" ); | 146 | QString view = cfg. readEntry ( "View" ); |
147 | if ( view == "Icon" ) // No tr | ||
148 | tc. m_view = TabConfig::Icon; | ||
138 | if ( view == "List" ) // No tr | 149 | if ( view == "List" ) // No tr |
@@ -140,4 +151,6 @@ void TabsSettings::readTabSettings ( Config &cfg ) | |||
140 | 151 | ||
141 | QString bgType = cfg. readEntry ( "BackgroundType", "Image" ); | 152 | QString bgType = cfg. readEntry ( "BackgroundType" ); |
142 | if ( bgType == "SolidColor" ) | 153 | if ( bgType == "Image" ) |
154 | tc. m_bg_type = TabConfig::Image; | ||
155 | else if ( bgType == "SolidColor" ) | ||
143 | tc. m_bg_type = TabConfig::SolidColor; | 156 | tc. m_bg_type = TabConfig::SolidColor; |
@@ -146,7 +159,8 @@ void TabsSettings::readTabSettings ( Config &cfg ) | |||
146 | 159 | ||
147 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" ); | 160 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); |
148 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( )); | 161 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); |
149 | tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( )); | 162 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); |
150 | QStringList f = cfg. readListEntry ( "Font", ',' ); | 163 | QStringList f = cfg. readListEntry ( "Font", ',' ); |
151 | if ( f. count ( ) == 4 ) { | 164 | if ( f. count ( ) == 4 ) { |
165 | tc. m_font_use = true; | ||
152 | tc. m_font_family = f [0]; | 166 | tc. m_font_family = f [0]; |
@@ -155,9 +169,3 @@ void TabsSettings::readTabSettings ( Config &cfg ) | |||
155 | tc. m_font_italic = ( f [3]. toInt ( )); | 169 | tc. m_font_italic = ( f [3]. toInt ( )); |
156 | } else { | 170 | } |
157 | tc. m_font_family = font ( ). family ( ); | ||
158 | tc. m_font_size = font ( ). pointSize ( ); | ||
159 | tc. m_font_weight = 50; | ||
160 | tc. m_font_italic = false; | ||
161 | } | ||
162 | |||
163 | m_tabs [*it] = tc; | 171 | m_tabs [*it] = tc; |
@@ -178,4 +186,6 @@ void TabsSettings::readTabSettings ( Config &cfg ) | |||
178 | } | 186 | } |
179 | if ( same ) | 187 | if ( same ) { |
180 | m_tabs [GLOBALID] = *first; | 188 | m_tabs [GLOBALID] = *first; |
189 | m_tabs [GLOBALID]. m_changed = true; | ||
190 | } | ||
181 | } | 191 | } |
@@ -193,3 +203,3 @@ void TabsSettings::accept ( ) | |||
193 | 203 | ||
194 | if ( !tc. m_changed || ( *it == GLOBALID )) | 204 | if ( !tc. m_changed ) |
195 | continue; | 205 | continue; |
@@ -213,4 +223,9 @@ void TabsSettings::accept ( ) | |||
213 | 223 | ||
214 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); | 224 | if ( tc. m_font_use ) { |
215 | cfg. writeEntry ( "Font", f ); | 225 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); |
226 | cfg. writeEntry ( "Font", f ); | ||
227 | } | ||
228 | else | ||
229 | cfg. removeEntry ( "Font" ); | ||
230 | |||
216 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); | 231 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); |
@@ -236,5 +251,7 @@ void TabsSettings::accept ( ) | |||
236 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 251 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); |
237 | fe << *it << tc. m_font_family; | 252 | fe << *it; |
253 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); | ||
238 | fe << tc. m_font_size; | 254 | fe << tc. m_font_size; |
239 | fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 ); | 255 | fe << tc. m_font_weight; |
256 | fe << ( tc. m_font_italic ? 1 : 0 ); | ||
240 | 257 | ||
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp index 5bc5ad2..b3e302a 100644 --- a/core/settings/launcher/taskbarsettings.cpp +++ b/core/settings/launcher/taskbarsettings.cpp | |||
@@ -137,2 +137,3 @@ void TaskbarSettings::accept ( ) | |||
137 | cfg. setGroup ( "Applets" ); | 137 | cfg. setGroup ( "Applets" ); |
138 | |||
138 | if ( m_applets_changed ) { | 139 | if ( m_applets_changed ) { |
@@ -150,3 +151,3 @@ void TaskbarSettings::accept ( ) | |||
150 | if ( m_applets_changed ) { | 151 | if ( m_applets_changed ) { |
151 | QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); | 152 | QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); |
152 | m_applets_changed = false; | 153 | m_applets_changed = false; |