more front work
This commit is contained in:
parent
9d79757a49
commit
2e76621616
9 changed files with 36 additions and 21 deletions
|
|
@ -184,6 +184,9 @@ ChannelWidget::ChannelWidget(uint32_t channelCount, EndpointHandler* eph, QWidge
|
|||
this->channelCount = channelCount;
|
||||
widgetLayout = new QGridLayout(this);
|
||||
float volume = 100;
|
||||
int left = 0, top = 0, right = 0, bottom = 0;
|
||||
widgetLayout->getContentsMargins(&left, &top, &right, &bottom);
|
||||
widgetLayout->setContentsMargins(0, top, 0, bottom);
|
||||
|
||||
/*
|
||||
* Channel sliders setup
|
||||
|
|
@ -201,6 +204,8 @@ ChannelWidget::ChannelWidget(uint32_t channelCount, EndpointHandler* eph, QWidge
|
|||
tmp->setValue((int) volume);
|
||||
tmpLb->setText(QString::number(volume));
|
||||
//tmpLb->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
tmp->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
tmpLb->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
this->channelSliders.push_back(tmp);
|
||||
this->channelLabels.push_back(tmpLb);
|
||||
widgetLayout->addWidget(tmp, 0, i);
|
||||
|
|
@ -251,6 +256,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
muteButton = new QCheckBox(this);
|
||||
mainLabel = new QLabel(QString::fromStdWString(eph->getName()), this);
|
||||
mainSlider = new QSlider(Qt::Horizontal, this);
|
||||
mainVolumeLabel = new QLabel(this);
|
||||
|
||||
if (this->eph->getState() != EndpointState::ENDPOINT_ACTIVE) {
|
||||
widgetLayout->addWidget(mainLabel, row, 0);
|
||||
|
|
@ -258,12 +264,14 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
return;
|
||||
}
|
||||
|
||||
mainLabel->setMaximumWidth(240 /*1/8 1080p*/);
|
||||
mainLabel->setMinimumWidth(240 /*1/8 1080p*/);
|
||||
mainLabel->setMaximumWidth(350 /* 1080p 120%*/);
|
||||
mainLabel->setMinimumWidth(350 /* 1080p 120%*/);
|
||||
mainLabel->setWordWrap(true);
|
||||
mainLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
|
||||
//mainLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
|
||||
//muteButton->setStyleSheet("background-color: #A3C1DA; color: red");
|
||||
mainSlider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
|
||||
mainSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
mainSlider->setFocusPolicy(Qt::StrongFocus);
|
||||
mainSlider->setTickPosition(QSlider::TicksBothSides);
|
||||
mainSlider->setTickInterval(5);
|
||||
|
|
@ -274,15 +282,18 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
muteButton->setText(eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||
float volume = eph->getVolume(AudioChannel::CHANNEL_MAIN) * 100;
|
||||
mainSlider->setValue((int)volume);
|
||||
mainVolumeLabel->setText(QString::number(volume));
|
||||
log_debugcpp("ENDPOINT SET WITH VOLUME " + std::to_string(volume));
|
||||
|
||||
//tip: would need to be new widget with layout in it
|
||||
//mainMuteLayout = new QGridLayout();
|
||||
widgetLayout->addWidget(mainLabel, row, 0, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
widgetLayout->addWidget(muteButton, row, 1, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
widgetLayout->addWidget(mainSlider, row, 2, 1, 2, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
widgetLayout->addWidget(mainLabel, row, 0, 1, 3, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
widgetLayout->addWidget(muteButton, row, 2, Qt::AlignRight | Qt::AlignVCenter);
|
||||
widgetLayout->addWidget(mainVolumeLabel, row, 3, Qt::AlignRight | Qt::AlignVCenter);
|
||||
row++;
|
||||
|
||||
widgetLayout->addWidget(mainSlider, row, 0, 1, 4, Qt::AlignVCenter);
|
||||
//widgetLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
||||
//int debug2 = this->minimumWidth();
|
||||
row++;
|
||||
|
||||
//TODO:0 = mute and muted, change volume = unmuted are client side tricks = 2 callbacks, one for volume, one for mute state. Implement as an user selectable option?
|
||||
|
|
@ -303,7 +314,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
|
||||
/*
|
||||
* Role ExtendedCheckBoxes setup
|
||||
*/
|
||||
*/
|
||||
|
||||
uint8_t assignedRoles = eph->getRoles();
|
||||
defaultRolesCheckBoxes.at(Roles::ROLE_ALL)->setCheckState(assignedRoles == Roles::ROLE_ALL ? Qt::Checked : Qt::Unchecked);
|
||||
|
|
@ -336,11 +347,16 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
connect(defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS), &QCheckBox::stateChanged,[this] {
|
||||
this->eph->setRoles(Roles::ROLE_COMMUNICATIONS);
|
||||
});
|
||||
|
||||
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_ALL), row, 0);
|
||||
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_CONSOLE), row, 1);
|
||||
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_MULTIMEDIA), row, 2);
|
||||
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS), row, 3);
|
||||
|
||||
defaultRolesCheckBoxes.at(Roles::ROLE_ALL)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_ALL),
|
||||
row, 0);
|
||||
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_CONSOLE),
|
||||
row, 1);
|
||||
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_MULTIMEDIA),
|
||||
row, 2);
|
||||
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS),
|
||||
row, 3);
|
||||
row++;
|
||||
|
||||
/* ----------------------------------------------------------- */
|
||||
|
|
@ -357,6 +373,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
mainSlider->blockSignals(true);
|
||||
muteButton->blockSignals(true);
|
||||
mainSlider->setValue((int)((eph->getCallbackInfo()->mainVolume + roundingFactor) * 100));
|
||||
mainVolumeLabel->setText(QString::number(mainSlider->value()));
|
||||
muteButton->setCheckState((eph->getCallbackInfo()->muted == false ? Qt::Unchecked : Qt::Checked));
|
||||
muteButton->setText(eph->getCallbackInfo()->muted ? STRING_UNMUTE : STRING_MUTE);
|
||||
for(uint32_t i = 0; i < eph->getCallbackInfo()->channels && eph->getChannelCount() > 1; i++){
|
||||
|
|
@ -501,6 +518,7 @@ void EndpointWidget::updateMute(int checked){
|
|||
}
|
||||
|
||||
void EndpointWidget::updateMainVolume(int newValue){
|
||||
mainVolumeLabel->setText(QString::number(newValue));
|
||||
this->eph->setVolume(osh->getGuid(), AudioChannel::CHANNEL_MAIN, newValue);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,8 @@ private:
|
|||
int row;
|
||||
const int sessionCol = 2;
|
||||
QCheckBox *muteButton = nullptr;
|
||||
QLabel *mainLabel = nullptr, *leftChannelLabel = nullptr, *rightChannelLabel = nullptr;
|
||||
QLabel *mainLabel = nullptr;
|
||||
QLabel *mainVolumeLabel = nullptr;
|
||||
QSlider *mainSlider = nullptr;
|
||||
std::vector<QSlider*> channelSliders;
|
||||
std::vector<QLabel*> channelLabels;
|
||||
|
|
|
|||
|
|
@ -59,13 +59,6 @@ int main (int argc, char* argv[]) {
|
|||
* QString styleSheet { QLatin1String(styleFile.readAll()) };
|
||||
*/
|
||||
|
||||
//app->setStyleSheet(styleSheet);
|
||||
/*
|
||||
* #ifdef DEBUG
|
||||
* window.calculateChildWidgetsSize();
|
||||
* window.show();
|
||||
* #endif
|
||||
*/
|
||||
return app->exec();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue