#include "client.h"
-INIT_SYNCABLE_OBJECT(ClientAliasManager)
ClientAliasManager::ClientAliasManager(QObject *parent)
: AliasManager(parent)
{
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENTALIASMANAGER_H
-#define CLIENTALIASMANAGER_H
+#pragma once
#include "aliasmanager.h"
class ClientAliasManager : public AliasManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
explicit ClientAliasManager(QObject *parent = 0);
- inline virtual const QMetaObject *syncMetaObject() const { return &AliasManager::staticMetaObject; }
-
protected:
const Network *network(NetworkId) const;
};
-
-
-#endif //CLIENTALIASMANAGER_H
#include <QDebug>
-INIT_SYNCABLE_OBJECT(ClientBacklogManager)
ClientBacklogManager::ClientBacklogManager(QObject *parent)
: BacklogManager(parent),
_requester(0),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENTBACKLOGMANAGER_H
-#define CLIENTBACKLOGMANAGER_H
+#pragma once
#include "backlogmanager.h"
#include "message.h"
class ClientBacklogManager : public BacklogManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
ClientBacklogManager(QObject *parent = 0);
{
checkForBacklog(BufferIdList() << bufferId);
}
-
-
-#endif // CLIENTBACKLOGMANAGER_H
#include "clientbufferviewconfig.h"
-INIT_SYNCABLE_OBJECT(ClientBufferViewConfig)
ClientBufferViewConfig::ClientBufferViewConfig(int bufferViewId, QObject *parent)
: BufferViewConfig(bufferViewId, parent),
_locked(false)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENTBUFFERVIEWCONFIG_H
-#define CLIENTBUFFERVIEWCONFIG_H
+#pragma once
#include "bufferviewconfig.h"
class ClientBufferViewConfig : public BufferViewConfig
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
ClientBufferViewConfig(int bufferViewId, QObject *parent = 0);
private:
bool _locked;
};
-
-
-#endif //CLIENTBUFFERVIEWCONFIG_H
#include "client.h"
#include "networkmodel.h"
-INIT_SYNCABLE_OBJECT(ClientBufferViewManager)
ClientBufferViewManager::ClientBufferViewManager(SignalProxy *proxy, QObject *parent)
: BufferViewManager(proxy, parent)
{
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENTBUFFERVIEWMANAGER_H
-#define CLIENTBUFFERVIEWMANAGER_H
+#pragma once
#include "bufferviewmanager.h"
class ClientBufferViewManager : public BufferViewManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
ClientBufferViewManager(SignalProxy *proxy, QObject *parent = 0);
protected:
virtual BufferViewConfig *bufferViewConfigFactory(int bufferViewConfigId);
};
-
-
-#endif //CLIENTBUFFERVIEWMANAGER_H
#include "client.h"
#include "signalproxy.h"
-INIT_SYNCABLE_OBJECT(CertIdentity)
CertIdentity::CertIdentity(IdentityId id, QObject *parent)
: Identity(id, parent)
#ifdef HAVE_SSL
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENTIDENTITY_H
-#define CLIENTIDENTITY_H
+#pragma once
#include "identity.h"
class CertIdentity : public Identity
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CertIdentity(IdentityId id = 0, QObject *parent = 0);
CertIdentity *_certIdentity;
};
-
#endif //HAVE_SSL
-
-#endif //CLIENTIDENTITY_H
#include "clientignorelistmanager.h"
-INIT_SYNCABLE_OBJECT(ClientIgnoreListManager)
-
ClientIgnoreListManager::ClientIgnoreListManager(QObject *parent)
: IgnoreListManager(parent)
{
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENTIGNORELISTMANAGER_H
-#define CLIENTIGNORELISTMANAGER_H
+#pragma once
#include "ignorelistmanager.h"
#include <QMap>
class ClientIgnoreListManager : public IgnoreListManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
explicit ClientIgnoreListManager(QObject *parent = 0);
- inline virtual const QMetaObject *syncMetaObject() const { return &IgnoreListManager::staticMetaObject; }
//! Fetch all matching ignore rules for a given hostmask
/** \param hostmask The hostmask of the user
// matches an ignore rule against a given string
bool pureMatch(const IgnoreListItem &item, const QString &string) const;
};
-
-
-#endif // CLIENTIGNORELISTMANAGER_H
#include "client.h"
#include "irclistmodel.h"
-INIT_SYNCABLE_OBJECT(ClientIrcListHelper)
QVariantList ClientIrcListHelper::requestChannelList(const NetworkId &netId, const QStringList &channelFilters)
{
_netId = netId;
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENTIRCLISTHELPER_H
-#define CLIENTIRCLISTHELPER_H
+#pragma once
#include "irclisthelper.h"
class ClientIrcListHelper : public IrcListHelper
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
inline ClientIrcListHelper(QObject *object = 0) : IrcListHelper(object) {};
- inline virtual const QMetaObject *syncMetaObject() const { return &IrcListHelper::staticMetaObject; }
-
public slots:
virtual QVariantList requestChannelList(const NetworkId &netId, const QStringList &channelFilters);
virtual void receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QVariantList &channels);
private:
NetworkId _netId;
};
-
-
-#endif //CLIENTIRCLISTHELPER_H
#include "clienttransfer.h"
-INIT_SYNCABLE_OBJECT(ClientTransfer)
ClientTransfer::ClientTransfer(const QUuid &uuid, QObject *parent)
: Transfer(uuid, parent),
_file(0)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENTTRANSFER_H
-#define CLIENTTRANSFER_H
+#pragma once
#include <QUuid>
class ClientTransfer : public Transfer
{
Q_OBJECT
- SYNCABLE_OBJECT
public:
ClientTransfer(const QUuid &uuid, QObject *parent = 0);
QFile *_file;
};
-
-#endif
#include "client.h"
#include "clienttransfer.h"
-INIT_SYNCABLE_OBJECT(ClientTransferManager)
-
void ClientTransferManager::setTransferIds(const QList<QUuid> &transferIds)
{
for(auto &&id : transferIds) {
class ClientTransferManager : public TransferManager
{
Q_OBJECT
- SYNCABLE_OBJECT
public:
using TransferManager::TransferManager;
#include "aliasmanager.h"
#include "network.h"
-INIT_SYNCABLE_OBJECT(AliasManager)
AliasManager &AliasManager::operator=(const AliasManager &other)
{
if (this == &other)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef ALIASMANAGER_H
-#define ALIASMANAGER_H
+#pragma once
#include <QVariantMap>
class AliasManager : public SyncableObject
{
+ Q_OBJECT
SYNCABLE_OBJECT
- Q_OBJECT
public:
inline AliasManager(QObject *parent = 0) : SyncableObject(parent) { setAllowClientUpdates(true); }
AliasList _aliases;
};
-
-
-#endif //ALIASMANAGER_H
#include "backlogmanager.h"
-INIT_SYNCABLE_OBJECT(BacklogManager)
QVariantList BacklogManager::requestBacklog(BufferId bufferId, MsgId first, MsgId last, int limit, int additional)
{
REQUEST(ARG(bufferId), ARG(first), ARG(last), ARG(limit), ARG(additional))
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef BACKLOGMANAGER_H
-#define BACKLOGMANAGER_H
+#pragma once
#include "syncableobject.h"
#include "types.h"
class BacklogManager : public SyncableObject
{
+ Q_OBJECT
SYNCABLE_OBJECT
- Q_OBJECT
public:
BacklogManager(QObject *parent = 0) : SyncableObject(parent) {}
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
public slots:
virtual QVariantList requestBacklog(BufferId bufferId, MsgId first = -1, MsgId last = -1, int limit = -1, int additional = 0);
void backlogRequested(BufferId, MsgId, MsgId, int, int);
void backlogAllRequested(MsgId, MsgId, int, int);
};
-
-
-#endif // BACKLOGMANAGER_H
#include "buffersyncer.h"
-INIT_SYNCABLE_OBJECT(BufferSyncer)
BufferSyncer::BufferSyncer(QObject *parent)
: SyncableObject(parent)
{
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef BUFFERSYNCER_H_
-#define BUFFERSYNCER_H_
+#pragma once
#include "syncableobject.h"
#include "types.h"
class BufferSyncer : public SyncableObject
{
+ Q_OBJECT
SYNCABLE_OBJECT
- Q_OBJECT
public:
explicit BufferSyncer(QObject *parent);
explicit BufferSyncer(const QHash<BufferId, MsgId> &lastSeenMsg, const QHash<BufferId, MsgId> &markerLines, const QHash<BufferId, Message::Types> &activities, const QHash<BufferId, int> &highlightCounts, QObject *parent);
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
-
MsgId lastSeenMsg(BufferId buffer) const;
MsgId markerLine(BufferId buffer) const;
Message::Types activity(BufferId buffer) const;
QHash<BufferId, Message::Types> _bufferActivities;
QHash<BufferId, int> _highlightCounts;
};
-
-
-#endif
#include "bufferviewconfig.h"
-INIT_SYNCABLE_OBJECT(BufferViewConfig)
BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent)
: SyncableObject(parent),
_bufferViewId(bufferViewId)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef BUFFERVIEWCONFIG_H
-#define BUFFERVIEWCONFIG_H
+#pragma once
#include "syncableobject.h"
class BufferViewConfig : public SyncableObject
{
- SYNCABLE_OBJECT
Q_OBJECT
+ SYNCABLE_OBJECT
Q_PROPERTY(QString bufferViewName READ bufferViewName WRITE setBufferViewName)
Q_PROPERTY(NetworkId networkId READ networkId WRITE setNetworkId)
Q_PROPERTY(bool showSearch READ showSearch WRITE setShowSearch)
public :
- BufferViewConfig(int bufferViewId, QObject *parent = 0);
+ BufferViewConfig(int bufferViewId, QObject *parent = 0);
BufferViewConfig(int bufferViewId, const QVariantMap &properties, QObject *parent = 0);
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
-
public slots:
inline int bufferViewId() const { return _bufferViewId; }
QSet<BufferId> _removedBuffers;
QSet<BufferId> _temporarilyRemovedBuffers;
};
-
-
-#endif // BUFFERVIEWCONFIG_H
#include "bufferviewconfig.h"
#include "signalproxy.h"
-INIT_SYNCABLE_OBJECT(BufferViewManager)
BufferViewManager::BufferViewManager(SignalProxy *proxy, QObject *parent)
: SyncableObject(parent),
_proxy(proxy)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef BUFFERVIEWMANAGER_H
-#define BUFFERVIEWMANAGER_H
+#pragma once
#include "syncableobject.h"
class BufferViewManager : public SyncableObject
{
+ Q_OBJECT
SYNCABLE_OBJECT
- Q_OBJECT
public:
BufferViewManager(SignalProxy *proxy, QObject *parent = 0);
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
-
inline QList<BufferViewConfig *> bufferViewConfigs() const { return _bufferViewConfigs.values(); }
BufferViewConfig *bufferViewConfig(int bufferViewId) const;
BufferViewConfigHash _bufferViewConfigs;
SignalProxy *_proxy;
};
-
-
-#endif // BUFFERVIEWMANAGER_H
#include "coreinfo.h"
-INIT_SYNCABLE_OBJECT(CoreInfo)
CoreInfo::CoreInfo(QObject *parent) : SyncableObject(parent) {}
QVariantMap CoreInfo::coreData() const
#include "types.h"
-INIT_SYNCABLE_OBJECT(DccConfig)
-
DccConfig::DccConfig(QObject *parent)
: SyncableObject(parent)
{
*/
DccConfig(QObject *parent = nullptr);
- // see base class
- const QMetaObject *syncMetaObject() const override { return &staticMetaObject; }
-
/**
* Assignment operator.
*
#include "expressionmatch.h"
#include "util.h"
-INIT_SYNCABLE_OBJECT(HighlightRuleManager)
-
HighlightRuleManager &HighlightRuleManager::operator=(const HighlightRuleManager &other)
{
if (this == &other)
class HighlightRuleManager : public SyncableObject
{
- SYNCABLE_OBJECT
Q_OBJECT
+ SYNCABLE_OBJECT
Q_PROPERTY(int highlightNick READ highlightNick WRITE setHighlightNick)
Q_PROPERTY(bool nicksCaseSensitive READ nicksCaseSensitive WRITE setNicksCaseSensitive)
# include <Security.h>
#endif
-INIT_SYNCABLE_OBJECT(Identity)
Identity::Identity(IdentityId id, QObject *parent)
: SyncableObject(parent),
_identityId(id)
id.fromVariantMap(i);
return in;
}
-
-
-#ifdef HAVE_SSL
-INIT_SYNCABLE_OBJECT(CertManager)
-#endif // HAVE_SSL
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef IDENTITY_H
-#define IDENTITY_H
+#pragma once
#include <QByteArray>
#include <QDataStream>
class Identity : public SyncableObject
{
- SYNCABLE_OBJECT
Q_OBJECT
+ SYNCABLE_OBJECT
Q_PROPERTY(IdentityId identityId READ id WRITE setId)
Q_PROPERTY(QString identityName READ identityName WRITE setIdentityName)
Q_PROPERTY(QString quitReason READ quitReason WRITE setQuitReason)
public :
- Identity(IdentityId id = 0, QObject *parent = 0);
+ Identity(IdentityId id = 0, QObject *parent = 0);
Identity(const Identity &other, QObject *parent = 0);
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
void setToDefaults();
class CertManager : public SyncableObject
{
- SYNCABLE_OBJECT
Q_OBJECT
+ SYNCABLE_OBJECT
+
Q_PROPERTY(QByteArray sslKey READ sslKeyPem WRITE setSslKey)
Q_PROPERTY(QByteArray sslCert READ sslCertPem WRITE setSslCert)
public :
- CertManager(IdentityId id, QObject *parent = 0) : SyncableObject(QString::number(id.toInt()), parent) {}
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
+ CertManager(IdentityId id, QObject *parent = 0) : SyncableObject(QString::number(id.toInt()), parent) {}
virtual const QSslKey &sslKey() const = 0;
inline QByteArray sslKeyPem() const { return sslKey().toPem(); }
inline virtual void setSslCert(const QByteArray &encoded) { SYNC(ARG(encoded)) }
};
-
#endif // HAVE_SSL
-
-#endif // IDENTITY_H
#include <QDebug>
#include <QStringList>
-INIT_SYNCABLE_OBJECT(IgnoreListManager)
IgnoreListManager &IgnoreListManager::operator=(const IgnoreListManager &other)
{
if (this == &other)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef IGNORELISTMANAGER_H
-#define IGNORELISTMANAGER_H
+#pragma once
#include <QDebug>
#include <QString>
class IgnoreListManager : public SyncableObject
{
+ Q_OBJECT
SYNCABLE_OBJECT
- Q_OBJECT
+
public:
inline IgnoreListManager(QObject *parent = 0) : SyncableObject(parent) { setAllowClientUpdates(true); }
IgnoreListManager &operator=(const IgnoreListManager &other);
private:
IgnoreList _ignoreList;
};
-
-
-#endif // IGNORELISTMANAGER_H
#include <QDebug>
-INIT_SYNCABLE_OBJECT(IrcChannel)
IrcChannel::IrcChannel(const QString &channelname, Network *network)
: SyncableObject(network),
_initialized(false),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef IRCCHANNEL_H
-#define IRCCHANNEL_H
+#pragma once
#include <QHash>
#include <QSet>
class IrcChannel : public SyncableObject
{
- SYNCABLE_OBJECT
Q_OBJECT
+ SYNCABLE_OBJECT
Q_PROPERTY(QString name READ name)
Q_PROPERTY(QString topic READ topic WRITE setTopic)
QHash<QChar, QString> _C_channelModes;
QSet<QChar> _D_channelModes;
};
-
-
-#endif
***************************************************************************/
#include "irclisthelper.h"
-
-INIT_SYNCABLE_OBJECT(IrcListHelper)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef IRCLISTHELPER_H
-#define IRCLISTHELPER_H
+#pragma once
#include "syncableobject.h"
#include "types.h"
*/
class IrcListHelper : public SyncableObject
{
+ Q_OBJECT
SYNCABLE_OBJECT
- Q_OBJECT
public:
inline IrcListHelper(QObject *parent = 0) : SyncableObject(parent) { setInitialized(); };
inline virtual void reportFinishedList(const NetworkId &netId) { SYNC(ARG(netId)) }
inline virtual void reportError(const QString &error) { SYNC(ARG(error)) }
};
-
-
-#endif //IRCLISTHELPER_H
#include <QTextCodec>
#include <QDebug>
-INIT_SYNCABLE_OBJECT(IrcUser)
IrcUser::IrcUser(const QString &hostmask, Network *network) : SyncableObject(network),
_initialized(false),
_nick(nickFromMask(hostmask)),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef IRCUSER_H
-#define IRCUSER_H
+#pragma once
#include <QSet>
#include <QString>
class IrcUser : public SyncableObject
{
- SYNCABLE_OBJECT
Q_OBJECT
+ SYNCABLE_OBJECT
Q_PROPERTY(QString user READ user WRITE setUser)
Q_PROPERTY(QString host READ host WRITE setHost)
/// Tracks if changes in away state (away/here, message) have yet to be acknowledged
bool _awayChanged = true;
};
-
-
-#endif
// ====================
// Public:
// ====================
-INIT_SYNCABLE_OBJECT(Network)
+
Network::Network(const NetworkId &networkid, QObject *parent)
: SyncableObject(parent),
_proxy(0),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef NETWORK_H
-#define NETWORK_H
+#pragma once
#include <QString>
#include <QStringList>
class Network : public SyncableObject
{
- SYNCABLE_OBJECT
Q_OBJECT
+ SYNCABLE_OBJECT
+
Q_ENUMS(ConnectionState)
Q_PROPERTY(QString networkName READ networkName WRITE setNetworkName)
QDataStream &operator>>(QDataStream &in, Network::Server &server);
QDebug operator<<(QDebug dbg, const Network::Server &server);
Q_DECLARE_METATYPE(Network::Server)
-
-#endif
#include "networkconfig.h"
-INIT_SYNCABLE_OBJECT(NetworkConfig)
NetworkConfig::NetworkConfig(const QString &objectName, QObject *parent)
: SyncableObject(objectName, parent),
_pingTimeoutEnabled(true),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef NETWORKCONFIG_H_
-#define NETWORKCONFIG_H_
+#pragma once
#include "syncableobject.h"
class NetworkConfig : public SyncableObject
{
- SYNCABLE_OBJECT
Q_OBJECT
+ SYNCABLE_OBJECT
Q_PROPERTY(bool pingTimeoutEnabled READ pingTimeoutEnabled WRITE setPingTimeoutEnabled)
Q_PROPERTY(int pingInterval READ pingInterval WRITE setPingInterval)
Q_PROPERTY(bool standardCtcp READ standardCtcp WRITE setStandardCtcp)
public :
- NetworkConfig(const QString &objectName = "GlobalNetworkConfig", QObject *parent = 0);
-
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
+ NetworkConfig(const QString &objectName = "GlobalNetworkConfig", QObject *parent = 0);
public slots:
inline bool pingTimeoutEnabled() const { return _pingTimeoutEnabled; }
bool _standardCtcp;
};
-
-
-#endif
#include "signalproxy.h"
#include "util.h"
-INIT_SYNCABLE_OBJECT(SyncableObject)
SyncableObject::SyncableObject(QObject *parent)
: QObject(parent),
_initialized(false),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef SYNCABLEOBJECT_H
-#define SYNCABLEOBJECT_H
+#pragma once
#include <QDataStream>
#include <QMetaType>
#include "signalproxy.h"
-#define SYNCABLE_OBJECT static int _classNameOffset__();
-#define INIT_SYNCABLE_OBJECT(x) int x ::_classNameOffset__() {\
- static int offset = QByteArray(x ::staticMetaObject.className()).length() + 2;\
- return offset;\
-}\
-
-#ifdef Q_CC_MSVC
-# define SYNC(...) sync_call__(SignalProxy::Server, (__FUNCTION__ + _classNameOffset__()), __VA_ARGS__);
-# define REQUEST(...) sync_call__(SignalProxy::Client, (__FUNCTION__ + _classNameOffset__()), __VA_ARGS__);
-#else
-# define SYNC(...) sync_call__(SignalProxy::Server, __func__, __VA_ARGS__);
-# define REQUEST(...) sync_call__(SignalProxy::Client, __func__, __VA_ARGS__);
-#endif //Q_CC_MSVC
+/**
+ * This macro needs to be declared in syncable objects, next to the Q_OBJECT macro.
+ *
+ * @note: Specializations of a base syncable object for core/client must not use the macro;
+ * i.e., if you have Foo, ClientFoo and/or CoreFoo, the SYNCABLE_OBJECT macro would
+ * only be declared in the class declaration of Foo.
+ */
+#define SYNCABLE_OBJECT \
+ public: \
+ const QMetaObject *syncMetaObject() const final override { \
+ return &staticMetaObject; \
+ } \
+ private: \
+
+#define SYNC(...) sync_call__(SignalProxy::Server, __func__, __VA_ARGS__);
+#define REQUEST(...) sync_call__(SignalProxy::Client, __func__, __VA_ARGS__);
#define SYNC_OTHER(x, ...) sync_call__(SignalProxy::Server, #x, __VA_ARGS__);
#define REQUEST_OTHER(x, ...) sync_call__(SignalProxy::Client, #x, __VA_ARGS__);
class SyncableObject : public QObject
{
- SYNCABLE_OBJECT
Q_OBJECT
public:
SyncableObject(QObject *parent = 0);
SyncableObject(const QString &objectName, QObject *parent = 0);
SyncableObject(const SyncableObject &other, QObject *parent = 0);
- ~SyncableObject();
+ ~SyncableObject() override;
//! Stores the object's state into a QVariantMap.
/** The default implementation takes dynamic properties as well as getters that have
friend class SignalProxy;
};
-
-
-#endif
#include "transfer.h"
-INIT_SYNCABLE_OBJECT(Transfer)
Transfer::Transfer(const QUuid &uuid, QObject *parent)
: SyncableObject(parent),
_status(Status::New),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef TRANSFER_H
-#define TRANSFER_H
+#pragma once
#include <QHostAddress>
#include <QUuid>
Transfer(const QUuid &uuid, QObject *parent = 0); // for creating a syncable object client-side
Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0);
- inline const QMetaObject *syncMetaObject() const override { return &staticMetaObject; }
QUuid uuid() const;
Status status() const;
QDataStream &operator>>(QDataStream &in, Transfer::Status &state);
QDataStream &operator<<(QDataStream &out, Transfer::Direction direction);
QDataStream &operator>>(QDataStream &in, Transfer::Direction &direction);
-
-#endif
#include "transfer.h"
-INIT_SYNCABLE_OBJECT(TransferManager)
-
TransferManager::TransferManager(QObject *parent)
: SyncableObject(parent)
{
using TransferIdList = QList<QUuid>;
TransferManager(QObject *parent = nullptr);
- const QMetaObject *syncMetaObject() const override { return &staticMetaObject; }
Transfer *transfer(const QUuid &uuid) const;
TransferIdList transferIds() const;
#include "corenetwork.h"
#include "coresession.h"
-INIT_SYNCABLE_OBJECT(CoreAliasManager)
CoreAliasManager::CoreAliasManager(CoreSession *parent)
: AliasManager(parent)
{
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREALIASMANAGER_H
-#define COREALIASMANAGER_H
+#pragma once
#include "aliasmanager.h"
class CoreAliasManager : public AliasManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
explicit CoreAliasManager(CoreSession *parent);
- inline virtual const QMetaObject *syncMetaObject() const { return &AliasManager::staticMetaObject; }
-
protected:
const Network *network(NetworkId) const;
private:
void loadDefaults();
};
-
-
-#endif //COREALIASMANAGER_H
#include <QDebug>
-INIT_SYNCABLE_OBJECT(CoreBacklogManager)
CoreBacklogManager::CoreBacklogManager(CoreSession *coreSession)
: BacklogManager(coreSession),
_coreSession(coreSession)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREBACKLOGMANAGER_H
-#define COREBACKLOGMANAGER_H
+#pragma once
#include "backlogmanager.h"
class CoreBacklogManager : public BacklogManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreBacklogManager(CoreSession *coreSession = 0);
private:
CoreSession *_coreSession;
};
-
-
-#endif // COREBACKLOGMANAGER_H
PurgeEvent() : QEvent(QEvent::User) {}
};
-
-INIT_SYNCABLE_OBJECT(CoreBufferSyncer)
CoreBufferSyncer::CoreBufferSyncer(CoreSession *parent)
: BufferSyncer(Core::bufferLastSeenMsgIds(parent->user()), Core::bufferMarkerLineMsgIds(parent->user()), Core::bufferActivities(parent->user()), Core::highlightCounts(parent->user()), parent),
_coreSession(parent),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREBUFFERSYNCER_H
-#define COREBUFFERSYNCER_H
+#pragma once
#include "buffersyncer.h"
class CoreBufferSyncer : public BufferSyncer
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
explicit CoreBufferSyncer(CoreSession *parent);
void purgeBufferIds();
};
-
-
-#endif //COREBUFFERSYNCER_H
#include "corebufferviewconfig.h"
-INIT_SYNCABLE_OBJECT(CoreBufferViewConfig)
CoreBufferViewConfig::CoreBufferViewConfig(int bufferViewId, QObject *parent)
: BufferViewConfig(bufferViewId, parent)
{
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include "bufferviewconfig.h"
+#pragma once
-#ifndef COREBUFFERVIEWCONFIG_H
-#define COREBUFFERVIEWCONFIG_H
+#include "bufferviewconfig.h"
class CoreBufferViewConfig : public BufferViewConfig
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreBufferViewConfig(int bufferViewId, QObject *parent = 0);
CoreBufferViewConfig(int bufferViewId, const QVariantMap &properties, QObject *parent = 0);
- inline virtual const QMetaObject *syncMetaObject() const { return &BufferViewConfig::staticMetaObject; }
-
public slots:
virtual inline void requestSetBufferViewName(const QString &bufferViewName) { setBufferViewName(bufferViewName); }
virtual inline void requestRemoveBuffer(const BufferId &bufferId) { removeBuffer(bufferId); }
virtual inline void requestAddBuffer(const BufferId &bufferId, int pos) { addBuffer(bufferId, pos); }
virtual inline void requestMoveBuffer(const BufferId &bufferId, int pos) { moveBuffer(bufferId, pos); }
};
-
-
-#endif // COREBUFFERVIEWCONFIG_H
#include "core.h"
#include "coresession.h"
-INIT_SYNCABLE_OBJECT(CoreBufferViewManager)
CoreBufferViewManager::CoreBufferViewManager(SignalProxy *proxy, CoreSession *parent)
: BufferViewManager(proxy, parent),
_coreSession(parent)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREBUFFERVIEWMANAGER_H
-#define COREBUFFERVIEWMANAGER_H
+#pragma once
#include "bufferviewmanager.h"
class CoreBufferViewManager : public BufferViewManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreBufferViewManager(SignalProxy *proxy, CoreSession *parent);
- inline virtual const QMetaObject *syncMetaObject() const { return &BufferViewManager::staticMetaObject; }
-
public slots:
virtual void requestCreateBufferView(const QVariantMap &properties);
virtual void requestCreateBufferViews(const QVariantList &properties);
private:
CoreSession *_coreSession;
};
-
-
-#endif // COREBUFFERVIEWMANAGER_H
constexpr auto settingsKey = "HighlightRuleList";
-INIT_SYNCABLE_OBJECT(CoreHighlightRuleManager)
CoreHighlightRuleManager::CoreHighlightRuleManager(CoreSession *session)
: HighlightRuleManager(session)
, _coreSession{session}
class CoreHighlightRuleManager : public HighlightRuleManager
{
Q_OBJECT
- SYNCABLE_OBJECT
using HighlightRuleManager::match;
*/
explicit CoreHighlightRuleManager(CoreSession *session);
- virtual const QMetaObject *syncMetaObject() const override { return &HighlightRuleManager::staticMetaObject; }
-
bool match(const RawMessage &msg, const QString ¤tNick, const QStringList &identityNicks);
public slots:
#include "signalproxy.h"
-INIT_SYNCABLE_OBJECT(CoreIdentity)
CoreIdentity::CoreIdentity(IdentityId id, QObject *parent)
: Identity(id, parent)
#ifdef HAVE_SSL
// ========================================
// CoreCertManager
// ========================================
-INIT_SYNCABLE_OBJECT(CoreCertManager)
+
CoreCertManager::CoreCertManager(CoreIdentity &identity)
: CertManager(identity.id()),
identity(identity)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREIDENTITY_H
-#define COREIDENTITY_H
+#pragma once
#include "identity.h"
class CoreIdentity;
class CoreCertManager : public CertManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreCertManager(CoreIdentity &identity);
// =========================================
class CoreIdentity : public Identity
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreIdentity(IdentityId id, QObject *parent = 0);
return identity.sslCert();
}
-
#endif
-
-#endif //COREIDENTITY_H
#include "core.h"
#include "coresession.h"
-INIT_SYNCABLE_OBJECT(CoreIgnoreListManager)
CoreIgnoreListManager::CoreIgnoreListManager(CoreSession *parent)
: IgnoreListManager(parent)
{
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREIGNORELISTMANAGER_H
-#define COREIGNORELISTMANAGER_H
+#pragma once
#include "ignorelistmanager.h"
class CoreIgnoreListManager : public IgnoreListManager
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
explicit CoreIgnoreListManager(CoreSession *parent);
- inline virtual const QMetaObject *syncMetaObject() const { return &IgnoreListManager::staticMetaObject; }
-
StrictnessType match(const RawMessage &rawMsg, const QString &networkName);
public slots:
//private:
// void loadDefaults();
};
-
-
-#endif //COREIGNORELISTMANAGER_H
#include "coreircchannel.h"
#include "corenetwork.h"
-INIT_SYNCABLE_OBJECT(CoreIrcChannel)
CoreIrcChannel::CoreIrcChannel(const QString &channelname, Network *network)
: IrcChannel(channelname, network),
_receivedWelcomeMsg(false)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREIRCCHANNEL_H
-#define COREIRCCHANNEL_H
+#pragma once
#include "ircchannel.h"
class CoreIrcChannel : public IrcChannel
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreIrcChannel(const QString &channelname, Network *network);
virtual ~CoreIrcChannel();
- inline virtual const QMetaObject *syncMetaObject() const { return &IrcChannel::staticMetaObject; }
-
#ifdef HAVE_QCA2
Cipher *cipher() const;
void setEncrypted(bool);
mutable Cipher *_cipher;
#endif
};
-
-
-#endif //COREIRCCHANNEL_H
constexpr auto kTimeoutMs = 5000;
-INIT_SYNCABLE_OBJECT(CoreIrcListHelper)
QVariantList CoreIrcListHelper::requestChannelList(const NetworkId &netId, const QStringList &channelFilters)
{
if (_finishedChannelLists.contains(netId))
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREIRCLISTHELPER_H
-#define COREIRCLISTHELPER_H
+#pragma once
#include <memory>
class CoreIrcListHelper : public IrcListHelper
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
inline CoreIrcListHelper(CoreSession *coreSession) : IrcListHelper(coreSession), _coreSession(coreSession) {};
- inline virtual const QMetaObject *syncMetaObject() const { return &IrcListHelper::staticMetaObject; }
-
inline CoreSession *coreSession() const { return _coreSession; }
inline bool requestInProgress(const NetworkId &netId) const { return _channelLists.contains(netId); }
QHash<int, NetworkId> _queryTimeoutByTimerId;
QHash<NetworkId, std::shared_ptr<QBasicTimer>> _queryTimeoutByNetId;
};
-
-
-#endif //COREIRCLISTHELPER_H
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREIRCUSER_H_
-#define COREIRCUSER_H_
+#pragma once
#include "ircuser.h"
class CoreIrcUser : public IrcUser
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreIrcUser(const QString &hostmask, Network *network);
virtual ~CoreIrcUser();
- inline virtual const QMetaObject *syncMetaObject() const { return &IrcUser::staticMetaObject; }
-
#ifdef HAVE_QCA2
Cipher *cipher() const;
#endif
mutable Cipher *_cipher;
#endif
};
-
-
-#endif
// IRCv3 capabilities
#include "irccap.h"
-INIT_SYNCABLE_OBJECT(CoreNetwork)
CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session)
: Network(networkid, session),
_coreSession(session),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CORENETWORK_H
-#define CORENETWORK_H
+#pragma once
#include "network.h"
#include "coreircchannel.h"
class CoreNetwork : public Network
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreNetwork(const NetworkId &networkid, CoreSession *session);
virtual ~CoreNetwork();
- inline virtual const QMetaObject *syncMetaObject() const { return &Network::staticMetaObject; }
inline CoreIdentity *identityPtr() const { return coreSession()->identity(identity()); }
inline CoreSession *coreSession() const { return _coreSession; }
// List of blowfish keys for channels
QHash<QString, QByteArray> _cipherKeys;
};
-
-
-#endif //CORENETWORK_H
#include "coresession.h"
#include "corenetworkconfig.h"
-INIT_SYNCABLE_OBJECT(CoreNetworkConfig)
CoreNetworkConfig::CoreNetworkConfig(const QString &objectName, CoreSession *session)
: NetworkConfig(objectName, session)
{
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CORENETWORKCONFIG_H_
-#define CORENETWORKCONFIG_H_
+#pragma once
#include "networkconfig.h"
class CoreNetworkConfig : public NetworkConfig
{
- SYNCABLE_OBJECT
- Q_OBJECT
+ Q_OBJECT
public:
CoreNetworkConfig(const QString &objectName, CoreSession *parent);
- inline virtual const QMetaObject *syncMetaObject() const { return &NetworkConfig::staticMetaObject; }
-
void save();
public slots:
virtual inline void requestSetAutoWhoDelay(int delay) { setAutoWhoDelay(delay); }
virtual inline void requestSetStandardCtcp(bool enabled) { setStandardCtcp(enabled); }
};
-
-
-#endif
const qint64 chunkSize = 16 * 1024;
-INIT_SYNCABLE_OBJECT(CoreTransfer)
-
CoreTransfer::CoreTransfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent)
: Transfer(direction, nick, fileName, address, port, fileSize, parent),
_socket(0),
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CORETRANSFER_H
-#define CORETRANSFER_H
+#pragma once
#include <QPointer>
class CoreTransfer : public Transfer
{
Q_OBJECT
- SYNCABLE_OBJECT
public:
CoreTransfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0);
QByteArray _buffer;
bool _reading;
};
-
-#endif
***************************************************************************/
#include "coretransfermanager.h"
-
-INIT_SYNCABLE_OBJECT(CoreTransferManager)
class CoreTransferManager : public TransferManager
{
Q_OBJECT
- SYNCABLE_OBJECT
public:
using TransferManager::TransferManager;