Introduce device_type_to_str

This commit is contained in:
Stefan Reiter 2020-02-22 00:22:49 +01:00 committed by Adam Honse
parent 20a99ef7ef
commit 3c6ac31eab
3 changed files with 30 additions and 32 deletions

View file

@ -55,4 +55,31 @@ void RGBController::SetMode(int mode)
active_mode = mode;
UpdateMode();
}
std::string device_type_to_str(device_type type)
{
switch(type)
{
case DEVICE_TYPE_MOTHERBOARD:
return "Motherboard";
case DEVICE_TYPE_DRAM:
return "DRAM";
case DEVICE_TYPE_GPU:
return "GPU";
case DEVICE_TYPE_COOLER:
return "Cooler";
case DEVICE_TYPE_LEDSTRIP:
return "LED Strip";
case DEVICE_TYPE_KEYBOARD:
return "Keyboard";
case DEVICE_TYPE_MOUSE:
return "Mouse";
case DEVICE_TYPE_MOUSEMAT:
return "Mousemat";
case DEVICE_TYPE_HEADSET:
return "Headset";
default:
return "Unknown";
}
}

View file

@ -112,6 +112,8 @@ enum
DEVICE_TYPE_UNKNOWN
};
std::string device_type_to_str(device_type type);
typedef struct
{
std::string name; /* Zone name */

View file

@ -8,38 +8,7 @@ OpenRGBDeviceInfoPage::OpenRGBDeviceInfoPage(RGBController *dev, QWidget *parent
{
ui->setupUi(this);
switch(dev->type)
{
case DEVICE_TYPE_MOTHERBOARD:
ui->TypeValue->setText("Motherboard");
break;
case DEVICE_TYPE_DRAM:
ui->TypeValue->setText("DRAM");
break;
case DEVICE_TYPE_GPU:
ui->TypeValue->setText("GPU");
break;
case DEVICE_TYPE_COOLER:
ui->TypeValue->setText("Cooler");
break;
case DEVICE_TYPE_LEDSTRIP:
ui->TypeValue->setText("LED Strip");
break;
case DEVICE_TYPE_KEYBOARD:
ui->TypeValue->setText("Keyboard");
break;
case DEVICE_TYPE_MOUSE:
ui->TypeValue->setText("Mouse");
break;
case DEVICE_TYPE_MOUSEMAT:
ui->TypeValue->setText("Mousemat");
break;
case DEVICE_TYPE_HEADSET:
ui->TypeValue->setText("Headset");
break;
default:
ui->TypeValue->setText("Unknown");
}
ui->TypeValue->setText(device_type_to_str(dev->type).c_str());
ui->NameValue->setText(QString::fromStdString(dev->name));
ui->DescriptionValue->setText(QString::fromStdString(dev->description));