Mercurial > hg > svcore
diff base/Preferences.cpp @ 612:75f154085a4d
* Add time display format preference
author | Chris Cannam |
---|---|
date | Fri, 25 Sep 2009 12:02:22 +0000 |
parents | 98077b21a9e1 |
children | 2c4aca969c24 451f7f3ab6e7 |
line wrap: on
line diff
--- a/base/Preferences.cpp Fri Sep 11 15:42:32 2009 +0000 +++ b/base/Preferences.cpp Fri Sep 25 12:02:22 2009 +0000 @@ -46,6 +46,7 @@ m_resampleOnLoad(false), m_viewFontSize(10), m_backgroundMode(BackgroundFromTheme), + m_timeToTextMode(TimeToTextMs), m_showSplash(true) { QSettings settings; @@ -63,6 +64,8 @@ m_resampleOnLoad = settings.value("resample-on-load", false).toBool(); m_backgroundMode = BackgroundMode (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); + m_timeToTextMode = TimeToTextMode + (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt()); m_viewFontSize = settings.value("view-font-size", 10).toInt(); m_showSplash = settings.value("show-splash", true).toBool(); settings.endGroup(); @@ -90,6 +93,7 @@ props.push_back("Resample On Load"); props.push_back("Temporary Directory Root"); props.push_back("Background Mode"); + props.push_back("Time To Text Mode"); props.push_back("View Font Size"); props.push_back("Show Splash Screen"); return props; @@ -128,6 +132,9 @@ if (name == "Background Mode") { return tr("Background colour preference"); } + if (name == "Time To Text Mode") { + return tr("Time display format"); + } if (name == "View Font Size") { return tr("Font size for text overlays"); } @@ -171,6 +178,9 @@ if (name == "Background Mode") { return ValueProperty; } + if (name == "Time To Text Mode") { + return ValueProperty; + } if (name == "View Font Size") { return RangeProperty; } @@ -231,6 +241,13 @@ return int(m_backgroundMode); } + if (name == "Time To Text Mode") { + if (min) *min = 0; + if (max) *max = 6; + if (deflt) *deflt = 0; + return int(m_timeToTextMode); + } + if (name == "View Font Size") { if (min) *min = 3; if (max) *max = 48; @@ -294,6 +311,17 @@ case LightBackground: return tr("Light background"); } } + if (name == "Time To Text Mode") { + switch (value) { + case TimeToTextMs: return tr("Standard (to millisecond)"); + case TimeToTextUs: return tr("High resolution (to microsecond)"); + case TimeToText24Frame: return tr("24 FPS"); + case TimeToText25Frame: return tr("25 FPS"); + case TimeToText30Frame: return tr("30 FPS"); + case TimeToText50Frame: return tr("50 FPS"); + case TimeToText60Frame: return tr("60 FPS"); + } + } return ""; } @@ -329,6 +357,8 @@ setOmitTempsFromRecentFiles(value ? true : false); } else if (name == "Background Mode") { setBackgroundMode(BackgroundMode(value)); + } else if (name == "Time To Text Mode") { + setTimeToTextMode(TimeToTextMode(value)); } else if (name == "View Font Size") { setViewFontSize(value); } else if (name == "Show Splash Screen") { @@ -480,6 +510,21 @@ } void +Preferences::setTimeToTextMode(TimeToTextMode mode) +{ + if (m_timeToTextMode != mode) { + + m_timeToTextMode = mode; + + QSettings settings; + settings.beginGroup("Preferences"); + settings.setValue("time-to-text-mode", int(mode)); + settings.endGroup(); + emit propertyChanged("Time To Text Mode"); + } +} + +void Preferences::setViewFontSize(int size) { if (m_viewFontSize != size) {