first callback implemented; overload not working
This commit is contained in:
parent
f21619aa1f
commit
ad53af655b
6 changed files with 92 additions and 29 deletions
|
|
@ -1,5 +1,21 @@
|
|||
#include "qtclasses.h"
|
||||
|
||||
/*
|
||||
* ToggleButton::ToggleButton(QWidget *parent) : QAbstractButton(parent) {
|
||||
* this->setCheckable(true);
|
||||
* }
|
||||
*
|
||||
* ToggleButton::~ToggleButton(){
|
||||
*
|
||||
* }
|
||||
*
|
||||
* void ToggleButton::checkStateSet(){ }
|
||||
*
|
||||
* bool hitButton(const QPoint &pos) {
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(parent){
|
||||
this->eph = eph;
|
||||
layout = new QGridLayout();
|
||||
|
|
@ -7,7 +23,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
|||
log_debugcpp("olaW");
|
||||
if (parent == nullptr) { log_debugcpp("owo?"); }
|
||||
|
||||
muteButton = new QPushButton();
|
||||
muteButton = new QCheckBox();
|
||||
mainLabel = new QLabel(QString::fromStdWString(eph->getName()));
|
||||
leftChannelLabel = new QLabel("88");
|
||||
rightChannelLabel = new QLabel("77");
|
||||
|
|
@ -15,7 +31,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
|||
leftChannelSlider = new QSlider(Qt::Horizontal);
|
||||
rightChannelSlider = new QSlider(Qt::Horizontal);
|
||||
|
||||
muteButton->setStyleSheet("background-color: #A3C1DA; color: red");
|
||||
//muteButton->setStyleSheet("background-color: #A3C1DA; color: red");
|
||||
mainSlider->setFocusPolicy(Qt::StrongFocus);
|
||||
mainSlider->setTickPosition(QSlider::TicksBothSides);
|
||||
mainSlider->setTickInterval(5);
|
||||
|
|
@ -28,6 +44,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
|||
rightChannelSlider->setSingleStep(1);
|
||||
rightChannelSlider->setRange(0,100);
|
||||
|
||||
muteButton->setCheckState((eph->getMute() == false ? Qt::Unchecked : Qt::Checked));
|
||||
muteButton->setText(eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||
float volume = eph->getVolume(ENDPOINT_MASTER_VOLUME) * 100;
|
||||
mainSlider->setValue((int)volume);
|
||||
|
|
@ -51,16 +68,31 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
|||
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 3, 0);
|
||||
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 3, 1);
|
||||
|
||||
/*
|
||||
* connect(mainSlider, &QSlider::valueChanged, eph, &EndpointHandler::setValue);
|
||||
*/
|
||||
connect(mainSlider, &QSlider::valueChanged, [this](int newValue){this->eph->setValue(ENDPOINT_MASTER_VOLUME, newValue); });
|
||||
connect(leftChannelSlider, &QSlider::valueChanged, [this](int newValue){ this->eph->setValue(ENDPOINT_LEFT_CHANNEL_VOLUME, newValue); this->leftChannelLabel->setText(QString::number(newValue)); });
|
||||
connect(rightChannelSlider, &QSlider::valueChanged, [this](int newValue){ this->eph->setValue(ENDPOINT_RIGHT_CHANNEL_VOLUME, newValue); this->rightChannelLabel->setText(QString::number(newValue)); });
|
||||
connect(muteButton, &QPushButton::clicked, [this](bool clicked){ log_debugcpp("cliqui" << clicked << "cloqui"); this->eph->setMute(osh->getGuid()); this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE); });
|
||||
connect(muteButton, &QCheckBox::stateChanged, this, &EndpointWidget::updateMute);
|
||||
/*
|
||||
* connect(muteButton, &QPushButton::clicked, [this](bool clicked){ log_debugcpp("cliqui" << clicked << "cloqui"); this->eph->setMute(osh->getGuid()); this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE); });
|
||||
*/
|
||||
log_debugcpp("ENDPOINT_WIDGETED");
|
||||
}
|
||||
|
||||
void EndpointWidget::updateMuteC(bool muted){
|
||||
log_debugcpp("cliqui callboqui cloqui");
|
||||
this->eph->setMute(osh->getGuid(), muted);
|
||||
this->muteButton->setChecked(eph->getMute() ? true : false);
|
||||
this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||
}
|
||||
|
||||
void EndpointWidget::updateMute(int checked){
|
||||
log_debugcpp("cliqui slOtty cloqui");
|
||||
bool muted = (checked == 2 ? true : false);
|
||||
log_debugcpp("int: " << checked << " bool: " << muted);
|
||||
this->eph->setMute(osh->getGuid(), muted);
|
||||
//this->muteButton->setCheckState();
|
||||
this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||
}
|
||||
|
||||
void EndpointWidget::setIndex(uint64_t idx){
|
||||
this->idx = idx;
|
||||
|
|
@ -93,7 +125,7 @@ void MainWindow::reloadEndpointWidgets() {
|
|||
ews.push_back(epw);
|
||||
layout->addWidget(epw, i, 0);
|
||||
}
|
||||
//osh->setEndpointWidgets(ews);
|
||||
osh->setEndpointWidgets(ews);
|
||||
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), i, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue