1 /* 2 * Hydrogen 3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net] 4 * 5 * http://www.hydrogen-music.org 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY, without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * 21 */ 22 23 #ifndef LCD_H 24 #define LCD_H 25 26 27 #include <QtGui> 28 #if QT_VERSION >= 0x050000 29 # include <QtWidgets> 30 #endif 31 32 #include <hydrogen/object.h> 33 34 #include <vector> 35 36 class LCDDigit : public QWidget, public H2Core::Object 37 { 38 H2_OBJECT 39 Q_OBJECT 40 public: 41 enum LCDType { 42 SMALL_BLUE, 43 SMALL_RED, 44 LARGE_GRAY, 45 SMALL_GRAY 46 }; 47 48 LCDDigit( QWidget *pParent, LCDType type ); 49 ~LCDDigit(); 50 51 void set( char ch ); 52 53 void setSmallRed(); 54 void setSmallBlue(); 55 56 signals: 57 void digitClicked(); 58 59 private: 60 static QPixmap *m_pSmallBlueFontSet; 61 static QPixmap *m_pSmallRedFontSet; 62 static QPixmap *m_pLargeGrayFontSet; 63 static QPixmap *m_pSmallGrayFontSet; 64 65 int m_nCol; 66 int m_nRow; 67 LCDType m_type; 68 69 virtual void paintEvent(QPaintEvent *ev); 70 virtual void mouseReleaseEvent(QMouseEvent* ev); 71 }; 72 73 74 75 class LCDDisplay : public QWidget, public H2Core::Object 76 { 77 H2_OBJECT 78 Q_OBJECT 79 public: 80 LCDDisplay( QWidget * pParent, LCDDigit::LCDType type, int nDigits, bool leftAlign = false ); 81 ~LCDDisplay(); 82 83 void setText( const QString& sMsg ); getText()84 QString getText() { return m_sMsg; } 85 86 void setSmallRed(); 87 void setSmallBlue(); 88 89 public slots: 90 void digitClicked(); 91 92 signals: 93 void displayClicked( LCDDisplay* pRef ); 94 95 private: 96 std::vector<LCDDigit*> m_pDisplay; 97 QString m_sMsg; 98 bool m_bLeftAlign; 99 }; 100 101 102 class LCDSpinBox : public QWidget, public H2Core::Object 103 { 104 H2_OBJECT 105 Q_OBJECT 106 public: 107 enum LCDSpinBoxType { 108 INTEGER, 109 FLOAT 110 }; 111 112 LCDSpinBox( QWidget *pParent, int nDigits, LCDSpinBoxType type, int nMin = -1, int nMax = -1 ); 113 ~LCDSpinBox(); 114 115 void setValue( float nValue ); getValue()116 float getValue() { return m_fValue; } 117 118 virtual void wheelEvent( QWheelEvent *ev ); 119 120 // richiamati da PlayerControl 121 void upBtnClicked(); 122 void downBtnClicked(); 123 124 signals: 125 void changed(LCDSpinBox *pRef); 126 void spinboxClicked(); 127 128 public slots: 129 void displayClicked( LCDDisplay *pRef ); 130 131 private: 132 LCDSpinBoxType m_type; 133 LCDDisplay* m_pDisplay; 134 135 float m_fValue; 136 int m_nMinValue; 137 int m_nMaxValue; 138 }; 139 140 141 #endif 142