| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef QUTETEXT_H |
| 24 |
#define QUTETEXT_H |
| 25 |
|
| 26 |
#include "qutewidget.h" |
| 27 |
#include "selectcolorbutton.h" |
| 28 |
|
| 29 |
class QuteText : public QuteWidget |
| 30 |
{ |
| 31 |
Q_OBJECT |
| 32 |
public: |
| 33 |
QuteText(QWidget *parent); |
| 34 |
|
| 35 |
~QuteText(); |
| 36 |
|
| 37 |
virtual QString getWidgetLine(); |
| 38 |
virtual QString getWidgetXmlText(); |
| 39 |
|
| 40 |
virtual QString getWidgetType(); |
| 41 |
virtual void setValue(double value); |
| 42 |
virtual void setValue(QString value); |
| 43 |
|
| 44 |
void setType(QString type); |
| 45 |
virtual void setAlignment(QString alignment); |
| 46 |
void setFont(QString font); |
| 47 |
void setFontSize(int fontSize); |
| 48 |
void setTextColor(QColor textColor); |
| 49 |
void setBgColor(QColor bgColor); |
| 50 |
void setBg(bool bg); |
| 51 |
void setBorder(bool border); |
| 52 |
void setBorderColor(QColor color); |
| 53 |
void setTransparentForMouse(bool status); |
| 54 |
virtual void setText(QString text); |
| 55 |
virtual void refreshWidget(); |
| 56 |
virtual void applyInternalProperties(); |
| 57 |
virtual QString getCabbageLine(); |
| 58 |
virtual QString getQml(); |
| 59 |
|
| 60 |
|
| 61 |
void setFontScaling(double scaling); |
| 62 |
void setFontOffset(double offset); |
| 63 |
|
| 64 |
protected: |
| 65 |
virtual void createPropertiesDialog(); |
| 66 |
virtual void applyProperties(); |
| 67 |
|
| 68 |
QString m_type; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
double m_fontScaling, m_fontOffset; |
| 73 |
|
| 74 |
QTextEdit *text; |
| 75 |
|
| 76 |
SelectColorButton *textColor; |
| 77 |
|
| 78 |
SelectColorButton *bgColor; |
| 79 |
QCheckBox *bg; |
| 80 |
|
| 81 |
QSpinBox *borderRadius; |
| 82 |
QSpinBox *borderWidth; |
| 83 |
QSpinBox *precisionSpinBox; |
| 84 |
QFontComboBox *font; |
| 85 |
QSpinBox * fontSize; |
| 86 |
QComboBox * alignment; |
| 87 |
QComboBox * vertAlignmentComboBox; |
| 88 |
QHash<QString, QLabel *>labelPtrs; |
| 89 |
int m_precision; |
| 90 |
|
| 91 |
private slots: |
| 92 |
|
| 93 |
|
| 94 |
}; |
| 95 |
|
| 96 |
class QuteLineEdit : public QuteText |
| 97 |
{ |
| 98 |
Q_OBJECT |
| 99 |
public: |
| 100 |
QuteLineEdit(QWidget* parent); |
| 101 |
~QuteLineEdit(); |
| 102 |
|
| 103 |
virtual void setText(QString text); |
| 104 |
virtual QString getWidgetLine(); |
| 105 |
virtual QString getWidgetXmlText(); |
| 106 |
virtual QString getStringValue(); |
| 107 |
virtual double getValue(); |
| 108 |
virtual QString getWidgetType(); |
| 109 |
virtual void dropEvent(QDropEvent *event); |
| 110 |
virtual void applyInternalProperties(); |
| 111 |
virtual QString getCabbageLine(); |
| 112 |
|
| 113 |
protected: |
| 114 |
virtual void createPropertiesDialog(); |
| 115 |
|
| 116 |
|
| 117 |
protected slots: |
| 118 |
void textEdited(QString text); |
| 119 |
}; |
| 120 |
|
| 121 |
class QuteScrollNumber : public QuteText |
| 122 |
{ |
| 123 |
Q_OBJECT |
| 124 |
public: |
| 125 |
QuteScrollNumber(QWidget* parent); |
| 126 |
~QuteScrollNumber(); |
| 127 |
|
| 128 |
virtual void setTextAlignment(int alignment); |
| 129 |
virtual QString getWidgetLine(); |
| 130 |
virtual QString getCsladspaLine(); |
| 131 |
virtual QString getWidgetXmlText(); |
| 132 |
virtual QString getWidgetType(); |
| 133 |
virtual void setValue(double value); |
| 134 |
virtual void setMidiValue(int value); |
| 135 |
virtual bool acceptsMidi() {return true;} |
| 136 |
|
| 137 |
virtual void applyInternalProperties(); |
| 138 |
virtual QString getCabbageLine(); |
| 139 |
|
| 140 |
protected: |
| 141 |
virtual void refreshWidget(); |
| 142 |
virtual void createPropertiesDialog(); |
| 143 |
virtual void applyProperties(); |
| 144 |
|
| 145 |
QDoubleSpinBox* resolutionSpinBox; |
| 146 |
QDoubleSpinBox *minSpinBox; |
| 147 |
QDoubleSpinBox *maxSpinBox; |
| 148 |
int m_places; |
| 149 |
double m_min, m_max; |
| 150 |
|
| 151 |
public slots: |
| 152 |
void setResolution(double resolution); |
| 153 |
void addValue(double delta); |
| 154 |
void setValueFromWidget(double value); |
| 155 |
void setValueFromDialog(); |
| 156 |
}; |
| 157 |
|
| 158 |
class ScrollNumberWidget : public QLabel |
| 159 |
{ |
| 160 |
Q_OBJECT |
| 161 |
public: |
| 162 |
ScrollNumberWidget(QWidget* parent) : QLabel(parent) |
| 163 |
{ |
| 164 |
setContextMenuPolicy(Qt::NoContextMenu); |
| 165 |
pressed = false; |
| 166 |
} |
| 167 |
~ScrollNumberWidget() {} |
| 168 |
|
| 169 |
void setResolution(double resolution) |
| 170 |
{ |
| 171 |
m_resolution = resolution; |
| 172 |
} |
| 173 |
|
| 174 |
protected: |
| 175 |
virtual void mouseMoveEvent(QMouseEvent * event) |
| 176 |
{ |
| 177 |
if (pressed) { |
| 178 |
double delta = (oldy - event->y()) * m_resolution; |
| 179 |
emit addValue(delta); |
| 180 |
oldy = event->y(); |
| 181 |
} |
| 182 |
} |
| 183 |
virtual void mousePressEvent(QMouseEvent * event) |
| 184 |
{ |
| 185 |
if (event->button() & Qt::LeftButton) { |
| 186 |
if (event->modifiers() & Qt::AltModifier) { |
| 187 |
emit setValue(0); |
| 188 |
} |
| 189 |
oldy = event->y(); |
| 190 |
pressed = true; |
| 191 |
} |
| 192 |
} |
| 193 |
virtual void mouseReleaseEvent (QMouseEvent * event) |
| 194 |
{ |
| 195 |
QLabel::mouseReleaseEvent(event); |
| 196 |
pressed = false; |
| 197 |
} |
| 198 |
|
| 199 |
virtual void mouseDoubleClickEvent (QMouseEvent *event) { |
| 200 |
if(!event->modifiers()) |
| 201 |
emit doubleClick(); |
| 202 |
else |
| 203 |
QLabel::mouseDoubleClickEvent(event); |
| 204 |
} |
| 205 |
|
| 206 |
private: |
| 207 |
double m_resolution; |
| 208 |
|
| 209 |
int oldy; |
| 210 |
bool pressed; |
| 211 |
|
| 212 |
signals: |
| 213 |
void addValue(double delta); |
| 214 |
void setValue(double value); |
| 215 |
void doubleClick(); |
| 216 |
}; |
| 217 |
|
| 218 |
#endif |