Optimization MaybeSave() method for Mac OS.
--HG-- branch : develop
This commit is contained in:
parent
6cd674ec0f
commit
1ccb8f3452
|
@ -2014,17 +2014,32 @@ bool TMainWindow::MaybeSave()
|
||||||
return true;// Don't ask if file was created without modifications.
|
return true;// Don't ask if file was created without modifications.
|
||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox::StandardButton ret;
|
QMessageBox *messageBox = new QMessageBox(tr("Unsaved changes"),
|
||||||
ret = QMessageBox::warning(this, tr("Unsaved changes"), tr("Measurements have been modified.\n"
|
tr("Measurements have been modified.\n"
|
||||||
"Do you want to save your changes?"),
|
"Do you want to save your changes?"),
|
||||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No,
|
||||||
if (ret == QMessageBox::Save)
|
QMessageBox::Cancel, this, Qt::Sheet);
|
||||||
|
|
||||||
|
messageBox->setDefaultButton(QMessageBox::Yes);
|
||||||
|
messageBox->setEscapeButton(QMessageBox::Cancel);
|
||||||
|
|
||||||
|
messageBox->setButtonText(QMessageBox::Yes, curFile.isEmpty() ? tr("Save...") : tr("Save"));
|
||||||
|
messageBox->setButtonText(QMessageBox::No, tr("Don't Save"));
|
||||||
|
|
||||||
|
messageBox->setWindowModality(Qt::ApplicationModal);
|
||||||
|
const QMessageBox::StandardButton ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
|
||||||
|
|
||||||
|
switch (ret)
|
||||||
{
|
{
|
||||||
FileSave();
|
case QMessageBox::Yes:
|
||||||
}
|
FileSave();
|
||||||
else if (ret == QMessageBox::Cancel)
|
return true;
|
||||||
{
|
case QMessageBox::No:
|
||||||
return false;
|
return true;
|
||||||
|
case QMessageBox::Cancel:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2909,17 +2909,31 @@ bool MainWindow::MaybeSave()
|
||||||
{
|
{
|
||||||
if (this->isWindowModified() && guiEnabled)
|
if (this->isWindowModified() && guiEnabled)
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton ret;
|
QMessageBox *messageBox = new QMessageBox(tr("Unsaved changes"),
|
||||||
ret = QMessageBox::warning(this, tr("Unsaved changes"), tr("The pattern has been modified.\n"
|
tr("The pattern has been modified.\n"
|
||||||
"Do you want to save your changes?"),
|
"Do you want to save your changes?"),
|
||||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No,
|
||||||
if (ret == QMessageBox::Save)
|
QMessageBox::Cancel, this, Qt::Sheet);
|
||||||
|
|
||||||
|
messageBox->setDefaultButton(QMessageBox::Yes);
|
||||||
|
messageBox->setEscapeButton(QMessageBox::Cancel);
|
||||||
|
|
||||||
|
messageBox->setButtonText(QMessageBox::Yes, curFile.isEmpty() ? tr("Save...") : tr("Save"));
|
||||||
|
messageBox->setButtonText(QMessageBox::No, tr("Don't Save"));
|
||||||
|
|
||||||
|
messageBox->setWindowModality(Qt::ApplicationModal);
|
||||||
|
const QMessageBox::StandardButton ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
|
||||||
|
|
||||||
|
switch (ret)
|
||||||
{
|
{
|
||||||
return Save();
|
case QMessageBox::Yes:
|
||||||
}
|
return Save();
|
||||||
else if (ret == QMessageBox::Cancel)
|
case QMessageBox::No:
|
||||||
{
|
return true;
|
||||||
return false;
|
case QMessageBox::Cancel:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user