nick changes and day changes can now be hidden too
authorMarcus Eggenberger <egs@quassel-irc.org>
Mon, 17 Nov 2008 23:40:35 +0000 (00:40 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Mon, 17 Nov 2008 23:40:35 +0000 (00:40 +0100)
src/uisupport/bufferview.cpp
src/uisupport/bufferview.h

index 8751c93..9ab553c 100644 (file)
@@ -60,16 +60,19 @@ BufferView::BufferView(QWidget *parent)
     _removeBufferAction(tr("Delete buffer"), this),
     _ignoreListAction(tr("Ignore list"), this),
 
-    _hideJoinAction(tr("Join Events"), this),
-    _hidePartAction(tr("Part Events"), this),
-    _hideQuitAction(tr("Quit Events"), this),
-    _hideModeAction(tr("Mode Events"), this)
-
+    _hideJoinAction(tr("Joins"), this),
+    _hidePartAction(tr("Parts"), this),
+    _hideQuitAction(tr("Quits"), this),
+    _hideNickAction(tr("Nick Changes"), this),
+    _hideModeAction(tr("Mode"), this),
+    _hideDayChangeAction(tr("Day Change"), this)
 {
   _hideJoinAction.setCheckable(true);
   _hidePartAction.setCheckable(true);
   _hideQuitAction.setCheckable(true);
+  _hideNickAction.setCheckable(true);
   _hideModeAction.setCheckable(true);
+  _hideDayChangeAction.setCheckable(true);
   _ignoreListAction.setEnabled(false);
 
   showChannelList.setIcon(SmallIcon("format-list-unordered"));
@@ -389,13 +392,17 @@ QMenu *BufferView::createHideEventsSubMenu(QMenu &menu, BufferId bufferId) {
   _hideJoinAction.setChecked(filter & Message::Join);
   _hidePartAction.setChecked(filter & Message::Part);
   _hideQuitAction.setChecked(filter & Message::Quit);
+  _hideNickAction.setChecked(filter & Message::Nick);
   _hideModeAction.setChecked(filter & Message::Mode);
+  _hideDayChangeAction.setChecked(filter & Message::DayChange);
 
   QMenu *hideEventsMenu = menu.addMenu(tr("Hide Events"));
   hideEventsMenu->addAction(&_hideJoinAction);
   hideEventsMenu->addAction(&_hidePartAction);
   hideEventsMenu->addAction(&_hideQuitAction);
+  hideEventsMenu->addAction(&_hideNickAction);
   hideEventsMenu->addAction(&_hideModeAction);
+  hideEventsMenu->addAction(&_hideDayChangeAction);
   return hideEventsMenu;
 }
 
@@ -540,12 +547,21 @@ void BufferView::contextMenuEvent(QContextMenuEvent *event) {
     BufferSettings(bufferId).filterMessage(Message::Quit, _hideQuitAction.isChecked());
     return;
   }
+  if(result == &_hideNickAction) {
+    BufferId bufferId = index.data(NetworkModel::BufferIdRole).value<BufferId>();
+    BufferSettings(bufferId).filterMessage(Message::Nick, _hideNickAction.isChecked());
+    return;
+  }
   if(result == &_hideModeAction) {
     BufferId bufferId = index.data(NetworkModel::BufferIdRole).value<BufferId>();
     BufferSettings(bufferId).filterMessage(Message::Mode, _hideModeAction.isChecked());
     return;
   }
-
+  if(result == &_hideDayChangeAction) {
+    BufferId bufferId = index.data(NetworkModel::BufferIdRole).value<BufferId>();
+    BufferSettings(bufferId).filterMessage(Message::DayChange, _hideDayChangeAction.isChecked());
+    return;
+  }
 }
 
 void BufferView::wheelEvent(QWheelEvent* event) {
index a8231d9..bb7e0cf 100644 (file)
@@ -42,22 +42,22 @@ class BufferView : public QTreeView {
 public:
   BufferView(QWidget *parent = 0);
   void init();
-  
+
   void setModel(QAbstractItemModel *model);
   void setFilteredModel(QAbstractItemModel *model, BufferViewConfig *config);
   virtual void setSelectionModel(QItemSelectionModel *selectionModel);
-  
+
   void setConfig(BufferViewConfig *config);
   inline BufferViewConfig *config() { return _config; }
 
 public slots:
   void setRootIndexForNetworkId(const NetworkId &networkId);
   void removeSelectedBuffers(bool permanently = false);
-  
+
 signals:
   void removeBuffer(const QModelIndex &);
   void removeBufferPermanently(const QModelIndex &);
-  
+
 protected:
   virtual void keyPressEvent(QKeyEvent *);
   virtual void rowsInserted(const QModelIndex & parent, int start, int end);
@@ -87,22 +87,24 @@ public:
 
 private:
   QPointer<BufferViewConfig> _config;
-  
+
   QAction _connectNetAction;
   QAction _disconnectNetAction;
   QAction _joinChannelAction;
-  
+
   QAction _joinBufferAction;
   QAction _partBufferAction;
   QAction _hideBufferTemporarilyAction;
   QAction _hideBufferPermanentlyAction;
   QAction _removeBufferAction;
   QAction _ignoreListAction;
-  
+
   QAction _hideJoinAction;
   QAction _hidePartAction;
   QAction _hideQuitAction;
+  QAction _hideNickAction;
   QAction _hideModeAction;
+  QAction _hideDayChangeAction;
 
   QHash<NetworkId, bool> _expandedState;
 
@@ -131,7 +133,7 @@ class BufferViewDock : public QDockWidget {
 public:
   BufferViewDock(BufferViewConfig *config, QWidget *parent);
   BufferViewDock(QWidget *parent);
-                                
+
 public slots:
   void bufferViewRenamed(const QString &newName);
 };