mardi 3 mars 2015

QProcess output like terminal emulator


I'm starting youtube-dl app from QProcess to get the ouput log into a QListWidget. I ran into the problem about how to process the data, here is the important code:



void MyQtYoutubedl::myprocessreadStdOutput () {
QProcess *_refProcess = m_Process.data();
QTextStream stream(_refProcess);
while (!stream.atEnd()) {
QString line = stream.readLine();
ui->logWidget->addItem (line.simplified());
}
}


I'm not having problems with launched app, is how to propertly show it in the QListWidget, because I'm getting this type of output:



[youtube] sz24ohfRmbo: Downloading webpage

[youtube] sz24ohfRmbo: Extracting video information

[youtube] sz24ohfRmbo: Downloading DASH manifest

[download] Destination: some video.mp4

[download] 1% of 8.31MiB in 00:07

[download] 10% of 8.31MiB in 00:07

[download] 40% of 8.31MiB in 00:07

[download] 100% of 8.31MiB in 00:07



And I'd like to have it like this:



[youtube] sz24ohfRmbo: Extracting video information

[youtube] sz24ohfRmbo: Downloading DASH manifest

[download] Destination: some video.mp4

** [download] 100% of 8.31MiB in 00:07



** keep in the same line until finished.




Aucun commentaire:

Enregistrer un commentaire