/***************************************************************************
- * Copyright (C) 2005-2014 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "topicwidget.h"
#include "client.h"
-#include "iconloader.h"
+#include "icon.h"
#include "networkmodel.h"
#include "uisettings.h"
#include "graphicalui.h"
: AbstractItemView(parent)
{
ui.setupUi(this);
- ui.topicEditButton->setIcon(SmallIcon("edit-rename"));
- ui.topicLineEdit->setWordWrapEnabled(true);
+ ui.topicEditButton->setIcon(icon::get("edit-rename"));
+ ui.topicLineEdit->setLineWrapEnabled(true);
ui.topicLineEdit->installEventFilter(this);
- connect(ui.topicLabel, SIGNAL(clickableActivated(Clickable)), SLOT(clickableActivated(Clickable)));
- connect(ui.topicLineEdit, SIGNAL(noTextEntered()), SLOT(on_topicLineEdit_textEntered()));
+ connect(ui.topicLabel, &StyledLabel::clickableActivated, this, &TopicWidget::clickableActivated);
+ connect(ui.topicLineEdit, &MultiLineEdit::noTextEntered, this, &TopicWidget::on_topicLineEdit_textEntered);
UiSettings s("TopicWidget");
s.notify("DynamicResize", this, SLOT(updateResizeMode()));
QModelIndex currentTopicIndex = selectionModel()->currentIndex().sibling(selectionModel()->currentIndex().row(), 1);
if (changedArea.contains(currentTopicIndex))
setTopic(selectionModel()->currentIndex());
-};
+}
void TopicWidget::setUseCustomFont(const QVariant &v)
{
case BufferInfo::StatusBuffer:
if (network) {
newtopic = QString("%1 (%2) | %3 | %4")
- .arg(Qt::escape(network->networkName()))
- .arg(Qt::escape(network->currentServer()))
+ .arg(network->networkName().toHtmlEscaped())
+ .arg(network->currentServer().toHtmlEscaped())
.arg(tr("Users: %1").arg(network->ircUsers().count()))
.arg(tr("Lag: %1 msecs").arg(network->latency()));
}
void TopicWidget::clickableActivated(const Clickable &click)
{
NetworkId networkId = selectionModel()->currentIndex().data(NetworkModel::NetworkIdRole).value<NetworkId>();
- UiStyle::StyledString sstr = GraphicalUi::uiStyle()->styleString(GraphicalUi::uiStyle()->mircToInternal(_topic), UiStyle::PlainMsg);
+ UiStyle::StyledString sstr = GraphicalUi::uiStyle()->styleString(GraphicalUi::uiStyle()->mircToInternal(_topic), UiStyle::FormatType::PlainMsg);
click.activate(networkId, sstr.plainText);
}
if (event->type() != QEvent::KeyRelease)
return QObject::eventFilter(obj, event);
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+ auto *keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Escape) {
switchPlain();
// some unicode characters with a new line, which then triggers
// a stack overflow later
QString result(topic);
+ result.replace(QChar::CarriageReturn, " ");
result.replace(QChar::ParagraphSeparator, " ");
result.replace(QChar::LineSeparator, " ");