qa: Remove lots of superfluous semicolons
[quassel.git] / src / qtui / topicwidget.cpp
index 95d6284..5426b08 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2015 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  *
@@ -20,9 +20,8 @@
 
 #include "topicwidget.h"
 
-#include <QIcon>
-
 #include "client.h"
+#include "icon.h"
 #include "networkmodel.h"
 #include "uisettings.h"
 #include "graphicalui.h"
@@ -32,7 +31,7 @@ TopicWidget::TopicWidget(QWidget *parent)
     : AbstractItemView(parent)
 {
     ui.setupUi(this);
-    ui.topicEditButton->setIcon(QIcon::fromTheme("edit-rename"));
+    ui.topicEditButton->setIcon(icon::get("edit-rename"));
     ui.topicLineEdit->setLineWrapEnabled(true);
     ui.topicLineEdit->installEventFilter(this);
 
@@ -68,7 +67,7 @@ void TopicWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bot
     QModelIndex currentTopicIndex = selectionModel()->currentIndex().sibling(selectionModel()->currentIndex().row(), 1);
     if (changedArea.contains(currentTopicIndex))
         setTopic(selectionModel()->currentIndex());
-};
+}
 
 void TopicWidget::setUseCustomFont(const QVariant &v)
 {
@@ -115,19 +114,11 @@ void TopicWidget::setTopic(const QModelIndex &index)
         switch (Client::networkModel()->bufferType(id)) {
         case BufferInfo::StatusBuffer:
             if (network) {
-#if QT_VERSION < 0x050000
-                newtopic = QString("%1 (%2) | %3 | %4")
-                           .arg(Qt::escape(network->networkName()))
-                           .arg(Qt::escape(network->currentServer()))
-                           .arg(tr("Users: %1").arg(network->ircUsers().count()))
-                           .arg(tr("Lag: %1 msecs").arg(network->latency()));
-#else
                 newtopic = QString("%1 (%2) | %3 | %4")
                            .arg(network->networkName().toHtmlEscaped())
                            .arg(network->currentServer().toHtmlEscaped())
                            .arg(tr("Users: %1").arg(network->ircUsers().count()))
                            .arg(tr("Lag: %1 msecs").arg(network->latency()));
-#endif
             }
             else {
                 newtopic = index0.data(Qt::DisplayRole).toString();
@@ -202,7 +193,7 @@ void TopicWidget::updateResizeMode()
 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);
 }
 
@@ -281,6 +272,7 @@ QString TopicWidget::sanitizeTopic(const QString& topic)
     // 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, " ");