From c0683537a10e88dbcb2c61b10f4213e77516309d Mon Sep 17 00:00:00 2001 From: legatvs Date: Sat, 20 Nov 2010 11:00:17 +0200 Subject: [PATCH] fix file length check --- src/i/MainWindow.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/i/MainWindow.cpp b/src/i/MainWindow.cpp index e4260c6..11109a7 100644 --- a/src/i/MainWindow.cpp +++ b/src/i/MainWindow.cpp @@ -94,8 +94,8 @@ MainWindow::MainWindow () download = new Download (this); #ifdef _0 download->setLabelText (tr ("Copying...")); -#endif download->setCancelButtonText (tr ("&Abort")); +#endif connect (download, SIGNAL (error (QString)), this, SLOT (onDownloadError (QString))); @@ -450,7 +450,7 @@ MainWindow::downloadVideo () { const qint64 expected_bytes = video->get (Video::Length).toLongLong (); - if (QFileInfo (fpath).size () != expected_bytes) { + if (QFileInfo (fpath).size () < expected_bytes) { const QString cmd = shPrefs.get (SharedPreferences::CurlPath).toString ().simplified (); @@ -459,11 +459,19 @@ MainWindow::downloadVideo () { } const bool completeFile = - QFileInfo (fpath).size () == expected_bytes; + QFileInfo (fpath).size () >= expected_bytes; const bool playWhenDone = shPrefs.get (SharedPreferences::PlayWhenDone).toBool (); +#ifdef _0 + qDebug () + << QFileInfo (fpath).size () + << expected_bytes + << completeFile + << playWhenDone; +#endif + if (completeFile && playWhenDone) { QStringList args = -- 2.11.4.GIT