From 8b896450a5fc56a2bde37b44e81dc5af6c338be1 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 20 Nov 2008 09:45:22 +0100 Subject: [PATCH] Add accessor for the All Buffers view to MainWin This will allow us to access the UI features of the NetworkModel, e.g. for creating context menu actions at a global location. We can't do this in NetworkModel since that is Client only; the All Buffers view seems like a sensible location instead. --- src/qtui/mainwin.cpp | 12 ++++++++++-- src/qtui/mainwin.h | 5 ++++- src/uisupport/bufferview.h | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 0a3147f6..b7a6181f 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -18,11 +18,12 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "mainwin.h" -#include + #include "aboutdlg.h" #include "action.h" #include "actioncollection.h" #include "buffermodel.h" +#include "bufferview.h" #include "bufferviewmanager.h" #include "bufferwidget.h" #include "channellistdlg.h" @@ -279,7 +280,7 @@ void MainWin::addBufferView(BufferViewConfig *config) { addDockWidget(Qt::LeftDockWidgetArea, dock); _bufferViewsMenu->addAction(dock->toggleViewAction()); - _netViews.append(dock); + _bufferViews.append(dock); } void MainWin::removeBufferView(int bufferViewConfigId) { @@ -298,6 +299,13 @@ void MainWin::removeBufferView(int bufferViewConfigId) { } } +BufferView *MainWin::allBuffersView() const { + // "All Buffers" is always the first dock created + if(_bufferViews.count() > 0) + return _bufferViews[0]->bufferView(); + return 0; +} + void MainWin::on_actionEditNetworks_triggered() { SettingsPageDlg dlg(new NetworksSettingsPage(this), this); dlg.exec(); diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 2a53f752..76bd423c 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -29,7 +29,9 @@ #include "titlesetter.h" class ActionCollection; +class BufferView; class BufferViewConfig; +class BufferViewDock; class BufferWidget; class MsgProcessorStatusWidget; class NickListWidget; @@ -49,6 +51,7 @@ class MainWin : public QMainWindow { void init(); void addBufferView(BufferViewConfig *config = 0); + BufferView *allBuffersView() const; inline QSystemTrayIcon *systemTrayIcon() const; @@ -128,7 +131,7 @@ class MainWin : public QMainWindow { QSystemTrayIcon *_trayIcon; - QList _netViews; + QList _bufferViews; BufferWidget *_bufferWidget; NickListWidget *_nickListWidget; diff --git a/src/uisupport/bufferview.h b/src/uisupport/bufferview.h index bb7e0cf3..d0ac2100 100644 --- a/src/uisupport/bufferview.h +++ b/src/uisupport/bufferview.h @@ -134,9 +134,10 @@ public: BufferViewDock(BufferViewConfig *config, QWidget *parent); BufferViewDock(QWidget *parent); + inline BufferView *bufferView() const { return qobject_cast(widget()); } + public slots: void bufferViewRenamed(const QString &newName); }; #endif - -- 2.20.1