X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fbufferviewconfig.cpp;h=935d175f8f51f310f1235a04c334d9acca43a26b;hb=eddadb820d74ad787a04c0652d15dfd1e8475082;hp=88c9dc0e3431008e43c6bd732c86185184431e57;hpb=a1bcca1c86e88406a0c5495b08731e6b11dd987e;p=quassel.git diff --git a/src/common/bufferviewconfig.cpp b/src/common/bufferviewconfig.cpp index 88c9dc0e..935d175f 100644 --- a/src/common/bufferviewconfig.cpp +++ b/src/common/bufferviewconfig.cpp @@ -28,6 +28,7 @@ BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent) _addNewBuffersAutomatically(true), _sortAlphabetically(true), _hideInactiveBuffers(false), + _disableDecoration(false), _allowedBufferTypes(BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer), _minimumActivity(0) { @@ -36,7 +37,8 @@ BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent) BufferViewConfig::BufferViewConfig(int bufferViewId, const QVariantMap &properties, QObject *parent) : SyncableObject(parent), - _bufferViewId(bufferViewId) + _bufferViewId(bufferViewId), + _disableDecoration(false) // FIXME remove as soon as we have bumped the protocol version to v8 { fromVariantMap(properties); setObjectName(QString::number(bufferViewId)); @@ -74,6 +76,14 @@ void BufferViewConfig::setSortAlphabetically(bool sortAlphabetically) { emit sortAlphabeticallySet(sortAlphabetically); } +void BufferViewConfig::setDisableDecoration(bool disableDecoration) { + if(_disableDecoration == disableDecoration) + return; + + _disableDecoration = disableDecoration; + emit disableDecorationSet(disableDecoration); +} + void BufferViewConfig::setAllowedBufferTypes(int bufferTypes) { if(_allowedBufferTypes == bufferTypes) return; @@ -130,7 +140,7 @@ void BufferViewConfig::initSetBufferList(const QList &buffers) { emit bufferListSet(); } -QVariantList BufferViewConfig::initRemovedBuffersList() const { +QVariantList BufferViewConfig::initRemovedBuffers() const { QVariantList removedBuffers; foreach(BufferId bufferId, _removedBuffers) { @@ -140,7 +150,7 @@ QVariantList BufferViewConfig::initRemovedBuffersList() const { return removedBuffers; } -void BufferViewConfig::initSetRemovedBuffersList(const QVariantList &buffers) { +void BufferViewConfig::initSetRemovedBuffers(const QVariantList &buffers) { _removedBuffers.clear(); foreach(QVariant buffer, buffers) { @@ -148,6 +158,24 @@ void BufferViewConfig::initSetRemovedBuffersList(const QVariantList &buffers) { } } +QVariantList BufferViewConfig::initTemporarilyRemovedBuffers() const { + QVariantList temporarilyRemovedBuffers; + + foreach(BufferId bufferId, _temporarilyRemovedBuffers) { + temporarilyRemovedBuffers << qVariantFromValue(bufferId); + } + + return temporarilyRemovedBuffers; +} + +void BufferViewConfig::initSetTemporarilyRemovedBuffers(const QVariantList &buffers) { + _temporarilyRemovedBuffers.clear(); + + foreach(QVariant buffer, buffers) { + _temporarilyRemovedBuffers << buffer.value(); + } +} + void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) { if(_buffers.contains(bufferId)) return; @@ -159,7 +187,10 @@ void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) { if(_removedBuffers.contains(bufferId)) _removedBuffers.remove(bufferId); - + + if(_temporarilyRemovedBuffers.contains(bufferId)) + _temporarilyRemovedBuffers.remove(bufferId); + _buffers.insert(pos, bufferId); emit bufferAdded(bufferId, pos); } @@ -178,17 +209,24 @@ void BufferViewConfig::moveBuffer(const BufferId &bufferId, int pos) { } void BufferViewConfig::removeBuffer(const BufferId &bufferId) { - if(!_buffers.contains(bufferId)) - return; - - _buffers.removeAt(_buffers.indexOf(bufferId)); + if(_buffers.contains(bufferId)) + _buffers.removeAt(_buffers.indexOf(bufferId)); + + if(_removedBuffers.contains(bufferId)) + _removedBuffers.remove(bufferId); + + _temporarilyRemovedBuffers << bufferId; + emit bufferRemoved(bufferId); } void BufferViewConfig::removeBufferPermanently(const BufferId &bufferId) { if(_buffers.contains(bufferId)) _buffers.removeAt(_buffers.indexOf(bufferId)); - + + if(_temporarilyRemovedBuffers.contains(bufferId)) + _temporarilyRemovedBuffers.remove(bufferId); + _removedBuffers << bufferId; emit bufferPermanentlyRemoved(bufferId);