void GetWhichPID() { QString temp = QString::number(pidproc); Status = false; QString fileLine; QRegExp nameReg(name); QRegExp exitState("Name"); QFile StateFile(QString("/proc/%1/status").arg(temp)); if(debugThisClass) qDebug() << "FILE : " << QString("/proc/%1/status").arg(temp); if(StateFile.open(QFile::ReadOnly)) { // 0 if(debugThisClass) qDebug() << "open file"; // Now we get a line dividing it, reject spaces and see the process name // if the name coincided with the one stored in our class, then we return true while(StateFile.atEnd()) { // 1.0 fileLine = StateFile.readLine(1024); if(fileLine.contains(nameReg)>0) Status = true; if(fileLine.contains(exitState)>0) break; } // 1.0 } // 0 StateFile.close(); } // GetWhichPID
void RDCutDialog::LoadState() { QString state_file = StateFile(); if(state_file.isEmpty()) { return; } RDProfile *p=new RDProfile(); p->setSource(state_file); bool value_read = false; cart_limit_box->setChecked(p->boolValue("RDCartDialog", "LimitSearch", true, &value_read)); delete p; }
void RDCutDialog::SaveState() { FILE *f=NULL; QString state_file = StateFile(); if(state_file.isEmpty()) { return; } if((f=fopen(state_file,"w"))==NULL) { return; } fprintf(f,"[RDCartDialog]\n"); if(cart_limit_box->isChecked()) { fprintf(f,"LimitSearch=Yes\n"); } else { fprintf(f,"LimitSearch=No\n"); } fclose(f); }