Esempio n. 1
0
void MainWindow::createActions()
{
    quitAction = new QAction(tr("exit"), this);
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(thread, SIGNAL(alert(QString)), this, SLOT(doAlert(QString)));
}
Esempio n. 2
0
void HookThread::Execute(void * data) {
	apmOptions = LoadAPMAlertOptions();

	RazerMonitorThread * rmt = new RazerMonitorThread();
	HotkeyThread * hkt = new HotkeyThread();
	rmt->Start(NULL);
	hkt->Start(NULL);

	bool wasIngame = false;

	while(!isTerminated()) {
		if(!hooksSetup) {
			SetupHooks();
			if(!hooksSetup)
				Sleep(5000);
		}
		else {
			if(isIngame && !wasIngame) {
				logInfo("Game detected. Beginning initialization.");
				isObs = true;
				if(apmOptions != NULL)
					FreeAPMAlertOptions(apmOptions);
				apmOptions = LoadAPMAlertOptions();
				if(pApmFont != NULL) pApmFont->Release();
				if(pClockFont != NULL) pClockFont->Release();
				if(pLine != NULL) pLine->Release();
				pApmFont = NULL;
				pClockFont = NULL;
				pLine = NULL;
				initializeAPMCalculator();
				minPassed = false;
				WriteHooks();
				wasIngame = isIngame;
			}
			else if(wasIngame && !isIngame) {
				logInfo("Game end detected.");
				ClearHooks();
				wasIngame = isIngame;
			}

			if(isIngame) {
				doAlert();
			}
		}
		Sleep(100);
	}
	logInfo("APMAlert2 beginning termination.");
	rmt->setTerminated(true);
	hkt->setTerminated(true);

	ClearHooks();
	logInfo("Freeing resources.");
	if(pApmFont != NULL) {
		pApmFont->Release();
		pApmFont = NULL;
	}
	if(pClockFont != NULL) {
		pClockFont->Release();
		pClockFont = NULL;
	}
	if(pLine != NULL) {
		pLine->Release();
		pLine = NULL;
	}
	if(apmOptions != NULL)
		FreeAPMAlertOptions(apmOptions);
	logInfo("Termination complete.");
	freeLogger();
}