Compare commits
No commits in common. "c7d77c30ab4afe40ea287cd99120de374b8cbdcf" and "dc8951776f418452138d3c9023d3df8a87804efb" have entirely different histories.
c7d77c30ab
...
dc8951776f
3 changed files with 8 additions and 92 deletions
|
|
@ -104,6 +104,7 @@ Session::Session(Endpoint* ep, IAudioSessionControl2* sessionControl, size_t idx
|
||||||
if (FAILED(sessionControl->QueryInterface(__uuidof(IAudioMeterInformation), (void**)&meterInformation))) { log_wdebugcpp(L"sPeakbros......"); };
|
if (FAILED(sessionControl->QueryInterface(__uuidof(IAudioMeterInformation), (void**)&meterInformation))) { log_wdebugcpp(L"sPeakbros......"); };
|
||||||
//meterInformation = (IAudioMeterInformation*)sessionControl;
|
//meterInformation = (IAudioMeterInformation*)sessionControl;
|
||||||
|
|
||||||
|
|
||||||
AudioSessionState msState;
|
AudioSessionState msState;
|
||||||
sessionControl->GetState(&msState);
|
sessionControl->GetState(&msState);
|
||||||
switch (msState) {
|
switch (msState) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include "qtclasses.h"
|
#include "qtclasses.h"
|
||||||
#define POLLING_RATE 2
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
CustomWidgetEvent<T>::CustomWidgetEvent(QEvent::Type type, T payload) : QEvent(type){
|
CustomWidgetEvent<T>::CustomWidgetEvent(QEvent::Type type, T payload) : QEvent(type){
|
||||||
|
|
@ -11,69 +10,6 @@ void MeterSlider::setPeakValue(float peakValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterSlider::paintEvent(QPaintEvent *event) {
|
void MeterSlider::paintEvent(QPaintEvent *event) {
|
||||||
QStyleOptionSlider sliderComplex = QStyleOptionSlider();
|
|
||||||
sliderComplex.initFrom(this);
|
|
||||||
/*
|
|
||||||
* sliderComplex.initFrom(this);
|
|
||||||
* sliderComplex.subControls = QStyle::SC_None;
|
|
||||||
* sliderComplex.activeSubControls = QStyle::SC_None;
|
|
||||||
* sliderComplex.orientation = this->orientation();
|
|
||||||
* sliderComplex.maximum = this->maximum();
|
|
||||||
* sliderComplex.minimum = this->minimum();
|
|
||||||
* sliderComplex.tickPosition = (QSlider::TickPosition)this->tickPosition();
|
|
||||||
* sliderComplex.tickInterval = this->tickInterval();
|
|
||||||
* sliderComplex.upsideDown = (this->orientation() == Qt::Horizontal) ?
|
|
||||||
* (this->invertedAppearance() != (sliderComplex.direction == Qt::RightToLeft))
|
|
||||||
* : (!this->invertedAppearance());
|
|
||||||
* sliderComplex.direction = Qt::LeftToRight; // we use the upsideDown option instead
|
|
||||||
* sliderComplex.sliderPosition = this->sliderPosition();
|
|
||||||
* sliderComplex.sliderValue = this->value();
|
|
||||||
* sliderComplex.singleStep = this->singleStep();
|
|
||||||
* sliderComplex.pageStep = this->pageStep();
|
|
||||||
* if (this->orientation() == Qt::Horizontal)
|
|
||||||
* sliderComplex.state |= QStyle::State_Horizontal;
|
|
||||||
*
|
|
||||||
* if (this->isSliderDown()) {
|
|
||||||
* sliderComplex.activeSubControls = QStyle::SC_SliderHandle;
|
|
||||||
* sliderComplex.state |= QStyle::State_Sunken;
|
|
||||||
* } else {
|
|
||||||
* sliderComplex.activeSubControls = QStyle::SC_SliderHandle;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* //sliderComplex.subControls = QStyle::SC_SliderGroove;
|
|
||||||
* if (this->tickPosition() != NoTicks) sliderComplex.subControls |= QStyle::SC_SliderTickmarks;
|
|
||||||
* QStylePainter p(this);
|
|
||||||
* p.drawComplexControl(QStyle::CC_Slider, sliderComplex);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* QStyleOptionSlider sliderComplex2 = QStyleOptionSlider();
|
|
||||||
* sliderComplex2.initFrom(this);
|
|
||||||
* sliderComplex2.orientation = this->orientation();
|
|
||||||
* sliderComplex2.maximum = this->maximum();
|
|
||||||
* sliderComplex2.minimum = this->minimum();
|
|
||||||
* sliderComplex2.tickPosition = (QSlider::TickPosition)this->tickPosition();
|
|
||||||
* sliderComplex2.tickInterval = this->tickInterval();
|
|
||||||
* sliderComplex2.upsideDown = (this->orientation() == Qt::Horizontal) ?
|
|
||||||
* (this->invertedAppearance() != (sliderComplex2.direction == Qt::RightToLeft))
|
|
||||||
* : (!this->invertedAppearance());
|
|
||||||
* sliderComplex2.subControls = QStyle::SC_SliderHandle;
|
|
||||||
* sliderComplex2.direction = Qt::LeftToRight; // we use the upsideDown option instead
|
|
||||||
* sliderComplex2.sliderPosition = this->sliderPosition();
|
|
||||||
* sliderComplex2.sliderValue = this->value();
|
|
||||||
* sliderComplex2.singleStep = this->singleStep();
|
|
||||||
* sliderComplex2.pageStep = this->pageStep();
|
|
||||||
* if (this->orientation() == Qt::Horizontal)
|
|
||||||
* sliderComplex2.state |= QStyle::State_Horizontal;
|
|
||||||
*
|
|
||||||
* if (this->isSliderDown()) {
|
|
||||||
* sliderComplex2.activeSubControls = QStyle::SC_SliderHandle;
|
|
||||||
* sliderComplex2.state |= QStyle::State_Sunken;
|
|
||||||
* } else {
|
|
||||||
* sliderComplex2.activeSubControls = QStyle::SC_SliderHandle;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Q_D(QSlider);
|
//Q_D(QSlider);
|
||||||
/*
|
/*
|
||||||
* QStylePainter p(this);
|
* QStylePainter p(this);
|
||||||
|
|
@ -86,9 +22,7 @@ void MeterSlider::paintEvent(QPaintEvent *event) {
|
||||||
*
|
*
|
||||||
* //p.drawComplexControl(QStyle::CC_Slider, opt);
|
* //p.drawComplexControl(QStyle::CC_Slider, opt);
|
||||||
*/
|
*/
|
||||||
//QSlider::paintEvent(event);
|
QSlider::paintEvent(event);
|
||||||
int left = 0, top = 0, right = 0, bottom = 0;
|
|
||||||
((QWidget*)parent())->layout()->getContentsMargins(&left, &top, &right, &bottom);
|
|
||||||
|
|
||||||
QStyle *style = QApplication::style();
|
QStyle *style = QApplication::style();
|
||||||
int lol = style->pixelMetric(QStyle::PM_SliderSpaceAvailable);
|
int lol = style->pixelMetric(QStyle::PM_SliderSpaceAvailable);
|
||||||
|
|
@ -98,29 +32,10 @@ void MeterSlider::paintEvent(QPaintEvent *event) {
|
||||||
painter.setClipping(false);
|
painter.setClipping(false);
|
||||||
painter.setCompositionMode(QPainter::CompositionMode::CompositionMode_Source);
|
painter.setCompositionMode(QPainter::CompositionMode::CompositionMode_Source);
|
||||||
float peakLength = (this->width() * (this->peakValue));
|
float peakLength = (this->width() * (this->peakValue));
|
||||||
double stepWidth = (double)this->width() * ((double)this->singleStep() / (this->maximum() - this->minimum()));
|
|
||||||
//Fusion seems to fuck around with bar's height and width
|
|
||||||
//const qreal dpr = painter->device()->devicePixelRatio();
|
//const qreal dpr = painter->device()->devicePixelRatio();
|
||||||
//QStyleOptionSlider sliderComplex = QStyleOptionSlider(); //slider.initFrom(this);
|
QStyleOptionSlider slider = QStyleOptionSlider();
|
||||||
QRect sliderSize = style->subControlRect(QStyle::CC_Slider, (QStyleOptionComplex*)&sliderComplex, QStyle::SC_SliderHandle);
|
QRect test = QApplication::style()->subControlRect(QStyle::CC_Slider, (QStyleOptionComplex*)&slider, QStyle::SC_SliderHandle);
|
||||||
int handleCenterPos = QStyle::sliderPositionFromValue(this->minimum(), this->maximum(), this->value(), this->width());
|
painter.fillRect(0, (this->height() / 2) - 3, (this->width() * (this->peakValue)), 4, Qt::green);
|
||||||
int unattenuatedPeakMeter = ((this->width() * this->peakValue) >= handleCenterPos - (sliderSize.width() / 2))
|
|
||||||
? this->width() - (sliderSize.width() / 2)
|
|
||||||
: this->width() * this->peakValue;
|
|
||||||
//QApplication::style()->subControlRect(QStyle::CC_Slider, (QStyleOptionComplex*)&slider, QStyle::SC_SliderHandle);
|
|
||||||
painter.fillRect(0, (this->height() / 2) - 3, this->width(),
|
|
||||||
4, Qt::white);
|
|
||||||
painter.fillRect(0, (this->height() / 2) - 3, this->width() * this->peakValue,
|
|
||||||
4, Qt::gray);
|
|
||||||
painter.fillRect(0, (this->height() / 2) - 3, (this->width() - ((this->maximum() - this->value()) * stepWidth)) * this->peakValue,
|
|
||||||
4, Qt::green);
|
|
||||||
// - ((this->maximum() - this->value()) * stepWidth))
|
|
||||||
//double ratio = ;
|
|
||||||
double handleShift = (double)((sliderSize.width() * ((double)(this->maximum() - this->value()) / 100)));
|
|
||||||
painter.fillRect((this->width() - ((this->maximum() - this->value()) * stepWidth)) - (sliderSize.width()) + handleShift,
|
|
||||||
top / 2, sliderSize.width(), sliderSize.height() - bottom, Qt::magenta);
|
|
||||||
//sliderComplex.subControls = QStyle::SC_SliderHandle;
|
|
||||||
//p.drawComplexControl(QStyle::CC_Slider, sliderComplex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtendedCheckBox::customEvent(QEvent* ev) {
|
void ExtendedCheckBox::customEvent(QEvent* ev) {
|
||||||
|
|
@ -345,7 +260,7 @@ SessionWidget::SessionWidget(uint64_t idx, SessionHandler* sh, QWidget *parent)
|
||||||
mainSlider->blockSignals(false);
|
mainSlider->blockSignals(false);
|
||||||
muteButton->blockSignals(false);
|
muteButton->blockSignals(false);
|
||||||
});
|
});
|
||||||
volumePoller->start(POLLING_RATE);
|
volumePoller->start(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionWidget::calculateSize(uint64_t width, uint64_t height) {
|
void SessionWidget::calculateSize(uint64_t width, uint64_t height) {
|
||||||
|
|
@ -592,7 +507,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent, uint64_t i
|
||||||
mainSlider->blockSignals(false);
|
mainSlider->blockSignals(false);
|
||||||
muteButton->blockSignals(false);
|
muteButton->blockSignals(false);
|
||||||
});
|
});
|
||||||
timer->start(POLLING_RATE);
|
timer->start(2);
|
||||||
|
|
||||||
/* First Widget batch */
|
/* First Widget batch */
|
||||||
for (size_t i = 0; i < eph->getSessionCount(); i++) {
|
for (size_t i = 0; i < eph->getSessionCount(); i++) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ int main (int argc, char* argv[]) {
|
||||||
* log_debugcpp(a.toStdString());
|
* log_debugcpp(a.toStdString());
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
//QApplication::setStyle("Fusion");
|
QApplication::setStyle("Fusion");
|
||||||
//Check if running
|
//Check if running
|
||||||
//https://stackoverflow.com/questions/48060989/qt-show-application-if-currently-running
|
//https://stackoverflow.com/questions/48060989/qt-show-application-if-currently-running
|
||||||
initialize_file_log();
|
initialize_file_log();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue