Commit 0bb0acb9 authored by Adam Honse's avatar Adam Honse

Automatically reconnect to server if disconnected, display controllers by client connection in list

parent ef0c3d7c
......@@ -350,46 +350,57 @@ void Ui::KeyboardVisDlg::on_lineEdit_Background_Timeout_textChanged(const QStrin
vis_ptr->OnSettingsChanged();
}
void Ui::KeyboardVisDlg::on_button_Connect_clicked()
void Ui::KeyboardVisDlg::UpdateOpenRGBClientList()
{
unsigned short port = std::stoi(ui->lineEdit_Port->text().toStdString());
std::string ip = ui->lineEdit_IP->text().toStdString();
vis_ptr->OpenRGBConnect(ip.c_str(), port);
ui->tree_Devices->clear();
//OpenRGB device list
ui->tree_Devices->setColumnCount(3);
ui->tree_Devices->setHeaderLabels(QStringList() << "Device Zones" << "LEDs" << "Type");
for(int dev_idx = 0; dev_idx < vis_ptr->rgb_controllers.size(); dev_idx++)
for(int client_idx = 0; client_idx < vis_ptr->rgb_clients.size(); client_idx++)
{
QTreeWidgetItem* new_item = new QTreeWidgetItem(ui->tree_Devices);
new_item->setText(0, QString::fromStdString(vis_ptr->rgb_controllers[dev_idx]->name));
QTreeWidgetItem* new_top_item = new QTreeWidgetItem(ui->tree_Devices);
new_top_item->setText(0, QString::fromStdString(vis_ptr->rgb_clients[client_idx]->GetIP()));
for(int zone_idx = 0; zone_idx < vis_ptr->rgb_controllers[dev_idx]->zones.size(); zone_idx++)
for(int dev_idx = 0; dev_idx < vis_ptr->rgb_clients[client_idx]->server_controllers.size(); dev_idx++)
{
QTreeWidgetItem* new_child = new QTreeWidgetItem();
QTreeWidgetItem* new_item = new QTreeWidgetItem(new_top_item);
new_item->setText(0, QString::fromStdString(vis_ptr->rgb_clients[client_idx]->server_controllers[dev_idx]->name));
new_child->setText(0, QString::fromStdString(vis_ptr->rgb_controllers[dev_idx]->zones[zone_idx].name));
new_child->setText(1, QString::fromStdString(std::to_string((vis_ptr->rgb_controllers[dev_idx]->zones[zone_idx].leds_count))));
switch(vis_ptr->rgb_controllers[dev_idx]->zones[zone_idx].type)
for(int zone_idx = 0; zone_idx < vis_ptr->rgb_clients[client_idx]->server_controllers[dev_idx]->zones.size(); zone_idx++)
{
case ZONE_TYPE_SINGLE:
new_child->setText(2, "Single");
break;
QTreeWidgetItem* new_child = new QTreeWidgetItem();
case ZONE_TYPE_LINEAR:
new_child->setText(2, "Linear");
break;
new_child->setText(0, QString::fromStdString(vis_ptr->rgb_clients[client_idx]->server_controllers[dev_idx]->zones[zone_idx].name));
new_child->setText(1, QString::fromStdString(std::to_string((vis_ptr->rgb_clients[client_idx]->server_controllers[dev_idx]->zones[zone_idx].leds_count))));
case ZONE_TYPE_MATRIX:
new_child->setText(2, "Matrix");
switch(vis_ptr->rgb_clients[client_idx]->server_controllers[dev_idx]->zones[zone_idx].type)
{
case ZONE_TYPE_SINGLE:
new_child->setText(2, "Single");
break;
}
new_item->addChild(new_child);
case ZONE_TYPE_LINEAR:
new_child->setText(2, "Linear");
break;
case ZONE_TYPE_MATRIX:
new_child->setText(2, "Matrix");
break;
}
new_item->addChild(new_child);
}
}
}
}
void Ui::KeyboardVisDlg::on_button_Connect_clicked()
{
unsigned short port = std::stoi(ui->lineEdit_Port->text().toStdString());
std::string ip = ui->lineEdit_IP->text().toStdString();
vis_ptr->OpenRGBConnect(ip.c_str(), port);
UpdateOpenRGBClientList();
}
......@@ -25,6 +25,7 @@ public:
void SetVisualizer(Visualizer* v);
void StartMinimized(boolean startmin);
void UpdateOpenRGBClientList();
private slots:
void update();
......
Subproject commit 69e1e19bf9bdb24019dcec97ef2ef433265fc5da
Subproject commit e2c2b8c1df81e3cbccaa68a531507155cac45590
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment