std::list<Cours> LesCours::CoursEns(){ std::list<Cours> LCours; // liste des cours lu boolean pareil; std::ifstream fichier1("etu_co.txt"); std::string monNom; if (fichier1.is_open()) { getline(fichier1, monNom); fichier1.close(); } if (monNom != "") { std::ifstream fichier("liste_cours_ens.txt");// fichier à lire std::string monTableau; if (fichier.is_open()) { //array<String^>^ tab = gcnew array<String^>(100); bool res = false; //int i = 0; while (getline(fichier, monTableau)) { // on vérifie si la ligne n'est pas vide if (monTableau != "") { Cours cours; // création d'un cours cours std::string delimiter = ";"; // délimiteur qui permet de split la ligne // on récupére le titre PS: attention a l'ordre dans le fichier std::string ID = monTableau.substr(0, monTableau.find(delimiter)); monTableau.erase(0, monTableau.find(delimiter) + delimiter.length()); //On suprime de la string la partie utiliser pour pouvoir effectuer un nouveau split // on récupére l'enseignant PS: attention a l'ordre dans le fichier std::string enseignant = monTableau.substr(0, monTableau.find(delimiter)); monTableau.erase(0, monTableau.find(delimiter) + delimiter.length()); //On suprime de la string la partie utiliser pour pouvoir effectuer un nouveau split // on récupére le titre PS: attention a l'ordre dans le fichier std::string titre = monTableau.substr(0, monTableau.find(delimiter)); monTableau.erase(0, monTableau.find(delimiter) + delimiter.length()); //On suprime de la string la partie utiliser pour pouvoir effectuer un nouveau split // on récupére la description PS: attention a l'ordre dans le fichier std::string description = monTableau.substr(0, monTableau.find(delimiter)); monTableau.erase(0, monTableau.find(delimiter) + delimiter.length()); //On suprime de la string la partie utiliser pour pouvoir effectuer un nouveau split // on récupére la description PS: attention a l'ordre dans le fichier std::string State = monTableau.substr(0, monTableau.find(delimiter)); monTableau.erase(0, monTableau.find(delimiter) + delimiter.length()); //On suprime de la string la partie utiliser pour pouvoir effectuer un nouveau split if (enseignant == monNom){ if (ID != ""){ cours.setId(ID); } if (enseignant != ""){ cours.setEnseignant(enseignant); } if (titre != ""){ cours.setTitre(titre); } if (description != ""){ cours.setDesciption(description); } if (State != ""){ cours.setState(State); } LCours.push_back(cours); // on ajoute à la liste le cours } } } fichier.close(); return LCours; } } return LCours; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { //discoveryAgent = new QBluetoothDeviceDiscoveryAgent(); ui->setupUi(this); VALEURSON = 50; ui->label_3->setText(QString::number(VALEURSON)); ui->label->setStyleSheet("color : #DD0A21 "); //Bouton 1 QFile fichier("/storage/sdcard0/Download/img/ar.png"); if(fichier.exists()) { qDebug("Bouton_0"); ui->pushButton->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/ar.png);""background-repeat: no-repeat;""background-position: center;"); } //Bouton2 QFile fichier1("/storage/sdcard0/Download/img/fr.png"); if(fichier1.exists()){ ui->pushButton_2->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/fr.png);""background-repeat: no-repeat;""background-position: center;"); } fichier1.close(); QFile fichierB_R("/storage/sdcard0/Download/img/B_Right.png"); if(fichierB_R.exists()){ ui->pushButton_6->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/B_Right.png);""background-repeat: no-repeat;""background-position: center; "); } fichierB_R.close(); QFile fichierB_TOP("/storage/sdcard0/Download/img/B_TOP.png"); if(fichierB_TOP.exists()){ ui->pushButton_3->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/B_TOP.png);""background-repeat: no-repeat;""background-position: center; "); } fichierB_TOP.close(); QFile fichierB_BOT("/storage/sdcard0/Download/img/B_BOT.png"); if(fichierB_BOT.exists()){ ui->pushButton_4->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/B_BOT.png);""background-repeat: no-repeat;""background-position: center; "); } fichierB_BOT.close(); QFile fichierB_L("/storage/sdcard0/Download/img/B_Left.png"); if(fichierB_L.exists()){ ui->pushButton_5->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/B_Left.png);""background-repeat: no-repeat;""background-position: center; "); } fichierB_L.close(); QFile fichierV_L("/storage/sdcard0/Download/img/V_L.png"); if(fichierV_L.exists()){ ui->pushButton_8->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/V_L.png);""background-repeat: no-repeat;""background-position: center; "); } fichierV_L.close(); QFile fichierV_M("/storage/sdcard0/Download/img/V_M.png"); if(fichierV_M.exists()){ qDebug("Bouton_2"); ui->pushButton_7->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/V_M.png);""background-repeat: no-repeat;""background-position: center; "); } fichierV_M.close(); QFile fichierV("/storage/sdcard0/Download/img/V.png"); if(fichierV.exists()){ qDebug("Bouton_2"); ui->label_4->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/V.png);""background-repeat: no-repeat;""background-position: center; "); } fichierV.close(); QFile fichierACT("/storage/sdcard0/Download/img/ACTION.png"); if(fichierACT.exists()){ qDebug("Bouton_2"); ui->label_5->setStyleSheet("background-image: url( /storage/sdcard0/Download/img/ACTION.png);""background-repeat: no-repeat;""background-position: center; "); } fichierACT.close(); QFile fichierconf("/storage/sdcard0/Download/Pupitre/titre.txt"); if(fichierconf.open(QIODevice::ReadOnly | QIODevice::Text)){ while (!fichierconf.atEnd()) { QString RDLINE = fichierconf.readLine(); NamePup << RDLINE; } } fichierconf.close(); tableFormat.setBorder(0); PupNbr = 1; STATE = 0; strPupNbr= '0' + QString::number(PupNbr); myNickName = client.nickName(); CheckWifiState(); //connect(ui->SonSlider, SIGNAL(valueChanged(int)),this, SLOT(on_SonSlider_Move()));// initialis e le slider connect(&client, SIGNAL(newMessage(QString,QString)), this, SLOT(appendMessage(QString,QString))); }