annotate base/Preferences.h @ 145:82f529a08cf3

* Change preferences dialog to ok/apply/cancel model * Make preferences persist in a config file * Change instance() to getInstance() for all singleton types * Make pasting to time-value layer with no values in clipboard ask you how to generate the values * Fix bad behaviour caused by importing "data"-type (i.e. 3d dense) model from annotation file without a fixed window size available
author Chris Cannam
date Thu, 27 Jul 2006 16:06:32 +0000
parents a35098a9c814
children 059b0322009c
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@136 7 This file copyright 2006 Chris Cannam.
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@145 23 class ConfigFile;
Chris@145 24
Chris@136 25 class Preferences : public PropertyContainer
Chris@136 26 {
Chris@136 27 Q_OBJECT
Chris@136 28
Chris@136 29 public:
Chris@136 30 static Preferences *getInstance() { return m_instance; }
Chris@136 31
Chris@136 32 virtual PropertyList getProperties() const;
Chris@136 33 virtual QString getPropertyLabel(const PropertyName &) const;
Chris@136 34 virtual PropertyType getPropertyType(const PropertyName &) const;
Chris@136 35 virtual int getPropertyRangeAndValue(const PropertyName &, int *, int *) const;
Chris@136 36 virtual QString getPropertyValueLabel(const PropertyName &, int value) const;
Chris@136 37 virtual QString getPropertyContainerName() const;
Chris@136 38 virtual QString getPropertyContainerIconName() const;
Chris@136 39
Chris@136 40 bool getSmoothSpectrogram() const { return m_smoothSpectrogram; }
Chris@136 41 float getTuningFrequency() const { return m_tuningFrequency; }
Chris@140 42 WindowType getWindowType() const { return m_windowType; }
Chris@136 43
Chris@145 44 ConfigFile *getConfigFile() { return m_configFile; }
Chris@145 45
Chris@138 46 //!!! harmonise with PaneStack
Chris@138 47 enum PropertyBoxLayout {
Chris@138 48 VerticallyStacked,
Chris@138 49 Layered
Chris@138 50 };
Chris@138 51 PropertyBoxLayout getPropertyBoxLayout() const { return m_propertyBoxLayout; }
Chris@138 52
Chris@136 53 public slots:
Chris@136 54 virtual void setProperty(const PropertyName &, int);
Chris@136 55
Chris@136 56 void setSmoothSpectrogram(bool smooth);
Chris@136 57 void setTuningFrequency(float freq);
Chris@138 58 void setPropertyBoxLayout(PropertyBoxLayout layout);
Chris@140 59 void setWindowType(WindowType type);
Chris@136 60
Chris@136 61 private:
Chris@145 62 Preferences(); // may throw DirectoryCreationFailed
Chris@145 63 virtual ~Preferences();
Chris@136 64
Chris@136 65 static Preferences *m_instance;
Chris@136 66
Chris@136 67 bool m_smoothSpectrogram;
Chris@136 68 float m_tuningFrequency;
Chris@138 69 PropertyBoxLayout m_propertyBoxLayout;
Chris@140 70 WindowType m_windowType;
Chris@145 71 ConfigFile *m_configFile;
Chris@136 72 };
Chris@136 73
Chris@136 74 #endif