[Kget] [Bug 105770] wrong estimated download time
Urs Wolfer
u.wolfer at bluewin.ch
Sat Jul 23 14:52:28 CEST 2005
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=105770
u.wolfer bluewin ch changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From u.wolfer bluewin ch 2005-07-23 14:52 -------
SVN commit 437888 by uwolfer:
* Remaining time: replace function KIO::calculateRemaining() with KIO::calculateRemainingSeconds() and KIO::convertSeconds(). So the time can be more than "23:59:59" (now for example "2 days 12:12:12").
BUG: 105770
CCBUG: 85190
* Better formatted systray tooltip.
M +3 -11 dlgIndividual.cpp
M +1 -1 dlgIndividual.h
M +9 -7 kmainwidget.cpp
M +16 -10 transfer.cpp
M +4 -3 transfer.h
--- trunk/KDE/kdenetwork/kget/dlgIndividual.cpp #437887:437888
@ -226,18 +226,10 @
}
-void DlgIndividual::setSpeed(unsigned long bytes_per_second, QTime remaining)
+void DlgIndividual::setSpeed(QString speed)
{
- QString msg;
- if (bytes_per_second == 0 && item->getStatus() < Transfer::ST_RUNNING)
- msg=i18n("Stalled");
- else if (bytes_per_second == 0 && item->getStatus() == Transfer::ST_FINISHED)
- msg=i18n("Finished");
- else
- msg=i18n("%1/s ( %2 )").arg(KIO::convertSize(bytes_per_second)).arg(remaining.toString());
-
- speedLabel->setText(msg);
- m_pDockIndividual->setTip(msg);
+ speedLabel->setText(speed);
+ m_pDockIndividual->setTip(speed);
}
--- trunk/KDE/kdenetwork/kget/dlgIndividual.h #437887:437888
@ -61,7 +61,7 @
void setProcessedSize(unsigned long bytes);
- void setSpeed(unsigned long bytes_per_second, QTime remaining);
+ void setSpeed(QString speed);
void setPercent(unsigned long percent);
void setCopying(const KURL & src, const KURL & dest);
--- trunk/KDE/kdenetwork/kget/kmainwidget.cpp #437887:437888
@ -83,6 +83,7 @
#include <kio/authinfo.h>
+#include <kio/global.h>
#include <qiconset.h>
#include "version.h"
@ -396,7 +397,7 @
statusBar()->insertFixedItem(i18n(" Transfers: %1 ").arg(99), ID_TOTAL_TRANSFERS);
statusBar()->insertFixedItem(i18n(" Files: %1 ").arg(555), ID_TOTAL_FILES);
statusBar()->insertFixedItem(i18n(" Size: %1 KB ").arg("134.56"), ID_TOTAL_SIZE);
- statusBar()->insertFixedItem(i18n(" Time: 00:00:00 "), ID_TOTAL_TIME);
+ statusBar()->insertFixedItem(i18n(" Time: %1 ").arg(KIO::convertSeconds(0)) + " ", ID_TOTAL_TIME); //added some spaces because "2 days 12:12:12" need more place as "12:12:12"
statusBar()->insertFixedItem(i18n(" %1 KB/s ").arg("123.34"), ID_TOTAL_SPEED);
setAutoSaveSettings( "MainWindow", false /*Settings takes care of size & pos & state */ );
@ -2049,7 +2050,7 @
int totalFiles = 0;
KIO::filesize_t totalSize = 0;
int totalSpeed = 0;
- QTime remTime;
+ unsigned int remTime = 0;
TransferIterator it(myTransferList);
@ -2069,14 +2070,15 @
statusBar()->changeItem(i18n(" Transfers: %1 ").arg(myTransferList->childCount()), ID_TOTAL_TRANSFERS);
statusBar()->changeItem(i18n(" Files: %1 ").arg(totalFiles), ID_TOTAL_FILES);
statusBar()->changeItem(i18n(" Size: %1 ").arg(KIO::convertSize(totalSize)), ID_TOTAL_SIZE);
- statusBar()->changeItem(i18n(" Time: %1 ").arg(remTime.toString()), ID_TOTAL_TIME);
+ statusBar()->changeItem(i18n(" Time: %1 ").arg(KIO::convertSeconds(remTime)), ID_TOTAL_TIME);
statusBar()->changeItem(i18n(" %1/s ").arg(KIO::convertSize(totalSpeed)), ID_TOTAL_SPEED);
if (kdock) {
- tmpstr = i18n(" Transfers: %1 ").arg(myTransferList->childCount()) +
- i18n(" Files: %1 ").arg(totalFiles)+
- i18n(" Size: %1 ").arg(KIO::convertSize(totalSize))+
- i18n(" Time: %1 %2/s").arg(remTime.toString()).arg(KIO::convertSize(totalSpeed));
+ tmpstr = i18n("<b>Transfers:</b> %1 ").arg(myTransferList->childCount()) +
+ i18n("<br /><b>Files:</b> %1 ").arg(totalFiles) +
+ i18n("<br /><b>Size:</b> %1 ").arg(KIO::convertSize(totalSize)) +
+ i18n("<br /><b>Time:</b> %1 ").arg(KIO::convertSeconds(remTime)) +
+ i18n("<br /><b>Speed:</b> %1/s").arg(KIO::convertSize(totalSpeed));
kdock->updateToolTip( tmpstr );
}
#ifdef _DEBUG
--- trunk/KDE/kdenetwork/kget/transfer.cpp #437887:437888
@ -101,7 +101,7 @
Transfer::init(const uint _id)
{
sDebugIn << endl;
-
+ remainingTimeSec = 0;
totalSize = 0;
processedSize = 0;
percent = 0;
@ -258,7 +258,8 @
// sDebugIn <<endl;
speed = _speed;
- remainingTime = KIO::calculateRemaining(totalSize, processedSize, speed);
+ remainingTimeSec = KIO::calculateRemainingSeconds(totalSize, processedSize, speed);
+ remainingTime = KIO::convertSeconds(remainingTimeSec);
//sDebugOut <<endl;
}
@ -594,27 +595,32 @
if (speed == 0 && status == ST_RUNNING) {
setText(view->lv_speed, i18n("Stalled"));
setText(view->lv_remaining, i18n("Stalled"));
+ if(dlgIndividual)
+ dlgIndividual->setSpeed(i18n("Stalled"));
} else if (speed == 0 && status == ST_FINISHED) {
setText(view->lv_progress, i18n("OK as in 'finished'","OK"));
- setText(view->lv_speed, i18n("0 MB/s"));
- setText(view->lv_remaining, i18n("00:00:00"));
+ setText(view->lv_speed, i18n("Finished"));
+ setText(view->lv_remaining, i18n("Finished"));
+ if(dlgIndividual)
+ dlgIndividual->setSpeed(i18n("Finished"));
} else if (speed == 0 && status == ST_STOPPED) {
- setText(view->lv_speed, i18n("0 MB/s"));
- setText(view->lv_remaining, i18n("00:00:00"));
+ setText(view->lv_speed, i18n("Stopped"));
+ setText(view->lv_remaining, i18n("Stopped"));
+ if(dlgIndividual)
+ dlgIndividual->setSpeed(i18n("Stopped"));
} else {
QString tmps = i18n("%1/s").arg(KIO::convertSize(speed));
setText(view->lv_speed, tmps);
- setText(view->lv_remaining, remainingTime.toString());
+ setText(view->lv_remaining, remainingTime);
+ if(dlgIndividual)
+ dlgIndividual->setSpeed(tmps + " ( " + remainingTime + " ) ");
}
- if(dlgIndividual)
- dlgIndividual->setSpeed(speed, remainingTime);
-
//sDebugOut<<endl;
}
--- trunk/KDE/kdenetwork/kget/transfer.h #437887:437888
@ -82,9 +82,9 @
{
return startTime;
}
- QTime getRemainingTime()const
+ unsigned int getRemainingTime()const
{
- return remainingTime;
+ return remainingTimeSec;
}
KIO::filesize_t getTotalSize()const
@ -216,7 +216,8 @
int percent;
int speed;
- QTime remainingTime;
+ unsigned int remainingTimeSec;
+ QString remainingTime;
TransferStatus status;
TransferMode mode;
More information about the Kget
mailing list