cleaning up the general settings page
[quassel.git] / src / qtui / chatview.cpp
index 9c5a6dc..024e49d 100644 (file)
  ***************************************************************************/
 
 #include <QGraphicsTextItem>
+#include <QMenu>
 #include <QScrollBar>
 
+#include "bufferwidget.h"
 #include "chatlinemodelitem.h"
 #include "chatscene.h"
 #include "chatview.h"
@@ -31,6 +33,7 @@
 ChatView::ChatView(BufferId bufferId, QWidget *parent)
   : QGraphicsView(parent),
     AbstractChatView(),
+    _bufferContainer(0),
     _currentScaleFactor(1)
 {
   QList<BufferId> filterList;
@@ -42,6 +45,7 @@ ChatView::ChatView(BufferId bufferId, QWidget *parent)
 ChatView::ChatView(MessageFilter *filter, QWidget *parent)
   : QGraphicsView(parent),
     AbstractChatView(),
+    _bufferContainer(0),
     _currentScaleFactor(1)
 {
   init(filter);
@@ -61,7 +65,7 @@ void ChatView::init(MessageFilter *filter) {
   _scrollTimer.setSingleShot(true);
   connect(&_scrollTimer, SIGNAL(timeout()), SLOT(scrollTimerTimeout()));
 
-  _scene = new ChatScene(filter, filter->idString(), viewport()->width() - 2, this); // see below: resizeEvent()
+  _scene = new ChatScene(filter, filter->idString(), viewport()->width() - 4, this); // see below: resizeEvent()
   connect(_scene, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(sceneRectChanged(const QRectF &)));
   connect(_scene, SIGNAL(lastLineChanged(QGraphicsItem *, qreal)), this, SLOT(lastLineChanged(QGraphicsItem *, qreal)));
   connect(_scene, SIGNAL(mouseMoveWhileSelecting(const QPointF &)), this, SLOT(mouseMoveWhileSelecting(const QPointF &)));
@@ -147,6 +151,15 @@ MsgId ChatView::lastMsgId() const {
   return model->data(model->index(model->rowCount() - 1, 0), MessageModel::MsgIdRole).value<MsgId>();
 }
 
+void ChatView::addActionsToMenu(QMenu *menu, const QPointF &pos) {
+  // zoom actions
+  BufferWidget *bw = qobject_cast<BufferWidget *>(bufferContainer());
+  if(bw) {
+    bw->addActionsToMenu(menu, pos);
+    menu->addSeparator();
+  }
+}
+
 void ChatView::zoomIn() {
     _currentScaleFactor *= 1.2;
     scale(1.2, 1.2);
@@ -159,7 +172,7 @@ void ChatView::zoomOut() {
     scene()->setWidth(viewport()->width() / _currentScaleFactor - 2);
 }
 
-void ChatView::zoomNormal() {
+void ChatView::zoomOriginal() {
     scale(1/_currentScaleFactor, 1/_currentScaleFactor);
     _currentScaleFactor = 1;
     scene()->setWidth(viewport()->width() - 2);