| 915 | } |
| 916 | |
| 917 | void DEV9SettingsWidget::RefreshHostList() |
| 918 | { |
| 919 | while (m_ethHost_model->rowCount() > 0) |
| 920 | m_ethHost_model->removeRow(0); |
| 921 | |
| 922 | bool enableHostsUi; |
| 923 | |
| 924 | std::vector<HostEntryUi> hosts; |
| 925 | |
| 926 | if (dialog()->isPerGameSettings()) |
| 927 | { |
| 928 | m_ui.ethHostPerGame->setVisible(true); |
| 929 | |
| 930 | std::optional<std::vector<HostEntryUi>> hostsOpt = ListHostsConfig(); |
| 931 | if (hostsOpt.has_value()) |
| 932 | { |
| 933 | m_ui.ethHostPerGame->setText(tr("Use Global")); |
| 934 | hosts = hostsOpt.value(); |
| 935 | enableHostsUi = true; |
| 936 | } |
| 937 | else |
| 938 | { |
| 939 | m_ui.ethHostPerGame->setText(tr("Override")); |
| 940 | hosts = ListBaseHostsConfig(); |
| 941 | enableHostsUi = false; |
| 942 | } |
| 943 | } |
| 944 | else |
| 945 | { |
| 946 | m_ui.ethHostPerGame->setVisible(false); |
| 947 | hosts = ListHostsConfig().value(); |
| 948 | enableHostsUi = true; |
| 949 | } |
| 950 | |
| 951 | m_ui.ethHosts->setEnabled(enableHostsUi); |
| 952 | m_ui.ethHostAdd->setEnabled(enableHostsUi); |
| 953 | m_ui.ethHostDel->setEnabled(enableHostsUi); |
| 954 | m_ui.ethHostExport->setEnabled(enableHostsUi); |
| 955 | m_ui.ethHostImport->setEnabled(enableHostsUi); |
| 956 | |
| 957 | //Load list |
| 958 | for (size_t i = 0; i < hosts.size(); i++) |
| 959 | { |
| 960 | HostEntryUi entry = hosts[i]; |
| 961 | const int row = m_ethHost_model->rowCount(); |
| 962 | m_ethHost_model->insertRow(row); |
| 963 | |
| 964 | QSignalBlocker sb(m_ethHost_model); |
| 965 | |
| 966 | QStandardItem* nameItem = new QStandardItem(); |
| 967 | nameItem->setText(QString::fromStdString(entry.Desc)); |
| 968 | m_ethHost_model->setItem(row, 0, nameItem); |
| 969 | |
| 970 | QStandardItem* urlItem = new QStandardItem(); |
| 971 | urlItem->setText(QString::fromStdString(entry.Url)); |
| 972 | m_ethHost_model->setItem(row, 1, urlItem); |
| 973 | |
| 974 | QStandardItem* addressItem = new QStandardItem(); |
nothing calls this directly
no test coverage detected