Changeset d88fa1f


Ignore:
Timestamp:
04/16/14 00:15:26 (12 months ago)
Author:
yurkis <yurkis@…>
Branches:
master, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1
Children:
d49234e
Parents:
db1e5a0
Message:

Changes to DLProcess class: Process output and fifo pipe are separated by events. Now PKG downloads can also get process output. That was needed for Update manager pkg output parser.

Location:
src-qt4/libpcbsd/utils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/libpcbsd/utils/pcbsd-DLProcess.cpp

    r23e7b34 rd88fa1f  
    55  this->setProcessChannelMode(QProcess::MergedChannels); 
    66  //Setup the internal signals/slots 
    7   connect(this, SIGNAL(readyRead()), this, SLOT(newMessage()) ); 
     7  connect(this, SIGNAL(readyRead()), this, SLOT(newProcessMessage()) ); 
    88  connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(ProcFinished()) ); 
    99  //Flag as no output parsing at the moment 
     
    4242    watcher = new QProcess(this); 
    4343          watcher->start("cat", QStringList() << "-u" << pipeFile ); 
    44           connect(watcher, SIGNAL(readyRead()), this, SLOT(newMessage()) ); 
     44          connect(watcher, SIGNAL(readyRead()), this, SLOT(newPipeMessage()) ); 
    4545    QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); 
    4646      env.insert("PCFETCHGUI","YES"); //For readable download notifications 
    4747      env.insert("EVENT_PIPE", pipeFile); 
    48     this->setProcessEnvironment(env); 
    49     //Disconnect the main process from the parser 
    50     disconnect(SIGNAL(readyRead()), this, SLOT(newMessage()) ); 
     48    this->setProcessEnvironment(env);     
    5149     
    5250  }else if(type=="cdn"){ 
     
    179177        //Now calculate the stats and emit the signal 
    180178        calculateStats(dl, tot, "", file); 
    181      }   
     179     } 
    182180} 
    183181 
     
    207205} 
    208206 
    209 void DLProcess::newMessage(){ 
    210   if(DLTYPE == 1){ 
     207void DLProcess::newPipeMessage() 
     208{ 
    211209    //PKG type pulls info from a different QProcess 
    212     while(watcher->canReadLine()){ 
    213        QString line = watcher->readLine().simplified(); 
    214         if(line.isEmpty()){ continue; } 
    215         parsePKGLine(line); 
     210    while(watcher->canReadLine()) 
     211    { 
     212        QString line = watcher->readLine().simplified(); 
     213        if(line.isEmpty()){ continue; } 
     214        parsePKGLine(line); 
    216215    } 
    217      
    218   }else{           
    219     //All other DL types pull from the main process 
    220            
     216} 
     217 
     218void DLProcess::newProcessMessage() 
     219{ 
    221220    while(this->canReadLine()){ 
    222221      QString line = this->readLine().simplified(); 
     
    233232      } 
    234233    }//End of loop over main process lines 
    235      
    236   } //end check of PKG type 
    237 } 
     234} 
  • src-qt4/libpcbsd/utils/pcbsd-DLProcess.h

    rdd91d89 rd88fa1f  
    3232private slots: 
    3333        void ProcFinished(); 
    34         void newMessage(); 
     34    void newProcessMessage(); 
     35    void newPipeMessage(); 
    3536 
    3637signals: 
Note: See TracChangeset for help on using the changeset viewer.