|
|
|
|
@ -3,10 +3,25 @@
|
|
|
|
|
#include <QStyleFactory> |
|
|
|
|
#include <QDir> |
|
|
|
|
#include <cstdio> |
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
#include <windows.h> |
|
|
|
|
#endif |
|
|
|
|
#include "mainwindow.h" |
|
|
|
|
#include "../db/db_manager.h" |
|
|
|
|
#include "../transport/node_config.h" |
|
|
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
extern "C" void utun_node_signal_shutdown(void); |
|
|
|
|
|
|
|
|
|
static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType) { |
|
|
|
|
if (dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_BREAK_EVENT) { |
|
|
|
|
utun_node_signal_shutdown(); |
|
|
|
|
return TRUE; |
|
|
|
|
} |
|
|
|
|
return FALSE; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) { |
|
|
|
|
QApplication app(argc, argv); |
|
|
|
|
app.setApplicationName("Chat"); |
|
|
|
|
@ -76,5 +91,9 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
cfg.debugLevel(), cfg.debugCategories()); |
|
|
|
|
w.show(); |
|
|
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
SetConsoleCtrlHandler(console_ctrl_handler, TRUE); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
return app.exec(); |
|
|
|
|
} |
|
|
|
|
|