From 3545504d0588f79ac92a7702c4cf78dc0adff05f Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sun, 14 Jun 2015 04:07:50 +0200 Subject: [PATCH 1/1] Make the buffer search optional, disable by default --- src/common/bufferviewconfig.cpp | 13 ++++++++++++- src/common/bufferviewconfig.h | 5 +++++ src/qtui/settingspages/bufferviewsettingspage.cpp | 3 +++ src/qtui/settingspages/bufferviewsettingspage.ui | 7 +++++++ src/uisupport/bufferview.cpp | 1 + src/uisupport/bufferview.h | 1 + 6 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/common/bufferviewconfig.cpp b/src/common/bufferviewconfig.cpp index 08a3c5e4..54edae50 100644 --- a/src/common/bufferviewconfig.cpp +++ b/src/common/bufferviewconfig.cpp @@ -32,7 +32,8 @@ BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent) _hideInactiveNetworks(false), _disableDecoration(false), _allowedBufferTypes(BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer), - _minimumActivity(0) + _minimumActivity(0), + _showSearch(true) { setObjectName(QString::number(bufferViewId)); } @@ -144,6 +145,16 @@ void BufferViewConfig::setHideInactiveNetworks(bool hideInactiveNetworks) emit configChanged(); } +void BufferViewConfig::setShowSearch(bool showSearch) { + if (_showSearch == showSearch) { + return; + } + + _showSearch = showSearch; + SYNC(ARG(showSearch)) + emit configChanged(); +} + QVariantList BufferViewConfig::initBufferList() const { diff --git a/src/common/bufferviewconfig.h b/src/common/bufferviewconfig.h index f940bc70..59164bb7 100644 --- a/src/common/bufferviewconfig.h +++ b/src/common/bufferviewconfig.h @@ -39,6 +39,7 @@ class BufferViewConfig : public SyncableObject Q_PROPERTY(bool disableDecoration READ disableDecoration WRITE setDisableDecoration) Q_PROPERTY(int allowedBufferTypes READ allowedBufferTypes WRITE setAllowedBufferTypes) Q_PROPERTY(int minimumActivity READ minimumActivity WRITE setMinimumActivity) + Q_PROPERTY(bool showSearch READ showSearch WRITE setShowSearch) public : BufferViewConfig(int bufferViewId, QObject *parent = 0); @@ -76,6 +77,9 @@ public slots: inline bool hideInactiveNetworks() const { return _hideInactiveNetworks; } void setHideInactiveNetworks(bool hideInactiveNetworks); + inline bool showSearch() const { return _showSearch; } + void setShowSearch(bool showSearch); + virtual inline void requestSetBufferViewName(const QString &bufferViewName) { REQUEST(ARG(bufferViewName)) } const QList &bufferList() const { return _buffers; } @@ -135,6 +139,7 @@ private: bool _disableDecoration; int _allowedBufferTypes; int _minimumActivity; + bool _showSearch; QList _buffers; QSet _removedBuffers; QSet _temporarilyRemovedBuffers; diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp index 06b341f0..4bfddc4e 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.cpp +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -67,6 +67,7 @@ BufferViewSettingsPage::BufferViewSettingsPage(QWidget *parent) connect(ui.hideInactiveNetworks, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.minimumActivitySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); + connect(ui.showSearch, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(enableStatusBuffers(int))); } @@ -441,6 +442,7 @@ void BufferViewSettingsPage::loadConfig(BufferViewConfig *config) ui.sortAlphabetically->setChecked(config->sortAlphabetically()); ui.hideInactiveBuffers->setChecked(config->hideInactiveBuffers()); ui.hideInactiveNetworks->setChecked(config->hideInactiveNetworks()); + ui.showSearch->setChecked(config->showSearch()); int networkIndex = 0; for (int i = 0; i < ui.networkSelector->count(); i++) { @@ -484,6 +486,7 @@ void BufferViewSettingsPage::saveConfig(BufferViewConfig *config) config->setHideInactiveBuffers(ui.hideInactiveBuffers->isChecked()); config->setHideInactiveNetworks(ui.hideInactiveNetworks->isChecked()); config->setNetworkId(ui.networkSelector->itemData(ui.networkSelector->currentIndex()).value()); + config->setShowSearch(ui.showSearch->isChecked()); int minimumActivity = 0; if (ui.minimumActivitySelector->currentIndex() > 0) diff --git a/src/qtui/settingspages/bufferviewsettingspage.ui b/src/qtui/settingspages/bufferviewsettingspage.ui index 30b09078..6e485143 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.ui +++ b/src/qtui/settingspages/bufferviewsettingspage.ui @@ -157,6 +157,13 @@ In this mode no separate status buffer is displayed. + + + + Show search + + + diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index 2127bcc6..f002405c 100644 --- a/src/uisupport/bufferview.cpp +++ b/src/uisupport/bufferview.cpp @@ -652,6 +652,7 @@ BufferViewDock::BufferViewDock(BufferViewConfig *config, QWidget *parent) toggleViewAction()->setData(config->bufferViewId()); setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea); connect(config, SIGNAL(bufferViewNameSet(const QString &)), this, SLOT(bufferViewRenamed(const QString &))); + connect(config, SIGNAL(configChanged()), SLOT(configChanged())); updateTitle(); _widget->setLayout(new QVBoxLayout); diff --git a/src/uisupport/bufferview.h b/src/uisupport/bufferview.h index a06c1f08..abcd4f5f 100644 --- a/src/uisupport/bufferview.h +++ b/src/uisupport/bufferview.h @@ -151,6 +151,7 @@ public slots: private slots: void bufferViewRenamed(const QString &newName); void updateTitle(); + void configChanged(); private: QWidget *_childWidget; -- 2.20.1