source: s10k/Vago/wizardfactory.h@ 1134

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

Vago 1.4

File size: 1.5 KB
RevLine 
[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
7template<typename T>
8class WizardFactory : public T
9{
10public:
[1093]11 static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings){
12 (new WizardFactory<T>(appDir, workspaceWizardLocation, vagoSettings))->exec();
[1061]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,
[1093]20 QSettings *vagoSettings
21 ):T(appDir, workspaceWizardLocation, vagoSettings){}
[1061]22};
23
24// Specialization for SoundWizard (it receives extra variables)
25template<>
26class WizardFactory<SoundWizard> : public SoundWizard
27{
28public:
[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 }
32private:
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.