Rev | Line | |
---|
[1061] | 1 | #ifndef WIZARDFACTORY_H
|
---|
| 2 | #define WIZARDFACTORY_H
|
---|
| 3 |
|
---|
| 4 | #include "soundwizard.h"
|
---|
| 5 |
|
---|
| 6 | // This template class allows us to create wizards in the heap which auto-delete themselves once finished
|
---|
| 7 | template<typename T>
|
---|
| 8 | class WizardFactory : public T
|
---|
| 9 | {
|
---|
| 10 | public:
|
---|
[1093] | 11 | static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings){
|
---|
| 12 | (new WizardFactory<T>(appDir, workspaceWizardLocation, vagoSettings))->exec();
|
---|
[1061] | 13 | }
|
---|
| 14 | private:
|
---|
| 15 | // We need to have a constructor to be able to acess "exec" protected function
|
---|
| 16 | WizardFactory
|
---|
| 17 | (
|
---|
| 18 | const QString &appDir,
|
---|
| 19 | const QString &workspaceWizardLocation,
|
---|
[1093] | 20 | QSettings *vagoSettings
|
---|
| 21 | ):T(appDir, workspaceWizardLocation, vagoSettings){}
|
---|
[1061] | 22 | };
|
---|
| 23 |
|
---|
| 24 | // Specialization for SoundWizard (it receives extra variables)
|
---|
| 25 | template<>
|
---|
| 26 | class WizardFactory<SoundWizard> : public SoundWizard
|
---|
| 27 | {
|
---|
| 28 | public:
|
---|
[1093] | 29 | static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, QHash<QString, QString> *commandMap){
|
---|
| 30 | (new WizardFactory(appDir, workspaceWizardLocation, vagoSettings, commandMap))->exec();
|
---|
[1061] | 31 | }
|
---|
| 32 | private:
|
---|
| 33 | WizardFactory
|
---|
| 34 | (
|
---|
| 35 | const QString &appDir,
|
---|
| 36 | const QString &workspaceWizardLocation,
|
---|
| 37 | QSettings *vagoSettings,
|
---|
| 38 | QHash<QString, QString> *commandMap
|
---|
[1093] | 39 | ):SoundWizard(appDir, workspaceWizardLocation, vagoSettings, commandMap){}
|
---|
[1061] | 40 | };
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | #endif // WIZARDFACTORY_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.