Move Autogenerated UI code into Private sections of the window classes
This commit is contained in:
parent
4c6bf55c8a
commit
6793d4a3a0
45 changed files with 940 additions and 531 deletions
|
|
@ -37,7 +37,7 @@ void OpenRGBSerialSettingsEntry::changeEvent(QEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int index)
|
||||
void OpenRGBSerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int index)
|
||||
{
|
||||
if(index == 3)
|
||||
{
|
||||
|
|
@ -48,3 +48,83 @@ void Ui::OpenRGBSerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int
|
|||
ui->BaudLabel->setText("Baud:");
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBSerialSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("name"))
|
||||
{
|
||||
ui->NameEdit->setText(QString::fromStdString(data["name"]));
|
||||
}
|
||||
|
||||
if(data.contains("port"))
|
||||
{
|
||||
ui->PortEdit->setText(QString::fromStdString(data["port"]));
|
||||
}
|
||||
|
||||
if(data.contains("baud"))
|
||||
{
|
||||
ui->BaudEdit->setText(QString::number((int)data["baud"]));
|
||||
}
|
||||
|
||||
if(data.contains("num_leds"))
|
||||
{
|
||||
ui->NumLEDsEdit->setText(QString::number((int)data["num_leds"]));
|
||||
}
|
||||
|
||||
if(data.contains("protocol"))
|
||||
{
|
||||
std::string protocol_string = data["protocol"];
|
||||
|
||||
if(protocol_string == "keyboard_visualizer")
|
||||
{
|
||||
ui->ProtocolComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(protocol_string == "adalight")
|
||||
{
|
||||
ui->ProtocolComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(protocol_string == "tpm2")
|
||||
{
|
||||
ui->ProtocolComboBox->setCurrentIndex(2);
|
||||
}
|
||||
else if(protocol_string == "basic_i2c")
|
||||
{
|
||||
ui->ProtocolComboBox->setCurrentIndex(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBSerialSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
result["port"] = ui->PortEdit->text().toStdString();
|
||||
result["num_leds"] = ui->NumLEDsEdit->text().toUInt();
|
||||
result["baud"] = ui->BaudEdit->text().toUInt();
|
||||
|
||||
switch(ui->ProtocolComboBox->currentIndex())
|
||||
{
|
||||
case 0:
|
||||
result["protocol"] = "keyboard_visualizer";
|
||||
break;
|
||||
case 1:
|
||||
result["protocol"] = "adalight";
|
||||
break;
|
||||
case 2:
|
||||
result["protocol"] = "tpm2";
|
||||
break;
|
||||
case 3:
|
||||
result["protocol"] = "basic_i2c";
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBSerialSettingsEntry::settingsSection()
|
||||
{
|
||||
return "LEDStripDevices";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue