Cleanup IWizard interface and users

Added 639 lines, removed 1391.

Change-Id: I15ec7dd056d4f7ad79c6dd6a4181007ad14f6a43
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
hjk
2013-09-20 15:12:44 +02:00
parent aa32c2be87
commit 49d0789e64
76 changed files with 554 additions and 1306 deletions

View File

@@ -236,8 +236,8 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error
Core::FileIconProvider::registerIconOverlayForMimeType(icon, C_PY_MIMETYPE);
// Add Python files and classes creation dialogs
addAutoReleasedObject(new FileWizard(Core::ICore::instance()));
addAutoReleasedObject(new ClassWizard(Core::ICore::instance()));
addAutoReleasedObject(new FileWizard);
addAutoReleasedObject(new ClassWizard);
addAutoReleasedObject(new Internal::PythonHighlighterFactory);
return true;

View File

@@ -45,22 +45,14 @@ using namespace ProjectExplorer;
namespace PythonEditor {
namespace Internal {
static Core::BaseFileWizardParameters getDefaultParams()
{
Core::BaseFileWizardParameters p(Core::IWizard::FileWizard);
p.setId(QLatin1String(Constants::C_PY_CLASS_WIZARD_ID));
p.setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
p.setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
p.setDisplayName(ClassWizard::tr(Constants::EN_PY_CLASS_DISPLAY_NAME));
p.setDescription(ClassWizard::tr(Constants::EN_PY_CLASS_DESCRIPTION));
return p;
}
ClassWizard::ClassWizard(QObject *parent) :
Core::BaseFileWizard(getDefaultParams(), parent)
ClassWizard::ClassWizard()
{
setWizardKind(Core::IWizard::FileWizard);
setId(QLatin1String(Constants::C_PY_CLASS_WIZARD_ID));
setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
setDisplayName(ClassWizard::tr(Constants::EN_PY_CLASS_DISPLAY_NAME));
setDescription(ClassWizard::tr(Constants::EN_PY_CLASS_DESCRIPTION));
}
QWizard *ClassWizard::createWizardDialog(

View File

@@ -46,9 +46,9 @@ class ClassWizard : public Core::BaseFileWizard
Q_OBJECT
public:
explicit ClassWizard(QObject *parent = 0);
ClassWizard();
protected:
private:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &params) const;

View File

@@ -41,32 +41,18 @@
namespace PythonEditor {
/**
* @brief GetDefaultParams
* @return Default parameters for menu item "Files&Classes->Python->Python file"
*/
static const Core::BaseFileWizardParameters GetDefaultParams()
{
Core::BaseFileWizardParameters p(Core::IWizard::FileWizard);
p.setId(QLatin1String(Constants::C_PY_SOURCE_WIZARD_ID));
p.setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
p.setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
p.setDisplayName(
FileWizard::tr(Constants::EN_PY_SOURCE_DISPLAY_NAME));
p.setDescription(
FileWizard::tr(Constants::EN_PY_SOURCE_DESCRIPTION));
return p;
}
/**
* @brief Initialize wizard and add new option to "New..." dialog.
* @param parent
*/
FileWizard::FileWizard(QObject *parent)
:Core::BaseFileWizard(GetDefaultParams(), parent)
FileWizard::FileWizard()
{
setWizardKind(Core::IWizard::FileWizard);
setId(QLatin1String(Constants::C_PY_SOURCE_WIZARD_ID));
setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
setDisplayName(FileWizard::tr(Constants::EN_PY_SOURCE_DISPLAY_NAME));
setDescription(FileWizard::tr(Constants::EN_PY_SOURCE_DESCRIPTION));
}
FileWizard::~FileWizard()

View File

@@ -39,16 +39,14 @@ class FileWizard : public Core::BaseFileWizard
Q_OBJECT
public:
explicit FileWizard(QObject *parent = 0);
virtual ~FileWizard();
FileWizard();
~FileWizard();
protected:
virtual QWizard *createWizardDialog(
QWidget *parent,
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &params) const;
virtual Core::GeneratedFiles generateFiles(
const QWizard *dialog,
Core::GeneratedFiles generateFiles( const QWizard *dialog,
QString *errorMessage) const;
};