fixed new endpoints not appering if UI open + no roles / deque

This commit is contained in:
Hane 2025-01-16 20:29:02 +01:00
commit 0a301fb9bf
4 changed files with 19 additions and 7 deletions

View file

@ -204,9 +204,16 @@ HRESULT EndpointSituationCallback::OnDefaultDeviceChanged(EDataFlow flow, ERole
} }
std::wstring wstringEndpointId = pwstrDeviceId; std::wstring wstringEndpointId = pwstrDeviceId;
log_wdebugcpp(L"we got za defol 4 " + wstringEndpointId); log_wdebugcpp(L"we got za defol 4 " + wstringEndpointId);
//APTTYPE aptType;
//APTTYPEQUALIFIER aptQualifier;
//CoGetApartmentType(
// &aptType,
// &aptQualifier
// );
//std::thread roleChangeThread(&OverseerHandler::roleBucketEntryCallback, this,
// nRole, wstringEndpointId);
//roleChangeThread.detach();
osh->roleBucketEntryCallback(nRole, wstringEndpointId); osh->roleBucketEntryCallback(nRole, wstringEndpointId);
//osh->changeFrontDefaultsCallback(nRole, wstringEndpointId);
return S_OK; return S_OK;
} }

View file

@ -12,6 +12,7 @@
#include <locale> #include <locale>
#include <map> #include <map>
#include <thread> #include <thread>
#include <deque>
#include "debug.h" #include "debug.h"
//#include "settings.h" //#include "settings.h"

View file

@ -792,7 +792,9 @@ void MainWindow::removeEndpointWidget(CustomWidgetEvent<uint64_t>* ev){
void MainWindow::addEndpointWidget(CustomWidgetEvent<EndpointHandler*>* ev){ void MainWindow::addEndpointWidget(CustomWidgetEvent<EndpointHandler*>* ev){
EndpointWidget* epw = new EndpointWidget(ev->payload, containerWidget, this->ews.size()); EndpointWidget* epw = new EndpointWidget(ev->payload, containerWidget, this->ews.size());
//epw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); //epw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
//this->widgetLayout->addWidget(epw); epw->setParent(this);
if(this->widgetLayout)
this->widgetLayout->addWidget(epw);
ews.push_back(epw); ews.push_back(epw);
return; return;
} }
@ -984,7 +986,9 @@ HeaderWidget::HeaderWidget(QWidget *parent) : QWidget(parent) {
void MainWindow::createLayout(QGridLayout *newLayout) { void MainWindow::createLayout(QGridLayout *newLayout) {
log_debugcpp("createLayout"); log_debugcpp("createLayout");
widgetLayout->removeItem(lastRowSpacer); widgetLayout->removeItem(lastRowSpacer);
delete this->widgetLayout; QGridLayout *tempStore = this->widgetLayout;
this->widgetLayout = 0;
delete tempStore;
containerWidget->setLayout(newLayout); containerWidget->setLayout(newLayout);
this->widgetLayout = newLayout; this->widgetLayout = newLayout;
@ -1191,9 +1195,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) {
} }
void MainWindow::flushRoleChanges() { void MainWindow::flushRoleChanges() {
//TODO: bucket list deque
std::pair<Roles, std::wstring> change = roleBucketList.front(); std::pair<Roles, std::wstring> change = roleBucketList.front();
roleBucketList.erase(roleBucketList.begin()); roleBucketList.pop_front();
EndpointWidget *newDef = nullptr, *oldDef = nullptr; EndpointWidget *newDef = nullptr, *oldDef = nullptr;
for (uint64_t i = 0; i < ews.size(); i++) { for (uint64_t i = 0; i < ews.size(); i++) {

View file

@ -208,7 +208,8 @@ private:
void changeFrontDefaults(Roles role, EndpointWidget* newDef, EndpointWidget* oldDef); void changeFrontDefaults(Roles role, EndpointWidget* newDef, EndpointWidget* oldDef);
std::vector<EndpointWidget*> ews; std::vector<EndpointWidget*> ews;
std::vector<std::pair<Roles, std::wstring>> roleBucketList; std::deque<std::pair<Roles, std::wstring>> roleBucketList;
std::mutex roleBucketMutex;
QWidget *containerWidget; QWidget *containerWidget;
QGridLayout *widgetLayout; QGridLayout *widgetLayout;