annotate widgets/SelectableLabel.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 f8fcfbe13c8f
children a18e78b9c78b
rev   line source
Chris@424 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@424 2
Chris@424 3 /*
Chris@424 4 Sonic Visualiser
Chris@424 5 An audio file viewer and annotation editor.
Chris@424 6 Centre for Digital Music, Queen Mary, University of London.
Chris@424 7 This file copyright 2008 QMUL.
Chris@424 8
Chris@424 9 This program is free software; you can redistribute it and/or
Chris@424 10 modify it under the terms of the GNU General Public License as
Chris@424 11 published by the Free Software Foundation; either version 2 of the
Chris@424 12 License, or (at your option) any later version. See the file
Chris@424 13 COPYING included with this distribution for more information.
Chris@424 14 */
Chris@424 15
Chris@424 16 #ifndef _SELECTABLE_LABEL_H_
Chris@424 17 #define _SELECTABLE_LABEL_H_
Chris@424 18
Chris@424 19 #include <QLabel>
Chris@424 20
Chris@424 21 class SelectableLabel : public QLabel
Chris@424 22 {
Chris@424 23 Q_OBJECT
Chris@424 24
Chris@424 25 public:
Chris@424 26 SelectableLabel(QWidget *parent = 0);
Chris@424 27 virtual ~SelectableLabel();
Chris@424 28
Chris@424 29 void setSelectedText(QString);
Chris@424 30 void setUnselectedText(QString);
Chris@424 31
Chris@424 32 bool isSelected() const { return m_selected; }
Chris@424 33
Chris@424 34 signals:
Chris@424 35 void selectionChanged();
Chris@424 36 void doubleClicked();
Chris@424 37
Chris@424 38 public slots:
Chris@424 39 void setSelected(bool);
Chris@424 40 void toggle();
Chris@424 41
Chris@424 42 protected:
Chris@424 43 virtual void mousePressEvent(QMouseEvent *e);
Chris@441 44 virtual void mouseReleaseEvent(QMouseEvent *e);
Chris@424 45 virtual void mouseDoubleClickEvent(QMouseEvent *e);
Chris@424 46 virtual void enterEvent(QEvent *);
Chris@424 47 virtual void leaveEvent(QEvent *);
Chris@424 48 void setupStyle();
Chris@424 49 QString m_selectedText;
Chris@424 50 QString m_unselectedText;
Chris@424 51 bool m_selected;
Chris@441 52 bool m_swallowRelease;
Chris@424 53 };
Chris@424 54
Chris@424 55 #endif