X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatmonitorview.cpp;h=d5c37312275494bc889dc0c52e9f7a151a1f5f5d;hp=3f31591e47200785104bf65f01fbdc8d8e2e0e64;hb=229b87f259ab1bc2c65f481eb39c25a872080fe7;hpb=eeced31ae5f16ddb4600c8fbd07c14d4e2e08824 diff --git a/src/qtui/chatmonitorview.cpp b/src/qtui/chatmonitorview.cpp index 3f31591e..d5c37312 100644 --- a/src/qtui/chatmonitorview.cpp +++ b/src/qtui/chatmonitorview.cpp @@ -38,30 +38,35 @@ ChatMonitorView::ChatMonitorView(ChatMonitorFilter *filter, QWidget *parent) : ChatView(filter, parent), _filter(filter) { + scene()->setSenderCutoffMode(ChatScene::CutoffLeft); } void ChatMonitorView::contextMenuEvent(QContextMenuEvent *event) { - if(scene()->sectionByScenePos(event->pos()) != ChatLineModel::SenderColumn) - return; - - int showFields = _filter->showFields(); - QMenu contextMenu(this); - QAction *showNetworkAction = contextMenu.addAction(tr("Show network name"), this, SLOT(showFieldsChanged(bool))); - showNetworkAction->setCheckable(true); - showNetworkAction->setChecked(showFields & ChatMonitorFilter::NetworkField); - showNetworkAction->setData(ChatMonitorFilter::NetworkField); - QAction *showBufferAction = contextMenu.addAction(tr("Show buffer name"), this, SLOT(showFieldsChanged(bool))); - showBufferAction->setCheckable(true); - showBufferAction->setChecked(showFields & ChatMonitorFilter::BufferField); - showBufferAction->setData(ChatMonitorFilter::BufferField); + QAction *showOwnNicksAction = contextMenu.addAction(tr("Show own messages"), _filter, SLOT(setShowOwnMessages(bool))); + showOwnNicksAction->setCheckable(true); + showOwnNicksAction->setChecked(_filter->showOwnMessages()); + + if(scene()->columnByScenePos(event->pos()) == ChatLineModel::SenderColumn) { + contextMenu.addSeparator(); + + QAction *showNetworkAction = contextMenu.addAction(tr("Show network name"), this, SLOT(showFieldsChanged(bool))); + showNetworkAction->setCheckable(true); + showNetworkAction->setChecked(_filter->showFields() & ChatMonitorFilter::NetworkField); + showNetworkAction->setData(ChatMonitorFilter::NetworkField); + + QAction *showBufferAction = contextMenu.addAction(tr("Show buffer name"), this, SLOT(showFieldsChanged(bool))); + showBufferAction->setCheckable(true); + showBufferAction->setChecked(_filter->showFields() & ChatMonitorFilter::BufferField); + showBufferAction->setData(ChatMonitorFilter::BufferField); + } contextMenu.exec(QCursor::pos()); } void ChatMonitorView::mouseDoubleClickEvent(QMouseEvent *event) { - if(scene()->sectionByScenePos(event->pos()) != ChatLineModel::SenderColumn) { + if(scene()->columnByScenePos(event->pos()) != ChatLineModel::SenderColumn) { ChatView::mouseDoubleClickEvent(event); return; } @@ -77,11 +82,7 @@ void ChatMonitorView::mouseDoubleClickEvent(QMouseEvent *event) { if(!bufferId.isValid()) return; - QModelIndex bufferIdx = Client::networkModel()->bufferIndex(bufferId); - if(!bufferIdx.isValid()) - return; - - Client::bufferModel()->setCurrentIndex(Client::bufferModel()->mapFromSource(bufferIdx)); + Client::bufferModel()->switchToBuffer(bufferId); } void ChatMonitorView::showFieldsChanged(bool checked) {