Showing the changes to assignment-client/src/AssignmentClient.cpp (1 of 6 files). Show all
Unified · Split
| @@ -36,7 +36,8 @@ int hifiSockAddrMeta = qRegisterMetaType<HifiSockAddr>("HifiSockAddr"); · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | AssignmentClient::AssignmentClient(int &argc, char **argv) : |
| 38 | 38 | QCoreApplication(argc, argv), |
| 39 | − _assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME) | |
| 39 | + _assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME), | |
| 40 | + _shutdownEventListener(this) | |
| 40 | 41 | { |
| 41 | 42 | |
| 42 | 43 | #ifdef Q_OS_WIN |
| @@ -54,7 +55,8 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : · 11 unmodified lines | ||
| 54 | 55 | setApplicationName("assignment-client"); |
| 55 | 56 | QSettings::setDefaultFormat(QSettings::IniFormat); |
| 56 | 57 | |
| 57 | − installNativeEventFilter(this); | |
| 58 | + installNativeEventFilter(&_shutdownEventListener); | |
| 59 | + connect(&_shutdownEventListener, SIGNAL(receivedCloseEvent()), SLOT(quit())); | |
| 58 | 60 | |
| 59 | 61 | // set the logging target to the the CHILD_TARGET_NAME |
| 60 | 62 | Logging::setTargetName(ASSIGNMENT_CLIENT_TARGET_NAME); |
| @@ -121,20 +123,6 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : · 60 unmodified lines | ||
| 121 | 123 | NetworkAccessManager::getInstance(); |
| 122 | 124 | } |
| 123 | 125 | |
| 124 | −bool AssignmentClient::nativeEventFilter(const QByteArray &eventType, void* msg, long* result) { | |
| 125 | −#ifdef Q_OS_WIN | |
| 126 | − if (eventType == "windows_generic_MSG") { | |
| 127 | − MSG* message = (MSG*)msg; | |
| 128 | − if (message->message == WM_CLOSE) { | |
| 129 | − qDebug() << "Received WM_CLOSE message, closing"; | |
| 130 | − quit(); | |
| 131 | − return false; | |
| 132 | − } | |
| 133 | − } | |
| 134 | −#endif | |
| 135 | − return true; | |
| 136 | −} | |
| 137 | − | |
| 138 | 126 | void AssignmentClient::sendAssignmentRequest() { |
| 139 | 127 | if (!_currentAssignment) { |
| 140 | 128 | NodeList::getInstance()->sendAssignment(_requestAssignment); |