Use GetName instead of directly accessing the RGBController::name member outside of Controllers

This commit is contained in:
Adam Honse 2025-08-01 11:32:55 -05:00
parent 1318d23401
commit 30f9b84d5f
6 changed files with 13 additions and 13 deletions

View file

@ -417,7 +417,7 @@ bool ProfileManager::LoadProfileWithOptions
for(std::size_t controller_index = 0; controller_index < controllers.size(); controller_index++) for(std::size_t controller_index = 0; controller_index < controllers.size(); controller_index++)
{ {
bool temp_ret_val = LoadDeviceFromListWithOptions(temp_controllers, temp_controller_used, controllers[controller_index], load_size, load_settings); bool temp_ret_val = LoadDeviceFromListWithOptions(temp_controllers, temp_controller_used, controllers[controller_index], load_size, load_settings);
std::string current_name = controllers[controller_index]->name + " @ " + controllers[controller_index]->GetLocation(); std::string current_name = controllers[controller_index]->GetName() + " @ " + controllers[controller_index]->GetLocation();
LOG_INFO("[ProfileManager] Profile loading: %s for %s", ( temp_ret_val ? "Succeeded" : "FAILED!" ), current_name.c_str()); LOG_INFO("[ProfileManager] Profile loading: %s for %s", ( temp_ret_val ? "Succeeded" : "FAILED!" ), current_name.c_str());
ret_val |= temp_ret_val; ret_val |= temp_ret_val;
} }

View file

@ -232,7 +232,7 @@ void ResourceManager::RegisterRGBController(RGBController *rgb_controller)
rgb_controller->flags &= ~CONTROLLER_FLAG_REMOTE; rgb_controller->flags &= ~CONTROLLER_FLAG_REMOTE;
rgb_controller->flags |= CONTROLLER_FLAG_LOCAL; rgb_controller->flags |= CONTROLLER_FLAG_LOCAL;
LOG_INFO("[%s] Registering RGB controller", rgb_controller->name.c_str()); LOG_INFO("[%s] Registering RGB controller", rgb_controller->GetName().c_str());
rgb_controllers_hw.push_back(rgb_controller); rgb_controllers_hw.push_back(rgb_controller);
/*-----------------------------------------------------*\ /*-----------------------------------------------------*\
@ -264,7 +264,7 @@ void ResourceManager::RegisterRGBController(RGBController *rgb_controller)
void ResourceManager::UnregisterRGBController(RGBController* rgb_controller) void ResourceManager::UnregisterRGBController(RGBController* rgb_controller)
{ {
LOG_INFO("[%s] Unregistering RGB controller", rgb_controller->name.c_str()); LOG_INFO("[%s] Unregistering RGB controller", rgb_controller->GetName().c_str());
/*-----------------------------------------------------*\ /*-----------------------------------------------------*\
| Clear callbacks from the controller before removal | | Clear callbacks from the controller before removal |

View file

@ -345,7 +345,7 @@ unsigned int ParseMode(DeviceOptions& options, std::vector<RGBController *> &rgb
} }
} }
std::cout << "Error: Mode '" + options.mode + "' not available for device '" + rgb_controllers[options.device]->name + "'" << std::endl; std::cout << "Error: Mode '" + options.mode + "' not available for device '" + rgb_controllers[options.device]->GetName() + "'" << std::endl;
return false; return false;
} }
@ -467,7 +467,7 @@ void OptionListDevices(std::vector<RGBController *>& rgb_controllers)
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Print device name | | Print device name |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
std::cout << controller_idx << ": " << controller->name << std::endl; std::cout << controller_idx << ": " << controller->GetName() << std::endl;
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Print device type | | Print device type |
@ -602,7 +602,7 @@ bool OptionDevice(std::vector<DeviceOptions>* current_devices, std::string argum
| If the argument is not a number then check all the | | If the argument is not a number then check all the |
| controllers names for a match | | controllers names for a match |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
std::string name = rgb_controllers[i]->name; std::string name = rgb_controllers[i]->GetName();
std::transform(name.begin(), name.end(), name.begin(), ::tolower); std::transform(name.begin(), name.end(), name.begin(), ::tolower);
LOG_TRACE("[CLI] Comparing to %s", name.c_str()); LOG_TRACE("[CLI] Comparing to %s", name.c_str());
@ -888,7 +888,7 @@ bool OptionProfile(std::string argument, std::vector<RGBController *>& rgb_contr
RGBController* device = rgb_controllers[controller_idx]; RGBController* device = rgb_controllers[controller_idx];
device->DeviceUpdateMode(); device->DeviceUpdateMode();
LOG_DEBUG("[CLI] Updating mode for %s to %i", device->name.c_str(), device->active_mode); LOG_DEBUG("[CLI] Updating mode for %s to %i", device->GetName().c_str(), device->active_mode);
if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED) if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED)
{ {

View file

@ -195,7 +195,7 @@ void OpenRGBClientInfoPage::UpdateInfo()
| names in them | | names in them |
\*-----------------------------------------------------*/ \*-----------------------------------------------------*/
QTreeWidgetItem* new_item = new QTreeWidgetItem(new_top_item); QTreeWidgetItem* new_item = new QTreeWidgetItem(new_top_item);
new_item->setText(0, QString::fromStdString(ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->name)); new_item->setText(0, QString::fromStdString(ResourceManager::get()->GetClients()[client_idx]->server_controllers[dev_idx]->GetName()));
/*-----------------------------------------------------*\ /*-----------------------------------------------------*\
| Add child items for each zone in the device | | Add child items for each zone in the device |

View file

@ -1062,10 +1062,10 @@ void OpenRGBDialog::UpdateDevicesList()
/*---------------------------------------------*\ /*---------------------------------------------*\
| Create the tab label | | Create the tab label |
\*---------------------------------------------*/ \*---------------------------------------------*/
TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->type), QString::fromStdString(controllers[controller_idx]->name), (char *)controllers[controller_idx]->name.c_str(), (char *)context); TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->type), QString::fromStdString(controllers[controller_idx]->GetName()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context);
ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel);
ui->DevicesTabBar->tabBar()->setTabToolTip(ui->DevicesTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->name)); ui->DevicesTabBar->tabBar()->setTabToolTip(ui->DevicesTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->GetName()));
/*---------------------------------------------*\ /*---------------------------------------------*\
| Now move the new tab to the correct position | | Now move the new tab to the correct position |
@ -1115,10 +1115,10 @@ void OpenRGBDialog::UpdateDevicesList()
/*---------------------------------------------*\ /*---------------------------------------------*\
| Create the tab label | | Create the tab label |
\*---------------------------------------------*/ \*---------------------------------------------*/
TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->type), QString::fromStdString(controllers[controller_idx]->name), (char *)controllers[controller_idx]->name.c_str(), (char *)context); TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->type), QString::fromStdString(controllers[controller_idx]->GetName()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context);
ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel);
ui->InformationTabBar->tabBar()->setTabToolTip(ui->InformationTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->name)); ui->InformationTabBar->tabBar()->setTabToolTip(ui->InformationTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->GetName()));
/*---------------------------------------------*\ /*---------------------------------------------*\
| Now move the new tab to the correct position | | Now move the new tab to the correct position |

View file

@ -142,7 +142,7 @@ void OpenRGBZonesBulkResizer::CreateZoneWidget(RGBController* controller, unsign
| Labels: controller name + zone name | | Labels: controller name + zone name |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
QLabel* controller_label = new QLabel(this); QLabel* controller_label = new QLabel(this);
controller_label->setText(QString::fromStdString(controller->name)); controller_label->setText(QString::fromStdString(controller->GetName()));
QLabel* zone_label = new QLabel(this); QLabel* zone_label = new QLabel(this);
zone_label->setText(QString::fromStdString(controller->zones[zone_index].name)); zone_label->setText(QString::fromStdString(controller->zones[zone_index].name));