Commit cda1b6d2 authored by Marco Bubke's avatar Marco Bubke Committed by Orgad Shaneh
Browse files

Git: Use Core::AsynchronousMessageBox



Event loops can lead to crashes so it is better to use a dialog which has
not it's own event loop.

Change-Id: Ib703aad698f270b1fa491731adee131ad8b081e6
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent e9a6e990
......@@ -57,6 +57,7 @@
#include <vcsbase/vcsoutputwindow.h>
#include <utils/synchronousprocess.h>
#include <coreplugin/messagebox.h>
#include <QDebug>
#include <QProcess>
......@@ -371,8 +372,8 @@ void GerritPlugin::openView()
{
if (m_dialog.isNull()) {
while (!m_parameters->isValid()) {
QMessageBox::warning(ICore::dialogParent(), tr("Error"),
tr("Invalid Gerrit configuration. Host, user and ssh binary are mandatory."));
Core::AsynchronousMessageBox::warning(tr("Error"),
tr("Invalid Gerrit configuration. Host, user and ssh binary are mandatory."));
const Id group = VcsBase::Constants::VCS_SETTINGS_CATEGORY;
if (!ICore::showOptionsDialog(group, "Gerrit"))
return;
......
......@@ -63,6 +63,7 @@
#include <coreplugin/vcsmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/messagebox.h>
#include <utils/qtcassert.h>
#include <utils/parameteraction.h>
......@@ -81,7 +82,6 @@
#include <QAction>
#include <QFileDialog>
#include <QMessageBox>
#include <QScopedPointer>
#ifdef WITH_TESTS
......@@ -1186,19 +1186,18 @@ void GitPlugin::cleanRepository(const QString &directory)
const bool gotFiles = m_gitClient->synchronousCleanList(directory, &files, &ignoredFiles, &errorMessage);
QApplication::restoreOverrideCursor();
QWidget *parent = ICore::mainWindow();
if (!gotFiles) {
QMessageBox::warning(parent, tr("Unable to retrieve file list"), errorMessage);
Core::AsynchronousMessageBox::warning(tr("Unable to retrieve file list"), errorMessage);
return;
}
if (files.isEmpty() && ignoredFiles.isEmpty()) {
QMessageBox::information(parent, tr("Repository Clean"),
tr("The repository is clean."));
Core::AsynchronousMessageBox::information(tr("Repository Clean"),
tr("The repository is clean."));
return;
}
// Show in dialog
CleanDialog dialog(parent);
CleanDialog dialog(ICore::dialogParent());
dialog.setFileList(directory, files, ignoredFiles);
dialog.exec();
}
......
......@@ -36,6 +36,7 @@
#include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>
#include <vcsbase/vcsoutputwindow.h>
#include <coreplugin/messagebox.h>
#include <QMessageBox>
#include <QProcess>
......@@ -93,8 +94,8 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
arguments << QLatin1String("mergetool") << QLatin1String("-y");
if (!files.isEmpty()) {
if (m_gitClient->gitVersion() < 0x010708) {
QMessageBox::warning(Core::ICore::dialogParent(), tr("Error"),
tr("File input for the merge tool requires Git 1.7.8, or later."));
Core::AsynchronousMessageBox::warning(tr("Error"),
tr("File input for the merge tool requires Git 1.7.8, or later."));
return false;
}
arguments << files;
......
......@@ -35,11 +35,11 @@
#include <vcsbase/vcsbaseconstants.h>
#include <utils/hostosinfo.h>
#include <coreplugin/messagebox.h>
#include <QDir>
#include <QDebug>
#include <QTextStream>
#include <QMessageBox>
namespace Git {
namespace Internal {
......@@ -118,7 +118,7 @@ void SettingsPage::apply()
QString errorMessage;
newSettings.gitExecutable(&gitFoundOk, &errorMessage);
if (!gitFoundOk)
QMessageBox::warning(m_widget, tr("Git Settings"), errorMessage);
Core::AsynchronousMessageBox::warning(tr("Git Settings"), errorMessage);
}
GitPlugin::instance()->setSettings(newSettings);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment