MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / remoteListRefresh

Method remoteListRefresh

player/NymphCastPlayer/mainwindow.cpp:677–723  ·  view source on GitHub ↗

--- REMOTE LIST REFRESH --- Refresh the list of remote servers on the network.

Source from the content-addressed store, hash-verified

675// --- REMOTE LIST REFRESH ---
676// Refresh the list of remote servers on the network.
677void MainWindow::remoteListRefresh() {
678 // Get the current list.
679 std::vector<NymphCastRemote> list = client.findServers();
680
681 // Update the list with any changed items.
682 remotes.clear();
683 ui->remotesComboBox->clear();
684 uint32_t idx = 0;
685 for (uint32_t i = 0; i < list.size(); ++i) {
686 QListWidgetItem *newItem = new QListWidgetItem;
687 newItem->setText(QString::fromStdString(list[i].ipv4 + " (" + list[i].name + ")"));
688 newItem->setData(Qt::UserRole, QVariant(i));
689 ui->remotesComboBox->insertItem(i, QString::fromStdString(list[i].ipv4 +
690 " (" + list[i].name + ")"), QVariant(i));
691
692 // Add remote to 'remotes' list.
693 NCRemoteInstance nci;
694 nci.remote = list[i];
695 remotes.push_back(nci);
696 idx++;
697 }
698
699 // Merge in custom remotes, if any.
700 for (uint32_t i = 0; i < custom_remotes.size(); ++i) {
701 QListWidgetItem *newItem = new QListWidgetItem;
702 newItem->setText(QString::fromStdString(custom_remotes[i].remote.ipv4 + " (" + custom_remotes[i].remote.name + ")"));
703 newItem->setData(Qt::UserRole, QVariant((i + ++idx)));
704 ui->remotesComboBox->insertItem((i + idx), QString::fromStdString(custom_remotes[i].remote.ipv4 +
705 " (" + custom_remotes[i].remote.name + ") [Manual]"), QVariant(i));
706
707 // Add remote to 'remotes' list.
708 NCRemoteInstance nci;
709 nci.manual = true;
710 nci.remote = custom_remotes[i].remote;
711 remotes.push_back(nci);
712 }
713
714 // Insert group separator for the relevant combo boxes.
715 ui->remotesComboBox->insertSeparator(remotes.size());
716 separatorIndex = remotes.size();
717
718 // Add groups.
719 for (uint32_t i = 0; i < groups.size(); ++i) {
720 ui->remotesComboBox->addItem(QString::fromStdString(groups[i].name +
721 " (group)"), QVariant(i));
722 }
723}
724
725
726// --- CAST FILE ---

Callers

nothing calls this directly

Calls 6

findServersMethod · 0.80
push_backMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45
setTextMethod · 0.45
addItemMethod · 0.45

Tested by

no test coverage detected