fix multiple checked profiles

This commit is contained in:
Nova 2024-12-21 03:17:15 +03:30
parent b8dc8be90e
commit f1e96499c2
No known key found for this signature in database
GPG Key ID: 389787EC83F5D73A
3 changed files with 8 additions and 8 deletions

View File

@ -183,9 +183,9 @@ private:
void refresh_proxy_list_impl(const int &id = -1, GroupSortAction groupSortAction = {}); void refresh_proxy_list_impl(const int &id = -1, GroupSortAction groupSortAction = {});
void refresh_proxy_list_impl_refresh_data(const int &id = -1); void refresh_proxy_list_impl_refresh_data(const int &id = -1, bool stopping = false);
void refresh_table_item(int row, const std::shared_ptr<NekoGui::ProxyEntity>& profile); void refresh_table_item(int row, const std::shared_ptr<NekoGui::ProxyEntity>& profile, bool stopping);
void keyPressEvent(QKeyEvent *event) override; void keyPressEvent(QKeyEvent *event) override;

View File

@ -1045,7 +1045,7 @@ void MainWindow::refresh_proxy_list_impl(const int &id, GroupSortAction groupSor
refresh_proxy_list_impl_refresh_data(id); refresh_proxy_list_impl_refresh_data(id);
} }
void MainWindow::refresh_proxy_list_impl_refresh_data(const int &id) { void MainWindow::refresh_proxy_list_impl_refresh_data(const int &id, bool stopping) {
if (id >= 0) if (id >= 0)
{ {
auto rowID = ui->proxyListTable->id2Row[id]; auto rowID = ui->proxyListTable->id2Row[id];
@ -1055,22 +1055,22 @@ void MainWindow::refresh_proxy_list_impl_refresh_data(const int &id) {
return; return;
} }
auto profile = NekoGui::profileManager->GetProfile(id); auto profile = NekoGui::profileManager->GetProfile(id);
refresh_table_item(rowID, profile); refresh_table_item(rowID, profile, stopping);
} else } else
{ {
for (int row = 0; row < ui->proxyListTable->rowCount(); row++) { for (int row = 0; row < ui->proxyListTable->rowCount(); row++) {
auto profileId = ui->proxyListTable->row2Id[row]; auto profileId = ui->proxyListTable->row2Id[row];
auto profile = NekoGui::profileManager->GetProfile(profileId); auto profile = NekoGui::profileManager->GetProfile(profileId);
refresh_table_item(row, profile); refresh_table_item(row, profile, stopping);
} }
} }
} }
void MainWindow::refresh_table_item(const int row, const std::shared_ptr<NekoGui::ProxyEntity>& profile) void MainWindow::refresh_table_item(const int row, const std::shared_ptr<NekoGui::ProxyEntity>& profile, bool stopping)
{ {
if (profile == nullptr) return; if (profile == nullptr) return;
auto isRunning = profile->id == NekoGui::dataStore->started_id; auto isRunning = profile->id == NekoGui::dataStore->started_id && !stopping;
auto f0 = std::make_unique<QTableWidgetItem>(); auto f0 = std::make_unique<QTableWidgetItem>();
f0->setData(114514, profile->id); f0->setData(114514, profile->id);

View File

@ -430,7 +430,7 @@ void MainWindow::neko_stop(bool crash, bool sem, bool manual) {
runOnUiThread([=] { runOnUiThread([=] {
refresh_status(); refresh_status();
refresh_proxy_list(id); refresh_proxy_list_impl_refresh_data(id, true);
mu_stopping.unlock(); mu_stopping.unlock();
if (sem) sem_stopped.release(); if (sem) sem_stopped.release();