summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-07-29 13:27:28 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-07-29 13:27:28 +0200
commitbdf09030a60214b5476cbfaa5c6237d54d4dec2d (patch)
treea4cd91d1637d7a9b6e9ffec2987486ef1dae2ddd
parentrekonq 0.5.52 (diff)
downloadrekonq-bdf09030a60214b5476cbfaa5c6237d54d4dec2d.tar.xz
Fix && improve fonts management.
This should save from fonts crash reported by pano &&.. (sorry, cannot remember your name)
-rw-r--r--src/settings/appearancewidget.cpp71
-rw-r--r--src/settings/appearancewidget.h13
-rw-r--r--src/settings/settingsdialog.cpp13
-rw-r--r--src/settings/settingsdialog.h3
4 files changed, 38 insertions, 62 deletions
diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp
index 20793d0a..03d81808 100644
--- a/src/settings/appearancewidget.cpp
+++ b/src/settings/appearancewidget.cpp
@@ -47,23 +47,23 @@ AppearanceWidget::AppearanceWidget(QWidget *parent)
cursiveFontChooser->setCurrentFont( QFont( ReKonfig::cursiveFontFamily() ) );
fantasyFontChooser->setCurrentFont( QFont( ReKonfig::fantasyFontFamily() ) );
- connect(standardFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotStandardFont(const QFont &)));
- connect(fixedFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotFixedFont(const QFont &)));
- connect(serifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotSerifFont(const QFont &)));
- connect(sansSerifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotSansSerifFont(const QFont &)));
- connect(cursiveFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotCursiveFont(const QFont &)));
- connect(fantasyFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotFantasyFont(const QFont &)));
+ connect(standardFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() ));
+ connect(fixedFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() ));
+ connect(serifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() ));
+ connect(sansSerifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() ));
+ connect(cursiveFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() ));
+ connect(fantasyFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() ));
}
void AppearanceWidget::save()
{
- ReKonfig::setStandardFontFamily(reFont[0]);
- ReKonfig::setFixedFontFamily(reFont[1]);
- ReKonfig::setSerifFontFamily(reFont[2]);
- ReKonfig::setSansSerifFontFamily(reFont[3]);
- ReKonfig::setCursiveFontFamily(reFont[4]);
- ReKonfig::setFantasyFontFamily(reFont[5]);
+ ReKonfig::setStandardFontFamily( standardFontChooser->currentFont().family() );
+ ReKonfig::setFixedFontFamily( fixedFontChooser->currentFont().family() );
+ ReKonfig::setSerifFontFamily( serifFontChooser->currentFont().family() );
+ ReKonfig::setSansSerifFontFamily( sansSerifFontChooser->currentFont().family() );
+ ReKonfig::setCursiveFontFamily( cursiveFontChooser->currentFont().family() );
+ ReKonfig::setFantasyFontFamily( fantasyFontChooser->currentFont().family() );
}
@@ -76,46 +76,15 @@ bool AppearanceWidget::changed()
void AppearanceWidget::hasChanged()
{
_changed = true;
+ emit changed(true);
}
-void AppearanceWidget::slotStandardFont(const QFont &f)
+bool AppearanceWidget::isDefault()
{
- reFont[0] = f.family();
- hasChanged();
-}
-
-
-void AppearanceWidget::slotFixedFont(const QFont &f)
-{
- reFont[1] = f.family();
- hasChanged();
-}
-
-
-void AppearanceWidget::slotSerifFont(const QFont &f)
-{
- reFont[2] = f.family();
- hasChanged();
-}
-
-
-void AppearanceWidget::slotSansSerifFont(const QFont &f)
-{
- reFont[3] = f.family();
- hasChanged();
-}
-
-
-void AppearanceWidget::slotCursiveFont(const QFont &f)
-{
- reFont[4] = f.family();
- hasChanged();
-}
-
-
-void AppearanceWidget::slotFantasyFont(const QFont &f)
-{
- reFont[5] = f.family();
- hasChanged();
-}
+ bool def = true;
+
+ // TODO: implement me!!
+
+ return def;
+} \ No newline at end of file
diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h
index ea3de6a1..e2696172 100644
--- a/src/settings/appearancewidget.h
+++ b/src/settings/appearancewidget.h
@@ -47,25 +47,16 @@ public:
void save();
bool changed();
-
+ bool isDefault();
+
signals:
void changed(bool);
private slots:
void hasChanged();
-
- void slotStandardFont(const QFont &);
- void slotFixedFont(const QFont &);
- void slotSerifFont(const QFont &);
- void slotSansSerifFont(const QFont &);
- void slotCursiveFont(const QFont &);
- void slotFantasyFont(const QFont &);
private:
bool _changed;
-
- QString reFont[6];
-
};
#endif // APPEARANCE_WIDGET_H
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index 27d40467..cd64f434 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -219,3 +219,16 @@ bool SettingsDialog::hasChanged()
|| d->shortcutsEditor->isModified();
;
}
+
+
+bool SettingsDialog::isDefault()
+{
+ bool isDef = KConfigDialog::isDefault();
+
+ if(isDef)
+ {
+ // check our private widget values
+ isDef = d->appearanceWidg->isDefault();
+ }
+ return isDef;
+}
diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h
index c25db74b..0b2d9d19 100644
--- a/src/settings/settingsdialog.h
+++ b/src/settings/settingsdialog.h
@@ -50,6 +50,9 @@ public:
virtual bool hasChanged();
+protected:
+ virtual bool isDefault();
+
private:
Private* const d;