Commit f5e20f1f authored by Adam Honse's avatar Adam Honse

Allow multiple OpenRGB SDK client connections simultaneously

parent a028a2c5
......@@ -1347,17 +1347,23 @@ void Visualizer::VisThreadFunction()
Sleep(15);
}
}
static bool started = false;
void Visualizer::OpenRGBConnect(const char * ip, unsigned short port)
{
rgb_client = new NetworkClient(rgb_controllers);
NetworkClient * rgb_client = new NetworkClient(rgb_controllers);
rgb_client->SetIP(ip);
rgb_client->SetPort(port);
rgb_client->StartClient();
LEDUpdateThread = new std::thread(&Visualizer::LEDUpdateThreadFunction, this);
rgb_clients.push_back(rgb_client);
if(!started)
{
LEDUpdateThread = new std::thread(&Visualizer::LEDUpdateThreadFunction, this);
started = true;
}
}
void Visualizer::LEDUpdateThreadFunction()
......
......@@ -180,7 +180,7 @@ public:
std::vector<char *> audio_devices;
//OpenRGB SDK
NetworkClient* rgb_client;
std::vector<NetworkClient*> rgb_clients;
std::vector<RGBController*> rgb_controllers;
private:
......
......@@ -353,9 +353,11 @@ void Ui::KeyboardVisDlg::on_lineEdit_Background_Timeout_textChanged(const QStrin
void Ui::KeyboardVisDlg::on_button_Connect_clicked()
{
unsigned short port = std::stoi(ui->lineEdit_Port->text().toStdString());
const char * ip = ui->lineEdit_IP->text().toStdString().c_str();
std::string ip = ui->lineEdit_IP->text().toStdString();
vis_ptr->OpenRGBConnect(ip, port);
vis_ptr->OpenRGBConnect(ip.c_str(), port);
ui->tree_Devices->clear();
//OpenRGB device list
ui->tree_Devices->setColumnCount(3);
......
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