summaryrefslogtreecommitdiffstats
path: root/libk3b/plugin/k3bplugin.h
blob: f4501a7dba193fa5e9fe7089286331643f39c293 (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
/* 
 *
 * $Id: k3bplugin.h 619556 2007-01-03 17:38:12Z trueg $
 * Copyright (C) 2003 Sebastian Trueg <trueg@k3b.org>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
 *
 * 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.
 * See the file "COPYING" for the exact licensing terms.
 */


#ifndef _K3B_PLUGIN_H_
#define _K3B_PLUGIN_H_

#include <qobject.h>
#include <kgenericfactory.h>
#include "k3b_export.h"

#define K3B_PLUGIN_SYSTEM_VERSION 3


class K3bPluginConfigWidget;
class QWidget;



class K3bPluginInfo
{
  friend class K3bPluginManager;

 public:
  K3bPluginInfo() {
  }

  K3bPluginInfo( QString libraryName,
		 QString name,
		 QString author,
		 QString email,
		 QString comment,
		 QString version,
		 QString licence )
    : m_libraryName(libraryName),
    m_name(name),
    m_author(author),
    m_email(email),
    m_comment(comment),
    m_version(version),
    m_licence(licence) {
  }

  const QString& name() const { return m_name; }
  const QString& author() const { return m_author; }
  const QString& email() const { return m_email; }
  const QString& comment() const { return m_comment; }
  const QString& version() const { return m_version; }
  const QString& licence() const { return m_licence; }

  const QString& libraryName() const { return m_libraryName; }

 private:
  QString m_libraryName;

  QString m_name;
  QString m_author;
  QString m_email;
  QString m_comment;
  QString m_version;
  QString m_licence;
};


/**
 * Base class for all plugins. You may use the K3bPluginFactory to make your plugin available.
 */
class LIBK3B_EXPORT K3bPlugin : public QObject
{
  Q_OBJECT

    friend class K3bPluginManager;

 public:
  K3bPlugin( QObject* parent = 0, const char* name = 0 );
  virtual ~K3bPlugin();

  const K3bPluginInfo& pluginInfo() const { return m_pluginInfo; }

  /**
   * Version of the plugin system this plugin was written for.
   */
  virtual int pluginSystemVersion() const = 0;

  /**
   * The plugin group.
   */
  virtual QString group() const = 0;

  /**
   * Returns a widget which configures the plugin.
   *
   * The caller has to destroy the widget
   */
  virtual K3bPluginConfigWidget* createConfigWidget( QWidget* parent = 0, const char* name = 0 ) const;

 private:
  K3bPluginInfo m_pluginInfo;
};

#endif