TempoSyncKnob.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * TempoSyncKnob.h - adds bpm to ms conversion for knob class
  3. *
  4. * Copyright (c) 2005-2008 Danny McRae <khjklujn/at/yahoo.com>
  5. * Copyright (c) 2009-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #ifndef TEMPO_SYNC_KNOB_H
  26. #define TEMPO_SYNC_KNOB_H
  27. #include <QPixmap>
  28. #include <QtCore/QPointer>
  29. #include "Knob.h"
  30. #include "TempoSyncKnobModel.h"
  31. class MeterDialog;
  32. class LMMS_EXPORT TempoSyncKnob : public Knob
  33. {
  34. Q_OBJECT
  35. public:
  36. TempoSyncKnob( knobTypes knobNum, QWidget* parent = nullptr, const QString& name = QString() );
  37. virtual ~TempoSyncKnob();
  38. const QString & syncDescription();
  39. void setSyncDescription( const QString & _new_description );
  40. const QPixmap & syncIcon();
  41. void setSyncIcon( const QPixmap & _new_pix );
  42. TempoSyncKnobModel * model()
  43. {
  44. return castModel<TempoSyncKnobModel>();
  45. }
  46. void modelChanged() override;
  47. signals:
  48. void syncDescriptionChanged( const QString & _new_description );
  49. void syncIconChanged();
  50. protected:
  51. void contextMenuEvent( QContextMenuEvent * _me ) override;
  52. protected slots:
  53. void updateDescAndIcon();
  54. void showCustom();
  55. private:
  56. QPixmap m_tempoSyncIcon;
  57. QString m_tempoSyncDescription;
  58. QPointer<MeterDialog> m_custom;
  59. } ;
  60. #endif