mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
When closing multiple capture connections apply 'No to All' answer wider
* This means if you're closing multiple connections and click 'no to all' when prompting save of instead of discarding just the captures in that connection then going on to prompt for the next, it discards all remaining captures.
This commit is contained in:
@@ -685,12 +685,11 @@ QString LiveCapture::MakeText(Capture *cap)
|
||||
return text;
|
||||
}
|
||||
|
||||
bool LiveCapture::checkAllowClose()
|
||||
bool LiveCapture::checkAllowClose(bool multipleClosures, bool &noToAll)
|
||||
{
|
||||
m_IgnoreThreadClosed = true;
|
||||
|
||||
bool suppressRemoteWarning = false;
|
||||
bool notoall = false;
|
||||
|
||||
QMessageBox::StandardButtons msgFlags = RDDialog::YesNoCancel;
|
||||
|
||||
@@ -712,7 +711,7 @@ bool LiveCapture::checkAllowClose()
|
||||
|
||||
QMessageBox::StandardButton res = QMessageBox::No;
|
||||
|
||||
if(!suppressRemoteWarning && !notoall)
|
||||
if(!suppressRemoteWarning && !noToAll)
|
||||
{
|
||||
QString frameName = tr("Frame #%1").arg(cap->frameNumber);
|
||||
if(cap->frameNumber == ~0U)
|
||||
@@ -727,7 +726,26 @@ bool LiveCapture::checkAllowClose()
|
||||
|
||||
if(res == QMessageBox::NoToAll)
|
||||
{
|
||||
notoall = true;
|
||||
// if we're closing multiple connections make sure the user is sure of what they're doing
|
||||
if(multipleClosures)
|
||||
{
|
||||
QMessageBox::StandardButton res2 =
|
||||
RDDialog::question(this, tr("Discarding all captures"),
|
||||
tr("Multiple connections open have potentially unsaved captures, "
|
||||
"are you sure you wish to discard them all?"));
|
||||
|
||||
// if the user is sure, apply the no to all
|
||||
if(res2 == QMessageBox::Yes)
|
||||
noToAll = true;
|
||||
|
||||
// otherwise we'll treat this as a simple 'no' in case they changed their mind.
|
||||
}
|
||||
else
|
||||
{
|
||||
// if we're not closing multiple, we can just immediately accept the 'no to all'
|
||||
noToAll = true;
|
||||
}
|
||||
|
||||
res = QMessageBox::No;
|
||||
}
|
||||
}
|
||||
@@ -782,6 +800,12 @@ bool LiveCapture::checkAllowClose()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LiveCapture::checkAllowClose()
|
||||
{
|
||||
bool dummy = false;
|
||||
return checkAllowClose(false, dummy);
|
||||
}
|
||||
|
||||
void LiveCapture::openCapture(Capture *cap)
|
||||
{
|
||||
cap->opened = true;
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
const QString &hostname() { return m_Hostname; }
|
||||
void cleanItems();
|
||||
void fileSaved(QString from, QString to);
|
||||
bool checkAllowClose(bool multipleClosures, bool &noToAll);
|
||||
|
||||
public slots:
|
||||
bool checkAllowClose();
|
||||
|
||||
@@ -1951,6 +1951,8 @@ void MainWindow::setRemoteHost(int hostIdx)
|
||||
if(hostIdx >= 0 && hostIdx < hosts.count())
|
||||
host = hosts[hostIdx];
|
||||
|
||||
bool noToAll = false;
|
||||
|
||||
for(LiveCapture *live : m_LiveCaptures)
|
||||
{
|
||||
// allow live captures to this host to stay open, that way
|
||||
@@ -1959,7 +1961,12 @@ void MainWindow::setRemoteHost(int hostIdx)
|
||||
if(host.IsValid() && live->hostname() == host.Hostname())
|
||||
continue;
|
||||
|
||||
if(!live->checkAllowClose())
|
||||
// if the user previously selected 'no to all' in the save prompts below, apply that to all
|
||||
// subsequent live captures
|
||||
if(noToAll)
|
||||
continue;
|
||||
|
||||
if(!live->checkAllowClose(m_LiveCaptures.count() > 1, noToAll))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2937,9 +2944,16 @@ void MainWindow::loadLayout_triggered()
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
bool noToAll = false;
|
||||
|
||||
for(LiveCapture *live : m_LiveCaptures)
|
||||
{
|
||||
if(!live->checkAllowClose())
|
||||
// if the user previously selected 'no to all' in the save prompts below, apply that to all
|
||||
// subsequent live captures
|
||||
if(noToAll)
|
||||
continue;
|
||||
|
||||
if(!live->checkAllowClose(m_LiveCaptures.count() > 1, noToAll))
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user