1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Qt/logging: add format function for QString

This commit is contained in:
Megamouse 2023-06-12 03:45:37 +02:00
parent 6dcf63009e
commit a90858193e
37 changed files with 122 additions and 128 deletions

View File

@ -7,6 +7,12 @@
LOG_CHANNEL(cfg_log, "CFG"); LOG_CHANNEL(cfg_log, "CFG");
template <>
void fmt_class_string<cfg::node>::format(std::string& out, u64 arg)
{
out += get_object(arg).to_string();
}
namespace cfg namespace cfg
{ {
_base::_base(type _type) _base::_base(type _type)

View File

@ -736,7 +736,7 @@ u32 keyboard_pad_handler::GetKeyCode(const QString& keyName)
if (seq.count() == 1) if (seq.count() == 1)
key_code = seq[0]; key_code = seq[0];
else else
input_log.notice("GetKeyCode(%s): seq.count() = %d", sstr(keyName), seq.count()); input_log.notice("GetKeyCode(%s): seq.count() = %d", keyName, seq.count());
return key_code; return key_code;
} }

View File

@ -131,7 +131,7 @@ void pad_thread::Init()
input_log.notice("Reloaded empty pad config"); input_log.notice("Reloaded empty pad config");
} }
input_log.trace("Using pad config:\n%s", g_cfg_input.to_string()); input_log.trace("Using pad config:\n%s", g_cfg_input);
std::shared_ptr<keyboard_pad_handler> keyptr; std::shared_ptr<keyboard_pad_handler> keyptr;

View File

@ -81,8 +81,6 @@ static const bool s_init_locale = []()
return true; return true;
}(); }();
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
static semaphore<> s_qt_init; static semaphore<> s_qt_init;
static atomic_t<bool> s_headless = false; static atomic_t<bool> s_headless = false;
@ -402,17 +400,23 @@ QCoreApplication* create_application(int& argc, char* argv[])
return new gui_application(argc, argv); return new gui_application(argc, argv);
} }
template <>
void fmt_class_string<QString>::format(std::string& out, u64 arg)
{
out += get_object(arg).toStdString();
}
void log_q_debug(QtMsgType type, const QMessageLogContext& context, const QString& msg) void log_q_debug(QtMsgType type, const QMessageLogContext& context, const QString& msg)
{ {
Q_UNUSED(context) Q_UNUSED(context)
switch (type) switch (type)
{ {
case QtDebugMsg: q_debug.trace("%s", msg.toStdString()); break; case QtDebugMsg: q_debug.trace("%s", msg); break;
case QtInfoMsg: q_debug.notice("%s", msg.toStdString()); break; case QtInfoMsg: q_debug.notice("%s", msg); break;
case QtWarningMsg: q_debug.warning("%s", msg.toStdString()); break; case QtWarningMsg: q_debug.warning("%s", msg); break;
case QtCriticalMsg: q_debug.error("%s", msg.toStdString()); break; case QtCriticalMsg: q_debug.error("%s", msg); break;
case QtFatalMsg: q_debug.fatal("%s", msg.toStdString()); break; case QtFatalMsg: q_debug.fatal("%s", msg); break;
} }
} }
@ -1184,7 +1188,7 @@ int main(int argc, char** argv)
for (const auto& opt : parser.optionNames()) for (const auto& opt : parser.optionNames())
{ {
sys_log.notice("Option passed via command line: %s %s", opt.toStdString(), parser.value(opt).toStdString()); sys_log.notice("Option passed via command line: %s %s", opt, parser.value(opt));
} }
if (parser.isSet(arg_savestate)) if (parser.isSet(arg_savestate))
@ -1237,7 +1241,7 @@ int main(int argc, char** argv)
} }
else if (const QStringList args = parser.positionalArguments(); !args.isEmpty() && !is_updating && !parser.isSet(arg_installfw) && !parser.isSet(arg_installpkg)) else if (const QStringList args = parser.positionalArguments(); !args.isEmpty() && !is_updating && !parser.isSet(arg_installfw) && !parser.isSet(arg_installpkg))
{ {
std::string spath = sstr(::at32(args, 0)); const std::string spath = ::at32(args, 0).toStdString();
if (spath.starts_with(Emulator::vfs_boot_prefix)) if (spath.starts_with(Emulator::vfs_boot_prefix))
{ {
@ -1295,7 +1299,7 @@ int main(int argc, char** argv)
} }
// Postpone startup to main event loop // Postpone startup to main event loop
Emu.CallFromMainThread([path = spath.starts_with("%RPCS3_") ? spath : sstr(QFileInfo(::at32(args, 0)).absoluteFilePath()), rpcs3_argv = std::move(rpcs3_argv), config_path = std::move(config_path)]() mutable Emu.CallFromMainThread([path = spath.starts_with("%RPCS3_") ? spath : QFileInfo(::at32(args, 0)).absoluteFilePath().toStdString(), rpcs3_argv = std::move(rpcs3_argv), config_path = std::move(config_path)]() mutable
{ {
Emu.argv = std::move(rpcs3_argv); Emu.argv = std::move(rpcs3_argv);
Emu.SetForceBoot(true); Emu.SetForceBoot(true);

View File

@ -250,7 +250,7 @@ EmuCallbacks main_application::CreateCallbacks()
} }
else else
{ {
sys_log.error("get_image_info failed to read '%s'. Error='%s'", filename, reader.errorString().toStdString()); sys_log.error("get_image_info failed to read '%s'. Error='%s'", filename, reader.errorString());
} }
}); });
return success; return success;
@ -320,7 +320,7 @@ EmuCallbacks main_application::CreateCallbacks()
} }
else else
{ {
sys_log.error("get_scaled_image failed to read '%s'. Error='%s'", path, reader.errorString().toStdString()); sys_log.error("get_scaled_image failed to read '%s'. Error='%s'", path, reader.errorString());
} }
}); });
return success; return success;

View File

@ -13,9 +13,6 @@
LOG_CHANNEL(gui_log, "GUI"); LOG_CHANNEL(gui_log, "GUI");
constexpr auto qstr = QString::fromStdString;
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
cg_disasm_window::cg_disasm_window(std::shared_ptr<gui_settings> gui_settings) cg_disasm_window::cg_disasm_window(std::shared_ptr<gui_settings> gui_settings)
: m_gui_settings(std::move(gui_settings)) : m_gui_settings(std::move(gui_settings))
{ {
@ -111,15 +108,15 @@ void cg_disasm_window::ShowDisasm() const
{ {
if (QFileInfo(m_path_last).isFile()) if (QFileInfo(m_path_last).isFile())
{ {
CgBinaryDisasm disasm(sstr(m_path_last)); CgBinaryDisasm disasm(m_path_last.toStdString());
disasm.BuildShaderBody(); disasm.BuildShaderBody();
m_disasm_text->setText(qstr(disasm.GetArbShader())); m_disasm_text->setText(QString::fromStdString(disasm.GetArbShader()));
m_glsl_text->setText(qstr(disasm.GetGlslShader())); m_glsl_text->setText(QString::fromStdString(disasm.GetGlslShader()));
m_gui_settings->SetValue(gui::fd_cg_disasm, m_path_last); m_gui_settings->SetValue(gui::fd_cg_disasm, m_path_last);
} }
else if (!m_path_last.isEmpty()) else if (!m_path_last.isEmpty())
{ {
gui_log.error("CgDisasm: Failed to open %s", sstr(m_path_last)); gui_log.error("CgDisasm: Failed to open %s", m_path_last);
} }
} }

View File

@ -84,7 +84,7 @@ bool config_checker::check_config(QString content, QString& result, bool is_log)
if (!config.from_string(content.toStdString())) if (!config.from_string(content.toStdString()))
{ {
gui_log.error("log_viewer: Failed to parse config:\n%s", content.toStdString()); gui_log.error("log_viewer: Failed to parse config:\n%s", content);
result = tr("Cannot find any config!"); result = tr("Cannot find any config!");
return false; return false;
} }

View File

@ -325,7 +325,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type,
const QVariantList var_list = combobox->itemData(i).toList(); const QVariantList var_list = combobox->itemData(i).toList();
if (var_list.size() != 2 || !var_list[0].canConvert<QString>()) if (var_list.size() != 2 || !var_list[0].canConvert<QString>())
{ {
fmt::throw_exception("Invalid data found in combobox entry %d (text='%s', listsize=%d, itemcount=%d)", i, sstr(combobox->itemText(i)), var_list.size(), combobox->count()); fmt::throw_exception("Invalid data found in combobox entry %d (text='%s', listsize=%d, itemcount=%d)", i, combobox->itemText(i), var_list.size(), combobox->count());
} }
if (value == var_list[0].toString()) if (value == var_list[0].toString())
@ -381,7 +381,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type,
const QVariantList var_list = combobox->itemData(index).toList(); const QVariantList var_list = combobox->itemData(index).toList();
if (var_list.size() != 2 || !var_list[0].canConvert<QString>()) if (var_list.size() != 2 || !var_list[0].canConvert<QString>())
{ {
fmt::throw_exception("Invalid data found in combobox entry %d (text='%s', listsize=%d, itemcount=%d)", index, sstr(combobox->itemText(index)), var_list.size(), combobox->count()); fmt::throw_exception("Invalid data found in combobox entry %d (text='%s', listsize=%d, itemcount=%d)", index, combobox->itemText(index), var_list.size(), combobox->count());
} }
SetSetting(type, sstr(var_list[0])); SetSetting(type, sstr(var_list[0]));
} }
@ -531,8 +531,7 @@ void emu_settings::EnhanceDateTimeEdit(QDateTimeEdit* date_time_edit, emu_settin
if (!val.isValid() || val < min || val > max) if (!val.isValid() || val < min || val > max)
{ {
cfg_log.error("EnhanceDateTimeEdit '%s' tried to set an invalid value: %s. Setting to default: %s Allowed range: [%s, %s]", cfg_log.error("EnhanceDateTimeEdit '%s' tried to set an invalid value: %s. Setting to default: %s Allowed range: [%s, %s]",
cfg_adapter::get_setting_name(type), val.toString(Qt::ISODate).toStdString(), def.toString(Qt::ISODate).toStdString(), cfg_adapter::get_setting_name(type), val.toString(Qt::ISODate), def.toString(Qt::ISODate), min.toString(Qt::ISODate), max.toString(Qt::ISODate));
min.toString(Qt::ISODate).toStdString(), max.toString(Qt::ISODate).toStdString());
val = def; val = def;
m_broken_types.insert(type); m_broken_types.insert(type);
SetSetting(type, sstr(def.toString(Qt::ISODate))); SetSetting(type, sstr(def.toString(Qt::ISODate)));
@ -795,7 +794,7 @@ void emu_settings::EnhanceRadioButton(QButtonGroup* button_group, emu_settings_t
{ {
ensure(def_pos >= 0); ensure(def_pos >= 0);
cfg_log.error("EnhanceRadioButton '%s' tried to set an invalid value: %s. Setting to default: %s.", cfg_adapter::get_setting_name(type), sstr(selected), sstr(def)); cfg_log.error("EnhanceRadioButton '%s' tried to set an invalid value: %s. Setting to default: %s.", cfg_adapter::get_setting_name(type), selected, def);
m_broken_types.insert(type); m_broken_types.insert(type);
// Select the default option on invalid setting string // Select the default option on invalid setting string
@ -1299,7 +1298,7 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_
type_string += loc; type_string += loc;
} }
} }
fmt::throw_exception("Missing translation for emu setting (original=%s, type='%s'=%d, index=%d)", original.toStdString(), type_string.empty() ? "?" : type_string, static_cast<int>(type), index); fmt::throw_exception("Missing translation for emu setting (original=%s, type='%s'=%d, index=%d)", original, type_string.empty() ? "?" : type_string, static_cast<int>(type), index);
} }
return original; return original;

View File

@ -14,7 +14,6 @@
LOG_CHANNEL(compat_log, "Compat"); LOG_CHANNEL(compat_log, "Compat");
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
game_compatibility::game_compatibility(std::shared_ptr<gui_settings> gui_settings, QWidget* parent) game_compatibility::game_compatibility(std::shared_ptr<gui_settings> gui_settings, QWidget* parent)
: QObject(parent) : QObject(parent)
@ -46,19 +45,19 @@ void game_compatibility::handle_download_finished(const QByteArray& content)
if (file.exists()) if (file.exists())
{ {
compat_log.notice("Database file found: %s", sstr(m_filepath)); compat_log.notice("Database file found: %s", m_filepath);
} }
if (!file.open(QIODevice::WriteOnly)) if (!file.open(QIODevice::WriteOnly))
{ {
compat_log.error("Database Error - Could not write database to file: %s", sstr(m_filepath)); compat_log.error("Database Error - Could not write database to file: %s", m_filepath);
return; return;
} }
file.write(content); file.write(content);
file.close(); file.close();
compat_log.success("Wrote database to file: %s", sstr(m_filepath)); compat_log.success("Wrote database to file: %s", m_filepath);
} }
// We have a new database in map, therefore refresh gamelist to new state // We have a new database in map, therefore refresh gamelist to new state
@ -116,7 +115,7 @@ bool game_compatibility::ReadJSON(const QJsonObject& json_data, bool after_downl
{ {
if (!json_results[key].isObject()) if (!json_results[key].isObject())
{ {
compat_log.error("Database Error - Unusable object %s", sstr(key)); compat_log.error("Database Error - Unusable object %s", key);
continue; continue;
} }
@ -187,7 +186,7 @@ bool game_compatibility::ReadJSON(const QJsonObject& json_data, bool after_downl
} }
// Add status to map // Add status to map
m_compat_database.emplace(std::pair<std::string, compat::status>(sstr(key), status)); m_compat_database.emplace(std::pair<std::string, compat::status>(key.toStdString(), status));
} }
return true; return true;
@ -202,20 +201,20 @@ void game_compatibility::RequestCompatibility(bool online)
if (!file.exists()) if (!file.exists())
{ {
compat_log.notice("Database file not found: %s", sstr(m_filepath)); compat_log.notice("Database file not found: %s", m_filepath);
return; return;
} }
if (!file.open(QIODevice::ReadOnly)) if (!file.open(QIODevice::ReadOnly))
{ {
compat_log.error("Database Error - Could not read database from file: %s", sstr(m_filepath)); compat_log.error("Database Error - Could not read database from file: %s", m_filepath);
return; return;
} }
const QByteArray content = file.readAll(); const QByteArray content = file.readAll();
file.close(); file.close();
compat_log.notice("Finished reading database from file: %s", sstr(m_filepath)); compat_log.notice("Finished reading database from file: %s", m_filepath);
// Create new map from database // Create new map from database
ReadJSON(QJsonDocument::fromJson(content).object(), online); ReadJSON(QJsonDocument::fromJson(content).object(), online);
@ -312,13 +311,13 @@ compat::package_info game_compatibility::GetPkgInfo(const QString& pkg_path, gam
if (compat) if (compat)
{ {
compat::status stat = compat->GetCompatibility(sstr(info.title_id)); compat::status stat = compat->GetCompatibility(info.title_id.toStdString());
if (!stat.patch_sets.empty()) if (!stat.patch_sets.empty())
{ {
// We currently only handle the first patch set // We currently only handle the first patch set
for (const auto& package : stat.patch_sets.front().packages) for (const auto& package : stat.patch_sets.front().packages)
{ {
if (sstr(info.version) == package.version) if (info.version.toStdString() == package.version)
{ {
if (const std::string localized_title = package.get_title(title_key); !localized_title.empty()) if (const std::string localized_title = package.get_title(title_key); !localized_title.empty())
{ {

View File

@ -60,7 +60,7 @@ void game_list_base::IconLoadFunction(game_info game, qreal device_pixel_ratio,
if (!logged) if (!logged)
{ {
game_list_log.warning("Could not load image from path %s", QDir(QString::fromStdString(game->info.icon_path)).absolutePath().toStdString()); game_list_log.warning("Could not load image from path %s", QDir(QString::fromStdString(game->info.icon_path)).absolutePath());
} }
} }
} }

View File

@ -877,7 +877,7 @@ void game_list_frame::CreateShortcuts(const game_info& gameinfo, const std::set<
{ {
if (locations.empty()) if (locations.empty())
{ {
game_list_log.error("Failed to create shortcuts for %s. No locations selected.", sstr(qstr(gameinfo->info.name).simplified())); game_list_log.error("Failed to create shortcuts for %s. No locations selected.", qstr(gameinfo->info.name).simplified());
return; return;
} }
@ -927,7 +927,7 @@ void game_list_frame::CreateShortcuts(const game_info& gameinfo, const std::set<
if (!fs::create_path(target_icon_dir)) if (!fs::create_path(target_icon_dir))
{ {
game_list_log.error("Failed to create shortcut path %s (%s)", sstr(qstr(gameinfo->info.name).simplified()), target_icon_dir, fs::g_tls_error); game_list_log.error("Failed to create shortcut path %s (%s)", qstr(gameinfo->info.name).simplified(), target_icon_dir, fs::g_tls_error);
return; return;
} }
@ -954,11 +954,11 @@ void game_list_frame::CreateShortcuts(const game_info& gameinfo, const std::set<
if (!gameid_token_value.empty() && gui::utils::create_shortcut(gameinfo->info.name, target_cli_args, gameinfo->info.name, gameinfo->info.icon_path, target_icon_dir, location)) if (!gameid_token_value.empty() && gui::utils::create_shortcut(gameinfo->info.name, target_cli_args, gameinfo->info.name, gameinfo->info.icon_path, target_icon_dir, location))
{ {
game_list_log.success("Created %s shortcut for %s", destination, sstr(qstr(gameinfo->info.name).simplified())); game_list_log.success("Created %s shortcut for %s", destination, qstr(gameinfo->info.name).simplified());
} }
else else
{ {
game_list_log.error("Failed to create %s shortcut for %s", destination, sstr(qstr(gameinfo->info.name).simplified())); game_list_log.error("Failed to create %s shortcut for %s", destination, qstr(gameinfo->info.name).simplified());
success = false; success = false;
} }
} }
@ -1281,12 +1281,12 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
{ {
if (QFile file(game_icon_path); file.exists() && !file.remove()) if (QFile file(game_icon_path); file.exists() && !file.remove())
{ {
game_list_log.error("Could not remove old file: '%s'", sstr(game_icon_path), sstr(file.errorString())); game_list_log.error("Could not remove old file: '%s'", game_icon_path, file.errorString());
QMessageBox::warning(this, tr("Warning!"), tr("Failed to remove the old file!")); QMessageBox::warning(this, tr("Warning!"), tr("Failed to remove the old file!"));
return; return;
} }
game_list_log.success("Removed file: '%s'", sstr(game_icon_path)); game_list_log.success("Removed file: '%s'", game_icon_path);
if (action == icon_action::remove) if (action == icon_action::remove)
{ {
refresh = true; refresh = true;
@ -1297,12 +1297,12 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
{ {
if (!QFile::copy(icon_path, game_icon_path)) if (!QFile::copy(icon_path, game_icon_path))
{ {
game_list_log.error("Could not import file '%s' to '%s'.", sstr(icon_path), sstr(game_icon_path)); game_list_log.error("Could not import file '%s' to '%s'.", icon_path, game_icon_path);
QMessageBox::warning(this, tr("Warning!"), tr("Failed to import the new file!")); QMessageBox::warning(this, tr("Warning!"), tr("Failed to import the new file!"));
} }
else else
{ {
game_list_log.success("Imported file '%s' to '%s'", sstr(icon_path), sstr(game_icon_path)); game_list_log.success("Imported file '%s' to '%s'", icon_path, game_icon_path);
refresh = true; refresh = true;
} }
} }
@ -1437,12 +1437,12 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
RemoveCustomPadConfiguration(current_game.serial); RemoveCustomPadConfiguration(current_game.serial);
} }
m_game_data.erase(std::remove(m_game_data.begin(), m_game_data.end(), gameinfo), m_game_data.end()); m_game_data.erase(std::remove(m_game_data.begin(), m_game_data.end(), gameinfo), m_game_data.end());
game_list_log.success("Removed %s %s in %s", sstr(gameinfo->localized_category), current_game.name, current_game.path); game_list_log.success("Removed %s %s in %s", gameinfo->localized_category, current_game.name, current_game.path);
Refresh(true); Refresh(true);
} }
else else
{ {
game_list_log.error("Failed to remove %s %s in %s (%s)", sstr(gameinfo->localized_category), current_game.name, current_game.path, fs::g_tls_error); game_list_log.error("Failed to remove %s %s in %s (%s)", gameinfo->localized_category, current_game.name, current_game.path, fs::g_tls_error);
QMessageBox::critical(this, tr("Failure!"), remove_caches QMessageBox::critical(this, tr("Failure!"), remove_caches
? tr("Failed to remove %0 from drive!\nPath: %1\nCaches and custom configs have been left intact.").arg(name).arg(qstr(current_game.path)) ? tr("Failed to remove %0 from drive!\nPath: %1\nCaches and custom configs have been left intact.").arg(name).arg(qstr(current_game.path))
: tr("Failed to remove %0 from drive!\nPath: %1").arg(name).arg(qstr(current_game.path))); : tr("Failed to remove %0 from drive!\nPath: %1").arg(name).arg(qstr(current_game.path)));
@ -1682,11 +1682,11 @@ bool game_list_frame::RemoveShadersCache(const std::string& base_dir, bool is_in
if (QDir(filepath).removeRecursively()) if (QDir(filepath).removeRecursively())
{ {
++caches_removed; ++caches_removed;
game_list_log.notice("Removed shaders cache dir: %s", sstr(filepath)); game_list_log.notice("Removed shaders cache dir: %s", filepath);
} }
else else
{ {
game_list_log.warning("Could not completely remove shaders cache dir: %s", sstr(filepath)); game_list_log.warning("Could not completely remove shaders cache dir: %s", filepath);
} }
++caches_total; ++caches_total;
@ -1733,11 +1733,11 @@ bool game_list_frame::RemovePPUCache(const std::string& base_dir, bool is_intera
if (QFile::remove(filepath)) if (QFile::remove(filepath))
{ {
++files_removed; ++files_removed;
game_list_log.notice("Removed PPU cache file: %s", sstr(filepath)); game_list_log.notice("Removed PPU cache file: %s", filepath);
} }
else else
{ {
game_list_log.warning("Could not remove PPU cache file: %s", sstr(filepath)); game_list_log.warning("Could not remove PPU cache file: %s", filepath);
} }
++files_total; ++files_total;
@ -1784,11 +1784,11 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera
if (QFile::remove(filepath)) if (QFile::remove(filepath))
{ {
++files_removed; ++files_removed;
game_list_log.notice("Removed SPU cache file: %s", sstr(filepath)); game_list_log.notice("Removed SPU cache file: %s", filepath);
} }
else else
{ {
game_list_log.warning("Could not remove SPU cache file: %s", sstr(filepath)); game_list_log.warning("Could not remove SPU cache file: %s", filepath);
} }
++files_total; ++files_total;

View File

@ -299,7 +299,7 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
void gs_frame::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKeySequence& key_sequence) void gs_frame::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKeySequence& key_sequence)
{ {
gui_log.notice("Game window registered shortcut: %s (%s)", shortcut_key, key_sequence.toString().toStdString()); gui_log.notice("Game window registered shortcut: %s (%s)", shortcut_key, key_sequence.toString());
switch (shortcut_key) switch (shortcut_key)
{ {

View File

@ -185,7 +185,7 @@ void gui_application::SwitchTranslator(QTranslator& translator, const QString& f
else if (const QString default_code = QLocale(QLocale::English).bcp47Name(); language_code != default_code) else if (const QString default_code = QLocale(QLocale::English).bcp47Name(); language_code != default_code)
{ {
// show error, but ignore default case "en", since it is handled in source code // show error, but ignore default case "en", since it is handled in source code
gui_log.error("No translation file found in: %s", file_path.toStdString()); gui_log.error("No translation file found in: %s", file_path);
// reset current language to default "en" // reset current language to default "en"
m_language_code = default_code; m_language_code = default_code;
@ -227,7 +227,7 @@ void gui_application::LoadLanguage(const QString& language_code)
m_gui_settings->SetValue(gui::loc_language, m_language_code); m_gui_settings->SetValue(gui::loc_language, m_language_code);
gui_log.notice("Current language changed to %s (%s)", locale_name.toStdString(), language_code.toStdString()); gui_log.notice("Current language changed to %s (%s)", locale_name, language_code);
} }
QStringList gui_application::GetAvailableLanguageCodes() QStringList gui_application::GetAvailableLanguageCodes()
@ -249,7 +249,7 @@ QStringList gui_application::GetAvailableLanguageCodes()
if (language_codes.contains(language_code)) if (language_codes.contains(language_code))
{ {
gui_log.error("Found duplicate language '%s' (%s)", language_code.toStdString(), filename.toStdString()); gui_log.error("Found duplicate language '%s' (%s)", language_code, filename);
} }
else else
{ {
@ -715,7 +715,7 @@ void gui_application::OnChangeStyleSheetRequest()
} }
else else
{ {
gui_log.error("Could not find stylesheet '%s'. Using default.", stylesheet_name.toStdString()); gui_log.error("Could not find stylesheet '%s'. Using default.", stylesheet_name);
setStyleSheet(gui::stylesheets::default_style_sheet); setStyleSheet(gui::stylesheets::default_style_sheet);
} }
} }

View File

@ -143,7 +143,7 @@ void gui_settings::ShowBox(QMessageBox::Icon icon, const QString& title, const Q
if (has_gui_setting && !GetValue(entry).toBool()) if (has_gui_setting && !GetValue(entry).toBool())
{ {
cfg_log.notice("%s Dialog for Entry %s was ignored", dialog_type, entry.name.toStdString()); cfg_log.notice("%s Dialog for Entry %s was ignored", dialog_type, entry.name);
return; return;
} }
@ -169,7 +169,7 @@ void gui_settings::ShowBox(QMessageBox::Icon icon, const QString& title, const Q
if (checkBox && checkBox->isChecked()) if (checkBox && checkBox->isChecked())
{ {
SetValue(entry, false); SetValue(entry, false);
cfg_log.notice("%s Dialog for Entry %s is now disabled", dialog_type, entry.name.toStdString()); cfg_log.notice("%s Dialog for Entry %s is now disabled", dialog_type, entry.name);
} }
}); });

View File

@ -545,7 +545,7 @@ figure_creator_dialog::figure_creator_dialog(QWidget* parent, u8 slot)
bool figure_creator_dialog::create_blank_figure(u32 character, u8 series) bool figure_creator_dialog::create_blank_figure(u32 character, u8 series)
{ {
infinity_log.trace("File path: %s Character: %d Series: %d", m_file_path.toStdString(), character, series); infinity_log.trace("File path: %s Character: %d Series: %d", m_file_path, character, series);
fs::file inf_file(m_file_path.toStdString(), fs::read + fs::write + fs::create); fs::file inf_file(m_file_path.toStdString(), fs::read + fs::write + fs::create);
if (!inf_file) if (!inf_file)
{ {

View File

@ -129,7 +129,7 @@ static QTreeWidgetItem* find_node(QTreeWidgetItem* root, u32 id)
} }
} }
sys_log.fatal("find_node(root=%s, id=%d) failed", root ? root->text(0).toStdString() : "?", id); sys_log.fatal("find_node(root=%s, id=%d) failed", root ? root->text(0) : "?", id);
return nullptr; return nullptr;
} }
@ -146,7 +146,7 @@ static QTreeWidgetItem* add_volatile_node(QTreeWidgetItem* parent, const QString
} }
else else
{ {
sys_log.fatal("add_volatile_node(parent=%s, regexp=%s) failed", parent ? parent->text(0).toStdString() : "?", base_text.toStdString() + ".*"); sys_log.fatal("add_volatile_node(parent=%s, regexp=%s) failed", parent ? parent->text(0) : "?", base_text + ".*");
} }
return node; return node;
} }
@ -1010,7 +1010,7 @@ void kernel_explorer::log(u32 level, QTreeWidgetItem* item)
m_log_buf = qstr(fmt::format("Kernel Explorer: %s\n", Emu.GetTitleAndTitleID())); m_log_buf = qstr(fmt::format("Kernel Explorer: %s\n", Emu.GetTitleAndTitleID()));
log(level + 1, item); log(level + 1, item);
sys_log.success("%s", m_log_buf.toStdString()); sys_log.success("%s", m_log_buf);
return; return;
} }

View File

@ -162,11 +162,11 @@ void log_viewer::show_context_menu(const QPoint& pos)
{ {
log_file.write(m_log_text->toPlainText().toUtf8()); log_file.write(m_log_text->toPlainText().toUtf8());
log_file.close(); log_file.close();
gui_log.success("Exported filtered log to file '%s'", file_path.toStdString()); gui_log.success("Exported filtered log to file '%s'", file_path);
} }
else else
{ {
gui_log.error("Failed to export filtered log to file '%s'", file_path.toStdString()); gui_log.error("Failed to export filtered log to file '%s'", file_path);
} }
}); });
@ -242,7 +242,7 @@ void log_viewer::show_log()
} }
else else
{ {
gui_log.error("log_viewer: Failed to open %s", m_path_last.toStdString()); gui_log.error("log_viewer: Failed to open %s", m_path_last);
m_log_text->setPlainText(tr("Failed to open '%0'").arg(m_path_last)); m_log_text->setPlainText(tr("Failed to open '%0'").arg(m_path_last));
} }

View File

@ -312,7 +312,7 @@ void main_window::ResizeIcons(int index)
void main_window::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKeySequence& key_sequence) void main_window::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKeySequence& key_sequence)
{ {
gui_log.notice("Main window registered shortcut: %s (%s)", shortcut_key, key_sequence.toString().toStdString()); gui_log.notice("Main window registered shortcut: %s (%s)", shortcut_key, key_sequence.toString());
const system_state status = Emu.GetStatus(); const system_state status = Emu.GetStatus();
@ -781,7 +781,7 @@ bool main_window::InstallPackages(QStringList file_paths, bool from_boot)
if (QMessageBox::question(this, tr("PKG Decrypter / Installer"), tr("Do you want to install this package?\n\n%0").arg(info_string), if (QMessageBox::question(this, tr("PKG Decrypter / Installer"), tr("Do you want to install this package?\n\n%0").arg(info_string),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
{ {
gui_log.notice("PKG: Cancelled installation from drop.\n%s", sstr(info_string)); gui_log.notice("PKG: Cancelled installation from drop.\n%s", info_string);
return true; return true;
} }
} }
@ -1006,25 +1006,25 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
{ {
case package_reader::result::success: case package_reader::result::success:
{ {
gui_log.success("Successfully installed %s (title_id=%s, title=%s, version=%s).", sstr(package.path), sstr(package.title_id), sstr(package.title), sstr(package.version)); gui_log.success("Successfully installed %s (title_id=%s, title=%s, version=%s).", package.path, package.title_id, package.title, package.version);
break; break;
} }
case package_reader::result::not_started: case package_reader::result::not_started:
case package_reader::result::started: case package_reader::result::started:
case package_reader::result::aborted: case package_reader::result::aborted:
{ {
gui_log.notice("Aborted installation of %s (title_id=%s, title=%s, version=%s).", sstr(package.path), sstr(package.title_id), sstr(package.title), sstr(package.version)); gui_log.notice("Aborted installation of %s (title_id=%s, title=%s, version=%s).", package.path, package.title_id, package.title, package.version);
break; break;
} }
case package_reader::result::error: case package_reader::result::error:
{ {
gui_log.error("Failed to install %s (title_id=%s, title=%s, version=%s).", sstr(package.path), sstr(package.title_id), sstr(package.title), sstr(package.version)); gui_log.error("Failed to install %s (title_id=%s, title=%s, version=%s).", package.path, package.title_id, package.title, package.version);
break; break;
} }
case package_reader::result::aborted_dirty: case package_reader::result::aborted_dirty:
case package_reader::result::error_dirty: case package_reader::result::error_dirty:
{ {
gui_log.error("Partially installed %s (title_id=%s, title=%s, version=%s).", sstr(package.path), sstr(package.title_id), sstr(package.title), sstr(package.version)); gui_log.error("Partially installed %s (title_id=%s, title=%s, version=%s).", package.path, package.title_id, package.title, package.version);
break; break;
} }
} }
@ -1151,12 +1151,12 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
if (error == package_error::app_version) if (error == package_error::app_version)
{ {
gui_log.error("Cannot install %s.", sstr(package->path)); gui_log.error("Cannot install %s.", package->path);
QMessageBox::warning(this, tr("Warning!"), tr("The following package cannot be installed on top of the current data:\n%1!").arg(package->path)); QMessageBox::warning(this, tr("Warning!"), tr("The following package cannot be installed on top of the current data:\n%1!").arg(package->path));
} }
else else
{ {
gui_log.error("Failed to install %s.", sstr(package->path)); gui_log.error("Failed to install %s.", package->path);
QMessageBox::critical(this, tr("Failure!"), tr("Failed to install software from package:\n%1!" QMessageBox::critical(this, tr("Failure!"), tr("Failed to install software from package:\n%1!"
"\nThis is very likely caused by external interference from a faulty anti-virus software." "\nThis is very likely caused by external interference from a faulty anti-virus software."
"\nPlease add RPCS3 to your anti-virus\' whitelist or use better anti-virus software.").arg(package->path)); "\nPlease add RPCS3 to your anti-virus\' whitelist or use better anti-virus software.").arg(package->path));
@ -1198,7 +1198,7 @@ void main_window::InstallPup(QString file_path)
if (QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Install firmware: %1?").arg(file_path), if (QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Install firmware: %1?").arg(file_path),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
{ {
gui_log.notice("Firmware: Cancelled installation from drop. File: %s", sstr(file_path)); gui_log.notice("Firmware: Cancelled installation from drop. File: %s", file_path);
return; return;
} }
} }
@ -1391,7 +1391,7 @@ void main_window::HandlePupInstallation(const QString& file_path, const QString&
if (!vfs::mount("/pup_extract", sstr(dir_path) + '/')) if (!vfs::mount("/pup_extract", sstr(dir_path) + '/'))
{ {
gui_log.error("Error while extracting firmware: Failed to mount '%s'", sstr(dir_path)); gui_log.error("Error while extracting firmware: Failed to mount '%s'", dir_path);
critical(tr("Firmware extraction failed: VFS mounting failed.")); critical(tr("Firmware extraction failed: VFS mounting failed."));
return; return;
} }
@ -1402,7 +1402,7 @@ void main_window::HandlePupInstallation(const QString& file_path, const QString&
critical(tr("Firmware installation failed: Firmware contents could not be extracted.")); critical(tr("Firmware installation failed: Firmware contents could not be extracted."));
} }
gui_log.success("Extracted PUP file to %s", sstr(dir_path)); gui_log.success("Extracted PUP file to %s", dir_path);
return; return;
} }
@ -1597,7 +1597,7 @@ void main_window::DecryptSPRXLibraries()
if (repeat_count >= 2) if (repeat_count >= 2)
{ {
gui_log.error("Failed to decrypt %s with specified KLIC, retrying.\n%s", path, sstr(hint)); gui_log.error("Failed to decrypt %s with specified KLIC, retrying.\n%s", path, hint);
} }
input_dialog* dlg = new input_dialog(39, "", tr("Enter KLIC of %0").arg(qstr(filename)), input_dialog* dlg = new input_dialog(39, "", tr("Enter KLIC of %0").arg(qstr(filename)),
@ -3126,11 +3126,11 @@ void main_window::RemoveFirmwareCache()
if (QDir(path).removeRecursively()) if (QDir(path).removeRecursively())
{ {
++caches_removed; ++caches_removed;
gui_log.notice("Removed firmware cache: %s", sstr(path)); gui_log.notice("Removed firmware cache: %s", path);
} }
else else
{ {
gui_log.warning("Could not remove firmware cache: %s", sstr(path)); gui_log.warning("Could not remove firmware cache: %s", path);
} }
++caches_total; ++caches_total;
@ -3389,12 +3389,12 @@ void main_window::dropEvent(QDropEvent* event)
if (const auto error = Emu.BootGame(sstr(drop_paths.first()), "", true); error != game_boot_result::no_errors) if (const auto error = Emu.BootGame(sstr(drop_paths.first()), "", true); error != game_boot_result::no_errors)
{ {
gui_log.error("Boot failed: reason: %s, path: %s", error, sstr(drop_paths.first())); gui_log.error("Boot failed: reason: %s, path: %s", error, drop_paths.first());
show_boot_error(error); show_boot_error(error);
} }
else else
{ {
gui_log.success("Elf Boot from drag and drop done: %s", sstr(drop_paths.first())); gui_log.success("Elf Boot from drag and drop done: %s", drop_paths.first());
m_game_list_frame->Refresh(true); m_game_list_frame->Refresh(true);
} }
break; break;

View File

@ -119,8 +119,7 @@ u64 memory_viewer_panel::OnSearch(std::string wstr, u32 mode)
if (const usz pos = wstr.find_first_not_of(hex_chars); pos != umax) if (const usz pos = wstr.find_first_not_of(hex_chars); pos != umax)
{ {
gui_log.error("String '%s' cannot be interpreted as hexadecimal byte string due to unknown character '%c'.", gui_log.error("String '%s' cannot be interpreted as hexadecimal byte string due to unknown character '%c'.", m_search_line->text(), wstr[pos]);
m_search_line->text().toStdString(), wstr[pos]);
return 0; return 0;
} }

View File

@ -116,7 +116,7 @@ pad_motion_settings_dialog::pad_motion_settings_dialog(QDialog* parent, std::sha
std::lock_guard lock(m_config_mutex); std::lock_guard lock(m_config_mutex);
if (!m_config_entries[i]->axis.from_string(m_axis_names[i]->itemText(index).toStdString())) if (!m_config_entries[i]->axis.from_string(m_axis_names[i]->itemText(index).toStdString()))
{ {
cfg_log.error("Failed to convert motion axis string: %s", m_axis_names[i]->itemData(index).toString().toStdString()); cfg_log.error("Failed to convert motion axis string: %s", m_axis_names[i]->itemData(index).toString());
} }
}); });
} }

View File

@ -36,7 +36,7 @@ inline bool CreateConfigFile(const QString& dir, const QString& name)
{ {
if (!QDir().mkpath(dir)) if (!QDir().mkpath(dir))
{ {
cfg_log.fatal("Failed to create dir %s", sstr(dir)); cfg_log.fatal("Failed to create dir %s", dir);
return false; return false;
} }
@ -45,7 +45,7 @@ inline bool CreateConfigFile(const QString& dir, const QString& name)
if (!new_file.open(QIODevice::WriteOnly)) if (!new_file.open(QIODevice::WriteOnly))
{ {
cfg_log.fatal("Failed to create file %s", sstr(filename)); cfg_log.fatal("Failed to create file %s", filename);
return false; return false;
} }
@ -612,7 +612,7 @@ pad_device_info pad_settings_dialog::get_pad_info(QComboBox* combo, int index)
if (!user_data.canConvert<pad_device_info>()) if (!user_data.canConvert<pad_device_info>())
{ {
cfg_log.fatal("get_pad_info: Cannot convert itemData for index %d and itemText %s", index, sstr(combo->itemText(index))); cfg_log.fatal("get_pad_info: Cannot convert itemData for index %d and itemText %s", index, combo->itemText(index));
return {}; return {};
} }
@ -1570,7 +1570,7 @@ void pad_settings_dialog::ChangeDevice(int index)
if (!user_data.canConvert<pad_device_info>()) if (!user_data.canConvert<pad_device_info>())
{ {
cfg_log.fatal("ChangeDevice: Cannot convert itemData for index %d and itemText %s", index, sstr(ui->chooseDevice->itemText(index))); cfg_log.fatal("ChangeDevice: Cannot convert itemData for index %d and itemText %s", index, ui->chooseDevice->itemText(index));
return; return;
} }

View File

@ -14,7 +14,6 @@
LOG_CHANNEL(patch_log, "PAT"); LOG_CHANNEL(patch_log, "PAT");
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
Q_DECLARE_METATYPE(patch_type) Q_DECLARE_METATYPE(patch_type)
@ -215,7 +214,7 @@ void patch_creator_dialog::add_instruction(int row)
ui->instructionTable->setItem(row, patch_column::value, new QTableWidgetItem(value)); ui->instructionTable->setItem(row, patch_column::value, new QTableWidgetItem(value));
ui->instructionTable->setItem(row, patch_column::comment, new QTableWidgetItem(comment)); ui->instructionTable->setItem(row, patch_column::comment, new QTableWidgetItem(comment));
patch_log.notice("Patch Creator: Inserted instruction [ %s, %s, %s ] at row %d", sstr(combo_box->currentText()), sstr(offset), sstr(value), row); patch_log.notice("Patch Creator: Inserted instruction [ %s, %s, %s ] at row %d", combo_box->currentText(), offset, value, row);
generate_yml(); generate_yml();
} }
@ -377,11 +376,11 @@ void patch_creator_dialog::export_patch()
{ {
patch_file.write(ui->patchEdit->toPlainText().toUtf8()); patch_file.write(ui->patchEdit->toPlainText().toUtf8());
patch_file.close(); patch_file.close();
patch_log.success("Exported patch to file '%s'", sstr(file_path)); patch_log.success("Exported patch to file '%s'", file_path);
} }
else else
{ {
patch_log.fatal("Failed to export patch to file '%s'", sstr(file_path)); patch_log.fatal("Failed to export patch to file '%s'", file_path);
} }
} }

View File

@ -54,6 +54,6 @@ QString persistent_settings::GetCurrentUser(const QString& fallback) const
return user; return user;
} }
cfg_log.fatal("Could not parse user setting: '%s'.", user.toStdString()); cfg_log.fatal("Could not parse user setting: '%s'.", user);
return QString(); return QString();
} }

View File

@ -76,5 +76,5 @@ void qt_camera_error_handler::handle_capture_modes(QCamera::CaptureModes capture
void qt_camera_error_handler::handle_camera_error(QCamera::Error error) void qt_camera_error_handler::handle_camera_error(QCamera::Error error)
{ {
camera_log.error("Error event: \"%s\" (error=%d)", m_camera ? m_camera->errorString().toStdString() : "", static_cast<int>(error)); camera_log.error("Error event: \"%s\" (error=%d)", m_camera ? m_camera->errorString() : "", static_cast<int>(error));
} }

View File

@ -15,7 +15,7 @@ qt_camera_handler::qt_camera_handler() : camera_handler_base()
// List available cameras // List available cameras
for (const QCameraInfo& cameraInfo : QCameraInfo::availableCameras()) for (const QCameraInfo& cameraInfo : QCameraInfo::availableCameras())
{ {
camera_log.success("Found camera: name=%s, description=%s", cameraInfo.deviceName().toStdString(), cameraInfo.description().toStdString()); camera_log.success("Found camera: name=%s, description=%s", cameraInfo.deviceName(), cameraInfo.description());
} }
if (!g_cfg_camera.load()) if (!g_cfg_camera.load())
@ -48,7 +48,7 @@ void qt_camera_handler::set_camera(const QCameraInfo& camera_info)
// Determine if the camera is front facing, in which case we will need to flip the image horizontally. // Determine if the camera is front facing, in which case we will need to flip the image horizontally.
const bool front_facing = camera_info.position() == QCamera::Position::FrontFace; const bool front_facing = camera_info.position() == QCamera::Position::FrontFace;
camera_log.success("Using camera: name=\"%s\", description=\"%s\", front_facing=%d", camera_info.deviceName().toStdString(), camera_info.description().toStdString(), front_facing); camera_log.success("Using camera: name=\"%s\", description=\"%s\", front_facing=%d", camera_info.deviceName(), camera_info.description(), front_facing);
// Create camera and video surface // Create camera and video surface
m_surface.reset(new qt_camera_video_surface(front_facing, nullptr)); m_surface.reset(new qt_camera_video_surface(front_facing, nullptr));

View File

@ -94,5 +94,5 @@ void qt_music_error_handler::handle_music_state(QMediaPlayer::State state)
void qt_music_error_handler::handle_music_error(QMediaPlayer::Error error) void qt_music_error_handler::handle_music_error(QMediaPlayer::Error error)
{ {
music_log.error("Error event: \"%s\" (error=%s)", m_media_player ? m_media_player->errorString().toStdString() : "", error); music_log.error("Error event: \"%s\" (error=%s)", m_media_player ? m_media_player->errorString() : "", error);
} }

View File

@ -16,7 +16,6 @@
LOG_CHANNEL(gui_log, "GUI"); LOG_CHANNEL(gui_log, "GUI");
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;
namespace gui namespace gui
@ -368,8 +367,8 @@ namespace gui
{ {
// Get Icon for the gs_frame from path. this handles presumably all possible use cases // Get Icon for the gs_frame from path. this handles presumably all possible use cases
const QString qpath = qstr(path); const QString qpath = qstr(path);
const std::string path_list[] = { path, sstr(qpath.section("/", 0, -2, QString::SectionIncludeTrailingSep)), const std::string path_list[] = { path, qpath.section("/", 0, -2, QString::SectionIncludeTrailingSep).toStdString(),
sstr(qpath.section("/", 0, -3, QString::SectionIncludeTrailingSep)) }; qpath.section("/", 0, -3, QString::SectionIncludeTrailingSep).toStdString() };
for (const std::string& pth : path_list) for (const std::string& pth : path_list)
{ {
@ -427,7 +426,7 @@ namespace gui
#ifdef _WIN32 #ifdef _WIN32
// Remove double slashes and convert to native separators. Double slashes don't seem to work with the explorer call. // Remove double slashes and convert to native separators. Double slashes don't seem to work with the explorer call.
path.replace(QRegularExpression("[\\\\|/]+"), QDir::separator()); path.replace(QRegularExpression("[\\\\|/]+"), QDir::separator());
gui_log.notice("gui::utils::open_dir: About to open file path '%s' (original: '%s')", path.toStdString(), spath); gui_log.notice("gui::utils::open_dir: About to open file path '%s' (original: '%s')", path, spath);
if (!QProcess::startDetached("explorer.exe", {"/select,", path})) if (!QProcess::startDetached("explorer.exe", {"/select,", path}))
{ {
@ -470,7 +469,7 @@ namespace gui
void open_dir(const QString& path) void open_dir(const QString& path)
{ {
open_dir(sstr(path)); open_dir(path.toStdString());
} }
QTreeWidgetItem* find_child(QTreeWidgetItem* parent, const QString& text) QTreeWidgetItem* find_child(QTreeWidgetItem* parent, const QString& text)

View File

@ -392,11 +392,11 @@ void Buffer::ShowContextMenu(const QPoint& pos)
if (m_image.save(path, "PNG", 100)) if (m_image.save(path, "PNG", 100))
{ {
rsx_debugger.success("Saved image to '%s'", path.toStdString()); rsx_debugger.success("Saved image to '%s'", path);
} }
else else
{ {
rsx_debugger.error("Failure to save image to '%s'", path.toStdString()); rsx_debugger.error("Failure to save image to '%s'", path);
} }
}); });

View File

@ -34,8 +34,6 @@ namespace
// Helper converters // Helper converters
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;
[[maybe_unused]] inline std::string sstr(const QString& _in) { return _in.toStdString(); }
QString FormatTimestamp(s64 time) QString FormatTimestamp(s64 time)
{ {
QDateTime dateTime; QDateTime dateTime;

View File

@ -4,8 +4,6 @@
#include "Utilities/File.h" #include "Utilities/File.h"
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
settings::settings(QObject* parent) : QObject(parent), settings::settings(QObject* parent) : QObject(parent),
m_settings_dir(ComputeSettingsDir()) m_settings_dir(ComputeSettingsDir())
{ {

View File

@ -822,11 +822,11 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
idx = 0; idx = 0;
if (renderer.old_adapter.isEmpty()) if (renderer.old_adapter.isEmpty())
{ {
rsx_log.warning("%s adapter config empty: setting to default!", sstr(renderer.name)); rsx_log.warning("%s adapter config empty: setting to default!", renderer.name);
} }
else else
{ {
rsx_log.warning("Last used %s adapter not found: setting to default!", sstr(renderer.name)); rsx_log.warning("Last used %s adapter not found: setting to default!", renderer.name);
} }
} }
ui->graphicsAdapterBox->setCurrentIndex(idx); ui->graphicsAdapterBox->setCurrentIndex(idx);
@ -2428,7 +2428,7 @@ void settings_dialog::AddStylesheets()
} }
else else
{ {
cfg_log.warning("Trying to set an invalid stylesheets index: %d (%s)", index, sstr(m_current_stylesheet)); cfg_log.warning("Trying to set an invalid stylesheets index: %d (%s)", index, m_current_stylesheet);
} }
} }

View File

@ -38,7 +38,7 @@ shortcut_handler::shortcut_handler(gui::shortcuts::shortcut_handler_id handler_i
// TODO: do not allow same shortcuts and remove this connect // TODO: do not allow same shortcuts and remove this connect
// activatedAmbiguously will trigger if you have the same key sequence for several shortcuts // activatedAmbiguously will trigger if you have the same key sequence for several shortcuts
const QKeySequence& key_sequence = m_shortcuts[key].key_sequence; const QKeySequence& key_sequence = m_shortcuts[key].key_sequence;
shortcut_log.error("Shortcut activated ambiguously: %s (%s)", key, key_sequence.toString().toStdString()); shortcut_log.error("Shortcut activated ambiguously: %s (%s)", key, key_sequence.toString());
handle_shortcut(key, key_sequence); handle_shortcut(key, key_sequence);
}); });
} }
@ -71,7 +71,7 @@ void shortcut_handler::update()
void shortcut_handler::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKeySequence& key_sequence) void shortcut_handler::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKeySequence& key_sequence)
{ {
shortcut_log.notice("Shortcut pressed: %s (%s)", shortcut_key, key_sequence.toString().toStdString()); shortcut_log.notice("Shortcut pressed: %s (%s)", shortcut_key, key_sequence.toString());
Q_EMIT shortcut_activated(shortcut_key, key_sequence); Q_EMIT shortcut_activated(shortcut_key, key_sequence);
} }

View File

@ -328,7 +328,7 @@ namespace gui::utils
if (!description.empty()) if (!description.empty())
{ {
fmt::append(file_content, "Comment=%s\n", QString::fromStdString(description).simplified().toStdString()); fmt::append(file_content, "Comment=%s\n", QString::fromStdString(description).simplified());
} }
if (!src_icon_path.empty() && !target_icon_dir.empty()) if (!src_icon_path.empty() && !target_icon_dir.empty())

View File

@ -114,7 +114,7 @@ void system_cmd_dialog::send_command()
const qulonglong status = m_command_box->currentData().toULongLong(&ok); const qulonglong status = m_command_box->currentData().toULongLong(&ok);
if (!ok) if (!ok)
{ {
gui_log.error("system_cmd_dialog::send_command: command can not be converted to qulonglong: %s", m_command_box->currentText().toStdString()); gui_log.error("system_cmd_dialog::send_command: command can not be converted to qulonglong: %s", m_command_box->currentText());
QMessageBox::warning(this, tr("Listen!"), tr("The selected command is bugged.\nPlease contact a developer.")); QMessageBox::warning(this, tr("Listen!"), tr("The selected command is bugged.\nPlease contact a developer."));
return; return;
} }
@ -122,7 +122,7 @@ void system_cmd_dialog::send_command()
const qulonglong param = hex_value(m_value_input->text(), ok); const qulonglong param = hex_value(m_value_input->text(), ok);
if (!ok) if (!ok)
{ {
gui_log.error("system_cmd_dialog::send_command: value can not be converted to qulonglong: %s", m_value_input->text().toStdString()); gui_log.error("system_cmd_dialog::send_command: value can not be converted to qulonglong: %s", m_value_input->text());
QMessageBox::information(this, tr("Listen!"), tr("Please select a proper value first.")); QMessageBox::information(this, tr("Listen!"), tr("Please select a proper value first."));
return; return;
} }
@ -137,7 +137,7 @@ void system_cmd_dialog::send_custom_command()
const qulonglong status = hex_value(m_custom_command_input->text(), ok); const qulonglong status = hex_value(m_custom_command_input->text(), ok);
if (!ok) if (!ok)
{ {
gui_log.error("system_cmd_dialog::send_custom_command: command can not be converted to qulonglong: %s", m_custom_command_input->text().toStdString()); gui_log.error("system_cmd_dialog::send_custom_command: command can not be converted to qulonglong: %s", m_custom_command_input->text());
QMessageBox::information(this, tr("Listen!"), tr("Please select a proper custom command first.")); QMessageBox::information(this, tr("Listen!"), tr("Please select a proper custom command first."));
return; return;
} }
@ -145,7 +145,7 @@ void system_cmd_dialog::send_custom_command()
const qulonglong param = hex_value(m_value_input->text(), ok); const qulonglong param = hex_value(m_value_input->text(), ok);
if (!ok) if (!ok)
{ {
gui_log.error("system_cmd_dialog::send_custom_command: value can not be converted to qulonglong: %s", m_value_input->text().toStdString()); gui_log.error("system_cmd_dialog::send_custom_command: value can not be converted to qulonglong: %s", m_value_input->text());
QMessageBox::information(this, tr("Listen!"), tr("Please select a proper value first.")); QMessageBox::information(this, tr("Listen!"), tr("Please select a proper value first."));
return; return;
} }

View File

@ -177,7 +177,7 @@ bool update_manager::handle_json(bool automatic, bool check_only, bool auto_acce
const qint64 diff_msec = cur_date.msecsTo(lts_date); const qint64 diff_msec = cur_date.msecsTo(lts_date);
update_log.notice("Current: %s, latest: %s, difference: %lld ms", cur_str.toStdString(), lts_str.toStdString(), diff_msec); update_log.notice("Current: %s, latest: %s, difference: %lld ms", cur_str, lts_str, diff_msec);
const Localized localized; const Localized localized;

View File

@ -12,8 +12,6 @@
#include "Emu/System.h" #include "Emu/System.h"
#include "Emu/vfs_config.h" #include "Emu/vfs_config.h"
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> _gui_settings, QWidget* parent) vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> _gui_settings, QWidget* parent)
: QDialog(parent), m_gui_settings(std::move(_gui_settings)) : QDialog(parent), m_gui_settings(std::move(_gui_settings))
{ {

View File

@ -7,8 +7,6 @@
#include "Emu/vfs_config.h" #include "Emu/vfs_config.h"
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
vfs_dialog_usb_input::vfs_dialog_usb_input(const QString& name, const cfg::device_info& default_info, cfg::device_info* info, std::shared_ptr<gui_settings> _gui_settings, QWidget* parent) vfs_dialog_usb_input::vfs_dialog_usb_input(const QString& name, const cfg::device_info& default_info, cfg::device_info* info, std::shared_ptr<gui_settings> _gui_settings, QWidget* parent)
: QDialog(parent), m_gui_settings(std::move(_gui_settings)), m_gui_save(gui::fs_dev_usb_list) : QDialog(parent), m_gui_settings(std::move(_gui_settings)), m_gui_save(gui::fs_dev_usb_list)
{ {