X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatmonitorview.cpp;h=d3ad1c82af38e05642aa94cfa65cfea4de7d5cf2;hp=a2740c64bc38181fd03289b6e83e35a1dc649cc0;hb=HEAD;hpb=6eefdfc697067d184a589fc8a231b16316c09106 diff --git a/src/qtui/chatmonitorview.cpp b/src/qtui/chatmonitorview.cpp index a2740c64..3b32efb8 100644 --- a/src/qtui/chatmonitorview.cpp +++ b/src/qtui/chatmonitorview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2022 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -21,27 +21,28 @@ #include "chatmonitorview.h" #include -#include #include +#include #include "action.h" #include "buffermodel.h" -#include "chatmonitorfilter.h" -#include "chatlinemodel.h" #include "chatitem.h" +#include "chatlinemodel.h" +#include "chatmonitorfilter.h" #include "chatscene.h" #include "client.h" #include "clientignorelistmanager.h" #include "icon.h" -#include "networkmodel.h" #include "messagemodel.h" +#include "networkmodel.h" #include "qtuisettings.h" #include "settingspagedlg.h" + #include "settingspages/chatmonitorsettingspage.h" -ChatMonitorView::ChatMonitorView(ChatMonitorFilter *filter, QWidget *parent) - : ChatView(filter, parent), - _filter(filter) +ChatMonitorView::ChatMonitorView(ChatMonitorFilter* filter, QWidget* parent) + : ChatView(filter, parent) + , _filter(filter) { scene()->setSenderCutoffMode(ChatScene::CutoffLeft); // The normal message prefixes get replaced by the network and buffer name. Re-add brackets for @@ -50,12 +51,11 @@ ChatMonitorView::ChatMonitorView(ChatMonitorFilter *filter, QWidget *parent) connect(Client::instance(), &Client::coreConnectionStateChanged, this, &ChatMonitorView::coreConnectionStateChanged); } - -void ChatMonitorView::addActionsToMenu(QMenu *menu, const QPointF &pos) +void ChatMonitorView::addActionsToMenu(QMenu* menu, const QPointF& pos) { ChatView::addActionsToMenu(menu, pos); menu->addSeparator(); - auto showOwnNicksAction = new Action(tr("Show Own Messages"), menu, _filter, SLOT(setShowOwnMessages(bool))); + auto showOwnNicksAction = new Action(tr("Show Own Messages"), menu, _filter, &ChatMonitorFilter::setShowOwnMessages); showOwnNicksAction->setCheckable(true); showOwnNicksAction->setChecked(_filter->showOwnMessages()); menu->addAction(showOwnNicksAction); @@ -63,13 +63,13 @@ void ChatMonitorView::addActionsToMenu(QMenu *menu, const QPointF &pos) if (scene()->columnByScenePos(pos) == ChatLineModel::SenderColumn) { menu->addSeparator(); - auto showNetworkAction = new Action(tr("Show Network Name"), menu, this, SLOT(showFieldsChanged(bool))); + auto showNetworkAction = new Action(tr("Show Network Name"), menu, this, &ChatMonitorView::showFieldsChanged); showNetworkAction->setCheckable(true); showNetworkAction->setChecked(_filter->showFields() & ChatMonitorFilter::NetworkField); showNetworkAction->setData(ChatMonitorFilter::NetworkField); menu->addAction(showNetworkAction); - auto showBufferAction = new Action(tr("Show Buffer Name"), menu, this, SLOT(showFieldsChanged(bool))); + auto showBufferAction = new Action(tr("Show Buffer Name"), menu, this, &ChatMonitorView::showFieldsChanged); showBufferAction->setCheckable(true); showBufferAction->setChecked(_filter->showFields() & ChatMonitorFilter::BufferField); showBufferAction->setData(ChatMonitorFilter::BufferField); @@ -77,18 +77,17 @@ void ChatMonitorView::addActionsToMenu(QMenu *menu, const QPointF &pos) } menu->addSeparator(); - menu->addAction(new Action(icon::get("configure"), tr("Configure..."), menu, this, SLOT(showSettingsPage()))); + menu->addAction(new Action(icon::get("configure"), tr("Configure..."), menu, this, &ChatMonitorView::showSettingsPage)); } - -void ChatMonitorView::mouseDoubleClickEvent(QMouseEvent *event) +void ChatMonitorView::mouseDoubleClickEvent(QMouseEvent* event) { if (scene()->columnByScenePos(event->pos()) != ChatLineModel::SenderColumn) { ChatView::mouseDoubleClickEvent(event); return; } - ChatItem *chatItem = scene()->chatItemAt(mapToScene(event->pos())); + ChatItem* chatItem = scene()->chatItemAt(mapToScene(event->pos())); if (!chatItem) { event->ignore(); return; @@ -102,10 +101,9 @@ void ChatMonitorView::mouseDoubleClickEvent(QMouseEvent *event) Client::bufferModel()->switchToBuffer(bufferId); } - void ChatMonitorView::showFieldsChanged(bool checked) { - auto *showAction = qobject_cast(sender()); + auto* showAction = qobject_cast(sender()); if (!showAction) return; @@ -115,14 +113,12 @@ void ChatMonitorView::showFieldsChanged(bool checked) _filter->removeShowField(showAction->data().toInt()); } - void ChatMonitorView::showSettingsPage() { SettingsPageDlg dlg(new ChatMonitorSettingsPage(), this); dlg.exec(); } - // connect only after client is synced to core since ChatMonitorView is created before // the ignoreListManager void ChatMonitorView::coreConnectionStateChanged(bool connected)