Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 1017:9c890b7dfa83 colourschemes
Add default spectrogram colours to prefs
author | Chris Cannam |
---|---|
date | Wed, 20 Jan 2016 11:43:16 +0000 |
parents | 89f44d182d37 |
children | 25ec2390fad3 |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Tue Jan 19 17:18:38 2016 +0000 +++ b/layer/SpectrogramLayer.cpp Wed Jan 20 11:43:16 2016 +0000 @@ -38,6 +38,7 @@ #include <QMessageBox> #include <QMouseEvent> #include <QTextStream> +#include <QSettings> #include <iostream> @@ -81,6 +82,9 @@ m_exiting(false), m_sliceableModel(0) { + QString colourConfigName = "spectrogram-colour"; + int colourConfigDefault = int(ColourMapper::Green); + if (config == FullRangeDb) { m_initialMaxFrequency = 0; setMaxFrequency(0); @@ -93,6 +97,8 @@ setColourScale(LinearColourScale); setColourMap(ColourMapper::Sunset); setFrequencyScale(LogFrequencyScale); + colourConfigName = "spectrogram-melodic-colour"; + colourConfigDefault = int(ColourMapper::Sunset); // setGain(20); } else if (config == MelodicPeaks) { setWindowSize(4096); @@ -104,8 +110,15 @@ setColourScale(LinearColourScale); setBinDisplay(PeakFrequencies); setNormalization(NormalizeColumns); + colourConfigName = "spectrogram-melodic-colour"; + colourConfigDefault = int(ColourMapper::Sunset); } + QSettings settings; + settings.beginGroup("Preferences"); + setColourMap(settings.value(colourConfigName, colourConfigDefault).toInt()); + settings.endGroup(); + Preferences *prefs = Preferences::getInstance(); connect(prefs, SIGNAL(propertyChanged(PropertyContainer::PropertyName)), this, SLOT(preferenceChanged(PropertyContainer::PropertyName)));