svcore  1.9
Preferences Class Reference

#include <Preferences.h>

Inheritance diagram for Preferences:
Collaboration diagram for Preferences:

List of all members.

Public Types

enum  SpectrogramSmoothing { NoSpectrogramSmoothing, SpectrogramInterpolated, SpectrogramZeroPadded, SpectrogramZeroPaddedAndInterpolated }
enum  SpectrogramXSmoothing { NoSpectrogramXSmoothing, SpectrogramXInterpolated }
enum  PropertyBoxLayout { VerticallyStacked, Layered }
 !! harmonise with PaneStack More...
enum  BackgroundMode { BackgroundFromTheme, DarkBackground, LightBackground }
enum  TimeToTextMode {
  TimeToTextMs, TimeToTextUs, TimeToText24Frame, TimeToText25Frame,
  TimeToText30Frame, TimeToText50Frame, TimeToText60Frame
}
enum  PropertyType {
  ToggleProperty, RangeProperty, ValueProperty, ColourProperty,
  UnitsProperty, InvalidProperty
}
typedef QString PropertyName
typedef std::vector< PropertyNamePropertyList

Public Slots

virtual void setProperty (const PropertyName &, int)
 Set a property.
void setSpectrogramSmoothing (SpectrogramSmoothing smoothing)
void setSpectrogramXSmoothing (SpectrogramXSmoothing smoothing)
void setTuningFrequency (float freq)
void setPropertyBoxLayout (PropertyBoxLayout layout)
void setWindowType (WindowType type)
void setResampleQuality (int quality)
void setOmitTempsFromRecentFiles (bool omit)
void setTemporaryDirectoryRoot (QString tempDirRoot)
void setFixedSampleRate (int)
void setResampleOnLoad (bool)
void setNormaliseAudio (bool)
void setBackgroundMode (BackgroundMode mode)
void setTimeToTextMode (TimeToTextMode mode)
void setOctaveOfMiddleC (int oct)
void setViewFontSize (int size)
void setShowSplash (bool)
virtual CommandgetSetPropertyCommand (const PropertyName &, int value)
 Obtain a command that sets the given property, which can be added to the command history for undo/redo.
virtual CommandgetSetPropertyCommand (QString nameString, QString valueString)
 As above, but returning a command.
virtual void setPropertyFuzzy (QString nameString, QString valueString)
 Set a property using a fuzzy match.

Signals

void propertyChanged (PropertyContainer::PropertyName)

Public Member Functions

virtual PropertyList getProperties () const
 Get a list of the names of all the supported properties on this container.
virtual QString getPropertyLabel (const PropertyName &) const
 Return the human-readable (and i18n'ised) name of a property.
virtual PropertyType getPropertyType (const PropertyName &) const
 Return the type of the given property, or InvalidProperty if the property is not supported on this container.
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.
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 that property.
virtual QString getPropertyContainerName () const
virtual QString getPropertyContainerIconName () const
SpectrogramSmoothing getSpectrogramSmoothing () const
SpectrogramXSmoothing getSpectrogramXSmoothing () const
float getTuningFrequency () const
WindowType getWindowType () const
int getResampleQuality () const
PropertyBoxLayout getPropertyBoxLayout () const
int getViewFontSize () const
bool getOmitTempsFromRecentFiles () const
QString getTemporaryDirectoryRoot () const
int getFixedSampleRate () const
 If we should always resample audio to the same rate, return it; otherwise (the normal case) return 0.
bool getResampleOnLoad () const
 True if we should resample second or subsequent audio file to match first audio file's rate.
bool getNormaliseAudio () const
 True if audio files should be loaded with normalisation (max == 1)
BackgroundMode getBackgroundMode () const
TimeToTextMode getTimeToTextMode () const
int getOctaveOfMiddleC () const
int getOctaveOfLowestMIDINote () const
bool getShowSplash () const
virtual QString getPropertyIconName (const PropertyName &) const
 Return an icon for the property, if any.
virtual QString getPropertyGroupName (const PropertyName &) const
 If this property has something in common with other properties on this container, return a name that can be used to group them (in order to save screen space, for example).
virtual RangeMappergetNewPropertyRangeMapper (const PropertyName &) const
 If the given property is a RangeProperty, return a new RangeMapper object mapping its integer range onto an underlying floating point value range for human-intelligible display, if appropriate.
virtual PlayParametersgetPlayParameters ()

Static Public Member Functions

static PreferencesgetInstance ()

Protected Member Functions

virtual bool convertPropertyStrings (QString nameString, QString valueString, PropertyName &name, int &value)

Private Types

enum  OctaveNumberingSystem { C0_Centre, C3_Logic, C4_ASA, C5_Sonar }

Private Member Functions

 Preferences ()
virtual ~Preferences ()

Static Private Member Functions

static int getOctaveOfMiddleCInSystem (OctaveNumberingSystem s)
static OctaveNumberingSystem getSystemWithMiddleCInOctave (int o)

Private Attributes

SpectrogramSmoothing m_spectrogramSmoothing
SpectrogramXSmoothing m_spectrogramXSmoothing
float m_tuningFrequency
PropertyBoxLayout m_propertyBoxLayout
WindowType m_windowType
int m_resampleQuality
bool m_omitRecentTemps
QString m_tempDirRoot
int m_fixedSampleRate
bool m_resampleOnLoad
bool m_normaliseAudio
int m_viewFontSize
BackgroundMode m_backgroundMode
TimeToTextMode m_timeToTextMode
int m_octave
bool m_showSplash

Static Private Attributes

static Preferencesm_instance = 0

Detailed Description

Definition at line 23 of file Preferences.h.


Member Typedef Documentation

typedef QString PropertyContainer::PropertyName [inherited]

Definition at line 35 of file PropertyContainer.h.

typedef std::vector<PropertyName> PropertyContainer::PropertyList [inherited]

Definition at line 36 of file PropertyContainer.h.


Member Enumeration Documentation

Enumerator:
NoSpectrogramSmoothing 
SpectrogramInterpolated 
SpectrogramZeroPadded 
SpectrogramZeroPaddedAndInterpolated 

Definition at line 38 of file Preferences.h.

Enumerator:
NoSpectrogramXSmoothing 
SpectrogramXInterpolated 

Definition at line 45 of file Preferences.h.

!! harmonise with PaneStack

Enumerator:
VerticallyStacked 
Layered 

Definition at line 57 of file Preferences.h.

Enumerator:
BackgroundFromTheme 
DarkBackground 
LightBackground 

Definition at line 78 of file Preferences.h.

Enumerator:
TimeToTextMs 
TimeToTextUs 
TimeToText24Frame 
TimeToText25Frame 
TimeToText30Frame 
TimeToText50Frame 
TimeToText60Frame 

Definition at line 85 of file Preferences.h.

Enumerator:
C0_Centre 
C3_Logic 
C4_ASA 
C5_Sonar 

Definition at line 136 of file Preferences.h.

Enumerator:
ToggleProperty 
RangeProperty 
ValueProperty 
ColourProperty 
UnitsProperty 
InvalidProperty 

Definition at line 38 of file PropertyContainer.h.


Constructor & Destructor Documentation

Preferences::~Preferences ( ) [private, virtual]

Definition at line 84 of file Preferences.cpp.


Member Function Documentation

Get a list of the names of all the supported properties on this container.

These should be fixed (i.e. not internationalized).

Reimplemented from PropertyContainer.

Definition at line 89 of file Preferences.cpp.

QString Preferences::getPropertyLabel ( const PropertyName ) const [virtual]

Return the human-readable (and i18n'ised) name of a property.

Implements PropertyContainer.

Definition at line 112 of file Preferences.cpp.

Return the type of the given property, or InvalidProperty if the property is not supported on this container.

Reimplemented from PropertyContainer.

Definition at line 166 of file Preferences.cpp.

References PropertyContainer::InvalidProperty, PropertyContainer::RangeProperty, PropertyContainer::ToggleProperty, and PropertyContainer::ValueProperty.

int Preferences::getPropertyRangeAndValue ( const PropertyName ,
int *  min,
int *  max,
int *  deflt 
) const [virtual]

Return the minimum and maximum values for the given property and its current value in this container.

Min and/or max may be passed as NULL if their values are not required.

!! freq mapping

Reimplemented from PropertyContainer.

Definition at line 221 of file Preferences.cpp.

References BlackmanHarrisWindow, getSystemWithMiddleCInOctave(), HanningWindow, Layered, m_backgroundMode, m_octave, m_propertyBoxLayout, m_resampleQuality, m_spectrogramSmoothing, m_spectrogramXSmoothing, m_timeToTextMode, m_viewFontSize, m_windowType, RectangularWindow, SpectrogramInterpolated, and SpectrogramXInterpolated.

QString Preferences::getPropertyContainerName ( ) const [virtual]

Implements PropertyContainer.

Definition at line 375 of file Preferences.cpp.

QString Preferences::getPropertyContainerIconName ( ) const [virtual]

Implements PropertyContainer.

Definition at line 381 of file Preferences.cpp.

Definition at line 50 of file Preferences.h.

References m_spectrogramSmoothing.

Definition at line 51 of file Preferences.h.

References m_spectrogramXSmoothing.

Definition at line 53 of file Preferences.h.

References m_windowType.

int Preferences::getResampleQuality ( ) const [inline]

Definition at line 54 of file Preferences.h.

References m_resampleQuality.

Definition at line 61 of file Preferences.h.

References m_propertyBoxLayout.

int Preferences::getViewFontSize ( ) const [inline]

Definition at line 63 of file Preferences.h.

References m_viewFontSize.

Definition at line 65 of file Preferences.h.

References m_omitRecentTemps.

Referenced by RecentFiles::addFile().

QString Preferences::getTemporaryDirectoryRoot ( ) const [inline]

Definition at line 67 of file Preferences.h.

References m_tempDirRoot.

int Preferences::getFixedSampleRate ( ) const [inline]

If we should always resample audio to the same rate, return it; otherwise (the normal case) return 0.

Definition at line 70 of file Preferences.h.

References m_fixedSampleRate.

bool Preferences::getResampleOnLoad ( ) const [inline]

True if we should resample second or subsequent audio file to match first audio file's rate.

Definition at line 73 of file Preferences.h.

References m_resampleOnLoad.

bool Preferences::getNormaliseAudio ( ) const [inline]

True if audio files should be loaded with normalisation (max == 1)

Definition at line 76 of file Preferences.h.

References m_normaliseAudio.

Referenced by WaveFileModel::WaveFileModel().

Definition at line 83 of file Preferences.h.

References m_backgroundMode.

Definition at line 94 of file Preferences.h.

References m_timeToTextMode.

Referenced by RealTime::toText().

Definition at line 100 of file Preferences.h.

References getOctaveOfMiddleC().

Referenced by Pitch::getPitchLabel().

bool Preferences::getShowSplash ( ) const [inline]

Definition at line 104 of file Preferences.h.

References m_showSplash.

void Preferences::setProperty ( const PropertyName name,
int  value 
) [virtual, slot]

Set a property.

This is used for all property types. For boolean properties, zero is false and non-zero true; for colours, the integer value is an index into the colours in the global ColourDatabase.

!!

Reimplemented from PropertyContainer.

Definition at line 387 of file Preferences.cpp.

References getOctaveOfMiddleCInSystem(), Layered, setBackgroundMode(), setOctaveOfMiddleC(), setOmitTempsFromRecentFiles(), setPropertyBoxLayout(), setResampleQuality(), setShowSplash(), setSpectrogramSmoothing(), setSpectrogramXSmoothing(), setTimeToTextMode(), setViewFontSize(), setWindowType(), and VerticallyStacked.

void Preferences::setTuningFrequency ( float  freq) [slot]

Definition at line 452 of file Preferences.cpp.

References m_tuningFrequency, and PropertyContainer::propertyChanged().

Definition at line 465 of file Preferences.cpp.

References m_propertyBoxLayout, and PropertyContainer::propertyChanged().

Referenced by setProperty().

void Preferences::setWindowType ( WindowType  type) [slot]

Definition at line 478 of file Preferences.cpp.

References m_windowType, and PropertyContainer::propertyChanged().

Referenced by setProperty().

void Preferences::setResampleQuality ( int  quality) [slot]

Definition at line 491 of file Preferences.cpp.

References m_resampleQuality, and PropertyContainer::propertyChanged().

Referenced by setProperty().

void Preferences::setOmitTempsFromRecentFiles ( bool  omit) [slot]

Definition at line 504 of file Preferences.cpp.

References m_omitRecentTemps, and PropertyContainer::propertyChanged().

Referenced by setProperty().

void Preferences::setTemporaryDirectoryRoot ( QString  tempDirRoot) [slot]

Definition at line 517 of file Preferences.cpp.

References m_tempDirRoot, and PropertyContainer::propertyChanged().

void Preferences::setFixedSampleRate ( int  rate) [slot]

Definition at line 546 of file Preferences.cpp.

References m_fixedSampleRate, and PropertyContainer::propertyChanged().

void Preferences::setResampleOnLoad ( bool  resample) [slot]

Definition at line 533 of file Preferences.cpp.

References m_resampleOnLoad, and PropertyContainer::propertyChanged().

void Preferences::setNormaliseAudio ( bool  norm) [slot]

Definition at line 559 of file Preferences.cpp.

References m_normaliseAudio, and PropertyContainer::propertyChanged().

Definition at line 572 of file Preferences.cpp.

References m_backgroundMode, and PropertyContainer::propertyChanged().

Referenced by setProperty().

Definition at line 587 of file Preferences.cpp.

References m_timeToTextMode, and PropertyContainer::propertyChanged().

Referenced by setProperty().

void Preferences::setOctaveOfMiddleC ( int  oct) [slot]

Definition at line 602 of file Preferences.cpp.

References m_octave, and PropertyContainer::propertyChanged().

Referenced by setProperty().

void Preferences::setViewFontSize ( int  size) [slot]

Definition at line 641 of file Preferences.cpp.

References m_viewFontSize, and PropertyContainer::propertyChanged().

Referenced by setProperty().

void Preferences::setShowSplash ( bool  show) [slot]

Definition at line 656 of file Preferences.cpp.

References m_showSplash, and PropertyContainer::propertyChanged().

Referenced by setProperty().

Definition at line 617 of file Preferences.cpp.

References C0_Centre, C3_Logic, C4_ASA, and C5_Sonar.

Referenced by getOctaveOfMiddleC(), and setProperty().

QString PropertyContainer::getPropertyIconName ( const PropertyName ) const [virtual, inherited]

Return an icon for the property, if any.

Definition at line 35 of file PropertyContainer.cpp.

QString PropertyContainer::getPropertyGroupName ( const PropertyName ) const [virtual, inherited]

If this property has something in common with other properties on this container, return a name that can be used to group them (in order to save screen space, for example).

e.g. "Window Type" and "Window Size" might both have a group name of "Window". If this property is not groupable, return the empty string.

Definition at line 41 of file PropertyContainer.cpp.

RangeMapper * PropertyContainer::getNewPropertyRangeMapper ( const PropertyName ) const [virtual, inherited]

If the given property is a RangeProperty, return a new RangeMapper object mapping its integer range onto an underlying floating point value range for human-intelligible display, if appropriate.

The RangeMapper should be allocated with new, and the caller takes responsibility for deleting it. Return NULL (as in the default implementation) if there is no such mapping.

Definition at line 63 of file PropertyContainer.cpp.

Referenced by PropertyContainer::convertPropertyStrings().

virtual PlayParameters* PropertyContainer::getPlayParameters ( ) [inline, virtual, inherited]

Definition at line 106 of file PropertyContainer.h.

Command * PropertyContainer::getSetPropertyCommand ( const PropertyName name,
int  value 
) [virtual, slot, inherited]

Obtain a command that sets the given property, which can be added to the command history for undo/redo.

Returns NULL if the property is already set to the given value.

Definition at line 75 of file PropertyContainer.cpp.

References PropertyContainer::getPropertyRangeAndValue().

Referenced by PropertyContainer::getSetPropertyCommand().

Command * PropertyContainer::getSetPropertyCommand ( QString  nameString,
QString  valueString 
) [virtual, slot, inherited]

As above, but returning a command.

Definition at line 98 of file PropertyContainer.cpp.

References PropertyContainer::convertPropertyStrings(), and PropertyContainer::getSetPropertyCommand().

void PropertyContainer::setPropertyFuzzy ( QString  nameString,
QString  valueString 
) [virtual, slot, inherited]

Set a property using a fuzzy match.

Compare nameString with the property labels and underlying names, and if it matches one (with preference given to labels), try to convert valueString appropriately and set it. The valueString should contain a value label for value properties, a mapped value for range properties, "on" or "off" for toggle properties, a colour or unit name, or the underlying integer value for the property.

Note that as property and value labels may be translatable, the results of this function may vary by locale. It is intended for handling user-originated strings, _not_ persistent storage.

The default implementation should work for most subclasses.

Definition at line 83 of file PropertyContainer.cpp.

References PropertyContainer::convertPropertyStrings(), and PropertyContainer::setProperty().


Member Data Documentation

Preferences * Preferences::m_instance = 0 [static, private]

Definition at line 130 of file Preferences.h.

Referenced by getInstance().

Definition at line 147 of file Preferences.h.

Referenced by getTuningFrequency(), Preferences(), and setTuningFrequency().

QString Preferences::m_tempDirRoot [private]

Definition at line 153 of file Preferences.h.

Referenced by getFixedSampleRate(), Preferences(), and setFixedSampleRate().

Definition at line 154 of file Preferences.h.

Referenced by getResampleOnLoad(), Preferences(), and setResampleOnLoad().

Definition at line 155 of file Preferences.h.

Referenced by getNormaliseAudio(), Preferences(), and setNormaliseAudio().

bool Preferences::m_showSplash [private]

Definition at line 160 of file Preferences.h.

Referenced by getShowSplash(), Preferences(), and setShowSplash().


The documentation for this class was generated from the following files: