svcore  1.9
Preferences.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam and QMUL.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef _PREFERENCES_H_
17 #define _PREFERENCES_H_
18 
19 #include "PropertyContainer.h"
20 
21 #include "Window.h"
22 
24 {
25  Q_OBJECT
26 
27 public:
28  static Preferences *getInstance();
29 
30  virtual PropertyList getProperties() const;
31  virtual QString getPropertyLabel(const PropertyName &) const;
32  virtual PropertyType getPropertyType(const PropertyName &) const;
33  virtual int getPropertyRangeAndValue(const PropertyName &, int *, int *, int *) const;
34  virtual QString getPropertyValueLabel(const PropertyName &, int value) const;
35  virtual QString getPropertyContainerName() const;
36  virtual QString getPropertyContainerIconName() const;
37 
43  };
44 
48  };
49 
52  float getTuningFrequency() const { return m_tuningFrequency; }
54  int getResampleQuality() const { return m_resampleQuality; }
55 
60  };
62 
63  int getViewFontSize() const { return m_viewFontSize; }
64 
66 
67  QString getTemporaryDirectoryRoot() const { return m_tempDirRoot; }
68 
70  int getFixedSampleRate() const { return m_fixedSampleRate; }
71 
73  bool getResampleOnLoad() const { return m_resampleOnLoad; }
74 
76  bool getNormaliseAudio() const { return m_normaliseAudio; }
77 
82  };
84 
93  };
95 
96  int getOctaveOfMiddleC() const {
97  // weed out unsupported octaves
99  }
101  return getOctaveOfMiddleC() - 5;
102  }
103 
104  bool getShowSplash() const { return m_showSplash; }
105 
106 public slots:
107  virtual void setProperty(const PropertyName &, int);
108 
111  void setTuningFrequency(float freq);
113  void setWindowType(WindowType type);
114  void setResampleQuality(int quality);
115  void setOmitTempsFromRecentFiles(bool omit);
116  void setTemporaryDirectoryRoot(QString tempDirRoot);
117  void setFixedSampleRate(int);
118  void setResampleOnLoad(bool);
119  void setNormaliseAudio(bool);
122  void setOctaveOfMiddleC(int oct);
123  void setViewFontSize(int size);
124  void setShowSplash(bool);
125 
126 private:
127  Preferences(); // may throw DirectoryCreationFailed
128  virtual ~Preferences();
129 
131 
132  // We don't support arbitrary octaves in the gui, because we want
133  // to be able to label what the octave system comes from. These
134  // are the ones we support. (But we save and load as octave
135  // numbers, so as not to make the prefs format really confusing)
141  };
144 
152  QString m_tempDirRoot;
159  int m_octave;
161 };
162 
163 #endif
int m_viewFontSize
Definition: Preferences.h:156
float getTuningFrequency() const
Definition: Preferences.h:52
void setOctaveOfMiddleC(int oct)
virtual PropertyList getProperties() const
Get a list of the names of all the supported properties on this container.
Definition: Preferences.cpp:89
void setResampleOnLoad(bool)
int getOctaveOfMiddleC() const
Definition: Preferences.h:96
SpectrogramSmoothing m_spectrogramSmoothing
Definition: Preferences.h:145
virtual ~Preferences()
Definition: Preferences.cpp:84
PropertyBoxLayout getPropertyBoxLayout() const
Definition: Preferences.h:61
TimeToTextMode getTimeToTextMode() const
Definition: Preferences.h:94
virtual QString getPropertyLabel(const PropertyName &) const
Return the human-readable (and i18n'ised) name of a property.
PropertyBoxLayout m_propertyBoxLayout
Definition: Preferences.h:148
bool m_resampleOnLoad
Definition: Preferences.h:154
WindowType getWindowType() const
Definition: Preferences.h:53
void setSpectrogramXSmoothing(SpectrogramXSmoothing smoothing)
bool m_showSplash
Definition: Preferences.h:160
static Preferences * getInstance()
Definition: Preferences.cpp:31
void setShowSplash(bool)
bool m_omitRecentTemps
Definition: Preferences.h:151
bool getOmitTempsFromRecentFiles() const
Definition: Preferences.h:65
WindowType
Definition: Window.h:27
void setTimeToTextMode(TimeToTextMode mode)
void setNormaliseAudio(bool)
void setWindowType(WindowType type)
SpectrogramXSmoothing m_spectrogramXSmoothing
Definition: Preferences.h:146
static int getOctaveOfMiddleCInSystem(OctaveNumberingSystem s)
virtual PropertyType getPropertyType(const PropertyName &) const
Return the type of the given property, or InvalidProperty if the property is not supported on this co...
void setSpectrogramSmoothing(SpectrogramSmoothing smoothing)
WindowType m_windowType
Definition: Preferences.h:149
void setOmitTempsFromRecentFiles(bool omit)
virtual QString getPropertyValueLabel(const PropertyName &, int value) const
If the given property is a ValueProperty, return the display label to be used for the given value for...
BackgroundMode m_backgroundMode
Definition: Preferences.h:157
bool getResampleOnLoad() const
True if we should resample second or subsequent audio file to match first audio file's rate.
Definition: Preferences.h:73
PropertyBoxLayout
!! harmonise with PaneStack
Definition: Preferences.h:57
static Preferences * m_instance
Definition: Preferences.h:130
void setPropertyBoxLayout(PropertyBoxLayout layout)
void setTemporaryDirectoryRoot(QString tempDirRoot)
static OctaveNumberingSystem getSystemWithMiddleCInOctave(int o)
SpectrogramXSmoothing getSpectrogramXSmoothing() const
Definition: Preferences.h:51
SpectrogramSmoothing getSpectrogramSmoothing() const
Definition: Preferences.h:50
int getFixedSampleRate() const
If we should always resample audio to the same rate, return it; otherwise (the normal case) return 0.
Definition: Preferences.h:70
virtual QString getPropertyContainerName() const
virtual void setProperty(const PropertyName &, int)
void setViewFontSize(int size)
bool m_normaliseAudio
Definition: Preferences.h:155
float m_tuningFrequency
Definition: Preferences.h:147
virtual int getPropertyRangeAndValue(const PropertyName &, int *, int *, int *) const
Return the minimum and maximum values for the given property and its current value in this container.
int m_fixedSampleRate
Definition: Preferences.h:153
void setFixedSampleRate(int)
int m_resampleQuality
Definition: Preferences.h:150
std::vector< PropertyName > PropertyList
TimeToTextMode m_timeToTextMode
Definition: Preferences.h:158
int getResampleQuality() const
Definition: Preferences.h:54
QString m_tempDirRoot
Definition: Preferences.h:152
virtual QString getPropertyContainerIconName() const
bool getNormaliseAudio() const
True if audio files should be loaded with normalisation (max == 1)
Definition: Preferences.h:76
void setTuningFrequency(float freq)
void setBackgroundMode(BackgroundMode mode)
int getViewFontSize() const
Definition: Preferences.h:63
int getOctaveOfLowestMIDINote() const
Definition: Preferences.h:100
QString getTemporaryDirectoryRoot() const
Definition: Preferences.h:67
BackgroundMode getBackgroundMode() const
Definition: Preferences.h:83
bool getShowSplash() const
Definition: Preferences.h:104
void setResampleQuality(int quality)