/***************************************************************************
- * Copyright (C) 2005-2015 by the Quassel Project *
+ * Copyright (C) 2005-2020 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "bufferviewconfig.h"
-#include "bufferinfo.h"
-
-INIT_SYNCABLE_OBJECT(BufferViewConfig)
-BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent)
- : SyncableObject(parent),
- _bufferViewId(bufferViewId),
- _addNewBuffersAutomatically(true),
- _sortAlphabetically(true),
- _hideInactiveBuffers(false),
- _hideInactiveNetworks(false),
- _disableDecoration(false),
- _allowedBufferTypes(BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer),
- _minimumActivity(0)
+BufferViewConfig::BufferViewConfig(int bufferViewId, QObject* parent)
+ : SyncableObject(parent)
+ , _bufferViewId(bufferViewId)
{
setObjectName(QString::number(bufferViewId));
}
-
-BufferViewConfig::BufferViewConfig(int bufferViewId, const QVariantMap &properties, QObject *parent)
- : SyncableObject(parent),
- _bufferViewId(bufferViewId)
+BufferViewConfig::BufferViewConfig(int bufferViewId, const QVariantMap& properties, QObject* parent)
+ : SyncableObject(parent)
+ , _bufferViewId(bufferViewId)
{
fromVariantMap(properties);
setObjectName(QString::number(bufferViewId));
}
+int BufferViewConfig::bufferViewId() const
+{
+ return _bufferViewId;
+}
+
+QString BufferViewConfig::bufferViewName() const
+{
+ return _bufferViewName;
+}
+
+NetworkId BufferViewConfig::networkId() const
+{
+ return _networkId;
+}
+
+bool BufferViewConfig::addNewBuffersAutomatically() const
+{
+ return _addNewBuffersAutomatically;
+}
+
+bool BufferViewConfig::sortAlphabetically() const
+{
+ return _sortAlphabetically;
+}
+
+bool BufferViewConfig::disableDecoration() const
+{
+ return _disableDecoration;
+}
+
+int BufferViewConfig::allowedBufferTypes() const
+{
+ return _allowedBufferTypes;
+}
+
+int BufferViewConfig::minimumActivity() const
+{
+ return _minimumActivity;
+}
+
+bool BufferViewConfig::hideInactiveBuffers() const
+{
+ return _hideInactiveBuffers;
+}
+
+bool BufferViewConfig::hideInactiveNetworks() const
+{
+ return _hideInactiveNetworks;
+}
+
+bool BufferViewConfig::showSearch() const
+{
+ return _showSearch;
+}
+
+QList<BufferId> BufferViewConfig::bufferList() const
+{
+ return _buffers;
+}
+
+QSet<BufferId> BufferViewConfig::removedBuffers() const
+{
+ return _removedBuffers;
+}
+
+QSet<BufferId> BufferViewConfig::temporarilyRemovedBuffers() const
+{
+ return _temporarilyRemovedBuffers;
+}
+
+QVariantList BufferViewConfig::initBufferList() const
+{
+ QVariantList buffers;
+
+ foreach (BufferId bufferId, _buffers) {
+ buffers << QVariant::fromValue(bufferId);
+ }
+
+ return buffers;
+}
+
+void BufferViewConfig::initSetBufferList(const QVariantList& buffers)
+{
+ _buffers.clear();
+
+ foreach (QVariant buffer, buffers) {
+ _buffers << buffer.value<BufferId>();
+ }
+
+ emit configChanged(); // used to track changes in the settingspage
+}
+
+QVariantList BufferViewConfig::initRemovedBuffers() const
+{
+ QVariantList removedBuffers;
+
+ foreach (BufferId bufferId, _removedBuffers) {
+ removedBuffers << QVariant::fromValue(bufferId);
+ }
+
+ return removedBuffers;
+}
+
+void BufferViewConfig::initSetRemovedBuffers(const QVariantList& buffers)
+{
+ _removedBuffers.clear();
+
+ foreach (QVariant buffer, buffers) {
+ _removedBuffers << buffer.value<BufferId>();
+ }
+}
+
+QVariantList BufferViewConfig::initTemporarilyRemovedBuffers() const
+{
+ QVariantList temporarilyRemovedBuffers;
+
+ foreach (BufferId bufferId, _temporarilyRemovedBuffers) {
+ temporarilyRemovedBuffers << QVariant::fromValue(bufferId);
+ }
+
+ return temporarilyRemovedBuffers;
+}
+
+void BufferViewConfig::initSetTemporarilyRemovedBuffers(const QVariantList& buffers)
+{
+ _temporarilyRemovedBuffers.clear();
+
+ foreach (QVariant buffer, buffers) {
+ _temporarilyRemovedBuffers << buffer.value<BufferId>();
+ }
+}
-void BufferViewConfig::setBufferViewName(const QString &bufferViewName)
+void BufferViewConfig::setBufferViewName(const QString& bufferViewName)
{
if (_bufferViewName == bufferViewName)
return;
emit bufferViewNameSet(bufferViewName);
}
-
-void BufferViewConfig::setNetworkId(const NetworkId &networkId)
+void BufferViewConfig::setNetworkId(const NetworkId& networkId)
{
if (_networkId == networkId)
return;
emit configChanged();
}
-
void BufferViewConfig::setAddNewBuffersAutomatically(bool addNewBuffersAutomatically)
{
if (_addNewBuffersAutomatically == addNewBuffersAutomatically)
emit configChanged();
}
-
void BufferViewConfig::setSortAlphabetically(bool sortAlphabetically)
{
if (_sortAlphabetically == sortAlphabetically)
emit configChanged();
}
-
void BufferViewConfig::setDisableDecoration(bool disableDecoration)
{
if (_disableDecoration == disableDecoration)
SYNC(ARG(disableDecoration))
}
-
void BufferViewConfig::setAllowedBufferTypes(int bufferTypes)
{
if (_allowedBufferTypes == bufferTypes)
emit configChanged();
}
-
void BufferViewConfig::setMinimumActivity(int activity)
{
if (_minimumActivity == activity)
emit configChanged();
}
-
void BufferViewConfig::setHideInactiveBuffers(bool hideInactiveBuffers)
{
if (_hideInactiveBuffers == hideInactiveBuffers)
emit configChanged();
}
-
-QVariantList BufferViewConfig::initBufferList() const
-{
- QVariantList buffers;
-
- foreach(BufferId bufferId, _buffers) {
- buffers << qVariantFromValue(bufferId);
- }
-
- return buffers;
-}
-
-
-void BufferViewConfig::initSetBufferList(const QVariantList &buffers)
-{
- _buffers.clear();
-
- foreach(QVariant buffer, buffers) {
- _buffers << buffer.value<BufferId>();
- }
-
- emit configChanged(); // used to track changes in the settingspage
-}
-
-
-void BufferViewConfig::initSetBufferList(const QList<BufferId> &buffers)
-{
- _buffers.clear();
-
- foreach(BufferId bufferId, buffers) {
- _buffers << bufferId;
- }
-
- emit configChanged(); // used to track changes in the settingspage
-}
-
-
-QVariantList BufferViewConfig::initRemovedBuffers() const
-{
- QVariantList removedBuffers;
-
- foreach(BufferId bufferId, _removedBuffers) {
- removedBuffers << qVariantFromValue(bufferId);
- }
-
- return removedBuffers;
-}
-
-
-void BufferViewConfig::initSetRemovedBuffers(const QVariantList &buffers)
-{
- _removedBuffers.clear();
-
- foreach(QVariant buffer, buffers) {
- _removedBuffers << buffer.value<BufferId>();
- }
-}
-
-
-QVariantList BufferViewConfig::initTemporarilyRemovedBuffers() const
+void BufferViewConfig::setShowSearch(bool showSearch)
{
- QVariantList temporarilyRemovedBuffers;
-
- foreach(BufferId bufferId, _temporarilyRemovedBuffers) {
- temporarilyRemovedBuffers << qVariantFromValue(bufferId);
+ if (_showSearch == showSearch) {
+ return;
}
- return temporarilyRemovedBuffers;
+ _showSearch = showSearch;
+ SYNC(ARG(showSearch))
+ emit configChanged();
}
-
-void BufferViewConfig::initSetTemporarilyRemovedBuffers(const QVariantList &buffers)
+void BufferViewConfig::setBufferList(const QList<BufferId>& buffers)
{
- _temporarilyRemovedBuffers.clear();
-
- foreach(QVariant buffer, buffers) {
- _temporarilyRemovedBuffers << buffer.value<BufferId>();
- }
+ _buffers = buffers;
+ emit configChanged();
}
-
-void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos)
+void BufferViewConfig::addBuffer(const BufferId& bufferId, int pos)
{
if (_buffers.contains(bufferId))
return;
emit configChanged();
}
-
-void BufferViewConfig::moveBuffer(const BufferId &bufferId, int pos)
+void BufferViewConfig::moveBuffer(const BufferId& bufferId, int pos)
{
if (!_buffers.contains(bufferId))
return;
emit configChanged();
}
-
-void BufferViewConfig::removeBuffer(const BufferId &bufferId)
+void BufferViewConfig::removeBuffer(const BufferId& bufferId)
{
if (_buffers.contains(bufferId))
_buffers.removeAt(_buffers.indexOf(bufferId));
emit configChanged();
}
-
-void BufferViewConfig::removeBufferPermanently(const BufferId &bufferId)
+void BufferViewConfig::removeBufferPermanently(const BufferId& bufferId)
{
if (_buffers.contains(bufferId))
_buffers.removeAt(_buffers.indexOf(bufferId));
emit bufferPermanentlyRemoved(bufferId);
emit configChanged();
}
+
+void BufferViewConfig::requestSetBufferViewName(const QString& bufferViewName)
+{
+ REQUEST(ARG(bufferViewName))
+}
+
+void BufferViewConfig::requestAddBuffer(const BufferId& bufferId, int pos)
+{
+ REQUEST(ARG(bufferId), ARG(pos))
+}
+
+void BufferViewConfig::requestMoveBuffer(const BufferId& bufferId, int pos)
+{
+ REQUEST(ARG(bufferId), ARG(pos))
+}
+
+void BufferViewConfig::requestRemoveBuffer(const BufferId& bufferId)
+{
+ REQUEST(ARG(bufferId))
+}
+
+void BufferViewConfig::requestRemoveBufferPermanently(const BufferId& bufferId)
+{
+ REQUEST(ARG(bufferId))
+}