summaryrefslogtreecommitdiffstats
path: root/quanta/plugins/quantaplugininterface.h
blob: 28458fad29144b64842b5574830aa24f4397dea4 (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
/***************************************************************************
                          quantaplugininterface.h  -  description
                             -------------------
    begin                : Mon Sep 16 2002
    copyright            : (C) 2002 by Marc Britton <[email protected]>
                           (C) 2003 by Andras Mantia <[email protected]>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 QUANTAPLUGININTERFACE_H
#define QUANTAPLUGININTERFACE_H

/* KDE INCLUDES */
#include <tdeconfig.h>
#include <kstandarddirs.h>

/* QT INCLUDES */
#include <tqobject.h>
#include <tqdict.h>
#include <tqstringlist.h>
#include <tqpopupmenu.h>

/* OTHER INCLUDES */

class QuantaPlugin;

/**Provides an interface to the installed plugins
  *@author Marc Britton
  */
class QuantaPluginInterface : public TQObject
{
  Q_OBJECT
  
public:
  /**
   *  since this class is a singleton you must use this function to access it
   *
   *  the parameters are only used at the first call to create the class
   *
   */
  static QuantaPluginInterface* const ref(TQWidget *parent = 0L)
  {
    static QuantaPluginInterface *m_ref;
    if (!m_ref) m_ref = new QuantaPluginInterface (parent);
    return m_ref;
  }

  ~QuantaPluginInterface();
  /** Reads the rc file */
  virtual void readConfig();
  /** Write the rc file */
  virtual void writeConfig();
  /* Returns TRUE if the plugin specified by a_name is available for us*/
  bool pluginAvailable(const TQString &);
  /** Gets the plugins */
  TQDict<QuantaPlugin> plugins() {return m_plugins;};
  /** Sets the plugins */
  void setPlugins(TQDict<QuantaPlugin> plugins) {m_plugins = plugins;};
  /** Gets the plugin specified by a_name */
  virtual QuantaPlugin *plugin(const TQString &);
  /** Gets the plugin menu */
  virtual TQPopupMenu *pluginMenu() {return m_pluginMenu;};
  void setPluginMenu(TQPopupMenu *pluginMenu) {m_pluginMenu = pluginMenu;}
  /** Builds the plugins menu dynamically */
  void buildPluginMenu();

private:
  /** The constructor is privat because we use singleton patter.
   *  If you need the class use QuantaPluginInterface::ref() for
   *  construction and reference
   */
  QuantaPluginInterface(TQWidget *parent);

protected slots:
  /** slot for the menu: validate */
  void slotPluginsValidate();
  /** slot for the menu: edit */
  void slotPluginsEdit();

protected:
  /** Gets the plugin names */
  virtual TQStringList pluginNames() const;
  void readConfigFile(const TQString& configFile);

  TQDict<QuantaPlugin> m_plugins;

  TQWidget *m_parent;

  TQPopupMenu *m_pluginMenu;

signals:
  void hideSplash();
  void statusMsg(const TQString &);
};

#endif