4
by Joseph Mills
adding backend to the mix for build time |
1 |
/*
|
2 |
* Copyright (C) 2008-2014 The Communi Project
|
|
3 |
*
|
|
4 |
* This library is free software; you can redistribute it and/or modify it
|
|
5 |
* under the terms of the GNU Lesser General Public License as published by
|
|
6 |
* the Free Software Foundation; either version 2 of the License, or (at your
|
|
7 |
* option) any later version.
|
|
8 |
*
|
|
9 |
* This library is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
12 |
* License for more details.
|
|
13 |
*/
|
|
14 |
||
15 |
#ifndef IRCBUFFER_H
|
|
16 |
#define IRCBUFFER_H
|
|
17 |
||
18 |
#include <Irc> |
|
19 |
#include <IrcGlobal> |
|
20 |
#include <QtCore/qobject.h> |
|
21 |
#include <QtCore/qvariant.h> |
|
22 |
#include <QtCore/qmetatype.h> |
|
23 |
#include <QtCore/qscopedpointer.h> |
|
24 |
||
25 |
IRC_BEGIN_NAMESPACE
|
|
26 |
||
27 |
class IrcChannel; |
|
28 |
class IrcCommand; |
|
29 |
class IrcMessage; |
|
30 |
class IrcNetwork; |
|
31 |
class IrcConnection; |
|
32 |
class IrcBufferModel; |
|
33 |
class IrcBufferPrivate; |
|
34 |
||
35 |
class IRC_MODEL_EXPORT IrcBuffer : public QObject |
|
36 |
{
|
|
37 |
Q_OBJECT
|
|
38 |
Q_PROPERTY(QString title READ title NOTIFY titleChanged) |
|
39 |
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |
|
40 |
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix NOTIFY prefixChanged) |
|
41 |
Q_PROPERTY(IrcConnection* connection READ connection CONSTANT) |
|
42 |
Q_PROPERTY(IrcNetwork* network READ network CONSTANT) |
|
43 |
Q_PROPERTY(IrcBufferModel* model READ model CONSTANT) |
|
44 |
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) |
|
45 |
Q_PROPERTY(bool channel READ isChannel CONSTANT) |
|
46 |
Q_PROPERTY(bool sticky READ isSticky WRITE setSticky NOTIFY stickyChanged) |
|
47 |
Q_PROPERTY(bool persistent READ isPersistent WRITE setPersistent NOTIFY persistentChanged) |
|
48 |
Q_PROPERTY(QVariantMap userData READ userData WRITE setUserData NOTIFY userDataChanged) |
|
49 |
||
50 |
public: |
|
51 |
Q_INVOKABLE explicit IrcBuffer(QObject* parent = 0); |
|
52 |
virtual ~IrcBuffer(); |
|
53 |
||
54 |
QString title() const; |
|
55 |
QString name() const; |
|
56 |
QString prefix() const; |
|
57 |
||
58 |
bool isChannel() const; |
|
59 |
Q_INVOKABLE IrcChannel* toChannel(); |
|
60 |
||
61 |
IrcConnection* connection() const; |
|
62 |
IrcNetwork* network() const; |
|
63 |
IrcBufferModel* model() const; |
|
64 |
||
65 |
virtual bool isActive() const; |
|
66 |
||
67 |
bool isSticky() const; |
|
68 |
void setSticky(bool sticky); |
|
69 |
||
70 |
bool isPersistent() const; |
|
71 |
void setPersistent(bool persistent); |
|
72 |
||
73 |
QVariantMap userData() const; |
|
74 |
void setUserData(const QVariantMap& data); |
|
75 |
||
76 |
Q_INVOKABLE bool sendCommand(IrcCommand* command); |
|
77 |
||
78 |
public Q_SLOTS: |
|
79 |
void setName(const QString& name); |
|
80 |
void setPrefix(const QString& prefix); |
|
81 |
void receiveMessage(IrcMessage* message); |
|
82 |
virtual void close(const QString& reason = QString()); |
|
83 |
||
84 |
Q_SIGNALS: |
|
85 |
void titleChanged(const QString& title); |
|
86 |
void nameChanged(const QString& name); |
|
87 |
void prefixChanged(const QString& name); |
|
88 |
void messageReceived(IrcMessage* message); |
|
89 |
void destroyed(IrcBuffer* buffer); |
|
90 |
void activeChanged(bool active); |
|
91 |
void stickyChanged(bool sticky); |
|
92 |
void persistentChanged(bool persistent); |
|
93 |
void userDataChanged(const QVariantMap& data); |
|
94 |
||
95 |
protected: |
|
96 |
IrcBuffer(IrcBufferPrivate& dd, QObject* parent); |
|
97 |
||
98 |
QScopedPointer<IrcBufferPrivate> d_ptr; |
|
99 |
Q_DECLARE_PRIVATE(IrcBuffer) |
|
100 |
Q_DISABLE_COPY(IrcBuffer) |
|
101 |
};
|
|
102 |
||
103 |
#ifndef QT_NO_DEBUG_STREAM
|
|
104 |
IRC_MODEL_EXPORT QDebug operator<<(QDebug debug, const IrcBuffer* buffer); |
|
105 |
#endif // QT_NO_DEBUG_STREAM |
|
106 |
||
107 |
IRC_END_NAMESPACE
|
|
108 |
||
109 |
Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcBuffer*)) |
|
110 |
Q_DECLARE_METATYPE(QList<IRC_PREPEND_NAMESPACE(IrcBuffer*)>) |
|
111 |
||
112 |
#endif // IRCBUFFER_H |