comparison base/Preferences.cpp @ 138:6332e41c1619

* Various experiments in spectrogram colour scaling, etc. Nothing final here yet, but some promising developments.
author Chris Cannam
date Fri, 14 Jul 2006 17:12:16 +0000
parents 0aafdda005ce
children a35098a9c814
comparison
equal deleted inserted replaced
137:0aafdda005ce 138:6332e41c1619
28 Preferences::getProperties() const 28 Preferences::getProperties() const
29 { 29 {
30 PropertyList props; 30 PropertyList props;
31 props.push_back("Smooth Spectrogram"); 31 props.push_back("Smooth Spectrogram");
32 props.push_back("Tuning Frequency"); 32 props.push_back("Tuning Frequency");
33 props.push_back("Property Box Layout");
33 return props; 34 return props;
34 } 35 }
35 36
36 QString 37 QString
37 Preferences::getPropertyLabel(const PropertyName &name) const 38 Preferences::getPropertyLabel(const PropertyName &name) const
40 return tr("Spectrogram Display Smoothing"); 41 return tr("Spectrogram Display Smoothing");
41 } 42 }
42 if (name == "Tuning Frequency") { 43 if (name == "Tuning Frequency") {
43 return tr("Tuning Frequency (concert A)"); 44 return tr("Tuning Frequency (concert A)");
44 } 45 }
46 if (name == "Property Box Layout") {
47 return tr("Arrangement of Layer Properties");
48 }
45 return name; 49 return name;
46 } 50 }
47 51
48 Preferences::PropertyType 52 Preferences::PropertyType
49 Preferences::getPropertyType(const PropertyName &name) const 53 Preferences::getPropertyType(const PropertyName &name) const
51 if (name == "Smooth Spectrogram") { 55 if (name == "Smooth Spectrogram") {
52 return ToggleProperty; 56 return ToggleProperty;
53 } 57 }
54 if (name == "Tuning Frequency") { 58 if (name == "Tuning Frequency") {
55 return RangeProperty; 59 return RangeProperty;
60 }
61 if (name == "Property Box Layout") {
62 return ValueProperty;
56 } 63 }
57 return InvalidProperty; 64 return InvalidProperty;
58 } 65 }
59 66
60 int 67 int
67 return m_smoothSpectrogram ? 1 : 0; 74 return m_smoothSpectrogram ? 1 : 0;
68 } 75 }
69 76
70 //!!! freq mapping 77 //!!! freq mapping
71 78
79 if (name == "Property Box Layout") {
80 if (min) *min = 0;
81 if (max) *max = 1;
82 return m_propertyBoxLayout == Layered ? 1 : 0;
83 }
84
72 return 0; 85 return 0;
73 } 86 }
74 87
75 QString 88 QString
76 Preferences::getPropertyValueLabel(const PropertyName &name, 89 Preferences::getPropertyValueLabel(const PropertyName &name,
77 int value) const 90 int value) const
78 { 91 {
79 //!!! 92 if (name == "Property Box Layout") {
93 if (value == 0) return tr("Vertically Stacked");
94 else return tr("Layered");
95 }
80 return ""; 96 return "";
81 } 97 }
82 98
83 QString 99 QString
84 Preferences::getPropertyContainerName() const 100 Preferences::getPropertyContainerName() const
97 { 113 {
98 if (name == "Smooth Spectrogram") { 114 if (name == "Smooth Spectrogram") {
99 setSmoothSpectrogram(value > 0.1); 115 setSmoothSpectrogram(value > 0.1);
100 } else if (name == "Tuning Frequency") { 116 } else if (name == "Tuning Frequency") {
101 //!!! 117 //!!!
118 } else if (name == "Property Box Layout") {
119 setPropertyBoxLayout(value == 0 ? VerticallyStacked : Layered);
102 } 120 }
103 } 121 }
104 122
105 void 123 void
106 Preferences::setSmoothSpectrogram(bool smooth) 124 Preferences::setSmoothSpectrogram(bool smooth)
107 { 125 {
108 m_smoothSpectrogram = smooth; 126 if (m_smoothSpectrogram != smooth) {
127 m_smoothSpectrogram = smooth;
109 //!!! emit 128 //!!! emit
129 }
110 } 130 }
111 131
112 void 132 void
113 Preferences::setTuningFrequency(float freq) 133 Preferences::setTuningFrequency(float freq)
114 { 134 {
115 m_tuningFrequency = freq; 135 if (m_tuningFrequency != freq) {
116 //!!! emit 136 m_tuningFrequency = freq;
137 //!!! emit
138 }
117 } 139 }
118 140
141 void
142 Preferences::setPropertyBoxLayout(PropertyBoxLayout layout)
143 {
144 if (m_propertyBoxLayout != layout) {
145 m_propertyBoxLayout = layout;
146 //!!! emit
147 }
148 }
149