Permalink
Browse files

Settings dialog now includes a font setting, still need to make the

graphics items respect it though LiteralGraphicsItem does already
  • Loading branch information...
aelliott committed Feb 16, 2012
1 parent 5fc2f09 commit 5b55b40a2bf830531bc9611bdd8a5c96f62475bc
Showing with 32 additions and 0 deletions.
  1. +13 −0 settingsdialog.cpp
  2. +2 −0 settingsdialog.hpp
  3. +17 −0 settingsdialog.ui
View
@@ -22,6 +22,8 @@
#include "settingsdialog.hpp"
#include "ui_settingsdialog.h"
+#include <QFontDialog>
+
SettingsDialog::SettingsDialog(QWidget *parent)
: QDialog(parent)
, _ui(new Ui::SettingsDialog)
@@ -69,6 +71,7 @@ void SettingsDialog::setValues()
_settings.setValue("Editor/Autocompletion",
_ui->autocompletionCheckBox->isChecked());
+ _settings.setValue("Visualisation/Font", _visualisationFont);
_settings.setValue("Visualisation/HorizontalSpacing",
_ui->horizontalSpacingSpinBox->value());
_settings.setValue("Visualisation/VerticalSpacing",
@@ -94,6 +97,7 @@ void SettingsDialog::readValues()
_expressionHighlighting = _settings.value("Editor/Highlighting", true).toBool();
_autocompletion = _settings.value("Editor/Autocompletion", false).toBool();
+ _visualisationFont = _settings.value("Visualisation/Font", QFont("sans-serif", 10)).value<QFont>();
_horizontalSpacing = _settings.value("Visualisation/HorizontalSpacing", 8).toInt();
_verticalSpacing = _settings.value("Visualisation/VerticalSpacing", 12).toInt();
_groupingDisplayOptions = _settings.value(
@@ -212,6 +216,15 @@ void SettingsDialog::autocompletionChanged(bool autocomplete)
rehash();
}
+void SettingsDialog::selectVisualisationFont()
+{
+ bool status;
+ _visualisationFont = QFontDialog::getFont(&status, _visualisationFont, this);
+ _settings.setValue("Visualisation/Font", _visualisationFont);
+
+ rehash();
+}
+
void SettingsDialog::horizontalSpacingChanged(int spacing)
{
_settings.setValue("Visualisation/HorizontalSpacing", spacing);
View
@@ -58,6 +58,7 @@ public slots:
void expressionHighlightingChanged(bool highlighting);
void autocompletionChanged(bool autocomplete);
+ void selectVisualisationFont();
void horizontalSpacingChanged(int spacing);
void verticalSpacingChanged(int spacing);
@@ -80,6 +81,7 @@ public slots:
int _horizontalSpacing;
int _verticalSpacing;
int _groupingDisplayOptions;
+ QFont _visualisationFont;
};
#endif // SETTINGSDIALOG_HPP
View
@@ -507,6 +507,22 @@
</hint>
</hints>
</connection>
+ <connection>
+ <sender>selectFontButton</sender>
+ <signal>pressed()</signal>
+ <receiver>SettingsDialog</receiver>
+ <slot>selectVisualisationFont()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>217</x>
+ <y>385</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>226</x>
+ <y>306</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
<slots>
<slot>visualisationTabChanged(int)</slot>
@@ -519,5 +535,6 @@
<slot>showCapturingGroupsChanged(bool)</slot>
<slot>showNoncapturingGroupsChanged(bool)</slot>
<slot>handleButtonPress(QAbstractButton*)</slot>
+ <slot>selectVisualisationFont()</slot>
</slots>
</ui>

0 comments on commit 5b55b40

Please sign in to comment.