Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
227fd375fb |
No files matched your search
@@ -2026,7 +2026,7 @@ void OpenRGBDevicePage::UpdateInterface(unsigned int update_reason)
|
|||||||
case RGBCONTROLLER_UPDATE_REASON_HIDDEN:
|
case RGBCONTROLLER_UPDATE_REASON_HIDDEN:
|
||||||
case RGBCONTROLLER_UPDATE_REASON_UNHIDDEN:
|
case RGBCONTROLLER_UPDATE_REASON_UNHIDDEN:
|
||||||
case RGBCONTROLLER_UPDATE_REASON_CONFIGUREDEVICE:
|
case RGBCONTROLLER_UPDATE_REASON_CONFIGUREDEVICE:
|
||||||
emit RefreshList();
|
emit ShowHideList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RGBCONTROLLER_UPDATE_REASON_UPDATELEDS:
|
case RGBCONTROLLER_UPDATE_REASON_UPDATELEDS:
|
||||||
|
|||||||
@@ -129,5 +129,7 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void RefreshList();
|
void RefreshList();
|
||||||
|
void ShowHideList();
|
||||||
|
|
||||||
void SetAllDevices(unsigned char red, unsigned char green, unsigned char blue);
|
void SetAllDevices(unsigned char red, unsigned char green, unsigned char blue);
|
||||||
};
|
};
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -106,7 +107,15 @@ static void OpenRGBDialogResourceManagerCallback(void * this_ptr, unsigned int u
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RESOURCEMANAGER_UPDATE_REASON_DEVICE_LIST_UPDATED:
|
case RESOURCEMANAGER_UPDATE_REASON_DEVICE_LIST_UPDATED:
|
||||||
QMetaObject::invokeMethod(this_obj, "onDeviceListUpdated", Qt::BlockingQueuedConnection);
|
if(QThread::currentThread() != qApp->thread())
|
||||||
|
{
|
||||||
|
printf("invoking onDeviceListUpdated\n");
|
||||||
|
QMetaObject::invokeMethod(this_obj, "onDeviceListUpdated", Qt::BlockingQueuedConnection);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this_obj->onDeviceListUpdated();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -960,6 +969,84 @@ void OpenRGBDialog::ClearDevicesList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenRGBDialog::UpdateDevicesListShowHide()
|
||||||
|
{
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Loop through each controller in the tab list and hide |
|
||||||
|
| any controller marked as hidden. |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
for(int tab_idx = 0; tab_idx < ui->DevicesTabBar->count(); tab_idx++)
|
||||||
|
{
|
||||||
|
/*-------------------------------------------------*\
|
||||||
|
| Get a pointer to the page at this index in the |
|
||||||
|
| tab bar |
|
||||||
|
\*-------------------------------------------------*/
|
||||||
|
QWidget* page = ui->DevicesTabBar->widget(tab_idx);
|
||||||
|
|
||||||
|
/*-------------------------------------------------*\
|
||||||
|
| Verify this page is an OpenRGBDevicePage |
|
||||||
|
\*-------------------------------------------------*/
|
||||||
|
if(dynamic_cast<OpenRGBDevicePage*>(page) != nullptr)
|
||||||
|
{
|
||||||
|
/*---------------------------------------------*\
|
||||||
|
| If the controller for this page is hidden, |
|
||||||
|
| remove the page from the tab bar and store it |
|
||||||
|
| in the hidden pages vector |
|
||||||
|
\*---------------------------------------------*/
|
||||||
|
if(((OpenRGBDevicePage*)page)->GetController()->GetHidden())
|
||||||
|
{
|
||||||
|
hidden_pages.push_back((OpenRGBDevicePage*)page);
|
||||||
|
ui->DevicesTabBar->removeTab(tab_idx);
|
||||||
|
|
||||||
|
/*-----------------------------------------*\
|
||||||
|
| Decrement tab index to account for |
|
||||||
|
| removing tab |
|
||||||
|
\*-----------------------------------------*/
|
||||||
|
tab_idx--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Loop through each controller in the hidden pages |
|
||||||
|
| vector and restore any controller marked as not |
|
||||||
|
| hidden. |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
for(std::size_t page_idx = 0; page_idx < hidden_pages.size(); page_idx++)
|
||||||
|
{
|
||||||
|
/*-----------------------------------------*\
|
||||||
|
| Get a pointer to the page at this index |
|
||||||
|
| in the hidden pages vector |
|
||||||
|
\*-----------------------------------------*/
|
||||||
|
OpenRGBDevicePage* page = (OpenRGBDevicePage*)hidden_pages[page_idx];
|
||||||
|
RGBController* controller = page->GetController();
|
||||||
|
|
||||||
|
/*-----------------------------------------*\
|
||||||
|
| If the current tab matches the current |
|
||||||
|
| controller, check if it is hidden |
|
||||||
|
\*-----------------------------------------*/
|
||||||
|
if(!(controller->GetHidden()))
|
||||||
|
{
|
||||||
|
ui->DevicesTabBar->addTab((QWidget*)page, "");
|
||||||
|
|
||||||
|
/*---------------------------------*\
|
||||||
|
| Create the tab label |
|
||||||
|
\*---------------------------------*/
|
||||||
|
TabLabel* NewTabLabel = new TabLabel(OpenRGBFont::GetIconIDFromDeviceType(controller->GetDeviceType()), (char *)controller->GetDisplayName().c_str(), (char *)context, false);
|
||||||
|
|
||||||
|
ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel);
|
||||||
|
|
||||||
|
hidden_pages.erase(hidden_pages.begin() + page_idx);
|
||||||
|
|
||||||
|
/*---------------------------------*\
|
||||||
|
| Decrement page index to account |
|
||||||
|
| for removing page |
|
||||||
|
\*---------------------------------*/
|
||||||
|
page_idx--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OpenRGBDialog::UpdateDevicesList()
|
void OpenRGBDialog::UpdateDevicesList()
|
||||||
{
|
{
|
||||||
std::vector<RGBController *> controllers = ResourceManager::get()->GetRGBControllers();
|
std::vector<RGBController *> controllers = ResourceManager::get()->GetRGBControllers();
|
||||||
@@ -1142,6 +1229,11 @@ void OpenRGBDialog::UpdateDevicesList()
|
|||||||
this,
|
this,
|
||||||
SLOT(onDeviceListUpdated()));
|
SLOT(onDeviceListUpdated()));
|
||||||
|
|
||||||
|
connect(NewPage,
|
||||||
|
SIGNAL(ShowHideList()),
|
||||||
|
this,
|
||||||
|
SLOT(onDeviceListShowHide()));
|
||||||
|
|
||||||
if(controllers[controller_idx]->GetHidden())
|
if(controllers[controller_idx]->GetHidden())
|
||||||
{
|
{
|
||||||
hidden_pages.push_back(NewPage);
|
hidden_pages.push_back(NewPage);
|
||||||
@@ -1475,6 +1567,11 @@ void OpenRGBDialog::onDeviceListUpdated()
|
|||||||
UpdateDevicesList();
|
UpdateDevicesList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenRGBDialog::onDeviceListShowHide()
|
||||||
|
{
|
||||||
|
UpdateDevicesListShowHide();
|
||||||
|
}
|
||||||
|
|
||||||
void OpenRGBDialog::onDetectionProgressUpdated()
|
void OpenRGBDialog::onDetectionProgressUpdated()
|
||||||
{
|
{
|
||||||
ui->DetectionProgressBar->setValue(ResourceManager::get()->GetDetectionPercent());
|
ui->DetectionProgressBar->setValue(ResourceManager::get()->GetDetectionPercent());
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ private:
|
|||||||
|
|
||||||
void ClearDevicesList();
|
void ClearDevicesList();
|
||||||
void UpdateDevicesList();
|
void UpdateDevicesList();
|
||||||
|
void UpdateDevicesListShowHide();
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
bool SelectConfigProfile(const std::string name);
|
bool SelectConfigProfile(const std::string name);
|
||||||
|
|
||||||
@@ -166,6 +167,9 @@ private:
|
|||||||
void UpdateTabs();
|
void UpdateTabs();
|
||||||
bool isCompactTabMode();
|
bool isCompactTabMode();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void onDeviceListUpdated();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_Exit();
|
void on_Exit();
|
||||||
void on_LightsOff();
|
void on_LightsOff();
|
||||||
@@ -176,7 +180,7 @@ private slots:
|
|||||||
void on_QuickBlue();
|
void on_QuickBlue();
|
||||||
void on_QuickMagenta();
|
void on_QuickMagenta();
|
||||||
void on_QuickWhite();
|
void on_QuickWhite();
|
||||||
void onDeviceListUpdated();
|
void onDeviceListShowHide();
|
||||||
void onDetectionProgressUpdated();
|
void onDetectionProgressUpdated();
|
||||||
void onDetectionStarted();
|
void onDetectionStarted();
|
||||||
void onDetectionEnded();
|
void onDetectionEnded();
|
||||||
|
|||||||
Reference in new issue
Block a user