QSize QTorrentItemDelegat::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const { try { Torrent* tor(index.data(QTorrentDisplayModel::TorrentRole).value<Torrent*>()); initStyleOption(const_cast<QStyleOptionViewItem*>(&option), index); if(tor != NULL) { return sizeHint(option, *tor); } else { return QSize(0, 0); } } catch(...) { qDebug() << "Exception in QTorrentItemDelegat::sizeHint"; } return QSize(0, 0); }
int main(int argc, char *argv[]) { QString Lang,LangDir; QSettings settings("qucs","qucs"); if(settings.contains("Language")) { Lang=settings.value("Language").toString(); } char * var = getenv ("QUCSDIR"); if (var != NULL) { QDir QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { LangDir = LANGUAGEDIR; } QApplication a(argc, argv); QTranslator tor( 0 ); if(Lang.isEmpty()) Lang = QString(QLocale::system().name()); tor.load( QString("qucs_") + Lang, LangDir); a.installTranslator( &tor ); QucsActiveFilter w; w.show(); return a.exec(); }
bool MetaTranslator::release( const QString& filename, bool verbose, bool ignoreUnfinished, Translator::SaveMode mode ) const { Translator tor( 0 ); int finished = 0; int unfinished = 0; int untranslated = 0; TMM::ConstIterator m; for ( m = mm.begin(); m != mm.end(); ++m ) { if ( m.key().type() != MetaTranslatorMessage::Obsolete ) { if ( m.key().translation().isEmpty() ) { untranslated++; } else { if ( m.key().type() == MetaTranslatorMessage::Unfinished ) unfinished++; else finished++; QByteArray context = m.key().context(); QByteArray sourceText = m.key().sourceText(); QByteArray comment = m.key().comment(); QByteArray translatorComment = m.key().translatorComment(); QStringList translations = m.key().translations(); if ( !ignoreUnfinished || m.key().type() != MetaTranslatorMessage::Unfinished ) { /* Drop the comment in (context, sourceText, comment), unless the context is empty, unless (context, sourceText, "") already exists or unless we already dropped the comment of (context, sourceText, comment0). */ if ( comment.isEmpty() || context.isEmpty() || contains(context, sourceText, "") || !tor.findMessage(context, sourceText, "").translation() .isNull() ) { tor.insert( m.key() ); } else { tor.insert( TranslatorMessage(context, sourceText, "", "", QString(), -1, translations) ); //filename and lineNumbers will be ignored from now. } } } } } bool saved = tor.save( filename, mode ); if ( saved && verbose ) fprintf( stderr, " %d finished, %d unfinished and %d untranslated messages\n", finished, unfinished, untranslated ); return saved; }
int main(int argc, char *argv[]) { qDebug() << "Starting OTA..."; QString session; QString plugin; int loop; for (loop = 1; loop <= argc; loop++) { QString s = argv[loop]; if (s == "-session") { loop++; if (loop > argc) break; session = argv[loop]; qDebug() << "Session:" << session; continue; } if (s == "-plugin") { loop++; if (loop > argc) break; plugin = argv[loop]; qDebug() << "Plugin:" << plugin; continue; } } QApplication a(argc, argv); QCoreApplication::setOrganizationName("OTA"); QCoreApplication::setApplicationName("OTA"); QTranslator tor(0); qDebug() << "Install INSTALL_DATA_DIR:" << INSTALL_DATA_DIR; qDebug() << "Install INSTALL_BIN_DIR:" << INSTALL_BIN_DIR; qDebug() << "Install INSTALL_DOCS_DIR:" << INSTALL_DOCS_DIR; qDebug() << "Install INSTALL_LIB_DIR:" << INSTALL_LIB_DIR; QString i18nDir = QString("%1/OTA/i18n").arg(INSTALL_DATA_DIR); QString i18nFilename = QString("ota_%1").arg(QLocale::system().name()); tor.load(i18nFilename, i18nDir); a.installTranslator( &tor ); //qDebug() << "OTA::main: using args" << session << plugin; OTA app(session, plugin); app.show(); return a.exec(); }
int main(int argc, char *argv[]) { // apply default settings QucsSettings.x = 100; QucsSettings.y = 50; QucsSettings.dx = 600; QucsSettings.dy = 350; QucsSettings.font = QFont("Helvetica", 12); QucsSettings.QucsHomeDir.setPath(QDir::homePath() + "/.qucs"); // is application relocated? char * var = getenv ("QUCSDIR"); QDir QucsDir; if (var != NULL) { QucsDir = QDir(QString(var)); QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; QucsSettings.LibDir = QucsDir.canonicalPath() + "/share/qucs/library/"; } else { QString QucsApplicationPath = QCoreApplication::applicationDirPath(); #ifdef __APPLE__ QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); #else QucsDir = QDir(QucsApplicationPath); QucsDir.cdUp(); #endif QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; QucsSettings.LibDir = QucsDir.canonicalPath() + "/share/qucs/library/"; } loadSettings(); UserLibDir.setPath(QucsSettings.QucsHomeDir.canonicalPath() + "/user_lib/"); QApplication a(argc, argv); a.setFont(QucsSettings.font); QTranslator tor( 0 ); QString lang = QucsSettings.Language; if(lang.isEmpty()) lang = QString(QLocale::system().name()); tor.load( QString("qucs_") + lang, QucsSettings.LangDir); a.installTranslator( &tor ); QucsLib *qucs = new QucsLib(); qucs->raise(); qucs->resize(QucsSettings.dx, QucsSettings.dy); // size and position ... qucs->move(QucsSettings.x, QucsSettings.y); // ... before "show" !!! qucs->show(); int result = a.exec(); saveApplSettings(qucs); delete qucs; return result; }
bool MetaTranslator::release( const QString& filename, bool verbose, QTranslator::SaveMode mode ) const { QTranslator tor( 0 ); int finished = 0; int unfinished = 0; int untranslated = 0; TMM::ConstIterator m; for ( m = mm.begin(); m != mm.end(); ++m ) { if ( m.key().type() != MetaTranslatorMessage::Obsolete ) { if ( m.key().translation().isEmpty() ) { untranslated++; } else { if ( m.key().type() == MetaTranslatorMessage::Unfinished ) unfinished++; else finished++; QCString context = m.key().context(); QCString sourceText = m.key().sourceText(); QCString comment = m.key().comment(); QString translation = m.key().translation(); /* Drop the comment in (context, sourceText, comment), unless (context, sourceText, "") already exists, or unless we already dropped the comment of (context, sourceText, comment0). */ if ( comment.isEmpty() || contains( context, sourceText, "" ) || !tor.findMessage( context, sourceText, "" ).translation() .isNull() ) { tor.insert( m.key() ); } else { tor.insert( QTranslatorMessage( context, sourceText, "", translation ) ); } } } } bool saved = tor.save( filename, mode ); if ( saved && verbose ) fprintf( stderr, " %d finished, %d unfinished and %d untranslated messages\n", finished, unfinished, untranslated ); return saved; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QString LangDir; // apply default settings QucsSettings.x = 200; QucsSettings.y = 100; QucsSettings.font = QFont("Helvetica", 12); QucsSettings.showConsole = true; // is application relocated? char * var = getenv ("QUCSDIR"); QDir QucsDir; if (var != NULL) { QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); LangDir = QDir::toNativeSeparators(QucsDirStr + "/share/qucs/lang/"); } else { QString QucsApplicationPath = QCoreApplication::applicationDirPath(); #ifdef __APPLE__ QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); #else QucsDir = QDir(QucsApplicationPath); QucsDir.cdUp(); #endif LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); a.setFont(QucsSettings.font); QTranslator tor( 0 ); QString Lang = QucsSettings.Language; if(Lang.isEmpty()) Lang = QString(QLocale::system().name()); tor.load( QString("qucs_") + Lang, LangDir); a.installTranslator( &tor ); QucsActiveFilter *w = new QucsActiveFilter(); w->raise(); w->move(QucsSettings.x, QucsSettings.y); // position before "show" !!! w->show(); int result = a.exec(); saveApplSettings(w); return result; }
/* void echange(void) { int i,j; for(i=0; i<N; i++) for(j=0;j<N;j++) mCal[i][j] = mAff[i][j]; } */ void initJeu(void) { int i,j; srandom(time(NULL)); for (i=1;i<N-1;i++) for (j=1;j<N-1;j++) { if (random()%2) mUni[i][j] = 0; else mUni[i][j] = -1; } tor(); echange(); }
int main( int argc, char ** argv ) { // apply default settings QucsSettings.x = 200; QucsSettings.y = 100; QucsSettings.font = QFont("Helvetica", 12); // is application relocated? char * var = getenv ("QUCSDIR"); if (var != NULL) { QDir QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { QucsSettings.LangDir = LANGUAGEDIR; } loadSettings(); QApplication a( argc, argv ); a.setFont(QucsSettings.font); QTranslator tor( 0 ); QString lang = QucsSettings.Language; if(lang.isEmpty()) lang = QString(QLocale::system().name()); tor.load( QString("qucs_") + lang, QucsSettings.LangDir); a.installTranslator( &tor ); QucsAttenuator *qucs = new QucsAttenuator(); //a.setMainWidget(qucs); qucs->raise(); qucs->move(QucsSettings.x, QucsSettings.y); // position before "show" !!! qucs->show(); int result = a.exec(); saveApplSettings(qucs); return result; // QApplication a( argc, argv ); // QucsAttenuator w; // w.show(); // a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); // return a.exec(); }
void QTorrentItemDelegat::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { try { Torrent* tor(index.data(QTorrentDisplayModel::TorrentRole).value<Torrent*>()); painter->save(); painter->setClipRect(option.rect); drawTorrent(painter, option, *tor, index); } catch(...) { qDebug() << "Excepion in QTorrentItemDelegat::paint"; } painter->restore(); }
void boucle(void) { int i,j,nbv; int changement = 0; while(changement >= 0) { changement = 0; for(i=1; i<N-1; i++) { for(j=1;j<N-1;j++) { nbv = nbVoisins(i,j); if (nbv == 3 && !mCal[i][j]) mAff[i][j] = true; else if ((nbv<=1 || nbv>=4) && mCal[i][j]) mAff[i][j] = false; else { mAff[i][j] = mCal[i][j]; changement++; } } } tor(); //Echange des matrices echange(); sleep(1); //affJeu(); affJeuSDL(); //Condition d'arrĂȘt if(changement == (N-2)*(N-2)) changement = -1; } /*for(i=1;i<N-1;i++) for(j=1;j<N-1;j++) SDL_FreeSurface(cellule[((i-1)*N)+j]); // LibĂ©ration de la surface SDL_Quit(); */ }
int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setFont(QFont("helvetica", 12)); QTranslator tor( 0 ); // set the location where your .qm files are in load() below as the last parameter instead of "." // for development, use "/" to use the english original as // .qm files are stored in the base project directory. tor.load( QString("qpart.") + QTextCodec::locale(), "." ); a.installTranslator( &tor ); /* uncomment the following line, if you want a Windows 95 look*/ // a.setStyle(WindowsStyle); QPartApp *qpart=new QPartApp(); a.setMainWidget(qpart); qpart->show(); return a.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setFont(QFont("helvetica", 12)); QTranslator tor( 0 ); // set the location where your .qm files are in load() below as the last parameter instead of "." // for development, use "/" to use the english original as // .qm files are stored in the base project directory. tor.load( QString("wcurve.") + QTextCodec::locale(), "." ); a.installTranslator( &tor ); WcurveApp *wcurve=new WcurveApp(); a.setMainWidget(wcurve); wcurve->show(); if(argc>1) wcurve->openDocumentFile(argv[1]); //else //wcurve->openDocumentFile(); return a.exec(); }
void initJeu(void) { int i,j; srandom(time(NULL)); for (i=1;i<N-1;i++) for (j=1;j<N-1;j++) { //~ if (random()%2) //~ mAff[i][j] = true; //~ else mAff[i][j] = false; } mAff[1][1]=true; mAff[1][2]=true; mAff[1][3]=true; mAff[3][1]=true; mAff[4][1]=true; mAff[4][4]=true; mAff[1][4]=true; tor(); echange(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); // apply default settings QucsSettings.x = 100; QucsSettings.y = 50; QucsSettings.dx = 540; QucsSettings.dy = 400; QucsSettings.font = QFont("Helvetica", 12); QucsSettings.length_unit = 0; QucsSettings.res_unit = 0; QucsSettings.ang_unit = 0; QucsSettings.freq_unit = 0; QucsSettings.QucsHomeDir.setPath(QDir::homePath() + "/.qucs"); // is application relocated? char * var = getenv ("QUCSDIR"); QDir QucsDir; if (var != NULL) { QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { QString QucsApplicationPath = QCoreApplication::applicationDirPath(); #ifdef __APPLE__ QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); #else QucsDir = QDir(QucsApplicationPath); QucsDir.cdUp(); #endif QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); a.setFont(QucsSettings.font); QTranslator tor( 0 ); QString lang = QucsSettings.Language; if(lang.isEmpty()) lang = QString(QLocale::system().name()); tor.load( QString("qucs_") + lang, QucsSettings.LangDir); a.installTranslator( &tor ); QucsTranscalc *qucs = new QucsTranscalc(); qucs->raise(); qucs->resize(QucsSettings.dx, QucsSettings.dy); // size and position ... qucs->move(QucsSettings.x, QucsSettings.y); // ... before "show" !!! qucs->show(); // load file with all the GUI input values from the Qucs Home qucs->loadFile(QucsSettings.QucsHomeDir.filePath("transrc")); qucs->setMode(QucsSettings.Mode); // optional file argument if (argc > 1) { int _mode = 0; QString File = argv[1]; qucs->loadFile(File,&_mode); } int result = a.exec(); saveApplSettings(qucs); // save file with all the GUI input values in the Qucs Home qucs->saveModes(QucsSettings.QucsHomeDir.filePath("transrc")); delete qucs; return result; }
int main(int argc, char *argv[]) { // apply default settings QucsSettings.x = 60; QucsSettings.y = 30; QucsSettings.dx = 640; QucsSettings.dy = 400; QucsSettings.font = QFont("Helvetica", 12); // is application relocated? char * var = getenv ("QUCSDIR"); if (var != NULL) { QDir QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.DocDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/docs/"); QucsSettings.BitmapDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/bitmaps/"); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { QucsSettings.DocDir = DOCDIR; QucsSettings.BitmapDir = BITMAPDIR; QucsSettings.LangDir = LANGUAGEDIR; } loadSettings(); QApplication a(argc, argv); a.setFont(QucsSettings.font); QTranslator tor( 0 ); QString locale = QucsSettings.Language; if(locale.isEmpty()) locale = QTextCodec::locale(); tor.load( QString("qucs_") + locale, QucsSettings.LangDir); a.installTranslator( &tor ); QucsHelpDir = QucsSettings.DocDir + locale; if (!QucsHelpDir.exists () || !QucsHelpDir.isReadable ()) { int p = locale.find ('_'); if (p != -1) { QucsHelpDir = QucsSettings.DocDir + locale.left (p); if (!QucsHelpDir.exists () || !QucsHelpDir.isReadable ()) { QucsHelpDir = QucsSettings.DocDir + "en"; } } else QucsHelpDir = QucsSettings.DocDir + "en"; } QString Page; if(argc > 1) Page = argv[1]; QucsHelp *qucs = new QucsHelp(Page); a.setMainWidget(qucs); qucs->resize(QucsSettings.dx, QucsSettings.dy); // size and position ... qucs->move(QucsSettings.x, QucsSettings.y); // ... before "show" !!! qucs->show(); int result = a.exec(); saveApplSettings(qucs); return result; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); // apply default settings QucsSettings.x = 60; QucsSettings.y = 30; QucsSettings.dx = 640; QucsSettings.dy = 400; QucsSettings.font = QFont("Helvetica", 12); // is application relocated? char * var = getenv ("QUCSDIR"); QDir QucsDir; if (var != NULL) { QucsDir = QDir (QString(var)); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.DocDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/docs/"); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { QString QucsApplicationPath = QCoreApplication::applicationDirPath(); #ifdef __APPLE__ QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); #else QucsDir = QDir(QucsApplicationPath); QucsDir.cdUp(); #endif QucsSettings.DocDir = QucsDir.canonicalPath() + "/share/qucs/docs/"; QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); a.setFont(QucsSettings.font); QTranslator tor( 0 ); QString locale = QucsSettings.Language; if(locale.isEmpty()) locale = QString(QLocale::system().name()); tor.load( QString("qucs_") + locale, QucsSettings.LangDir); a.installTranslator( &tor ); QucsHelpDir = QucsSettings.DocDir + locale; if (!QucsHelpDir.exists () || !QucsHelpDir.isReadable ()) { int p = locale.indexOf ('_'); if (p != -1) { QucsHelpDir = QucsSettings.DocDir + locale.left (p); if (!QucsHelpDir.exists () || !QucsHelpDir.isReadable ()) { QucsHelpDir = QucsSettings.DocDir + "en"; } } else QucsHelpDir = QucsSettings.DocDir + "en"; } QString Page; if(argc > 1) Page = argv[1]; qInstallMsgHandler(qucsMessageOutput); QucsHelp *qucs = new QucsHelp(Page); //a.setMainWidget(qucs); qucs->resize(QucsSettings.dx, QucsSettings.dy); // size and position ... qucs->move(QucsSettings.x, QucsSettings.y); // ... before "show" !!! qucs->show(); int result = a.exec(); saveApplSettings(qucs); return result; }
int main(int argc, char *argv[]) { /* // signals handling for(int i=0; i<NSIG; i++) signal(i, signalhandler); */ struct sigaction act; #ifdef SA_RESTART act.sa_flags = SA_RESTART; #else act.sa_flags = 0; #endif act.sa_handler = sigchld; if(sigaction(SIGCHLD, &act, NULL) == -1) perror("sigaction(SIGCLHD)"); act.sa_handler = sigpipe; if(sigaction(SIGPIPE, &act, NULL) == -1) perror("sigaction(SIGPIPE)"); act.sa_handler = sigusr1; if(sigaction(SIGUSR1, &act, NULL) == -1) perror("sigaction(SIGUSR1)"); QApplication a(argc, argv); //a.setFont(QFont("helvetica", 12)); QTranslator tor( 0 ); // set the location where your .qm files are in load() below as the last parameter instead of "." // for development, use "/" to use the english original as // .qm files are stored in the base project directory. QLocale localLang; #ifdef xxLINUX g_application_path = QString("/usr/share/piaf"); QDir dir("/usr/share/piaf"); #else QDir dir(QApplication::applicationDirPath()); QString g_application_path = QApplication::applicationDirPath(); #endif QString translationFile = QString("piaf_") + localLang.languageToString(localLang.language()) + QString(".qm"); fprintf(stderr, "Translation file='%s'\n", translationFile.ascii()); tor.load( translationFile, dir.absolutePath() ); a.installTranslator( &tor ); WorkshopApp * workshop = new WorkshopApp(); a.setMainWidget(workshop); workshop->show(); /* if(argc>1) workshop->openDocumentFile(argv[1]); else workshop->openDocumentFile(); */ return a.exec(); }
int main (int argc, char * argv []) { // apply default settings QucsSettings.x = 200; QucsSettings.y = 100; QucsSettings.font = QFont("Helvetica", 12); // is application relocated? char * var = getenv ("QUCSDIR"); QDir QucsDir; if (var != NULL) { QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { QString QucsApplicationPath = QCoreApplication::applicationDirPath(); #ifdef __APPLE__ QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); #else QucsDir = QDir(QucsApplicationPath); QucsDir.cdUp(); #endif QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); QApplication app (argc, argv); qf_spec* spec_p; int result = 0; app.setFont( QucsSettings.font ); QTranslator tor( 0 ); QString lang = QucsSettings.Language; if(lang.isEmpty()) lang = QTextCodec::locale(); tor.load( QString("qucs_") + lang, QucsSettings.LangDir); app.installTranslator( &tor ); qf_box Filterbox; Filterbox.setFont (QucsSettings.font); Filterbox.move (QucsSettings.x, QucsSettings.y); Filterbox.show (); Filterbox.FilterName->setCurrentItem (QucsSettings.type); Filterbox.on_FilterName_activated (QucsSettings.form); Filterbox.TformName->setCurrentItem (QucsSettings.form); Filterbox.on_TformName_activated (QucsSettings.type); Filterbox.EnterCutoff->setText (QString::number (QucsSettings.cutoff)); Filterbox.CutoffCombo->setCurrentItem (QucsSettings.cutoff_unit); Filterbox.EnterZin->setText (QString::number (QucsSettings.zin)); Filterbox.EnterZout->setText (QString::number (QucsSettings.zout)); Filterbox.OrderBox->setChecked (QucsSettings.specify); Filterbox.OrderCombo->setCurrentItem (QucsSettings.ord); Filterbox.SubOrderCombo->setCurrentItem (QucsSettings.subord); Filterbox.EnterBandwidth->setText (QString::number (QucsSettings.bw)); Filterbox.BandwidthCombo->setCurrentItem (QucsSettings.bw_unit); Filterbox.EnterStopband->setText (QString::number (QucsSettings.sb)); Filterbox.StopbandCombo->setCurrentItem (QucsSettings.sb_unit); Filterbox.EnterRipple->setText (QString::number (QucsSettings.ripple)); Filterbox.EnterAngle->setText (QString::number (QucsSettings.angle)); Filterbox.EnterAttenuation->setText (QString::number (QucsSettings.atten)); while (true) { if (Filterbox. exec () != QDialog::Accepted) break; spec_p = Filterbox. get_spec (); QByteArray buf; Q3TextStream s (buf, QIODevice::ReadWrite); compute_lumped (spec_p, s); // FIXME #warning s. device () -> flush (); QClipboard *cb = QApplication::clipboard(); cb->setText(buf); } saveSettings (&Filterbox); saveXmlSettings (&Filterbox); return result; }
void * thread(void *a) { int i,j,nbv; int numThread; numThread = -1; bool fin = true; /* On incremente le nombre de threads lances * et on assigne un numero au thread courant */ pthread_mutex_lock(&m1); numThread = nb_th_lance ; nb_th_lance++; //printf("MUTEX1\n numThread = %d\n nb_th_lance = %d\n",numThread,nb_th_lance); pthread_mutex_unlock(&m1); while(fin) { //printf("WHILE\n TID : %d - Num : %d\n",(unsigned int)pthread_self(),numThread); for(i=(numThread*NB_LIGNES_PAR_THREADS)+1; i<(numThread*NB_LIGNES_PAR_THREADS)+NB_LIGNES_PAR_THREADS+1; i++) { for(j=1;j<N-1;j++) { nbv = nbVoisins(i,j); if (nbv == 3 && !mCal[i][j]) mAff[i][j] = true; else if ((nbv<=1 || nbv>=4) && mCal[i][j]) mAff[i][j] = false; else { mAff[i][j] = mCal[i][j]; } } } pthread_mutex_lock(&m2); //printf("MUTEX\n TID : %d - Num : %d\n",(unsigned int)pthread_self(),numThread); nb_th_finis++; if (nb_th_finis == NB_THREADS) { tor(); echange(); affJeuSDL(); nb_th_finis = 0; pthread_cond_broadcast(&cond); } else{ pthread_cond_wait(&cond,&m2); } while(SDL_PollEvent(&event) ){ if( event.type == SDL_QUIT ) fin = false;//On quitte le programme } pthread_mutex_unlock(&m2); //sleep(1); } SDL_FreeSurface(cellule); SDL_Quit(); pthread_exit(NULL); return NULL; }