Mercurial > hg > svgui
changeset 87:4b98bda7e94d
* Add property labels to property containers (so i18n() won't affect file format)
author | Chris Cannam |
---|---|
date | Wed, 03 May 2006 16:48:03 +0000 |
parents | 93a7efc75fb7 |
children | 6b864e6864cb |
files | layer/Colour3DPlotLayer.h layer/NoteLayer.cpp layer/NoteLayer.h layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h layer/TextLayer.cpp layer/TextLayer.h layer/TimeInstantLayer.cpp layer/TimeInstantLayer.h layer/TimeRulerLayer.cpp layer/TimeRulerLayer.h layer/TimeValueLayer.cpp layer/TimeValueLayer.h layer/WaveformLayer.cpp layer/WaveformLayer.h widgets/PropertyBox.cpp |
diffstat | 16 files changed, 207 insertions(+), 129 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.h Wed May 03 14:26:26 2006 +0000 +++ b/layer/Colour3DPlotLayer.h Wed May 03 16:48:03 2006 +0000 @@ -66,6 +66,7 @@ virtual bool getValueExtents(float &, float &, QString &) const { return false; } + virtual QString getPropertyLabel(const PropertyName &) const { return ""; } /* virtual PropertyList getProperties() const; virtual PropertyType getPropertyType(const PropertyName &) const;
--- a/layer/NoteLayer.cpp Wed May 03 14:26:26 2006 +0000 +++ b/layer/NoteLayer.cpp Wed May 03 16:48:03 2006 +0000 @@ -69,11 +69,19 @@ NoteLayer::getProperties() const { PropertyList list; - list.push_back(tr("Colour")); - list.push_back(tr("Vertical Scale")); + list.push_back("Colour"); + list.push_back("Vertical Scale"); return list; } +QString +NoteLayer::getPropertyLabel(const PropertyName &name) const +{ + if (name == "Colour") return tr("Colour"); + if (name == "Vertical Scale") return tr("Vertical Scale"); + return ""; +} + Layer::PropertyType NoteLayer::getPropertyType(const PropertyName &) const { @@ -88,7 +96,7 @@ int deft = 0; - if (name == tr("Colour")) { + if (name == "Colour") { if (min) *min = 0; if (max) *max = 5; @@ -100,7 +108,7 @@ else if (m_colour == QColor(200, 50, 255)) deft = 4; else if (m_colour == QColor(255, 150, 50)) deft = 5; - } else if (name == tr("Vertical Scale")) { + } else if (name == "Vertical Scale") { if (min) *min = 0; if (max) *max = 2; @@ -119,7 +127,7 @@ NoteLayer::getPropertyValueLabel(const PropertyName &name, int value) const { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: return tr("Black"); @@ -129,7 +137,7 @@ case 4: return tr("Purple"); case 5: return tr("Orange"); } - } else if (name == tr("Vertical Scale")) { + } else if (name == "Vertical Scale") { switch (value) { default: case 0: return tr("Note Range In Use"); @@ -143,7 +151,7 @@ void NoteLayer::setProperty(const PropertyName &name, int value) { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: setBaseColour(Qt::black); break; @@ -153,7 +161,7 @@ case 4: setBaseColour(QColor(200, 50, 255)); break; case 5: setBaseColour(QColor(255, 150, 50)); break; } - } else if (name == tr("Vertical Scale")) { + } else if (name == "Vertical Scale") { setVerticalScale(VerticalScale(value)); } }
--- a/layer/NoteLayer.h Wed May 03 14:26:26 2006 +0000 +++ b/layer/NoteLayer.h Wed May 03 16:48:03 2006 +0000 @@ -61,6 +61,7 @@ void setModel(NoteModel *model); virtual PropertyList getProperties() const; + virtual QString getPropertyLabel(const PropertyName &) const; virtual PropertyType getPropertyType(const PropertyName &) const; virtual int getPropertyRangeAndValue(const PropertyName &, int *min, int *max) const;
--- a/layer/SpectrogramLayer.cpp Wed May 03 14:26:26 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Wed May 03 16:48:03 2006 +0000 @@ -141,49 +141,68 @@ SpectrogramLayer::getProperties() const { PropertyList list; - list.push_back(tr("Colour")); - list.push_back(tr("Colour Scale")); - list.push_back(tr("Window Type")); - list.push_back(tr("Window Size")); - list.push_back(tr("Window Overlap")); - list.push_back(tr("Normalize Columns")); - list.push_back(tr("Bin Display")); - list.push_back(tr("Threshold")); - list.push_back(tr("Gain")); - list.push_back(tr("Colour Rotation")); - list.push_back(tr("Min Frequency")); - list.push_back(tr("Max Frequency")); - list.push_back(tr("Frequency Scale")); + list.push_back("Colour"); + list.push_back("Colour Scale"); + list.push_back("Window Type"); + list.push_back("Window Size"); + list.push_back("Window Overlap"); + list.push_back("Normalize Columns"); + list.push_back("Bin Display"); + list.push_back("Threshold"); + list.push_back("Gain"); + list.push_back("Colour Rotation"); + list.push_back("Min Frequency"); + list.push_back("Max Frequency"); + list.push_back("Frequency Scale"); return list; } +QString +SpectrogramLayer::getPropertyLabel(const PropertyName &name) const +{ + if (name == "Colour") return tr("Colour"); + if (name == "Colour Scale") return tr("Colour Scale"); + if (name == "Window Type") return tr("Window Type"); + if (name == "Window Size") return tr("Window Size"); + if (name == "Window Overlap") return tr("Window Overlap"); + if (name == "Normalize Columns") return tr("Normalize Columns"); + if (name == "Bin Display") return tr("Bin Display"); + if (name == "Threshold") return tr("Threshold"); + if (name == "Gain") return tr("Gain"); + if (name == "Colour Rotation") return tr("Colour Rotation"); + if (name == "Min Frequency") return tr("Min Frequency"); + if (name == "Max Frequency") return tr("Max Frequency"); + if (name == "Frequency Scale") return tr("Frequency Scale"); + return ""; +} + Layer::PropertyType SpectrogramLayer::getPropertyType(const PropertyName &name) const { - if (name == tr("Gain")) return RangeProperty; - if (name == tr("Colour Rotation")) return RangeProperty; - if (name == tr("Normalize Columns")) return ToggleProperty; - if (name == tr("Threshold")) return RangeProperty; + if (name == "Gain") return RangeProperty; + if (name == "Colour Rotation") return RangeProperty; + if (name == "Normalize Columns") return ToggleProperty; + if (name == "Threshold") return RangeProperty; return ValueProperty; } QString SpectrogramLayer::getPropertyGroupName(const PropertyName &name) const { - if (name == tr("Window Size") || - name == tr("Window Type") || - name == tr("Window Overlap")) return tr("Window"); - if (name == tr("Colour") || - name == tr("Gain") || - name == tr("Threshold") || - name == tr("Colour Rotation")) return tr("Colour"); - if (name == tr("Normalize Columns") || - name == tr("Bin Display") || - name == tr("Colour Scale")) return tr("Scale"); - if (name == tr("Max Frequency") || - name == tr("Min Frequency") || - name == tr("Frequency Scale") || - name == tr("Frequency Adjustment")) return tr("Range"); + if (name == "Window Size" || + name == "Window Type" || + name == "Window Overlap") return tr("Window"); + if (name == "Colour" || + name == "Gain" || + name == "Threshold" || + name == "Colour Rotation") return tr("Colour"); + if (name == "Normalize Columns" || + name == "Bin Display" || + name == "Colour Scale") return tr("Scale"); + if (name == "Max Frequency" || + name == "Min Frequency" || + name == "Frequency Scale" || + name == "Frequency Adjustment") return tr("Range"); return QString(); } @@ -197,7 +216,7 @@ if (!min) min = &garbage0; if (!max) max = &garbage1; - if (name == tr("Gain")) { + if (name == "Gain") { *min = -50; *max = 50; @@ -206,7 +225,7 @@ if (deft < *min) deft = *min; if (deft > *max) deft = *max; - } else if (name == tr("Threshold")) { + } else if (name == "Threshold") { *min = -50; *max = 0; @@ -215,35 +234,35 @@ if (deft < *min) deft = *min; if (deft > *max) deft = *max; - } else if (name == tr("Colour Rotation")) { + } else if (name == "Colour Rotation") { *min = 0; *max = 256; deft = m_colourRotation; - } else if (name == tr("Colour Scale")) { + } else if (name == "Colour Scale") { *min = 0; *max = 3; deft = (int)m_colourScale; - } else if (name == tr("Colour")) { + } else if (name == "Colour") { *min = 0; *max = 6; deft = (int)m_colourScheme; - } else if (name == tr("Window Type")) { + } else if (name == "Window Type") { *min = 0; *max = 6; deft = (int)m_windowType; - } else if (name == tr("Window Size")) { + } else if (name == "Window Size") { *min = 0; *max = 10; @@ -252,7 +271,7 @@ int ws = m_windowSize; while (ws > 32) { ws >>= 1; deft ++; } - } else if (name == tr("Window Overlap")) { + } else if (name == "Window Overlap") { *min = 0; *max = 4; @@ -260,7 +279,7 @@ deft = m_windowOverlap / 25; if (m_windowOverlap == 90) deft = 4; - } else if (name == tr("Min Frequency")) { + } else if (name == "Min Frequency") { *min = 0; *max = 9; @@ -278,7 +297,7 @@ case 10000: deft = 9; break; } - } else if (name == tr("Max Frequency")) { + } else if (name == "Max Frequency") { *min = 0; *max = 9; @@ -296,19 +315,19 @@ default: deft = 9; break; } - } else if (name == tr("Frequency Scale")) { + } else if (name == "Frequency Scale") { *min = 0; *max = 1; deft = (int)m_frequencyScale; - } else if (name == tr("Bin Display")) { + } else if (name == "Bin Display") { *min = 0; *max = 2; deft = (int)m_binDisplay; - } else if (name == tr("Normalize Columns")) { + } else if (name == "Normalize Columns") { deft = (m_normalizeColumns ? 1 : 0); @@ -323,7 +342,7 @@ SpectrogramLayer::getPropertyValueLabel(const PropertyName &name, int value) const { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: return tr("Default"); @@ -335,7 +354,7 @@ case 6: return tr("Fruit Salad"); } } - if (name == tr("Colour Scale")) { + if (name == "Colour Scale") { switch (value) { default: case 0: return tr("Linear"); @@ -344,7 +363,7 @@ case 3: return tr("Phase"); } } - if (name == tr("Window Type")) { + if (name == "Window Type") { switch ((WindowType)value) { default: case RectangularWindow: return tr("Rectangle"); @@ -356,10 +375,10 @@ case ParzenWindow: return tr("Parzen"); } } - if (name == tr("Window Size")) { + if (name == "Window Size") { return QString("%1").arg(32 << value); } - if (name == tr("Window Overlap")) { + if (name == "Window Overlap") { switch (value) { default: case 0: return tr("0%"); @@ -369,7 +388,7 @@ case 4: return tr("90%"); } } - if (name == tr("Min Frequency")) { + if (name == "Min Frequency") { switch (value) { default: case 0: return tr("No min"); @@ -384,7 +403,7 @@ case 9: return tr("10 KHz"); } } - if (name == tr("Max Frequency")) { + if (name == "Max Frequency") { switch (value) { default: case 0: return tr("500 Hz"); @@ -399,14 +418,14 @@ case 9: return tr("No max"); } } - if (name == tr("Frequency Scale")) { + if (name == "Frequency Scale") { switch (value) { default: case 0: return tr("Linear"); case 1: return tr("Log"); } } - if (name == tr("Bin Display")) { + if (name == "Bin Display") { switch (value) { default: case 0: return tr("All Bins"); @@ -420,14 +439,14 @@ void SpectrogramLayer::setProperty(const PropertyName &name, int value) { - if (name == tr("Gain")) { + if (name == "Gain") { setGain(pow(10, float(value)/20.0)); - } else if (name == tr("Threshold")) { + } else if (name == "Threshold") { if (value == -50) setThreshold(0.0); else setThreshold(AudioLevel::dB_to_multiplier(value)); - } else if (name == tr("Colour Rotation")) { + } else if (name == "Colour Rotation") { setColourRotation(value); - } else if (name == tr("Colour")) { + } else if (name == "Colour") { switch (value) { default: case 0: setColourScheme(DefaultColours); break; @@ -438,14 +457,14 @@ case 5: setColourScheme(BlueOnBlack); break; case 6: setColourScheme(Rainbow); break; } - } else if (name == tr("Window Type")) { + } else if (name == "Window Type") { setWindowType(WindowType(value)); - } else if (name == tr("Window Size")) { + } else if (name == "Window Size") { setWindowSize(32 << value); - } else if (name == tr("Window Overlap")) { + } else if (name == "Window Overlap") { if (value == 4) setWindowOverlap(90); else setWindowOverlap(25 * value); - } else if (name == tr("Min Frequency")) { + } else if (name == "Min Frequency") { switch (value) { default: case 0: setMinFrequency(0); break; @@ -459,7 +478,7 @@ case 8: setMinFrequency(4000); break; case 9: setMinFrequency(10000); break; } - } else if (name == tr("Max Frequency")) { + } else if (name == "Max Frequency") { switch (value) { case 0: setMaxFrequency(500); break; case 1: setMaxFrequency(1000); break; @@ -473,7 +492,7 @@ default: case 9: setMaxFrequency(0); break; } - } else if (name == tr("Colour Scale")) { + } else if (name == "Colour Scale") { switch (value) { default: case 0: setColourScale(LinearColourScale); break; @@ -481,13 +500,13 @@ case 2: setColourScale(dBColourScale); break; case 3: setColourScale(PhaseColourScale); break; } - } else if (name == tr("Frequency Scale")) { + } else if (name == "Frequency Scale") { switch (value) { default: case 0: setFrequencyScale(LinearFrequencyScale); break; case 1: setFrequencyScale(LogFrequencyScale); break; } - } else if (name == tr("Bin Display")) { + } else if (name == "Bin Display") { switch (value) { default: case 0: setBinDisplay(AllBins); break; @@ -1325,6 +1344,7 @@ std::cerr << "WARNING: fftw_plan_dft_r2c_1d(" << windowSize << ") failed!" << std::endl; fftw_free(input); fftw_free(output); + fftw_free(workbuffer); m_layer.m_mutex.lock(); continue; }
--- a/layer/SpectrogramLayer.h Wed May 03 14:26:26 2006 +0000 +++ b/layer/SpectrogramLayer.h Wed May 03 16:48:03 2006 +0000 @@ -71,6 +71,7 @@ void setModel(const DenseTimeValueModel *model); virtual PropertyList getProperties() const; + virtual QString getPropertyLabel(const PropertyName &) const; virtual PropertyType getPropertyType(const PropertyName &) const; virtual QString getPropertyGroupName(const PropertyName &) const; virtual int getPropertyRangeAndValue(const PropertyName &,
--- a/layer/TextLayer.cpp Wed May 03 14:26:26 2006 +0000 +++ b/layer/TextLayer.cpp Wed May 03 16:48:03 2006 +0000 @@ -63,10 +63,16 @@ TextLayer::getProperties() const { PropertyList list; - list.push_back(tr("Colour")); + list.push_back("Colour"); return list; } +QString +TextLayer::getPropertyLabel(const PropertyName &name) const +{ + if (name == "Colour") return tr("Colour"); +} + Layer::PropertyType TextLayer::getPropertyType(const PropertyName &name) const { @@ -81,7 +87,7 @@ int deft = 0; - if (name == tr("Colour")) { + if (name == "Colour") { if (min) *min = 0; if (max) *max = 5; @@ -105,7 +111,7 @@ TextLayer::getPropertyValueLabel(const PropertyName &name, int value) const { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: return tr("Black"); @@ -122,7 +128,7 @@ void TextLayer::setProperty(const PropertyName &name, int value) { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: setBaseColour(Qt::black); break;
--- a/layer/TextLayer.h Wed May 03 14:26:26 2006 +0000 +++ b/layer/TextLayer.h Wed May 03 16:48:03 2006 +0000 @@ -61,6 +61,7 @@ void setModel(TextModel *model); virtual PropertyList getProperties() const; + virtual QString getPropertyLabel(const PropertyName &) const; virtual PropertyType getPropertyType(const PropertyName &) const; virtual int getPropertyRangeAndValue(const PropertyName &, int *min, int *max) const;
--- a/layer/TimeInstantLayer.cpp Wed May 03 14:26:26 2006 +0000 +++ b/layer/TimeInstantLayer.cpp Wed May 03 16:48:03 2006 +0000 @@ -65,11 +65,19 @@ TimeInstantLayer::getProperties() const { PropertyList list; - list.push_back(tr("Colour")); - list.push_back(tr("Plot Type")); + list.push_back("Colour"); + list.push_back("Plot Type"); return list; } +QString +TimeInstantLayer::getPropertyLabel(const PropertyName &name) const +{ + if (name == "Colour") return tr("Colour"); + if (name == "Plot Type") return tr("Plot Type"); + return ""; +} + Layer::PropertyType TimeInstantLayer::getPropertyType(const PropertyName &) const { @@ -82,7 +90,7 @@ { int deft = 0; - if (name == tr("Colour")) { + if (name == "Colour") { if (min) *min = 0; if (max) *max = 5; @@ -94,7 +102,7 @@ else if (m_colour == QColor(200, 50, 255)) deft = 4; else if (m_colour == QColor(255, 150, 50)) deft = 5; - } else if (name == tr("Plot Type")) { + } else if (name == "Plot Type") { if (min) *min = 0; if (max) *max = 1; @@ -113,7 +121,7 @@ TimeInstantLayer::getPropertyValueLabel(const PropertyName &name, int value) const { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: return tr("Black"); @@ -123,7 +131,7 @@ case 4: return tr("Purple"); case 5: return tr("Orange"); } - } else if (name == tr("Plot Type")) { + } else if (name == "Plot Type") { switch (value) { default: case 0: return tr("Instants"); @@ -136,7 +144,7 @@ void TimeInstantLayer::setProperty(const PropertyName &name, int value) { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: setBaseColour(Qt::black); break; @@ -146,7 +154,7 @@ case 4: setBaseColour(QColor(200, 50, 255)); break; case 5: setBaseColour(QColor(255, 150, 50)); break; } - } else if (name == tr("Plot Type")) { + } else if (name == "Plot Type") { setPlotStyle(PlotStyle(value)); } }
--- a/layer/TimeInstantLayer.h Wed May 03 14:26:26 2006 +0000 +++ b/layer/TimeInstantLayer.h Wed May 03 16:48:03 2006 +0000 @@ -61,6 +61,7 @@ void setModel(SparseOneDimensionalModel *model); virtual PropertyList getProperties() const; + virtual QString getPropertyLabel(const PropertyName &) const; virtual PropertyType getPropertyType(const PropertyName &) const; virtual int getPropertyRangeAndValue(const PropertyName &, int *min, int *max) const;
--- a/layer/TimeRulerLayer.cpp Wed May 03 14:26:26 2006 +0000 +++ b/layer/TimeRulerLayer.cpp Wed May 03 16:48:03 2006 +0000 @@ -55,10 +55,17 @@ TimeRulerLayer::getProperties() const { PropertyList list; - list.push_back(tr("Colour")); + list.push_back("Colour"); return list; } +QString +TimeRulerLayer::getPropertyLabel(const PropertyName &name) const +{ + if (name == "Colour") return tr("Colour"); + return ""; +} + Layer::PropertyType TimeRulerLayer::getPropertyType(const PropertyName &name) const { @@ -71,7 +78,7 @@ { int deft = 0; - if (name == tr("Colour")) { + if (name == "Colour") { if (min) *min = 0; if (max) *max = 5; @@ -95,7 +102,7 @@ TimeRulerLayer::getPropertyValueLabel(const PropertyName &name, int value) const { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: return tr("Black"); @@ -112,7 +119,7 @@ void TimeRulerLayer::setProperty(const PropertyName &name, int value) { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: setBaseColour(Qt::black); break;
--- a/layer/TimeRulerLayer.h Wed May 03 14:26:26 2006 +0000 +++ b/layer/TimeRulerLayer.h Wed May 03 16:48:03 2006 +0000 @@ -45,6 +45,7 @@ LabelHeight getLabelHeight() const { return m_labelHeight; } virtual PropertyList getProperties() const; + virtual QString getPropertyLabel(const PropertyName &) const; virtual PropertyType getPropertyType(const PropertyName &) const; virtual int getPropertyRangeAndValue(const PropertyName &, int *min, int *max) const;
--- a/layer/TimeValueLayer.cpp Wed May 03 14:26:26 2006 +0000 +++ b/layer/TimeValueLayer.cpp Wed May 03 16:48:03 2006 +0000 @@ -69,12 +69,21 @@ TimeValueLayer::getProperties() const { PropertyList list; - list.push_back(tr("Colour")); - list.push_back(tr("Plot Type")); - list.push_back(tr("Vertical Scale")); + list.push_back("Colour"); + list.push_back("Plot Type"); + list.push_back("Vertical Scale"); return list; } +QString +TimeValueLayer::getPropertyLabel(const PropertyName &name) const +{ + if (name == "Colour") return tr("Colour"); + if (name == "Plot Type") return tr("Plot Type"); + if (name == "Vertical Scale") return tr("Vertical Scale"); + return ""; +} + Layer::PropertyType TimeValueLayer::getPropertyType(const PropertyName &name) const { @@ -89,7 +98,7 @@ int deft = 0; - if (name == tr("Colour")) { + if (name == "Colour") { if (min) *min = 0; if (max) *max = 5; @@ -101,14 +110,14 @@ else if (m_colour == QColor(200, 50, 255)) deft = 4; else if (m_colour == QColor(255, 150, 50)) deft = 5; - } else if (name == tr("Plot Type")) { + } else if (name == "Plot Type") { if (min) *min = 0; if (max) *max = 5; deft = int(m_plotStyle); - } else if (name == tr("Vertical Scale")) { + } else if (name == "Vertical Scale") { if (min) *min = 0; if (max) *max = 3; @@ -127,7 +136,7 @@ TimeValueLayer::getPropertyValueLabel(const PropertyName &name, int value) const { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: return tr("Black"); @@ -137,7 +146,7 @@ case 4: return tr("Purple"); case 5: return tr("Orange"); } - } else if (name == tr("Plot Type")) { + } else if (name == "Plot Type") { switch (value) { default: case 0: return tr("Points"); @@ -147,7 +156,7 @@ case 4: return tr("Curve"); case 5: return tr("Segmentation"); } - } else if (name == tr("Vertical Scale")) { + } else if (name == "Vertical Scale") { switch (value) { default: case 0: return tr("Linear Scale"); @@ -162,7 +171,7 @@ void TimeValueLayer::setProperty(const PropertyName &name, int value) { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: setBaseColour(Qt::black); break; @@ -172,9 +181,9 @@ case 4: setBaseColour(QColor(200, 50, 255)); break; case 5: setBaseColour(QColor(255, 150, 50)); break; } - } else if (name == tr("Plot Type")) { + } else if (name == "Plot Type") { setPlotStyle(PlotStyle(value)); - } else if (name == tr("Vertical Scale")) { + } else if (name == "Vertical Scale") { setVerticalScale(VerticalScale(value)); } }
--- a/layer/TimeValueLayer.h Wed May 03 14:26:26 2006 +0000 +++ b/layer/TimeValueLayer.h Wed May 03 16:48:03 2006 +0000 @@ -64,6 +64,7 @@ void setModel(SparseTimeValueModel *model); virtual PropertyList getProperties() const; + virtual QString getPropertyLabel(const PropertyName &) const; virtual PropertyType getPropertyType(const PropertyName &) const; virtual int getPropertyRangeAndValue(const PropertyName &, int *min, int *max) const;
--- a/layer/WaveformLayer.cpp Wed May 03 14:26:26 2006 +0000 +++ b/layer/WaveformLayer.cpp Wed May 03 16:48:03 2006 +0000 @@ -90,35 +90,46 @@ WaveformLayer::getProperties() const { PropertyList list; - list.push_back(tr("Colour")); - list.push_back(tr("Scale")); - list.push_back(tr("Gain")); - list.push_back(tr("Normalize Visible Area")); + list.push_back("Colour"); + list.push_back("Scale"); + list.push_back("Gain"); + list.push_back("Normalize Visible Area"); if (m_model && m_model->getChannelCount() > 1 && m_channel == -1) { - list.push_back(tr("Channels")); + list.push_back("Channels"); } return list; } +QString +WaveformLayer::getPropertyLabel(const PropertyName &name) const +{ + if (name == "Colour") return tr("Colour"); + if (name == "Scale") return tr("Scale"); + if (name == "Gain") return tr("Gain"); + if (name == "Normalize Visible Area") return tr("Normalize Visible Area"); + if (name == "Channels") return tr("Channels"); + return ""; +} + Layer::PropertyType WaveformLayer::getPropertyType(const PropertyName &name) const { - if (name == tr("Gain")) return RangeProperty; - if (name == tr("Normalize Visible Area")) return ToggleProperty; - if (name == tr("Colour")) return ValueProperty; - if (name == tr("Channels")) return ValueProperty; - if (name == tr("Scale")) return ValueProperty; + if (name == "Gain") return RangeProperty; + if (name == "Normalize Visible Area") return ToggleProperty; + if (name == "Colour") return ValueProperty; + if (name == "Channels") return ValueProperty; + if (name == "Scale") return ValueProperty; return InvalidProperty; } QString WaveformLayer::getPropertyGroupName(const PropertyName &name) const { - if (name == tr("Gain") || - name == tr("Normalize Visible Area") || - name == tr("Scale")) return tr("Scale"); + if (name == "Gain" || + name == "Normalize Visible Area" || + name == "Scale") return tr("Scale"); return QString(); } @@ -132,7 +143,7 @@ if (!min) min = &garbage0; if (!max) max = &garbage1; - if (name == tr("Gain")) { + if (name == "Gain") { *min = -50; *max = 50; @@ -141,11 +152,11 @@ if (deft < *min) deft = *min; if (deft > *max) deft = *max; - } else if (name == tr("Normalize Visible Area")) { + } else if (name == "Normalize Visible Area") { deft = (m_autoNormalize ? 1 : 0); - } else if (name == tr("Colour")) { + } else if (name == "Colour") { *min = 0; *max = 5; @@ -157,7 +168,7 @@ else if (m_colour == QColor(200, 50, 255)) deft = 4; else if (m_colour == QColor(255, 150, 50)) deft = 5; - } else if (name == tr("Channels")) { + } else if (name == "Channels") { *min = 0; *max = 2; @@ -165,7 +176,7 @@ else if (m_channelMode == MergeChannels) deft = 2; else deft = 0; - } else if (name == tr("Scale")) { + } else if (name == "Scale") { *min = 0; *max = 2; @@ -183,7 +194,7 @@ WaveformLayer::getPropertyValueLabel(const PropertyName &name, int value) const { - if (name == tr("Colour")) { + if (name == "Colour") { switch (value) { default: case 0: return tr("Black"); @@ -194,7 +205,7 @@ case 5: return tr("Orange"); } } - if (name == tr("Scale")) { + if (name == "Scale") { switch (value) { default: case 0: return tr("Linear"); @@ -202,7 +213,7 @@ case 2: return tr("dB"); } } - if (name == tr("Channels")) { + if (name == "Channels") { switch (value) { default: case 0: return tr("Separate"); @@ -216,11 +227,11 @@ void WaveformLayer::setProperty(const PropertyName &name, int value) { - if (name == tr("Gain")) { + if (name == "Gain") { setGain(pow(10, float(value)/20.0)); - } else if (name == tr("Normalize Visible Area")) { + } else if (name == "Normalize Visible Area") { setAutoNormalize(value ? true : false); - } else if (name == tr("Colour")) { + } else if (name == "Colour") { switch (value) { default: case 0: setBaseColour(Qt::black); break; @@ -230,11 +241,11 @@ case 4: setBaseColour(QColor(200, 50, 255)); break; case 5: setBaseColour(QColor(255, 150, 50)); break; } - } else if (name == tr("Channels")) { + } else if (name == "Channels") { if (value == 1) setChannelMode(MixChannels); else if (value == 2) setChannelMode(MergeChannels); else setChannelMode(SeparateChannels); - } else if (name == tr("Scale")) { + } else if (name == "Scale") { switch (value) { default: case 0: setScale(LinearScale); break;
--- a/layer/WaveformLayer.h Wed May 03 14:26:26 2006 +0000 +++ b/layer/WaveformLayer.h Wed May 03 16:48:03 2006 +0000 @@ -47,6 +47,7 @@ void setModel(const RangeSummarisableTimeValueModel *model); virtual PropertyList getProperties() const; + virtual QString getPropertyLabel(const PropertyName &) const; virtual PropertyType getPropertyType(const PropertyName &) const; virtual QString getPropertyGroupName(const PropertyName &) const; virtual int getPropertyRangeAndValue(const PropertyName &,
--- a/widgets/PropertyBox.cpp Wed May 03 14:26:26 2006 +0000 +++ b/widgets/PropertyBox.cpp Wed May 03 16:48:03 2006 +0000 @@ -224,6 +224,7 @@ m_propertyControllers.end()); QString groupName = m_container->getPropertyGroupName(name); + QString propertyLabel = m_container->getPropertyLabel(name); #ifdef DEBUG_PROPERTY_BOX std::cerr << "PropertyBox[" << this @@ -251,9 +252,9 @@ } } else { #ifdef DEBUG_PROPERTY_BOX - std::cerr << "PropertyBox: adding label \"" << name.toStdString() << "\"" << std::endl; + std::cerr << "PropertyBox: adding label \"" << propertyLabel.toStdString() << "\"" << std::endl; #endif - m_layout->addWidget(new QLabel(name, m_mainWidget), row, 0); + m_layout->addWidget(new QLabel(propertyLabel, m_mainWidget), row, 0); } }