~ubuntu-branches/ubuntu/natty/kadu/natty

« back to all changes in this revision

Viewing changes to kadu-core/protocols_manager.h

  • Committer: Package Import Robot
  • Author(s): Kiszel Kristóf
  • Date: 2010-07-21 15:24:54 UTC
  • mfrom: (0.6.1) (0.5.1) (1.4.1) (22.1.2 maverick)
  • Revision ID: package-import@ubuntu.com-20100721152454-vttqle18lovfudni
Tags: 0.6.5.4.ds1-3ubuntu2
Remove libqt4-webkit-dev from build-depends and add
libqtwebkit-dev for qtwebkit transition

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef KADU_PROTOCOLS_MANAGER_H
 
2
#define KADU_PROTOCOLS_MANAGER_H
 
3
 
 
4
#include <QtCore/QList>
 
5
 
 
6
#include "protocol.h"
 
7
#include "exports.h"
 
8
 
 
9
class KADUAPI ProtocolManager : public QObject
 
10
{
 
11
        Q_OBJECT
 
12
 
 
13
public slots:
 
14
        virtual Protocol * newInstance(const QString &id) = 0;
 
15
 
 
16
};
 
17
 
 
18
class KADUAPI ProtocolsManager : public QObject
 
19
{
 
20
        ProtocolsManager();
 
21
        ~ProtocolsManager();
 
22
 
 
23
        struct ProtocolDescription
 
24
        {
 
25
                QString protocolID;
 
26
                QString Name;
 
27
                ProtocolManager *Manager;
 
28
                        
 
29
                ProtocolDescription(const QString &id, const QString &name, ProtocolManager *manager)
 
30
                        : protocolID(id), Name(name), Manager(manager) {}
 
31
                ProtocolDescription() : protocolID(), Name(), Manager(0) {}
 
32
                ProtocolDescription(const ProtocolDescription &c) 
 
33
                        : protocolID(c.protocolID), Name(c.Name), Manager(c.Manager) {}
 
34
 
 
35
                bool operator == (const ProtocolDescription &pd)  { return protocolID == pd.protocolID; }
 
36
        };
 
37
 
 
38
        QList<ProtocolDescription> protocolDescriptions;
 
39
        QList<Protocol *> protocols;
 
40
 
 
41
public:
 
42
        static void initModule();
 
43
        static void closeModule();
 
44
 
 
45
        QList<Protocol *> byProtocolID(const QString &protocolID);
 
46
        Protocol *byID(const QString &protocolID, const QString &ID);
 
47
                
 
48
        void registerProtocol(const QString &protocolID, const QString &name, ProtocolManager *manager);
 
49
        void unregisterProtocol(const QString &protocolID);
 
50
        Protocol * newProtocol(const QString &protocolID, const QString &ID);
 
51
 
 
52
};
 
53
 
 
54
extern KADUAPI ProtocolsManager *protocols_manager;
 
55
 
 
56
#endif