+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) {
+ 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
+{
+ 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<BufferId>();
+ }
+}
+
+
+void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos)
+{
+ if (_buffers.contains(bufferId))
+ return;
+
+ if (pos < 0)
+ pos = 0;
+ if (pos > _buffers.count())
+ pos = _buffers.count();
+
+ if (_removedBuffers.contains(bufferId))
+ _removedBuffers.remove(bufferId);
+
+ if (_temporarilyRemovedBuffers.contains(bufferId))
+ _temporarilyRemovedBuffers.remove(bufferId);
+
+ _buffers.insert(pos, bufferId);
+ SYNC(ARG(bufferId), ARG(pos))
+ emit bufferAdded(bufferId, pos);
+ emit configChanged();
+}
+
+
+void BufferViewConfig::moveBuffer(const BufferId &bufferId, int pos)
+{
+ if (!_buffers.contains(bufferId))
+ return;
+
+ if (pos < 0)
+ pos = 0;
+ if (pos >= _buffers.count())
+ pos = _buffers.count() - 1;
+
+ _buffers.move(_buffers.indexOf(bufferId), pos);
+ SYNC(ARG(bufferId), ARG(pos))
+ emit bufferMoved(bufferId, pos);
+ emit configChanged();
+}
+
+
+void BufferViewConfig::removeBuffer(const BufferId &bufferId)
+{
+ if (_buffers.contains(bufferId))
+ _buffers.removeAt(_buffers.indexOf(bufferId));
+
+ if (_removedBuffers.contains(bufferId))
+ _removedBuffers.remove(bufferId);
+
+ _temporarilyRemovedBuffers << bufferId;
+ SYNC(ARG(bufferId))
+ emit bufferRemoved(bufferId);
+ emit configChanged();
+}
+
+
+void BufferViewConfig::removeBufferPermanently(const BufferId &bufferId)
+{
+ if (_buffers.contains(bufferId))
+ _buffers.removeAt(_buffers.indexOf(bufferId));
+
+ if (_temporarilyRemovedBuffers.contains(bufferId))
+ _temporarilyRemovedBuffers.remove(bufferId);
+
+ _removedBuffers << bufferId;