modernize: Use raw string literals instead of escaped strings
[quassel.git] / src / qtui / settingspages / identitiessettingspage.cpp
index 577e6e9..0cf9974 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   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 "identitiessettingspage.h"
 
-#include <QIcon>
 #include <QInputDialog>
 #include <QMessageBox>
+#include <utility>
 
 #include "client.h"
+#include "icon.h"
 #include "signalproxy.h"
 
 IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent)
-    : SettingsPage(tr("IRC"), tr("Identities"), parent),
-    _editSsl(false)
+    : SettingsPage(tr("IRC"), tr("Identities"), parent)
 {
     ui.setupUi(this);
-    ui.renameIdentity->setIcon(QIcon::fromTheme("edit-rename"));
-    ui.addIdentity->setIcon(QIcon::fromTheme("list-add-user"));
-    ui.deleteIdentity->setIcon(QIcon::fromTheme("list-remove-user"));
+    ui.renameIdentity->setIcon(icon::get("edit-rename"));
+    ui.addIdentity->setIcon(icon::get("list-add-user"));
+    ui.deleteIdentity->setIcon(icon::get("list-remove-user"));
 
     coreConnectionStateChanged(Client::isConnected()); // need a core connection!
     connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool)));
@@ -84,7 +84,7 @@ void IdentitiesSettingsPage::continueUnsecured()
     _editSsl = true;
 
     QHash<IdentityId, CertIdentity *>::iterator idIter;
-    for (idIter = identities.begin(); idIter != identities.end(); idIter++) {
+    for (idIter = identities.begin(); idIter != identities.end(); ++idIter) {
         idIter.value()->enableEditSsl();
     }
 
@@ -215,7 +215,7 @@ bool IdentitiesSettingsPage::aboutToSave()
 
 void IdentitiesSettingsPage::clientIdentityCreated(IdentityId id)
 {
-    CertIdentity *identity = new CertIdentity(*Client::identity(id), this);
+    auto *identity = new CertIdentity(*Client::identity(id), this);
 #ifdef HAVE_SSL
     identity->enableEditSsl(_editSsl);
 #endif
@@ -303,13 +303,13 @@ void IdentitiesSettingsPage::removeIdentity(Identity *id)
 
 void IdentitiesSettingsPage::on_identityList_currentIndexChanged(int index)
 {
-    CertIdentity *previousIdentity = 0;
+    CertIdentity *previousIdentity = nullptr;
     if (currentId != 0 && identities.contains(currentId))
         previousIdentity = identities[currentId];
 
     if (index < 0) {
         //ui.identityList->setEditable(false);
-        ui.identityEditor->displayIdentity(0, previousIdentity);
+        ui.identityEditor->displayIdentity(nullptr, previousIdentity);
         currentId = 0;
     }
     else {
@@ -332,7 +332,7 @@ void IdentitiesSettingsPage::on_addIdentity_clicked()
             if (!identities.keys().contains(-id.toInt())) break;
         }
         id = -id.toInt();
-        CertIdentity *newId = new CertIdentity(id, this);
+        auto *newId = new CertIdentity(id, this);
 #ifdef HAVE_SSL
         newId->enableEditSsl(_editSsl);
 #endif
@@ -417,7 +417,7 @@ SaveIdentitiesDlg::SaveIdentitiesDlg(const QList<CertIdentity *> &toCreate, cons
     : QDialog(parent)
 {
     ui.setupUi(this);
-    ui.abort->setIcon(QIcon::fromTheme("dialog-cancel"));
+    ui.abort->setIcon(icon::get("dialog-cancel"));
 
     numevents = toCreate.count() + toUpdate.count() + toRemove.count();
     rcvevents = 0;
@@ -464,15 +464,15 @@ void SaveIdentitiesDlg::clientEvent()
 
 /*************************************************************************************************/
 
-NickEditDlg::NickEditDlg(const QString &old, const QStringList &exist, QWidget *parent)
-    : QDialog(parent), oldNick(old), existing(exist)
+NickEditDlg::NickEditDlg(const QString &old, QStringList exist, QWidget *parent)
+    : QDialog(parent), oldNick(old), existing(std::move(exist))
 {
     ui.setupUi(this);
 
     // define a regexp for valid nicknames
     // TODO: add max nicklength according to ISUPPORT
     QString letter = "A-Za-z";
-    QString special = "\x5b-\x60\x7b-\x7d";
+    QString special = R"([-`{-})";
     QRegExp rx(QString("[%1%2][%1%2\\d-]*").arg(letter, special));
     ui.nickEdit->setValidator(new QRegExpValidator(rx, ui.nickEdit));
     if (old.isEmpty()) {