cambio a un vector de CueTrack en vex de CueTrackWidget.
CueTrackListWidget ahora posee el contenedor de CueTracks y muestra un QTableWidget con info de las CueTracks.
This commit is contained in:
parent
3b98be8b14
commit
84702c5e44
15 changed files with 265 additions and 652 deletions
|
|
@ -1,183 +0,0 @@
|
|||
#include "cuetrackwidget.h"
|
||||
#include "editcuetrackwidget.h"
|
||||
#include <QSplitter>
|
||||
|
||||
CueTrackWidget::CueTrackWidget(QWidget *parent) : QWidget(parent) {
|
||||
setupUi();
|
||||
}
|
||||
|
||||
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, 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");
|
||||
|
||||
filePathEdit = new QLineEdit(this);
|
||||
filePathEdit->setToolTip("File name");
|
||||
|
||||
volumeSpin = new ClickableDoubleSpinBox(this);
|
||||
volumeSpin->setRange(0.0f, 100.0f);
|
||||
volumeSpin->setToolTip("Volume");
|
||||
volumeSpin->setSpecialValueText("-inf");
|
||||
volumeSpin->setValue(75.0f);
|
||||
|
||||
bus1Spin = new ClickableDoubleSpinBox(this);
|
||||
bus1Spin->setRange(0.0f, 100.0f);
|
||||
bus1Spin->setToolTip("Bus 1");
|
||||
bus1Spin->setSpecialValueText("-inf");
|
||||
bus1Spin->setValue(100.0f);
|
||||
|
||||
bus2Spin = new ClickableDoubleSpinBox(this);
|
||||
bus2Spin->setRange(0.0f, 100.0f);
|
||||
bus2Spin->setToolTip("Bus 2");
|
||||
bus2Spin->setSpecialValueText("-inf");
|
||||
bus2Spin->setValue(100.0f);
|
||||
|
||||
panSpin = new ClickableDoubleSpinBox(this);
|
||||
panSpin->setRange(-1, 1);
|
||||
panSpin->setToolTip("Pan");
|
||||
panSpin->setValue(0);
|
||||
|
||||
pitchSpin = new ClickableDoubleSpinBox(this);
|
||||
pitchSpin->setRange(0, 2);
|
||||
pitchSpin->setSpecialValueText("Stop");
|
||||
pitchSpin->setToolTip("Pitch");
|
||||
pitchSpin->setValue(1);
|
||||
|
||||
entryPointSpin = new QSpinBox(this);
|
||||
entryPointSpin->setRange(0, 255);
|
||||
entryPointSpin->setToolTip("Entry Point");
|
||||
|
||||
exitPointSpin = new QSpinBox(this);
|
||||
exitPointSpin->setRange(0, 255);
|
||||
exitPointSpin->setToolTip("Exit Point");
|
||||
exitPointSpin->setValue(255);
|
||||
|
||||
setupStatusCombo();
|
||||
statusCombo->setToolTip("Playback Status");
|
||||
row->addWidget(userNumberSpin);
|
||||
|
||||
fadeInSpin = new QSpinBox(this);
|
||||
fadeInSpin->setRange(0, 10000);
|
||||
fadeInSpin->setToolTip("Fade In Time");
|
||||
fadeInSpin->setValue(3);
|
||||
|
||||
fadeOutSpin = new QSpinBox(this);
|
||||
fadeOutSpin->setRange(0, 10000);
|
||||
fadeOutSpin->setToolTip("Fade Out Time");
|
||||
fadeOutSpin->setValue(3);
|
||||
|
||||
waitInSpin = new QSpinBox(this);
|
||||
waitInSpin->setRange(0, 10000);
|
||||
waitInSpin->setToolTip("Wait In Time");
|
||||
|
||||
waitOutSpin = new QSpinBox(this);
|
||||
waitOutSpin->setRange(0, 10000);
|
||||
waitOutSpin->setToolTip("Wait Out Time");
|
||||
|
||||
stopAtEndCheck = new QCheckBox(this);
|
||||
stopAtEndCheck->setToolTip("Halt");
|
||||
stopAtEndCheck->setChecked("True");
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void CueTrackWidget::setStyle(bool highlight) {
|
||||
QString style;
|
||||
|
||||
style.append("margin: 1px;");
|
||||
if (highlight)
|
||||
style.append("background-color: #e8e0f8;");
|
||||
else
|
||||
style.append("background-color: #b9b8a7;");
|
||||
this->setStyleSheet(style);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void CueTrackWidget::loadCueTrack(const CueTrack &cueTrack) {
|
||||
filePathEdit->setText(QString::fromStdString(cueTrack.filePath));
|
||||
volumeSpin->setValue(cueTrack.volume);
|
||||
panSpin->setValue(cueTrack.pan);
|
||||
pitchSpin->setValue(cueTrack.pitch);
|
||||
bus1Spin->setValue(cueTrack.bus1);
|
||||
bus2Spin->setValue(cueTrack.bus2);
|
||||
fadeInSpin->setValue(cueTrack.fadeIn);
|
||||
fadeOutSpin->setValue(cueTrack.fadeOut);
|
||||
waitInSpin->setValue(cueTrack.waitIn);
|
||||
waitOutSpin->setValue(cueTrack.waitOut);
|
||||
stopAtEndCheck->setChecked(cueTrack.stopAtEnd);
|
||||
nameEdit->setText(QString::fromStdString(cueTrack.name));
|
||||
descriptionEdit->setText(QString::fromStdString(cueTrack.description));
|
||||
userNumberSpin->setValue(cueTrack.userNumber);
|
||||
entryPointSpin->setValue(cueTrack.entryPoint);
|
||||
exitPointSpin->setValue(cueTrack.exitPoint);
|
||||
statusCombo->setCurrentIndex(statusCombo->findData(cueTrack.status));
|
||||
}
|
||||
|
||||
CueTrack CueTrackWidget::saveCueTrack() const {
|
||||
CueTrack cueTrack;
|
||||
cueTrack.filePath = filePathEdit->text().toStdString();
|
||||
cueTrack.volume = volumeSpin->value();
|
||||
cueTrack.pan = panSpin->value();
|
||||
cueTrack.pitch = pitchSpin->value();
|
||||
cueTrack.bus1 = bus1Spin->value();
|
||||
cueTrack.bus2 = bus2Spin->value();
|
||||
cueTrack.fadeIn = fadeInSpin->value();
|
||||
cueTrack.fadeOut = fadeOutSpin->value();
|
||||
cueTrack.waitIn = waitInSpin->value();
|
||||
cueTrack.waitOut = waitOutSpin->value();
|
||||
cueTrack.stopAtEnd = stopAtEndCheck->isChecked();
|
||||
cueTrack.name = nameEdit->text().toStdString();
|
||||
cueTrack.description = descriptionEdit->text().toStdString();
|
||||
cueTrack.userNumber = userNumberSpin->value();
|
||||
cueTrack.entryPoint = entryPointSpin->value();
|
||||
cueTrack.exitPoint = exitPointSpin->value();
|
||||
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());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue