From: Shane Synan Date: Thu, 12 Jul 2018 01:13:22 +0000 (-0500) Subject: common: Fix BufferViewConfig upgrade defaults X-Git-Tag: 0.13-rc1~15 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=e9c0076ab1da4d613cf0ef97adbb1f45fed13d47 common: Fix BufferViewConfig upgrade defaults Fix initialization of default values when upgrading BufferViewConfig. This solves the issue of showSearch() being set to true on upgrade despite having the default of false. Search doesn't usually need shown as the activate shortcut will make it temporarily appear. Details: When loading a buffer from configuration, the "fromVariantMap(properties);" path was taken. As this side lacked the initialization, defaults weren't set for newly-added values. Thankfully, it really is just this simple (fingers crossed). Add some documentation love, too. --- diff --git a/src/common/bufferviewconfig.cpp b/src/common/bufferviewconfig.cpp index 55eb4a2f..95cee709 100644 --- a/src/common/bufferviewconfig.cpp +++ b/src/common/bufferviewconfig.cpp @@ -20,20 +20,10 @@ #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), - _showSearch(false) + _bufferViewId(bufferViewId) { setObjectName(QString::number(bufferViewId)); } diff --git a/src/common/bufferviewconfig.h b/src/common/bufferviewconfig.h index 8d135d2d..71a8eab7 100644 --- a/src/common/bufferviewconfig.h +++ b/src/common/bufferviewconfig.h @@ -23,6 +23,7 @@ #include "syncableobject.h" +#include "bufferinfo.h" #include "types.h" class BufferViewConfig : public SyncableObject @@ -129,17 +130,21 @@ signals: // void setBufferViewNameRequested(const QString &bufferViewName); private: - int _bufferViewId; - QString _bufferViewName; - NetworkId _networkId; - bool _addNewBuffersAutomatically; - bool _sortAlphabetically; - bool _hideInactiveBuffers; - bool _hideInactiveNetworks; - bool _disableDecoration; - int _allowedBufferTypes; - int _minimumActivity; - bool _showSearch; + int _bufferViewId = 0; ///< ID of the associated BufferView + QString _bufferViewName = {}; ///< Display name of the associated BufferView + NetworkId _networkId = {}; ///< Network ID this buffer belongs to + + bool _addNewBuffersAutomatically = true; ///< Automatically add new buffers when created + bool _sortAlphabetically = true; ///< Sort buffers alphabetically + bool _hideInactiveBuffers = false; ///< Hide buffers without activity + bool _hideInactiveNetworks = false; ///< Hide networks without activity + bool _disableDecoration = false; ///< Disable buffer decoration (not fully implemented) + /// Buffer types allowed within this view + int _allowedBufferTypes = (BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer + | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer); + int _minimumActivity = 0; ///< Minimum activity for a buffer to show + bool _showSearch = false; ///< Persistently show the buffer search UI + QList _buffers; QSet _removedBuffers; QSet _temporarilyRemovedBuffers;