UI: Improve console output

This commit is contained in:
Nodir Temirkhodjaev 2024-01-10 17:07:31 +03:00
parent 447e5fe336
commit 13bd3d3523
2 changed files with 2 additions and 8 deletions

View File

@ -52,7 +52,7 @@ const QLoggingCategory LC("fortManager");
void dbErrorHandler(void *context, int errCode, const char *message)
{
qCWarning(LC) << "DB Error:" << errCode << message;
qCWarning(LC) << "DB Error:" << errCode << qUtf8Printable(message);
if (SqliteDb::isIoError(errCode)) {
auto fortManager = static_cast<FortManager *>(context);

View File

@ -145,15 +145,9 @@ void OsUtil::showConsole(bool visible)
void OsUtil::writeToConsole(const QString &line)
{
const HANDLE stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
if (!stdoutHandle || stdoutHandle == INVALID_HANDLE_VALUE)
return;
QByteArray data;
data.append(line.toLocal8Bit());
data.append('\n');
DWORD nw;
WriteFile(stdoutHandle, data.constData(), DWORD(data.size()), &nw, nullptr);
WriteConsoleW(stdoutHandle, line.utf16(), line.size(), &nw, nullptr);
}
bool OsUtil::setCurrentThreadName(const QString &name)