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

Method checkAllowClose

qrenderdoc/Windows/Dialogs/LiveCapture.cpp:707–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707bool LiveCapture::checkAllowClose(int totalUnsavedCaptures, bool &noToAll)
708{
709 m_IgnoreThreadClosed = true;
710
711 bool suppressRemoteWarning = false;
712
713 QMessageBox::StandardButtons msgFlags = RDDialog::YesNoCancel;
714
715 const int unsavedCaptures = unsavedCaptureCount();
716 const bool multipleClosures = totalUnsavedCaptures > unsavedCaptures;
717
718 if(unsavedCaptures > 1 || multipleClosures)
719 msgFlags |= QMessageBox::NoToAll;
720
721 for(int i = 0; i < ui->captures->count(); i++)
722 {
723 QListWidgetItem *item = ui->captures->item(i);
724 Capture *cap = GetCapture(ui->captures->item(i));
725
726 if(cap->saved)
727 continue;
728
729 ui->captures->clearSelection();
730 ToolWindowManager::raiseToolWindow(this);
731 ui->captures->setFocus();
732 item->setSelected(true);
733
734 QMessageBox::StandardButton res = QMessageBox::No;
735
736 if(!suppressRemoteWarning && !noToAll)
737 {
738 QString frameName = tr("Frame #%1").arg(cap->frameNumber);
739 if(cap->frameNumber == ~0U)
740 frameName = tr("User-defined Capture");
741
742 res = RDDialog::question(this, tr("Unsaved capture"),
743 tr("Save this capture '%1 %2' at %3?")
744 .arg(cap->name)
745 .arg(frameName)
746 .arg(cap->timestamp.toString(lit("HH:mm:ss"))),
747 msgFlags);
748
749 if(res == QMessageBox::NoToAll)
750 {
751 // if we're closing multiple connections make sure the user is sure of what they're doing
752 if(multipleClosures)
753 {
754 QMessageBox::StandardButton res2 = RDDialog::question(
755 this, tr("Discarding all captures"),
756 tr("Multiple connections open have potentially unsaved captures, "
757 "this will discard all captures in all connections, are you sure?"));
758
759 // if the user is sure, apply the no to all
760 if(res2 == QMessageBox::Yes)
761 {
762 noToAll = true;
763 }
764 else

Callers 2

setRemoteHostMethod · 0.45
closeEventMethod · 0.45

Calls 13

GetCaptureFunction · 0.85
questionFunction · 0.85
rdcstrClass · 0.85
itemMethod · 0.80
setFocusMethod · 0.80
availableMethod · 0.80
CurrentRemoteMethod · 0.80
trFunction · 0.50
QStringFunction · 0.50
countMethod · 0.45
setSelectedMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected