funcionando sin la parte de las settings.
This commit is contained in:
parent
b59cc92c5f
commit
8b5d9414d1
20 changed files with 239 additions and 343 deletions
|
|
@ -5,102 +5,61 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name, int layer):
|
|||
QGroupBox(parent)
|
||||
, m_layer(layer)
|
||||
, m_suspendResumeButton(0)
|
||||
, m_volumeIndicator(new QSpinBox)
|
||||
, m_panIndicator(new QSpinBox)
|
||||
, m_pitchIndicator(new QSpinBox)
|
||||
{
|
||||
this->setTitle(name);
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
QGridLayout *status = new QGridLayout;
|
||||
m_statusValue = new QLabel;
|
||||
status->addWidget(m_statusValue, 1, 1);
|
||||
m_folderValue = new QLabel;
|
||||
m_folderValue->setMaximumWidth(100);
|
||||
status->addWidget(m_folderValue, 0, 0);
|
||||
m_fileValue = new QLabel;
|
||||
m_fileValue->setMaximumWidth(100);
|
||||
status->addWidget(m_fileValue, 0, 2);
|
||||
layout->addLayout(status);
|
||||
|
||||
QGridLayout *volumeBox = new QGridLayout;
|
||||
m_volumeLabel = new QLabel;
|
||||
m_volumeLabel->setText(tr(VOLUME_LABEL));
|
||||
m_volumeSlider = new QSlider(Qt::Horizontal);
|
||||
m_volumeSlider->setMinimum(0);
|
||||
m_volumeSlider->setMaximum(100);
|
||||
m_volumeSlider->setSingleStep(1);
|
||||
m_volumeIndicator->setRange(0, 100);
|
||||
m_volumeIndicator->setValue(0);
|
||||
m_volumeIndicator->setMaximumWidth(40);
|
||||
m_volumeIndicator->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
volumeBox->addWidget(m_volumeLabel, 0, 0);
|
||||
volumeBox->addWidget(m_volumeSlider, 0, 1);
|
||||
volumeBox->addWidget(m_volumeIndicator, 0, 2);
|
||||
connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
||||
connect(m_volumeSlider, &QSlider::valueChanged, this, [=] () {
|
||||
m_volumeIndicator->setValue(m_volumeSlider->value());
|
||||
});
|
||||
m_panLabel = new QLabel;
|
||||
m_panLabel->setText("Pan");
|
||||
m_panSlider = new QSlider(Qt::Horizontal);
|
||||
m_panSlider->setMinimum(0);
|
||||
m_panSlider->setMaximum(255);
|
||||
m_panSlider->setSingleStep(1);
|
||||
m_panIndicator->setRange(0, 255);
|
||||
m_panIndicator->setValue(128);
|
||||
m_panIndicator->setMaximumWidth(40);
|
||||
m_panIndicator->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
connect(m_panSlider, &QSlider::valueChanged, this, [=] () {
|
||||
m_panIndicator->setValue(m_panSlider->value());
|
||||
});
|
||||
connect(m_panSlider, SIGNAL(valueChanged(int)), this, SLOT(panChanged(int)));
|
||||
volumeBox->addWidget(m_panLabel, 1, 0);
|
||||
volumeBox->addWidget(m_panSlider, 1, 1);
|
||||
volumeBox->addWidget(m_panIndicator, 1, 2);
|
||||
m_pitchLabel = new QLabel;
|
||||
m_pitchLabel->setText("Pitch");
|
||||
m_pitchSlider = new QSlider(Qt::Horizontal);
|
||||
m_pitchSlider->setMinimum(0);
|
||||
m_pitchSlider->setMaximum(255);
|
||||
m_pitchSlider->setSingleStep(1);
|
||||
m_pitchIndicator->setRange(0, 255);
|
||||
m_pitchIndicator->setValue(128);
|
||||
m_pitchIndicator->setMaximumWidth(40);
|
||||
m_pitchIndicator->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
connect(m_pitchSlider, &QSlider::valueChanged, this, [=] () {
|
||||
m_pitchIndicator->setValue(m_pitchSlider->value());
|
||||
});
|
||||
connect(m_pitchSlider, SIGNAL(valueChanged(int)), this, SLOT(pitchChanged(int)));
|
||||
volumeBox->addWidget(m_pitchLabel, 2, 0);
|
||||
volumeBox->addWidget(m_pitchSlider, 2, 1);
|
||||
volumeBox->addWidget(m_pitchIndicator, 2, 2);
|
||||
layout->addLayout(volumeBox);
|
||||
|
||||
QHBoxLayout *progressTime = new QHBoxLayout;
|
||||
m_progressTimeLabel = new QLabel;
|
||||
m_progressTimeLabel->setText(PROGRESS_TIME_LABEL);
|
||||
//m_progressTimeLabel = new QLabel;
|
||||
//m_progressTimeLabel->setText(PROGRESS_TIME_LABEL);
|
||||
//progressTime->addWidget(m_progressTimeLabel);
|
||||
m_progressTime = new QTimeEdit;
|
||||
m_progressTime->text();
|
||||
m_progressTime->setDisplayFormat("h:mm:ss:zzz");
|
||||
m_progressTime->setReadOnly(true);
|
||||
m_progressTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_progressTime->setMaximumWidth(100);
|
||||
progressTime->addWidget(m_progressTimeLabel);
|
||||
m_progressTime->setMaximumWidth(90);
|
||||
m_progressTime->setFocusPolicy(Qt::NoFocus);
|
||||
progressTime->addWidget(m_progressTime);
|
||||
m_totalTimeLabel = new QLabel;
|
||||
m_totalTimeLabel->setText(TOTAL_TIME_LABEL);
|
||||
//m_totalTimeLabel = new QLabel;
|
||||
//m_totalTimeLabel->setText(TOTAL_TIME_LABEL);
|
||||
//progressTime->addWidget(m_totalTimeLabel);
|
||||
m_totalTimeValue = new QTimeEdit;
|
||||
m_totalTimeValue->setDisplayFormat("h:mm:ss:zzz");
|
||||
m_totalTimeValue->setReadOnly(true);
|
||||
m_totalTimeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_totalTimeValue->setMaximumWidth(100);
|
||||
progressTime->addWidget(m_totalTimeLabel);
|
||||
m_totalTimeValue->setMaximumWidth(90);
|
||||
m_totalTimeValue->setFocusPolicy(Qt::NoFocus);
|
||||
progressTime->addWidget(m_totalTimeValue);
|
||||
layout->addLayout(progressTime);
|
||||
|
||||
m_progressSlider = new QSlider(Qt::Horizontal);
|
||||
m_progressSlider->setFocusPolicy(Qt::NoFocus);
|
||||
layout->addWidget(m_progressSlider);
|
||||
|
||||
QGridLayout *status = new QGridLayout;
|
||||
m_statusValue = new QLabel;
|
||||
status->addWidget(m_statusValue, 0, 0);
|
||||
m_folderValue = new QLabel;
|
||||
m_folderValue->setMaximumWidth(200);
|
||||
status->addWidget(m_folderValue, 1, 0);
|
||||
m_fileValue = new QLabel;
|
||||
m_fileValue->setMaximumWidth(200);
|
||||
status->addWidget(m_fileValue, 2, 0);
|
||||
layout->addLayout(status);
|
||||
|
||||
QHBoxLayout *volumeBox = new QHBoxLayout;
|
||||
m_volume = new SliderGroup("Vol", 0 , 100, NULL);
|
||||
volumeBox->addWidget(m_volume);
|
||||
connect(m_volume, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
||||
m_pan = new SliderGroup("Pan", 0 , 255, NULL);
|
||||
volumeBox->addWidget(m_pan);
|
||||
connect(m_pan, SIGNAL(valueChanged(int)), this, SLOT(panChanged(int)));
|
||||
m_pitch = new SliderGroup("Pitch", 0 , 255, NULL);
|
||||
volumeBox->addWidget(m_pitch);
|
||||
connect(m_pitch, SIGNAL(valueChanged(int)), this, SLOT(pitchChanged(int)));
|
||||
layout->addLayout(volumeBox);
|
||||
|
||||
m_suspendResumeButton = new QPushButton(this);
|
||||
m_suspendResumeButton->setText(tr(SUSPEND_LABEL));
|
||||
connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspendResume()));
|
||||
|
|
@ -149,26 +108,23 @@ void AudioLayerWidget::toggleSuspendResume()
|
|||
// from DMX signals
|
||||
void AudioLayerWidget::setVol(qreal vol)
|
||||
{
|
||||
m_volumeSlider->blockSignals(true);
|
||||
m_volumeSlider->setValue(vol);
|
||||
m_volumeIndicator->setValue(vol);
|
||||
m_volumeSlider->blockSignals(false);
|
||||
m_volume->blockSignals(true);
|
||||
m_volume->setValue(vol);
|
||||
m_volume->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPan(qreal pan)
|
||||
{
|
||||
m_panSlider->blockSignals(true);
|
||||
m_panSlider->setValue(pan);
|
||||
m_panIndicator->setValue(pan);
|
||||
m_panSlider->blockSignals(false);
|
||||
m_pan->blockSignals(true);
|
||||
m_pan->setValue(pan);
|
||||
m_pan->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPitch(qreal pitch)
|
||||
{
|
||||
m_pitchSlider->blockSignals(true);
|
||||
m_pitchSlider->setValue(pitch);
|
||||
m_pitchIndicator->setValue(pitch);
|
||||
m_pitchSlider->blockSignals(false);
|
||||
m_pitch->blockSignals(true);
|
||||
m_pitch->setValue(pitch);
|
||||
m_pitch->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::fileLoaded(QString file)
|
||||
|
|
@ -181,36 +137,35 @@ void AudioLayerWidget::fileLoaded(QString file)
|
|||
}
|
||||
}
|
||||
|
||||
QString AudioLayerWidget::getStatus()
|
||||
{
|
||||
QString tmp;
|
||||
switch (m_status) {
|
||||
case Status::Paused:
|
||||
tmp.append("Paused");
|
||||
break;
|
||||
case Status::PlayingLoop:
|
||||
tmp.append("Playing Loop");
|
||||
break;
|
||||
case Status::PlayingOnce:
|
||||
tmp.append("Playing one");
|
||||
break;
|
||||
case Status::Stopped:
|
||||
tmp.append("Stopped");
|
||||
break;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPlaybackStatus(Status status)
|
||||
{
|
||||
m_status = status;
|
||||
if (status == Status::Stopped)
|
||||
m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(0));
|
||||
QString tmp = this->getStatus();
|
||||
m_statusValue->blockSignals(true);
|
||||
m_suspendResumeButton->blockSignals(true);
|
||||
m_statusValue->setText(tmp);
|
||||
m_suspendResumeButton->setText(tmp);
|
||||
switch (m_status) {
|
||||
case Status::Paused:
|
||||
m_statusValue->setText("Pause");
|
||||
m_statusValue->setStyleSheet("QLabel { color : red; }");
|
||||
m_suspendResumeButton->setText("Pause");
|
||||
break;
|
||||
case Status::PlayingLoop:
|
||||
m_statusValue->setText("Play Loop");
|
||||
m_statusValue->setStyleSheet("QLabel { color : green; }");
|
||||
m_suspendResumeButton->setText("Play Loop");
|
||||
break;
|
||||
case Status::PlayingOnce:
|
||||
m_statusValue->setText("Play One");
|
||||
m_statusValue->setStyleSheet("QLabel { color : green; }");
|
||||
m_suspendResumeButton->setText("Play One");
|
||||
break;
|
||||
case Status::Stopped:
|
||||
m_statusValue->setText("Stop");
|
||||
m_statusValue->setStyleSheet("QLabel { color : red; }");
|
||||
m_suspendResumeButton->setText("Stop");
|
||||
break;
|
||||
}
|
||||
m_statusValue->blockSignals(false);
|
||||
m_suspendResumeButton->blockSignals(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue