wip edit cues

This commit is contained in:
snt 2024-06-18 20:23:19 +02:00
parent 333d7c7b49
commit bd9b07f000
10 changed files with 318 additions and 168 deletions

View file

@ -7,152 +7,116 @@ CueTrackWidget::CueTrackWidget(QWidget *parent) : QWidget(parent) {
void CueTrackWidget::setupUi() {
QVBoxLayout *layout = new QVBoxLayout(this);
QSplitter *row = new QSplitter(Qt::Horizontal);
active = new QCheckBox(this);
row->addWidget(active);
userNumberSpin = new QSpinBox(this);
userNumberSpin->setRange(0, 1000);
userNumberSpin->setRange(0, 100000);
userNumberSpin->setToolTip("Cue user number");
row->addWidget(userNumberSpin);
audioLayer = new QSpinBox(this);
audioLayer->setRange(0, MAX_LAYERS);
audioLayer->setToolTip("Audio Layer");
row->addWidget(audioLayer);
nameEdit = new QLineEdit(this);
nameEdit->setToolTip("Cue Name");
row->addWidget(nameEdit);
descriptionEdit = new QLineEdit(this);
descriptionEdit->setToolTip("Cue Notes");
row->addWidget(descriptionEdit);
filePathEdit = new QLineEdit(this);
filePathEdit->setToolTip("File name");
row->addWidget(filePathEdit);
layout->addWidget(row);
row = new QSplitter(Qt::Horizontal);
volumeSpin = new QSpinBox(this);
volumeSpin->setRange(0, 65535);
volumeSpin = new ClickableDoubleSpinBox(this);
volumeSpin->setRange(0.0f, 100.0f);
volumeSpin->setToolTip("Volume");
volumeSpin->setValue(100);
row->addWidget(volumeSpin);
bus1Spin = new QSpinBox(this);
bus1Spin->setRange(0, 255);
volumeSpin->setSpecialValueText("-inf");
volumeSpin->setValue(75.0f);
bus1Spin = new ClickableDoubleSpinBox(this);
bus1Spin->setRange(0.0f, 100.0f);
bus1Spin->setToolTip("Bus 1");
bus1Spin->setValue(255);
row->addWidget(bus1Spin);
bus2Spin = new QSpinBox(this);
bus2Spin->setRange(0, 255);
bus1Spin->setSpecialValueText("-inf");
bus1Spin->setValue(100.0f);
bus2Spin = new ClickableDoubleSpinBox(this);
bus2Spin->setRange(0.0f, 100.0f);
bus2Spin->setToolTip("Bus 2");
bus2Spin->setValue(255);
row->addWidget(bus2Spin);
panSpin = new QSpinBox(this);
panSpin->setRange(0, 255);
bus2Spin->setSpecialValueText("-inf");
bus2Spin->setValue(100.0f);
panSpin = new ClickableDoubleSpinBox(this);
panSpin->setRange(-1, 1);
panSpin->setToolTip("Pan");
panSpin->setValue(128);
row->addWidget(panSpin);
pitchSpin = new QSpinBox(this);
pitchSpin->setRange(0, 255);
panSpin->setValue(0);
pitchSpin = new ClickableDoubleSpinBox(this);
pitchSpin->setRange(0, 2);
pitchSpin->setSpecialValueText("Stop");
pitchSpin->setToolTip("Pitch");
pitchSpin->setValue(128);
row->addWidget(pitchSpin);
pitchSpin->setValue(1);
entryPointSpin = new QSpinBox(this);
entryPointSpin->setRange(0, 255);
entryPointSpin->setToolTip("Entry Point");
row->addWidget(entryPointSpin);
exitPointSpin = new QSpinBox(this);
exitPointSpin->setRange(0, 255);
exitPointSpin->setToolTip("Exit Point");
exitPointSpin->setValue(255);
row->addWidget(exitPointSpin);
layout->addWidget(row);
row = new QSplitter(Qt::Horizontal);
setupStatusCombo();
statusCombo->setToolTip("Playback Status");
row->addWidget(statusCombo);
fadeInSpin = new QSpinBox(this);
row->addWidget(userNumberSpin);
fadeInSpin = new QSpinBox(this);
fadeInSpin->setRange(0, 10000);
fadeInSpin->setToolTip("Fade In Time");
fadeInSpin->setValue(3);
row->addWidget(fadeInSpin);
fadeOutSpin = new QSpinBox(this);
fadeOutSpin->setRange(0, 10000);
fadeOutSpin->setToolTip("Fade Out Time");
fadeOutSpin->setValue(3);
row->addWidget(fadeOutSpin);
waitInSpin = new QSpinBox(this);
waitInSpin->setRange(0, 10000);
waitInSpin->setToolTip("Wait In Time");
row->addWidget(waitInSpin);
waitOutSpin = new QSpinBox(this);
waitOutSpin->setRange(0, 10000);
waitOutSpin->setToolTip("Wait Out Time");
row->addWidget(waitOutSpin);
stopAtEndCheck = new QCheckBox(this);
stopAtEndCheck->setToolTip("Halt");
stopAtEndCheck->setChecked("True");
row->addWidget(stopAtEndCheck);
editButton = new QPushButton("Edit", this);
editButton->setToolTip("Edit");
row->addWidget(editButton);
connect(editButton, &QPushButton::clicked, this, &CueTrackWidget::editButtonClicked);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(row);
setLayout(layout);
setStyle(false);
}
QWidget *CueTrackWidget::createHeader()
{
QWidget *ret = new QWidget();
void CueTrackWidget::setStyle(bool highlight) {
QString style;
auto layout = new QHBoxLayout(this);
QLabel *l = new QLabel("Cue Number");
layout->addWidget(l);
l = new QLabel("File Path");
layout->addWidget(l);
l = new QLabel("Volume");
layout->addWidget(l);
l = new QLabel("Bus 1");
layout->addWidget(l);
l = new QLabel("Bus 2");
layout->addWidget(l);
l = new QLabel("Pan");
layout->addWidget(l);
l = new QLabel("Pitch");
layout->addWidget(l);
l = new QLabel("Playback Status");
layout->addWidget(l);
l = new QLabel("Fade In");
layout->addWidget(l);
l = new QLabel("Fade Out");
layout->addWidget(l);
l = new QLabel("Wait In");
layout->addWidget(l);
l = new QLabel("Wait Out ");
layout->addWidget(l);
l = new QLabel("Halt");
layout->addWidget(l);
l = new QLabel("Name");
layout->addWidget(l);
l = new QLabel("Notes");
layout->addWidget(l);
l = new QLabel("Entry Point");
layout->addWidget(l);
l = new QLabel("Exit Point");
layout->addWidget(l);
ret->setLayout(layout);
return ret;
style.append("margin: 1px;");
if (highlight)
style.append("background-color: #e8e0f8;");
else
style.append("background-color: #b9b8a7;");
this->setStyleSheet(style);
}
void CueTrackWidget::setupStatusCombo() {
@ -208,3 +172,11 @@ CueTrack CueTrackWidget::saveCueTrack() const {
cueTrack.status = static_cast<Status>(statusCombo->currentData().toInt());
return cueTrack;
}
void CueTrackWidget::editButtonClicked() {
EditCueTrackWidget editor;
editor.loadCueTrack(saveCueTrack());
if (editor.exec() == QDialog::Accepted) {
loadCueTrack(editor.saveCueTrack());
}
}