mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Support Quit event
This commit is contained in:
		| @@ -144,7 +144,7 @@ void EventHandler::handleEvent(Event event) | ||||
| { | ||||
| 	QObject *senderObj = QObject::sender(); | ||||
| 	QString senderObjectClass; | ||||
| 	if (senderObj) | ||||
| 	if (senderObj != nullptr) | ||||
| 	{ | ||||
| 		senderObjectClass = senderObj->metaObject()->className(); | ||||
| 	} else | ||||
| @@ -188,6 +188,10 @@ void EventHandler::handleEvent(Event event) | ||||
| 		Process::restartHyperion(11); | ||||
| 		break; | ||||
|  | ||||
| 	case Event::Quit: | ||||
| 		emit signalEvent(Event::Quit); | ||||
| 		break; | ||||
|  | ||||
| 	default: | ||||
| 		Error(_log,"Unkonwn Event '%d' received", event); | ||||
| 		break; | ||||
|   | ||||
| @@ -35,7 +35,7 @@ OsEventHandlerBase::OsEventHandlerBase() | ||||
| 	_log = Logger::getInstance("EVENTS-OS"); | ||||
|  | ||||
| 	QCoreApplication* app = QCoreApplication::instance(); | ||||
| 	if (!qobject_cast<QApplication*>(app)) | ||||
| 	if (qobject_cast<QApplication*>(app) == nullptr) | ||||
| 	{ | ||||
| 		_isService = true; | ||||
| 	} | ||||
| @@ -46,6 +46,7 @@ OsEventHandlerBase::OsEventHandlerBase() | ||||
|  | ||||
| OsEventHandlerBase::~OsEventHandlerBase() | ||||
| { | ||||
| 	quit(); | ||||
| 	QObject::disconnect(this, &OsEventHandlerBase::signalEvent, EventHandler::getInstance().data(), &EventHandler::handleEvent); | ||||
|  | ||||
| 	OsEventHandlerBase::unregisterLockHandler(); | ||||
| @@ -130,6 +131,11 @@ void OsEventHandlerBase::lock(bool isLocked) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void OsEventHandlerBase::quit() | ||||
| { | ||||
| 	emit signalEvent(Event::Quit); | ||||
| } | ||||
|  | ||||
| #if defined(_WIN32) | ||||
|  | ||||
| OsEventHandlerWindows* OsEventHandlerWindows::getInstance() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user