diff options
Diffstat (limited to 'src/selectioneditor.cc')
-rw-r--r-- | src/selectioneditor.cc | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/src/selectioneditor.cc b/src/selectioneditor.cc index 5f3057b..71a1195 100644 --- a/src/selectioneditor.cc +++ b/src/selectioneditor.cc @@ -30,87 +30,89 @@ #include <QVBoxLayout> #include <QLabel> -QLineEdit *createWidget(QString name, QWidget *parent) +QLineEdit *createWidget(QString name, QWidget* parent) { - QHBoxLayout *l = new QHBoxLayout(); + QHBoxLayout* l = new QHBoxLayout(); - l->addWidget(new QLabel(name)); - - QLineEdit *edt = new QLineEdit(); - QObject::connect(edt, SIGNAL(editingFinished()), - parent, SLOT(updateSelection())); + l->addWidget(new QLabel(name)); - l->addWidget(edt); + QLineEdit* edt = new QLineEdit(); + QObject::connect(edt, SIGNAL(editingFinished()), + parent, SLOT(updateSelection())); - ((QHBoxLayout *)parent->layout())->addLayout(l); - - return edt; + l->addWidget(edt); + + ((QHBoxLayout*)parent->layout())->addLayout(l); + + return edt; } SelectionEditor::SelectionEditor(Selections &s) - : selections(s) + : selections(s) { - cur = SEL_NONE; + cur = SEL_NONE; - setLayout(new QVBoxLayout()); + setLayout(new QVBoxLayout()); - from = createWidget("From:", this); - to = createWidget("To:", this); - fadein = createWidget("FadeIn:", this); - fadeout = createWidget("FadeOut:", this); - energy = createWidget("Energy:", this); - name = createWidget("Name:", this); + from = createWidget("From:", this); + to = createWidget("To:", this); + fadein = createWidget("FadeIn:", this); + fadeout = createWidget("FadeOut:", this); + energy = createWidget("Energy:", this); + name = createWidget("Name:", this); - ((QHBoxLayout *)layout())->addStretch(); + ((QHBoxLayout*)layout())->addStretch(); } void SelectionEditor::updateSelection() { - Selection sel; + Selection sel; - sel.from = from->text().toInt(); - sel.to = to->text().toInt(); - sel.fadein = fadein->text().toInt(); - sel.fadeout = fadeout->text().toInt(); - sel.energy = energy->text().toDouble(); - sel.name = name->text(); + sel.from = from->text().toInt(); + sel.to = to->text().toInt(); + sel.fadein = fadein->text().toInt(); + sel.fadeout = fadeout->text().toInt(); + sel.energy = energy->text().toDouble(); + sel.name = name->text(); - selections.update(cur, sel); + selections.update(cur, sel); } void SelectionEditor::update() { - Selection sel = selections.get(cur); - from->setText(QString::number(sel.from)); - to->setText(QString::number(sel.to)); - fadein->setText(QString::number(sel.fadein)); - fadeout->setText(QString::number(sel.fadeout)); - energy->setText(QString::number(sel.energy)); - name->setText(sel.name); + Selection sel = selections.get(cur); + from->setText(QString::number(sel.from)); + to->setText(QString::number(sel.to)); + fadein->setText(QString::number(sel.fadein)); + fadeout->setText(QString::number(sel.fadeout)); + energy->setText(QString::number(sel.energy)); + name->setText(sel.name); } void SelectionEditor::added(sel_id_t id) { - // Nothing to do here... + // Nothing to do here... } void SelectionEditor::updated(sel_id_t id) { - if(cur == id) { - update(); - } + if(cur == id) + { + update(); + } } void SelectionEditor::removed(sel_id_t id) { - if(cur == id) { - cur = SEL_NONE; - update(); - } + if(cur == id) + { + cur = SEL_NONE; + update(); + } } void SelectionEditor::activeChanged(sel_id_t id) { - cur = id; - update(); + cur = id; + update(); } |