X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatmonitorview.cpp;h=da61ee7ffce2fbf2de7ac67e433e0069377fa91c;hp=0c4099862680450c25056ddeb0cc9371f1137ce6;hb=f824db0e31b54969e0b7fa0b5405b1e9173d482c;hpb=4dabe69f242f8a760c1aef549d41aec23d2aed23 diff --git a/src/qtui/chatmonitorview.cpp b/src/qtui/chatmonitorview.cpp index 0c409986..da61ee7f 100644 --- a/src/qtui/chatmonitorview.cpp +++ b/src/qtui/chatmonitorview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -29,43 +29,48 @@ #include "chatitem.h" #include "chatscene.h" #include "client.h" +#include "iconloader.h" #include "networkmodel.h" #include "buffermodel.h" #include "messagemodel.h" #include "qtuisettings.h" +#include "settingspagedlg.h" +#include "settingspages/chatmonitorsettingspage.h" ChatMonitorView::ChatMonitorView(ChatMonitorFilter *filter, QWidget *parent) : ChatView(filter, parent), _filter(filter) { + scene()->setSenderCutoffMode(ChatScene::CutoffLeft); } -void ChatMonitorView::contextMenuEvent(QContextMenuEvent *event) { - QMenu contextMenu(this); - - QAction *showOwnNicksAction = contextMenu.addAction(tr("Show own messages"), _filter, SLOT(setShowOwnMessages(bool))); +void ChatMonitorView::addActionsToMenu(QMenu *menu, const QPointF &pos) { + ChatView::addActionsToMenu(menu, pos); + menu->addSeparator(); + QAction *showOwnNicksAction = menu->addAction(tr("Show Own Messages"), _filter, SLOT(setShowOwnMessages(bool))); showOwnNicksAction->setCheckable(true); showOwnNicksAction->setChecked(_filter->showOwnMessages()); - - if(scene()->sectionByScenePos(event->pos()) == ChatLineModel::SenderColumn) { - contextMenu.addSeparator(); - QAction *showNetworkAction = contextMenu.addAction(tr("Show network name"), this, SLOT(showFieldsChanged(bool))); + if(scene()->columnByScenePos(pos) == ChatLineModel::SenderColumn) { + menu->addSeparator(); + + QAction *showNetworkAction = menu->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))); + QAction *showBufferAction = menu->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()); + menu->addSeparator(); + menu->addAction(SmallIcon("configure"), tr("Configure..."), this, SLOT(showSettingsPage())); } void ChatMonitorView::mouseDoubleClickEvent(QMouseEvent *event) { - if(scene()->sectionByScenePos(event->pos()) != ChatLineModel::SenderColumn) { + if(scene()->columnByScenePos(event->pos()) != ChatLineModel::SenderColumn) { ChatView::mouseDoubleClickEvent(event); return; } @@ -81,11 +86,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) { @@ -98,3 +99,8 @@ void ChatMonitorView::showFieldsChanged(bool checked) { else _filter->removeShowField(showAction->data().toInt()); } + +void ChatMonitorView::showSettingsPage() { + SettingsPageDlg dlg(new ChatMonitorSettingsPage(), this); + dlg.exec(); +}