forked from qt-creator/qt-creator
Delete QMessageBox after usage
Change-Id: Icba5fddb5596f263f2cbb19f91b6ce95ca7785c6 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Laurent Montel
parent
2cf2aca136
commit
44802d754e
@@ -894,18 +894,18 @@ void SessionManagerPrivate::askUserAboutFailedProjects()
|
|||||||
if (!failedProjects.isEmpty()) {
|
if (!failedProjects.isEmpty()) {
|
||||||
QString fileList =
|
QString fileList =
|
||||||
QDir::toNativeSeparators(failedProjects.join(QLatin1String("<br>")));
|
QDir::toNativeSeparators(failedProjects.join(QLatin1String("<br>")));
|
||||||
auto box = new QMessageBox(QMessageBox::Warning,
|
QMessageBox box(QMessageBox::Warning,
|
||||||
SessionManager::tr("Failed to restore project files"),
|
SessionManager::tr("Failed to restore project files"),
|
||||||
SessionManager::tr("Could not restore the following project files:<br><b>%1</b>").
|
SessionManager::tr("Could not restore the following project files:<br><b>%1</b>").
|
||||||
arg(fileList));
|
arg(fileList));
|
||||||
auto keepButton = new QPushButton(SessionManager::tr("Keep projects in Session"), box);
|
auto keepButton = new QPushButton(SessionManager::tr("Keep projects in Session"), &box);
|
||||||
auto removeButton = new QPushButton(SessionManager::tr("Remove projects from Session"), box);
|
auto removeButton = new QPushButton(SessionManager::tr("Remove projects from Session"), &box);
|
||||||
box->addButton(keepButton, QMessageBox::AcceptRole);
|
box.addButton(keepButton, QMessageBox::AcceptRole);
|
||||||
box->addButton(removeButton, QMessageBox::DestructiveRole);
|
box.addButton(removeButton, QMessageBox::DestructiveRole);
|
||||||
|
|
||||||
box->exec();
|
box.exec();
|
||||||
|
|
||||||
if (box->clickedButton() == removeButton)
|
if (box.clickedButton() == removeButton)
|
||||||
m_failedProjects.clear();
|
m_failedProjects.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -554,7 +554,7 @@ void FontSettingsPage::maybeSaveColorScheme()
|
|||||||
if (d_ptr->m_value.colorScheme() == d_ptr->m_ui->schemeEdit->colorScheme())
|
if (d_ptr->m_value.colorScheme() == d_ptr->m_ui->schemeEdit->colorScheme())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning,
|
QMessageBox messageBox(QMessageBox::Warning,
|
||||||
tr("Color Scheme Changed"),
|
tr("Color Scheme Changed"),
|
||||||
tr("The color scheme \"%1\" was modified, do you want to save the changes?")
|
tr("The color scheme \"%1\" was modified, do you want to save the changes?")
|
||||||
.arg(d_ptr->m_ui->schemeEdit->colorScheme().displayName()),
|
.arg(d_ptr->m_ui->schemeEdit->colorScheme().displayName()),
|
||||||
@@ -562,12 +562,12 @@ void FontSettingsPage::maybeSaveColorScheme()
|
|||||||
d_ptr->m_ui->schemeComboBox->window());
|
d_ptr->m_ui->schemeComboBox->window());
|
||||||
|
|
||||||
// Change the text of the discard button
|
// Change the text of the discard button
|
||||||
QPushButton *discardButton = static_cast<QPushButton*>(messageBox->button(QMessageBox::Discard));
|
QPushButton *discardButton = static_cast<QPushButton*>(messageBox.button(QMessageBox::Discard));
|
||||||
discardButton->setText(tr("Discard"));
|
discardButton->setText(tr("Discard"));
|
||||||
messageBox->addButton(discardButton, QMessageBox::DestructiveRole);
|
messageBox.addButton(discardButton, QMessageBox::DestructiveRole);
|
||||||
messageBox->setDefaultButton(QMessageBox::Save);
|
messageBox.setDefaultButton(QMessageBox::Save);
|
||||||
|
|
||||||
if (messageBox->exec() == QMessageBox::Save) {
|
if (messageBox.exec() == QMessageBox::Save) {
|
||||||
const ColorScheme &scheme = d_ptr->m_ui->schemeEdit->colorScheme();
|
const ColorScheme &scheme = d_ptr->m_ui->schemeEdit->colorScheme();
|
||||||
scheme.save(d_ptr->m_value.colorSchemeFileName(), Core::ICore::mainWindow());
|
scheme.save(d_ptr->m_value.colorSchemeFileName(), Core::ICore::mainWindow());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user