Skip to content

Commit

Permalink
Fix #136 - Allow bends that extend over more than 8 notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronwhite committed Sep 20, 2014
1 parent a9f7974 commit 07bb497
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 14 deletions.
26 changes: 13 additions & 13 deletions source/dialogs/benddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ BendDialog::BendDialog(QWidget *parent)

initBendPitches();

ui->bendDurationComboBox->addItems({
tr("Default"), tr("Current Note Duration")
});
for (int i = 1; i <= 8; ++i)
{
ui->bendDurationComboBox->addItem(
tr("Current Note Duration + Next %n Note(s)", 0, i));
}
myDurationButtonGroup = new QButtonGroup(this);
myDurationButtonGroup->addButton(ui->defaultDurationButton);
myDurationButtonGroup->addButton(ui->customDurationButton);
ui->defaultDurationButton->setChecked(true);

initDrawPoints(ui->vertStartingPointComboBox);
initDrawPoints(ui->vertEndingPointComboBox);
Expand All @@ -59,7 +55,7 @@ Bend BendDialog::getBend() const
static_cast<Bend::BendType>(ui->bendTypeComboBox->currentIndex()),
ui->bentPitchComboBox->itemData(ui->bentPitchComboBox->currentIndex()).toInt(),
ui->releasePitchComboBox->itemData(ui->releasePitchComboBox->currentIndex()).toInt(),
ui->bendDurationComboBox->currentIndex(),
ui->defaultDurationButton->isChecked() ? 0 : ui->bendDurationSpinBox->value() + 1,
static_cast<Bend::DrawPoint>(
ui->vertStartingPointComboBox->currentIndex()),
static_cast<Bend::DrawPoint>(
Expand Down Expand Up @@ -96,14 +92,16 @@ void BendDialog::handleBendTypeChanged()
// First, reset everything.
ui->bentPitchComboBox->setEnabled(true);
ui->releasePitchComboBox->setEnabled(true);
ui->bendDurationComboBox->setEnabled(true);
for (auto button : myDurationButtonGroup->buttons())
button->setEnabled(true);

// Enable or disable some of the options depending on the active bend type.
switch (bendType)
{
case Bend::PreBend:
case Bend::PreBendAndHold:
ui->bendDurationComboBox->setDisabled(true);
for (auto button : myDurationButtonGroup->buttons())
button->setDisabled(true);
// FALL THROUGH
case Bend::NormalBend:
case Bend::BendAndHold:
Expand All @@ -114,13 +112,15 @@ void BendDialog::handleBendTypeChanged()

case Bend::PreBendAndRelease:
case Bend::BendAndRelease:
ui->bendDurationComboBox->setDisabled(true);
for (auto button : myDurationButtonGroup->buttons())
button->setDisabled(true);
ui->vertStartingPointComboBox->setCurrentIndex(Bend::LowPoint);
ui->vertEndingPointComboBox->setCurrentIndex(Bend::LowPoint);
break;

case Bend::ImmediateRelease:
ui->bendDurationComboBox->setDisabled(true);
for (auto button : myDurationButtonGroup->buttons())
button->setDisabled(true);
ui->releasePitchComboBox->setDisabled(true);
// FALL THROUGH
case Bend::GradualRelease:
Expand Down
1 change: 1 addition & 0 deletions source/dialogs/benddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class BendDialog : public QDialog
void handleBendTypeChanged();

Ui::BendDialog *ui;
QButtonGroup *myDurationButtonGroup;
};

#endif
37 changes: 36 additions & 1 deletion source/dialogs/benddialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,42 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="bendDurationComboBox"/>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="defaultDurationButton">
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>3</number>
</property>
<item>
<widget class="QRadioButton" name="customDurationButton">
<property name="text">
<string>Current note duration + next</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bendDurationSpinBox"/>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>notes</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="vertStartingPointLabel">
Expand Down

0 comments on commit 07bb497

Please sign in to comment.