annotate base/UnitDatabase.h @ 188:f86b74d1b143

* Simplify maker names in plugin menu * Make sure derived models have a name (based on the transform) * Don't start deriving a model from a derived model until the derived model is ready * Tidy up completion management in writable wave file model * Make writable models save/reload correctly from session file (i.e. regenerating from the original transform) * Same for dense 3d models -- don't save the data, just the transform details * Add a comment describing the SV file format
author Chris Cannam
date Fri, 13 Oct 2006 12:51:05 +0000
parents a08718723b20
children 1d789d688f59
rev   line source
Chris@116 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@116 2
Chris@116 3 /*
Chris@116 4 Sonic Visualiser
Chris@116 5 An audio file viewer and annotation editor.
Chris@116 6 Centre for Digital Music, Queen Mary, University of London.
Chris@116 7 This file copyright 2006 Chris Cannam.
Chris@116 8
Chris@116 9 This program is free software; you can redistribute it and/or
Chris@116 10 modify it under the terms of the GNU General Public License as
Chris@116 11 published by the Free Software Foundation; either version 2 of the
Chris@116 12 License, or (at your option) any later version. See the file
Chris@116 13 COPYING included with this distribution for more information.
Chris@116 14 */
Chris@116 15
Chris@116 16 #ifndef _UNIT_DATABASE_H_
Chris@116 17 #define _UNIT_DATABASE_H_
Chris@116 18
Chris@116 19 #include <QObject>
Chris@116 20 #include <QString>
Chris@116 21 #include <QStringList>
Chris@116 22 #include <map>
Chris@116 23
Chris@116 24 // This grandly named class is just a list of the names of known scale
Chris@116 25 // units for the various models, for use as the set of fixed values in
Chris@116 26 // unit dropdown menus etc. Of course, the user should be allowed to
Chris@116 27 // enter their own as well.
Chris@116 28
Chris@116 29 class UnitDatabase : public QObject
Chris@116 30 {
Chris@116 31 Q_OBJECT
Chris@116 32
Chris@116 33 public:
Chris@116 34 static UnitDatabase *getInstance();
Chris@116 35
Chris@116 36 QStringList getKnownUnits() const;
Chris@116 37 void registerUnit(QString unit);
Chris@116 38
Chris@116 39 int getUnitId(QString unit);
Chris@116 40 QString getUnitById(int id);
Chris@116 41
Chris@116 42 signals:
Chris@116 43 void unitDatabaseChanged();
Chris@116 44
Chris@116 45 protected:
Chris@116 46 UnitDatabase();
Chris@116 47
Chris@116 48 typedef std::map<QString, int> UnitMap;
Chris@116 49 UnitMap m_units;
Chris@116 50 int m_nextId;
Chris@116 51
Chris@116 52 static UnitDatabase m_instance;
Chris@116 53 };
Chris@116 54
Chris@116 55 #endif
Chris@116 56