summaryrefslogtreecommitdiffstats
path: root/src/include/pluginmanager.h
blob: cd4e79e40299860ca6683bd7ff359948588ba091 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/***************************************************************************
                          pluginmanager.h  -  description
                             -------------------
    begin                : Mon Apr 28 2003
    copyright            : (C) 2003 by Martin Witte
    email                : witte@kawo1.rwth-aachen.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KRADIO_PLUGINMANAGER_INTERFACES_H
#define KRADIO_PLUGINMANAGER_INTERFACES_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <tqstring.h>
#include <tqptrdict.h>
#include <tdemacros.h>

#include "plugins.h"

class PluginBase;
class WidgetPluginBase;
class PluginConfigurationDialog;
class PluginManagerConfiguration;
class TQWidget;
class TDEConfig;
class TQFrame;
class TDEAboutDialog;
class KDialogBase;

struct ConfigPageInfo;
class TQMenuData;
class TDERadioApp;


class TDE_EXPORT PluginManager : public TQObject
{
TQ_OBJECT

public :
             PluginManager(const TQString &name,
                           TDERadioApp *app,
                           const TQString &configDialogTitle,
                           const TQString &aboutTitle);
    virtual ~PluginManager();

    // Library Functions

    void                 noticeLibrariesChanged();
    void                 unloadPlugins(const TQString &class_name);

    // managing plugins

    const PluginList    &plugins() const { return m_plugins; }
    void                 addWidgetPluginMenuItems(TQMenuData *menu, TQMap<WidgetPluginBase *,int> &map) const;
    void                 updateWidgetPluginMenuItem(WidgetPluginBase *p, TQMenuData *menu, TQMap<WidgetPluginBase *,int> &map, bool shown) const;

    PluginBase          *getPluginByName(const TQString &name) const;

    // after insert, pluginManager is responsible for deletion
    void                 insertPlugin(PluginBase *);

    // remove and delete plugin
    void                 deletePlugin(PluginBase *);
    void                 deletePluginByName(const TQString &name) { deletePlugin(getPluginByName(name)); }

    // remove plugin, afterwards pluginManager is no longer responsible for deletion
    void                 removePlugin(PluginBase *);
    void                 removePluginByName(const TQString &name) { removePlugin(getPluginByName(name)); }

    // operations on all plugins

    virtual void         saveState    (TDEConfig *) const;
    virtual void         restoreState (TDEConfig *);
    virtual void         startPlugins();

    // configuration dialog handling

    virtual PluginConfigurationDialog *getConfigDialog();
    virtual KDialogBase               *getAboutDialog();
    virtual bool                       showsProgressBar() const { return m_showProgressBar; }
    virtual void                       showProgressBar(bool b) { m_showProgressBar = b; }

    virtual void         noticeWidgetPluginShown(WidgetPluginBase *p, bool shown);

protected :
    virtual void         createConfigDialog(const TQString &title = TQString());
    virtual void         createAboutDialog (const TQString &title = TQString());

    virtual void         addConfigurationPage (PluginBase *forWhom,
                                               const ConfigPageInfo    &info);
    virtual void         addAboutPage         (PluginBase *forWhom,
                                               const AboutPageInfo     &info);

protected slots:

    virtual void         slotConfigOK();

public slots:
    virtual void         aboutToQuit();

signals:

    virtual void         sigConfigOK();

private:
    virtual TQFrame      *addConfigurationPage (const ConfigPageInfo    &info);
    ConfigPageInfo       createOwnConfigurationPage();

    // PluginManager's data & types ;)
protected:
    typedef TQPtrDict<TQFrame>               TQFrameDict;
    typedef TQPtrDictIterator<TQFrame>       TQFrameDictIterator;
    typedef TQPtrDict<TQWidget>              TQWidgetDict;
    typedef TQPtrDictIterator<TQWidget>      TQWidgetDictIterator;

    TQString      m_Name;
    TDERadioApp   *m_Application;

    PluginList   m_plugins;
    bool         m_showProgressBar;

    TQFrameDict   m_configPageFrames;
    TQWidgetDict  m_configPages;

    TQFrameDict   m_aboutPageFrames;
    TQWidgetDict  m_aboutPages;

    PluginConfigurationDialog *m_configDialog;
    PluginManagerConfiguration*m_pluginManagerConfiguration;
    KDialogBase               *m_aboutDialog;
    TQString                    m_configDialogTitle;
    TQString                    m_aboutDialogTitle;
};




#endif