From 84bec06a90ab415434c80163b05832daac2b7457 Mon Sep 17 00:00:00 2001 From: Silent Date: Tue, 2 Mar 2021 23:33:03 +0100 Subject: [PATCH] Use QString::number where applicable --- src/duckstation-qt/autoupdaterdialog.cpp | 2 +- src/duckstation-qt/cheatmanagerdialog.cpp | 4 ++-- src/duckstation-qt/gamepropertiesdialog.cpp | 2 +- src/duckstation-qt/memorycardeditordialog.cpp | 2 +- .../postprocessingshaderconfigwidget.cpp | 14 +++++++------- src/duckstation-qt/settingwidgetbinder.h | 10 +++++----- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/duckstation-qt/autoupdaterdialog.cpp b/src/duckstation-qt/autoupdaterdialog.cpp index c5bfe98b2..8dfd5e75b 100644 --- a/src/duckstation-qt/autoupdaterdialog.cpp +++ b/src/duckstation-qt/autoupdaterdialog.cpp @@ -544,7 +544,7 @@ bool AutoUpdaterDialog::doUpdate(const QString& zip_path, const QString& updater } QStringList arguments; - arguments << QStringLiteral("%1").arg(QCoreApplication::applicationPid()); + arguments << QString::number(QCoreApplication::applicationPid()); arguments << destination_path; arguments << zip_path; arguments << program_path; diff --git a/src/duckstation-qt/cheatmanagerdialog.cpp b/src/duckstation-qt/cheatmanagerdialog.cpp index 648ef3a49..515cdea80 100644 --- a/src/duckstation-qt/cheatmanagerdialog.cpp +++ b/src/duckstation-qt/cheatmanagerdialog.cpp @@ -48,9 +48,9 @@ static QString formatHexAndDecValue(u32 value, u8 size, bool is_signed) static QString formatValue(u32 value, bool is_signed) { if (is_signed) - return QStringLiteral("%1").arg(static_cast(value)); + return QString::number(static_cast(value)); else - return QStringLiteral("%1").arg(static_cast(value)); + return QString::number(static_cast(value)); } CheatManagerDialog::CheatManagerDialog(QWidget* parent) : QDialog(parent) diff --git a/src/duckstation-qt/gamepropertiesdialog.cpp b/src/duckstation-qt/gamepropertiesdialog.cpp index 02f88ea24..814028176 100644 --- a/src/duckstation-qt/gamepropertiesdialog.cpp +++ b/src/duckstation-qt/gamepropertiesdialog.cpp @@ -236,7 +236,7 @@ void GamePropertiesDialog::populateTracksInfo(const std::string& image_path) const CDImage::TrackMode mode = image->GetTrackMode(static_cast(track)); const int row = static_cast(track - 1u); m_ui.tracks->insertRow(row); - m_ui.tracks->setItem(row, 0, new QTableWidgetItem(QStringLiteral("%1").arg(track))); + m_ui.tracks->setItem(row, 0, new QTableWidgetItem(QString::number(track))); m_ui.tracks->setItem(row, 1, new QTableWidgetItem(track_mode_strings[static_cast(mode)])); m_ui.tracks->setItem(row, 2, new QTableWidgetItem(MSFTotString(position))); m_ui.tracks->setItem(row, 3, new QTableWidgetItem(MSFTotString(length))); diff --git a/src/duckstation-qt/memorycardeditordialog.cpp b/src/duckstation-qt/memorycardeditordialog.cpp index 0877c681a..6bcdf8046 100644 --- a/src/duckstation-qt/memorycardeditordialog.cpp +++ b/src/duckstation-qt/memorycardeditordialog.cpp @@ -207,7 +207,7 @@ void MemoryCardEditorDialog::updateCardTable(Card* card) card->table->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(fi.title))); card->table->setItem(row, 2, new QTableWidgetItem(QString::fromStdString(fi.filename))); - card->table->setItem(row, 3, new QTableWidgetItem(QStringLiteral("%1").arg(fi.num_blocks))); + card->table->setItem(row, 3, new QTableWidgetItem(QString::number(fi.num_blocks))); } } diff --git a/src/duckstation-qt/postprocessingshaderconfigwidget.cpp b/src/duckstation-qt/postprocessingshaderconfigwidget.cpp index d8909e62c..9a1fd5aa9 100644 --- a/src/duckstation-qt/postprocessingshaderconfigwidget.cpp +++ b/src/duckstation-qt/postprocessingshaderconfigwidget.cpp @@ -47,7 +47,7 @@ void PostProcessingShaderConfigWidget::createUi() QString label; if (option.vector_size <= 1) { - label = QStringLiteral("%1").arg(QString::fromStdString(option.ui_name)); + label = QString::fromStdString(option.ui_name); } else { @@ -66,7 +66,7 @@ void PostProcessingShaderConfigWidget::createUi() if (option.type == PostProcessingShader::Option::Type::Int) { - slider_label->setText(QStringLiteral("%1").arg(option.value[i].int_value)); + slider_label->setText(QString::number(option.value[i].int_value)); const int range = std::max(option.max_value[i].int_value - option.min_value[i].int_value, 1); const int step_value = @@ -81,20 +81,20 @@ void PostProcessingShaderConfigWidget::createUi() const int new_value = std::clamp(option.min_value[i].int_value + (value * option.step_value[i].int_value), option.min_value[i].int_value, option.max_value[i].int_value); option.value[i].int_value = new_value; - slider_label->setText(QStringLiteral("%1").arg(new_value)); + slider_label->setText(QString::number(new_value)); configChanged(); }); connect(this, &PostProcessingShaderConfigWidget::resettingtoDefaults, [&option, i, slider, slider_label, step_value]() { QSignalBlocker sb(slider); slider->setValue((option.default_value[i].int_value - option.min_value[i].int_value) / step_value); - slider_label->setText(QStringLiteral("%1").arg(option.default_value[i].int_value)); + slider_label->setText(QString::number(option.default_value[i].int_value)); option.value = option.default_value; }); } else { - slider_label->setText(QStringLiteral("%1").arg(option.value[i].float_value)); + slider_label->setText(QString::number(option.value[i].float_value)); const float range = std::max(option.max_value[i].float_value - option.min_value[i].float_value, 1.0f); const float step_value = @@ -111,7 +111,7 @@ void PostProcessingShaderConfigWidget::createUi() (static_cast(value) * option.step_value[i].float_value), option.min_value[i].float_value, option.max_value[i].float_value); option.value[i].float_value = new_value; - slider_label->setText(QStringLiteral("%1").arg(new_value)); + slider_label->setText(QString::number(new_value)); configChanged(); }); connect(this, &PostProcessingShaderConfigWidget::resettingtoDefaults, @@ -119,7 +119,7 @@ void PostProcessingShaderConfigWidget::createUi() QSignalBlocker sb(slider); slider->setValue(static_cast( (option.default_value[i].float_value - option.min_value[i].float_value) / step_value)); - slider_label->setText(QStringLiteral("%1").arg(option.default_value[i].float_value)); + slider_label->setText(QString::number(option.default_value[i].float_value)); option.value = option.default_value; }); } diff --git a/src/duckstation-qt/settingwidgetbinder.h b/src/duckstation-qt/settingwidgetbinder.h index 3b6811efc..876b15afa 100644 --- a/src/duckstation-qt/settingwidgetbinder.h +++ b/src/duckstation-qt/settingwidgetbinder.h @@ -44,10 +44,10 @@ struct SettingAccessor } static int getIntValue(const QLineEdit* widget) { return widget->text().toInt(); } - static void setIntValue(QLineEdit* widget, int value) { widget->setText(QStringLiteral("%1").arg(value)); } + static void setIntValue(QLineEdit* widget, int value) { widget->setText(QString::number(value)); } static float getFloatValue(const QLineEdit* widget) { return widget->text().toFloat(); } - static void setFloatValue(QLineEdit* widget, float value) { widget->setText(QStringLiteral("%1").arg(value)); } + static void setFloatValue(QLineEdit* widget, float value) { widget->setText(QString::number(value)); } static QString getStringValue(const QLineEdit* widget) { return widget->text(); } static void setStringValue(QLineEdit* widget, const QString& value) { widget->setText(value); } @@ -118,7 +118,7 @@ struct SettingAccessor static float getFloatValue(const QSlider* widget) { return static_cast(widget->value()); } static void setFloatValue(QSlider* widget, float value) { widget->setValue(static_cast(value)); } - static QString getStringValue(const QSlider* widget) { return QStringLiteral("%1").arg(widget->value()); } + static QString getStringValue(const QSlider* widget) { return QString::number(widget->value()); } static void setStringValue(QSlider* widget, const QString& value) { widget->setValue(value.toInt()); } template @@ -140,7 +140,7 @@ struct SettingAccessor static float getFloatValue(const QSpinBox* widget) { return static_cast(widget->value()); } static void setFloatValue(QSpinBox* widget, float value) { widget->setValue(static_cast(value)); } - static QString getStringValue(const QSpinBox* widget) { return QStringLiteral("%1").arg(widget->value()); } + static QString getStringValue(const QSpinBox* widget) { return QString::number(widget->value()); } static void setStringValue(QSpinBox* widget, const QString& value) { widget->setValue(value.toInt()); } template @@ -162,7 +162,7 @@ struct SettingAccessor static float getFloatValue(const QDoubleSpinBox* widget) { return static_cast(widget->value()); } static void setFloatValue(QDoubleSpinBox* widget, float value) { widget->setValue(static_cast(value)); } - static QString getStringValue(const QDoubleSpinBox* widget) { return QStringLiteral("%1").arg(widget->value()); } + static QString getStringValue(const QDoubleSpinBox* widget) { return QString::number(widget->value()); } static void setStringValue(QDoubleSpinBox* widget, const QString& value) { widget->setValue(value.toDouble()); } template