source: s10k/Vago/wizardfactory.h@ 1098

Last change on this file since 1098 was 1093, checked in by s10k, 7 years ago

Vago 1.4

File size: 1.5 KB
Line 
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
7template<typename T>
8class WizardFactory : public T
9{
10public:
11 static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings){
12 (new WizardFactory<T>(appDir, workspaceWizardLocation, vagoSettings))->exec();
13 }
14private:
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,
20 QSettings *vagoSettings
21 ):T(appDir, workspaceWizardLocation, vagoSettings){}
22};
23
24// Specialization for SoundWizard (it receives extra variables)
25template<>
26class WizardFactory<SoundWizard> : public SoundWizard
27{
28public:
29 static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, QHash<QString, QString> *commandMap){
30 (new WizardFactory(appDir, workspaceWizardLocation, vagoSettings, commandMap))->exec();
31 }
32private:
33 WizardFactory
34 (
35 const QString &appDir,
36 const QString &workspaceWizardLocation,
37 QSettings *vagoSettings,
38 QHash<QString, QString> *commandMap
39 ):SoundWizard(appDir, workspaceWizardLocation, vagoSettings, commandMap){}
40};
41
42
43
44
45
46#endif // WIZARDFACTORY_H
Note: See TracBrowser for help on using the repository browser.