From: <arn...@us...> - 2008-02-09 22:14:52
|
Revision: 999 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=999&view=rev Author: arnetheduck Date: 2008-02-09 14:14:47 -0800 (Sat, 09 Feb 2008) Log Message: ----------- add requesting message when downloading, fix downloads view Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/DownloadManagerListener.h dcplusplus/trunk/dcpp/HashBloom.cpp dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/TransferView.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/changelog.txt 2008-02-09 22:14:47 UTC (rev 999) @@ -28,7 +28,7 @@ * [ADC] Added /me handling (thanks poy) * Fixed issues with scrolling (thanks poy) * Fixed re-add sources showing wrong sources (thanks poy) -* Partially fixed +* Partially fixed kick message filtering (thanks mikejj) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-09 22:14:47 UTC (rev 999) @@ -192,7 +192,10 @@ if(aConn->isSet(UserConnection::FLAG_SUPPORTS_XML_BZLIST) && d->getType() == Transfer::TYPE_FULL_LIST) { d->setFlag(Download::FLAG_XML_BZ_LIST); } + + fire(DownloadManagerListener::Requesting(), d); aConn->send(d->getCommand(aConn->isSet(UserConnection::FLAG_SUPPORTS_ZLIB_GET))); + } void DownloadManager::on(AdcCommand::SND, UserConnection* aSource, const AdcCommand& cmd) throw() { Modified: dcplusplus/trunk/dcpp/DownloadManagerListener.h =================================================================== --- dcplusplus/trunk/dcpp/DownloadManagerListener.h 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/dcpp/DownloadManagerListener.h 2008-02-09 22:14:47 UTC (rev 999) @@ -45,11 +45,17 @@ typedef X<1> Failed; typedef X<2> Starting; typedef X<3> Tick; + typedef X<3> Requesting; /** * This is the first message sent before a download starts. - * No other messages will be sent before. + * No other messages will be sent before this. */ + virtual void on(Requesting, Download*) throw() { } + + /** + * This is the first message sent before a download starts. + */ virtual void on(Starting, Download*) throw() { } /** Modified: dcplusplus/trunk/dcpp/HashBloom.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashBloom.cpp 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/dcpp/HashBloom.cpp 2008-02-09 22:14:47 UTC (rev 999) @@ -50,13 +50,13 @@ } size_t HashBloom::pos(const TTHValue& tth, size_t n) const { - uint64_t x = 0; - - size_t start = n * h; if((n+1)*h > TTHValue::BITS) { return 0; } + uint64_t x = 0; + + size_t start = n * h; for(size_t i = 0; i < h; ++i) { size_t bit = start + i; size_t byte = bit / 8; Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-02-09 22:14:47 UTC (rev 999) @@ -33,7 +33,7 @@ #include <dcpp/Upload.h> int TransferView::connectionIndexes[] = { CONNECTION_COLUMN_USER, CONNECTION_COLUMN_STATUS, CONNECTION_COLUMN_SPEED, CONNECTION_COLUMN_CHUNK, CONNECTION_COLUMN_TRANSFERED, CONNECTION_COLUMN_QUEUED, CONNECTION_COLUMN_CIPHER, CONNECTION_COLUMN_IP }; -int TransferView::connectionSizes[] = { 125, 375, 100, 100, 125, 75, 100, 100 }; +int TransferView::connectionSizes[] = { 125, 375, 100, 125, 125, 75, 100, 100 }; int TransferView::downloadIndexes[] = { DOWNLOAD_COLUMN_FILE, DOWNLOAD_COLUMN_PATH, DOWNLOAD_COLUMN_STATUS, DOWNLOAD_COLUMN_TIMELEFT, DOWNLOAD_COLUMN_SPEED, DOWNLOAD_COLUMN_DONE, DOWNLOAD_COLUMN_SIZE }; int TransferView::downloadSizes[] = { 200, 300, 150, 200, 125, 100, 100 }; @@ -42,7 +42,7 @@ N_("User"), N_("Status"), N_("Speed"), - N_("Chunk size"), + N_("Chunk"), N_("Transfered (Ratio)"), N_("Queued"), N_("Cipher"), @@ -575,8 +575,9 @@ } if(ui.updateMask & UpdateInfo::MASK_CHUNK) { + chunkPos = ui.chunkPos; chunk = ui.chunk; - columns[CONNECTION_COLUMN_CHUNK] = Text::toT(Util::formatBytes(ui.chunk)); + columns[CONNECTION_COLUMN_CHUNK] = Text::toT(Util::formatBytes(chunkPos) + "/" + Util::formatBytes(chunk)); } if(ui.updateMask & UpdateInfo::MASK_SPEED) { @@ -682,7 +683,7 @@ void TransferView::starting(UpdateInfo* ui, Transfer* t) { ui->setStatus(ConnectionInfo::STATUS_RUNNING); ui->setTransfered(t->getPos(), t->getActual()); - ui->setChunk(t->getSize()); + ui->setChunk(t->getPos(), t->getSize()); const UserConnection& uc = t->getUserConnection(); ui->setCipher(Text::toT(uc.getCipherName())); tstring country = Text::toT(Util::getIpCountry(uc.getRemoteIp())); @@ -694,10 +695,21 @@ } } +void TransferView::on(DownloadManagerListener::Requesting, Download* d) throw() { + UpdateInfo* ui = new UpdateInfo(d->getUser(), true); + + starting(ui, d); + + ui->setStatusString(str(TF_("Requesting %1%") % getFile(d))); + + speak(CONNECTIONS_UPDATE, ui); + + speak(DOWNLOADS_ADD_USER, new TickInfo(d->getPath())); +} + void TransferView::on(DownloadManagerListener::Starting, Download* d) throw() { UpdateInfo* ui = new UpdateInfo(d->getUser(), true); - starting(ui, d); tstring statusString; if(d->getUserConnection().isSecure()) { @@ -720,8 +732,6 @@ ui->setStatusString(statusString); speak(CONNECTIONS_UPDATE, ui); - - speak(DOWNLOADS_ADD_USER, new TickInfo(d->getPath())); } void TransferView::on(DownloadManagerListener::Tick, const DownloadList& dl) throw() { @@ -731,7 +741,7 @@ UpdateInfo* ui = new UpdateInfo(d->getUser(), true); ui->setTransfered(d->getPos(), d->getActual()); ui->setSpeed(d->getAverageSpeed()); - + ui->setChunk(d->getPos(), d->getSize()); tasks.add(CONNECTIONS_UPDATE, ui); } Modified: dcplusplus/trunk/win32/TransferView.h =================================================================== --- dcplusplus/trunk/win32/TransferView.h 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/win32/TransferView.h 2008-02-09 22:14:47 UTC (rev 999) @@ -117,6 +117,7 @@ int64_t queued; int64_t speed; int64_t chunk; + int64_t chunkPos; tstring columns[CONNECTION_COLUMN_LAST]; void update(const UpdateInfo& ui); @@ -167,7 +168,8 @@ int64_t speed; void setStatusString(const tstring& aStatusString) { statusString = aStatusString; updateMask |= MASK_STATUS_STRING; } tstring statusString; - void setChunk(int64_t aChunk) { chunk = aChunk; updateMask |= MASK_CHUNK; } + void setChunk(int64_t aChunkPos, int64_t aChunk) { chunkPos = aChunkPos; chunk = aChunk; updateMask |= MASK_CHUNK; } + int64_t chunkPos; int64_t chunk; void setIP(const tstring& aIp) { ip = aIp; updateMask |= MASK_IP; } @@ -277,6 +279,7 @@ virtual void on(ConnectionManagerListener::Removed, ConnectionQueueItem* aCqi) throw(); virtual void on(ConnectionManagerListener::StatusChanged, ConnectionQueueItem* aCqi) throw(); + virtual void on(DownloadManagerListener::Requesting, Download* aDownload) throw(); virtual void on(DownloadManagerListener::Complete, Download* aDownload) throw(); virtual void on(DownloadManagerListener::Failed, Download* aDownload, const string& aReason) throw(); virtual void on(DownloadManagerListener::Starting, Download* aDownload) throw(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |