Mercurial > hg > svcore
changeset 1034:780959a4fe23
Update and merge
author | Chris Cannam |
---|---|
date | Thu, 26 Feb 2015 09:44:08 +0000 |
parents | 3a48b22fed48 (current diff) 344c9ea90181 (diff) |
children | 682d64f05e72 |
files | |
diffstat | 3 files changed, 76 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/base/Preferences.cpp Thu Feb 26 09:43:12 2015 +0000 +++ b/base/Preferences.cpp Thu Feb 26 09:44:08 2015 +0000 @@ -49,6 +49,7 @@ m_viewFontSize(10), m_backgroundMode(BackgroundFromTheme), m_timeToTextMode(TimeToTextMs), + m_showHMS(true), m_octave(4), m_showSplash(true) { @@ -71,6 +72,7 @@ (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); m_timeToTextMode = TimeToTextMode (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt()); + m_showHMS = (settings.value("show-hours-minutes-seconds", true)).toBool(); m_octave = (settings.value("octave-of-middle-c", 4)).toInt(); m_viewFontSize = settings.value("view-font-size", 10).toInt(); m_showSplash = settings.value("show-splash", true).toBool(); @@ -102,6 +104,7 @@ props.push_back("Temporary Directory Root"); props.push_back("Background Mode"); props.push_back("Time To Text Mode"); + props.push_back("Show Hours And Minutes"); props.push_back("Octave Numbering System"); props.push_back("View Font Size"); props.push_back("Show Splash Screen"); @@ -148,7 +151,10 @@ return tr("Background colour preference"); } if (name == "Time To Text Mode") { - return tr("Time display format"); + return tr("Time display precision"); + } + if (name == "Show Hours And Minutes") { + return tr("Use hours:minutes:seconds format"); } if (name == "Octave Numbering System") { return tr("Label middle C as"); @@ -205,6 +211,9 @@ if (name == "Time To Text Mode") { return ValueProperty; } + if (name == "Show Hours And Minutes") { + return ToggleProperty; + } if (name == "Octave Numbering System") { return ValueProperty; } @@ -259,6 +268,7 @@ if (name == "Omit Temporaries from Recent Files") { if (deflt) *deflt = 1; + return m_omitRecentTemps ? 1 : 0; } if (name == "Background Mode") { @@ -275,6 +285,11 @@ return int(m_timeToTextMode); } + if (name == "Show Hours And Minutes") { + if (deflt) *deflt = 1; + return m_showHMS ? 1 : 0; + } + if (name == "Octave Numbering System") { // we don't support arbitrary octaves in the gui, because we // want to be able to label what the octave system comes @@ -294,6 +309,7 @@ if (name == "Show Splash Screen") { if (deflt) *deflt = 1; + return m_showSplash ? 1 : 0; } return 0; @@ -404,6 +420,8 @@ setBackgroundMode(BackgroundMode(value)); } else if (name == "Time To Text Mode") { setTimeToTextMode(TimeToTextMode(value)); + } else if (name == "Show Hours And Minutes") { + setShowHMS(value ? true : false); } else if (name == "Octave Numbering System") { setOctaveOfMiddleC(getOctaveOfMiddleCInSystem (OctaveNumberingSystem(value))); @@ -599,6 +617,21 @@ } void +Preferences::setShowHMS(bool show) +{ + if (m_showHMS != show) { + + m_showHMS = show; + + QSettings settings; + settings.beginGroup("Preferences"); + settings.setValue("show-hours-minutes-seconds", show); + settings.endGroup(); + emit propertyChanged("Show Hours And Minutes"); + } +} + +void Preferences::setOctaveOfMiddleC(int oct) { if (m_octave != oct) {
--- a/base/Preferences.h Thu Feb 26 09:43:12 2015 +0000 +++ b/base/Preferences.h Thu Feb 26 09:44:08 2015 +0000 @@ -93,6 +93,8 @@ }; TimeToTextMode getTimeToTextMode() const { return m_timeToTextMode; } + bool getShowHMS() const { return m_showHMS; } + int getOctaveOfMiddleC() const { // weed out unsupported octaves return getOctaveOfMiddleCInSystem(getSystemWithMiddleCInOctave(m_octave)); @@ -119,6 +121,7 @@ void setNormaliseAudio(bool); void setBackgroundMode(BackgroundMode mode); void setTimeToTextMode(TimeToTextMode mode); + void setShowHMS(bool show); void setOctaveOfMiddleC(int oct); void setViewFontSize(int size); void setShowSplash(bool); @@ -156,6 +159,7 @@ int m_viewFontSize; BackgroundMode m_backgroundMode; TimeToTextMode m_timeToTextMode; + bool m_showHMS; int m_octave; bool m_showSplash; };
--- a/base/RealTime.cpp Thu Feb 26 09:43:12 2015 +0000 +++ b/base/RealTime.cpp Thu Feb 26 09:44:08 2015 +0000 @@ -274,19 +274,25 @@ std::stringstream out; - if (sec >= 3600) { - out << (sec / 3600) << ":"; + if (p->getShowHMS()) { + + if (sec >= 3600) { + out << (sec / 3600) << ":"; + } + + if (sec >= 60) { + out << (sec % 3600) / 60 << ":"; + } + + if (sec >= 10) { + out << ((sec % 60) / 10); + } + + out << (sec % 10); + + } else { + out << sec; } - - if (sec >= 60) { - out << (sec % 3600) / 60 << ":"; - } - - if (sec >= 10) { - out << ((sec % 60) / 10); - } - - out << (sec % 10); int ms = msec(); @@ -319,21 +325,29 @@ { if (*this < RealTime::zeroTime) return "-" + (-*this).toFrameText(fps); + Preferences *p = Preferences::getInstance(); + std::stringstream out; - if (sec >= 3600) { - out << (sec / 3600) << ":"; + if (p->getShowHMS()) { + + if (sec >= 3600) { + out << (sec / 3600) << ":"; + } + + if (sec >= 60) { + out << (sec % 3600) / 60 << ":"; + } + + if (sec >= 10) { + out << ((sec % 60) / 10); + } + + out << (sec % 10); + + } else { + out << sec; } - - if (sec >= 60) { - out << (sec % 3600) / 60 << ":"; - } - - if (sec >= 10) { - out << ((sec % 60) / 10); - } - - out << (sec % 10); int f = nsec / (ONE_BILLION / fps);