FxLine.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * FxLine.h - FX line widget
  3. *
  4. * Copyright (c) 2009 Andrew Kelley <superjoe30/at/gmail/dot/com>
  5. * Copyright (c) 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 FX_LINE_H
  26. #define FX_LINE_H
  27. #include <QGraphicsView>
  28. #include <QLineEdit>
  29. #include <QWidget>
  30. #include "Knob.h"
  31. #include "LcdWidget.h"
  32. #include "SendButtonIndicator.h"
  33. class FxMixerView;
  34. class SendButtonIndicator;
  35. class FxLine : public QWidget
  36. {
  37. Q_OBJECT
  38. public:
  39. Q_PROPERTY( QBrush backgroundActive READ backgroundActive WRITE setBackgroundActive )
  40. Q_PROPERTY( QColor strokeOuterActive READ strokeOuterActive WRITE setStrokeOuterActive )
  41. Q_PROPERTY( QColor strokeOuterInactive READ strokeOuterInactive WRITE setStrokeOuterInactive )
  42. Q_PROPERTY( QColor strokeInnerActive READ strokeInnerActive WRITE setStrokeInnerActive )
  43. Q_PROPERTY( QColor strokeInnerInactive READ strokeInnerInactive WRITE setStrokeInnerInactive )
  44. FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex);
  45. ~FxLine();
  46. void paintEvent( QPaintEvent * ) override;
  47. void mousePressEvent( QMouseEvent * ) override;
  48. void mouseDoubleClickEvent( QMouseEvent * ) override;
  49. void contextMenuEvent( QContextMenuEvent * ) override;
  50. inline int channelIndex() { return m_channelIndex; }
  51. void setChannelIndex(int index);
  52. Knob * m_sendKnob;
  53. SendButtonIndicator * m_sendBtn;
  54. QBrush backgroundActive() const;
  55. void setBackgroundActive( const QBrush & c );
  56. QColor strokeOuterActive() const;
  57. void setStrokeOuterActive( const QColor & c );
  58. QColor strokeOuterInactive() const;
  59. void setStrokeOuterInactive( const QColor & c );
  60. QColor strokeInnerActive() const;
  61. void setStrokeInnerActive( const QColor & c );
  62. QColor strokeInnerInactive() const;
  63. void setStrokeInnerInactive( const QColor & c );
  64. static const int FxLineHeight;
  65. bool eventFilter (QObject *dist, QEvent *event) override;
  66. private:
  67. void drawFxLine( QPainter* p, const FxLine *fxLine, bool isActive, bool sendToThis, bool receiveFromThis );
  68. QString elideName( const QString & name );
  69. FxMixerView * m_mv;
  70. LcdWidget* m_lcd;
  71. int m_channelIndex;
  72. QBrush m_backgroundActive;
  73. QColor m_strokeOuterActive;
  74. QColor m_strokeOuterInactive;
  75. QColor m_strokeInnerActive;
  76. QColor m_strokeInnerInactive;
  77. static QPixmap * s_sendBgArrow;
  78. static QPixmap * s_receiveBgArrow;
  79. bool m_inRename;
  80. QLineEdit * m_renameLineEdit;
  81. QGraphicsView * m_view;
  82. public slots:
  83. void renameChannel();
  84. private slots:
  85. void renameFinished();
  86. void removeChannel();
  87. void removeUnusedChannels();
  88. void moveChannelLeft();
  89. void moveChannelRight();
  90. };
  91. #endif // FXLINE_H