mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 07:15:27 +00:00
parent
48bcd725c9
commit
c93f7e7385
@ -59,13 +59,6 @@ public:
|
|||||||
|
|
||||||
void showMessage(QString message, MessageType type) const
|
void showMessage(QString message, MessageType type) const
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN32)
|
|
||||||
UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND;
|
|
||||||
flags |= (type == Info ? MB_ICONINFORMATION : MB_ICONERROR);
|
|
||||||
QString title = "Moonlight";
|
|
||||||
MessageBoxW(nullptr, reinterpret_cast<const wchar_t *>(message.utf16()),
|
|
||||||
reinterpret_cast<const wchar_t *>(title.utf16()), flags);
|
|
||||||
#endif
|
|
||||||
message = message.endsWith('\n') ? message : message + '\n';
|
message = message.endsWith('\n') ? message : message + '\n';
|
||||||
fputs(qPrintable(message), type == Info ? stdout : stderr);
|
fputs(qPrintable(message), type == Info ? stdout : stderr);
|
||||||
}
|
}
|
||||||
|
39
app/main.cpp
39
app/main.cpp
@ -588,31 +588,32 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
// If we don't have stdout or stderr handles (which will normally be the case
|
||||||
|
// since we're a /SUBSYSTEM:WINDOWS app), attach to our parent console and use
|
||||||
|
// that for stdout and stderr.
|
||||||
|
//
|
||||||
|
// If we do have stdout or stderr handles, that means the user has used standard
|
||||||
|
// handle redirection. In that case, we don't want to override those handles.
|
||||||
|
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
|
||||||
|
// If we didn't have an old stdout/stderr handle, use the new CONOUT$ handle
|
||||||
|
if (IS_UNSPECIFIED_HANDLE(oldConOut)) {
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
}
|
||||||
|
if (IS_UNSPECIFIED_HANDLE(oldConErr)) {
|
||||||
|
freopen("CONOUT$", "w", stderr);
|
||||||
|
setvbuf(stderr, NULL, _IONBF, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
GlobalCommandLineParser parser;
|
GlobalCommandLineParser parser;
|
||||||
GlobalCommandLineParser::ParseResult commandLineParserResult = parser.parse(app.arguments());
|
GlobalCommandLineParser::ParseResult commandLineParserResult = parser.parse(app.arguments());
|
||||||
switch (commandLineParserResult) {
|
switch (commandLineParserResult) {
|
||||||
case GlobalCommandLineParser::ListRequested:
|
case GlobalCommandLineParser::ListRequested:
|
||||||
// Don't log to the console since it will jumble the command output
|
// Don't log to the console since it will jumble the command output
|
||||||
s_SuppressVerboseOutput = true;
|
s_SuppressVerboseOutput = true;
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
// If we don't have stdout or stderr handles (which will normally be the case
|
|
||||||
// since we're a /SUBSYSTEM:WINDOWS app), attach to our parent console and use
|
|
||||||
// that for stdout and stderr.
|
|
||||||
//
|
|
||||||
// If we do have stdout or stderr handles, that means the user has used standard
|
|
||||||
// handle redirection. In that case, we don't want to override those handles.
|
|
||||||
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
|
|
||||||
// If we didn't have an old stdout/stderr handle, use the new CONOUT$ handle
|
|
||||||
if (IS_UNSPECIFIED_HANDLE(oldConOut)) {
|
|
||||||
freopen("CONOUT$", "w", stdout);
|
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
|
||||||
}
|
|
||||||
if (IS_UNSPECIFIED_HANDLE(oldConErr)) {
|
|
||||||
freopen("CONOUT$", "w", stderr);
|
|
||||||
setvbuf(stderr, NULL, _IONBF, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user