lms-audio/src/cuetrackwidget.cpp
2024-06-16 18:15:27 +02:00

157 lines
4.5 KiB
C++

#include "cuetrackwidget.h"
CueTrackWidget::CueTrackWidget(QWidget *parent) : QWidget(parent) {
setupUi();
}
void CueTrackWidget::setupUi() {
auto layout = new QHBoxLayout(this);
userNumberSpin = new QSpinBox(this);
userNumberSpin->setRange(0, 1000);
userNumberSpin->setToolTip("Cue user number");
layout->addWidget(userNumberSpin);
filePathEdit = new QLineEdit(this);
filePathEdit->setToolTip("File name");
layout->addWidget(filePathEdit);
volumeSpin = new QSpinBox(this);
volumeSpin->setRange(0, 65535);
volumeSpin->setToolTip("Volume");
layout->addWidget(volumeSpin);
bus1Spin = new QSpinBox(this);
bus1Spin->setRange(0, 255);
bus1Spin->setToolTip("Bus 1");
layout->addWidget(bus1Spin);
bus2Spin = new QSpinBox(this);
bus2Spin->setRange(0, 255);
bus2Spin->setToolTip("Bus 2");
layout->addWidget(bus2Spin);
panSpin = new QSpinBox(this);
panSpin->setRange(0, 255);
panSpin->setToolTip("Pan");
layout->addWidget(panSpin);
pitchSpin = new QSpinBox(this);
pitchSpin->setRange(0, 255);
pitchSpin->setToolTip("Pitch");
layout->addWidget(pitchSpin);
statusCombo = new QComboBox(this);
setupStatusCombo();
statusCombo->setToolTip("Playback Status");
layout->addWidget(statusCombo);
fadeInSpin = new QSpinBox(this);
fadeInSpin->setRange(0, 10000);
fadeInSpin->setToolTip("Fade In Time");
layout->addWidget(fadeInSpin);
fadeOutSpin = new QSpinBox(this);
fadeOutSpin->setRange(0, 10000);
fadeOutSpin->setToolTip("Fade Out Time");
layout->addWidget(fadeOutSpin);
waitInSpin = new QSpinBox(this);
waitInSpin->setRange(0, 10000);
waitInSpin->setToolTip("Wait In Time");
layout->addWidget(waitInSpin);
waitOutSpin = new QSpinBox(this);
waitOutSpin->setRange(0, 10000);
waitOutSpin->setToolTip("Wait Out Time");
layout->addWidget(waitOutSpin);
stopAtEndCheck = new QCheckBox(this);
stopAtEndCheck->setToolTip("Halt");
layout->addWidget(stopAtEndCheck);
nameEdit = new QLineEdit(this);
nameEdit->setToolTip("Cue Name");
layout->addWidget(nameEdit);
descriptionEdit = new QLineEdit(this);
descriptionEdit->setToolTip("Cue Notes");
layout->addWidget(descriptionEdit);
entryPointSpin = new QSpinBox(this);
entryPointSpin->setRange(0, 255);
entryPointSpin->setToolTip("Entry Point");
layout->addWidget(entryPointSpin);
exitPointSpin = new QSpinBox(this);
exitPointSpin->setRange(0, 255);
exitPointSpin->setToolTip("Exit Point");
layout->addWidget(exitPointSpin);
setLayout(layout);
}
QWidget *CueTrackWidget::createHeader()
{
QWidget *ret = new QWidget();
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;
}
void CueTrackWidget::setupStatusCombo() {
statusCombo = new QComboBox(this);
statusCombo->addItem("Stopped", Stopped);
statusCombo->addItem("Paused", Paused);
statusCombo->addItem("PlayingOnce", PlayingOnce);
statusCombo->addItem("PlayingLoop", PlayingLoop);
statusCombo->addItem("Iddle", Iddle);
statusCombo->addItem("PlayingFolder", PlayingFolder);
statusCombo->addItem("PlayingFolderLoop", PlayingFolderLoop);
statusCombo->addItem("PlayingFolderRandom", PlayingFolderRandom);
}
CueTrack CueTrackWidget::saveCueTrack() const {
CueTrack cueTrack;
cueTrack.filePath = filePathEdit->text().toStdString();
cueTrack.volume = volumeSpin->value();
// Guarda el resto de los campos aquí...
cueTrack.status = static_cast<Status>(statusCombo->currentData().toInt());
return cueTrack;
}