コード例 #1
0
ファイル: mainprocess.cpp プロジェクト: c-goldschmidt/XRLCD
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!";
}
コード例 #2
0
ファイル: mainprocess.cpp プロジェクト: c-goldschmidt/XRLCD
void MainProcess::run(){
	QString line;
	if (keepRunning) {

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

		emit runAgain();
	}
	emit done();
}
コード例 #3
0
ファイル: cubic_roots.c プロジェクト: aparajitamehta/repo1
int main() { 
	double a, b, c, d; 
	double rootfloor, rootceil;
	printf("This program will compute the roots of a cubic equation in the form:\n"); 
	puts("Ax^3 + Bx^2 + Cx + D = 0"); 
	printf("--------------------------------------------------------------------\n"); 
	printf("Input the coefficients A, B, C, and the constant D separated by a space:\n");
	scanf("%lf %lf %lf %lf", &a, &b, &c, &d); 
	printf("rootSearch Lower limit: "); 
	scanf("%lf", &rootfloor); 
	printf("rootSearch Upper limit: "); 
	scanf("%lf", &rootceil);
	rootSearch(a, b, c, d, rootfloor, rootceil);
	runAgain();
	return 0; 
}