1 /***************************************************************************
3 copyright : (C) Mark Kretschmann
5 ***************************************************************************/
7 /***************************************************************************
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 ***************************************************************************/
16 #ifndef AMAROK_PLUGINMANAGER_H
17 #define AMAROK_PLUGINMANAGER_H
20 #include <KServiceTypeTrader>
24 namespace Amarok
{ class Plugin
; }
30 /** Bump this number whenever the plugin framework gets incompatible with older versions */
31 static const int FrameworkVersion
= 30;
34 * It will return a list of services that match your
35 * specifications. The only required parameter is the service
36 * type. This is something like 'text/plain' or 'text/html'. The
37 * constraint parameter is used to limit the possible choices
38 * returned based on the constraints you give it.
40 * The @p constraint language is rather full. The most common
41 * keywords are AND, OR, NOT, IN, and EXIST, all used in an
42 * almost spoken-word form. An example is:
44 * (Type == 'Service') and (('KParts/ReadOnlyPart' in ServiceTypes) or (exist Exec))
47 * The keys used in the query (Type, ServiceType, Exec) are all
48 * fields found in the .desktop files.
50 * @param constraint A constraint to limit the choices returned, QString::null to
51 * get all services of the given @p servicetype
53 * @return A list of services that satisfy the query
54 * @see http://developer.kde.org/documentation/library/kdeqt/tradersyntax.html
56 static KService::List
query( const QString
& constraint
= QString() );
59 * Load and instantiate plugin from query
60 * @param constraint A constraint to limit the choices returned, QString::null to
61 * get all services of the given @p servicetype
62 * @return Pointer to Plugin, or NULL if error
63 * @see http://developer.kde.org/documentation/library/kdeqt/tradersyntax.html
65 static Amarok::Plugin
* createFromQuery( const QString
& constraint
= QString() );
68 * Load and instantiate plugin from service
69 * @param service Pointer to KService
70 * @return Pointer to Plugin, or NULL if error
72 static Amarok::Plugin
* createFromService( const KService::Ptr service
);
75 * Remove library and delete plugin
76 * @param plugin Pointer to plugin
78 static void unload( Amarok::Plugin
* plugin
);
81 * Look up service for loaded plugin from store
82 * @param pointer Pointer to plugin
83 * @return KService, or 0 if not found
85 static KService::Ptr
getService( const Amarok::Plugin
* plugin
);
88 * Dump properties from a service to stdout for debugging
89 * @param service Pointer to KService
91 static void dump( const KService::Ptr service
);
94 * Show modal info dialog about plugin
95 * @param constraint A constraint to limit the choices returned
97 static void showAbout( const QString
& constraint
);
101 Amarok::Plugin
* plugin
;
103 KService::Ptr service
;
106 static std::vector
<StoreItem
>::iterator
lookupPlugin( const Amarok::Plugin
* plugin
);
109 static std::vector
<StoreItem
> m_store
;
113 #endif /* AMAROK_PLUGINMANAGER_H */