summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/metafactory.h
blob: 216de03601aa508ae79c723f22289c30a33c3c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef OPIE_META_FACTORY_H
#define OPIE_META_FACTORY_H

/**
 * The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets
 * and to instantiate these implementations on demand
 */

#include <qwidget.h>
#include <qmap.h>

#include <qpe/config.h>

#include "io_layer.h"
#include "file_layer.h"
#include "profile.h"
#include "profileeditorplugins.h"

class MetaFactory {
public:
    typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, Profile* prof);
    typedef IOLayer* (*iolayer)(const Profile& );
    typedef FileTransferLayer* (*filelayer)(IOLayer*);

    MetaFactory();
    ~MetaFactory();

    void addConfigWidgetFactory( const QString&,
                                 const QString&,
                                 configWidget );
    void addIOLayerFactory(const QString&,
                           iolayer );
    void addFileTransferLayer( const QString&,
                               filelayer );
    QStringList ioLayers()const;
    QStringList configWidgets()const;
    QStringList fileTransferLayers()const;
    IOLayer* newIOLayer( const QString&,const Profile& );
    ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, Profile* );

    QString name( const QString& );

private:
    QMap<QString, configWidget> m_confFact;
    QMap<QString, iolayer> m_layerFact;
    QMap<QString, filelayer> m_fileFact;
	QMap<QString, QString> m_namemap;
};


#endif