annotate base/Preferences.h @ 367:722bc705775a

* Ensure plugin version is updated when a transform is re-run using a newer plugin -- so that the plugin version saved in the session corresponds with the one that was actually used, not the one previously specified * Fix uninitialised font size in preferences -- was causing all sorts of grief
author Chris Cannam
date Mon, 28 Jan 2008 17:43:44 +0000
parents 048b21bc9891
children d31b4ccb7ddb
rev   line source
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@246 45 SpectrogramSmoothing getSpectrogramSmoothing() const { return m_spectrogramSmoothing; }
Chris@136 46 float getTuningFrequency() const { return m_tuningFrequency; }
Chris@140 47 WindowType getWindowType() const { return m_windowType; }
Chris@164 48 int getResampleQuality() const { return m_resampleQuality; }
Chris@136 49
Chris@138 50 //!!! harmonise with PaneStack
Chris@138 51 enum PropertyBoxLayout {
Chris@138 52 VerticallyStacked,
Chris@138 53 Layered
Chris@138 54 };
Chris@138 55 PropertyBoxLayout getPropertyBoxLayout() const { return m_propertyBoxLayout; }
Chris@138 56
Chris@354 57 int getViewFontSize() const { return m_viewFontSize; }
Chris@354 58
Chris@277 59 bool getOmitTempsFromRecentFiles() const { return m_omitRecentTemps; }
Chris@277 60
Chris@297 61 QString getTemporaryDirectoryRoot() const { return m_tempDirRoot; }
Chris@297 62
Chris@297 63 bool getResampleOnLoad() const { return m_resampleOnLoad; }
Chris@297 64
Chris@297 65 enum BackgroundMode {
Chris@297 66 BackgroundFromTheme,
Chris@297 67 DarkBackground,
Chris@297 68 LightBackground
Chris@297 69 };
Chris@297 70 BackgroundMode getBackgroundMode() const { return m_backgroundMode; }
Chris@297 71
Chris@136 72 public slots:
Chris@136 73 virtual void setProperty(const PropertyName &, int);
Chris@136 74
Chris@246 75 void setSpectrogramSmoothing(SpectrogramSmoothing smoothing);
Chris@136 76 void setTuningFrequency(float freq);
Chris@138 77 void setPropertyBoxLayout(PropertyBoxLayout layout);
Chris@140 78 void setWindowType(WindowType type);
Chris@164 79 void setResampleQuality(int quality);
Chris@277 80 void setOmitTempsFromRecentFiles(bool omit);
Chris@297 81 void setTemporaryDirectoryRoot(QString tempDirRoot);
Chris@297 82 void setResampleOnLoad(bool);
Chris@297 83 void setBackgroundMode(BackgroundMode mode);
Chris@354 84 void setViewFontSize(int size);
Chris@136 85
Chris@136 86 private:
Chris@145 87 Preferences(); // may throw DirectoryCreationFailed
Chris@145 88 virtual ~Preferences();
Chris@136 89
Chris@136 90 static Preferences *m_instance;
Chris@136 91
Chris@246 92 SpectrogramSmoothing m_spectrogramSmoothing;
Chris@136 93 float m_tuningFrequency;
Chris@138 94 PropertyBoxLayout m_propertyBoxLayout;
Chris@140 95 WindowType m_windowType;
Chris@164 96 int m_resampleQuality;
Chris@277 97 bool m_omitRecentTemps;
Chris@297 98 QString m_tempDirRoot;
Chris@297 99 bool m_resampleOnLoad;
Chris@354 100 int m_viewFontSize;
Chris@297 101 BackgroundMode m_backgroundMode;
Chris@136 102 };
Chris@136 103
Chris@136 104 #endif