mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Remove most uses of StringFromFormat in favor of fmt
This commit is contained in:
@ -6,6 +6,8 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QHeaderView>
|
||||
@ -656,7 +658,7 @@ void CodeViewWidget::OnCopyFunction()
|
||||
for (u32 addr = start; addr != end; addr += 4)
|
||||
{
|
||||
const std::string disasm = PowerPC::debug_interface.Disassemble(addr);
|
||||
text += StringFromFormat("%08x: ", addr) + disasm + "\r\n";
|
||||
fmt::format_to(std::back_inserter(text), "{:08x}: {}\r\n", addr, disasm);
|
||||
}
|
||||
|
||||
QApplication::clipboard()->setText(QString::fromStdString(text));
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
@ -16,7 +18,6 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "Common/Event.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/Debugger_SymbolMap.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
@ -389,7 +390,7 @@ void CodeWidget::UpdateFunctionCalls(const Common::Symbol* symbol)
|
||||
if (call_symbol)
|
||||
{
|
||||
const QString name =
|
||||
QString::fromStdString(StringFromFormat("> %s (%08x)", call_symbol->name.c_str(), addr));
|
||||
QString::fromStdString(fmt::format("> {} ({:08x})", call_symbol->name, addr));
|
||||
|
||||
if (name.toUpper().indexOf(filter.toUpper()) == -1)
|
||||
continue;
|
||||
@ -413,8 +414,8 @@ void CodeWidget::UpdateFunctionCallers(const Common::Symbol* symbol)
|
||||
|
||||
if (caller_symbol)
|
||||
{
|
||||
const QString name = QString::fromStdString(
|
||||
StringFromFormat("< %s (%08x)", caller_symbol->name.c_str(), addr));
|
||||
const QString name =
|
||||
QString::fromStdString(fmt::format("< {} ({:08x})", caller_symbol->name, addr));
|
||||
|
||||
if (name.toUpper().indexOf(filter.toUpper()) == -1)
|
||||
continue;
|
||||
|
@ -9,8 +9,9 @@
|
||||
#include <QTextBrowser>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/PowerPC/PPCAnalyst.h"
|
||||
#include "UICommon/Disassembler.h"
|
||||
|
||||
@ -214,7 +215,7 @@ void JITWidget::Update()
|
||||
{
|
||||
m_host_asm_widget->setHtml(
|
||||
QStringLiteral("<pre>%1</pre>")
|
||||
.arg(QString::fromStdString(StringFromFormat("(non-code address: %08x)", m_address))));
|
||||
.arg(QString::fromStdString(fmt::format("(non-code address: {:08x})", m_address))));
|
||||
m_ppc_asm_widget->setHtml(QStringLiteral("<i>---</i>"));
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include <QPushButton>
|
||||
|
||||
#include <discord_rpc.h>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/HttpRequest.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
DiscordJoinRequestDialog::DiscordJoinRequestDialog(QWidget* parent, const std::string& id,
|
||||
const std::string& discord_tag,
|
||||
@ -27,8 +27,8 @@ DiscordJoinRequestDialog::DiscordJoinRequestDialog(QWidget* parent, const std::s
|
||||
|
||||
if (!avatar.empty())
|
||||
{
|
||||
const std::string avatar_endpoint = StringFromFormat(
|
||||
"https://cdn.discordapp.com/avatars/%s/%s.png", id.c_str(), avatar.c_str());
|
||||
const std::string avatar_endpoint =
|
||||
fmt::format("https://cdn.discordapp.com/avatars/{}/{}.png", id, avatar);
|
||||
|
||||
Common::HttpRequest request;
|
||||
Common::HttpRequest::Response response = request.Get(avatar_endpoint);
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QErrorMessage>
|
||||
@ -714,9 +716,9 @@ void GameList::OpenGCSaveFolder()
|
||||
{
|
||||
case ExpansionInterface::EXIDeviceType::MemoryCardFolder:
|
||||
{
|
||||
std::string path = StringFromFormat("%s/%s/%s", File::GetUserPath(D_GCUSER_IDX).c_str(),
|
||||
Config::GetDirectoryForRegion(game->GetRegion()),
|
||||
slot == Slot::A ? "Card A" : "Card B");
|
||||
std::string path = fmt::format("{}/{}/{}", File::GetUserPath(D_GCUSER_IDX),
|
||||
Config::GetDirectoryForRegion(game->GetRegion()),
|
||||
slot == Slot::A ? "Card A" : "Card B");
|
||||
|
||||
std::string override_path = Config::Get(Config::GetInfoForGCIPathOverride(slot));
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <cmath>
|
||||
#include <thread>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
@ -367,7 +369,7 @@ void HotkeyScheduler::Run()
|
||||
OSD::AddMessage("Internal Resolution: Native");
|
||||
break;
|
||||
default:
|
||||
OSD::AddMessage(StringFromFormat("Internal Resolution: %dx", g_Config.iEFBScale));
|
||||
OSD::AddMessage(fmt::format("Internal Resolution: {}x", g_Config.iEFBScale));
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -415,20 +417,19 @@ void HotkeyScheduler::Run()
|
||||
{
|
||||
const bool new_value = !Config::Get(Config::GFX_HACK_EFB_ACCESS_ENABLE);
|
||||
Config::SetCurrent(Config::GFX_HACK_EFB_ACCESS_ENABLE, new_value);
|
||||
OSD::AddMessage(
|
||||
StringFromFormat("%s EFB Access from CPU", new_value ? "Skip" : "Don't skip"));
|
||||
OSD::AddMessage(fmt::format("{} EFB Access from CPU", new_value ? "Skip" : "Don't skip"));
|
||||
}
|
||||
|
||||
if (IsHotkey(HK_TOGGLE_EFBCOPIES))
|
||||
{
|
||||
const bool new_value = !Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM);
|
||||
Config::SetCurrent(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM, new_value);
|
||||
OSD::AddMessage(StringFromFormat("Copy EFB: %s", new_value ? "to Texture" : "to RAM"));
|
||||
OSD::AddMessage(fmt::format("Copy EFB: {}", new_value ? "to Texture" : "to RAM"));
|
||||
}
|
||||
|
||||
auto ShowXFBCopies = []() {
|
||||
OSD::AddMessage(StringFromFormat(
|
||||
"Copy XFB: %s%s", Config::Get(Config::GFX_HACK_IMMEDIATE_XFB) ? " (Immediate)" : "",
|
||||
OSD::AddMessage(fmt::format(
|
||||
"Copy XFB: {}{}", Config::Get(Config::GFX_HACK_IMMEDIATE_XFB) ? " (Immediate)" : "",
|
||||
Config::Get(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM) ? "to Texture" : "to RAM"));
|
||||
};
|
||||
|
||||
@ -448,7 +449,7 @@ void HotkeyScheduler::Run()
|
||||
{
|
||||
const bool new_value = !Config::Get(Config::GFX_DISABLE_FOG);
|
||||
Config::SetCurrent(Config::GFX_DISABLE_FOG, new_value);
|
||||
OSD::AddMessage(StringFromFormat("Fog: %s", new_value ? "Enabled" : "Disabled"));
|
||||
OSD::AddMessage(fmt::format("Fog: {}", new_value ? "Enabled" : "Disabled"));
|
||||
}
|
||||
|
||||
if (IsHotkey(HK_TOGGLE_DUMPTEXTURES))
|
||||
@ -461,10 +462,9 @@ void HotkeyScheduler::Run()
|
||||
|
||||
auto ShowEmulationSpeed = []() {
|
||||
const float emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
|
||||
OSD::AddMessage(
|
||||
emulation_speed <= 0 ?
|
||||
"Speed Limit: Unlimited" :
|
||||
StringFromFormat("Speed Limit: %li%%", std::lround(emulation_speed * 100.f)));
|
||||
OSD::AddMessage(emulation_speed <= 0 ?
|
||||
"Speed Limit: Unlimited" :
|
||||
fmt::format("Speed Limit: {}%", std::lround(emulation_speed * 100.f)));
|
||||
};
|
||||
|
||||
if (IsHotkey(HK_DECREASE_EMULATION_SPEED))
|
||||
@ -569,7 +569,7 @@ void HotkeyScheduler::Run()
|
||||
{
|
||||
const bool new_value = !Config::Get(Config::FREE_LOOK_ENABLED);
|
||||
Config::SetCurrent(Config::FREE_LOOK_ENABLED, new_value);
|
||||
OSD::AddMessage(StringFromFormat("Free Look: %s", new_value ? "Enabled" : "Disabled"));
|
||||
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
|
||||
}
|
||||
|
||||
// Savestates
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QWindow>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <future>
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
@ -1346,8 +1348,8 @@ void MainWindow::SetStateSlot(int slot)
|
||||
Settings::Instance().SetStateSlot(slot);
|
||||
m_state_slot = slot;
|
||||
|
||||
Core::DisplayMessage(StringFromFormat("Selected slot %d - %s", m_state_slot,
|
||||
State::GetInfoStringOfSlot(m_state_slot, false).c_str()),
|
||||
Core::DisplayMessage(fmt::format("Selected slot {} - {}", m_state_slot,
|
||||
State::GetInfoStringOfSlot(m_state_slot, false)),
|
||||
2500);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
@ -14,8 +16,6 @@
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/NetPlayClient.h"
|
||||
#include "Core/NetPlayServer.h"
|
||||
|
||||
@ -134,8 +134,8 @@ void ChunkedProgressDialog::SetProgress(const int pid, const u64 progress)
|
||||
|
||||
m_status_labels[pid]->setText(tr("%1[%2]: %3/%4 MiB")
|
||||
.arg(player_name, QString::number(pid),
|
||||
QString::fromStdString(StringFromFormat("%.2f", acquired)),
|
||||
QString::fromStdString(StringFromFormat("%.2f", total))));
|
||||
QString::fromStdString(fmt::format("{:.2f}", acquired)),
|
||||
QString::fromStdString(fmt::format("{:.2f}", total))));
|
||||
m_progress_bars[pid]->setValue(prog);
|
||||
}
|
||||
|
||||
|
@ -3,14 +3,17 @@
|
||||
|
||||
#include "DolphinQt/Translation.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLocale>
|
||||
#include <QTranslator>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLocale>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IOFile.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
@ -275,15 +278,14 @@ static bool TryInstallTranslator(const QString& exact_language_code)
|
||||
std::string lang = qlang.toStdString();
|
||||
auto filename =
|
||||
#if defined _WIN32
|
||||
File::GetExeDirectory() + StringFromFormat("/Languages/%s.mo", lang.c_str())
|
||||
fmt::format("{}/Languages/{}.mo", File::GetExeDirectory(), lang)
|
||||
#elif defined __APPLE__
|
||||
File::GetBundleDirectory() +
|
||||
StringFromFormat("/Contents/Resources/%s.lproj/dolphin-emu.mo", lang.c_str())
|
||||
fmt::format("{}/Contents/Resources/{}.lproj/dolphin-emu.mo", File::GetBundleDirectory(),
|
||||
lang)
|
||||
#elif defined LINUX_LOCAL_DEV
|
||||
File::GetExeDirectory() +
|
||||
StringFromFormat("/../Source/Core/DolphinQt/%s/dolphin-emu.mo", lang.c_str())
|
||||
fmt::format("{}/../Source/Core/DolphinQt/{}/dolphin-emu.mo", File::GetExeDirectory(), lang)
|
||||
#else
|
||||
StringFromFormat(DATA_DIR "/../locale/%s/LC_MESSAGES/dolphin-emu.mo", lang.c_str())
|
||||
fmt::format("{}/../locale/{}/LC_MESSAGES/dolphin-emu.mo", DATA_DIR, lang)
|
||||
#endif
|
||||
;
|
||||
|
||||
|
Reference in New Issue
Block a user