MCPcopy Create free account
hub / github.com/baldurk/renderdoc / on_deleteHost_clicked

Method on_deleteHost_clicked

qrenderdoc/Windows/Dialogs/RemoteManager.cpp:658–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658void RemoteManager::on_deleteHost_clicked()
659{
660 RDTreeWidgetItem *item = ui->hosts->selectedItem();
661
662 if(!item)
663 return;
664
665 RemoteHost host = getRemoteHost(item);
666
667 int itemIdx = ui->hosts->indexOfTopLevelItem(item);
668
669 // don't delete running instances on a host
670 if(item->parent() != ui->hosts->invisibleRootItem() || itemIdx < 0 || !host.IsValid())
671 return;
672
673 QString hostname = item->text(0);
674
675 if(hostname == lit("localhost"))
676 return;
677
678 QMessageBox::StandardButton res = RDDialog::question(
679 this, tr("Deleting host"), tr("Are you sure you wish to delete %1?").arg(hostname),
680 RDDialog::YesNoCancel);
681
682 if(res == QMessageBox::Cancel || res == QMessageBox::No)
683 return;
684
685 if(res == QMessageBox::Yes)
686 {
687 RemoteHost h = m_Ctx.Config().GetRemoteHost(host.Hostname());
688 if(!h.IsValid())
689 return;
690
691 // the host will be removed in queueDelete.
692 m_Ctx.Config().RemoveRemoteHost(h);
693 m_Ctx.Config().Save();
694
695 item->clear();
696
697 queueDelete(ui->hosts->takeTopLevelItem(itemIdx));
698
699 ui->hosts->clearSelection();
700
701 ui->hostname->setText(hostname);
702 on_hostname_textEdited(hostname);
703 }
704}

Callers

nothing calls this directly

Calls 15

questionFunction · 0.85
selectedItemMethod · 0.80
indexOfTopLevelItemMethod · 0.80
invisibleRootItemMethod · 0.80
takeTopLevelItemMethod · 0.80
trFunction · 0.50
parentMethod · 0.45
IsValidMethod · 0.45
textMethod · 0.45
argMethod · 0.45
GetRemoteHostMethod · 0.45
ConfigMethod · 0.45

Tested by

no test coverage detected