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
animadddialog.cpp
Go to the documentation of this file.
1 #include "animadddialog.h"
2 #include "ui_animadddialog.h"
3 
4 AnimAddDialog::AnimAddDialog(QWidget *parent, KbLight *light, const QStringList &keys) :
5  QDialog(parent),
6  ui(new Ui::AnimAddDialog), _light(light), _keys(keys), showPreview(true)
7 {
8  ui->setupUi(this);
10  foreach(const AnimScript* script, scripts)
11  ui->animBox->addItem(script->name());
13 }
14 
16  delete ui;
18 }
19 
21  return scripts[ui->animBox->currentIndex()];
22 }
23 
25  return ui->presetBox->currentIndex();
26 }
27 
29  // Update preset list
30  ui->presetBox->clear();
31  foreach(const QString& preset, chosenScript()->presets())
32  ui->presetBox->addItem(preset);
33  ui->presetBox->setCurrentIndex(0);
35 }
36 
38  // Update preview
39  if(showPreview)
40  _light->previewAnim(chosenScript(), _keys, chosenScript()->preset(index));
41 }
42 
44  showPreview = checked;
45  if(showPreview)
46  on_presetBox_activated(ui->presetBox->currentIndex());
47  else
49 }
void stopPreview()
Definition: kblight.cpp:143
Ui::AnimAddDialog * ui
Definition: animadddialog.h:29
AnimAddDialog(QWidget *parent, KbLight *light, const QStringList &keys)
static QList< const AnimScript * > list()
Definition: animscript.cpp:51
void setupUi(QDialog *AnimAddDialog)
void previewAnim(const AnimScript *base, const QStringList &keys, const QMap< QString, QVariant > &preset)
Definition: kblight.cpp:124
QComboBox * animBox
void on_animBox_activated(int index)
QList< const AnimScript * > scripts
Definition: animadddialog.h:30
const QString & name() const
Definition: animscript.h:60
QStringList _keys
Definition: animadddialog.h:33
const AnimScript * chosenScript()
KbLight * _light
Definition: animadddialog.h:32
void on_previewBox_clicked(bool checked)
void on_presetBox_activated(int index)
QComboBox * presetBox