annotate widgets/KeyReference.h @ 1127:9fb8dfd7ce4c spectrogram-minor-refactor

Fix threshold in spectrogram -- it wasn't working in the last release. There is a new protocol for this. Formerly the threshold parameter had a range from -50dB to 0 with the default at -50, and -50 treated internally as "no threshold". However, there was a hardcoded, hidden internal threshold for spectrogram colour mapping at -80dB with anything below this being rounded to zero. Now the threshold parameter has range -81 to -1 with the default at -80, -81 is treated internally as "no threshold", and there is no hidden internal threshold. So the default behaviour is the same as before, an effective -80dB threshold, but it is now possible to change this in both directions. Sessions reloaded from prior versions may look slightly different because, if the session says there should be no threshold, there will now actually be no threshold instead of having the hidden internal one. Still need to do something in the UI to make it apparent that the -81dB setting removes the threshold entirely. This is at least no worse than the previous, also obscured, magic -50dB setting.
author Chris Cannam
date Mon, 01 Aug 2016 16:21:01 +0100
parents a31c8ee2e17e
children 05d614f6e46d
rev   line source
Chris@281 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@281 2
Chris@281 3 /*
Chris@281 4 Sonic Visualiser
Chris@281 5 An audio file viewer and annotation editor.
Chris@281 6 Centre for Digital Music, Queen Mary, University of London.
Chris@281 7 This file copyright 2007 QMUL.
Chris@281 8
Chris@281 9 This program is free software; you can redistribute it and/or
Chris@281 10 modify it under the terms of the GNU General Public License as
Chris@281 11 published by the Free Software Foundation; either version 2 of the
Chris@281 12 License, or (at your option) any later version. See the file
Chris@281 13 COPYING included with this distribution for more information.
Chris@281 14 */
Chris@281 15
Chris@281 16 #ifndef _KEY_REFERENCE_H_
Chris@281 17 #define _KEY_REFERENCE_H_
Chris@281 18
Chris@281 19 #include <QObject>
Chris@281 20 #include <QString>
Chris@281 21 #include <vector>
Chris@281 22 #include <map>
Chris@740 23 #include <QKeySequence>
Chris@281 24
Chris@281 25 class QAction;
Chris@281 26 class QTextEdit;
Chris@282 27 class QDialog;
Chris@282 28 class QAbstractButton;
Chris@281 29
Chris@281 30 class KeyReference : public QObject
Chris@281 31 {
Chris@281 32 Q_OBJECT
Chris@281 33
Chris@281 34 public:
Chris@281 35 KeyReference();
Chris@281 36 virtual ~KeyReference();
Chris@281 37
Chris@281 38 void setCategory(QString category);
Chris@281 39
Chris@281 40 void registerShortcut(QAction *, QString overrideName = "");
Chris@281 41 void registerAlternativeShortcut(QAction *, QString alternative);
Chris@740 42 void registerAlternativeShortcut(QAction *, QKeySequence alternative);
Chris@281 43
Chris@281 44 void registerShortcut(QString actionName, QString shortcut, QString tipText);
Chris@281 45 void registerAlternativeShortcut(QString actionName, QString alternative);
Chris@740 46 void registerAlternativeShortcut(QString actionName, QKeySequence alternative);
Chris@281 47
Chris@281 48 void show();
Chris@609 49 void hide();
Chris@281 50
Chris@282 51 protected slots:
Chris@282 52 void dialogButtonClicked(QAbstractButton *);
Chris@282 53
Chris@281 54 protected:
Chris@281 55 struct KeyDetails {
Chris@281 56 QString actionName;
Chris@281 57 QString shortcut;
Chris@281 58 QString tip;
Chris@281 59 std::vector<QString> alternatives;
Chris@281 60 };
Chris@281 61
Chris@281 62 typedef std::vector<KeyDetails> KeyList;
Chris@281 63 typedef std::map<QString, KeyList> CategoryMap;
Chris@281 64 typedef std::vector<QString> CategoryList;
Chris@281 65
Chris@281 66 QString m_currentCategory;
Chris@281 67 CategoryMap m_map;
Chris@281 68 CategoryList m_categoryOrder;
Chris@281 69
Chris@281 70 QTextEdit *m_text;
Chris@282 71 QDialog *m_dialog;
Chris@281 72 };
Chris@281 73
Chris@281 74 #endif