mirror of
https://github.com/overte-org/overte.git
synced 2025-08-16 09:12:26 +02:00
Add WM_CLOSE support to domain server
This commit is contained in:
parent
439f2d5c02
commit
fa7b2a87bf
3 changed files with 21 additions and 2 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "ThreadedAssignment.h"
|
||||
|
||||
class AssignmentClient : public QCoreApplication, QAbstractNativeEventFilter {
|
||||
class AssignmentClient : public QCoreApplication, public QAbstractNativeEventFilter {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AssignmentClient(int &argc, char **argv);
|
||||
|
|
|
@ -47,6 +47,8 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
|||
setOrganizationDomain("highfidelity.io");
|
||||
setApplicationName("domain-server");
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
|
||||
installNativeEventFilter(this);
|
||||
|
||||
_argumentVariantMap = HifiConfigVariantMap::mergeCLParametersWithJSONConfig(arguments());
|
||||
|
||||
|
@ -61,6 +63,20 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
|||
}
|
||||
}
|
||||
|
||||
bool DomainServer::nativeEventFilter(const QByteArray &eventType, void* msg, long* result) {
|
||||
#ifdef Q_OS_WIN
|
||||
if (eventType == "windows_generic_MSG") {
|
||||
MSG* message = (MSG*)msg;
|
||||
if (message->message == WM_CLOSE) {
|
||||
qDebug() << "Received WM_CLOSE message, closing";
|
||||
quit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DomainServer::optionallyReadX509KeyAndCertificate() {
|
||||
const QString X509_CERTIFICATE_OPTION = "cert";
|
||||
const QString X509_PRIVATE_KEY_OPTION = "key";
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
|
||||
#include <Assignment.h>
|
||||
#include <HTTPSConnection.h>
|
||||
|
@ -31,13 +32,15 @@
|
|||
typedef QSharedPointer<Assignment> SharedAssignmentPointer;
|
||||
typedef QMultiHash<QUuid, WalletTransaction*> TransactionHash;
|
||||
|
||||
class DomainServer : public QCoreApplication, public HTTPSRequestHandler {
|
||||
class DomainServer : public QCoreApplication, public HTTPSRequestHandler, public QAbstractNativeEventFilter {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DomainServer(int argc, char* argv[]);
|
||||
|
||||
bool handleHTTPRequest(HTTPConnection* connection, const QUrl& url);
|
||||
bool handleHTTPSRequest(HTTPSConnection* connection, const QUrl& url);
|
||||
|
||||
bool nativeEventFilter(const QByteArray &eventType, void* msg, long* result);
|
||||
|
||||
void exit(int retCode = 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue