svcore  1.9
Preferences Class Reference

#include <Preferences.h>

Inheritance diagram for Preferences:
Collaboration diagram for Preferences:

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)
 
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. More...
 
virtual CommandgetSetPropertyCommand (QString nameString, QString valueString)
 As above, but returning a command. More...
 
virtual void setPropertyFuzzy (QString nameString, QString valueString)
 Set a property using a fuzzy match. More...
 

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. More...
 
virtual QString getPropertyLabel (const PropertyName &) const
 Return the human-readable (and i18n'ised) name of a property. More...
 
virtual PropertyType getPropertyType (const PropertyName &) const
 Return the type of the given property, or InvalidProperty if the property is not supported on this container. More...
 
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. More...
 
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. More...
 
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. More...
 
bool getResampleOnLoad () const
 True if we should resample second or subsequent audio file to match first audio file's rate. More...
 
bool getNormaliseAudio () const
 True if audio files should be loaded with normalisation (max == 1) More...
 
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. More...
 
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). More...
 
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. More...
 
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

◆ PropertyName

typedef QString PropertyContainer::PropertyName
inherited

Definition at line 35 of file PropertyContainer.h.

◆ PropertyList

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

Definition at line 36 of file PropertyContainer.h.

Member Enumeration Documentation

◆ SpectrogramSmoothing

Enumerator
NoSpectrogramSmoothing 
SpectrogramInterpolated 
SpectrogramZeroPadded 
SpectrogramZeroPaddedAndInterpolated 

Definition at line 38 of file Preferences.h.

◆ SpectrogramXSmoothing

Enumerator
NoSpectrogramXSmoothing 
SpectrogramXInterpolated 

Definition at line 45 of file Preferences.h.

◆ PropertyBoxLayout

!! harmonise with PaneStack

Enumerator
VerticallyStacked 
Layered 

Definition at line 57 of file Preferences.h.

◆ BackgroundMode

Enumerator
BackgroundFromTheme 
DarkBackground 
LightBackground 

Definition at line 78 of file Preferences.h.

◆ TimeToTextMode

Enumerator
TimeToTextMs 
TimeToTextUs 
TimeToText24Frame 
TimeToText25Frame 
TimeToText30Frame 
TimeToText50Frame 
TimeToText60Frame 

Definition at line 85 of file Preferences.h.

◆ OctaveNumberingSystem

Enumerator
C0_Centre 
C3_Logic 
C4_ASA 
C5_Sonar 

Definition at line 136 of file Preferences.h.

◆ PropertyType

Enumerator
ToggleProperty 
RangeProperty 
ValueProperty 
ColourProperty 
UnitsProperty 
InvalidProperty 

Definition at line 38 of file PropertyContainer.h.

Constructor & Destructor Documentation

◆ Preferences()

◆ ~Preferences()

Preferences::~Preferences ( )
privatevirtual

Definition at line 84 of file Preferences.cpp.

Member Function Documentation

◆ getInstance()

◆ getProperties()

Preferences::PropertyList Preferences::getProperties ( ) const
virtual

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.

◆ getPropertyLabel()

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.

◆ getPropertyType()

Preferences::PropertyType Preferences::getPropertyType ( const PropertyName ) const
virtual

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.

◆ getPropertyRangeAndValue()

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.

◆ getPropertyValueLabel()

◆ getPropertyContainerName()

QString Preferences::getPropertyContainerName ( ) const
virtual

Implements PropertyContainer.

Definition at line 375 of file Preferences.cpp.

◆ getPropertyContainerIconName()

QString Preferences::getPropertyContainerIconName ( ) const
virtual

Implements PropertyContainer.

Definition at line 381 of file Preferences.cpp.

◆ getSpectrogramSmoothing()

SpectrogramSmoothing Preferences::getSpectrogramSmoothing ( ) const
inline

Definition at line 50 of file Preferences.h.

References m_spectrogramSmoothing.

◆ getSpectrogramXSmoothing()

SpectrogramXSmoothing Preferences::getSpectrogramXSmoothing ( ) const
inline

Definition at line 51 of file Preferences.h.

References m_spectrogramXSmoothing.

◆ getTuningFrequency()

◆ getWindowType()

WindowType Preferences::getWindowType ( ) const
inline

Definition at line 53 of file Preferences.h.

References m_windowType.

◆ getResampleQuality()

int Preferences::getResampleQuality ( ) const
inline

Definition at line 54 of file Preferences.h.

References m_resampleQuality.

◆ getPropertyBoxLayout()

PropertyBoxLayout Preferences::getPropertyBoxLayout ( ) const
inline

Definition at line 61 of file Preferences.h.

References m_propertyBoxLayout.

◆ getViewFontSize()

int Preferences::getViewFontSize ( ) const
inline

Definition at line 63 of file Preferences.h.

References m_viewFontSize.

◆ getOmitTempsFromRecentFiles()

bool Preferences::getOmitTempsFromRecentFiles ( ) const
inline

Definition at line 65 of file Preferences.h.

References m_omitRecentTemps.

Referenced by RecentFiles::addFile().

◆ getTemporaryDirectoryRoot()

QString Preferences::getTemporaryDirectoryRoot ( ) const
inline

Definition at line 67 of file Preferences.h.

References m_tempDirRoot.

◆ getFixedSampleRate()

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.

◆ getResampleOnLoad()

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.

◆ getNormaliseAudio()

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().

◆ getBackgroundMode()

BackgroundMode Preferences::getBackgroundMode ( ) const
inline

Definition at line 83 of file Preferences.h.

References m_backgroundMode.

◆ getTimeToTextMode()

TimeToTextMode Preferences::getTimeToTextMode ( ) const
inline

Definition at line 94 of file Preferences.h.

References m_timeToTextMode.

Referenced by RealTime::toText().

◆ getOctaveOfMiddleC()

int Preferences::getOctaveOfMiddleC ( ) const
inline

◆ getOctaveOfLowestMIDINote()

int Preferences::getOctaveOfLowestMIDINote ( ) const
inline

Definition at line 100 of file Preferences.h.

References getOctaveOfMiddleC().

Referenced by Pitch::getPitchLabel().

◆ getShowSplash()

bool Preferences::getShowSplash ( ) const
inline

Definition at line 104 of file Preferences.h.

References m_showSplash.

◆ setProperty

◆ setSpectrogramSmoothing

void Preferences::setSpectrogramSmoothing ( SpectrogramSmoothing  smoothing)
slot

Definition at line 418 of file Preferences.cpp.

References m_spectrogramSmoothing, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setSpectrogramXSmoothing

void Preferences::setSpectrogramXSmoothing ( SpectrogramXSmoothing  smoothing)
slot

Definition at line 435 of file Preferences.cpp.

References m_spectrogramXSmoothing, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setTuningFrequency

void Preferences::setTuningFrequency ( float  freq)
slot

Definition at line 452 of file Preferences.cpp.

References m_tuningFrequency, and PropertyContainer::propertyChanged().

◆ setPropertyBoxLayout

void Preferences::setPropertyBoxLayout ( PropertyBoxLayout  layout)
slot

Definition at line 465 of file Preferences.cpp.

References m_propertyBoxLayout, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setWindowType

void Preferences::setWindowType ( WindowType  type)
slot

Definition at line 478 of file Preferences.cpp.

References m_windowType, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setResampleQuality

void Preferences::setResampleQuality ( int  quality)
slot

Definition at line 491 of file Preferences.cpp.

References m_resampleQuality, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setOmitTempsFromRecentFiles

void Preferences::setOmitTempsFromRecentFiles ( bool  omit)
slot

Definition at line 504 of file Preferences.cpp.

References m_omitRecentTemps, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setTemporaryDirectoryRoot

void Preferences::setTemporaryDirectoryRoot ( QString  tempDirRoot)
slot

Definition at line 517 of file Preferences.cpp.

References m_tempDirRoot, and PropertyContainer::propertyChanged().

◆ setFixedSampleRate

void Preferences::setFixedSampleRate ( int  rate)
slot

Definition at line 546 of file Preferences.cpp.

References m_fixedSampleRate, and PropertyContainer::propertyChanged().

◆ setResampleOnLoad

void Preferences::setResampleOnLoad ( bool  resample)
slot

Definition at line 533 of file Preferences.cpp.

References m_resampleOnLoad, and PropertyContainer::propertyChanged().

◆ setNormaliseAudio

void Preferences::setNormaliseAudio ( bool  norm)
slot

Definition at line 559 of file Preferences.cpp.

References m_normaliseAudio, and PropertyContainer::propertyChanged().

◆ setBackgroundMode

void Preferences::setBackgroundMode ( BackgroundMode  mode)
slot

Definition at line 572 of file Preferences.cpp.

References m_backgroundMode, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setTimeToTextMode

void Preferences::setTimeToTextMode ( TimeToTextMode  mode)
slot

Definition at line 587 of file Preferences.cpp.

References m_timeToTextMode, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setOctaveOfMiddleC

void Preferences::setOctaveOfMiddleC ( int  oct)
slot

Definition at line 602 of file Preferences.cpp.

References m_octave, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setViewFontSize

void Preferences::setViewFontSize ( int  size)
slot

Definition at line 641 of file Preferences.cpp.

References m_viewFontSize, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ setShowSplash

void Preferences::setShowSplash ( bool  show)
slot

Definition at line 656 of file Preferences.cpp.

References m_showSplash, and PropertyContainer::propertyChanged().

Referenced by setProperty().

◆ getOctaveOfMiddleCInSystem()

int Preferences::getOctaveOfMiddleCInSystem ( OctaveNumberingSystem  s)
staticprivate

Definition at line 617 of file Preferences.cpp.

References C0_Centre, C3_Logic, C4_ASA, and C5_Sonar.

Referenced by getOctaveOfMiddleC(), and setProperty().

◆ getSystemWithMiddleCInOctave()

Preferences::OctaveNumberingSystem Preferences::getSystemWithMiddleCInOctave ( int  o)
staticprivate

Definition at line 629 of file Preferences.cpp.

References C0_Centre, C3_Logic, C4_ASA, and C5_Sonar.

Referenced by getOctaveOfMiddleC(), and getPropertyRangeAndValue().

◆ getPropertyIconName()

QString PropertyContainer::getPropertyIconName ( const PropertyName ) const
virtualinherited

Return an icon for the property, if any.

Definition at line 35 of file PropertyContainer.cpp.

◆ getPropertyGroupName()

QString PropertyContainer::getPropertyGroupName ( const PropertyName ) const
virtualinherited

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.

◆ getNewPropertyRangeMapper()

RangeMapper * PropertyContainer::getNewPropertyRangeMapper ( const PropertyName ) const
virtualinherited

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().

◆ getPlayParameters()

virtual PlayParameters* PropertyContainer::getPlayParameters ( )
inlinevirtualinherited

Definition at line 106 of file PropertyContainer.h.

◆ propertyChanged

◆ getSetPropertyCommand [1/2]

Command * PropertyContainer::getSetPropertyCommand ( const PropertyName name,
int  value 
)
virtualslotinherited

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().

◆ getSetPropertyCommand [2/2]

Command * PropertyContainer::getSetPropertyCommand ( QString  nameString,
QString  valueString 
)
virtualslotinherited

As above, but returning a command.

Definition at line 98 of file PropertyContainer.cpp.

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

◆ setPropertyFuzzy

void PropertyContainer::setPropertyFuzzy ( QString  nameString,
QString  valueString 
)
virtualslotinherited

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().

◆ convertPropertyStrings()

Member Data Documentation

◆ m_instance

Preferences * Preferences::m_instance = 0
staticprivate

Definition at line 130 of file Preferences.h.

Referenced by getInstance().

◆ m_spectrogramSmoothing

SpectrogramSmoothing Preferences::m_spectrogramSmoothing
private

◆ m_spectrogramXSmoothing

SpectrogramXSmoothing Preferences::m_spectrogramXSmoothing
private

◆ m_tuningFrequency

float Preferences::m_tuningFrequency
private

Definition at line 147 of file Preferences.h.

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

◆ m_propertyBoxLayout

PropertyBoxLayout Preferences::m_propertyBoxLayout
private

◆ m_windowType

WindowType Preferences::m_windowType
private

Definition at line 149 of file Preferences.h.

Referenced by getPropertyRangeAndValue(), getWindowType(), Preferences(), and setWindowType().

◆ m_resampleQuality

int Preferences::m_resampleQuality
private

◆ m_omitRecentTemps

bool Preferences::m_omitRecentTemps
private

Definition at line 151 of file Preferences.h.

Referenced by getOmitTempsFromRecentFiles(), and setOmitTempsFromRecentFiles().

◆ m_tempDirRoot

QString Preferences::m_tempDirRoot
private

◆ m_fixedSampleRate

int Preferences::m_fixedSampleRate
private

Definition at line 153 of file Preferences.h.

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

◆ m_resampleOnLoad

bool Preferences::m_resampleOnLoad
private

Definition at line 154 of file Preferences.h.

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

◆ m_normaliseAudio

bool Preferences::m_normaliseAudio
private

Definition at line 155 of file Preferences.h.

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

◆ m_viewFontSize

int Preferences::m_viewFontSize
private

◆ m_backgroundMode

BackgroundMode Preferences::m_backgroundMode
private

◆ m_timeToTextMode

TimeToTextMode Preferences::m_timeToTextMode
private

◆ m_octave

int Preferences::m_octave
private

◆ m_showSplash

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: