mute city boton momento
This commit is contained in:
parent
eaa935fb39
commit
e42c2dd6c9
7 changed files with 50 additions and 7 deletions
|
|
@ -26,6 +26,15 @@ float Endpoint::getVolume(int channel){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Endpoint::getMute(){
|
||||||
|
BOOL mut;
|
||||||
|
if(FAILED(endpointVolume->GetMute(&mut))) { log_debugcpp("si"); }
|
||||||
|
log_debugcpp("back BOOL is " << mut);
|
||||||
|
bool mute = (bool)mut;
|
||||||
|
log_debugcpp("translate to bool " << mute);
|
||||||
|
return mute;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* float Endpoint::getLeftChannelVolume(){
|
* float Endpoint::getLeftChannelVolume(){
|
||||||
* float volume;
|
* float volume;
|
||||||
|
|
@ -49,6 +58,15 @@ void Endpoint::setVolume(int channel, float volume) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Endpoint::setMute() {
|
||||||
|
log_debugcpp("bool mute arrives as " << mut);
|
||||||
|
BOOL mut;
|
||||||
|
if(FAILED(endpointVolume->GetMute(&mut))) { log_debugcpp("si"); }
|
||||||
|
log_debugcpp("translate to BOOL as " << mute);
|
||||||
|
if(FAILED(endpointVolume->SetMute((mut == false ? 1 : 0), NULL))) { log_debugcpp("si"); };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Endpoint::~Endpoint(){
|
Endpoint::~Endpoint(){
|
||||||
log_debugcpp("cum");
|
log_debugcpp("cum");
|
||||||
free(friendlyName);
|
free(friendlyName);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,9 @@ class Endpoint {
|
||||||
void setVolume(int channel, float volume);
|
void setVolume(int channel, float volume);
|
||||||
/* float getLeftChannelVolume(); */
|
/* float getLeftChannelVolume(); */
|
||||||
/* float getRightChannelVolume(); */
|
/* float getRightChannelVolume(); */
|
||||||
float getVolume(int channel);
|
float getVolume(int channel);
|
||||||
|
void setMute();
|
||||||
|
bool getMute();
|
||||||
LPWSTR getName();
|
LPWSTR getName();
|
||||||
~Endpoint();
|
~Endpoint();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,12 @@ void EndpointHandler::setValue(int channel, int value){
|
||||||
else ept->setVolume(channel, (float)value / 100);
|
else ept->setVolume(channel, (float)value / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EndpointHandler::setMute(){
|
||||||
|
//Qt momento, de ahi el param?
|
||||||
|
log_debugcpp("kinda handling the muting tbh");
|
||||||
|
ept->setMute();
|
||||||
|
}
|
||||||
|
|
||||||
QString EndpointHandler::getName(){
|
QString EndpointHandler::getName(){
|
||||||
return eptName;
|
return eptName;
|
||||||
}
|
}
|
||||||
|
|
@ -23,6 +29,10 @@ float EndpointHandler::getVolume(int channel){
|
||||||
return ept->getVolume(channel);
|
return ept->getVolume(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EndpointHandler::getMute(){
|
||||||
|
return ept->getMute();
|
||||||
|
}
|
||||||
|
|
||||||
Overseer* OverseerHandler::getOverseer(){
|
Overseer* OverseerHandler::getOverseer(){
|
||||||
return &os;
|
return &os;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ public:
|
||||||
EndpointHandler(Endpoint *ept, QObject *parent = nullptr);
|
EndpointHandler(Endpoint *ept, QObject *parent = nullptr);
|
||||||
QString getName();
|
QString getName();
|
||||||
float getVolume(int channel);
|
float getVolume(int channel);
|
||||||
|
bool getMute();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Endpoint *ept;
|
Endpoint *ept;
|
||||||
|
|
@ -18,8 +19,7 @@ private:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setValue(int channel, int value);
|
void setValue(int channel, int value);
|
||||||
|
void setMute();
|
||||||
|
|
||||||
//signals:
|
//signals:
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,12 @@
|
||||||
#define ENDPOINT_MASTER_VOLUME -1
|
#define ENDPOINT_MASTER_VOLUME -1
|
||||||
#define ENDPOINT_LEFT_CHANNEL_VOLUME 0
|
#define ENDPOINT_LEFT_CHANNEL_VOLUME 0
|
||||||
#define ENDPOINT_RIGHT_CHANNEL_VOLUME 1
|
#define ENDPOINT_RIGHT_CHANNEL_VOLUME 1
|
||||||
|
|
||||||
|
#define STRING_MUTE "Mute"
|
||||||
|
#define STRING_UNMUTE "Unmute"
|
||||||
//INIT BACK
|
//INIT BACK
|
||||||
|
|
||||||
|
|
||||||
class OverseerHandler;
|
class OverseerHandler;
|
||||||
extern OverseerHandler *osh;
|
extern OverseerHandler *osh;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
||||||
log_debugcpp("olaW");
|
log_debugcpp("olaW");
|
||||||
if (parent == nullptr) { log_debugcpp("owo?"); }
|
if (parent == nullptr) { log_debugcpp("owo?"); }
|
||||||
|
|
||||||
|
muteButton = new QPushButton();
|
||||||
mainLabel = new QLabel(eph->getName());
|
mainLabel = new QLabel(eph->getName());
|
||||||
leftChannelLabel = new QLabel("88");
|
leftChannelLabel = new QLabel("88");
|
||||||
rightChannelLabel = new QLabel("77");
|
rightChannelLabel = new QLabel("77");
|
||||||
|
|
@ -15,9 +16,9 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
||||||
leftChannelSlider = new QSlider(Qt::Horizontal);
|
leftChannelSlider = new QSlider(Qt::Horizontal);
|
||||||
rightChannelSlider = new QSlider(Qt::Horizontal);
|
rightChannelSlider = new QSlider(Qt::Horizontal);
|
||||||
|
|
||||||
|
muteButton->setStyleSheet("background-color: #A3C1DA; color: red");
|
||||||
mainSlider->setFocusPolicy(Qt::StrongFocus);
|
mainSlider->setFocusPolicy(Qt::StrongFocus);
|
||||||
mainSlider->setTickPosition(QSlider::TicksBothSides);
|
mainSlider->setTickPosition(QSlider::TicksBothSides);
|
||||||
|
|
||||||
mainSlider->setTickInterval(5);
|
mainSlider->setTickInterval(5);
|
||||||
mainSlider->setSingleStep(1);
|
mainSlider->setSingleStep(1);
|
||||||
mainSlider->setRange(0,100);
|
mainSlider->setRange(0,100);
|
||||||
|
|
@ -27,7 +28,8 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
||||||
rightChannelSlider->setTickInterval(5);
|
rightChannelSlider->setTickInterval(5);
|
||||||
rightChannelSlider->setSingleStep(1);
|
rightChannelSlider->setSingleStep(1);
|
||||||
rightChannelSlider->setRange(0,100);
|
rightChannelSlider->setRange(0,100);
|
||||||
|
|
||||||
|
muteButton->setText(eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||||
float volume = eph->getVolume(ENDPOINT_MASTER_VOLUME) * 100;
|
float volume = eph->getVolume(ENDPOINT_MASTER_VOLUME) * 100;
|
||||||
mainSlider->setValue((int)volume);
|
mainSlider->setValue((int)volume);
|
||||||
volume = eph->getVolume(ENDPOINT_LEFT_CHANNEL_VOLUME) * 100;
|
volume = eph->getVolume(ENDPOINT_LEFT_CHANNEL_VOLUME) * 100;
|
||||||
|
|
@ -38,7 +40,10 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
||||||
rightChannelLabel->setText(QString::number(volume));
|
rightChannelLabel->setText(QString::number(volume));
|
||||||
log_debugcpp("ENDPOINT SET WITH VOLUME " << volume);
|
log_debugcpp("ENDPOINT SET WITH VOLUME " << volume);
|
||||||
|
|
||||||
layout->addWidget(mainLabel, 0, 0);
|
mainMuteLayout = new QGridLayout();
|
||||||
|
layout->addLayout(mainMuteLayout, 0, 0);
|
||||||
|
mainMuteLayout->addWidget(mainLabel, 0, 0);
|
||||||
|
mainMuteLayout->addWidget(muteButton, 0, 1);
|
||||||
layout->addWidget(mainSlider, 0, 1);
|
layout->addWidget(mainSlider, 0, 1);
|
||||||
layout->addWidget(leftChannelSlider, 1, 0);
|
layout->addWidget(leftChannelSlider, 1, 0);
|
||||||
layout->addWidget(leftChannelLabel, 2, 0);
|
layout->addWidget(leftChannelLabel, 2, 0);
|
||||||
|
|
@ -53,6 +58,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
||||||
connect(mainSlider, &QSlider::valueChanged, [this](int newValue){this->eph->setValue(ENDPOINT_MASTER_VOLUME, newValue); });
|
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(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(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(); this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE); });
|
||||||
log_debugcpp("ENDPOINT_WIDGETED");
|
log_debugcpp("ENDPOINT_WIDGETED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
#include <QPushButton>
|
||||||
#include "contclasses.h"
|
#include "contclasses.h"
|
||||||
//#include <Q>
|
//#include <Q>
|
||||||
//#include <QWidgets>
|
//#include <QWidgets>
|
||||||
|
|
@ -20,14 +21,16 @@ public:
|
||||||
EndpointWidget(EndpointHandler* eph, QWidget *parent = nullptr);
|
EndpointWidget(EndpointHandler* eph, QWidget *parent = nullptr);
|
||||||
//void populateEndpointWidget(EndpointHandler *eph);
|
//void populateEndpointWidget(EndpointHandler *eph);
|
||||||
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EndpointHandler* eph;
|
EndpointHandler* eph;
|
||||||
|
QPushButton *muteButton = nullptr;
|
||||||
QLabel *mainLabel = nullptr, *leftChannelLabel = nullptr, *rightChannelLabel = nullptr;
|
QLabel *mainLabel = nullptr, *leftChannelLabel = nullptr, *rightChannelLabel = nullptr;
|
||||||
QSlider *mainSlider = nullptr;
|
QSlider *mainSlider = nullptr;
|
||||||
QSlider *leftChannelSlider = nullptr;
|
QSlider *leftChannelSlider = nullptr;
|
||||||
QSlider *rightChannelSlider = nullptr;
|
QSlider *rightChannelSlider = nullptr;
|
||||||
QGridLayout *layout = nullptr;
|
QGridLayout *layout = nullptr;
|
||||||
|
QGridLayout *mainMuteLayout = nullptr;
|
||||||
//std::vector<EndpointHandler*> *ephs;
|
//std::vector<EndpointHandler*> *ephs;
|
||||||
//std::vector<QSlider> *sliders;
|
//std::vector<QSlider> *sliders;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue