|
|
|
|
@ -1,3 +1,6 @@
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
#include <winsock2.h> |
|
|
|
|
#endif |
|
|
|
|
#include <QCoreApplication> |
|
|
|
|
#include <QApplication> |
|
|
|
|
#include <QIcon> |
|
|
|
|
@ -39,9 +42,10 @@ static DWORD count_threads(void) {
|
|
|
|
|
|
|
|
|
|
static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType) { |
|
|
|
|
if (dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_BREAK_EVENT) { |
|
|
|
|
if (g_mainWindow) |
|
|
|
|
QMetaObject::invokeMethod(g_mainWindow, [g_mainWindow] { |
|
|
|
|
g_mainWindow->requestShutdown(); |
|
|
|
|
MainWindow* window = g_mainWindow; |
|
|
|
|
if (window) |
|
|
|
|
QMetaObject::invokeMethod(window, [window] { |
|
|
|
|
window->requestShutdown(); |
|
|
|
|
}, Qt::QueuedConnection); |
|
|
|
|
else if (g_ctrl_node) |
|
|
|
|
g_ctrl_node->requestStop(); |
|
|
|
|
|