wip edit cues
This commit is contained in:
parent
333d7c7b49
commit
bd9b07f000
10 changed files with 318 additions and 168 deletions
|
@ -5,13 +5,5 @@
|
||||||
ClickableDoubleSpinBox::ClickableDoubleSpinBox(QWidget *parent)
|
ClickableDoubleSpinBox::ClickableDoubleSpinBox(QWidget *parent)
|
||||||
: QDoubleSpinBox(parent)
|
: QDoubleSpinBox(parent)
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::NoFocus);
|
|
||||||
setButtonSymbols(QAbstractSpinBox::NoButtons);
|
|
||||||
setValue(-1);
|
|
||||||
setDecimals(1);
|
|
||||||
setAlignment(Qt::AlignHCenter);
|
|
||||||
setContentsMargins(0, 0, 0, 0);
|
|
||||||
setMaximumWidth(66);
|
|
||||||
setMinimumWidth(25);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,20 @@ class ClickableDoubleSpinBox : public QDoubleSpinBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
bool active = false;
|
||||||
|
|
||||||
explicit ClickableDoubleSpinBox(QWidget *parent = nullptr);
|
explicit ClickableDoubleSpinBox(QWidget *parent = nullptr);
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent ( QMouseEvent * event ) {
|
void mousePressEvent ( QMouseEvent * event ) {
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
emit click();
|
emit click();
|
||||||
|
active = true;
|
||||||
|
//this->setBackgroundRole(QPalette::BrightText);
|
||||||
|
|
||||||
|
} else if (event->button() == Qt::RightButton) {
|
||||||
|
emit click();
|
||||||
|
active = false;
|
||||||
|
//this->setBackgroundRole(QPalette::Shadow);
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,9 @@ public:
|
||||||
void addCueTrackWidget(CueTrackWidget* widget) {
|
void addCueTrackWidget(CueTrackWidget* widget) {
|
||||||
widget->setParent(containerWidget);
|
widget->setParent(containerWidget);
|
||||||
layout->addWidget(widget);
|
layout->addWidget(widget);
|
||||||
widget->show();
|
if (m_size == 0)
|
||||||
|
widget->setStyle(true);
|
||||||
|
widget->show();
|
||||||
m_size++;
|
m_size++;
|
||||||
containerWidget->update();
|
containerWidget->update();
|
||||||
containerWidget->adjustSize();
|
containerWidget->adjustSize();
|
||||||
|
@ -76,17 +78,17 @@ private:
|
||||||
private slots:
|
private slots:
|
||||||
void key_up() {
|
void key_up() {
|
||||||
if (m_size > 0 && selectedIndex > 0) {
|
if (m_size > 0 && selectedIndex > 0) {
|
||||||
getTrackAtIndex(selectedIndex)->highlight(false);
|
getTrackAtIndex(selectedIndex)->setStyle(false);
|
||||||
selectedIndex--;
|
selectedIndex--;
|
||||||
getTrackAtIndex(selectedIndex)->highlight(true);
|
getTrackAtIndex(selectedIndex)->setStyle(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void key_down() {
|
void key_down() {
|
||||||
if (selectedIndex < m_size - 1 && m_size > 0) {
|
if (selectedIndex < m_size - 1 && m_size > 0) {
|
||||||
getTrackAtIndex(selectedIndex)->highlight(false);
|
getTrackAtIndex(selectedIndex)->setStyle(false);
|
||||||
selectedIndex++;
|
selectedIndex++;
|
||||||
getTrackAtIndex(selectedIndex)->highlight(true);
|
getTrackAtIndex(selectedIndex)->setStyle(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,152 +7,116 @@ CueTrackWidget::CueTrackWidget(QWidget *parent) : QWidget(parent) {
|
||||||
|
|
||||||
void CueTrackWidget::setupUi() {
|
void CueTrackWidget::setupUi() {
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QSplitter *row = new QSplitter(Qt::Horizontal);
|
QSplitter *row = new QSplitter(Qt::Horizontal);
|
||||||
|
|
||||||
active = new QCheckBox(this);
|
active = new QCheckBox(this);
|
||||||
row->addWidget(active);
|
row->addWidget(active);
|
||||||
|
|
||||||
userNumberSpin = new QSpinBox(this);
|
userNumberSpin = new QSpinBox(this);
|
||||||
userNumberSpin->setRange(0, 1000);
|
userNumberSpin->setRange(0, 100000);
|
||||||
userNumberSpin->setToolTip("Cue user number");
|
userNumberSpin->setToolTip("Cue user number");
|
||||||
row->addWidget(userNumberSpin);
|
row->addWidget(userNumberSpin);
|
||||||
|
|
||||||
|
audioLayer = new QSpinBox(this);
|
||||||
|
audioLayer->setRange(0, MAX_LAYERS);
|
||||||
|
audioLayer->setToolTip("Audio Layer");
|
||||||
|
row->addWidget(audioLayer);
|
||||||
|
|
||||||
nameEdit = new QLineEdit(this);
|
nameEdit = new QLineEdit(this);
|
||||||
nameEdit->setToolTip("Cue Name");
|
nameEdit->setToolTip("Cue Name");
|
||||||
row->addWidget(nameEdit);
|
row->addWidget(nameEdit);
|
||||||
|
|
||||||
descriptionEdit = new QLineEdit(this);
|
descriptionEdit = new QLineEdit(this);
|
||||||
descriptionEdit->setToolTip("Cue Notes");
|
descriptionEdit->setToolTip("Cue Notes");
|
||||||
row->addWidget(descriptionEdit);
|
|
||||||
|
|
||||||
filePathEdit = new QLineEdit(this);
|
filePathEdit = new QLineEdit(this);
|
||||||
filePathEdit->setToolTip("File name");
|
filePathEdit->setToolTip("File name");
|
||||||
row->addWidget(filePathEdit);
|
|
||||||
|
|
||||||
layout->addWidget(row);
|
volumeSpin = new ClickableDoubleSpinBox(this);
|
||||||
|
volumeSpin->setRange(0.0f, 100.0f);
|
||||||
row = new QSplitter(Qt::Horizontal);
|
|
||||||
volumeSpin = new QSpinBox(this);
|
|
||||||
volumeSpin->setRange(0, 65535);
|
|
||||||
volumeSpin->setToolTip("Volume");
|
volumeSpin->setToolTip("Volume");
|
||||||
volumeSpin->setValue(100);
|
volumeSpin->setSpecialValueText("-inf");
|
||||||
row->addWidget(volumeSpin);
|
volumeSpin->setValue(75.0f);
|
||||||
|
|
||||||
bus1Spin = new QSpinBox(this);
|
bus1Spin = new ClickableDoubleSpinBox(this);
|
||||||
bus1Spin->setRange(0, 255);
|
bus1Spin->setRange(0.0f, 100.0f);
|
||||||
bus1Spin->setToolTip("Bus 1");
|
bus1Spin->setToolTip("Bus 1");
|
||||||
bus1Spin->setValue(255);
|
bus1Spin->setSpecialValueText("-inf");
|
||||||
row->addWidget(bus1Spin);
|
bus1Spin->setValue(100.0f);
|
||||||
|
|
||||||
bus2Spin = new QSpinBox(this);
|
bus2Spin = new ClickableDoubleSpinBox(this);
|
||||||
bus2Spin->setRange(0, 255);
|
bus2Spin->setRange(0.0f, 100.0f);
|
||||||
bus2Spin->setToolTip("Bus 2");
|
bus2Spin->setToolTip("Bus 2");
|
||||||
bus2Spin->setValue(255);
|
bus2Spin->setSpecialValueText("-inf");
|
||||||
row->addWidget(bus2Spin);
|
bus2Spin->setValue(100.0f);
|
||||||
|
|
||||||
panSpin = new QSpinBox(this);
|
panSpin = new ClickableDoubleSpinBox(this);
|
||||||
panSpin->setRange(0, 255);
|
panSpin->setRange(-1, 1);
|
||||||
panSpin->setToolTip("Pan");
|
panSpin->setToolTip("Pan");
|
||||||
panSpin->setValue(128);
|
panSpin->setValue(0);
|
||||||
row->addWidget(panSpin);
|
|
||||||
|
|
||||||
pitchSpin = new QSpinBox(this);
|
pitchSpin = new ClickableDoubleSpinBox(this);
|
||||||
pitchSpin->setRange(0, 255);
|
pitchSpin->setRange(0, 2);
|
||||||
|
pitchSpin->setSpecialValueText("Stop");
|
||||||
pitchSpin->setToolTip("Pitch");
|
pitchSpin->setToolTip("Pitch");
|
||||||
pitchSpin->setValue(128);
|
pitchSpin->setValue(1);
|
||||||
row->addWidget(pitchSpin);
|
|
||||||
|
|
||||||
entryPointSpin = new QSpinBox(this);
|
entryPointSpin = new QSpinBox(this);
|
||||||
entryPointSpin->setRange(0, 255);
|
entryPointSpin->setRange(0, 255);
|
||||||
entryPointSpin->setToolTip("Entry Point");
|
entryPointSpin->setToolTip("Entry Point");
|
||||||
row->addWidget(entryPointSpin);
|
|
||||||
|
|
||||||
exitPointSpin = new QSpinBox(this);
|
exitPointSpin = new QSpinBox(this);
|
||||||
exitPointSpin->setRange(0, 255);
|
exitPointSpin->setRange(0, 255);
|
||||||
exitPointSpin->setToolTip("Exit Point");
|
exitPointSpin->setToolTip("Exit Point");
|
||||||
exitPointSpin->setValue(255);
|
exitPointSpin->setValue(255);
|
||||||
row->addWidget(exitPointSpin);
|
|
||||||
|
|
||||||
layout->addWidget(row);
|
|
||||||
|
|
||||||
row = new QSplitter(Qt::Horizontal);
|
|
||||||
setupStatusCombo();
|
setupStatusCombo();
|
||||||
statusCombo->setToolTip("Playback Status");
|
statusCombo->setToolTip("Playback Status");
|
||||||
row->addWidget(statusCombo);
|
row->addWidget(userNumberSpin);
|
||||||
|
|
||||||
fadeInSpin = new QSpinBox(this);
|
fadeInSpin = new QSpinBox(this);
|
||||||
fadeInSpin->setRange(0, 10000);
|
fadeInSpin->setRange(0, 10000);
|
||||||
fadeInSpin->setToolTip("Fade In Time");
|
fadeInSpin->setToolTip("Fade In Time");
|
||||||
fadeInSpin->setValue(3);
|
fadeInSpin->setValue(3);
|
||||||
row->addWidget(fadeInSpin);
|
|
||||||
|
|
||||||
fadeOutSpin = new QSpinBox(this);
|
fadeOutSpin = new QSpinBox(this);
|
||||||
fadeOutSpin->setRange(0, 10000);
|
fadeOutSpin->setRange(0, 10000);
|
||||||
fadeOutSpin->setToolTip("Fade Out Time");
|
fadeOutSpin->setToolTip("Fade Out Time");
|
||||||
fadeOutSpin->setValue(3);
|
fadeOutSpin->setValue(3);
|
||||||
row->addWidget(fadeOutSpin);
|
|
||||||
|
|
||||||
waitInSpin = new QSpinBox(this);
|
waitInSpin = new QSpinBox(this);
|
||||||
waitInSpin->setRange(0, 10000);
|
waitInSpin->setRange(0, 10000);
|
||||||
waitInSpin->setToolTip("Wait In Time");
|
waitInSpin->setToolTip("Wait In Time");
|
||||||
row->addWidget(waitInSpin);
|
|
||||||
|
|
||||||
waitOutSpin = new QSpinBox(this);
|
waitOutSpin = new QSpinBox(this);
|
||||||
waitOutSpin->setRange(0, 10000);
|
waitOutSpin->setRange(0, 10000);
|
||||||
waitOutSpin->setToolTip("Wait Out Time");
|
waitOutSpin->setToolTip("Wait Out Time");
|
||||||
row->addWidget(waitOutSpin);
|
|
||||||
|
|
||||||
stopAtEndCheck = new QCheckBox(this);
|
stopAtEndCheck = new QCheckBox(this);
|
||||||
stopAtEndCheck->setToolTip("Halt");
|
stopAtEndCheck->setToolTip("Halt");
|
||||||
stopAtEndCheck->setChecked("True");
|
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);
|
layout->addWidget(row);
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
setStyle(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *CueTrackWidget::createHeader()
|
void CueTrackWidget::setStyle(bool highlight) {
|
||||||
{
|
QString style;
|
||||||
QWidget *ret = new QWidget();
|
|
||||||
|
|
||||||
auto layout = new QHBoxLayout(this);
|
style.append("margin: 1px;");
|
||||||
QLabel *l = new QLabel("Cue Number");
|
if (highlight)
|
||||||
layout->addWidget(l);
|
style.append("background-color: #e8e0f8;");
|
||||||
l = new QLabel("File Path");
|
else
|
||||||
layout->addWidget(l);
|
style.append("background-color: #b9b8a7;");
|
||||||
l = new QLabel("Volume");
|
this->setStyleSheet(style);
|
||||||
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() {
|
void CueTrackWidget::setupStatusCombo() {
|
||||||
|
@ -208,3 +172,11 @@ CueTrack CueTrackWidget::saveCueTrack() const {
|
||||||
cueTrack.status = static_cast<Status>(statusCombo->currentData().toInt());
|
cueTrack.status = static_cast<Status>(statusCombo->currentData().toInt());
|
||||||
return cueTrack;
|
return cueTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CueTrackWidget::editButtonClicked() {
|
||||||
|
EditCueTrackWidget editor;
|
||||||
|
editor.loadCueTrack(saveCueTrack());
|
||||||
|
if (editor.exec() == QDialog::Accepted) {
|
||||||
|
loadCueTrack(editor.saveCueTrack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,24 +8,23 @@
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QDialog>
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "clickabledoublespinbox.h"
|
||||||
|
|
||||||
class CueTrackWidget : public QWidget {
|
class CueTrackWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int audioLayer = 0;
|
|
||||||
|
|
||||||
explicit CueTrackWidget(QWidget *parent = nullptr);
|
explicit CueTrackWidget(QWidget *parent = nullptr);
|
||||||
CueTrack saveCueTrack() const;
|
CueTrack saveCueTrack() const;
|
||||||
void loadCueTrack(const CueTrack &cueTrack);
|
void loadCueTrack(const CueTrack &cueTrack);
|
||||||
QWidget *createHeader();
|
int getVolume() const { return volumeSpin->value() * 2.55f * 255.0f; }
|
||||||
|
int getPan() const { return (panSpin->value() * 128) + 128; }
|
||||||
int getVolume() const { return volumeSpin->value(); }
|
int getPitch() const { return pitchSpin->value() * 128; }
|
||||||
int getPan() const { return panSpin->value(); }
|
int getBus1() const { return bus1Spin->value() * 2.55f * 255.0f; }
|
||||||
int getPitch() const { return pitchSpin->value(); }
|
int getBus2() const { return bus2Spin->value() * 2.55f * 255.0f; }
|
||||||
int getBus1() const { return bus1Spin->value(); }
|
|
||||||
int getBus2() const { return bus2Spin->value(); }
|
|
||||||
Status getStatus() const { return static_cast<Status>(statusCombo->currentIndex()); }
|
Status getStatus() const { return static_cast<Status>(statusCombo->currentIndex()); }
|
||||||
QString getFilePath() const { return filePathEdit->text(); }
|
QString getFilePath() const { return filePathEdit->text(); }
|
||||||
void setFilePath(QString text) const { filePathEdit->setText(text);};
|
void setFilePath(QString text) const { filePathEdit->setText(text);};
|
||||||
|
@ -39,18 +38,16 @@ public:
|
||||||
int getUserNumber() const { return userNumberSpin->value(); }
|
int getUserNumber() const { return userNumberSpin->value(); }
|
||||||
int getEntryPoint() const { return entryPointSpin->value(); }
|
int getEntryPoint() const { return entryPointSpin->value(); }
|
||||||
int getExitPoint() const { return exitPointSpin->value(); }
|
int getExitPoint() const { return exitPointSpin->value(); }
|
||||||
void highlight(bool highlight) {
|
void setStyle(bool highlight);
|
||||||
if (highlight) this->setStyleSheet("background-color: yellow;");
|
|
||||||
else this->setStyleSheet("background-color: white;");
|
|
||||||
}
|
|
||||||
|
|
||||||
QCheckBox* active;
|
QCheckBox* active;
|
||||||
|
QSpinBox* audioLayer;
|
||||||
QLineEdit* filePathEdit;
|
QLineEdit* filePathEdit;
|
||||||
QSpinBox* volumeSpin;
|
ClickableDoubleSpinBox* volumeSpin;
|
||||||
QSpinBox* panSpin;
|
ClickableDoubleSpinBox* panSpin;
|
||||||
QSpinBox* pitchSpin;
|
ClickableDoubleSpinBox* pitchSpin;
|
||||||
QSpinBox* bus1Spin;
|
ClickableDoubleSpinBox* bus1Spin;
|
||||||
QSpinBox* bus2Spin;
|
ClickableDoubleSpinBox* bus2Spin;
|
||||||
QComboBox* statusCombo;
|
QComboBox* statusCombo;
|
||||||
QSpinBox* fadeOutSpin;
|
QSpinBox* fadeOutSpin;
|
||||||
QSpinBox* fadeInSpin;
|
QSpinBox* fadeInSpin;
|
||||||
|
@ -62,10 +59,171 @@ public:
|
||||||
QSpinBox* userNumberSpin;
|
QSpinBox* userNumberSpin;
|
||||||
QSpinBox* entryPointSpin;
|
QSpinBox* entryPointSpin;
|
||||||
QSpinBox* exitPointSpin;
|
QSpinBox* exitPointSpin;
|
||||||
|
QPushButton* editButton;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupUi();
|
void setupUi();
|
||||||
void setupStatusCombo();
|
void setupStatusCombo();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void editButtonClicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Definición de la clase EditCueTrackWidget
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
class EditCueTrackWidget : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EditCueTrackWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
void loadCueTrack(const CueTrack &cueTrack);
|
||||||
|
CueTrack saveCueTrack() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupUi();
|
||||||
|
void connectSignals();
|
||||||
|
void onBrowseButtonClicked();
|
||||||
|
|
||||||
|
QLineEdit *filePathEdit;
|
||||||
|
QDoubleSpinBox *volumeSpin;
|
||||||
|
QDoubleSpinBox *panSpin;
|
||||||
|
QDoubleSpinBox *pitchSpin;
|
||||||
|
QDoubleSpinBox *bus1Spin;
|
||||||
|
QDoubleSpinBox *bus2Spin;
|
||||||
|
QSpinBox *fadeInSpin;
|
||||||
|
QSpinBox *fadeOutSpin;
|
||||||
|
QSpinBox *waitInSpin;
|
||||||
|
QSpinBox *waitOutSpin;
|
||||||
|
QCheckBox *stopAtEndCheck;
|
||||||
|
QLineEdit *nameEdit;
|
||||||
|
QLineEdit *descriptionEdit;
|
||||||
|
QSpinBox *userNumberSpin;
|
||||||
|
QSpinBox *entryPointSpin;
|
||||||
|
QSpinBox *exitPointSpin;
|
||||||
|
QComboBox *statusCombo;
|
||||||
|
QPushButton *browseButton;
|
||||||
|
QPushButton *saveButton;
|
||||||
|
QPushButton *cancelButton;
|
||||||
|
|
||||||
|
CueTrack currentCueTrack;
|
||||||
|
};
|
||||||
|
|
||||||
|
EditCueTrackWidget::EditCueTrackWidget(QWidget *parent) : QDialog(parent) {
|
||||||
|
setupUi();
|
||||||
|
connectSignals();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::setupUi() {
|
||||||
|
filePathEdit = new QLineEdit(this);
|
||||||
|
volumeSpin = new QDoubleSpinBox(this);
|
||||||
|
panSpin = new QDoubleSpinBox(this);
|
||||||
|
pitchSpin = new QDoubleSpinBox(this);
|
||||||
|
bus1Spin = new QDoubleSpinBox(this);
|
||||||
|
bus2Spin = new QDoubleSpinBox(this);
|
||||||
|
fadeInSpin = new QSpinBox(this);
|
||||||
|
fadeOutSpin = new QSpinBox(this);
|
||||||
|
waitInSpin = new QSpinBox(this);
|
||||||
|
waitOutSpin = new QSpinBox(this);
|
||||||
|
stopAtEndCheck = new QCheckBox(this);
|
||||||
|
nameEdit = new QLineEdit(this);
|
||||||
|
descriptionEdit = new QLineEdit(this);
|
||||||
|
userNumberSpin = new QSpinBox(this);
|
||||||
|
entryPointSpin = new QSpinBox(this);
|
||||||
|
exitPointSpin = new QSpinBox(this);
|
||||||
|
statusCombo = new QComboBox(this);
|
||||||
|
statusCombo->addItem("Stopped");
|
||||||
|
statusCombo->addItem("Paused");
|
||||||
|
statusCombo->addItem("PlayingOnce");
|
||||||
|
statusCombo->addItem("PlayingLoop");
|
||||||
|
statusCombo->addItem("Iddle");
|
||||||
|
statusCombo->addItem("PlayingFolder");
|
||||||
|
statusCombo->addItem("PlayingFolderLoop");
|
||||||
|
statusCombo->addItem("PlayingFolderRandom");
|
||||||
|
|
||||||
|
browseButton = new QPushButton("Browse...", this);
|
||||||
|
saveButton = new QPushButton("Save", this);
|
||||||
|
cancelButton = new QPushButton("Cancel", this);
|
||||||
|
|
||||||
|
QFormLayout *layout = new QFormLayout(this);
|
||||||
|
layout->addRow("User Number", userNumberSpin);
|
||||||
|
layout->addRow("Name", nameEdit);
|
||||||
|
layout->addRow("File Path", filePathEdit);
|
||||||
|
layout->addRow(browseButton);
|
||||||
|
layout->addRow("Status", statusCombo);
|
||||||
|
layout->addRow("Fade In", fadeInSpin);
|
||||||
|
layout->addRow("Fade Out", fadeOutSpin);
|
||||||
|
layout->addRow("Wait In", waitInSpin);
|
||||||
|
layout->addRow("Wait Out", waitOutSpin);
|
||||||
|
layout->addRow("Stop At End", stopAtEndCheck);
|
||||||
|
layout->addRow("Volume", volumeSpin);
|
||||||
|
layout->addRow("Bus 1", bus1Spin);
|
||||||
|
layout->addRow("Bus 2", bus2Spin);
|
||||||
|
layout->addRow("Pan", panSpin);
|
||||||
|
layout->addRow("Pitch", pitchSpin);
|
||||||
|
layout->addRow("Entry Point", entryPointSpin);
|
||||||
|
layout->addRow("Exit Point", exitPointSpin);
|
||||||
|
layout->addRow("Description", descriptionEdit);
|
||||||
|
layout->addRow(saveButton);
|
||||||
|
layout->addRow(cancelButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::loadCueTrack(const CueTrack &cueTrack) {
|
||||||
|
filePathEdit->setText(cueTrack.filePath.data());
|
||||||
|
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(cueTrack.name.data());
|
||||||
|
descriptionEdit->setText(cueTrack.description.data());
|
||||||
|
userNumberSpin->setValue(cueTrack.userNumber);
|
||||||
|
entryPointSpin->setValue(cueTrack.entryPoint);
|
||||||
|
exitPointSpin->setValue(cueTrack.exitPoint);
|
||||||
|
statusCombo->setCurrentIndex(statusCombo->findText(statusToString(cueTrack.status)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CueTrack EditCueTrackWidget::saveCueTrack() const {
|
||||||
|
CueTrack cueTrack;
|
||||||
|
cueTrack.filePath.append(filePathEdit->text().toUtf8().constData());
|
||||||
|
cueTrack.volume = volumeSpin->value();
|
||||||
|
cueTrack.pan = panSpin->value();
|
||||||
|
cueTrack.pitch = pitchSpin->value();
|
||||||
|
cueTrack.name.append(nameEdit->text().toUtf8().constData());
|
||||||
|
cueTrack.description.append(descriptionEdit->text().toUtf8().constData());
|
||||||
|
cueTrack.status = static_cast<Status>(statusCombo->currentIndex());
|
||||||
|
cueTrack.fadeIn = fadeInSpin->value();
|
||||||
|
cueTrack.fadeOut = fadeOutSpin->value();
|
||||||
|
cueTrack.waitIn = waitInSpin->value();
|
||||||
|
cueTrack.waitOut = waitOutSpin->value();
|
||||||
|
cueTrack.stopAtEnd = stopAtEndCheck->isChecked();
|
||||||
|
cueTrack.userNumber = userNumberSpin->value();
|
||||||
|
cueTrack.entryPoint = entryPointSpin->value();
|
||||||
|
cueTrack.exitPoint = exitPointSpin->value();
|
||||||
|
return cueTrack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::connectSignals() {
|
||||||
|
connect(saveButton, &QPushButton::clicked, this, &EditCueTrackWidget::accept);
|
||||||
|
connect(cancelButton, &QPushButton::clicked, this, &EditCueTrackWidget::reject);
|
||||||
|
connect(browseButton, &QPushButton::clicked, this, &EditCueTrackWidget::onBrowseButtonClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::onBrowseButtonClicked() {
|
||||||
|
QString filePath = QFileDialog::getOpenFileName(this, tr("Select File"), Settings::getInstance()->getPathMedia(), tr("Audio Files (*.mp3 *.wav *.flac)"));
|
||||||
|
if (!filePath.isEmpty()) {
|
||||||
|
filePathEdit->setText(filePath);
|
||||||
|
QDir dir;
|
||||||
|
Settings::getInstance()->setPathMedia(dir.absoluteFilePath(filePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CUETRACKWIDGET_H
|
#endif // CUETRACKWIDGET_H
|
||||||
|
|
|
@ -47,6 +47,14 @@ FilterBankWidget::FilterBankWidget(QWidget *parent)
|
||||||
} else {
|
} else {
|
||||||
fb[j]->setRange(-50, 50);
|
fb[j]->setRange(-50, 50);
|
||||||
}
|
}
|
||||||
|
fb[j]->setFocusPolicy(Qt::NoFocus);
|
||||||
|
fb[j]->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||||
|
fb[j]->setValue(-1);
|
||||||
|
fb[j]->setDecimals(1);
|
||||||
|
fb[j]->setAlignment(Qt::AlignHCenter);
|
||||||
|
fb[j]->setContentsMargins(0, 0, 0, 0);
|
||||||
|
fb[j]->setMaximumWidth(66);
|
||||||
|
fb[j]->setMinimumWidth(25);
|
||||||
filterLayout->insertWidget(j, fb[j]);
|
filterLayout->insertWidget(j, fb[j]);
|
||||||
}
|
}
|
||||||
filterLayout->setSpacing(0);
|
filterLayout->setSpacing(0);
|
||||||
|
|
|
@ -8,18 +8,21 @@ ShowPlayer::ShowPlayer(QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->addCueButton, SIGNAL(clicked()), this, SLOT(onAddTrack()));
|
connect(ui->addCueButton, SIGNAL(clicked()), this, SLOT(onAddTrack()));
|
||||||
connect(ui->goButton, SIGNAL(clicked()), this, SLOT(go()));
|
connect(ui->goButton, SIGNAL(clicked()), this, SLOT(go()));
|
||||||
currentTrackIndex = 0;
|
|
||||||
filesLoaded = 0;
|
filesLoaded = 0;
|
||||||
currentStatus = Status::Iddle;
|
currentStatus = Status::Iddle;
|
||||||
|
for(int i = 0; i < MAX_LAYERS; i++)
|
||||||
|
layersUsed[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowPlayer::~ShowPlayer() {}
|
ShowPlayer::~ShowPlayer() {}
|
||||||
|
|
||||||
void ShowPlayer::onAddTrack() {
|
void ShowPlayer::onAddTrack() {
|
||||||
TrackDialog dialog;
|
CueTrackWidget* track = new CueTrackWidget();
|
||||||
dialog.show();
|
EditCueTrackWidget editor;
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
editor.loadCueTrack(track->saveCueTrack());
|
||||||
ui->cueListWidget->addCueTrackWidget(dialog.track);
|
if (editor.exec() == QDialog::Accepted) {
|
||||||
|
track->loadCueTrack(editor.saveCueTrack());
|
||||||
|
ui->cueListWidget->addCueTrackWidget(track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,15 +31,25 @@ void ShowPlayer::go()
|
||||||
CueTrackWidget* current = ui->cueListWidget->getSelectedTrack();
|
CueTrackWidget* current = ui->cueListWidget->getSelectedTrack();
|
||||||
if (!current)
|
if (!current)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < MAX_LAYERS; i++) {
|
if (!current->getFilePath().isEmpty())
|
||||||
if (layersUsed[i] == -1) {
|
{
|
||||||
layersUsed[i] = currentTrackIndex;
|
for (int i = 0; i < MAX_LAYERS; i++) {
|
||||||
current->audioLayer = i;
|
if (layersUsed[i] == -1) {
|
||||||
break;
|
layersUsed[i] = current->userNumberSpin->value();
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
updateTrackStateInEngine(currentTrackIndex, current->audioLayer);
|
}
|
||||||
emit uiLoadMedia(current->audioLayer, current->getFilePath());
|
emit uiLoadMedia(current->audioLayer->value(), current->getFilePath());
|
||||||
emit uiPlaybackChanged(current->audioLayer, current->getStatus());
|
}
|
||||||
|
updateTrackStateInEngine(current);
|
||||||
|
emit uiPlaybackChanged(current->audioLayer->value(), current->getStatus());
|
||||||
filesLoaded++;
|
filesLoaded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShowPlayer::updateTrackStateInEngine(CueTrackWidget *track) {
|
||||||
|
emit uiSliderChanged(track->audioLayer->value(), Slider::Volume, track->getVolume());
|
||||||
|
emit uiSliderChanged(track->audioLayer->value(), Slider::Pan, track->getPan());
|
||||||
|
emit uiSliderChanged(track->audioLayer->value(), Slider::Pitch, track->getPitch());
|
||||||
|
emit uiSliderChanged(track->audioLayer->value(), Slider::Bus1, track->getBus1());
|
||||||
|
emit uiSliderChanged(track->audioLayer->value(), Slider::Bus2, track->getBus2());
|
||||||
|
};
|
||||||
|
|
|
@ -5,11 +5,13 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "cuetrackwidget.h"
|
#include "cuetrackwidget.h"
|
||||||
#include "cuetracklistwidget.h"
|
#include "cuetracklistwidget.h"
|
||||||
#include "trackdialog.h"
|
#include "trackdialog.h"
|
||||||
|
#include "settings.h"
|
||||||
#include "ui_showplayer.h"
|
#include "ui_showplayer.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -26,19 +28,11 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ShowPlayer *ui;
|
Ui::ShowPlayer *ui;
|
||||||
size_t currentTrackIndex;
|
|
||||||
Status currentStatus = Status::Iddle;
|
Status currentStatus = Status::Iddle;
|
||||||
size_t filesLoaded = 0;
|
size_t filesLoaded = 0;
|
||||||
int layersUsed[MAX_LAYERS] = { -1 };
|
int layersUsed[MAX_LAYERS];
|
||||||
|
|
||||||
void updateTrackStateInEngine(size_t index, int layer) {
|
void updateTrackStateInEngine(CueTrackWidget *track);
|
||||||
CueTrackWidget *track = ui->cueListWidget->getTrackAtIndex(index);
|
|
||||||
emit uiSliderChanged(layer, Slider::Volume, track->getVolume());
|
|
||||||
emit uiSliderChanged(layer, Slider::Pan, track->getPan());
|
|
||||||
emit uiSliderChanged(layer, Slider::Pitch, track->getPitch());
|
|
||||||
emit uiSliderChanged(layer, Slider::Bus1, track->getBus1());
|
|
||||||
emit uiSliderChanged(layer, Slider::Bus2, track->getBus2());
|
|
||||||
};
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAddTrack();
|
void onAddTrack();
|
||||||
|
|
|
@ -12,25 +12,27 @@ void TrackDialog::setupUi() {
|
||||||
browseButton = new QPushButton(tr("Buscar..."), this);
|
browseButton = new QPushButton(tr("Buscar..."), this);
|
||||||
|
|
||||||
QFormLayout *layout = new QFormLayout(this);
|
QFormLayout *layout = new QFormLayout(this);
|
||||||
track = new CueTrack();
|
//track = new CueTrackWidget();
|
||||||
layout->addRow(tr("&User number"), track->userNumber);
|
//track->editButtonClicked();
|
||||||
layout->addRow(tr("&Name"), track->name);
|
/* layout->addRow(tr("&User number"), track->userNumberSpin);
|
||||||
layout->addRow(tr("&Description"), track->description);
|
layout->addRow(tr("&Name"), track->nameEdit);
|
||||||
layout->addRow(tr("&File"), track->filePath);
|
layout->addRow(tr("&Description"), track->descriptionEdit);
|
||||||
layout->addRow(tr("&Browse files"), browseButton);
|
layout->addRow(tr("&File"), track->filePathEdit);
|
||||||
layout->addRow(tr("&Status"), track->status);
|
layout->addRow(tr("&Status"), track->statusCombo);
|
||||||
layout->addRow(tr("&Fade in"), track->fadeIn);
|
layout->addRow(tr("&Fade in"), track->fadeInSpin);
|
||||||
layout->addRow(tr("Fade &Out"), track->fadeOut);
|
layout->addRow(tr("Fade &Out"), track->fadeOutSpin);
|
||||||
layout->addRow(tr("&Wait In"), track->waitIn);
|
layout->addRow(tr("&Wait In"), track->waitInSpin);
|
||||||
layout->addRow(tr("&Wait Ou&t"), track->waitOut);
|
layout->addRow(tr("&Wait Ou&t"), track->waitOutSpin);
|
||||||
layout->addRow(tr("Sto&p at end"), track->stopAtEnd);
|
layout->addRow(tr("Sto&p at end"), track->stopAtEndCheck);
|
||||||
layout->addRow(tr("&Volume"), track->volume);
|
layout->addRow(tr("&Volume"), track->volumeSpin);
|
||||||
layout->addRow(tr("pan"), track->pan);
|
layout->addRow(tr("pan"), track->panSpin);
|
||||||
layout->addRow(tr("pitch"), track->pitch);
|
layout->addRow(tr("pitch"), track->pitchSpin);
|
||||||
layout->addRow(tr("Bus&1"), track->bus1);
|
layout->addRow(tr("Bus&1"), track->bus1Spin);
|
||||||
layout->addRow(tr("Bus&2"), track->bus2);
|
layout->addRow(tr("Bus&2"), track->bus2Spin);
|
||||||
layout->addRow(tr("&Entry Point"), track->entryPoint);
|
layout->addRow(tr("&Entry Point"), track->entryPointSpin);
|
||||||
layout->addRow(tr("E&xit Point"), track->exitPoint);
|
layout->addRow(tr("E&xit Point"), track->exitPointSpin);*/
|
||||||
|
//layout->addRow(tr("&Browse files"), browseButton);
|
||||||
|
//layout->addWidget(track);
|
||||||
layout->addWidget(okButton);
|
layout->addWidget(okButton);
|
||||||
layout->addWidget(cancelButton);
|
layout->addWidget(cancelButton);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
@ -39,7 +41,7 @@ void TrackDialog::setupUi() {
|
||||||
void TrackDialog::connectSignals() {
|
void TrackDialog::connectSignals() {
|
||||||
connect(okButton, &QPushButton::clicked, this, &TrackDialog::accept);
|
connect(okButton, &QPushButton::clicked, this, &TrackDialog::accept);
|
||||||
connect(cancelButton, &QPushButton::clicked, this, &TrackDialog::reject);
|
connect(cancelButton, &QPushButton::clicked, this, &TrackDialog::reject);
|
||||||
connect(browseButton, &QPushButton::clicked, this, &TrackDialog::browseFiles);
|
//connect(browseButton, &QPushButton::clicked, this, &TrackDialog::browseFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrackDialog::browseFiles() const {
|
QString TrackDialog::browseFiles() const {
|
||||||
|
@ -50,7 +52,7 @@ QString TrackDialog::browseFiles() const {
|
||||||
tr("Archivos de audio (*.mp3 *.wav *.flac);;Todos los archivos (*)")
|
tr("Archivos de audio (*.mp3 *.wav *.flac);;Todos los archivos (*)")
|
||||||
);
|
);
|
||||||
if (!filePath.isEmpty()) {
|
if (!filePath.isEmpty()) {
|
||||||
track->setFilePath(filePath);
|
track->setFilePath(filePath);
|
||||||
QDir dir;
|
QDir dir;
|
||||||
Settings::getInstance()->setPathMedia(dir.absoluteFilePath(filePath));
|
Settings::getInstance()->setPathMedia(dir.absoluteFilePath(filePath));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TrackDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CueTrack *track;
|
CueTrackWidget *track;
|
||||||
|
|
||||||
explicit TrackDialog(QWidget *parent = nullptr);
|
explicit TrackDialog(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue