From 12898b0b9c41cfe7936ed5a9595d18be68bcfaee Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Thu, 3 Jul 2008 13:39:31 +0000 Subject: [PATCH] prefs dialog shows currently selected fonts --- doc/ChangeLog | 6 ++++ src/gui/PrefsDialog.cpp | 24 +++++++++++---- src/gui/PrefsDialog.h | 7 +++-- src/gui/prefsdialog_q.ui | 63 +++++++++++++++++++++++++++++++--------- 4 files changed, 80 insertions(+), 20 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8e8358ad3..5acc0400e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2008-07-03 Vadim Kurland + + * PrefsDialog.cpp (PrefsDialog::getFontDescription): Tab "Fonts" + of the Preferences dialog shows currently selected fonts for both + the tree and rules. + 2008-07-02 Vadim Kurland * instDialog.cpp (instDialog::addToLog): fixes in built-in diff --git a/src/gui/PrefsDialog.cpp b/src/gui/PrefsDialog.cpp index e59af4412..8c20b759e 100644 --- a/src/gui/PrefsDialog.cpp +++ b/src/gui/PrefsDialog.cpp @@ -188,9 +188,21 @@ PrefsDialog::PrefsDialog(QWidget *parent) : QDialog(parent) rulesFont = st->getRulesFont(); treeFont = st->getTreeFont(); uiFont = st->getUiFont(); + + m_dialog->rulesFontDescr->setText(getFontDescription(rulesFont)); + m_dialog->treeFontDescr->setText(getFontDescription(treeFont)); + m_dialog->chClipComment->setChecked(st->getClipComment() ); } +QString PrefsDialog::getFontDescription(const QFont &font) +{ + ostringstream str; + str << font.family().toLatin1().constData() + << " " << font.pointSize(); + return QString(str.str().c_str()); +} + void PrefsDialog::changeColor(QPushButton *btn, FWBSettings::LabelColors colorCode) { @@ -256,20 +268,22 @@ void PrefsDialog::changeShowIcons() void PrefsDialog::changeRulesFont() { - changeFont(&rulesFont); + changeFont(rulesFont); + m_dialog->rulesFontDescr->setText(getFontDescription(rulesFont)); } void PrefsDialog::changeTreeFont() { - changeFont(&treeFont); + changeFont(treeFont); + m_dialog->treeFontDescr->setText(getFontDescription(treeFont)); } -void PrefsDialog::changeFont(QFont *font) +void PrefsDialog::changeFont(QFont &font) { bool ok; - QFont f = QFontDialog::getFont(&ok, *font, this); + QFont f = QFontDialog::getFont(&ok, font, this); if (ok) - *font = f; + font = f; } void PrefsDialog::findWDir() diff --git a/src/gui/PrefsDialog.h b/src/gui/PrefsDialog.h index 957d2e12b..86781f837 100644 --- a/src/gui/PrefsDialog.h +++ b/src/gui/PrefsDialog.h @@ -56,10 +56,13 @@ class PrefsDialog : public QDialog QFont rulesFont; QFont treeFont; QFont uiFont; - void changeFont(QFont *font); - public: + void changeFont(QFont &font); + +public: PrefsDialog(QWidget *parent); ~PrefsDialog(); + + QString getFontDescription(const QFont &font); public slots: virtual void accept(); diff --git a/src/gui/prefsdialog_q.ui b/src/gui/prefsdialog_q.ui index f9b79080e..04fc7c961 100644 --- a/src/gui/prefsdialog_q.ui +++ b/src/gui/prefsdialog_q.ui @@ -8,7 +8,7 @@ 0 0 - 555 + 639 396 @@ -104,7 +104,7 @@ - 0 + 6 @@ -934,6 +934,18 @@ + + + 0 + 0 + + + + + 200 + 0 + + Choose font for rules sets @@ -942,21 +954,33 @@ - - - - Qt::Horizontal + + + + + 0 + 0 + - - - 40 - 121 - + + rules font description - + + + + 0 + 0 + + + + + 200 + 0 + + Choose font for tree @@ -965,7 +989,20 @@ - + + + + + 0 + 0 + + + + tree font description + + + + Qt::Vertical