Skip to content

Commit

Permalink
Fix issue where progress bar remains at 0 in qcli
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Gervais <gervais.maxime@gmail.com>
  • Loading branch information
g-maxime committed Dec 18, 2024
1 parent 5afda38 commit 90dd3a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
16 changes: 7 additions & 9 deletions Source/Cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <Core/logging.h>
#include <clocale>

Cli::Cli() : indexOfStreamWithKnownFrameCount(0), statsFileBytesWritten(0), statsFileBytesTotal(0), statsFileBytesUploaded(0), statsFileBytesToUpload(0)
Cli::Cli() : statsFileBytesWritten(0), statsFileBytesTotal(0), statsFileBytesUploaded(0), statsFileBytesToUpload(0)
{

}
Expand Down Expand Up @@ -671,12 +671,6 @@ int Cli::exec(QCoreApplication &a)
return InvalidInput;
}

for(int i = 0; i < info->Stats.size(); ++i)
{
if(info->Frames_Count_Get(i) > info->Frames_Count_Get(indexOfStreamWithKnownFrameCount))
indexOfStreamWithKnownFrameCount = i;
}

if(!info->hasStats() || forceOutput)
{
// parse
Expand Down Expand Up @@ -812,8 +806,12 @@ int Cli::exec(QCoreApplication &a)

void Cli::updateParsingProgress()
{
int value = info->Frames_Pos_Get(indexOfStreamWithKnownFrameCount) * progress->getMax() /
info->Frames_Count_Get(indexOfStreamWithKnownFrameCount);
CommonStats* stat = info->ReferenceStat();
if(!stat)
return;

int value = stat->x_Current * progress->getMax() /
stat->x_Current_Max;

progress->setValue(value);
}
Expand Down
1 change: 0 additions & 1 deletion Source/Cli/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public slots:
std::unique_ptr<SignalServer> signalServer;

QTimer progressTimer;
int indexOfStreamWithKnownFrameCount;

quint64 statsFileBytesWritten;
quint64 statsFileBytesTotal;
Expand Down

0 comments on commit 90dd3a6

Please sign in to comment.