ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gradientdialog.h
Go to the documentation of this file.
1 #ifndef GRADIENTDIALOG_H
2 #define GRADIENTDIALOG_H
3 
4 #include <QDialog>
5 #include <QListWidgetItem>
6 #include <QMap>
7 
8 namespace Ui {
9 class GradientDialog;
10 }
11 
12 class GradientDialog : public QDialog
13 {
14  Q_OBJECT
15 
16 public:
17  explicit GradientDialog(QWidget *parent = 0);
19 
20  QGradientStops getGradient(const QGradientStops& prevGradient);
21 private:
22  // Preset gradients, sorted by lower case name
23  struct Preset {
24  QString name;
25  QGradientStops gradient;
26  bool builtIn;
27  inline Preset(QString _name, bool _builtIn = false) : name(_name), builtIn(_builtIn) {}
28  inline Preset(QString _name, const QGradientStops& _gradient) : name(_name), gradient(_gradient), builtIn(false) {}
29  inline Preset() : builtIn(false) {}
30  };
31  QMap<QString, Preset> presets;
32  QString currentPreset;
33 
34  inline void addPreset(const Preset& preset) { presets[preset.name.toLower()] = preset; }
35  QIcon makeIcon(const Preset& preset);
36  void updatePresets();
37  void setPreset(const QString& newPreset);
38 
40 
41 private slots:
42  void currentChanged(QColor color, bool spontaneous, int position);
43  void colorChanged(QColor color);
44 
45  void on_presetList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
46  void on_presetName_textEdited(const QString &arg1);
47  void on_presetSave_clicked();
49  void on_stopPos_valueChanged(int arg1);
50  void on_stopOpacity_valueChanged(int arg1);
51 };
52 
53 #endif // GRADIENTDIALOG_H
void currentChanged(QColor color, bool spontaneous, int position)
rgb * current
Definition: main.c:46
QMap< QString, Preset > presets
QString currentPreset
void on_presetDelete_clicked()
void on_stopPos_valueChanged(int arg1)
void on_presetList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
void on_stopOpacity_valueChanged(int arg1)
Ui::GradientDialog * ui
QGradientStops getGradient(const QGradientStops &prevGradient)
void setPreset(const QString &newPreset)
void on_presetName_textEdited(const QString &arg1)
QGradientStops gradient
GradientDialog(QWidget *parent=0)
Preset(QString _name, const QGradientStops &_gradient)
void on_presetSave_clicked()
Preset(QString _name, bool _builtIn=false)
void colorChanged(QColor color)
void addPreset(const Preset &preset)
QIcon makeIcon(const Preset &preset)