From 27090f0cfb60433e0e335b0ab819959e16bb703a Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 21 Nov 2017 16:07:48 +0800 Subject: [PATCH] Remove superfluous QString::fromUtf8() --- src/app/application.cpp | 6 +++--- src/gui/downloadfromurldlg.h | 4 ++-- src/gui/optionsdlg.cpp | 4 ++-- src/gui/properties/propertieswidget.cpp | 2 +- src/gui/speedlimitdlg.cpp | 4 ++-- src/gui/trackerlogin.cpp | 2 +- src/gui/transferlistwidget.cpp | 2 +- src/webui/prefjson.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index 9d397674a..3e53f5ff5 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -600,15 +600,15 @@ void Application::initializeTranslation() // Load translation QString localeStr = pref->getLocale(); - if (m_qtTranslator.load(QString::fromUtf8("qtbase_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) || - m_qtTranslator.load(QString::fromUtf8("qt_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + if (m_qtTranslator.load(QLatin1String("qtbase_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) || + m_qtTranslator.load(QLatin1String("qt_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) qDebug("Qt %s locale recognized, using translation.", qUtf8Printable(localeStr)); else qDebug("Qt %s locale unrecognized, using default (en).", qUtf8Printable(localeStr)); installTranslator(&m_qtTranslator); - if (m_translator.load(QString::fromUtf8(":/lang/qbittorrent_") + localeStr)) + if (m_translator.load(QLatin1String(":/lang/qbittorrent_") + localeStr)) qDebug("%s locale recognized, using translation.", qUtf8Printable(localeStr)); else qDebug("%s locale unrecognized, using default (en).", qUtf8Printable(localeStr)); diff --git a/src/gui/downloadfromurldlg.h b/src/gui/downloadfromurldlg.h index d6acd0e1c..9adbb7936 100644 --- a/src/gui/downloadfromurldlg.h +++ b/src/gui/downloadfromurldlg.h @@ -60,7 +60,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL // Paste clipboard if there is an URL in it QString clip_txt = qApp->clipboard()->text(); - QStringList clip_txt_list = clip_txt.split(QString::fromUtf8("\n")); + QStringList clip_txt_list = clip_txt.split(QLatin1Char('\n')); clip_txt.clear(); QStringList clip_txt_list_cleaned; foreach (clip_txt, clip_txt_list) { @@ -94,7 +94,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL void downloadButtonClicked() { QString urls = textUrls->toPlainText(); - QStringList url_list = urls.split(QString::fromUtf8("\n")); + QStringList url_list = urls.split(QLatin1Char('\n')); QString url; QStringList url_list_cleaned; foreach (url, url_list) { diff --git a/src/gui/optionsdlg.cpp b/src/gui/optionsdlg.cpp index 5b9d0158a..c4ca836c6 100644 --- a/src/gui/optionsdlg.cpp +++ b/src/gui/optionsdlg.cpp @@ -259,7 +259,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) connect(m_ui->autoRunBox, &QGroupBox::toggled, this, &ThisType::enableApplyButton); connect(m_ui->autoRun_txt, &FileSystemPathEdit::selectedPathChanged, this, &ThisType::enableApplyButton); - const QString autoRunStr = QString::fromUtf8("%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10\n%11") + const QString autoRunStr = QString("%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10\n%11") .arg(tr("Supported parameters (case sensitive):")) .arg(tr("%N: Torrent name")) .arg(tr("%L: Category")) @@ -489,7 +489,7 @@ void OptionsDialog::saveOptions() QString locale = getLocale(); if (pref->getLocale() != locale) { QTranslator *translator = new QTranslator; - if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) + if (translator->load(QLatin1String(":/lang/qbittorrent_") + locale)) qDebug("%s locale recognized, using translation.", qUtf8Printable(locale)); else qDebug("%s locale unrecognized, using default (en).", qUtf8Printable(locale)); diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index 16ed3be33..34042d5cd 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -799,7 +799,7 @@ void PropertiesWidget::askWebSeed() // Ask user for a new url seed const QString url_seed = AutoExpandableDialog::getText(this, tr("New URL seed", "New HTTP source"), tr("New URL seed:"), QLineEdit::Normal, - QString::fromUtf8("http://www."), &ok); + QLatin1String("http://www."), &ok); if (!ok) return; qDebug("Adding %s web seed", qUtf8Printable(url_seed)); if (!m_ui->listWebSeeds->findItems(url_seed, Qt::MatchFixedString).empty()) { diff --git a/src/gui/speedlimitdlg.cpp b/src/gui/speedlimitdlg.cpp index a26e8399d..723f68ecd 100644 --- a/src/gui/speedlimitdlg.cpp +++ b/src/gui/speedlimitdlg.cpp @@ -74,7 +74,7 @@ void SpeedLimitDialog::updateSpinValue(int val) const if (val <= 0) { m_ui->spinBandwidth->setValue(0); m_ui->spinBandwidth->setSpecialValueText(QString::fromUtf8(C_INFINITY)); - m_ui->spinBandwidth->setSuffix(QString::fromUtf8("")); + m_ui->spinBandwidth->setSuffix(""); } else { m_ui->spinBandwidth->setValue(val); @@ -87,7 +87,7 @@ void SpeedLimitDialog::updateSliderValue(int val) const if (val <= 0) { m_ui->spinBandwidth->setValue(0); m_ui->spinBandwidth->setSpecialValueText(QString::fromUtf8(C_INFINITY)); - m_ui->spinBandwidth->setSuffix(QString::fromUtf8("")); + m_ui->spinBandwidth->setSuffix(""); } if (val > m_ui->bandwidthSlider->maximum()) m_ui->bandwidthSlider->setMaximum(val); diff --git a/src/gui/trackerlogin.cpp b/src/gui/trackerlogin.cpp index e2d425221..7d25a93e8 100644 --- a/src/gui/trackerlogin.cpp +++ b/src/gui/trackerlogin.cpp @@ -43,7 +43,7 @@ trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const tor buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Log in")); - login_logo->setPixmap(QPixmap(QString::fromUtf8(":/icons/qbt-theme/encrypted.png"))); + login_logo->setPixmap(QPixmap(QLatin1String(":/icons/qbt-theme/encrypted.png"))); tracker_url->setText(torrent->currentTracker()); diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index 34d9e75a0..380ffc636 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -844,7 +844,7 @@ void TransferListWidget::displayListMenu(const QPoint&) connect(&actionDelete, SIGNAL(triggered()), this, SLOT(softDeleteSelectedTorrents())); QAction actionPreview_file(GuiIconProvider::instance()->getIcon("view-preview"), tr("Preview file..."), 0); connect(&actionPreview_file, SIGNAL(triggered()), this, SLOT(previewSelectedTorrents())); - QAction actionSet_max_ratio(QIcon(QString::fromUtf8(":/icons/skin/ratio.png")), tr("Limit share ratio..."), 0); + QAction actionSet_max_ratio(QIcon(QLatin1String(":/icons/skin/ratio.png")), tr("Limit share ratio..."), 0); connect(&actionSet_max_ratio, SIGNAL(triggered()), this, SLOT(setMaxRatioSelectedTorrents())); QAction actionSet_upload_limit(GuiIconProvider::instance()->getIcon("kt-set-max-upload-speed"), tr("Limit upload rate..."), 0); connect(&actionSet_upload_limit, SIGNAL(triggered()), this, SLOT(setUpLimitSelectedTorrents())); diff --git a/src/webui/prefjson.cpp b/src/webui/prefjson.cpp index eb97d2bef..2fb41b849 100644 --- a/src/webui/prefjson.cpp +++ b/src/webui/prefjson.cpp @@ -394,7 +394,7 @@ void prefjson::setPreferences(const QString& json) QString locale = m["locale"].toString(); if (pref->getLocale() != locale) { QTranslator *translator = new QTranslator; - if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) { + if (translator->load(QLatin1String(":/lang/qbittorrent_") + locale)) { qDebug("%s locale recognized, using translation.", qUtf8Printable(locale)); }else{ qDebug("%s locale unrecognized, using default (en).", qUtf8Printable(locale));