~quassel-dev/quassel/i18n-master

« back to all changes in this revision

Viewing changes to core/coreproxy.h

  • Committer: Manuel Nickschas
  • Date: 2007-06-20 01:21:00 UTC
  • Revision ID: git-v1:077d44f36d2f5c730283ef6be839aea7dd073d56
Starting reorganization of files in preparation of separation of client and GUI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2005/06 by The Quassel Team                             *
3
 
 *   devel@quassel-irc.org                                                 *
4
 
 *                                                                         *
5
 
 *   This program is free software; you can redistribute it and/or modify  *
6
 
 *   it under the terms of the GNU General Public License as published by  *
7
 
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 
 *   (at your option) any later version.                                   *
9
 
 *                                                                         *
10
 
 *   This program is distributed in the hope that it will be useful,       *
11
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 
 *   GNU General Public License for more details.                          *
14
 
 *                                                                         *
15
 
 *   You should have received a copy of the GNU General Public License     *
16
 
 *   along with this program; if not, write to the                         *
17
 
 *   Free Software Foundation, Inc.,                                       *
18
 
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 
 ***************************************************************************/
20
 
 
21
 
#ifndef _COREPROXY_H_
22
 
#define _COREPROXY_H_
23
 
 
24
 
#include "proxy_common.h"
25
 
#include "message.h"
26
 
#include "global.h"
27
 
 
28
 
#include <QtCore>
29
 
#include <QTcpSocket>
30
 
#include <QTcpServer>
31
 
 
32
 
/** This class is the Core side of the proxy. The Core connects its signals and slots to it,
33
 
 *  and the calls are marshalled and sent to (or received and unmarshalled from) the GuiProxy.
34
 
 *  The connection functions are defined in main/main_core.cpp or main/main_mono.cpp.
35
 
 */
36
 
class CoreProxy : public QObject {
37
 
  Q_OBJECT
38
 
 
39
 
  public:
40
 
    CoreProxy();
41
 
 
42
 
  public slots:
43
 
    inline void csUpdateGlobalData(QString key, QVariant data)          { send(CS_UPDATE_GLOBAL_DATA, key, data); }
44
 
    inline void csServerConnected(QString net)                          { send(CS_SERVER_CONNECTED, net); }
45
 
    inline void csServerDisconnected(QString net)                       { send(CS_SERVER_DISCONNECTED, net); }
46
 
    inline void csServerState(QString net, VarMap data)                 { send(CS_SERVER_STATE, net, data); }
47
 
    inline void csDisplayMsg(Message msg)                               { send(CS_DISPLAY_MSG, QVariant::fromValue(msg)); }
48
 
    inline void csDisplayStatusMsg(QString net, QString msg)            { send(CS_DISPLAY_STATUS_MSG, net, msg); }
49
 
    inline void csModeSet(QString net, QString target, QString mode)    { send(CS_MODE_SET, net, target, mode); }
50
 
    inline void csTopicSet(QString net, QString buf, QString topic)     { send(CS_TOPIC_SET, net, buf, topic); }
51
 
    inline void csNickAdded(QString net, QString nick, VarMap props)    { send(CS_NICK_ADDED, net, nick, props); }
52
 
    inline void csNickRemoved(QString net, QString nick)                { send(CS_NICK_REMOVED, net, nick); }
53
 
    inline void csNickRenamed(QString net, QString oldn, QString newn)  { send(CS_NICK_RENAMED, net, oldn, newn); }
54
 
    inline void csNickUpdated(QString net, QString nick, VarMap props)  { send(CS_NICK_UPDATED, net, nick, props); }
55
 
    inline void csOwnNickSet(QString net, QString nick)                 { send(CS_OWN_NICK_SET, net, nick); }
56
 
    inline void csQueryRequested(QString net, QString nick)             { send(CS_QUERY_REQUESTED, net, nick); }
57
 
    inline void csBacklogData(BufferId id, QList<QVariant> msg, bool done) { send(CS_BACKLOG_DATA, QVariant::fromValue(id), msg, done); }
58
 
    inline void csUpdateBufferId(BufferId id)                           { send(CS_UPDATE_BUFFERID, QVariant::fromValue(id)); }
59
 
 
60
 
    inline void csGeneric(CoreSignal sig, QVariant v1 = QVariant(), QVariant v2 = QVariant(), QVariant v3 = QVariant()) { send(sig, v1, v2, v3); }
61
 
 
62
 
  signals:
63
 
    void gsPutGlobalData(QString, QVariant);
64
 
    void gsUserInput(BufferId, QString);
65
 
    void gsRequestConnect(QStringList networks);
66
 
    void gsImportBacklog();
67
 
    void gsRequestBacklog(BufferId, QVariant, QVariant);
68
 
 
69
 
    void gsGeneric(ClientSignal, QVariant, QVariant, QVariant);
70
 
 
71
 
    void requestServerStates();
72
 
 
73
 
    void send(CoreSignal, QVariant arg1 = QVariant(), QVariant arg2 = QVariant(), QVariant arg3 = QVariant());
74
 
 
75
 
  public:
76
 
    //void send(CoreSignal, QVariant arg1 = QVariant(), QVariant arg2 = QVariant(), QVariant arg3 = QVariant());
77
 
    void recv(ClientSignal, QVariant arg1 = QVariant(), QVariant arg2 = QVariant(), QVariant arg3 = QVariant());
78
 
 
79
 
  private:
80
 
    void processClientUpdate(QTcpSocket *, QString key, QVariant data);
81
 
 
82
 
 
83
 
  private:
84
 
 
85
 
  friend class GuiProxy;
86
 
};
87
 
 
88
 
//extern CoreProxy *coreProxy;
89
 
 
90
 
 
91
 
 
92
 
#endif