Basic scrollArea work, win32 sound controlpanel shortcut
This commit is contained in:
parent
40bee90610
commit
a373c706ac
12 changed files with 159 additions and 13 deletions
|
|
@ -6,7 +6,7 @@ CustomWidgetEvent<T>::CustomWidgetEvent(QEvent::Type type, T payload) : QEvent(t
|
|||
}
|
||||
|
||||
void ExtendedCheckBox::customEvent(QEvent* ev) {
|
||||
QEvent::Type tipo = ev->type();
|
||||
//QEvent::Type tipo = ev->type();
|
||||
if (ev->type() == (QEvent::Type)CustomQEvent::EndpointDefaultChange) {
|
||||
//todo: still prone to bugs; whack-a-mole to come
|
||||
ev->setAccepted(true);
|
||||
|
|
@ -56,6 +56,8 @@ SessionWidget::SessionWidget(uint64_t idx, SessionHandler* sh, QWidget *parent)
|
|||
layout->addWidget(muteButton, 0, 1, Qt::AlignLeft | Qt::AlignBottom);
|
||||
layout->addWidget(mainSlider, 0, 2, 1, 2);
|
||||
|
||||
layout->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
||||
|
||||
//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?
|
||||
connect<void(QSlider::*)(int), void(SessionWidget::*)(int)>(mainSlider, &QSlider::valueChanged, this,&SessionWidget::updateMainVolume);
|
||||
connect<void(QCheckBox::*)(int), void(SessionWidget::*)(int)>(muteButton, &QCheckBox::stateChanged, this, (&SessionWidget::updateMute));
|
||||
|
|
@ -108,6 +110,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
//todo: sussy
|
||||
this->eph->setState(EndpointState::ENDPOINT_ACTIVE, idx);
|
||||
|
||||
//setAttribute(Qt::WA_TranslucentBackground);
|
||||
layout = new QGridLayout(this);
|
||||
//this->setLayout(layout);
|
||||
log_debugcpp("epw main layout parent: " + std::to_string((intptr_t)(layout->parent())));
|
||||
|
|
@ -149,9 +152,11 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
|
||||
//tip: would need to be new widget with layout in it
|
||||
//mainMuteLayout = new QGridLayout();
|
||||
layout->addWidget(mainLabel, row, 0, Qt::AlignLeft | Qt::AlignBottom);
|
||||
layout->addWidget(muteButton, row, 1, Qt::AlignLeft | Qt::AlignBottom);
|
||||
layout->addWidget(mainSlider, row, 2, 1, 2);
|
||||
layout->addWidget(mainLabel, row, 0, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
layout->addWidget(muteButton, row, 1, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
layout->addWidget(mainSlider, row, 2, 1, 2, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
layout->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?
|
||||
|
|
@ -176,7 +181,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
tmpLb->setText(QString::number(volume));
|
||||
this->channelSliders.push_back(tmp);
|
||||
this->channelLabels.push_back(tmpLb);
|
||||
layout->addWidget(tmp, row + 1, i);
|
||||
layout->addWidget(tmp, row + 1, i);
|
||||
layout->addWidget(tmpLb, row + 2, i);
|
||||
|
||||
//TODO: check if there's a need to prevent deadlocks; probably this will eventually turn into its own func
|
||||
|
|
@ -263,7 +268,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
/* First SessionWidget batch */
|
||||
for (size_t i = 0; i < eph->getSessionCount(); i++) {
|
||||
SessionWidget* sessionWidget = new SessionWidget(i, eph->getSessionHandlers().at(i), this);
|
||||
layout->addWidget(sessionWidget, row, 4);
|
||||
layout->addWidget(sessionWidget, row, 1, 1, 4);
|
||||
row++;
|
||||
sessionWidgets.push_back(sessionWidget);
|
||||
eph->getSessionHandlers().at(i)->setFrontIndex(i);
|
||||
|
|
@ -290,7 +295,7 @@ void EndpointWidget::addSessionWidget(CustomWidgetEvent<SessionHandler*>* ev){
|
|||
uint64_t index = this->sessionWidgets.size();
|
||||
SessionWidget* sw = new SessionWidget(index, ev->payload, this);
|
||||
ev->payload->setFrontIndex(index);
|
||||
this->layout->addWidget(sw, row, 4);
|
||||
this->layout->addWidget(sw, row, 1, 1, 4);
|
||||
row++;
|
||||
sessionWidgets.push_back(sw);
|
||||
return;
|
||||
|
|
@ -326,7 +331,7 @@ EndpointWidget::~EndpointWidget() {
|
|||
}
|
||||
|
||||
void MainWindow::customEvent(QEvent* ev) {
|
||||
if (ev->type() == CustomQEvent::EndpointWidgetObsolete) {
|
||||
if (ev->type() == (QEvent::Type)CustomQEvent::EndpointWidgetObsolete) {
|
||||
ev->setAccepted(true);
|
||||
this->removeEndpointWidget((CustomWidgetEvent<uint64_t>*)ev);
|
||||
} else if (ev->type() == (QEvent::Type)CustomQEvent::EndpointWidgetCreated) {
|
||||
|
|
@ -448,6 +453,23 @@ std::map<Roles, ExtendedCheckBox*> EndpointWidget::getDefaultRolesWidgets() {
|
|||
return defaultRolesCheckBoxes;
|
||||
}
|
||||
|
||||
HeaderWidget::HeaderWidget(QWidget *parent) : QWidget(parent) {
|
||||
layout = new QGridLayout(this);
|
||||
QString text = "&" STRING_ABOUT;
|
||||
about = new QPushButton(text, this);
|
||||
#ifdef WIN32
|
||||
text = "&" STRING_CP;
|
||||
openCP = new QPushButton(text, this);
|
||||
connect(openCP, &QPushButton::clicked, [this](){ osh->openControlPanel(); });
|
||||
text = "&" STRING_STARTUP;
|
||||
startup = new QPushButton(text, this);
|
||||
|
||||
layout->addWidget(openCP , 0, 0);
|
||||
layout->addWidget(startup, 0, 1);
|
||||
#endif
|
||||
layout->addWidget(about , 0, 2);
|
||||
this->setLayout(layout);
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||
// setWindowState(Qt::WindowFullScreen);
|
||||
|
|
@ -459,7 +481,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
|||
QEvent::registerEventType(CustomQEvent::EndpointWidgetObsolete);
|
||||
QEvent::registerEventType(CustomQEvent::EndpointWidgetCreated);
|
||||
QEvent::registerEventType(CustomQEvent::EndpointDefaultChange);
|
||||
QEvent::registerEventType(CustomQEvent::SessionWidgetObsolete);
|
||||
QEvent::registerEventType(CustomQEvent::SessionWidgetCreated);
|
||||
|
||||
//setWindowFlags(Qt::FramelessWindowHint);
|
||||
//setParent(0); // Create TopLevel-Widget
|
||||
//setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
//setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
ewsUpdateTimer = new QTimer(this);
|
||||
widget = new QWidget();
|
||||
layout = new QGridLayout();
|
||||
|
|
@ -470,13 +498,34 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
|||
ewsUpdateTimer->setSingleShot(true);
|
||||
ewsUpdateTimer->setInterval(ewsUpdateTimerFrequency);
|
||||
connect(ewsUpdateTimer, &QTimer::timeout, this, &MainWindow::reorderEndpointWidgetCollection);
|
||||
//widget->setMinimumSize(QSize(300,300));
|
||||
widget->setLayout(layout);
|
||||
setCentralWidget(widget);
|
||||
/*
|
||||
* Scroll bar code
|
||||
*/
|
||||
scrollArea = new QScrollArea(this);
|
||||
scrollArea->setWidget(widget);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
scrollArea->setMinimumWidth(500);
|
||||
setCentralWidget(scrollArea);
|
||||
|
||||
/*
|
||||
* Menu bar code
|
||||
*/
|
||||
QMenuBar* menuBar = (this->menuBar)();
|
||||
hw = new HeaderWidget(this);
|
||||
menuBar->setCornerWidget(hw,Qt::TopLeftCorner);
|
||||
menuBar->show();
|
||||
this->setMenuBar(menuBar);
|
||||
|
||||
//setCentralWidget(widget);
|
||||
//layout->addWidget(pintas, 0, 0);
|
||||
setWindowTitle(STRING_TITLE);
|
||||
|
||||
reloadEndpointWidgets();
|
||||
|
||||
scrollArea->setMinimumWidth(ews.at(0)->minimumWidth());
|
||||
int debug = scrollArea->minimumWidth();
|
||||
/*
|
||||
* Tray Icon code
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue