29#ifndef IRCBUFFERMODEL_H
30#define IRCBUFFERMODEL_H
34#include <QtCore/qmetatype.h>
35#include <QtCore/qstringlist.h>
36#include <QtCore/qabstractitemmodel.h>
45class IrcBufferModelPrivate;
50 Q_PROPERTY(
int count READ count NOTIFY countChanged)
51 Q_PROPERTY(
bool empty READ isEmpty NOTIFY emptyChanged)
52 Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder)
53 Q_PROPERTY(
Irc::SortMethod sortMethod READ sortMethod WRITE setSortMethod)
54 Q_PROPERTY(QStringList channels READ channels NOTIFY channelsChanged)
55 Q_PROPERTY(
Irc::DataRole displayRole READ displayRole WRITE setDisplayRole)
56 Q_PROPERTY(
bool persistent READ isPersistent WRITE setPersistent NOTIFY persistentChanged)
57 Q_PROPERTY(QList<
IrcBuffer*> buffers READ buffers NOTIFY buffersChanged)
58 Q_PROPERTY(
IrcConnection* connection READ connection WRITE setConnection NOTIFY connectionChanged)
59 Q_PROPERTY(
IrcNetwork* network READ network NOTIFY networkChanged)
60 Q_PROPERTY(
IrcBuffer* bufferPrototype READ bufferPrototype WRITE setBufferPrototype NOTIFY bufferPrototypeChanged)
61 Q_PROPERTY(
IrcChannel* channelPrototype READ channelPrototype WRITE setChannelPrototype NOTIFY channelPrototypeChanged)
62 Q_PROPERTY(
int joinDelay READ joinDelay WRITE setJoinDelay NOTIFY joinDelayChanged)
63 Q_PROPERTY(
bool monitorEnabled READ isMonitorEnabled WRITE setMonitorEnabled NOTIFY monitorEnabledChanged)
76 QStringList channels() const;
80 Q_INVOKABLE
bool contains(const QString& title) const;
85 Q_INVOKABLE
void remove(const QString& title);
88 Qt::SortOrder sortOrder() const;
89 void setSortOrder(Qt::SortOrder order);
91 Irc::SortMethod sortMethod() const;
92 void setSortMethod(
Irc::SortMethod method);
94 Irc::DataRole displayRole() const;
95 void setDisplayRole(
Irc::DataRole role);
97 bool isPersistent() const;
103#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
104 QHash<int, QByteArray>
roleNames()
const override;
106 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
107 QVariant
data(
const QModelIndex&
index,
int role = Qt::DisplayRole)
const override;
108 QModelIndex
index(
int row,
int column = 0,
const QModelIndex& parent = QModelIndex())
const override;
111 void setBufferPrototype(
IrcBuffer* prototype);
114 void setChannelPrototype(
IrcChannel* prototype);
116 int joinDelay()
const;
117 void setJoinDelay(
int delay);
119 bool isMonitorEnabled()
const;
120 void setMonitorEnabled(
bool enabled);
122 Q_INVOKABLE QByteArray
saveState(
int version = 0)
const;
123 Q_INVOKABLE
bool restoreState(
const QByteArray& state,
int version = 0);
128 void sort(
int column = 0, Qt::SortOrder order = Qt::AscendingOrder)
override;
132 void countChanged(
int count);
133 void emptyChanged(
bool empty);
139 void buffersChanged(
const QList<IrcBuffer*>& buffers);
140 void channelsChanged(
const QStringList& channels);
144 void bufferPrototypeChanged(
IrcBuffer* prototype);
145 void channelPrototypeChanged(
IrcChannel* prototype);
147 void joinDelayChanged(
int delay);
148 void monitorEnabledChanged(
bool enabled);
158 friend class IrcBufferLessThan;
159 friend class IrcBufferGreaterThan;
160 QScopedPointer<IrcBufferModelPrivate> d_ptr;
164 Q_PRIVATE_SLOT(d_func(),
void _irc_connected())
165 Q_PRIVATE_SLOT(d_func(),
void _irc_initialized())
166 Q_PRIVATE_SLOT(d_func(),
void _irc_disconnected())
167 Q_PRIVATE_SLOT(d_func(),
void _irc_bufferDestroyed(
IrcBuffer*))
168 Q_PRIVATE_SLOT(d_func(),
void _irc_restoreBuffers())
169 Q_PRIVATE_SLOT(d_func(),
void _irc_monitorStatus())
Q_INVOKABLE QByteArray saveState(int version=0) const
Definition ircbuffermodel.cpp:1373
QHash< int, QByteArray > roleNames() const override
Definition ircbuffermodel.cpp:1187
QModelIndex index(IrcBuffer *buffer) const
Definition ircbuffermodel.cpp:923
void aboutToBeRemoved(IrcBuffer *buffer)
bool empty
Definition ircbuffermodel.h:51
virtual bool lessThan(IrcBuffer *one, IrcBuffer *another, Irc::SortMethod method) const
Definition ircbuffermodel.cpp:1137
virtual IrcBuffer * createBuffer(const QString &title)
Definition ircbuffermodel.cpp:1103
void clear()
Definition ircbuffermodel.cpp:1010
void aboutToBeAdded(IrcBuffer *buffer)
void sort(int column=0, Qt::SortOrder order=Qt::AscendingOrder) override
Definition ircbuffermodel.cpp:1054
bool monitorEnabled
Definition ircbuffermodel.h:63
virtual IrcChannel * createChannel(const QString &title)
Definition ircbuffermodel.cpp:1121
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition ircbuffermodel.cpp:1196
Q_INVOKABLE bool restoreState(const QByteArray &state, int version=0)
Definition ircbuffermodel.cpp:1403
Q_INVOKABLE bool contains(const QString &title) const
Definition ircbuffermodel.cpp:811
IrcBufferModel(QObject *parent=nullptr)
Definition ircbuffermodel.cpp:652
void added(IrcBuffer *buffer)
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition ircbuffermodel.cpp:1208
Q_INVOKABLE int indexOf(IrcBuffer *buffer) const
Definition ircbuffermodel.cpp:821
Q_INVOKABLE IrcBuffer * get(int index) const
Definition ircbuffermodel.cpp:793
void removed(IrcBuffer *buffer)
Q_INVOKABLE void remove(const QString &title)
Definition ircbuffermodel.cpp:848
void messageIgnored(IrcMessage *message)
bool persistent
Definition ircbuffermodel.h:56
Q_INVOKABLE IrcBuffer * add(const QString &title)
Definition ircbuffermodel.cpp:830
Q_INVOKABLE IrcBuffer * find(const QString &title) const
Definition ircbuffermodel.cpp:802
IrcBuffer * buffer(const QModelIndex &index) const
Definition ircbuffermodel.cpp:932
void receiveMessage(IrcMessage *message)
Definition ircbuffermodel.cpp:1045
Keeps track of buffer status.
Definition ircbuffer.h:50
Keeps track of channel status.
Definition ircchannel.h:41
Provides means to establish a connection to an IRC server.
Definition ircconnection.h:49
The base class of all messages.
Definition ircmessage.h:48
Provides network information and capability management.
Definition ircnetwork.h:44
Miscellaneous identifiers used throughout the library.
Definition irc.h:40
SortMethod
Definition irc.h:88