mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 19:35:41 -04:00
Misc: Replace log printf calls with fmt
This commit is contained in:
@ -86,7 +86,7 @@ bool AutoUpdaterDialog::isSupported()
|
||||
// For Linux, we need to check whether we're running from the appimage.
|
||||
if (!std::getenv("APPIMAGE"))
|
||||
{
|
||||
Log_InfoPrintf("We're a CI release, but not running from an AppImage. Disabling automatic updater.");
|
||||
Log_InfoPrint("We're a CI release, but not running from an AppImage. Disabling automatic updater.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -465,16 +465,16 @@ bool AutoUpdaterDialog::updateNeeded() const
|
||||
{
|
||||
QString last_checked_sha = QString::fromStdString(Host::GetBaseStringSettingValue("AutoUpdater", "LastVersion"));
|
||||
|
||||
Log_InfoPrintf("Current SHA: %s", g_scm_hash_str);
|
||||
Log_InfoPrintf("Latest SHA: %s", m_latest_sha.toUtf8().constData());
|
||||
Log_InfoPrintf("Last Checked SHA: %s", last_checked_sha.toUtf8().constData());
|
||||
Log_InfoFmt("Current SHA: {}", g_scm_hash_str);
|
||||
Log_InfoFmt("Latest SHA: {}", m_latest_sha.toUtf8().constData());
|
||||
Log_InfoFmt("Last Checked SHA: {}", last_checked_sha.toUtf8().constData());
|
||||
if (m_latest_sha == g_scm_hash_str || m_latest_sha == last_checked_sha)
|
||||
{
|
||||
Log_InfoPrintf("No update needed.");
|
||||
Log_InfoPrint("No update needed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Log_InfoPrintf("Update needed.");
|
||||
Log_InfoPrint("Update needed.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -735,9 +735,9 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
|
||||
|
||||
const QString new_appimage_path(qappimage_path + QStringLiteral(".new"));
|
||||
const QString backup_appimage_path(qappimage_path + QStringLiteral(".backup"));
|
||||
Log_InfoPrintf("APPIMAGE = %s", appimage_path);
|
||||
Log_InfoPrintf("Backup AppImage path = %s", backup_appimage_path.toUtf8().constData());
|
||||
Log_InfoPrintf("New AppImage path = %s", new_appimage_path.toUtf8().constData());
|
||||
Log_InfoFmt("APPIMAGE = {}", appimage_path);
|
||||
Log_InfoFmt("Backup AppImage path = {}", backup_appimage_path.toUtf8().constData());
|
||||
Log_InfoFmt("New AppImage path = {}", new_appimage_path.toUtf8().constData());
|
||||
|
||||
// Remove old "new" appimage and existing backup appimage.
|
||||
if (QFile::exists(new_appimage_path) && !QFile::remove(new_appimage_path))
|
||||
|
@ -481,7 +481,7 @@ void ControllerBindingWidget::bindBindingWidgets(QWidget* parent)
|
||||
InputBindingWidget* widget = parent->findChild<InputBindingWidget*>(QString::fromUtf8(bi.name));
|
||||
if (!widget)
|
||||
{
|
||||
Log_ErrorPrintf("No widget found for '%s' (%s)", bi.name, m_controller_info->name);
|
||||
Log_ErrorFmt("No widget found for '{}' ({})", bi.name, m_controller_info->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ void DisplayWidget::updateRelativeMode(bool enabled)
|
||||
if (m_relative_mouse_enabled == enabled && m_clip_mouse_enabled == clip_cursor)
|
||||
return;
|
||||
|
||||
Log_InfoPrintf("updateRelativeMode(): relative=%s, clip=%s", enabled ? "yes" : "no", clip_cursor ? "yes" : "no");
|
||||
Log_InfoFmt("updateRelativeMode(): relative={}, clip={}", enabled ? "yes" : "no", clip_cursor ? "yes" : "no");
|
||||
|
||||
if (!clip_cursor && m_clip_mouse_enabled)
|
||||
{
|
||||
@ -95,7 +95,7 @@ void DisplayWidget::updateRelativeMode(bool enabled)
|
||||
if (m_relative_mouse_enabled == enabled)
|
||||
return;
|
||||
|
||||
Log_InfoPrintf("updateRelativeMode(): relative=%s", enabled ? "yes" : "no");
|
||||
Log_InfoFmt("updateRelativeMode(): relative={}", enabled ? "yes" : "no");
|
||||
#endif
|
||||
|
||||
if (enabled)
|
||||
@ -126,12 +126,12 @@ void DisplayWidget::updateCursor(bool hidden)
|
||||
m_cursor_hidden = hidden;
|
||||
if (hidden)
|
||||
{
|
||||
Log_DevPrintf("updateCursor(): Cursor is now hidden");
|
||||
Log_DevPrint("updateCursor(): Cursor is now hidden");
|
||||
setCursor(Qt::BlankCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_DevPrintf("updateCursor(): Cursor is now shown");
|
||||
Log_DevPrint("updateCursor(): Cursor is now shown");
|
||||
unsetCursor();
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,7 @@ GDBConnection::GDBConnection(GDBServer* parent, intptr_t descriptor) : QTcpSocke
|
||||
{
|
||||
if (!setSocketDescriptor(descriptor))
|
||||
{
|
||||
Log_ErrorPrintf("(%" PRIdPTR ") Failed to set socket descriptor: %s", descriptor,
|
||||
errorString().toUtf8().constData());
|
||||
Log_ErrorFmt("{} failed to set socket descriptor: {}", descriptor, errorString().toStdString());
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
@ -22,7 +21,7 @@ GDBConnection::GDBConnection(GDBServer* parent, intptr_t descriptor) : QTcpSocke
|
||||
connect(this, &QTcpSocket::readyRead, this, &GDBConnection::receivedData);
|
||||
connect(this, &QTcpSocket::disconnected, this, &GDBConnection::gotDisconnected);
|
||||
|
||||
Log_InfoPrintf("(%" PRIdPTR ") Client connected", m_descriptor);
|
||||
Log_InfoFmt("{} client connected", m_descriptor);
|
||||
|
||||
m_seen_resume = System::IsPaused();
|
||||
g_emu_thread->setSystemPaused(true);
|
||||
@ -30,7 +29,7 @@ GDBConnection::GDBConnection(GDBServer* parent, intptr_t descriptor) : QTcpSocke
|
||||
|
||||
void GDBConnection::gotDisconnected()
|
||||
{
|
||||
Log_InfoPrintf("(%" PRIdPTR ") Client disconnected", m_descriptor);
|
||||
Log_InfoFmt("{} client disconnected", m_descriptor);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
@ -47,19 +46,19 @@ void GDBConnection::receivedData()
|
||||
|
||||
if (GDBProtocol::IsPacketInterrupt(m_readBuffer))
|
||||
{
|
||||
Log_DebugPrintf("(%" PRIdPTR ") > Interrupt request", m_descriptor);
|
||||
Log_DebugFmt("{} > Interrupt request", m_descriptor);
|
||||
g_emu_thread->setSystemPaused(true);
|
||||
m_readBuffer.erase();
|
||||
}
|
||||
else if (GDBProtocol::IsPacketContinue(m_readBuffer))
|
||||
{
|
||||
Log_DebugPrintf("(%" PRIdPTR ") > Continue request", m_descriptor);
|
||||
Log_DebugFmt("{} > Continue request", m_descriptor);
|
||||
g_emu_thread->setSystemPaused(false);
|
||||
m_readBuffer.erase();
|
||||
}
|
||||
else if (GDBProtocol::IsPacketComplete(m_readBuffer))
|
||||
{
|
||||
Log_DebugPrintf("(%" PRIdPTR ") > %s", m_descriptor, m_readBuffer.c_str());
|
||||
Log_DebugFmt("{} > %s", m_descriptor, m_readBuffer.c_str());
|
||||
writePacket(GDBProtocol::ProcessPacket(m_readBuffer));
|
||||
m_readBuffer.erase();
|
||||
}
|
||||
@ -67,8 +66,7 @@ void GDBConnection::receivedData()
|
||||
}
|
||||
if (bytesRead == -1)
|
||||
{
|
||||
Log_ErrorPrintf("(%" PRIdPTR ") Failed to read from socket: %s", m_descriptor,
|
||||
errorString().toUtf8().constData());
|
||||
Log_ErrorFmt("{} failed to read from socket: %s", m_descriptor, errorString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,10 +89,7 @@ void GDBConnection::onEmulationResumed()
|
||||
|
||||
void GDBConnection::writePacket(std::string_view packet)
|
||||
{
|
||||
Log_DebugPrintf("(%" PRIdPTR ") < %.*s", m_descriptor, static_cast<int>(packet.length()), packet.data());
|
||||
Log_DebugFmt("{} < {}", m_descriptor, packet);
|
||||
if (write(packet.data(), packet.length()) == -1)
|
||||
{
|
||||
Log_ErrorPrintf("(%" PRIdPTR ") Failed to write to socket: %s", m_descriptor,
|
||||
errorString().toUtf8().constData());
|
||||
}
|
||||
Log_ErrorFmt("{} failed to write to socket: {}", m_descriptor, errorString().toStdString());
|
||||
}
|
||||
|
@ -2,13 +2,12 @@
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#include "gdbserver.h"
|
||||
#include "gdbconnection.h"
|
||||
#include "common/log.h"
|
||||
#include "gdbconnection.h"
|
||||
#include "qthost.h"
|
||||
Log_SetChannel(GDBServer);
|
||||
|
||||
GDBServer::GDBServer(QObject *parent)
|
||||
: QTcpServer(parent)
|
||||
GDBServer::GDBServer(QObject* parent) : QTcpServer(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@ -17,7 +16,8 @@ GDBServer::~GDBServer()
|
||||
stop();
|
||||
}
|
||||
|
||||
void GDBServer::start(quint16 port) {
|
||||
void GDBServer::start(quint16 port)
|
||||
{
|
||||
if (isListening())
|
||||
{
|
||||
return;
|
||||
@ -25,12 +25,11 @@ void GDBServer::start(quint16 port) {
|
||||
|
||||
if (!listen(QHostAddress::LocalHost, port))
|
||||
{
|
||||
Log_ErrorPrintf("Failed to listen on TCP port %u for GDB server: %s", port,
|
||||
errorString().toUtf8().constData());
|
||||
Log_ErrorFmt("Failed to listen on TCP port {} for GDB server: {}", port, errorString().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
Log_InfoPrintf("GDB server listening on TCP port %u", port);
|
||||
Log_InfoFmt("GDB server listening on TCP port {}", port);
|
||||
}
|
||||
|
||||
void GDBServer::stop()
|
||||
@ -41,7 +40,8 @@ void GDBServer::stop()
|
||||
Log_InfoPrint("GDB server stopped");
|
||||
}
|
||||
|
||||
for (QObject* connection : children()) {
|
||||
for (QObject* connection : children())
|
||||
{
|
||||
connection->deleteLater();
|
||||
}
|
||||
}
|
||||
|
@ -246,8 +246,8 @@ bool MainWindow::nativeEvent(const QByteArray& eventType, void* message, qintptr
|
||||
std::optional<WindowInfo> MainWindow::acquireRenderWindow(bool recreate_window, bool fullscreen, bool render_to_main,
|
||||
bool surfaceless, bool use_main_window_pos)
|
||||
{
|
||||
Log_DevPrintf(
|
||||
"acquireRenderWindow() recreate=%s fullscreen=%s render_to_main=%s surfaceless=%s use_main_window_pos=%s",
|
||||
Log_DevFmt(
|
||||
"acquireRenderWindow() recreate={} fullscreen={} render_to_main={} surfaceless={} use_main_window_pos={}",
|
||||
recreate_window ? "true" : "false", fullscreen ? "true" : "false", render_to_main ? "true" : "false",
|
||||
surfaceless ? "true" : "false", use_main_window_pos ? "true" : "false");
|
||||
|
||||
@ -269,7 +269,7 @@ std::optional<WindowInfo> MainWindow::acquireRenderWindow(bool recreate_window,
|
||||
if (m_display_created && !recreate_window && !is_rendering_to_main && !render_to_main &&
|
||||
has_container == needs_container && !needs_container && !changing_surfaceless)
|
||||
{
|
||||
Log_DevPrintf("Toggling to %s without recreating surface", (fullscreen ? "fullscreen" : "windowed"));
|
||||
Log_DevFmt("Toggling to {} without recreating surface", (fullscreen ? "fullscreen" : "windowed"));
|
||||
|
||||
// since we don't destroy the display widget, we need to save it here
|
||||
if (!is_fullscreen && !is_rendering_to_main)
|
||||
|
@ -465,9 +465,9 @@ bool QtHost::SetCriticalFolders()
|
||||
return false;
|
||||
|
||||
// logging of directories in case something goes wrong super early
|
||||
Log_DevPrintf("AppRoot Directory: %s", EmuFolders::AppRoot.c_str());
|
||||
Log_DevPrintf("DataRoot Directory: %s", EmuFolders::DataRoot.c_str());
|
||||
Log_DevPrintf("Resources Directory: %s", EmuFolders::Resources.c_str());
|
||||
Log_DevFmt("AppRoot Directory: {}", EmuFolders::AppRoot);
|
||||
Log_DevFmt("DataRoot Directory: {}", EmuFolders::DataRoot);
|
||||
Log_DevFmt("Resources Directory: {}", EmuFolders::Resources);
|
||||
|
||||
// Write crash dumps to the data directory, since that'll be accessible for certain.
|
||||
CrashHandler::SetWriteDirectory(EmuFolders::DataRoot);
|
||||
@ -493,7 +493,7 @@ bool QtHost::ShouldUsePortableMode()
|
||||
void QtHost::SetAppRoot()
|
||||
{
|
||||
const std::string program_path = FileSystem::GetProgramPath();
|
||||
Log_InfoPrintf("Program Path: %s", program_path.c_str());
|
||||
Log_InfoFmt("Program Path: {}", program_path.c_str());
|
||||
|
||||
EmuFolders::AppRoot = Path::Canonicalize(Path::GetDirectory(program_path));
|
||||
}
|
||||
@ -1813,14 +1813,9 @@ void Host::ReportFatalError(std::string_view title, std::string_view message)
|
||||
void Host::ReportErrorAsync(std::string_view title, std::string_view message)
|
||||
{
|
||||
if (!title.empty() && !message.empty())
|
||||
{
|
||||
Log_ErrorPrintf("ReportErrorAsync: %.*s: %.*s", static_cast<int>(title.size()), title.data(),
|
||||
static_cast<int>(message.size()), message.data());
|
||||
}
|
||||
Log_ErrorFmt("ReportErrorAsync: {}: {}", title, message);
|
||||
else if (!message.empty())
|
||||
{
|
||||
Log_ErrorPrintf("ReportErrorAsync: %.*s", static_cast<int>(message.size()), message.data());
|
||||
}
|
||||
Log_ErrorFmt("ReportErrorAsync: {}", message);
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
g_main_window, "reportError", Qt::QueuedConnection,
|
||||
@ -2292,88 +2287,88 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
|
||||
}
|
||||
else if (CHECK_ARG("-batch"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Using batch mode.");
|
||||
Log_InfoPrint("Command Line: Using batch mode.");
|
||||
s_batch_mode = true;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-nogui"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Using NoGUI mode.");
|
||||
Log_InfoPrint("Command Line: Using NoGUI mode.");
|
||||
s_nogui_mode = true;
|
||||
s_batch_mode = true;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-bios"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Starting BIOS.");
|
||||
Log_InfoPrint("Command Line: Starting BIOS.");
|
||||
AutoBoot(autoboot);
|
||||
starting_bios = true;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-fastboot"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Forcing fast boot.");
|
||||
Log_InfoPrint("Command Line: Forcing fast boot.");
|
||||
AutoBoot(autoboot)->override_fast_boot = true;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-slowboot"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Forcing slow boot.");
|
||||
Log_InfoPrint("Command Line: Forcing slow boot.");
|
||||
AutoBoot(autoboot)->override_fast_boot = false;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-resume"))
|
||||
{
|
||||
state_index = -1;
|
||||
Log_InfoPrintf("Command Line: Loading resume state.");
|
||||
Log_InfoPrint("Command Line: Loading resume state.");
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG_PARAM("-state"))
|
||||
{
|
||||
state_index = args[++i].toInt();
|
||||
Log_InfoPrintf("Command Line: Loading state index: %d", state_index.value());
|
||||
Log_InfoFmt("Command Line: Loading state index: {}", state_index.value());
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG_PARAM("-statefile"))
|
||||
{
|
||||
AutoBoot(autoboot)->save_state = args[++i].toStdString();
|
||||
Log_InfoPrintf("Command Line: Loading state file: '%s'", autoboot->save_state.c_str());
|
||||
Log_InfoFmt("Command Line: Loading state file: '{}'", autoboot->save_state);
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG_PARAM("-exe"))
|
||||
{
|
||||
AutoBoot(autoboot)->override_exe = args[++i].toStdString();
|
||||
Log_InfoPrintf("Command Line: Overriding EXE file: '%s'", autoboot->override_exe.c_str());
|
||||
Log_InfoFmt("Command Line: Overriding EXE file: '{}'", autoboot->override_exe);
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-fullscreen"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Using fullscreen.");
|
||||
Log_InfoPrint("Command Line: Using fullscreen.");
|
||||
AutoBoot(autoboot)->override_fullscreen = true;
|
||||
s_start_fullscreen_ui_fullscreen = true;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-nofullscreen"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Not using fullscreen.");
|
||||
Log_InfoPrint("Command Line: Not using fullscreen.");
|
||||
AutoBoot(autoboot)->override_fullscreen = false;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-portable"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Using portable mode.");
|
||||
Log_InfoPrint("Command Line: Using portable mode.");
|
||||
EmuFolders::DataRoot = EmuFolders::AppRoot;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG_PARAM("-settings"))
|
||||
{
|
||||
settings_filename = args[++i].toStdString();
|
||||
Log_InfoPrintf("Command Line: Overriding settings filename: %s", settings_filename.c_str());
|
||||
Log_InfoFmt("Command Line: Overriding settings filename: {}", settings_filename);
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("-bigpicture"))
|
||||
{
|
||||
Log_InfoPrintf("Command Line: Starting big picture mode.");
|
||||
Log_InfoPrint("Command Line: Starting big picture mode.");
|
||||
s_start_fullscreen_ui = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ void QtHost::InstallTranslator(QWidget* dialog_parent)
|
||||
return;
|
||||
}
|
||||
|
||||
Log_InfoPrintf("Loaded translation file for language %s", language.toUtf8().constData());
|
||||
Log_InfoFmt("Loaded translation file for language {}", language.toUtf8().constData());
|
||||
qApp->installTranslator(translator);
|
||||
s_translators.push_back(translator);
|
||||
|
||||
|
Reference in New Issue
Block a user