#ifndef WIZARDFACTORY_H #define WIZARDFACTORY_H #include "soundwizard.h" // This template class allows us to create wizards in the heap which auto-delete themselves once finished template class WizardFactory : public T { public: static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings){ (new WizardFactory(appDir, workspaceWizardLocation, vagoSettings))->exec(); } private: // We need to have a constructor to be able to acess "exec" protected function WizardFactory ( const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings ):T(appDir, workspaceWizardLocation, vagoSettings){} }; // Specialization for SoundWizard (it receives extra variables) template<> class WizardFactory : public SoundWizard { public: static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, QHash *commandMap){ (new WizardFactory(appDir, workspaceWizardLocation, vagoSettings, commandMap))->exec(); } private: WizardFactory ( const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, QHash *commandMap ):SoundWizard(appDir, workspaceWizardLocation, vagoSettings, commandMap){} }; #endif // WIZARDFACTORY_H