coreplugin: remove unused return value from virtual void runWizard

This commit is contained in:
hjk
2010-09-16 17:09:36 +02:00
parent 9217ad97d2
commit ade574cc45
6 changed files with 15 additions and 22 deletions

View File

@@ -477,9 +477,9 @@ QString BaseFileWizard::displayCategory() const
return m_d->m_parameters.displayCategory(); return m_d->m_parameters.displayCategory();
} }
QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent) void BaseFileWizard::runWizard(const QString &path, QWidget *parent)
{ {
QTC_ASSERT(!path.isEmpty(), return QStringList()) QTC_ASSERT(!path.isEmpty(), return);
typedef QList<IFileWizardExtension*> ExtensionList; typedef QList<IFileWizardExtension*> ExtensionList;
@@ -508,7 +508,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
// leaving the func, but not before the IFileWizardExtension::process // leaving the func, but not before the IFileWizardExtension::process
// has been called // has been called
const QScopedPointer<QWizard> wizard(createWizardDialog(parent, path, allExtensionPages)); const QScopedPointer<QWizard> wizard(createWizardDialog(parent, path, allExtensionPages));
QTC_ASSERT(!wizard.isNull(), return QStringList()) QTC_ASSERT(!wizard.isNull(), return);
GeneratedFiles files; GeneratedFiles files;
// Run the wizard: Call generate files on switching to the first extension // Run the wizard: Call generate files on switching to the first extension
@@ -538,7 +538,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
break; break;
} }
if (files.empty()) if (files.empty())
return QStringList(); return;
// Compile result list and prompt for overwrite // Compile result list and prompt for overwrite
QStringList result; QStringList result;
foreach (const GeneratedFile &generatedFile, files) foreach (const GeneratedFile &generatedFile, files)
@@ -546,10 +546,10 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
switch (promptOverwrite(result, &errorMessage)) { switch (promptOverwrite(result, &errorMessage)) {
case OverwriteCanceled: case OverwriteCanceled:
return QStringList(); return;
case OverwriteError: case OverwriteError:
QMessageBox::critical(0, tr("Existing files"), errorMessage); QMessageBox::critical(0, tr("Existing files"), errorMessage);
return QStringList(); return;
case OverwriteOk: case OverwriteOk:
break; break;
} }
@@ -557,7 +557,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
// Write // Write
if (!writeFiles(files, &errorMessage)) { if (!writeFiles(files, &errorMessage)) {
QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage); QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
return QStringList(); return;
} }
bool removeOpenProjectAttribute = false; bool removeOpenProjectAttribute = false;
@@ -566,7 +566,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
bool remove; bool remove;
if (!ex->process(files, &remove, &errorMessage)) { if (!ex->process(files, &remove, &errorMessage)) {
QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage); QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
return QStringList(); return;
} }
removeOpenProjectAttribute |= remove; removeOpenProjectAttribute |= remove;
} }
@@ -579,12 +579,8 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
} }
// Post generation handler // Post generation handler
if (!postGenerateFiles(wizard.data(), files, &errorMessage)) { if (!postGenerateFiles(wizard.data(), files, &errorMessage))
QMessageBox::critical(0, tr("File Generation Failure"), errorMessage); QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
return QStringList();
}
return result;
} }
// Write // Write

View File

@@ -181,7 +181,7 @@ public:
virtual QString category() const; virtual QString category() const;
virtual QString displayCategory() const; virtual QString displayCategory() const;
virtual QStringList runWizard(const QString &path, QWidget *parent); virtual void runWizard(const QString &path, QWidget *parent);
// Build a file name, adding the extension unless baseName already has one // Build a file name, adding the extension unless baseName already has one
static QString buildFileName(const QString &path, const QString &baseName, const QString &extension); static QString buildFileName(const QString &path, const QString &baseName, const QString &extension);

View File

@@ -125,13 +125,12 @@
*/ */
/*! /*!
\fn QStringList IWizard::runWizard(const QString &path, QWidget *parent) \fn void IWizard::runWizard(const QString &path, QWidget *parent)
This method is executed when the wizard has been selected by the user This method is executed when the wizard has been selected by the user
for execution. Any dialogs the wizard opens should use the given \a parent. for execution. Any dialogs the wizard opens should use the given \a parent.
The \a path argument is a suggestion for the location where files should be The \a path argument is a suggestion for the location where files should be
created. The wizard should fill this in its path selection elements as a created. The wizard should fill this in its path selection elements as a
default path. default path.
Returns a list of files (absolute paths) that have been created, if any.
*/ */
using namespace Core; using namespace Core;

View File

@@ -63,7 +63,7 @@ public:
virtual QString category() const = 0; virtual QString category() const = 0;
virtual QString displayCategory() const = 0; virtual QString displayCategory() const = 0;
virtual QStringList runWizard(const QString &path, QWidget *parent) = 0; virtual void runWizard(const QString &path, QWidget *parent) = 0;
// Utility to find all registered wizards // Utility to find all registered wizards
static QList<IWizard*> allWizards(); static QList<IWizard*> allWizards();

View File

@@ -95,7 +95,7 @@ void BaseCheckoutWizard::setId(const QString &id)
d->id = id; d->id = id;
} }
QStringList BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent) void BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent)
{ {
// Create dialog and launch // Create dialog and launch
d->parameterPages = createParameterPages(path); d->parameterPages = createParameterPages(path);
@@ -104,7 +104,7 @@ QStringList BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent)
connect(&dialog, SIGNAL(progressPageShown()), this, SLOT(slotProgressPageShown())); connect(&dialog, SIGNAL(progressPageShown()), this, SLOT(slotProgressPageShown()));
dialog.setWindowTitle(displayName()); dialog.setWindowTitle(displayName());
if (dialog.exec() != QDialog::Accepted) if (dialog.exec() != QDialog::Accepted)
return QStringList(); return;
// Now try to find the project file and open // Now try to find the project file and open
const QString checkoutPath = d->checkoutPath; const QString checkoutPath = d->checkoutPath;
d->clear(); d->clear();
@@ -115,9 +115,7 @@ QStringList BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent)
tr("Failed to open project in '%1'.").arg(QDir::toNativeSeparators(checkoutPath))); tr("Failed to open project in '%1'.").arg(QDir::toNativeSeparators(checkoutPath)));
msgBox.setDetailedText(errorMessage); msgBox.setDetailedText(errorMessage);
msgBox.exec(); msgBox.exec();
return QStringList();
} }
return QStringList(projectFile);
} }
static inline QString msgNoProjectFiles(const QDir &dir, const QStringList &patterns) static inline QString msgNoProjectFiles(const QDir &dir, const QStringList &patterns)

View File

@@ -73,7 +73,7 @@ public:
virtual QString displayCategory() const; virtual QString displayCategory() const;
virtual QString id() const; virtual QString id() const;
virtual QStringList runWizard(const QString &path, QWidget *parent); virtual void runWizard(const QString &path, QWidget *parent);
static QString openProject(const QString &path, QString *errorMessage); static QString openProject(const QString &path, QString *errorMessage);