# HG changeset patch # User Chris Cannam # Date 1197385109 0 # Node ID 048b21bc9891156b12f0d2fa9a5d3d5bb0499fc3 # Parent 1c68162201851fa05ce819b3af77e067e9b6eaef * Make font size in panes configurable, with a smaller default * Add [ and ] to select prev/next pane diff -r 1c6816220185 -r 048b21bc9891 base/Preferences.cpp --- a/base/Preferences.cpp Mon Dec 10 17:37:13 2007 +0000 +++ b/base/Preferences.cpp Tue Dec 11 14:58:29 2007 +0000 @@ -23,6 +23,8 @@ #include #include #include +#include +#include Preferences * Preferences::m_instance = 0; @@ -42,7 +44,9 @@ m_resampleQuality(1), m_omitRecentTemps(true), m_tempDirRoot(""), - m_resampleOnLoad(false) + m_resampleOnLoad(false), + m_viewFontSize(10), + m_backgroundMode(BackgroundFromTheme) { QSettings settings; settings.beginGroup("Preferences"); @@ -57,6 +61,8 @@ m_resampleOnLoad = settings.value("resample-on-load", false).toBool(); m_backgroundMode = BackgroundMode (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); + m_viewFontSize = settings.value + ("view-font-size", QApplication::font().pointSize() * 0.9).toInt(); settings.endGroup(); settings.beginGroup("TempDirectory"); @@ -81,6 +87,7 @@ props.push_back("Resample On Load"); props.push_back("Temporary Directory Root"); props.push_back("Background Mode"); + props.push_back("View Font Size"); return props; } @@ -114,6 +121,9 @@ if (name == "Background Mode") { return tr("Background colour preference"); } + if (name == "View Font Size") { + return tr("Font size for text overlays"); + } return name; } @@ -148,6 +158,9 @@ if (name == "Background Mode") { return ValueProperty; } + if (name == "View Font Size") { + return RangeProperty; + } return InvalidProperty; } @@ -196,6 +209,13 @@ return int(m_backgroundMode); } + if (name == "View Font Size") { + if (min) *min = 3; + if (max) *max = 48; + if (deflt) *deflt = int(QApplication::font().pointSize() * 0.9); + return int(m_viewFontSize); + } + return 0; } @@ -274,6 +294,8 @@ setOmitTempsFromRecentFiles(value ? true : false); } else if (name == "Background Mode") { setBackgroundMode(BackgroundMode(value)); + } else if (name == "View Font Size") { + setViewFontSize(value); } } @@ -403,4 +425,18 @@ } } +void +Preferences::setViewFontSize(int size) +{ + if (m_viewFontSize != size) { + m_viewFontSize = size; + + QSettings settings; + settings.beginGroup("Preferences"); + settings.setValue("view-font-size", size); + settings.endGroup(); + emit propertyChanged("View Font Size"); + } +} + diff -r 1c6816220185 -r 048b21bc9891 base/Preferences.h --- a/base/Preferences.h Mon Dec 10 17:37:13 2007 +0000 +++ b/base/Preferences.h Tue Dec 11 14:58:29 2007 +0000 @@ -54,6 +54,8 @@ }; PropertyBoxLayout getPropertyBoxLayout() const { return m_propertyBoxLayout; } + int getViewFontSize() const { return m_viewFontSize; } + bool getOmitTempsFromRecentFiles() const { return m_omitRecentTemps; } QString getTemporaryDirectoryRoot() const { return m_tempDirRoot; } @@ -79,6 +81,7 @@ void setTemporaryDirectoryRoot(QString tempDirRoot); void setResampleOnLoad(bool); void setBackgroundMode(BackgroundMode mode); + void setViewFontSize(int size); private: Preferences(); // may throw DirectoryCreationFailed @@ -94,6 +97,7 @@ bool m_omitRecentTemps; QString m_tempDirRoot; bool m_resampleOnLoad; + int m_viewFontSize; BackgroundMode m_backgroundMode; };