forked from qt-creator/qt-creator
Introduce BaseFileWizard
Introduce BaseFileWizard and derive all File Wizards from that. Change BaseFileWizardFactory::create(...) to return a BaseFileWizard. Change-Id: Ic0cb9e9d0390045dab57cd1a75a0f839c1f90216 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -55,7 +55,7 @@ ClassWizard::ClassWizard()
|
||||
setDescription(ClassWizard::tr(Constants::EN_PY_CLASS_DESCRIPTION));
|
||||
}
|
||||
|
||||
QWizard *ClassWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
Core::BaseFileWizard *ClassWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
ClassWizardDialog *wizard = new ClassWizardDialog(parent);
|
||||
foreach (QWizardPage *p, parameters.extensionPages())
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
ClassWizard();
|
||||
|
||||
private:
|
||||
QWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
||||
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
||||
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
namespace PythonEditor {
|
||||
namespace Internal {
|
||||
|
||||
ClassWizardDialog::ClassWizardDialog(QWidget *parent)
|
||||
: Utils::Wizard(parent)
|
||||
, m_classNamePage(new ClassNamePage(this))
|
||||
ClassWizardDialog::ClassWizardDialog(QWidget *parent) :
|
||||
Core::BaseFileWizard(parent),
|
||||
m_classNamePage(new ClassNamePage(this))
|
||||
{
|
||||
setWindowTitle(tr("Python Class Wizard"));
|
||||
const int classNameId = addPage(m_classNamePage.data());
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
#ifndef PYTHONEDITOR_CLASSWIZARDDIALOG_H
|
||||
#define PYTHONEDITOR_CLASSWIZARDDIALOG_H
|
||||
|
||||
#include <utils/wizard.h>
|
||||
#include <coreplugin/basefilewizard.h>
|
||||
|
||||
#include <utils/newclasswidget.h>
|
||||
#include <QScopedPointer>
|
||||
#include <QVariantMap>
|
||||
@@ -50,7 +51,7 @@ public:
|
||||
Utils::NewClassWidget::ClassType classType;
|
||||
};
|
||||
|
||||
class ClassWizardDialog : public Utils::Wizard
|
||||
class ClassWizardDialog : public Core::BaseFileWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "pythonfilewizard.h"
|
||||
#include "../pythoneditorconstants.h"
|
||||
|
||||
#include <utils/filewizarddialog.h>
|
||||
#include <coreplugin/basefilewizard.h>
|
||||
#include <texteditor/textfilewizard.h>
|
||||
|
||||
#include <QWizard>
|
||||
@@ -61,15 +61,15 @@ FileWizard::FileWizard()
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
QWizard *FileWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
Core::BaseFileWizard *FileWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
Utils::FileWizardDialog *pDialog = new Utils::FileWizardDialog(parent);
|
||||
pDialog->setWindowTitle(tr("New %1").arg(displayName()));
|
||||
pDialog->setPath(parameters.defaultPath());
|
||||
Core::BaseFileWizard *wizard = new Core::BaseFileWizard(parent);
|
||||
wizard->setWindowTitle(tr("New %1").arg(displayName()));
|
||||
wizard->setPath(parameters.defaultPath());
|
||||
foreach (QWizardPage *p, parameters.extensionPages())
|
||||
applyExtensionPageShortTitle(pDialog, pDialog->addPage(p));
|
||||
applyExtensionPageShortTitle(wizard, wizard->addPage(p));
|
||||
|
||||
return pDialog;
|
||||
return wizard;
|
||||
}
|
||||
|
||||
Core::GeneratedFiles FileWizard::generateFiles(const QWizard *dialog,
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
FileWizard();
|
||||
|
||||
protected:
|
||||
QWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
||||
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
||||
|
||||
Core::GeneratedFiles generateFiles(const QWizard *dialog, QString *errorMessage) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user