Make the buffer search optional, disable by default
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>
Sun, 14 Jun 2015 02:07:50 +0000 (04:07 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 5 Sep 2016 17:00:03 +0000 (19:00 +0200)
src/common/bufferviewconfig.cpp
src/common/bufferviewconfig.h
src/qtui/settingspages/bufferviewsettingspage.cpp
src/qtui/settingspages/bufferviewsettingspage.ui
src/uisupport/bufferview.cpp
src/uisupport/bufferview.h

index 08a3c5e..54edae5 100644 (file)
@@ -32,7 +32,8 @@ BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent)
     _hideInactiveNetworks(false),
     _disableDecoration(false),
     _allowedBufferTypes(BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer),
     _hideInactiveNetworks(false),
     _disableDecoration(false),
     _allowedBufferTypes(BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer),
-    _minimumActivity(0)
+    _minimumActivity(0),
+    _showSearch(true)
 {
     setObjectName(QString::number(bufferViewId));
 }
 {
     setObjectName(QString::number(bufferViewId));
 }
@@ -144,6 +145,16 @@ void BufferViewConfig::setHideInactiveNetworks(bool hideInactiveNetworks)
     emit configChanged();
 }
 
     emit configChanged();
 }
 
+void BufferViewConfig::setShowSearch(bool showSearch) {
+    if (_showSearch == showSearch) {
+        return;
+    }
+
+    _showSearch = showSearch;
+    SYNC(ARG(showSearch))
+    emit configChanged();
+}
+
 
 QVariantList BufferViewConfig::initBufferList() const
 {
 
 QVariantList BufferViewConfig::initBufferList() const
 {
index f940bc7..59164bb 100644 (file)
@@ -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 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);
 
 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 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<BufferId> &bufferList() const { return _buffers; }
     virtual inline void requestSetBufferViewName(const QString &bufferViewName) { REQUEST(ARG(bufferViewName)) }
 
     const QList<BufferId> &bufferList() const { return _buffers; }
@@ -135,6 +139,7 @@ private:
     bool _disableDecoration;
     int _allowedBufferTypes;
     int _minimumActivity;
     bool _disableDecoration;
     int _allowedBufferTypes;
     int _minimumActivity;
+    bool _showSearch;
     QList<BufferId> _buffers;
     QSet<BufferId> _removedBuffers;
     QSet<BufferId> _temporarilyRemovedBuffers;
     QList<BufferId> _buffers;
     QSet<BufferId> _removedBuffers;
     QSet<BufferId> _temporarilyRemovedBuffers;
index 06b341f..4bfddc4 100644 (file)
@@ -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.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)));
 }
 
     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.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++) {
 
     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<NetworkId>());
     config->setHideInactiveBuffers(ui.hideInactiveBuffers->isChecked());
     config->setHideInactiveNetworks(ui.hideInactiveNetworks->isChecked());
     config->setNetworkId(ui.networkSelector->itemData(ui.networkSelector->currentIndex()).value<NetworkId>());
+    config->setShowSearch(ui.showSearch->isChecked());
 
     int minimumActivity = 0;
     if (ui.minimumActivitySelector->currentIndex() > 0)
 
     int minimumActivity = 0;
     if (ui.minimumActivitySelector->currentIndex() > 0)
index 30b0907..6e48514 100644 (file)
@@ -157,6 +157,13 @@ In this mode no separate status buffer is displayed.</string>
         </property>
        </widget>
       </item>
         </property>
        </widget>
       </item>
+      <item>
+       <widget class="QCheckBox" name="showSearch">
+        <property name="text">
+         <string>Show search</string>
+        </property>
+       </widget>
+      </item>
       <item>
        <widget class="QLabel" name="label_3">
         <property name="text">
       <item>
        <widget class="QLabel" name="label_3">
         <property name="text">
index 2127bcc..f002405 100644 (file)
@@ -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 &)));
     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);
     updateTitle();
 
     _widget->setLayout(new QVBoxLayout);
index a06c1f0..abcd4f5 100644 (file)
@@ -151,6 +151,7 @@ public slots:
 private slots:
     void bufferViewRenamed(const QString &newName);
     void updateTitle();
 private slots:
     void bufferViewRenamed(const QString &newName);
     void updateTitle();
+    void configChanged();
 
 private:
     QWidget *_childWidget;
 
 private:
     QWidget *_childWidget;