X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fbufferviewconfig.cpp;h=fff1ef1ead415add53427185763a7ca4624ba7b3;hb=b8db3c55a7f66a8d6ecabf9039aabceff9ae4837;hp=15750ced5c6d133c4bb0a3df86b6a368dce3ca54;hpb=694f9bfbf7f1af19108461c7e00d133e55082bce;p=quassel.git diff --git a/src/common/bufferviewconfig.cpp b/src/common/bufferviewconfig.cpp index 15750ced..fff1ef1e 100644 --- a/src/common/bufferviewconfig.cpp +++ b/src/common/bufferviewconfig.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,38 +15,27 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #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), - _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)); } - -void BufferViewConfig::setBufferViewName(const QString &bufferViewName) +void BufferViewConfig::setBufferViewName(const QString& bufferViewName) { if (_bufferViewName == bufferViewName) return; @@ -56,8 +45,7 @@ void BufferViewConfig::setBufferViewName(const QString &bufferViewName) emit bufferViewNameSet(bufferViewName); } - -void BufferViewConfig::setNetworkId(const NetworkId &networkId) +void BufferViewConfig::setNetworkId(const NetworkId& networkId) { if (_networkId == networkId) return; @@ -68,7 +56,6 @@ void BufferViewConfig::setNetworkId(const NetworkId &networkId) emit configChanged(); } - void BufferViewConfig::setAddNewBuffersAutomatically(bool addNewBuffersAutomatically) { if (_addNewBuffersAutomatically == addNewBuffersAutomatically) @@ -79,7 +66,6 @@ void BufferViewConfig::setAddNewBuffersAutomatically(bool addNewBuffersAutomatic emit configChanged(); } - void BufferViewConfig::setSortAlphabetically(bool sortAlphabetically) { if (_sortAlphabetically == sortAlphabetically) @@ -90,7 +76,6 @@ void BufferViewConfig::setSortAlphabetically(bool sortAlphabetically) emit configChanged(); } - void BufferViewConfig::setDisableDecoration(bool disableDecoration) { if (_disableDecoration == disableDecoration) @@ -100,7 +85,6 @@ void BufferViewConfig::setDisableDecoration(bool disableDecoration) SYNC(ARG(disableDecoration)) } - void BufferViewConfig::setAllowedBufferTypes(int bufferTypes) { if (_allowedBufferTypes == bufferTypes) @@ -111,7 +95,6 @@ void BufferViewConfig::setAllowedBufferTypes(int bufferTypes) emit configChanged(); } - void BufferViewConfig::setMinimumActivity(int activity) { if (_minimumActivity == activity) @@ -122,7 +105,6 @@ void BufferViewConfig::setMinimumActivity(int activity) emit configChanged(); } - void BufferViewConfig::setHideInactiveBuffers(bool hideInactiveBuffers) { if (_hideInactiveBuffers == hideInactiveBuffers) @@ -133,88 +115,101 @@ void BufferViewConfig::setHideInactiveBuffers(bool hideInactiveBuffers) emit configChanged(); } +void BufferViewConfig::setHideInactiveNetworks(bool hideInactiveNetworks) +{ + if (_hideInactiveNetworks == hideInactiveNetworks) + return; + + _hideInactiveNetworks = hideInactiveNetworks; + SYNC(ARG(hideInactiveNetworks)) + emit configChanged(); +} + +void BufferViewConfig::setShowSearch(bool showSearch) +{ + if (_showSearch == showSearch) { + return; + } + + _showSearch = showSearch; + SYNC(ARG(showSearch)) + emit configChanged(); +} QVariantList BufferViewConfig::initBufferList() const { QVariantList buffers; - foreach(BufferId bufferId, _buffers) { + foreach (BufferId bufferId, _buffers) { buffers << qVariantFromValue(bufferId); } return buffers; } - -void BufferViewConfig::initSetBufferList(const QVariantList &buffers) +void BufferViewConfig::initSetBufferList(const QVariantList& buffers) { _buffers.clear(); - foreach(QVariant buffer, buffers) { + foreach (QVariant buffer, buffers) { _buffers << buffer.value(); } - emit configChanged(); // used to track changes in the settingspage + emit configChanged(); // used to track changes in the settingspage } - -void BufferViewConfig::initSetBufferList(const QList &buffers) +void BufferViewConfig::initSetBufferList(const QList& buffers) { _buffers.clear(); - foreach(BufferId bufferId, buffers) { + foreach (BufferId bufferId, buffers) { _buffers << bufferId; } - emit configChanged(); // used to track changes in the settingspage + emit configChanged(); // used to track changes in the settingspage } - QVariantList BufferViewConfig::initRemovedBuffers() const { QVariantList removedBuffers; - foreach(BufferId bufferId, _removedBuffers) { + foreach (BufferId bufferId, _removedBuffers) { removedBuffers << qVariantFromValue(bufferId); } return removedBuffers; } - -void BufferViewConfig::initSetRemovedBuffers(const QVariantList &buffers) +void BufferViewConfig::initSetRemovedBuffers(const QVariantList& buffers) { _removedBuffers.clear(); - foreach(QVariant buffer, buffers) { + foreach (QVariant buffer, buffers) { _removedBuffers << buffer.value(); } } - QVariantList BufferViewConfig::initTemporarilyRemovedBuffers() const { QVariantList temporarilyRemovedBuffers; - foreach(BufferId bufferId, _temporarilyRemovedBuffers) { + foreach (BufferId bufferId, _temporarilyRemovedBuffers) { temporarilyRemovedBuffers << qVariantFromValue(bufferId); } return temporarilyRemovedBuffers; } - -void BufferViewConfig::initSetTemporarilyRemovedBuffers(const QVariantList &buffers) +void BufferViewConfig::initSetTemporarilyRemovedBuffers(const QVariantList& buffers) { _temporarilyRemovedBuffers.clear(); - foreach(QVariant buffer, buffers) { + foreach (QVariant buffer, buffers) { _temporarilyRemovedBuffers << buffer.value(); } } - -void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) +void BufferViewConfig::addBuffer(const BufferId& bufferId, int pos) { if (_buffers.contains(bufferId)) return; @@ -236,8 +231,7 @@ void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) emit configChanged(); } - -void BufferViewConfig::moveBuffer(const BufferId &bufferId, int pos) +void BufferViewConfig::moveBuffer(const BufferId& bufferId, int pos) { if (!_buffers.contains(bufferId)) return; @@ -253,8 +247,7 @@ void BufferViewConfig::moveBuffer(const BufferId &bufferId, int pos) emit configChanged(); } - -void BufferViewConfig::removeBuffer(const BufferId &bufferId) +void BufferViewConfig::removeBuffer(const BufferId& bufferId) { if (_buffers.contains(bufferId)) _buffers.removeAt(_buffers.indexOf(bufferId)); @@ -268,8 +261,7 @@ void BufferViewConfig::removeBuffer(const BufferId &bufferId) emit configChanged(); } - -void BufferViewConfig::removeBufferPermanently(const BufferId &bufferId) +void BufferViewConfig::removeBufferPermanently(const BufferId& bufferId) { if (_buffers.contains(bufferId)) _buffers.removeAt(_buffers.indexOf(bufferId));