Пример #1
0
Competences::Competences()
{	
	table = new QTableWidget();
	table->setColumnCount(8);

	QStringList liste;
	// Création des en-tête
	liste << "De classe" << "Innée" << "Compétence" << "Stat." << "Mod. compét." << "Mod. stat." << "Deg. maîtrise" << "Mod. divers";
	table->setHorizontalHeaderLabels(liste);

	nbCompetences = 0;
	setListCompetences();
	
	layoutPrincipal = new QVBoxLayout(this);
	layoutHaut = new QHBoxLayout();
	
	layoutPrincipal->addLayout(layoutHaut);
	layoutHaut->addWidget(new QLabel("Points à dépenser:"));
	aDepenser = new QLineEdit();
	aDepenser->setInputMask("99");
	aDepenser->setText("");
	aDepenser->setFixedSize(40,40);
	aDepenser->setAlignment(Qt::AlignCenter);
	layoutHaut->addWidget(aDepenser);
	
	layoutHaut->addStretch();
	
	layoutHaut->addWidget(new QLabel("Degré de maîtrise max.:"));
	degreMaitriseMaxI = new QLineEdit();
	degreMaitriseMaxI->setInputMask("99");
	degreMaitriseMaxI->setText("");
	degreMaitriseMaxI->setFixedSize(40,40);
	degreMaitriseMaxI->setAlignment(Qt::AlignCenter);
	layoutHaut->addWidget(degreMaitriseMaxI);
	
	layoutHaut->addWidget(new QLabel("/"));
	degreMaitriseMaxN = new QLineEdit();
	degreMaitriseMaxN->setInputMask("99");
	degreMaitriseMaxN->setText("");
	degreMaitriseMaxN->setFixedSize(40,40);
	degreMaitriseMaxN->setAlignment(Qt::AlignCenter);
	layoutHaut->addWidget(degreMaitriseMaxN);
	
	layoutPrincipal->addWidget(table);
	
	//Tri alphabétique des compétences
	table->sortItems(2);
	
	//Resize des colonnes
	table->resizeColumnsToContents();
	
	connect(&xmlManager,SIGNAL(requestCompetencesSave()),this,SLOT(receiveSaveRequest()));
	connect(this,SIGNAL(saveDone()),&xmlManager,SLOT(competencesSaved()));
}
Пример #2
0
// ------------------------------------------------------------------------
void DicomParser::okPressed()
{
	if(outputFolder.isEmpty())
	{
		outputFolder = QFileDialog::getExistingDirectory(this, 
				"Choose output directory","/Users/oliverferoze/Uni/Data/ValveTracking/Testing");
	}

	if(outputFolder.isEmpty())
		return;


	DicomSeriesList outputSeries;
	getSelectedSeries(outputSeries);

	for(unsigned int i = 0; i < outputSeries.size(); i++)
	{
		writeSeries(outputSeries[i], outputFolder);
	}

	emit saveDone(outputFolder);
	this->close();

}
Пример #3
0
void Dons::receiveSaveRequest()
{
	QDomElement elem;
	QDomAttr a;
	
	elem = xmlManager.getDons().firstChildElement("raceClasses");
	while(!elem.firstChild().isNull())										// Suppression des anciennes lignes
	{
		elem.removeChild(elem.firstChild());
	}
	for(int i=0;i<bonus->rowCount();i++)
	{
		QDomElement ligneTableau = xmlManager.getDoc().createElement("ligne");
		ligneTableau.setAttribute("numero",i);
		elem.appendChild(ligneTableau);
		
		for(int j=0;j<bonus->columnCount();j++)
		{
			QDomElement elemLigne;
		
			if(bonus->horizontalHeaderItem(j)->text() == "Don/Bonus")
				elemLigne = xmlManager.getDoc().createElement("donBonus");
			else
				elemLigne = xmlManager.getDoc().createElement(bonus->horizontalHeaderItem(j)->text());
				
			if(bonus->item(i,j) == NULL)
				elemLigne.setAttribute("value","");
			else
				elemLigne.setAttribute("value",bonus->item(i,j)->text());
			ligneTableau.appendChild(elemLigne);
		}
	}
	
	elem = xmlManager.getDons().firstChildElement("normaux");
	while(!elem.firstChild().isNull())										// Suppression des anciennes lignes
	{
		elem.removeChild(elem.firstChild());
	}
	for(int i=0;i<dons->rowCount();i++)
	{
		QDomElement ligneTableau = xmlManager.getDoc().createElement("ligne");
		ligneTableau.setAttribute("numero",i);
		elem.appendChild(ligneTableau);
		
		for(int j=0;j<dons->columnCount();j++)
		{
			QDomElement elemLigne;
		
			if(dons->horizontalHeaderItem(j)->text() == "Prérequis")
				elemLigne = xmlManager.getDoc().createElement("Prerequis");
			else
				elemLigne = xmlManager.getDoc().createElement(dons->horizontalHeaderItem(j)->text());
				
			if(dons->item(i,j) == NULL)
				elemLigne.setAttribute("value","");
			else
				elemLigne.setAttribute("value",dons->item(i,j)->text());
			ligneTableau.appendChild(elemLigne);
		}
	}
	
	emit saveDone();
}
Пример #4
0
Dons::Dons()
{	
	//Création de la bande bonus
	boutonAjoutBonus = new QPushButton("+");
		boutonAjoutBonus->setFixedWidth(25);
	boutonRetraitBonus = new QPushButton("-");
		boutonRetraitBonus->setFixedWidth(25);
	ligne1 = new QFrame();
		ligne1->setFrameStyle(QFrame::HLine | QFrame::Plain);
	l_bonus = new QLabel("Bonus raciaux et de classe");
		l_bonus->setAlignment(Qt::AlignCenter);
		l_bonus->setFixedWidth(175);
	ligne2 = new QFrame();
		ligne2->setFrameStyle(QFrame::HLine | QFrame::Plain);
	
	layoutBandeBonus = new QHBoxLayout();
		layoutBandeBonus->addWidget(boutonAjoutBonus);
		layoutBandeBonus->addWidget(boutonRetraitBonus);
		layoutBandeBonus->addWidget(ligne1);
		layoutBandeBonus->addWidget(l_bonus);
		layoutBandeBonus->addWidget(ligne2);
		
	//Création du tableau bonus
	bonus = new QTableWidget();
		bonus->setRowCount(2);
		bonus->setColumnCount(3);	
	QStringList liste;
	liste << "Don/Bonus" << "Effets" << "Informations";
	bonus->setHorizontalHeaderLabels(liste);
	
	//Création de la bande dons
	boutonAjoutDon = new QPushButton("+");
		boutonAjoutDon->setFixedWidth(25);
	boutonRetraitDon = new QPushButton("-");
		boutonRetraitDon->setFixedWidth(25);
	ligne3 = new QFrame();
		ligne3->setFrameStyle(QFrame::HLine | QFrame::Plain);
	l_dons = new QLabel("Dons");
		l_dons->setAlignment(Qt::AlignCenter);
		l_dons->setFixedWidth(50);
	ligne4 = new QFrame();
		ligne4->setFrameStyle(QFrame::HLine | QFrame::Plain);
		
	layoutBandeDons = new QHBoxLayout();
		layoutBandeDons->addWidget(boutonAjoutDon);
		layoutBandeDons->addWidget(boutonRetraitDon);
		layoutBandeDons->addWidget(ligne3);
		layoutBandeDons->addWidget(l_dons);
		layoutBandeDons->addWidget(ligne4);
	
	//Création du tableau dons
	dons = new QTableWidget();
		dons->setRowCount(2);
		dons->setColumnCount(4);
	liste.clear();
	liste << "Don" << "Prérequis" << "Effets" << "Notes";
	dons->setHorizontalHeaderLabels(liste);
		
	//Création du layout principal
	layout = new QVBoxLayout(this);
		layout->addLayout(layoutBandeBonus);
		layout->addWidget(bonus);
		layout->addLayout(layoutBandeDons);
		layout->addWidget(dons);

	//Connexion des signaux/slots
	connect(boutonAjoutBonus,SIGNAL(clicked()),this,SLOT(ajoutLigneBonus()));
	connect(boutonRetraitBonus,SIGNAL(clicked()),this,SLOT(retraitLigneBonus()));
	connect(boutonAjoutDon,SIGNAL(clicked()),this,SLOT(ajoutLigneDons()));
	connect(boutonRetraitDon,SIGNAL(clicked()),this,SLOT(retraitLigneDons()));
	
	connect(&xmlManager,SIGNAL(requestDonsSave()),this,SLOT(receiveSaveRequest()));
	connect(this,SIGNAL(saveDone()),&xmlManager,SLOT(donsSaved()));
}
Пример #5
0
int main(int argc, char *argv[])
{
    qRegisterMetaType<QVector<double> >("QVector<double>");

    QApplication a(argc, argv);

    argParse arguments;

    arguments.parseArgs(a.arguments());


    MainWindow w;

    packetFifo data_fifo;


    //pipeReader piperead("",1472,&data_fifo);
   // QThread pt;
   // piperead.moveToThread(&pt);
   //!! pt.start();


    //
    // Create fifo to store UDP raw data packets.
    //
    data_fifo.fillFifo(arguments.q_length,arguments.q_packetlen);

//!! nc -ul 192.168.1.102 50000 | ./testEnet

    //
    // set up udp receiver, and its own thread.
    //
    udpRcv myudp(&data_fifo);

    QThread udpth;
    myudp.moveToThread(&udpth);
    udpth.start(QThread::TimeCriticalPriority);

    //
    //set up packet parser, that splits udp data into two streams.
    //
    packetParse pparse(&data_fifo);
    QThread pparse_th;
    pparse.moveToThread(&pparse_th);
    pparse_th.start();

    dataQueue *stream_a = pparse.getOutQueueA();
    dataQueue *stream_b = pparse.getOutQueueB();

    //
    // set up two parsers.
    //


    roachParser parser_a(stream_a);
    roachParser parser_b(stream_b,128);

    QThread parseth_a;
    QThread parseth_b;

    parser_a.moveToThread(&parseth_a);
    parser_b.moveToThread(&parseth_b);

    //parser_a.setIsDumpInputDbg(true);
    //parser_b.setIsDumpInputDbg(true);
   parseth_a.start();
    parseth_b.start();


    //
    // Set up two file savers, one per parser.
    // streams to files.
    //
    //fileSaver fsave_a;
    //fileSaver fsave_b;
    hdfFileSaver fsave_a;
    hdfFileSaver fsave_b;

    fsave_a.setEventSource(&parser_a);
    fsave_b.setEventSource(&parser_b);


    QThread fsaveth_a;
    QThread fsaveth_b;

    fsave_a.moveToThread(&fsaveth_a);
    fsave_b.moveToThread(&fsaveth_b);
    fsaveth_a.start();
    fsaveth_b.start();



    //
    // Tell gui about all the objects we have.
    //


    w.setUdp(&myudp);
    w.addParser(&parser_a);
    w.addParser(&parser_b);
    w.setPacketParser(&pparse);
    w.setPacketFifo(&data_fifo);
    w.addSaver(&fsave_a);
    w.addSaver(&fsave_b);

    // start up the udp parser
    QMetaObject::invokeMethod(
                &pparse,
                "writeStreams",
                Qt::QueuedConnection);

    // connect udp parser output to the roach parsers.

    parser_a.connect(
                &pparse,
                SIGNAL(dataAvailA()),
                SLOT(parseStream()),
                Qt::QueuedConnection);

    parser_b.connect(
                &pparse,
                SIGNAL(dataAvailB()),
                SLOT(parseStream()),
                Qt::QueuedConnection);

    // timer for periodically updating gui
    QTimer disp_timer;
    disp_timer.start(200);
    w.connect(&disp_timer,SIGNAL(timeout()),SLOT(updateGui()),Qt::QueuedConnection);


    //
    // text commander. it is a text command interface that listens to a pipe.
    // text commands are sent to this pipe from other programs, to remote control
    // the gui of this program. python can then hit buttons or call any slot
    // in the q obhects here.
    //
    textCommander cmd(arguments.cmd_in_pipe_name,arguments.cmd_out_pipe_name);
    cmd.addNameObject("parser_a",&parser_a);
    cmd.addNameObject("parser_b",&parser_b);

    cmd.addNameObject("saver_a",&fsave_a);
    cmd.addNameObject("saver_b",&fsave_b);

    cmd.addNameObject("pparse",&pparse);
   // cmd.addNameObject("piperead",&piperead);
    cmd.addNameObject("w",&w);
    cmd.setAppName("roachstream");


    bool isc = cmd.connect(&fsave_a,SIGNAL(saveDone(QString)),SLOT(sendCommand(QString)),Qt::DirectConnection);

    isc = cmd.connect(&fsave_b,SIGNAL(saveDone(QString)),SLOT(sendCommand(QString)),Qt::DirectConnection);

#if 1
    QThread cmdth;
    cmd.moveToThread(&cmdth);
    cmdth.start();
    QMetaObject::invokeMethod(
             &cmd,
             "openInputPipe",
             Qt::AutoConnection);
     QMetaObject::invokeMethod(
         &cmd,
         "openOutputPipe",
         Qt::AutoConnection);
     QMetaObject::invokeMethod(
         &cmd,
         "waitNextCommand",
         Qt::AutoConnection);

#endif

    w.show();
    
    return a.exec();
}
Пример #6
0
void Competences::receiveSaveRequest()
{
	QDomElement elem;
	QDomAttr a;
	
	elem = xmlManager.getCompetences().firstChildElement("pointsADepenser");
	a = elem.attributeNode("value");
	a.setValue(aDepenser->text());
	
	elem = xmlManager.getCompetences().firstChildElement("degreMaitriseMax");
	a = elem.attributeNode("deClasse");
	a.setValue(degreMaitriseMaxI->text());
	a = elem.attributeNode("inconnue");
	a.setValue(degreMaitriseMaxN->text());
	
	elem = xmlManager.getCompetences().firstChildElement("liste");
	while(!elem.firstChild().isNull())										// Suppression des anciennes lignes
	{
		elem.removeChild(elem.firstChild());
	}
	for(int i=0;i<table->rowCount();i++)
	{
		QDomElement ligneTableau = xmlManager.getDoc().createElement("ligne");
		ligneTableau.setAttribute("numero",i);
		elem.appendChild(ligneTableau);
		
		QDomElement elemLigne;
		
		// compétence de classe ou non
		elemLigne = xmlManager.getDoc().createElement("deClasse");
		if(static_cast<QCheckBox*>(table->cellWidget(i,0))->isChecked())
			elemLigne.setAttribute("value","oui");
		else
			elemLigne.setAttribute("value","non");
		ligneTableau.appendChild(elemLigne);
		
		// nom de la compétence
		elemLigne = xmlManager.getDoc().createElement("nom");
		elemLigne.removeChild(elemLigne.firstChild());
		QDomText valeur = xmlManager.getDoc().createTextNode(static_cast<QLabel*>(table->cellWidget(i,2))->text());
		elemLigne.appendChild(valeur);
		ligneTableau.appendChild(elemLigne);
		
		// degré de maitrise
		elemLigne = xmlManager.getDoc().createElement("degreMaitrise");
		if(table->item(i,6) == NULL)
			elemLigne.setAttribute("value","");
		else
			elemLigne.setAttribute("value",table->item(i,6)->text());
		ligneTableau.appendChild(elemLigne);
		
		// modificateurs divers
		elemLigne = xmlManager.getDoc().createElement("modDivers");
		if(table->item(i,7) == NULL)
			elemLigne.setAttribute("value","");
		else
			elemLigne.setAttribute("value",table->item(i,7)->text());
		ligneTableau.appendChild(elemLigne);
	}
	
	emit saveDone();
}