Exemple #1
0
MainProcess::MainProcess(QObject *parent) : QThread(parent) {
	QString settingsFile = QCoreApplication::applicationDirPath() + "/settings.ini";
	settings = new QSettings(settingsFile, QSettings::IniFormat);
	
	parser = new LogParser(settings, this);
	ctrl = new LCDController(this);

	QString logfile = settings->value("main/logfile", "").toString();

	file = new QFile(logfile);
	if (logfile != "") {
		keepRunning = file->open(QIODevice::ReadOnly | QIODevice::Text);
	} else {
		keepRunning = false;
	}	
	
	if (!keepRunning) {
		qDebug() << "error opening file!";
		system("pause");
	}

	connect(this, SIGNAL(runAgain()), this, SLOT(run()));
	connect(this, SIGNAL(lineRead(QString)), parser, SLOT(parseLine(QString)));
	connect(parser, SIGNAL(setValues(LogParser::infopackage)), ctrl, SLOT(setValues(LogParser::infopackage)));

	//TODO: non win-specific version
	SetConsoleCtrlHandler((PHANDLER_ROUTINE) handleSIGINT, TRUE);

	qDebug() << "up and running!";
}
void Horus::ServerEmulator::Core::EmulatorTest::initTestCase()
{
    m_reader.configure(m_file_path);

    connect(
        &m_emulator, SIGNAL(startSuccess()),
        this, SLOT(onStartSuccess()), Qt::DirectConnection);
    connect(
        &m_emulator, SIGNAL(printToConsoleCalled(QString)),
        this, SLOT(onPrintToConsoleCalled(const QString&)), Qt::DirectConnection);
    connect(
        &m_reader, SIGNAL(lineRead(QString)),
        this, SLOT(onFileLineRead(QString)), Qt::DirectConnection);

    m_file_expected_strings.reset();
    m_console_expected_strings.reset();

    m_console_expected_strings.append("IL-2 Horus Team: IL-2 FB dedicated server emulator");
    m_console_expected_strings.append("  *** Library **** DT ****  Loaded *** XXX");
    m_console_expected_strings.append("RTS Version Y.Y");
    m_console_expected_strings.append("Core Version Z.Z");
    m_console_expected_strings.append("Sound: Native library (build Q.Q, target - TTTT) loaded.");
    m_console_expected_strings.append("IL2 FB dedicated server vAA.BB.CC");
    m_console_expected_strings.append("1>");
}
Exemple #3
0
void MainProcess::run(){
	QString line;
	if (keepRunning) {

		if (file->bytesAvailable()) {
			emit lineRead(file->readLine());
		} else {
			sleep(1);
		}

		emit runAgain();
	}
	emit done();
}