Chris@136
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@136
|
2
|
Chris@136
|
3 /*
|
Chris@136
|
4 Sonic Visualiser
|
Chris@136
|
5 An audio file viewer and annotation editor.
|
Chris@136
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@202
|
7 This file copyright 2006 Chris Cannam and QMUL.
|
Chris@136
|
8
|
Chris@136
|
9 This program is free software; you can redistribute it and/or
|
Chris@136
|
10 modify it under the terms of the GNU General Public License as
|
Chris@136
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@136
|
12 License, or (at your option) any later version. See the file
|
Chris@136
|
13 COPYING included with this distribution for more information.
|
Chris@136
|
14 */
|
Chris@136
|
15
|
Chris@136
|
16 #ifndef _PREFERENCES_H_
|
Chris@136
|
17 #define _PREFERENCES_H_
|
Chris@136
|
18
|
Chris@136
|
19 #include "PropertyContainer.h"
|
Chris@136
|
20
|
Chris@140
|
21 #include "Window.h"
|
Chris@140
|
22
|
Chris@136
|
23 class Preferences : public PropertyContainer
|
Chris@136
|
24 {
|
Chris@136
|
25 Q_OBJECT
|
Chris@136
|
26
|
Chris@136
|
27 public:
|
Chris@156
|
28 static Preferences *getInstance();
|
Chris@136
|
29
|
Chris@136
|
30 virtual PropertyList getProperties() const;
|
Chris@136
|
31 virtual QString getPropertyLabel(const PropertyName &) const;
|
Chris@136
|
32 virtual PropertyType getPropertyType(const PropertyName &) const;
|
Chris@245
|
33 virtual int getPropertyRangeAndValue(const PropertyName &, int *, int *, int *) const;
|
Chris@136
|
34 virtual QString getPropertyValueLabel(const PropertyName &, int value) const;
|
Chris@136
|
35 virtual QString getPropertyContainerName() const;
|
Chris@136
|
36 virtual QString getPropertyContainerIconName() const;
|
Chris@136
|
37
|
Chris@246
|
38 enum SpectrogramSmoothing {
|
Chris@246
|
39 NoSpectrogramSmoothing,
|
Chris@246
|
40 SpectrogramInterpolated,
|
Chris@246
|
41 SpectrogramZeroPadded,
|
Chris@246
|
42 SpectrogramZeroPaddedAndInterpolated
|
Chris@246
|
43 };
|
Chris@246
|
44
|
Chris@553
|
45 enum SpectrogramXSmoothing {
|
Chris@553
|
46 NoSpectrogramXSmoothing,
|
Chris@553
|
47 SpectrogramXInterpolated
|
Chris@553
|
48 };
|
Chris@553
|
49
|
Chris@246
|
50 SpectrogramSmoothing getSpectrogramSmoothing() const { return m_spectrogramSmoothing; }
|
Chris@553
|
51 SpectrogramXSmoothing getSpectrogramXSmoothing() const { return m_spectrogramXSmoothing; }
|
Chris@136
|
52 float getTuningFrequency() const { return m_tuningFrequency; }
|
Chris@140
|
53 WindowType getWindowType() const { return m_windowType; }
|
Chris@164
|
54 int getResampleQuality() const { return m_resampleQuality; }
|
Chris@136
|
55
|
Chris@138
|
56 //!!! harmonise with PaneStack
|
Chris@138
|
57 enum PropertyBoxLayout {
|
Chris@138
|
58 VerticallyStacked,
|
Chris@138
|
59 Layered
|
Chris@138
|
60 };
|
Chris@138
|
61 PropertyBoxLayout getPropertyBoxLayout() const { return m_propertyBoxLayout; }
|
Chris@138
|
62
|
Chris@354
|
63 int getViewFontSize() const { return m_viewFontSize; }
|
Chris@354
|
64
|
Chris@277
|
65 bool getOmitTempsFromRecentFiles() const { return m_omitRecentTemps; }
|
Chris@277
|
66
|
Chris@297
|
67 QString getTemporaryDirectoryRoot() const { return m_tempDirRoot; }
|
Chris@297
|
68
|
Chris@297
|
69 bool getResampleOnLoad() const { return m_resampleOnLoad; }
|
Chris@297
|
70
|
Chris@297
|
71 enum BackgroundMode {
|
Chris@297
|
72 BackgroundFromTheme,
|
Chris@297
|
73 DarkBackground,
|
Chris@297
|
74 LightBackground
|
Chris@297
|
75 };
|
Chris@297
|
76 BackgroundMode getBackgroundMode() const { return m_backgroundMode; }
|
Chris@297
|
77
|
Chris@612
|
78 enum TimeToTextMode {
|
Chris@612
|
79 TimeToTextMs,
|
Chris@612
|
80 TimeToTextUs,
|
Chris@612
|
81 TimeToText24Frame,
|
Chris@612
|
82 TimeToText25Frame,
|
Chris@612
|
83 TimeToText30Frame,
|
Chris@612
|
84 TimeToText50Frame,
|
Chris@612
|
85 TimeToText60Frame
|
Chris@612
|
86 };
|
Chris@612
|
87 TimeToTextMode getTimeToTextMode() const { return m_timeToTextMode; }
|
Chris@612
|
88
|
Chris@892
|
89 int getOctaveOfMiddleC() const {
|
Chris@892
|
90 // weed out unsupported octaves
|
Chris@892
|
91 return getOctaveOfMiddleCInSystem(getSystemWithMiddleCInOctave(m_octave));
|
Chris@892
|
92 }
|
Chris@892
|
93 int getOctaveOfLowestMIDINote() const {
|
Chris@892
|
94 return getOctaveOfMiddleC() - 5;
|
Chris@892
|
95 }
|
Chris@892
|
96
|
Chris@372
|
97 bool getShowSplash() const { return m_showSplash; }
|
Chris@372
|
98
|
Chris@136
|
99 public slots:
|
Chris@136
|
100 virtual void setProperty(const PropertyName &, int);
|
Chris@136
|
101
|
Chris@246
|
102 void setSpectrogramSmoothing(SpectrogramSmoothing smoothing);
|
Chris@553
|
103 void setSpectrogramXSmoothing(SpectrogramXSmoothing smoothing);
|
Chris@136
|
104 void setTuningFrequency(float freq);
|
Chris@138
|
105 void setPropertyBoxLayout(PropertyBoxLayout layout);
|
Chris@140
|
106 void setWindowType(WindowType type);
|
Chris@164
|
107 void setResampleQuality(int quality);
|
Chris@277
|
108 void setOmitTempsFromRecentFiles(bool omit);
|
Chris@297
|
109 void setTemporaryDirectoryRoot(QString tempDirRoot);
|
Chris@297
|
110 void setResampleOnLoad(bool);
|
Chris@297
|
111 void setBackgroundMode(BackgroundMode mode);
|
Chris@612
|
112 void setTimeToTextMode(TimeToTextMode mode);
|
Chris@892
|
113 void setOctaveOfMiddleC(int oct);
|
Chris@354
|
114 void setViewFontSize(int size);
|
Chris@372
|
115 void setShowSplash(bool);
|
Chris@136
|
116
|
Chris@136
|
117 private:
|
Chris@145
|
118 Preferences(); // may throw DirectoryCreationFailed
|
Chris@145
|
119 virtual ~Preferences();
|
Chris@136
|
120
|
Chris@136
|
121 static Preferences *m_instance;
|
Chris@136
|
122
|
Chris@892
|
123 // We don't support arbitrary octaves in the gui, because we want
|
Chris@892
|
124 // to be able to label what the octave system comes from. These
|
Chris@892
|
125 // are the ones we support. (But we save and load as octave
|
Chris@892
|
126 // numbers, so as not to make the prefs format really confusing)
|
Chris@892
|
127 enum OctaveNumberingSystem {
|
Chris@892
|
128 C0_Centre,
|
Chris@892
|
129 C3_Logic,
|
Chris@892
|
130 C4_ASA,
|
Chris@892
|
131 C5_Sonar
|
Chris@892
|
132 };
|
Chris@892
|
133 static int getOctaveOfMiddleCInSystem(OctaveNumberingSystem s);
|
Chris@892
|
134 static OctaveNumberingSystem getSystemWithMiddleCInOctave(int o);
|
Chris@892
|
135
|
Chris@246
|
136 SpectrogramSmoothing m_spectrogramSmoothing;
|
Chris@553
|
137 SpectrogramXSmoothing m_spectrogramXSmoothing;
|
Chris@136
|
138 float m_tuningFrequency;
|
Chris@138
|
139 PropertyBoxLayout m_propertyBoxLayout;
|
Chris@140
|
140 WindowType m_windowType;
|
Chris@164
|
141 int m_resampleQuality;
|
Chris@277
|
142 bool m_omitRecentTemps;
|
Chris@297
|
143 QString m_tempDirRoot;
|
Chris@297
|
144 bool m_resampleOnLoad;
|
Chris@354
|
145 int m_viewFontSize;
|
Chris@297
|
146 BackgroundMode m_backgroundMode;
|
Chris@612
|
147 TimeToTextMode m_timeToTextMode;
|
Chris@892
|
148 int m_octave;
|
Chris@372
|
149 bool m_showSplash;
|
Chris@136
|
150 };
|
Chris@136
|
151
|
Chris@136
|
152 #endif
|