Merge pull request #379 from selmf/new_qr_engine

New qr engine: Fix output on Windows
This commit is contained in:
Luis Ángel San Martín 2023-04-23 16:37:55 +02:00 committed by GitHub
commit b4e95fb6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -80,9 +80,9 @@ void printServerInfo(YACReaderHttpServer *httpServer)
for (int x = -border - 1; x < code.getSize() + border + 1; x++) { for (int x = -border - 1; x < code.getSize() + border + 1; x++) {
QRCodeString.append((code.getModule(x, y) && code.getModule(x, y + 1)) QRCodeString.append((code.getModule(x, y) && code.getModule(x, y + 1))
? " " ? " "
: code.getModule(x, y + 1) ? "\u2580" : code.getModule(x, y + 1) ? u8"\u2580"
: code.getModule(x, y) ? "\u2584" : code.getModule(x, y) ? u8"\u2584"
: "\u2588"); : u8"\u2588");
} }
QLOG_INFO() << QRCodeString; QLOG_INFO() << QRCodeString;
} }

View File

@ -31,17 +31,18 @@
#include <cstdio> #include <cstdio>
void QsDebugOutput::output( const QString& message ) void QsDebugOutput::output( const QString& message )
{ {
fprintf(stderr, "%s\n", qPrintable(message)); fprintf(stderr, "%s\n", qPrintable(message));
fflush(stderr); fflush(stderr);
} }
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <Windows.h>
void QsDebugOutput::output( const QString& message ) void QsDebugOutput::output( const QString& message )
{ {
OutputDebugStringW(reinterpret_cast<const WCHAR*>(message.utf16())); WriteConsoleW(GetStdHandle(STD_ERROR_HANDLE), message.utf16(), message.size(), NULL, NULL);
OutputDebugStringW(L"\n"); WriteConsoleW(GetStdHandle(STD_ERROR_HANDLE), L"\n", 1, NULL, NULL);
} }
#endif #endif
const char* const QsLogging::DebugOutputDestination::Type = "console"; const char* const QsLogging::DebugOutputDestination::Type = "console";