You can subscribe to this list here.
2006 |
Jan
|
Feb
(24) |
Mar
(9) |
Apr
(4) |
May
(7) |
Jun
(13) |
Jul
(19) |
Aug
(1) |
Sep
(12) |
Oct
(20) |
Nov
(1) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(6) |
Mar
(24) |
Apr
(1) |
May
(10) |
Jun
(30) |
Jul
(46) |
Aug
(20) |
Sep
(12) |
Oct
(27) |
Nov
(51) |
Dec
(58) |
2008 |
Jan
(40) |
Feb
(40) |
Mar
(78) |
Apr
(138) |
May
(4) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(2) |
Jul
(10) |
Aug
(1) |
Sep
(11) |
Oct
(31) |
Nov
(7) |
Dec
(1) |
2011 |
Jan
(1) |
Feb
|
Mar
(3) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
(2) |
Dec
(2) |
2013 |
Jan
(3) |
Feb
(5) |
Mar
(1) |
Apr
|
May
|
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2014 |
Jan
(2) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <arn...@us...> - 2008-01-19 23:29:09
|
Revision: 970 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=970&view=rev Author: arnetheduck Date: 2008-01-19 15:29:06 -0800 (Sat, 19 Jan 2008) Log Message: ----------- Add right-click menu to downloads frame Modified Paths: -------------- dcplusplus/trunk/intl/SConscript dcplusplus/trunk/win32/DirectoryListingFrame.cpp dcplusplus/trunk/win32/DirectoryListingFrame.h dcplusplus/trunk/win32/DownloadsFrame.cpp dcplusplus/trunk/win32/DownloadsFrame.h dcplusplus/trunk/win32/QueueFrame.cpp dcplusplus/trunk/win32/QueueFrame.h dcplusplus/trunk/win32/SearchFrame.cpp dcplusplus/trunk/win32/SearchFrame.h dcplusplus/trunk/win32/WinUtil.cpp dcplusplus/trunk/win32/WinUtil.h Modified: dcplusplus/trunk/intl/SConscript =================================================================== --- dcplusplus/trunk/intl/SConscript 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/intl/SConscript 2008-01-19 23:29:06 UTC (rev 970) @@ -3,7 +3,7 @@ ret = None if dev.is_win32(): - env, target, sources = dev.prepare_build(source_path, 'aintl', '*.c') + env, target, sources = dev.prepare_build(source_path, 'aintl', '*.c', in_bin=False) env.Append(CPPDEFINES=['LOCALEDIR=\\"\\"', 'LOCALE_ALIAS_PATH=\\"\\"', 'INSTALLDIR=\\"\\"', 'LIBDIR=\\"\\"', 'BUILDING_LIBINTL', 'IN_LIBINTL', 'ENABLE_RELOCATABLE=1', 'NO_XMALLOC', 'HAVE_CONFIG_H', Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-01-19 23:29:06 UTC (rev 970) @@ -317,9 +317,7 @@ menu->appendSeparatorItem(); - menu->appendItem(IDC_SEARCH_ALTERNATES, T_("Search for alternates"), std::tr1::bind(&DirectoryListingFrame::handleSearchAlternates, this)); - menu->appendItem(IDC_BITZI_LOOKUP, T_("Lookup TTH at Bitzi.com"), std::tr1::bind(&DirectoryListingFrame::handleLookupBitzi, this)); - menu->appendItem(IDC_COPY_MAGNET, T_("Copy magnet link to clipboard"), std::tr1::bind(&DirectoryListingFrame::handleCopyMagnet, this)); + WinUtil::addHashItems(menu, ii->file->getTTH(), Text::toT(ii->file->getName())); } if((ii->type == ItemInfo::FILE && ii->file->getAdls()) || @@ -469,27 +467,6 @@ } } -void DirectoryListingFrame::handleSearchAlternates() { - ItemInfo* ii = files->getSelectedData(); - if(ii != NULL && ii->type == ItemInfo::FILE) { - WinUtil::searchHash(ii->file->getTTH()); - } -} - -void DirectoryListingFrame::handleLookupBitzi() { - ItemInfo* ii = files->getSelectedData(); - if(ii != NULL && ii->type == ItemInfo::FILE) { - WinUtil::bitziLink(ii->file->getTTH()); - } -} - -void DirectoryListingFrame::handleCopyMagnet() { - ItemInfo* ii = files->getSelectedData(); - if(ii != NULL && ii->type == ItemInfo::FILE) { - WinUtil::copyMagnet(ii->file->getTTH(), ii->getText(COLUMN_FILENAME)); - } -} - void DirectoryListingFrame::handleDownload() { if(usingDirMenu) { ItemInfo* ii = dirs->getSelectedData(); Modified: dcplusplus/trunk/win32/DirectoryListingFrame.h =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.h 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/DirectoryListingFrame.h 2008-01-19 23:29:06 UTC (rev 970) @@ -190,9 +190,6 @@ void handleDownload(); void handleViewAsText(); - void handleSearchAlternates(); - void handleLookupBitzi(); - void handleCopyMagnet(); void handleGoToDirectory(); void handleDownloadLastDir(unsigned id); void handleDownloadTarget(unsigned id); Modified: dcplusplus/trunk/win32/DownloadsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-19 23:29:06 UTC (rev 970) @@ -94,7 +94,13 @@ SettingsManager::getInstance()->set(SettingsManager::DOWNLOADSFRAME_WIDTHS, WinUtil::toString(downloads->getColumnWidths())); } -DownloadsFrame::DownloadInfo::DownloadInfo(const string& target, int64_t size_) : path(target), done(QueueManager::getInstance()->getPos(target)), size(size_), users(0) { +DownloadsFrame::DownloadInfo::DownloadInfo(const string& target, int64_t size_, const TTHValue& tth_) : + path(target), + done(QueueManager::getInstance()->getPos(target)), + size(size_), + users(0), + tth(tth_) +{ columns[COLUMN_FILE] = Text::toT(Util::getFileName(target)); columns[COLUMN_PATH] = Text::toT(Util::getFilePath(target)); columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(size)); @@ -127,13 +133,14 @@ } bool DownloadsFrame::handleContextMenu(SmartWin::ScreenCoordinate pt) { - if (downloads->hasSelection()) { + if (downloads->getSelectedCount() == 1) { if(pt.x() == -1 && pt.y() == -1) { pt = downloads->getContextMenuPos(); } WidgetMenuPtr menu = createMenu(true); - + DownloadInfo* di = downloads->getSelectedData(); + WinUtil::addHashItems(menu, di->tth, di->columns[COLUMN_FILE]); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; @@ -160,7 +167,12 @@ if(size == -1) { return 0; } - i = downloads->insert(new DownloadInfo(ti->path, size)); + TTHValue tth; + if(QueueManager::getInstance()->getTTH(ti->path, tth)) { + i = downloads->insert(new DownloadInfo(ti->path, size, tth)); + } else { + return 0; + } } DownloadInfo* di = downloads->getData(i); di->update(*ti); Modified: dcplusplus/trunk/win32/DownloadsFrame.h =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-19 23:29:06 UTC (rev 970) @@ -82,7 +82,7 @@ class DownloadInfo { public: - DownloadInfo(const string& filename, int64_t size); + DownloadInfo(const string& filename, int64_t size, const TTHValue& tth); const tstring& getText(int col) const { return columns[col]; @@ -110,6 +110,7 @@ int64_t size; double bps; int users; + TTHValue tth; tstring columns[COLUMN_LAST]; }; Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-01-19 23:29:06 UTC (rev 970) @@ -767,25 +767,6 @@ } } -void QueueFrame::handleSearchAlternates() { - if(files->getSelectedCount() == 1) { - WinUtil::searchHash(files->getSelectedData()->getTTH()); - } -} - -void QueueFrame::handleBitziLookup() { - if(files->getSelectedCount() == 1) { - WinUtil::bitziLink(files->getSelectedData()->getTTH()); - } -} - -void QueueFrame::handleCopyMagnet() { - if(files->getSelectedCount() == 1) { - QueueItemInfo* ii = files->getSelectedData(); - WinUtil::copyMagnet(ii->getTTH(), Text::toT(Util::getFileName(ii->getTarget()))); - } -} - void QueueFrame::handleBrowseList(const UserPtr& user) { if(files->getSelectedCount() == 1) { @@ -975,9 +956,7 @@ QueueFrame::WidgetMenuPtr QueueFrame::makeSingleMenu(QueueItemInfo* qii) { WidgetMenuPtr menu = createMenu(true); - menu->appendItem(IDC_SEARCH_ALTERNATES, T_("Search for alternates"), std::tr1::bind(&QueueFrame::handleSearchAlternates, this)); - menu->appendItem(IDC_BITZI_LOOKUP, T_("Lookup TTH at Bitzi.com"), std::tr1::bind(&QueueFrame::handleBitziLookup, this)); - menu->appendItem(IDC_COPY_MAGNET, T_("Copy magnet link to clipboard"), std::tr1::bind(&QueueFrame::handleCopyMagnet, this)); + WinUtil::addHashItems(menu, qii->getTTH(), Text::toT(Util::getFileName(qii->getTarget()))); menu->appendItem(IDC_MOVE, T_("Move/Rename"), std::tr1::bind(&QueueFrame::handleMove, this)); addPriorityMenu(menu); addBrowseMenu(menu, qii); Modified: dcplusplus/trunk/win32/QueueFrame.h =================================================================== --- dcplusplus/trunk/win32/QueueFrame.h 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/QueueFrame.h 2008-01-19 23:29:06 UTC (rev 970) @@ -286,9 +286,6 @@ void handleShowTreeClicked(); - void handleSearchAlternates(); - void handleBitziLookup(); - void handleCopyMagnet(); void handleMove(); void handleRemove(); void handlePriority(unsigned id); Modified: dcplusplus/trunk/win32/SearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SearchFrame.cpp 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/SearchFrame.cpp 2008-01-19 23:29:06 UTC (rev 970) @@ -727,36 +727,6 @@ results->forEachSelected(&SearchInfo::view); } -void SearchFrame::handleSearchAlternates() { - if(results->getSelectedCount() == 1) { - int i = results->getNext(-1, LVNI_SELECTED); - SearchResult* sr = results->getData(i)->sr; - if(sr->getType() == SearchResult::TYPE_FILE) { - WinUtil::searchHash(sr->getTTH()); - } - } -} - -void SearchFrame::handleBitziLookup() { - if(results->getSelectedCount() == 1) { - int i = results->getNext(-1, LVNI_SELECTED); - SearchResult* sr = results->getData(i)->sr; - if(sr->getType() == SearchResult::TYPE_FILE) { - WinUtil::bitziLink(sr->getTTH()); - } - } -} - -void SearchFrame::handleCopyMagnet() { - if(results->getSelectedCount() == 1) { - int i = results->getNext(-1, LVNI_SELECTED); - SearchResult* sr = results->getData(i)->sr; - if(sr->getType() == SearchResult::TYPE_FILE) { - WinUtil::copyMagnet(sr->getTTH(), Text::toT(sr->getFileName())); - } - } -} - void SearchFrame::handleRemove() { int i = -1; while((i = results->getNext(-1, LVNI_SELECTED)) != -1) { @@ -776,9 +746,10 @@ addTargetDirMenu(menu, favoriteDirs); menu->appendItem(IDC_VIEW_AS_TEXT, T_("View as text"), std::tr1::bind(&SearchFrame::handleViewAsText, this)); menu->appendSeparatorItem(); - menu->appendItem(IDC_SEARCH_ALTERNATES, T_("Search for alternates"), std::tr1::bind(&SearchFrame::handleSearchAlternates, this)); - menu->appendItem(IDC_BITZI_LOOKUP, T_("Lookup TTH at Bitzi.com"), std::tr1::bind(&SearchFrame::handleBitziLookup, this)); - menu->appendItem(IDC_COPY_MAGNET, T_("Copy magnet link to clipboard"), std::tr1::bind(&SearchFrame::handleCopyMagnet, this)); + if(checkTTH.hasTTH) { + SearchInfo* si = results->getSelectedData(); + WinUtil::addHashItems(menu, TTHValue(Text::fromT(checkTTH.tth)), si->getText(COLUMN_FILENAME)); + } menu->appendSeparatorItem(); appendUserItems(getParent(), menu); menu->appendSeparatorItem(); Modified: dcplusplus/trunk/win32/SearchFrame.h =================================================================== --- dcplusplus/trunk/win32/SearchFrame.h 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/SearchFrame.h 2008-01-19 23:29:06 UTC (rev 970) @@ -222,9 +222,6 @@ void handleDownloadWholeTarget(unsigned id); void handleDownloadDirTo(); void handleViewAsText(); - void handleSearchAlternates(); - void handleBitziLookup(); - void handleCopyMagnet(); void handleRemove(); LRESULT handleSpeaker(WPARAM wParam, LPARAM lParam); bool handleSearchKeyDown(int c); Modified: dcplusplus/trunk/win32/WinUtil.cpp =================================================================== --- dcplusplus/trunk/win32/WinUtil.cpp 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/WinUtil.cpp 2008-01-19 23:29:06 UTC (rev 970) @@ -358,6 +358,11 @@ return 2; } } +void WinUtil::addHashItems(const SmartWin::WidgetMenu::ObjectType& menu, const TTHValue& tth, const tstring& filename) { + menu->appendItem(IDC_SEARCH_ALTERNATES, T_("Search for alternates"), std::tr1::bind(&WinUtil::searchHash, tth)); + menu->appendItem(IDC_BITZI_LOOKUP, T_("Lookup TTH at Bitzi.com"), std::tr1::bind(WinUtil::bitziLink, tth)); + menu->appendItem(IDC_COPY_MAGNET, T_("Copy magnet link to clipboard"), std::tr1::bind(&WinUtil::copyMagnet, tth, filename)); +} void WinUtil::bitziLink(const TTHValue& aHash) { // to use this free service by bitzi, we must not hammer or request information from bitzi Modified: dcplusplus/trunk/win32/WinUtil.h =================================================================== --- dcplusplus/trunk/win32/WinUtil.h 2008-01-19 22:19:19 UTC (rev 969) +++ dcplusplus/trunk/win32/WinUtil.h 2008-01-19 23:29:06 UTC (rev 970) @@ -133,6 +133,7 @@ static pair<tstring, bool> getHubNames(const UserPtr& u); // Hash related + static void addHashItems(const SmartWin::WidgetMenu::ObjectType& menu, const TTHValue& tth, const tstring& filename); static void bitziLink(const TTHValue& /*aHash*/); static void copyMagnet(const TTHValue& /*aHash*/, const tstring& /*aFile*/); static void searchHash(const TTHValue& /*aHash*/); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-19 22:19:24
|
Revision: 969 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=969&view=rev Author: arnetheduck Date: 2008-01-19 14:19:19 -0800 (Sat, 19 Jan 2008) Log Message: ----------- Transfer and downloads frames fixes Modified Paths: -------------- dcplusplus/trunk/win32/DownloadsFrame.cpp dcplusplus/trunk/win32/DownloadsFrame.h dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/TransferView.h Modified: dcplusplus/trunk/win32/DownloadsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-19 15:35:31 UTC (rev 968) +++ dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-19 22:19:19 UTC (rev 969) @@ -28,7 +28,7 @@ #include "HoldRedraw.h" #include "WinUtil.h" -int DownloadsFrame::columnIndexes[] = { COLUMN_FILE, COLUMN_PATH, COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, COLUMN_SIZE }; +int DownloadsFrame::columnIndexes[] = { COLUMN_FILE, COLUMN_PATH, COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, COLUMN_DONE, COLUMN_SIZE }; int DownloadsFrame::columnSizes[] = { 200, 300, 150, 200, 125, 100}; static const char* columnNames[] = { @@ -37,6 +37,7 @@ N_("Status"), N_("Time left"), N_("Speed"), + N_("Done"), N_("Size") }; @@ -97,6 +98,7 @@ columns[COLUMN_FILE] = Text::toT(Util::getFileName(target)); columns[COLUMN_PATH] = Text::toT(Util::getFilePath(target)); columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(size)); + update(); } @@ -121,6 +123,7 @@ columns[COLUMN_TIMELEFT] = Text::toT(Util::formatSeconds(static_cast<int64_t>(timeleft()))); columns[COLUMN_SPEED] = str(TF_("%1%/s") % Text::toT(Util::formatBytes(static_cast<int64_t>(bps)))); } + columns[COLUMN_DONE] = Text::toT(Util::formatBytes(done)); } bool DownloadsFrame::handleContextMenu(SmartWin::ScreenCoordinate pt) { Modified: dcplusplus/trunk/win32/DownloadsFrame.h =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-19 15:35:31 UTC (rev 968) +++ dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-19 22:19:19 UTC (rev 969) @@ -60,6 +60,7 @@ COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, + COLUMN_DONE, COLUMN_SIZE, COLUMN_LAST }; @@ -95,6 +96,7 @@ case COLUMN_TIMELEFT: return compare(a->timeleft(), b->timeleft()); case COLUMN_SPEED: return compare(a->bps, b->bps); case COLUMN_SIZE: return compare(a->size, b->size); + case COLUMN_DONE: return compare(a->done, b->done); default: return lstrcmpi(a->columns[col].c_str(), b->columns[col].c_str()); } } Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-01-19 15:35:31 UTC (rev 968) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-01-19 22:19:19 UTC (rev 969) @@ -33,13 +33,14 @@ #include <dcpp/Download.h> #include <dcpp/Upload.h> -int TransferView::columnIndexes[] = { COLUMN_USER, COLUMN_STATUS, COLUMN_SPEED, COLUMN_TRANSFERED, COLUMN_QUEUED, COLUMN_CIPHER, COLUMN_IP }; -int TransferView::columnSizes[] = { 125, 375, 150, 150, 75, 100, 100 }; +int TransferView::columnIndexes[] = { COLUMN_USER, COLUMN_STATUS, COLUMN_SPEED, COLUMN_CHUNK, COLUMN_TRANSFERED, COLUMN_QUEUED, COLUMN_CIPHER, COLUMN_IP }; +int TransferView::columnSizes[] = { 125, 375, 100, 100, 125, 75, 100, 100 }; static const char* columnNames[] = { N_("User"), N_("Status"), N_("Speed"), + N_("Chunk size"), N_("Transfered (Ratio)"), N_("Queued"), N_("Cipher"), @@ -110,12 +111,9 @@ menu->appendSeparatorItem(); menu->appendItem(IDC_FORCE, T_("Force attempt"), std::tr1::bind(&TransferView::handleForce, this)); - if(ii->download) { - menu->appendItem(IDC_SEARCH_ALTERNATES, CTSTRING(SEARCH_FOR_ALTERNATES), std::tr1::bind(&TransferView::handleSearchAlternates, this)); - } menu->appendItem(IDC_COPY_NICK, T_("Copy nick to clipboard"), std::tr1::bind(&TransferView::handleCopyNick, this)); menu->appendSeparatorItem(); - menu->appendItem(IDC_REMOVE, T_("Close connection"), std::tr1::bind(&TransferView::handleRemove, this)); + menu->appendItem(IDC_REMOVE, T_("Disconnect"), std::tr1::bind(&TransferView::handleDisconnect, this)); menu->setDefaultItem(IDC_PRIVATEMESSAGE); return menu; } @@ -136,7 +134,7 @@ return false; } -void TransferView::handleRemove() { +void TransferView::handleDisconnect() { transfers->forEachSelected(&ItemInfo::disconnect); } @@ -172,7 +170,8 @@ void TransferView::handleForce() { int i = -1; while( (i = transfers->getNext(i, LVNI_SELECTED)) != -1) { - transfers->setText(i, COLUMN_STATUS, T_("Connecting (forced)...")); + transfers->getData(i)->columns[COLUMN_STATUS] = T_("Connecting (forced)"); + transfers->update(i); ConnectionManager::getInstance()->force(transfers->getData(i)->user); } } @@ -324,6 +323,7 @@ case COLUMN_SPEED: return compare(a->speed, b->speed); case COLUMN_TRANSFERED: return compare(a->transfered, b->transfered); case COLUMN_QUEUED: return compare(a->queued, b->queued); + case COLUMN_CHUNK: return compare(a->chunk, b->chunk); default: return lstrcmpi(a->columns[col].c_str(), b->columns[col].c_str()); } } @@ -371,35 +371,20 @@ return 0; } -void TransferView::handleSearchAlternates() { -#ifdef PORT_ME - int i = transfers->getNext(-1, LVNI_SELECTED); - - if(i != -1) { - ItemInfo *ii = transfers->getData(i); - - string target = Text::fromT(ii->getText(COLUMN_PATH) + ii->getText(COLUMN_FILE)); - - TTHValue tth; - if(QueueManager::getInstance()->getTTH(target, tth)) { - WinUtil::searchHash(tth); - } - } -#endif -} - TransferView::ItemInfo::ItemInfo(const UserPtr& u, bool aDownload) : UserInfoBase(u), download(aDownload), transferFailed(false), status(STATUS_WAITING), actual(0), + lastActual(0), transfered(0), + lastTransfered(0), queued(0), speed(0) { columns[COLUMN_USER] = WinUtil::getNicks(u); - columns[COLUMN_STATUS] = T_("Idle..."); + columns[COLUMN_STATUS] = T_("Idle"); columns[COLUMN_TRANSFERED] = Text::toT(Util::toString(0)); if(aDownload) { queued = QueueManager::getInstance()->getQueued(u); @@ -409,6 +394,7 @@ void TransferView::ItemInfo::update(const UpdateInfo& ui) { if(ui.updateMask & UpdateInfo::MASK_STATUS) { + lastTransfered = lastActual = 0; status = ui.status; if(download) { // Also update queued when status changes... @@ -425,17 +411,24 @@ } if(ui.updateMask & UpdateInfo::MASK_TRANSFERED) { - actual = ui.actual; - transfered = ui.transfered; + actual += ui.actual - lastActual; + lastActual = ui.actual; + transfered += ui.transfered - lastTransfered; + lastTransfered = ui.transfered; if(actual == transfered) { columns[COLUMN_TRANSFERED] = Text::toT(Util::formatBytes(transfered)); } else { - columns[COLUMN_TRANSFERED] = str(TF_("%1% (%|.2|)") + columns[COLUMN_TRANSFERED] = str(TF_("%1% (%2$0.2f)") % Text::toT(Util::formatBytes(transfered)) % (static_cast<double>(actual) / transfered)); } } + if(ui.updateMask & UpdateInfo::MASK_CHUNK) { + chunk = ui.chunk; + columns[COLUMN_CHUNK] = Text::toT(Util::formatBytes(ui.chunk)); + } + if(ui.updateMask & UpdateInfo::MASK_SPEED) { speed = ui.speed; if (status == STATUS_RUNNING) { @@ -458,14 +451,14 @@ UpdateInfo* ui = new UpdateInfo(aCqi->getUser(), aCqi->getDownload()); ui->setStatus(ItemInfo::STATUS_WAITING); - ui->setStatusString(T_("Connecting...")); + ui->setStatusString(T_("Connecting")); speak(ADD_ITEM, ui); } void TransferView::on(ConnectionManagerListener::StatusChanged, ConnectionQueueItem* aCqi) throw() { UpdateInfo* ui = new UpdateInfo(aCqi->getUser(), aCqi->getDownload()); - ui->setStatusString((aCqi->getState() == ConnectionQueueItem::CONNECTING) ? T_("Connecting...") : T_("Waiting to retry...")); + ui->setStatusString((aCqi->getState() == ConnectionQueueItem::CONNECTING) ? T_("Connecting") : T_("Waiting to retry")); speak(UPDATE_ITEM, ui); } @@ -489,27 +482,56 @@ if(t->getType() == Transfer::TYPE_TREE) { file = str(TF_("TTH: %1%") % Text::toT(Util::getFileName(t->getPath()))); + } else if(t->getType() == Transfer::TYPE_FULL_LIST || t->getType() == Transfer::TYPE_PARTIAL_LIST) { + file = T_("file list"); } else { - file = Text::toT(Util::getFileName(t->getPath())); + file = Text::toT(Util::getFileName(t->getPath()) + + " (" + Util::formatBytes(t->getStartPos()) + + " - " + Util::formatBytes(t->getStartPos() + t->getSize()) + ")"); } return file; } -void TransferView::on(DownloadManagerListener::Starting, Download* aDownload) throw() { - UpdateInfo* ui = new UpdateInfo(aDownload->getUser(), true); +void TransferView::starting(UpdateInfo* ui, Transfer* t) { ui->setStatus(ItemInfo::STATUS_RUNNING); - ui->setTransfered(aDownload->getPos(), aDownload->getActual()); - - ui->setStatusString(str(TF_("Requesting %1% (%2%)...") % getFile(aDownload) % aDownload->getSize())); - ui->setCipher(Text::toT(aDownload->getUserConnection().getCipherName())); - tstring country = Text::toT(Util::getIpCountry(aDownload->getUserConnection().getRemoteIp())); - tstring ip = Text::toT(aDownload->getUserConnection().getRemoteIp()); + ui->setTransfered(t->getPos(), t->getActual()); + ui->setChunk(t->getSize()); + const UserConnection& uc = t->getUserConnection(); + ui->setCipher(Text::toT(uc.getCipherName())); + tstring country = Text::toT(Util::getIpCountry(uc.getRemoteIp())); + tstring ip = Text::toT(uc.getRemoteIp()); if(country.empty()) { ui->setIP(ip); } else { ui->setIP(country + _T(" (") + ip + _T(")")); } +} +void TransferView::on(DownloadManagerListener::Starting, Download* d) throw() { + UpdateInfo* ui = new UpdateInfo(d->getUser(), true); + + starting(ui, d); + tstring statusString; + + if(d->getUserConnection().isSecure()) { + if(d->getUserConnection().isTrusted()) { + statusString += _T("[S]"); + } else { + statusString += _T("[U]"); + } + } + if(d->isSet(Download::FLAG_TTH_CHECK)) { + statusString += _T("[T]"); + } + if(d->isSet(Download::FLAG_ZDOWNLOAD)) { + statusString += _T("[Z]"); + } + if(!statusString.empty()) { + statusString += _T(" "); + } + statusString += str(TF_("Downloading %1%") % getFile(d)); + + ui->setStatusString(statusString); speak(UPDATE_ITEM, ui); } @@ -521,31 +543,6 @@ ui->setTransfered(d->getPos(), d->getActual()); ui->setSpeed(d->getAverageSpeed()); - tstring statusString; - - if(d->getUserConnection().isSecure()) { - if(d->getUserConnection().isTrusted()) { - statusString += _T("[S]"); - } else { - statusString += _T("[U]"); - } - } - if(d->isSet(Download::FLAG_TTH_CHECK)) { - statusString += _T("[T]"); - } - if(d->isSet(Download::FLAG_ZDOWNLOAD)) { - statusString += _T("[Z]"); - } - if(!statusString.empty()) { - statusString += _T(" "); - } - statusString += str(TF_("Downloading %1% (%2%/%3%)...") - % getFile(d) - % Text::toT(Util::formatBytes(d->getPos())) - % Text::toT(Util::formatBytes(d->getSize()))); - - ui->setStatusString(statusString); - tasks.add(UPDATE_ITEM, ui); } @@ -560,20 +557,30 @@ speak(UPDATE_ITEM, ui); } -void TransferView::on(UploadManagerListener::Starting, Upload* aUpload) throw() { - UpdateInfo* ui = new UpdateInfo(aUpload->getUser(), false); +void TransferView::on(UploadManagerListener::Starting, Upload* u) throw() { + UpdateInfo* ui = new UpdateInfo(u->getUser(), false); - ui->setStatus(ItemInfo::STATUS_RUNNING); - ui->setStatusString(T_("Upload starting...")); - ui->setCipher(Text::toT(aUpload->getUserConnection().getCipherName())); - tstring country = Text::toT(Util::getIpCountry(aUpload->getUserConnection().getRemoteIp())); - tstring ip = Text::toT(aUpload->getUserConnection().getRemoteIp()); - if(country.empty()) { - ui->setIP(ip); - } else { - ui->setIP(country + _T(" (") + ip + _T(")")); + starting(ui, u); + + tstring statusString; + + if(u->getUserConnection().isSecure()) { + if(u->getUserConnection().isTrusted()) { + statusString += _T("[S]"); + } else { + statusString += _T("[U]"); + } } + if(u->isSet(Upload::FLAG_ZUPLOAD)) { + statusString += _T("[Z]"); + } + if(!statusString.empty()) { + statusString += _T(" "); + } + statusString += str(TF_("Uploading %1%") % getFile(u)); + ui->setStatusString(statusString); + speak(UPDATE_ITEM, ui); } @@ -582,30 +589,9 @@ Upload* u = *j; UpdateInfo* ui = new UpdateInfo(u->getUser(), false); + ui->setTransfered(u->getPos(), u->getActual()); ui->setSpeed(u->getAverageSpeed()); - tstring statusString; - - if(u->getUserConnection().isSecure()) { - if(u->getUserConnection().isTrusted()) { - statusString += _T("[S]"); - } else { - statusString += _T("[U]"); - } - } - if(u->isSet(Upload::FLAG_ZUPLOAD)) { - statusString += _T("[Z]"); - } - if(!statusString.empty()) { - statusString += _T(" "); - } - statusString += str(TF_("Uploading %1% (%2%/%3%)...") - % getFile(u) - % Text::toT(Util::formatBytes(u->getPos())) - % Text::toT(Util::formatBytes(u->getSize()))); - - ui->setStatusString(statusString); - tasks.add(UPDATE_ITEM, ui); } @@ -624,7 +610,7 @@ UpdateInfo* ui = new UpdateInfo(aTransfer->getUser(), !isUpload); ui->setStatus(ItemInfo::STATUS_WAITING); - ui->setStatusString(T_("Idle...")); + ui->setStatusString(T_("Idle")); speak(UPDATE_ITEM, ui); } Modified: dcplusplus/trunk/win32/TransferView.h =================================================================== --- dcplusplus/trunk/win32/TransferView.h 2008-01-19 15:35:31 UTC (rev 968) +++ dcplusplus/trunk/win32/TransferView.h 2008-01-19 22:19:19 UTC (rev 969) @@ -63,6 +63,7 @@ COLUMN_USER = COLUMN_FIRST, COLUMN_STATUS, COLUMN_SPEED, + COLUMN_CHUNK, COLUMN_TRANSFERED, COLUMN_QUEUED, COLUMN_CIPHER, @@ -91,15 +92,17 @@ Status status; int64_t actual; + int64_t lastActual; int64_t transfered; + int64_t lastTransfered; int64_t queued; int64_t speed; - + int64_t chunk; + tstring columns[COLUMN_LAST]; void update(const UpdateInfo& ui); void disconnect(); - void deleteSelf() { delete this; } double getRatio() { return (transfered > 0) ? (double)actual / (double)transfered : 1.0; } @@ -120,7 +123,8 @@ MASK_SPEED = 1 << 2, MASK_TRANSFERED = 1 << 3, MASK_IP = 1 << 4, - MASK_CIPHER = 1 << 5 + MASK_CIPHER = 1 << 5, + MASK_CHUNK = 1 << 6 }; bool operator==(const ItemInfo& ii) { return download == ii.download && user == ii.user; } @@ -144,6 +148,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; } + int64_t chunk; void setIP(const tstring& aIp) { ip = aIp; updateMask |= MASK_IP; } tstring ip; @@ -168,9 +174,8 @@ HRESULT handleSpeaker(WPARAM wParam, LPARAM lParam); HRESULT handleDestroy(WPARAM wParam, LPARAM lParam); void handleForce(); - void handleSearchAlternates(); void handleCopyNick(); - void handleRemove(); + void handleDisconnect(); void runUserCommand(const UserCommand& uc); bool handleKeyDown(int c); void handleDblClicked(); @@ -198,7 +203,8 @@ virtual void on(UploadManagerListener::Complete, Upload* aUpload) throw(); void onTransferComplete(Transfer* aTransfer, bool isUpload); - + void starting(UpdateInfo* ui, Transfer* t); + #ifdef PORT_ME LRESULT onCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-19 15:35:33
|
Revision: 968 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=968&view=rev Author: arnetheduck Date: 2008-01-19 07:35:31 -0800 (Sat, 19 Jan 2008) Log Message: ----------- Prepare proppages for translation Modified Paths: -------------- dcplusplus/trunk/SConstruct dcplusplus/trunk/win32/Advanced3Page.cpp dcplusplus/trunk/win32/AdvancedPage.cpp dcplusplus/trunk/win32/Appearance2Page.cpp dcplusplus/trunk/win32/AppearancePage.cpp dcplusplus/trunk/win32/CertificatesPage.cpp dcplusplus/trunk/win32/DownloadPage.cpp dcplusplus/trunk/win32/FavoriteDirsPage.cpp dcplusplus/trunk/win32/GeneralPage.cpp dcplusplus/trunk/win32/LogPage.cpp dcplusplus/trunk/win32/NetworkPage.cpp dcplusplus/trunk/win32/PropPage.cpp dcplusplus/trunk/win32/PropPage.h dcplusplus/trunk/win32/QueuePage.cpp dcplusplus/trunk/win32/TabsPage.cpp dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/UCPage.cpp dcplusplus/trunk/win32/UploadPage.cpp dcplusplus/trunk/win32/WindowsPage.cpp Modified: dcplusplus/trunk/SConstruct =================================================================== --- dcplusplus/trunk/SConstruct 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/SConstruct 2008-01-19 15:35:31 UTC (rev 968) @@ -159,7 +159,7 @@ pot_args = ['xgettext', '--from-code=UTF-8', '--foreign-user',# '--package-name=$PACKAGE', '--copyright-holder=Jacek Sieka', '--msgid-bugs-address=dcp...@li...', '--no-wrap', '--keyword=_', '--keyword=T_', '--keyword=TF_', '--keyword=TFN_:1,2', - '--keyword=F_', '--keyword=gettext_noop', '--keyword=N_', '--boost', + '--keyword=F_', '--keyword=gettext_noop', '--keyword=N_', '--boost', '-s', '--output=$TARGET', '$SOURCES'] pot_bld = Builder (action = Action([pot_args], 'Extracting messages to $TARGET from $SOURCES')) Modified: dcplusplus/trunk/win32/Advanced3Page.cpp =================================================================== --- dcplusplus/trunk/win32/Advanced3Page.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/Advanced3Page.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -25,6 +25,7 @@ #include <dcpp/SettingsManager.h> PropPage::TextItem Advanced3Page::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_B, ResourceManager::B }, { IDC_SETTINGS_WRITE_BUFFER, ResourceManager::SETTINGS_WRITE_BUFFER }, { IDC_SETTINGS_KB, ResourceManager::KiB }, @@ -40,7 +41,8 @@ { IDC_SETTINGS_AUTO_REFRESH_TIME, ResourceManager::SETTINGS_AUTO_REFRESH_TIME }, { IDC_SETTINGS_AUTO_SEARCH_LIMIT, ResourceManager::SETTINGS_AUTO_SEARCH_LIMIT }, { IDC_SETTINGS_MIN_SEGMENT_SIZE, ResourceManager::SETTINGS_MIN_SEGMENT_SIZE }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item Advanced3Page::items[] = { Modified: dcplusplus/trunk/win32/AdvancedPage.cpp =================================================================== --- dcplusplus/trunk/win32/AdvancedPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/AdvancedPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -27,6 +27,7 @@ PropPage::Item AdvancedPage::items[] = { { 0, 0, PropPage::T_END } }; AdvancedPage::ListItem AdvancedPage::listItems[] = { +#ifdef PORT_ME { SettingsManager::AUTO_AWAY, ResourceManager::SETTINGS_AUTO_AWAY }, { SettingsManager::AUTO_FOLLOW, ResourceManager::SETTINGS_AUTO_FOLLOW }, { SettingsManager::CLEAR_SEARCH, ResourceManager::SETTINGS_CLEAR_SEARCH }, @@ -46,7 +47,8 @@ { SettingsManager::USE_CTRL_FOR_LINE_HISTORY, ResourceManager::SETTINGS_USE_CTRL_FOR_LINE_HISTORY }, { SettingsManager::AUTO_KICK_NO_FAVS, ResourceManager::SETTINGS_AUTO_KICK_NO_FAVS }, { SettingsManager::SHOW_SHELL_MENU, ResourceManager::SETTINGS_SHOW_SHELL_MENU }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; AdvancedPage::AdvancedPage(SmartWin::Widget* parent) : PropPage(parent) { Modified: dcplusplus/trunk/win32/Appearance2Page.cpp =================================================================== --- dcplusplus/trunk/win32/Appearance2Page.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/Appearance2Page.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -26,6 +26,7 @@ #include "WinUtil.h" PropPage::TextItem Appearance2Page::texts[] = { +#ifdef PORT_ME { IDC_BEEP_NOTIFICATION, ResourceManager::SETTINGS_NOTIFICATION_SOUND }, { IDC_BROWSE, ResourceManager::BROWSE_ACCEL }, { IDC_SETTINGS_COLORS, ResourceManager::SETTINGS_COLORS }, @@ -38,7 +39,8 @@ { IDC_PRIVATE_MESSAGE_BEEP, ResourceManager::SETTINGS_PM_BEEP }, { IDC_PRIVATE_MESSAGE_BEEP_OPEN, ResourceManager::SETTINGS_PM_BEEP_OPEN }, { IDC_SETTINGS_DOWNLOAD_BAR_COLOR, ResourceManager::DOWNLOADS }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item Appearance2Page::items[] = { Modified: dcplusplus/trunk/win32/AppearancePage.cpp =================================================================== --- dcplusplus/trunk/win32/AppearancePage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/AppearancePage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -28,12 +28,14 @@ #include "WinUtil.h" PropPage::TextItem AppearancePage::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_APPEARANCE_OPTIONS, ResourceManager::SETTINGS_OPTIONS }, { IDC_SETTINGS_DEFAULT_AWAY_MSG, ResourceManager::SETTINGS_DEFAULT_AWAY_MSG }, { IDC_SETTINGS_TIME_STAMPS_FORMAT, ResourceManager::SETTINGS_TIME_STAMPS_FORMAT }, { IDC_SETTINGS_LANGUAGE_FILE, ResourceManager::SETTINGS_LANGUAGE_FILE }, { IDC_SETTINGS_REQUIRES_RESTART, ResourceManager::SETTINGS_REQUIRES_RESTART }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item AppearancePage::items[] = { @@ -43,6 +45,7 @@ }; PropPage::ListItem AppearancePage::listItems[] = { +#ifdef PORT_ME { SettingsManager::ALT_SORT_ORDER, ResourceManager::SETTINGS_ALT_SORT_ORDER }, { SettingsManager::FILTER_MESSAGES, ResourceManager::SETTINGS_FILTER_MESSAGES }, { SettingsManager::MINIMIZE_TRAY, ResourceManager::SETTINGS_MINIMIZE_TRAY }, @@ -54,7 +57,8 @@ { SettingsManager::USE_SYSTEM_ICONS, ResourceManager::SETTINGS_USE_SYSTEM_ICONS }, { SettingsManager::USE_OEM_MONOFONT, ResourceManager::SETTINGS_USE_OEM_MONOFONT }, { SettingsManager::GET_USER_COUNTRY, ResourceManager::SETTINGS_GET_USER_COUNTRY }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; AppearancePage::AppearancePage(SmartWin::Widget* parent) : PropPage(parent), languages(0) { Modified: dcplusplus/trunk/win32/CertificatesPage.cpp =================================================================== --- dcplusplus/trunk/win32/CertificatesPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/CertificatesPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -27,7 +27,7 @@ #include "WinUtil.h" PropPage::TextItem CertificatesPage::texts[] = { - { 0, ResourceManager::SETTINGS_AUTO_AWAY } + { 0, 0 } }; PropPage::Item CertificatesPage::items[] = { @@ -38,10 +38,12 @@ }; PropPage::ListItem CertificatesPage::listItems[] = { +#ifdef PORT_ME { SettingsManager::USE_TLS, ResourceManager::SETTINGS_USE_TLS }, { SettingsManager::ALLOW_UNTRUSTED_HUBS, ResourceManager::SETTINGS_ALLOW_UNTRUSTED_HUBS }, { SettingsManager::ALLOW_UNTRUSTED_CLIENTS, ResourceManager::SETTINGS_ALLOW_UNTRUSTED_CLIENTS, }, - { 0, ResourceManager::SETTINGS_ALLOW_UNTRUSTED_CLIENTS, }, +#endif + { 0, 0 } }; CertificatesPage::CertificatesPage(SmartWin::Widget* parent) : PropPage(parent) { Modified: dcplusplus/trunk/win32/DownloadPage.cpp =================================================================== --- dcplusplus/trunk/win32/DownloadPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/DownloadPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -27,6 +27,7 @@ #include "HubListsDlg.h" PropPage::TextItem DownloadPage::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_DIRECTORIES, ResourceManager::SETTINGS_DIRECTORIES }, { IDC_SETTINGS_DOWNLOAD_DIRECTORY, ResourceManager::SETTINGS_DOWNLOAD_DIRECTORY }, { IDC_BROWSEDIR, ResourceManager::BROWSE_ACCEL }, @@ -40,7 +41,8 @@ { IDC_SETTINGS_PUBLIC_HUB_LIST_URL, ResourceManager::SETTINGS_PUBLIC_HUB_LIST_URL }, { IDC_SETTINGS_LIST_CONFIG, ResourceManager::SETTINGS_CONFIGURE_HUB_LISTS }, { IDC_SETTINGS_PUBLIC_HUB_LIST_HTTP_PROXY, ResourceManager::SETTINGS_PUBLIC_HUB_LIST_HTTP_PROXY }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item DownloadPage::items[] = { Modified: dcplusplus/trunk/win32/FavoriteDirsPage.cpp =================================================================== --- dcplusplus/trunk/win32/FavoriteDirsPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/FavoriteDirsPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -29,11 +29,13 @@ #include "LineDlg.h" PropPage::TextItem FavoriteDirsPage::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_FAVORITE_DIRECTORIES, ResourceManager::SETTINGS_FAVORITE_DIRS }, { IDC_REMOVE, ResourceManager::REMOVE }, { IDC_ADD, ResourceManager::SETTINGS_ADD_FOLDER }, { IDC_RENAME, ResourceManager::SETTINGS_RENAME_FOLDER }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; FavoriteDirsPage::FavoriteDirsPage(SmartWin::Widget* parent) : PropPage(parent) { Modified: dcplusplus/trunk/win32/GeneralPage.cpp =================================================================== --- dcplusplus/trunk/win32/GeneralPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/GeneralPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -25,13 +25,15 @@ #include <dcpp/SettingsManager.h> PropPage::TextItem GeneralPage::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_PERSONAL_INFORMATION, ResourceManager::SETTINGS_PERSONAL_INFORMATION }, { IDC_SETTINGS_NICK, ResourceManager::NICK }, { IDC_SETTINGS_EMAIL, ResourceManager::EMAIL }, { IDC_SETTINGS_DESCRIPTION, ResourceManager::DESCRIPTION }, { IDC_SETTINGS_UPLOAD_LINE_SPEED, ResourceManager::SETTINGS_UPLOAD_LINE_SPEED }, { IDC_SETTINGS_MEBIBITS, ResourceManager::MiBITSPS }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item GeneralPage::items[] = { Modified: dcplusplus/trunk/win32/LogPage.cpp =================================================================== --- dcplusplus/trunk/win32/LogPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/LogPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -28,12 +28,14 @@ #include "WinUtil.h" PropPage::TextItem LogPage::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_LOGGING, ResourceManager::SETTINGS_LOGGING }, { IDC_SETTINGS_LOG_DIR, ResourceManager::DIRECTORY }, { IDC_BROWSE_LOG, ResourceManager::BROWSE_ACCEL }, { IDC_SETTINGS_FORMAT, ResourceManager::SETTINGS_FORMAT }, { IDC_SETTINGS_FILE_NAME, ResourceManager::SETTINGS_FILE_NAME }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item LogPage::items[] = { @@ -42,6 +44,7 @@ }; PropPage::ListItem LogPage::listItems[] = { +#ifdef PORT_ME { SettingsManager::LOG_MAIN_CHAT, ResourceManager::SETTINGS_LOG_MAIN_CHAT }, { SettingsManager::LOG_PRIVATE_CHAT, ResourceManager::SETTINGS_LOG_PRIVATE_CHAT }, { SettingsManager::LOG_DOWNLOADS, ResourceManager::SETTINGS_LOG_DOWNLOADS }, @@ -49,7 +52,8 @@ { SettingsManager::LOG_SYSTEM, ResourceManager::SETTINGS_LOG_SYSTEM_MESSAGES }, { SettingsManager::LOG_STATUS_MESSAGES, ResourceManager::SETTINGS_LOG_STATUS_MESSAGES }, { SettingsManager::LOG_FILELIST_TRANSFERS, ResourceManager::SETTINGS_LOG_FILELIST_TRANSFERS }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; LogPage::LogPage(SmartWin::Widget* parent) : PropPage(parent) { Modified: dcplusplus/trunk/win32/NetworkPage.cpp =================================================================== --- dcplusplus/trunk/win32/NetworkPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/NetworkPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -27,6 +27,7 @@ #include "WinUtil.h" PropPage::TextItem NetworkPage::texts[] = { +#ifdef PORT_ME { IDC_DIRECT, ResourceManager::SETTINGS_DIRECT }, { IDC_DIRECT_OUT, ResourceManager::SETTINGS_DIRECT }, { IDC_FIREWALL_UPNP, ResourceManager::SETTINGS_FIREWALL_UPNP }, @@ -46,7 +47,8 @@ { IDC_SOCKS_RESOLVE, ResourceManager::SETTINGS_SOCKS5_RESOLVE }, { IDC_SETTINGS_INCOMING, ResourceManager::SETTINGS_INCOMING }, { IDC_SETTINGS_OUTGOING, ResourceManager::SETTINGS_OUTGOING }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item NetworkPage::items[] = { Modified: dcplusplus/trunk/win32/PropPage.cpp =================================================================== --- dcplusplus/trunk/win32/PropPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/PropPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -67,8 +67,9 @@ LVITEM lvi = { LVIF_TEXT }; for(int i = 0; listItems[i].setting != 0; i++) { + tstring str = T_(listItems[i].desc); lvi.iItem = i; - lvi.pszText = const_cast<TCHAR*>(CTSTRING_I(listItems[i].desc)); + lvi.pszText = const_cast<TCHAR*>(str.c_str()); ListView_InsertItem(list, &lvi); ListView_SetCheckState(list, i, settings->getBool(SettingsManager::IntSetting(listItems[i].setting), true)); } @@ -124,7 +125,7 @@ if (textItems != NULL) { for(int i = 0; textItems[i].itemID != 0; i++) { ::SetDlgItemText(page, textItems[i].itemID, - CTSTRING_I(textItems[i].translatedString)); + CT_(textItems[i].translatedString)); } } } Modified: dcplusplus/trunk/win32/PropPage.h =================================================================== --- dcplusplus/trunk/win32/PropPage.h 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/PropPage.h 2008-01-19 15:35:31 UTC (rev 968) @@ -21,7 +21,6 @@ #define SETTINGS_BUF_LEN 1024 -#include <dcpp/ResourceManager.h> #include "WidgetFactory.h" #include "resource.h" @@ -47,11 +46,11 @@ }; struct ListItem { int setting; - ResourceManager::Strings desc; + const char* desc; }; struct TextItem { WORD itemID; - ResourceManager::Strings translatedString; + const char* translatedString; }; protected: Modified: dcplusplus/trunk/win32/QueuePage.cpp =================================================================== --- dcplusplus/trunk/win32/QueuePage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/QueuePage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -25,6 +25,7 @@ #include <dcpp/SettingsManager.h> PropPage::TextItem QueuePage::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_AUTOPRIO, ResourceManager::SETTINGS_PRIO_AUTOPRIO }, { IDC_SETTINGS_PRIO_HIGHEST, ResourceManager::SETTINGS_PRIO_HIGHEST }, { IDC_SETTINGS_KB3, ResourceManager::KiB }, @@ -47,7 +48,8 @@ { IDC_SETTINGS_AUTODROP_FILESIZE, ResourceManager::SETTINGS_AUTODROP_FILESIZE }, { IDC_SETTINGS_KB7, ResourceManager::KiB }, { IDC_SETTINGS_OTHER_QUEUE_OPTIONS, ResourceManager::SETTINGS_OTHER_QUEUE_OPTIONS }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item QueuePage::items[] = { @@ -65,6 +67,7 @@ }; PropPage::ListItem QueuePage::optionItems[] = { +#ifdef PORT_ME { SettingsManager::PRIO_LOWEST, ResourceManager::SETTINGS_PRIO_LOWEST }, { SettingsManager::AUTODROP_ALL, ResourceManager::SETTINGS_AUTODROP_ALL }, { SettingsManager::AUTODROP_FILELISTS, ResourceManager::SETTINGS_AUTODROP_FILELISTS }, @@ -75,7 +78,8 @@ { SettingsManager::DONT_DL_ALREADY_SHARED, ResourceManager::SETTINGS_DONT_DL_ALREADY_SHARED }, { SettingsManager::DONT_DL_ALREADY_QUEUED, ResourceManager::SETTINGS_DONT_DL_ALREADY_QUEUED }, { SettingsManager::ANTI_FRAG, ResourceManager::SETTINGS_ANTI_FRAG }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; QueuePage::QueuePage(SmartWin::Widget* parent) : PropPage(parent) { Modified: dcplusplus/trunk/win32/TabsPage.cpp =================================================================== --- dcplusplus/trunk/win32/TabsPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/TabsPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -29,11 +29,14 @@ }; PropPage::TextItem TabsPage::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_BOLD_CONTENTS, ResourceManager::SETTINGS_BOLD_OPTIONS }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::ListItem TabsPage::listItems[] = { +#ifdef PORT_ME { SettingsManager::BOLD_HUB, ResourceManager::HUB }, { SettingsManager::BOLD_PM, ResourceManager::PRIVATE_MESSAGE }, { SettingsManager::BOLD_SEARCH, ResourceManager::SEARCH }, @@ -42,7 +45,8 @@ { SettingsManager::BOLD_FINISHED_DOWNLOADS, ResourceManager::FINISHED_DOWNLOADS }, { SettingsManager::BOLD_WAITING_USERS, ResourceManager::WAITING_USERS }, { SettingsManager::BOLD_FINISHED_UPLOADS, ResourceManager::FINISHED_UPLOADS }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; TabsPage::TabsPage(SmartWin::Widget* parent) : PropPage(parent) { Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -40,7 +40,7 @@ N_("User"), N_("Status"), N_("Speed"), - N_("Transfered"), + N_("Transfered (Ratio)"), N_("Queued"), N_("Cipher"), N_("IP") @@ -127,7 +127,6 @@ } /// @todo Fix multiple selection menu... - int i = -1; ItemInfo* ii = transfers->getSelectedData(); WidgetMenuPtr contextMenu = makeContextMenu(ii); contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); @@ -404,9 +403,8 @@ columns[COLUMN_TRANSFERED] = Text::toT(Util::toString(0)); if(aDownload) { queued = QueueManager::getInstance()->getQueued(u); - columns[COLUMN_QUEUED] = Text::toT(Util::toString(queued)); + columns[COLUMN_QUEUED] = Text::toT(Util::formatBytes(queued)); } - } void TransferView::ItemInfo::update(const UpdateInfo& ui) { @@ -415,28 +413,29 @@ if(download) { // Also update queued when status changes... queued = QueueManager::getInstance()->getQueued(user); - columns[COLUMN_QUEUED] = Text::toT(Util::toString(queued)); + columns[COLUMN_QUEUED] = Text::toT(Util::formatBytes(queued)); } - } + if(ui.updateMask & UpdateInfo::MASK_STATUS_STRING) { // No slots etc from transfermanager better than disconnected from connectionmanager if(!transferFailed) columns[COLUMN_STATUS] = ui.statusString; transferFailed = ui.transferFailed; } + if(ui.updateMask & UpdateInfo::MASK_TRANSFERED) { actual = ui.actual; transfered = ui.transfered; if(actual == transfered) { columns[COLUMN_TRANSFERED] = Text::toT(Util::formatBytes(transfered)); } else { - columns[COLUMN_TRANSFERED] = str(TF_("%1% (%2%, %3%%%)") + columns[COLUMN_TRANSFERED] = str(TF_("%1% (%|.2|)") % Text::toT(Util::formatBytes(transfered)) - % Text::toT(Util::formatBytes(actual)) - % (actual * 100.0 / transfered)); + % (static_cast<double>(actual) / transfered)); } } + if(ui.updateMask & UpdateInfo::MASK_SPEED) { speed = ui.speed; if (status == STATUS_RUNNING) { @@ -445,9 +444,11 @@ columns[COLUMN_SPEED] = Util::emptyStringT; } } + if(ui.updateMask & UpdateInfo::MASK_IP) { columns[COLUMN_IP] = ui.ip; } + if(ui.updateMask & UpdateInfo::MASK_CIPHER) { columns[COLUMN_CIPHER] = ui.cipher; } Modified: dcplusplus/trunk/win32/UCPage.cpp =================================================================== --- dcplusplus/trunk/win32/UCPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/UCPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -28,12 +28,14 @@ #include "HoldRedraw.h" PropPage::TextItem UCPage::texts[] = { - { IDC_MOVE_UP, ResourceManager::MOVE_UP }, + { IDC_MOVE_UP, N_("Move &Up") }, +#ifdef PORT_ME { IDC_MOVE_DOWN, ResourceManager::MOVE_DOWN }, { IDC_ADD_MENU, ResourceManager::ADD }, { IDC_CHANGE_MENU, ResourceManager::SETTINGS_CHANGE }, { IDC_REMOVE_MENU, ResourceManager::REMOVE }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item UCPage::items[] = { Modified: dcplusplus/trunk/win32/UploadPage.cpp =================================================================== --- dcplusplus/trunk/win32/UploadPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/UploadPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -30,6 +30,7 @@ #include "HashProgressDlg.h" PropPage::TextItem UploadPage::texts[] = { +#ifdef PORT_ME { IDC_SETTINGS_SHARED_DIRECTORIES, ResourceManager::SETTINGS_SHARED_DIRECTORIES }, { IDC_SETTINGS_SHARE_SIZE, ResourceManager::SETTINGS_SHARE_SIZE }, { IDC_SHAREHIDDEN, ResourceManager::SETTINGS_SHARE_HIDDEN }, @@ -40,7 +41,8 @@ { IDC_SETTINGS_KBPS, ResourceManager::KiBPS }, { IDC_SETTINGS_UPLOADS_SLOTS, ResourceManager::SETTINGS_UPLOADS_SLOTS }, { IDC_SETTINGS_ONLY_HASHED, ResourceManager::SETTINGS_ONLY_HASHED }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; PropPage::Item UploadPage::items[] = { Modified: dcplusplus/trunk/win32/WindowsPage.cpp =================================================================== --- dcplusplus/trunk/win32/WindowsPage.cpp 2008-01-19 10:18:34 UTC (rev 967) +++ dcplusplus/trunk/win32/WindowsPage.cpp 2008-01-19 15:35:31 UTC (rev 968) @@ -27,13 +27,16 @@ PropPage::Item WindowsPage::items[] = { { 0, 0, PropPage::T_END } }; PropPage::TextItem WindowsPage::textItem[] = { +#ifdef PORT_ME { IDC_SETTINGS_AUTO_OPEN, ResourceManager::SETTINGS_AUTO_OPEN }, { IDC_SETTINGS_WINDOWS_OPTIONS, ResourceManager::SETTINGS_WINDOWS_OPTIONS }, { IDC_SETTINGS_CONFIRM_OPTIONS, ResourceManager::SETTINGS_CONFIRM_DIALOG_OPTIONS }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; WindowsPage::ListItem WindowsPage::listItems[] = { +#ifdef PORT_ME { SettingsManager::OPEN_SYSTEM_LOG, ResourceManager::SYSTEM_LOG }, { SettingsManager::OPEN_FAVORITE_USERS, ResourceManager::FAVORITE_USERS }, { SettingsManager::OPEN_QUEUE, ResourceManager::DOWNLOAD_QUEUE }, @@ -46,10 +49,12 @@ { SettingsManager::OPEN_PUBLIC, ResourceManager::PUBLIC_HUBS }, { SettingsManager::OPEN_FAVORITE_HUBS, ResourceManager::FAVORITE_HUBS }, { SettingsManager::OPEN_DOWNLOADS, ResourceManager::DOWNLOADS }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; WindowsPage::ListItem WindowsPage::optionItems[] = { +#ifdef PORT_ME { SettingsManager::POPUP_PMS, ResourceManager::SETTINGS_POPUP_PMS }, { SettingsManager::POPUP_HUB_PMS, ResourceManager::SETTINGS_POPUP_HUB_PMS }, { SettingsManager::POPUP_BOT_PMS, ResourceManager::SETTINGS_POPUP_BOT_PMS }, @@ -60,14 +65,17 @@ { SettingsManager::IGNORE_BOT_PMS, ResourceManager::SETTINGS_IGNORE_BOT_PMS }, { SettingsManager::TOGGLE_ACTIVE_WINDOW, ResourceManager::SETTINGS_TOGGLE_ACTIVE_WINDOW }, { SettingsManager::PROMPT_PASSWORD, ResourceManager::SETTINGS_PROMPT_PASSWORD }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; WindowsPage::ListItem WindowsPage::confirmItems[] = { +#ifdef PORT_ME { SettingsManager::CONFIRM_EXIT, ResourceManager::SETTINGS_CONFIRM_EXIT }, { SettingsManager::CONFIRM_HUB_REMOVAL, ResourceManager::SETTINGS_CONFIRM_HUB_REMOVAL }, { SettingsManager::CONFIRM_ITEM_REMOVAL, ResourceManager::SETTINGS_CONFIRM_ITEM_REMOVAL }, - { 0, ResourceManager::SETTINGS_AUTO_AWAY } +#endif + { 0, 0 } }; WindowsPage::WindowsPage(SmartWin::Widget* parent) : PropPage(parent) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-19 10:18:36
|
Revision: 967 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=967&view=rev Author: arnetheduck Date: 2008-01-19 02:18:34 -0800 (Sat, 19 Jan 2008) Log Message: ----------- Translations + redone transferview (unfinished) Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/ADLSearch.h dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/QueueManager.h dcplusplus/trunk/win32/ADLSProperties.cpp dcplusplus/trunk/win32/ADLSearchFrame.cpp dcplusplus/trunk/win32/AboutDlg.cpp dcplusplus/trunk/win32/CommandDlg.cpp dcplusplus/trunk/win32/DirectoryListingFrame.cpp dcplusplus/trunk/win32/FavHubProperties.cpp dcplusplus/trunk/win32/FinishedFrameBase.h dcplusplus/trunk/win32/HashProgressDlg.cpp dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MagnetDlg.cpp dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/PublicHubsFrame.cpp dcplusplus/trunk/win32/QueueFrame.cpp dcplusplus/trunk/win32/SearchFrame.cpp dcplusplus/trunk/win32/SpyFrame.cpp dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/TransferView.h dcplusplus/trunk/win32/WinUtil.cpp dcplusplus/trunk/win32/stdafx.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/changelog.txt 2008-01-19 10:18:34 UTC (rev 967) @@ -6,12 +6,14 @@ * [ADC] Searches filtered by token if available so that each search window only gets its own results * [ADC] Implemented test version of bloom filters which will dramatically reduce hub bandwidth usage for TTH searches * Fixed a crash with partial list browsing -* Replaced homegrown i18n solution with gettext +* Replaced homegrown i18n solution with gettext (thanks david grundberg, mikejj) * Fixed an issue with nick encodings and nmdc connections (thanks stanislav maslovski) * Added download view which shows per-file download information * Chat timestamps on by default * Added tab drag/drop (thanks poy) +* Changed Pothead to mikejj + -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) * Use system header arrows on common controls 6+ (thanks poy) Modified: dcplusplus/trunk/dcpp/ADLSearch.h =================================================================== --- dcplusplus/trunk/dcpp/ADLSearch.h 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/dcpp/ADLSearch.h 2008-01-19 10:18:34 UTC (rev 967) @@ -110,26 +110,20 @@ } } - tstring SourceTypeToDisplayString(SourceType t) { - switch(t) { - default: - case OnlyFile: return TSTRING(FILENAME); - case OnlyDirectory: return TSTRING(DIRECTORY); - case FullPath: return TSTRING(ADLS_FULL_PATH); - } - } - // Maximum & minimum file sizes (in bytes). // Negative values means do not check. int64_t minFileSize; int64_t maxFileSize; + enum SizeType { SizeBytes = TypeFirst, SizeKibiBytes, SizeMebiBytes, SizeGibiBytes }; + SizeType typeFileSize; + SizeType StringToSizeType(const string& s) { if(Util::stricmp(s.c_str(), "B") == 0) { return SizeBytes; @@ -143,6 +137,7 @@ return SizeBytes; } } + string SizeTypeToString(SizeType t) { switch(t) { default: @@ -152,15 +147,7 @@ case SizeGibiBytes: return "GiB"; } } - tstring SizeTypeToDisplayString(SizeType t) { - switch(t) { - default: - case SizeBytes: return CTSTRING(B); - case SizeKibiBytes: return CTSTRING(KiB); - case SizeMebiBytes: return CTSTRING(MiB); - case SizeGibiBytes: return CTSTRING(GiB); - } - } + int64_t GetSizeBase() { switch(typeFileSize) { default: Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -253,6 +253,25 @@ add(qi); } +int64_t QueueManager::UserQueue::getQueued(const UserPtr& aUser) const { + int64_t total = 0; + for(size_t i = 0; i < QueueItem::LAST; ++i) { + const QueueItem::UserListMap& ulm = userQueue[i]; + QueueItem::UserListMap::const_iterator iulm = ulm.find(aUser); + if(iulm == ulm.end()) { + continue; + } + + for(QueueItem::List::const_iterator j = iulm->second.begin(); j != iulm->second.end(); ++j) { + const QueueItem::Ptr qi = *j; + if(qi->getSize() != -1) { + total += qi->getSize() - qi->getDownloadedBytes(); + } + } + } + return total; +} + QueueItem* QueueManager::UserQueue::getRunning(const UserPtr& aUser) { QueueItem::UserIter i = running.find(aUser); return (i == running.end()) ? 0 : i->second; @@ -1061,6 +1080,11 @@ } } +int64_t QueueManager::getQueued(const UserPtr& aUser) const { + Lock l(cs); + return userQueue.getQueued(aUser); +} + void QueueManager::removeSource(const UserPtr& aUser, int reason) throw() { bool isRunning = false; string removeRunning; Modified: dcplusplus/trunk/dcpp/QueueManager.h =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.h 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/dcpp/QueueManager.h 2008-01-19 10:18:34 UTC (rev 967) @@ -108,6 +108,8 @@ void putDownload(Download* aDownload, bool finished) throw(); void setFile(Download* download); + int64_t getQueued(const UserPtr& aUser) const; + /** @return The highest priority download the user has, PAUSED may also mean no downloads */ QueueItem::Priority hasDownload(const UserPtr& aUser) throw(); @@ -187,6 +189,7 @@ bool isRunning(const UserPtr& aUser) const { return (running.find(aUser) != running.end()); } + int64_t getQueued(const UserPtr& aUser) const; private: /** QueueItems by priority and user (this is where the download order is determined) */ QueueItem::UserListMap userQueue[QueueItem::LAST]; Modified: dcplusplus/trunk/win32/ADLSProperties.cpp =================================================================== --- dcplusplus/trunk/win32/ADLSProperties.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/ADLSProperties.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -47,12 +47,12 @@ bool ADLSProperties::handleInitDialog() { // Translate dialog setText(T_("ADLSearch Properties")); - ::SetDlgItemText(handle(), IDC_ADLSP_SEARCH, CTSTRING(ADLS_SEARCH_STRING)); - ::SetDlgItemText(handle(), IDC_ADLSP_TYPE, CTSTRING(ADLS_TYPE)); - ::SetDlgItemText(handle(), IDC_ADLSP_SIZE_MIN, CTSTRING(ADLS_SIZE_MIN)); - ::SetDlgItemText(handle(), IDC_ADLSP_SIZE_MAX, CTSTRING(ADLS_SIZE_MAX)); - ::SetDlgItemText(handle(), IDC_ADLSP_UNITS, CTSTRING(ADLS_UNITS)); - ::SetDlgItemText(handle(), IDC_ADLSP_DESTINATION, CTSTRING(ADLS_DESTINATION)); + ::SetDlgItemText(handle(), IDC_ADLSP_SEARCH, CT_("Search String")); + ::SetDlgItemText(handle(), IDC_ADLSP_TYPE, CT_("Search Type")); + ::SetDlgItemText(handle(), IDC_ADLSP_SIZE_MIN, CT_("Min FileSize")); + ::SetDlgItemText(handle(), IDC_ADLSP_SIZE_MAX, CT_("Max FileSize")); + ::SetDlgItemText(handle(), IDC_ADLSP_UNITS, CT_("Size Type")); + ::SetDlgItemText(handle(), IDC_ADLSP_DESTINATION, CT_("Destination Directory")); searchString = attachTextBox(IDC_SEARCH_STRING); searchString->setText(Text::toT(search->searchString)); @@ -109,11 +109,11 @@ search->sourceType = (ADLSearch::SourceType)searchType->getSelectedIndex(); tstring minFileSize = minSize->getText(); - search->minFileSize = minFileSize.empty() ? -1 : Util::toInt64(Text::fromT(minFileSize)); + tstring maxFileSize = maxSize->getText(); - search->maxFileSize = maxFileSize.empty() ? -1 : Util::toInt64(Text::fromT(maxFileSize)); + search->typeFileSize = (ADLSearch::SizeType)sizeType->getSelectedIndex(); search->destDir = Text::fromT(destDir->getText()); Modified: dcplusplus/trunk/win32/ADLSearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -305,10 +305,10 @@ void ADLSearchFrame::addEntry(ADLSearch& search, int index) { TStringList l; l.push_back(Text::toT(search.searchString)); - l.push_back(search.SourceTypeToDisplayString(search.sourceType)); + l.push_back(Text::toT(search.SourceTypeToString(search.sourceType))); l.push_back(Text::toT(search.destDir)); - l.push_back((search.minFileSize >= 0) ? Text::toT(Util::toString(search.minFileSize)) + _T(" ") + search.SizeTypeToDisplayString(search.typeFileSize) : Util::emptyStringT); - l.push_back((search.maxFileSize >= 0) ? Text::toT(Util::toString(search.maxFileSize)) + _T(" ") + search.SizeTypeToDisplayString(search.typeFileSize) : Util::emptyStringT); + l.push_back((search.minFileSize >= 0) ? Text::toT(Util::toString(search.minFileSize)) + _T(" ") + Text::toT(search.SizeTypeToString(search.typeFileSize)) : Util::emptyStringT); + l.push_back((search.maxFileSize >= 0) ? Text::toT(Util::toString(search.maxFileSize)) + _T(" ") + Text::toT(search.SizeTypeToString(search.typeFileSize)) : Util::emptyStringT); int itemCount = items->insert(l, 0, index); if(index == -1) index = itemCount; Modified: dcplusplus/trunk/win32/AboutDlg.cpp =================================================================== --- dcplusplus/trunk/win32/AboutDlg.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/AboutDlg.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -42,7 +42,7 @@ "bsod, sulan, jonathan stone, tim burton, izzzo, guitarm, paka, nils maier, jens oknelid, yoji, " "krzysztof tyszecki, poison, mikejj, pur, bigmuscle, martin, jove, bart vullings, " "steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45, mikael eman, james ross," -"stanislav maslovski. " +"stanislav maslovski, david grundberg. " "Keep it coming!"; AboutDlg::AboutDlg(SmartWin::Widget* parent) : SmartWin::WidgetFactory<SmartWin::WidgetModalDialog>(parent) { @@ -63,7 +63,7 @@ sprintf(buf, "Ratio (up/down): %.2f", ((double)SETTING(TOTAL_UPLOAD)) / ((double)SETTING(TOTAL_DOWNLOAD))); setItemText(IDC_RATIO, Text::toT(buf)); } - setItemText(IDC_LATEST, CTSTRING(DOWNLOADING)); + setItemText(IDC_LATEST, T_("Downloading...")); attachButton(IDOK)->onClicked(std::tr1::bind(&AboutDlg::endDialog, this, IDOK)); Modified: dcplusplus/trunk/win32/CommandDlg.cpp =================================================================== --- dcplusplus/trunk/win32/CommandDlg.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/CommandDlg.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -62,14 +62,14 @@ bool CommandDlg::handleInitDialog() { // Translate setText(T_("Create / Modify Command")); - ::SetDlgItemText(handle(), IDC_SETTINGS_TYPE, CTSTRING(USER_CMD_TYPE)); - ::SetDlgItemText(handle(), IDC_SETTINGS_CONTEXT, CTSTRING(USER_CMD_CONTEXT)); - ::SetDlgItemText(handle(), IDC_SETTINGS_PARAMETERS, CTSTRING(USER_CMD_PARAMETERS)); - ::SetDlgItemText(handle(), IDC_SETTINGS_NAME, CTSTRING(HUB_NAME)); - ::SetDlgItemText(handle(), IDC_SETTINGS_COMMAND, CTSTRING(USER_CMD_COMMAND)); - ::SetDlgItemText(handle(), IDC_SETTINGS_HUB, CTSTRING(USER_CMD_HUB)); - ::SetDlgItemText(handle(), IDC_SETTINGS_TO, CTSTRING(USER_CMD_TO)); - ::SetDlgItemText(handle(), IDC_USER_CMD_PREVIEW, CTSTRING(USER_CMD_PREVIEW)); + ::SetDlgItemText(handle(), IDC_SETTINGS_TYPE, CT_("Command Type")); + ::SetDlgItemText(handle(), IDC_SETTINGS_CONTEXT, CT_("Context")); + ::SetDlgItemText(handle(), IDC_SETTINGS_PARAMETERS, CT_("Parameters")); + ::SetDlgItemText(handle(), IDC_SETTINGS_NAME, CT_("Name")); + ::SetDlgItemText(handle(), IDC_SETTINGS_COMMAND, CT_("Command")); + ::SetDlgItemText(handle(), IDC_SETTINGS_HUB, CT_("Hub IP / DNS (empty = all, 'op' = where operator)")); + ::SetDlgItemText(handle(), IDC_SETTINGS_TO, CT_("To")); + ::SetDlgItemText(handle(), IDC_USER_CMD_PREVIEW, CT_("Text sent to hub")); separator = attachRadioButton(IDC_SETTINGS_SEPARATOR); separator->setText(T_("Separator")); Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -655,9 +655,9 @@ } void DirectoryListingFrame::initStatusText() { - setStatus(STATUS_TOTAL_FILES, Text::toT(STRING(FILES) + ": " + Util::toString(dl->getTotalFileCount(true)))); - setStatus(STATUS_TOTAL_SIZE, Text::toT(STRING(SIZE) + ": " + Util::formatBytes(dl->getTotalSize(true)))); - setStatus(STATUS_SPEED, Text::toT(STRING(SPEED) + ": " + Util::formatBytes(speed) + "/s")); + setStatus(STATUS_TOTAL_FILES, str(TF_("Files: %1%") % dl->getTotalFileCount(true))); + setStatus(STATUS_TOTAL_SIZE, str(TF_("Size: %1%") % Text::toT(Util::formatBytes(dl->getTotalSize(true))))); + setStatus(STATUS_SPEED, str(TF_("Speed: %1%/s") % Text::toT(Util::formatBytes(speed)))); } void DirectoryListingFrame::updateStatus() { @@ -671,9 +671,9 @@ total = files->forEachSelectedT(ItemInfo::TotalSize()).total; } - setStatus(STATUS_SELECTED_FILES, Text::toT(STRING(ITEMS) + ": " + Util::toString(cnt))); + setStatus(STATUS_SELECTED_FILES, str(TF_("Files: %1%") % cnt)); - setStatus(STATUS_SELECTED_SIZE, Text::toT(STRING(SIZE) + ": " + Util::formatBytes(total))); + setStatus(STATUS_SELECTED_SIZE, str(TF_("Size: %1%") % Text::toT(Util::formatBytes(total)))); } } Modified: dcplusplus/trunk/win32/FavHubProperties.cpp =================================================================== --- dcplusplus/trunk/win32/FavHubProperties.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/FavHubProperties.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -46,14 +46,14 @@ bool FavHubProperties::handleInitDialog() { // Translate dialog setText(T_("Favorite Hub Properties")); - ::SetDlgItemText(handle(), IDC_FH_HUB, CTSTRING(HUB)); - ::SetDlgItemText(handle(), IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY)); - ::SetDlgItemText(handle(), IDC_FH_NAME, CTSTRING(HUB_NAME)); - ::SetDlgItemText(handle(), IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS)); - ::SetDlgItemText(handle(), IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION)); - ::SetDlgItemText(handle(), IDC_FH_NICK, CTSTRING(NICK)); - ::SetDlgItemText(handle(), IDC_FH_PASSWORD, CTSTRING(PASSWORD)); - ::SetDlgItemText(handle(), IDC_FH_USER_DESC, CTSTRING(DESCRIPTION)); + ::SetDlgItemText(handle(), IDC_FH_HUB, CT_("Hub")); + ::SetDlgItemText(handle(), IDC_FH_IDENT, CT_("Identification (leave blank for defaults)")); + ::SetDlgItemText(handle(), IDC_FH_NAME, CT_("Name")); + ::SetDlgItemText(handle(), IDC_FH_ADDRESS, CT_("Address")); + ::SetDlgItemText(handle(), IDC_FH_HUB_DESC, CT_("Description")); + ::SetDlgItemText(handle(), IDC_FH_NICK, CT_("Nick")); + ::SetDlgItemText(handle(), IDC_FH_PASSWORD, CT_("Password")); + ::SetDlgItemText(handle(), IDC_FH_USER_DESC, CT_("Description")); name = attachTextBox(IDC_HUBNAME); name->setText(Text::toT(entry->getName())); Modified: dcplusplus/trunk/win32/FinishedFrameBase.h =================================================================== --- dcplusplus/trunk/win32/FinishedFrameBase.h 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/FinishedFrameBase.h 2008-01-19 10:18:34 UTC (rev 967) @@ -276,9 +276,9 @@ } void updateStatus() { - setStatus(STATUS_COUNT, Text::toT(Util::toString(items->size()) + ' ' + STRING(ITEMS))); + setStatus(STATUS_COUNT, str(TFN_("%1% item", "%1% items", items->size()) % items->size())); setStatus(STATUS_BYTES, Text::toT(Util::formatBytes(totalBytes))); - setStatus(STATUS_SPEED, Text::toT(Util::formatBytes((totalTime > 0) ? totalBytes * ((int64_t)1000) / totalTime : 0) + "/s")); + setStatus(STATUS_SPEED, str(TF_("%1%/s") % Text::toT(Util::formatBytes((totalTime > 0) ? totalBytes * ((int64_t)1000) / totalTime : 0)))); } void updateList(const FinishedItemList& fl) { Modified: dcplusplus/trunk/win32/HashProgressDlg.cpp =================================================================== --- dcplusplus/trunk/win32/HashProgressDlg.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/HashProgressDlg.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -39,8 +39,8 @@ bool HashProgressDlg::handleInitDialog() { setText(T_("Creating file index...")); - ::SetDlgItemText(handle(), IDC_HASH_INDEXING, CTSTRING(HASH_PROGRESS_TEXT)); - ::SetDlgItemText(handle(), IDC_STATISTICS, CTSTRING(HASH_PROGRESS_STATS)); + ::SetDlgItemText(handle(), IDC_HASH_INDEXING, CT_("Please wait while DC++ indexes your files (they won't be shared until they've been indexed)...")); + ::SetDlgItemText(handle(), IDC_STATISTICS, CT_("Statistics")); progress = attachProgressBar(IDC_HASH_PROGRESS); progress->setRange(0, 10000); @@ -103,7 +103,7 @@ } if(files == 0) { - ::SetDlgItemText(handle(), IDC_CURRENT_FILE, CTSTRING(DONE)); + ::SetDlgItemText(handle(), IDC_CURRENT_FILE, CT_("Done")); } else { ::SetDlgItemText(handle(), IDC_CURRENT_FILE, Text::toT(file).c_str()); } Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -328,12 +328,11 @@ } else if(Util::stricmp(cmd.c_str(), _T("userlist")) == 0) { showUsers->setChecked(!showUsers->getChecked()); } else if(Util::stricmp(cmd.c_str(), _T("connection")) == 0) { - addStatus(Text::toT((STRING(IP) + client->getLocalIp() + ", " + - STRING(PORT) + - Util::toString(ConnectionManager::getInstance()->getPort()) + "/" + - Util::toString(SearchManager::getInstance()->getPort()) + "/" + - Util::toString(ConnectionManager::getInstance()->getSecurePort()) - ))); + addStatus(str(TF_("IP: %1%, Port: %2%/%3%/%4%") % Text::toT(client->getLocalIp()) + % ConnectionManager::getInstance()->getPort() + % SearchManager::getInstance()->getPort() + % ConnectionManager::getInstance()->getSecurePort() + )); } else if((Util::stricmp(cmd.c_str(), _T("favorite")) == 0) || (Util::stricmp(cmd.c_str(), _T("fav")) == 0)) { addAsFavorite(); } else if((Util::stricmp(cmd.c_str(), _T("removefavorite")) == 0) || (Util::stricmp(cmd.c_str(), _T("removefav")) == 0)) { @@ -379,12 +378,12 @@ if (BOOLSETTING(SEND_UNKNOWN_COMMANDS)) { client->hubMessage(Text::fromT(s)); } else { - addStatus(TSTRING(UNKNOWN_COMMAND) + cmd); + addStatus(str(TF_("Unknown command: %1%") % cmd)); } } message->setText(_T("")); } else if(waitingForPW) { - addStatus(TSTRING(DONT_REMOVE_SLASH_PASSWORD)); + addStatus(T_("Don't remove /password before your password")); message->setText(_T("/password ")); message->setFocus(); message->setSelection(10, 10); @@ -489,14 +488,14 @@ UserTask& u = *static_cast<UserTask*>(i->second); if(updateUser(u)) { if (showJoins || (favShowJoins && FavoriteManager::getInstance()->isFavoriteUser(u.user))) { - addStatus(_T("*** ") + TSTRING(JOINS) + Text::toT(u.identity.getNick())); + addStatus(str(TF_("*** Joins: %1%") % Text::toT(u.identity.getNick()))); } } } else if(i->first == REMOVE_USER) { UserTask& u = *static_cast<UserTask*>(i->second); removeUser(u.user); if (showJoins || (favShowJoins && FavoriteManager::getInstance()->isFavoriteUser(u.user))) { - addStatus(Text::toT("*** " + STRING(PARTS) + u.identity.getNick())); + addStatus(str(TF_("*** Parts: %1%") % Text::toT(u.identity.getNick()))); } } else if(i->first == CONNECTED) { addStatus(T_("Connected")); @@ -541,25 +540,25 @@ PMTask& pm = *static_cast<PMTask*>(i->second); if(pm.hub) { if(BOOLSETTING(IGNORE_HUB_PMS)) { - addStatus(TSTRING(IGNORED_MESSAGE) + Text::toT(pm.str), false); + addStatus(str(TF_("Ignored message: %1%") % Text::toT(pm.str)), false); } else if(BOOLSETTING(POPUP_HUB_PMS) || PrivateFrame::isOpen(pm.replyTo)) { PrivateFrame::gotMessage(getParent(), pm.from, pm.to, pm.replyTo, Text::toT(pm.str)); } else { - addChat(TSTRING(PRIVATE_MESSAGE_FROM) + getNick(pm.from) + _T(": ") + Text::toT(pm.str)); + addChat(str(TF_("Private message from %1%: %2%") % getNick(pm.from) % Text::toT(pm.str))); } } else if(pm.bot) { if(BOOLSETTING(IGNORE_BOT_PMS)) { - addStatus(TSTRING(IGNORED_MESSAGE) + Text::toT(pm.str), false); + addStatus(str(TF_("Ignored message: %1%") % Text::toT(pm.str)), false); } else if(BOOLSETTING(POPUP_BOT_PMS) || PrivateFrame::isOpen(pm.replyTo)) { PrivateFrame::gotMessage(getParent(), pm.from, pm.to, pm.replyTo, Text::toT(pm.str)); } else { - addChat(TSTRING(PRIVATE_MESSAGE_FROM) + getNick(pm.from) + _T(": ") + Text::toT(pm.str)); + addChat(str(TF_("Private message from %1%: %2%") % getNick(pm.from) % Text::toT(pm.str))); } } else { if(BOOLSETTING(POPUP_PMS) || PrivateFrame::isOpen(pm.replyTo) || pm.from == client->getMyIdentity().getUser()) { PrivateFrame::gotMessage(getParent(), pm.from, pm.to, pm.replyTo, Text::toT(pm.str)); } else { - addChat(TSTRING(PRIVATE_MESSAGE_FROM) + getNick(pm.from) + _T(": ") + Text::toT(pm.str)); + addChat(str(TF_("Private message from %1%: %2%") % getNick(pm.from) % Text::toT(pm.str))); } } } else if(i->first == FOLLOW) { @@ -905,7 +904,7 @@ } void HubFrame::on(NickTaken, Client*) throw() { - speak(ADD_STATUS_LINE, STRING(NICK_TAKEN)); + speak(ADD_STATUS_LINE, _("Your nick was already taken, please change to something else!")); } void HubFrame::on(SearchFlood, Client*, const string& line) throw() { @@ -935,7 +934,7 @@ textForUsers += Text::toT(Util::toString(users->getSelectedCount()) + "/"); if (showUsers->getChecked() && users->size() < userCount) textForUsers += Text::toT(Util::toString(users->size()) + "/"); - return textForUsers + Text::toT(Util::toString(userCount) + " " + STRING(HUB_USERS)); + return textForUsers + str(TFN_("%1% user", "%1% users", userCount) % userCount); } Modified: dcplusplus/trunk/win32/MagnetDlg.cpp =================================================================== --- dcplusplus/trunk/win32/MagnetDlg.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/MagnetDlg.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -43,10 +43,10 @@ bool MagnetDlg::handleInitDialog() { setText(T_("MAGNET Link detected")); - ::SetDlgItemText(handle(), IDC_MAGNET_TEXT, CTSTRING(MAGNET_DLG_TEXT_GOOD)); - ::SetDlgItemText(handle(), IDC_MAGNET_HASH, CTSTRING(MAGNET_DLG_HASH)); + ::SetDlgItemText(handle(), IDC_MAGNET_TEXT, CT_("DC++ has detected a MAGNET link with a file hash that can be searched for on the Direct Connect network. What would you like to do?")); + ::SetDlgItemText(handle(), IDC_MAGNET_HASH, CT_("File Hash:")); ::SetDlgItemText(handle(), IDC_MAGNET_DISP_HASH, mHash.c_str()); - ::SetDlgItemText(handle(), IDC_MAGNET_NAME, CTSTRING(MAGNET_DLG_FILE)); + ::SetDlgItemText(handle(), IDC_MAGNET_NAME, CT_("Filename:")); ::SetDlgItemText(handle(), IDC_MAGNET_DISP_NAME, mFileName.c_str()); //queue = attachRadioButton(IDC_MAGNET_1_QUEUE); Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -179,7 +179,7 @@ dcdebug("initMenu\n"); mainMenu = createMenu(false); - WidgetMenuPtr file = mainMenu->appendPopup(CTSTRING(MENU_FILE)); + WidgetMenuPtr file = mainMenu->appendPopup(T_("&File")); file->appendItem(IDC_QUICK_CONNECT, T_("&Quick Connect ...\tCtrl+Q"), std::tr1::bind(&MainWindow::handleQuickConnect, this)); file->appendItem(IDC_FOLLOW, T_("Follow last redirec&t\tCtrl+T")); @@ -197,7 +197,7 @@ file->appendSeparatorItem(); file->appendItem(IDC_EXIT, T_("E&xit"), std::tr1::bind(&MainWindow::handleExit, this)); - WidgetMenuPtr view = mainMenu->appendPopup(CTSTRING(MENU_VIEW)); + WidgetMenuPtr view = mainMenu->appendPopup(T_("&View")); view->appendItem(IDC_PUBLIC_HUBS, T_("&Public Hubs\tCtrl+P"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendItem(IDC_FAVORITE_HUBS, T_("&Favorite Hubs\tCtrl+F"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); @@ -218,7 +218,7 @@ view->appendItem(IDC_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendItem(IDC_HASH_PROGRESS, T_("Indexing progress"), std::tr1::bind(&MainWindow::handleHashProgress, this)); - WidgetMenuPtr window = mainMenu->appendPopup(CTSTRING(MENU_WINDOW)); + WidgetMenuPtr window = mainMenu->appendPopup(T_("&Window")); window->appendItem(IDC_CLOSE_ALL_DISCONNECTED, T_("Close disconnected"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); window->appendItem(IDC_CLOSE_ALL_PM, T_("Close all PM windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); @@ -226,7 +226,7 @@ window->appendItem(IDC_CLOSE_ALL_DIR_LIST, T_("Close all file list windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); window->appendItem(IDC_CLOSE_ALL_SEARCH_FRAME, T_("Close all search windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - WidgetMenuPtr help = mainMenu->appendPopup(TSTRING(MENU_HELP)); + WidgetMenuPtr help = mainMenu->appendPopup(T_("&Help")); help->appendItem(IDC_HELP_CONTENTS, T_("Help &Contents\tF1"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); help->appendSeparatorItem(); @@ -615,7 +615,7 @@ try { SearchManager::getInstance()->listen(); } catch(const Exception&) { - WidgetMessageBox().show(CTSTRING(TCP_PORT_BUSY), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); + WidgetMessageBox().show(T_("Unable to open UDP port. Searching will not work correctly until you change settings or turn off any application that might be using the UDP port"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); } } @@ -631,7 +631,7 @@ if ( FAILED(UPnP_UDPConnection->OpenPorts()) || FAILED(UPnP_TCPConnection->OpenPorts()) ) { - LogManager::getInstance()->message(STRING(UPNP_FAILED_TO_CREATE_MAPPINGS)); + LogManager::getInstance()->message(_("Failed to create port mappings. Please set up your NAT yourself.")); createMessageBox().show(T_("Failed to create port mappings. Please set up your NAT yourself."), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); // We failed! thus reset the objects @@ -650,7 +650,7 @@ } else { //:-( Looks like we have to rely on the user setting the external IP manually // no need to do cleanup here because the mappings work - LogManager::getInstance()->message(STRING(UPNP_FAILED_TO_GET_EXTERNAL_IP)); + LogManager::getInstance()->message(_("Failed to get external IP via UPnP. Please set it yourself.")); createMessageBox().show(T_("Failed to get external IP via UPnP. Please set it yourself."), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); } } @@ -664,7 +664,7 @@ { if (FAILED(UPnP_TCPConnection->ClosePorts()) ) { - LogManager::getInstance()->message(STRING(UPNP_FAILED_TO_REMOVE_MAPPINGS)); + LogManager::getInstance()->message(_("Failed to remove port mappings")); } delete UPnP_TCPConnection; } @@ -672,7 +672,7 @@ { if (FAILED(UPnP_UDPConnection->ClosePorts()) ) { - LogManager::getInstance()->message(STRING(UPNP_FAILED_TO_REMOVE_MAPPINGS)); + LogManager::getInstance()->message(_("Failed to remove port mappings")); } delete UPnP_UDPConnection; } Modified: dcplusplus/trunk/win32/PublicHubsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PublicHubsFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/PublicHubsFrame.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -269,8 +269,8 @@ } void PublicHubsFrame::updateStatus() { - setStatus(STATUS_HUBS, Text::toT(STRING(HUBS) + ": " + Util::toString(visibleHubs))); - setStatus(STATUS_USERS, Text::toT(STRING(USERS) + ": " + Util::toString(users))); + setStatus(STATUS_HUBS, str(TF_("Hubs: %1%") % visibleHubs)); + setStatus(STATUS_USERS, str(TF_("Users: %1%") % users)); } void PublicHubsFrame::updateDropDown() { @@ -314,13 +314,13 @@ std::auto_ptr<tstring> x(reinterpret_cast<tstring*>(lParam)); entries = FavoriteManager::getInstance()->getPublicHubs(); updateList(); - setStatus(STATUS_STATUS, ((wParam == LOADED_FROM_CACHE) ? TSTRING(HUB_LIST_LOADED_FROM_CACHE) : TSTRING(HUB_LIST_DOWNLOADED)) + _T(" (") + (*x) + _T(")")); + setStatus(STATUS_STATUS, ((wParam == LOADED_FROM_CACHE) ? T_("Hub list loaded from cache...") : str(TF_("Hub list downloaded... (%1%)") % (*x)))); } else if(wParam == STARTING) { std::auto_ptr<tstring> x(reinterpret_cast<tstring*>(lParam)); - setStatus(STATUS_STATUS, TSTRING(DOWNLOADING_HUB_LIST) + _T(" (") + (*x) + _T(")")); + setStatus(STATUS_STATUS, str(TF_("Downloading public hub list... (%1%)") % (*x))); } else if(wParam == FAILED) { std::auto_ptr<tstring> x(reinterpret_cast<tstring*>(lParam)); - setStatus(STATUS_STATUS, TSTRING(DOWNLOAD_FAILED) + (*x)); + setStatus(STATUS_STATUS, str(TF_("Download failed: %1%") % (*x))); } return 0; } @@ -456,7 +456,7 @@ } void PublicHubsFrame::handleRefresh() { - setStatus(STATUS_STATUS, CTSTRING(DOWNLOADING_HUB_LIST)); + setStatus(STATUS_STATUS, CT_("Downloading public hub list...")); FavoriteManager::getInstance()->refresh(true); updateDropDown(); } Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -278,15 +278,14 @@ QueueItemInfo* ii = files->getData(i); total += (ii->getSize() > 0) ? ii->getSize() : 0; } - } - setStatus(STATUS_PARTIAL_COUNT, Text::toT(STRING(ITEMS) + ": " + Util::toString(cnt))); - setStatus(STATUS_PARTIAL_BYTES, Text::toT(STRING(SIZE) + ": " + Util::formatBytes(total))); + setStatus(STATUS_PARTIAL_COUNT, str(TF_("Items: %1%") % cnt)); + setStatus(STATUS_PARTIAL_BYTES, str(TF_("Size: %1%") % Text::toT(Util::formatBytes(total)))); if(dirty) { - setStatus(STATUS_TOTAL_COUNT, Text::toT(STRING(FILES) + ": " + Util::toString(queueItems))); - setStatus(STATUS_TOTAL_BYTES, Text::toT(STRING(SIZE) + ": " + Util::formatBytes(queueSize))); + setStatus(STATUS_TOTAL_COUNT, str(TF_("Files: %1%") % queueItems)); + setStatus(STATUS_TOTAL_BYTES, str(TF_("Size: %1%") % Text::toT(Util::formatBytes(queueSize)))); dirty = false; } } Modified: dcplusplus/trunk/win32/SearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SearchFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/SearchFrame.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -569,12 +569,12 @@ } results->insert(si); - setStatus(STATUS_COUNT, Text::toT(Util::toString(results->size()) + ' ' + STRING(ITEMS))); + setStatus(STATUS_COUNT, str(TFN_("%1% item", "%1% items", results->size()) % results->size())); setDirty(SettingsManager::BOLD_SEARCH); } break; case SPEAK_FILTER_RESULT: - setStatus(STATUS_FILTERED, Text::toT(Util::toString(droppedResults) + ' ' + STRING(FILTERED))); + setStatus(STATUS_FILTERED, str(TF_("%1% filtered") % droppedResults)); break; case SPEAK_HUB_ADDED: onHubAdded(reinterpret_cast<HubInfo*>(lParam)); @@ -990,10 +990,9 @@ token = Util::toString(Util::rand()); } - - SearchManager::SizeModes mode((SearchManager::SizeModes)sizeMode->getSelectedIndex()); + SearchManager::SizeModes searchMode((SearchManager::SizeModes)mode->getSelectedIndex()); if(llsize == 0) - mode = SearchManager::SIZE_DONTCARE; + searchMode = SearchManager::SIZE_DONTCARE; int ftype = fileType->getSelectedIndex(); @@ -1012,17 +1011,17 @@ lastSearches.push_back(s); } - setStatus(STATUS_STATUS, TSTRING(SEARCHING_FOR) + s + _T("...")); + setStatus(STATUS_STATUS, str(TF_("Searching for %1%...") % s)); setStatus(STATUS_COUNT, Util::emptyStringT); setStatus(STATUS_FILTERED, Util::emptyStringT); droppedResults = 0; isHash = (ftype == SearchManager::TYPE_TTH); - setText(TSTRING(SEARCH) + _T(" - ") + s); + setText(str(TF_("Search - %1%") % s)); if(SearchManager::getInstance()->okToSearch()) { SearchManager::getInstance()->search(clients, Text::fromT(s), llsize, - (SearchManager::TypeModes)ftype, mode, token); + (SearchManager::TypeModes)ftype, searchMode, token); if(BOOLSETTING(CLEAR_SEARCH)) // Only clear if the search was sent searchBox->setText(Util::emptyStringT); } else { @@ -1033,7 +1032,7 @@ setStatus(STATUS_COUNT, Util::emptyStringT); setStatus(STATUS_FILTERED, Util::emptyStringT); - setText(T_("Search") + _T(" - ") + msg); + setText(str(TF_("Search - %1%") % msg)); // Start the countdown timer initSecond(); } @@ -1048,12 +1047,12 @@ if(waitFor > 0) { tstring msg = str(TFN_("Searching too soon, next search in %1% second", "Searching too soon, next search in %1% seconds", waitFor) % waitFor); setStatus(STATUS_STATUS, msg); - setText(T_("Search") + _T(" - ") + msg); + setText(str(TF_("Search - %1%") % msg)); return true; } setStatus(STATUS_STATUS, T_("Ready to search...")); - setText(T_("Search") + _T(" - ") + T_("Ready to search...")); + setText(T_("Search - Ready to search...")); return false; } Modified: dcplusplus/trunk/win32/SpyFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SpyFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/SpyFrame.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -110,7 +110,7 @@ cur++; perSecond[cur] = 0; - setStatus(STATUS_AVG_PER_SECOND, Text::toT(STRING(AVERAGE) + Util::toString(x))); + setStatus(STATUS_AVG_PER_SECOND, str(TF_("Average/s: %1%") % x)); return true; } @@ -154,10 +154,10 @@ searches->resort(); } - setStatus(STATUS_TOTAL, Text::toT(STRING(TOTAL) + Util::toString(total))); - setStatus(STATUS_HITS, Text::toT(STRING(HITS) + Util::toString(ShareManager::getInstance()->getHits()))); + setStatus(STATUS_TOTAL, str(TF_("Total: %1%") % total)); + setStatus(STATUS_HITS, str(TF_("Hits: %1%") % ShareManager::getInstance()->getHits())); double ratio = total > 0 ? ((double)ShareManager::getInstance()->getHits()) / (double)total : 0.0; - setStatus(STATUS_HIT_RATIO, Text::toT(STRING(HIT_RATIO) + Util::toString(ratio))); + setStatus(STATUS_HIT_RATIO, str(TF_("Hit Ratio: %1%") % ratio)); } return 0; } Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "stdafx.h" #include "TransferView.h" @@ -34,22 +33,17 @@ #include <dcpp/Download.h> #include <dcpp/Upload.h> -int TransferView::columnIndexes[] = { COLUMN_USER, COLUMN_HUB, COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, COLUMN_FILE, COLUMN_SIZE, COLUMN_PATH, COLUMN_IP, COLUMN_RATIO, COLUMN_CID, COLUMN_CIPHER }; -int TransferView::columnSizes[] = { 150, 100, 250, 75, 75, 175, 100, 200, 50, 75, 125, 125 }; +int TransferView::columnIndexes[] = { COLUMN_USER, COLUMN_STATUS, COLUMN_SPEED, COLUMN_TRANSFERED, COLUMN_QUEUED, COLUMN_CIPHER, COLUMN_IP }; +int TransferView::columnSizes[] = { 125, 375, 150, 150, 75, 100, 100 }; static const char* columnNames[] = { N_("User"), - N_("Hub"), N_("Status"), - N_("Time left"), N_("Speed"), - N_("Filename"), - N_("Size"), - N_("Path"), - N_("IP"), - N_("Ratio"), - N_("CID"), - N_("Cipher") + N_("Transfered"), + N_("Queued"), + N_("Cipher"), + N_("IP") }; TransferView::TransferView(SmartWin::Widget* parent, SmartWin::WidgetTabView* mdi_) : @@ -103,7 +97,6 @@ } HRESULT TransferView::handleDestroy(WPARAM wParam, LPARAM lParam) { - SettingsManager::getInstance()->set(SettingsManager::MAINFRAME_ORDER, WinUtil::toString(transfers->getColumnOrder())); SettingsManager::getInstance()->set(SettingsManager::MAINFRAME_WIDTHS, WinUtil::toString(transfers->getColumnWidths())); @@ -329,10 +322,9 @@ } switch(col) { case COLUMN_STATUS: return 0; - case COLUMN_TIMELEFT: return compare(a->timeLeft, b->timeLeft); case COLUMN_SPEED: return compare(a->speed, b->speed); - case COLUMN_SIZE: return compare(a->size, b->size); - case COLUMN_RATIO: return compare(a->getRatio(), b->getRatio()); + case COLUMN_TRANSFERED: return compare(a->transfered, b->transfered); + case COLUMN_QUEUED: return compare(a->queued, b->queued); default: return lstrcmpi(a->columns[col].c_str(), b->columns[col].c_str()); } } @@ -381,6 +373,7 @@ } void TransferView::handleSearchAlternates() { +#ifdef PORT_ME int i = transfers->getNext(-1, LVNI_SELECTED); if(i != -1) { @@ -393,19 +386,38 @@ WinUtil::searchHash(tth); } } +#endif } -TransferView::ItemInfo::ItemInfo(const UserPtr& u, bool aDownload) : UserInfoBase(u), download(aDownload), transferFailed(false), - status(STATUS_WAITING), pos(0), size(0), start(0), actual(0), speed(0), timeLeft(0) +TransferView::ItemInfo::ItemInfo(const UserPtr& u, bool aDownload) : + UserInfoBase(u), + download(aDownload), + transferFailed(false), + status(STATUS_WAITING), + actual(0), + transfered(0), + queued(0), + speed(0) { columns[COLUMN_USER] = WinUtil::getNicks(u); - columns[COLUMN_HUB] = WinUtil::getHubNames(u).first; - columns[COLUMN_CID] = Text::toT(u->getCID().toBase32()); + columns[COLUMN_STATUS] = T_("Idle..."); + columns[COLUMN_TRANSFERED] = Text::toT(Util::toString(0)); + if(aDownload) { + queued = QueueManager::getInstance()->getQueued(u); + columns[COLUMN_QUEUED] = Text::toT(Util::toString(queued)); + } + } void TransferView::ItemInfo::update(const UpdateInfo& ui) { if(ui.updateMask & UpdateInfo::MASK_STATUS) { status = ui.status; + if(download) { + // Also update queued when status changes... + queued = QueueManager::getInstance()->getQueued(user); + columns[COLUMN_QUEUED] = Text::toT(Util::toString(queued)); + } + } if(ui.updateMask & UpdateInfo::MASK_STATUS_STRING) { // No slots etc from transfermanager better than disconnected from connectionmanager @@ -413,42 +425,28 @@ columns[COLUMN_STATUS] = ui.statusString; transferFailed = ui.transferFailed; } - if(ui.updateMask & UpdateInfo::MASK_SIZE) { - size = ui.size; - columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(size)); + if(ui.updateMask & UpdateInfo::MASK_TRANSFERED) { + actual = ui.actual; + transfered = ui.transfered; + if(actual == transfered) { + columns[COLUMN_TRANSFERED] = Text::toT(Util::formatBytes(transfered)); + } else { + columns[COLUMN_TRANSFERED] = str(TF_("%1% (%2%, %3%%%)") + % Text::toT(Util::formatBytes(transfered)) + % Text::toT(Util::formatBytes(actual)) + % (actual * 100.0 / transfered)); + } } - if(ui.updateMask & UpdateInfo::MASK_START) { - start = ui.start; - } - if(ui.updateMask & UpdateInfo::MASK_POS) { - pos = start + ui.pos; - } - if(ui.updateMask & UpdateInfo::MASK_ACTUAL) { - actual = start + ui.actual; - columns[COLUMN_RATIO] = Text::toT(Util::toString(getRatio())); - } if(ui.updateMask & UpdateInfo::MASK_SPEED) { speed = ui.speed; if (status == STATUS_RUNNING) { - columns[COLUMN_SPEED] = Text::toT(Util::formatBytes(speed) + "/s"); + columns[COLUMN_SPEED] = str(TF_("%1%/s") % Text::toT(Util::formatBytes(speed))); } else { columns[COLUMN_SPEED] = Util::emptyStringT; } } - if(ui.updateMask & UpdateInfo::MASK_FILE) { - columns[COLUMN_FILE] = ui.file; - columns[COLUMN_PATH] = ui.path; - } - if(ui.updateMask & UpdateInfo::MASK_TIMELEFT) { - timeLeft = ui.timeLeft; - if (status == STATUS_RUNNING) { - columns[COLUMN_TIMELEFT] = Text::toT(Util::formatSeconds(timeLeft)); - } else { - columns[COLUMN_TIMELEFT] = Util::emptyStringT; - } - } if(ui.updateMask & UpdateInfo::MASK_IP) { - columns[COLUMN_IP] = ui.IP; + columns[COLUMN_IP] = ui.ip; } if(ui.updateMask & UpdateInfo::MASK_CIPHER) { columns[COLUMN_CIPHER] = ui.cipher; @@ -485,15 +483,23 @@ speak(UPDATE_ITEM, ui); } +static tstring getFile(Transfer* t) { + tstring file; + + if(t->getType() == Transfer::TYPE_TREE) { + file = str(TF_("TTH: %1%") % Text::toT(Util::getFileName(t->getPath()))); + } else { + file = Text::toT(Util::getFileName(t->getPath())); + } + return file; +} + void TransferView::on(DownloadManagerListener::Starting, Download* aDownload) throw() { UpdateInfo* ui = new UpdateInfo(aDownload->getUser(), true); ui->setStatus(ItemInfo::STATUS_RUNNING); - ui->setPos(aDownload->getPos()); - ui->setActual(aDownload->getActual()); - ui->setStart(0); - ui->setSize(aDownload->getSize()); - ui->setFile(Text::toT(aDownload->getPath())); - ui->setStatusString(T_("Download starting...")); + ui->setTransfered(aDownload->getPos(), aDownload->getActual()); + + ui->setStatusString(str(TF_("Requesting %1% (%2%)...") % getFile(aDownload) % aDownload->getSize())); ui->setCipher(Text::toT(aDownload->getUserConnection().getCipherName())); tstring country = Text::toT(Util::getIpCountry(aDownload->getUserConnection().getRemoteIp())); tstring ip = Text::toT(aDownload->getUserConnection().getRemoteIp()); @@ -502,9 +508,6 @@ } else { ui->setIP(country + _T(" (") + ip + _T(")")); } - if(aDownload->getType() == Transfer::TYPE_TREE) { - ui->file = _T("TTH: ") + ui->file; - } speak(UPDATE_ITEM, ui); } @@ -514,15 +517,9 @@ Download* d = *j; UpdateInfo* ui = new UpdateInfo(d->getUser(), true); - ui->setActual(d->getActual()); - ui->setPos(d->getPos()); - ui->setTimeLeft(d->getSecondsLeft()); + ui->setTransfered(d->getPos(), d->getActual()); ui->setSpeed(d->getAverageSpeed()); - tstring pos = Text::toT(Util::formatBytes(d->getPos())); - double percent = (double)d->getPos()*100.0/(double)d->getSize(); - tstring elapsed = Text::toT(Util::formatSeconds((GET_TICK() - d->getStart())/1000)); - tstring statusString; if(d->getUserConnection().isSecure()) { @@ -541,7 +538,11 @@ if(!statusString.empty()) { statusString += _T(" "); } - statusString += str(TF_("Downloaded %1% (%|2$.1f|%%) in %3%") % pos % percent % elapsed); + statusString += str(TF_("Downloading %1% (%2%/%3%)...") + % getFile(d) + % Text::toT(Util::formatBytes(d->getPos())) + % Text::toT(Util::formatBytes(d->getSize()))); + ui->setStatusString(statusString); tasks.add(UPDATE_ITEM, ui); @@ -553,13 +554,7 @@ void TransferView::on(DownloadManagerListener::Failed, Download* aDownload, const string& aReason) throw() { UpdateInfo* ui = new UpdateInfo(aDownload->getUser(), true, true); ui->setStatus(ItemInfo::STATUS_WAITING); - ui->setPos(0); ui->setStatusString(Text::toT(aReason)); - ui->setSize(aDownload->getSize()); - ui->setFile(Text::toT(aDownload->getPath())); - if(aDownload->getType() == Transfer::TYPE_TREE) { - ui->file = _T("TTH: ") + ui->file; - } speak(UPDATE_ITEM, ui); } @@ -568,11 +563,6 @@ UpdateInfo* ui = new UpdateInfo(aUpload->getUser(), false); ui->setStatus(ItemInfo::STATUS_RUNNING); - ui->setPos(aUpload->getPos()); - ui->setActual(aUpload->getActual()); - ui->setStart(aUpload->getPos()); - ui->setSize(aUpload->getSize()); - ui->setFile(Text::toT(aUpload->getPath())); ui->setStatusString(T_("Upload starting...")); ui->setCipher(Text::toT(aUpload->getUserConnection().getCipherName())); tstring country = Text::toT(Util::getIpCountry(aUpload->getUserConnection().getRemoteIp())); @@ -582,9 +572,6 @@ } else { ui->setIP(country + _T(" (") + ip + _T(")")); } - if(aUpload->getType() == Transfer::TYPE_TREE) { - ui->file = _T("TTH: ") + ui->file; - } speak(UPDATE_ITEM, ui); } @@ -594,15 +581,8 @@ Upload* u = *j; UpdateInfo* ui = new UpdateInfo(u->getUser(), false); - ui->setActual(u->getActual()); - ui->setPos(u->getPos()); - ui->setTimeLeft(u->getSecondsLeft()); ui->setSpeed(u->getAverageSpeed()); - tstring pos = Text::toT(Util::formatBytes(u->getPos())); - double percent = (double)u->getPos()*100.0/(double)u->getSize(); - tstring elapsed = Text::toT(Util::formatSeconds((GET_TICK() - u->getStart())/1000)); - tstring statusString; if(u->getUserConnection().isSecure()) { @@ -618,7 +598,10 @@ if(!statusString.empty()) { statusString += _T(" "); } - statusString += str(TF_("Uploaded %1% (%|2$.1f|%%) in %3%") % pos % percent % elapsed); + statusString += str(TF_("Uploading %1% (%2%/%3%)...") + % getFile(u) + % Text::toT(Util::formatBytes(u->getPos())) + % Text::toT(Util::formatBytes(u->getSize()))); ui->setStatusString(statusString); @@ -640,8 +623,7 @@ UpdateInfo* ui = new UpdateInfo(aTransfer->getUser(), !isUpload); ui->setStatus(ItemInfo::STATUS_WAITING); - ui->setPos(0); - ui->setStatusString(isUpload ? T_("Upload finished, idle...") : T_("Download finished, idle...")); + ui->setStatusString(T_("Idle...")); speak(UPDATE_ITEM, ui); } Modified: dcplusplus/trunk/win32/TransferView.h =================================================================== --- dcplusplus/trunk/win32/TransferView.h 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/TransferView.h 2008-01-19 10:18:34 UTC (rev 967) @@ -61,17 +61,12 @@ enum { COLUMN_FIRST, COLUMN_USER = COLUMN_FIRST, - COLUMN_HUB, COLUMN_STATUS, - COLUMN_TIMELEFT, COLUMN_SPEED, - COLUMN_FILE, - COLUMN_SIZE, - COLUMN_PATH, - COLUMN_IP, - COLUMN_RATIO, - COLUMN_CID, + COLUMN_TRANSFERED, + COLUMN_QUEUED, COLUMN_CIPHER, + COLUMN_IP, COLUMN_LAST }; @@ -84,21 +79,21 @@ class ItemInfo : public UserInfoBase { public: enum Status { - STATUS_RUNNING, - STATUS_WAITING + STATUS_RUNNING, ///< Transfering + STATUS_WAITING ///< Idle }; ItemInfo(const UserPtr& u, bool aDownload); bool download; bool transferFailed; + Status status; - int64_t pos; - int64_t size; - int64_t start; + int64_t actual; + int64_t transfered; + int64_t queued; int64_t speed; - int64_t timeLeft; tstring columns[COLUMN_LAST]; void update(const UpdateInfo& ui); @@ -106,7 +101,7 @@ void disconnect(); void deleteSelf() { delete this; } - double getRatio() { return (pos > 0) ? (double)actual / (double)pos : 1.0; } + double getRatio() { return (transfered > 0) ? (double)actual / (double)transfered : 1.0; } const tstring& getText(int col) const { return columns[col]; @@ -120,18 +115,12 @@ struct UpdateInfo : public Task { enum { - MASK_POS = 1 << 0, - MASK_SIZE = 1 << 1, - MASK_START = 1 << 2, - MASK_ACTUAL = 1 << 3, - MASK_SPEED = 1 << 4, - MASK_FILE = 1 << 5, - MASK_STATUS = 1 << 6, - MASK_TIMELEFT = 1 << 7, - MASK_IP = 1 << 8, - MASK_STATUS_STRING = 1 << 9, - MASK_COUNTRY = 1 << 10, - MASK_CIPHER = 1 << 11 + MASK_STATUS = 1 << 0, + MASK_STATUS_STRING = 1 << 1, + MASK_SPEED = 1 << 2, + MASK_TRANSFERED = 1 << 3, + MASK_IP = 1 << 4, + MASK_CIPHER = 1 << 5 }; bool operator==(const ItemInfo& ii) { return download == ii.download && user == ii.user; } @@ -143,27 +132,21 @@ UserPtr user; bool download; bool transferFailed; + void setStatus(ItemInfo::Status aStatus) { status = aStatus; updateMask |= MASK_STATUS; } ItemInfo::Status status; - void setPos(int64_t aPos) { pos = aPos; updateMask |= MASK_POS; } - int64_t pos; - void setSize(int64_t aSize) { size = aSize; updateMask |= MASK_SIZE; } - int64_t size; - void setStart(int64_t aStart) { start = aStart; updateMask |= MASK_START; } - int64_t start; - void setActual(int64_t aActual) { actual = aActual; updateMask |= MASK_ACTUAL; } + void setTransfered(int64_t aTransfered, int64_t aActual) { + transfered = aTransfered; actual = aActual; updateMask |= MASK_TRANSFERED; + } int64_t actual; + int64_t transfered; void setSpeed(int64_t aSpeed) { speed = aSpeed; updateMask |= MASK_SPEED; } int64_t speed; - void setTimeLeft(int64_t aTimeLeft) { timeLeft = aTimeLeft; updateMask |= MASK_TIMELEFT; } - int64_t timeLeft; void setStatusString(const tstring& aStatusString) { statusString = aStatusString; updateMask |= MASK_STATUS_STRING; } tstring statusString; - void setFile(const tstring& aFile) { file = Util::getFileName(aFile); path = Util::getFilePath(aFile); updateMask|= MASK_FILE; } - tstring file; - tstring path; - void setIP(const tstring& aIP) { IP = aIP; updateMask |= MASK_IP; } - tstring IP; + + void setIP(const tstring& aIp) { ip = aIp; updateMask |= MASK_IP; } + tstring ip; void setCipher(const tstring& aCipher) { cipher = aCipher; updateMask |= MASK_CIPHER; } tstring cipher; }; Modified: dcplusplus/trunk/win32/WinUtil.cpp =================================================================== --- dcplusplus/trunk/win32/WinUtil.cpp 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/WinUtil.cpp 2008-01-19 10:18:34 UTC (rev 967) @@ -262,31 +262,32 @@ if(Util::getAway() && param.empty()) { Util::setAway(false); Util::setManualAway(false); - status = TSTRING(AWAY_MODE_OFF); + status = T_("Away mode off"); } else { Util::setAway(true); Util::setManualAway(true); Util::setAwayMessage(Text::fromT(param)); - status = TSTRING(AWAY_MODE_ON) + Text::toT(Util::getAwayMessage()); + status = str(TF_("Away mode on: %1%") % Text::toT(Util::getAwayMessage())); } } else if(Util::stricmp(cmd.c_str(), _T("back")) == 0) { Util::setAway(false); - status = TSTRING(AWAY_MODE_OFF); + Util::setManualAway(false); + status = T_("Away mode off"); } else if(Util::stricmp(cmd.c_str(), _T("g")) == 0) { if(param.empty()) { - status = TSTRING(SPECIFY_SEARCH_STRING); + status = T_("Specify a search string"); } else { WinUtil::openLink(_T("http://www.google.com/search?q=") + Text::toT(Util::encodeURI(Text::fromT(param)))); } } else if(Util::stricmp(cmd.c_str(), _T("imdb")) == 0) { if(param.empty()) { - status = TSTRING(SPECIFY_SEARCH_STRING); + status = T_("Specify a search string"); } else { WinUtil::openLink(_T("http://www.imdb.com/find?q=") + Text::toT(Util::encodeURI(Text::fromT(param)))); } } else if(Util::stricmp(cmd.c_str(), _T("u")) == 0) { if (param.empty()) { - status = TSTRING(SPECIFY_URL); + status = T_("Specify a URL"); } else { WinUtil::openLink(Text::toT(Util::encodeURI(Text::fromT(param)))); } @@ -414,7 +415,7 @@ bi.hwndOwner = owner; bi.pszDisplayName = buf; - bi.lpszTitle = CTSTRING(CHOOSE_FOLDER); + bi.lpszTitle = CT_("Choose folder"); bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI; bi.lParam = (LPARAM)target.c_str(); bi.lpfn = &browseCallbackProc; @@ -689,7 +690,7 @@ if(Util::stricmp(app.c_str(), Buf) != 0) { if (::RegCreateKeyEx(HKEY_CLASSES_ROOT, _T("dchub"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hk, NULL)) { - LogManager::getInstance()->message(STRING(ERROR_CREATING_REGISTRY_KEY_DCHUB)); + LogManager::getInstance()->message(_("Error creating dchub registry key")); return; } @@ -728,7 +729,7 @@ if(Util::stricmp(app.c_str(), Buf) != 0) { if (::RegCreateKeyEx(HKEY_CLASSES_ROOT, _T("adc"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hk, NULL)) { - LogManager::getInstance()->message(STRING(ERROR_CREATING_REGISTRY_KEY_ADC)); + LogManager::getInstance()->message(_("Error creating adc registry key")); return; } @@ -788,7 +789,7 @@ } else { // set Magnet\Location if (::RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Magnet"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hk, NULL)) { - LogManager::getInstance()->message(STRING(ERROR_CREATING_REGISTRY_KEY_MAGNET)); + LogManager::getInstance()->message(_("Error creating magnet registry key")); return; } @@ -801,10 +802,10 @@ if(BOOLSETTING(MAGNET_REGISTER) && (Util::strnicmp(openCmd, magnetLoc, magnetLoc.size()) != 0 || !haveMagnet)) { SHDeleteKey(HKEY_CLASSES_ROOT, _T("magnet")); if (::RegCreateKeyEx(HKEY_CLASSES_ROOT, _T("magnet"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hk, NULL)) { - LogManager::getInstance()->message(STRING(ERROR_CREATING_REGISTRY_KEY_MAGNET)); + LogManager::getInstance()->message(_("Error creating magnet registry key")); return; } - ::RegSetValueEx(hk, NULL, NULL, REG_SZ, (LPBYTE)CTSTRING(MAGNET_SHELL_DESC), sizeof(TCHAR)*(T_("URL:MAGNET URI").length()+1)); + ::RegSetValueEx(hk, NULL, NULL, REG_SZ, (LPBYTE)CT_("URL:MAGNET URI"), sizeof(TCHAR)*(T_("URL:MAGNET URI").length()+1)); ::RegSetValueEx(hk, _T("URL Protocol"), NULL, REG_SZ, NULL, NULL); ::RegCloseKey(hk); ::RegCreateKeyEx(HKEY_CLASSES_ROOT, _T("magnet\\DefaultIcon"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hk, NULL); @@ -820,8 +821,8 @@ SHDeleteKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Magnet\\Handlers\\DC++")); // add DC++ to magnet-handler's list of applications ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Magnet\\Handlers\\DC++"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hk, NULL); - ::RegSetValueEx(hk, NULL, NULL, REG_SZ, (LPBYTE)CTSTRING(MAGNET_HANDLER_ROOT), sizeof(TCHAR) * (T_("DC++").size()+1)); - ::RegSetValueEx(hk, _T("Description"), NULL, REG_SZ, (LPBYTE)CTSTRING(MAGNET_HANDLER_DESC), sizeof(TCHAR) * (STRING(MAGNET_HANDLER_DESC).size()+1)); + ::RegSetValueEx(hk, NULL, NULL, REG_SZ, (LPBYTE)CT_("DC++"), sizeof(TCHAR) * (T_("DC++").size()+1)); + ::RegSetValueEx(hk, _T("Description"), NULL, REG_SZ, (LPBYTE)CT_("Download files from the Direct Connect network"), sizeof(TCHAR) * (T_("Download files from the Direct Connect network").size()+1)); // set ShellExecute tstring app = Text::toT("\"" + getAppName() + "\" %URL"); ::RegSetValueEx(hk, _T("ShellExecute"), NULL, REG_SZ, (LPBYTE)app.c_str(), sizeof(TCHAR) * (app.length()+1)); @@ -1035,15 +1036,15 @@ double WinUtil::toBytes(TCHAR* aSize) { double bytes = _tstof(aSize); - if (_tcsstr(aSize, CTSTRING(PIB))) { + if (_tcsstr(aSize, CT_("PiB"))) { return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(TiB))) { + } else if (_tcsstr(aSize, CT_("TiB"))) { return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(GiB))) { + } else if (_tcsstr(aSize, CT_("GiB"))) { return bytes * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(MiB))) { + } else if (_tcsstr(aSize, CT_("MiB"))) { return bytes * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(KiB))) { + } else if (_tcsstr(aSize, CT_("KiB"))) { return bytes * 1024.0; } else { return bytes; Modified: dcplusplus/trunk/win32/stdafx.h =================================================================== --- dcplusplus/trunk/win32/stdafx.h 2008-01-17 21:48:59 UTC (rev 966) +++ dcplusplus/trunk/win32/stdafx.h 2008-01-19 10:18:34 UTC (rev 967) @@ -50,6 +50,7 @@ #define gettext_noop(String) String #define N_(String) gettext_noop (String) #define T_(String) Text::toT(gettext(String)) +#define CT_(String) T_(String).c_str() #ifdef UNICODE #define TF_(String) boost::wformat(Text::toT(gettext(String))) #define TFN_(String1,String2, N) boost::wformat(Text::toT(ngettext(String1, String2, N))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-18 22:37:28
|
Revision: 128 http://adchpp.svn.sourceforge.net/adchpp/?rev=128&view=rev Author: arnetheduck Date: 2008-01-18 14:36:54 -0800 (Fri, 18 Jan 2008) Log Message: ----------- fix bloom loading Modified Paths: -------------- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2008-01-15 13:53:57 UTC (rev 127) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2008-01-18 22:36:54 UTC (rev 128) @@ -47,7 +47,7 @@ bloom.resize(v.size() * 8); for(size_t i = 0; i < v.size(); ++i) { for(size_t j = 0; j < 8; ++j) { - bloom[i*8 + j] = ((v[i] >> j) != 0); + bloom[i*8 + j] = (((v[i] >> j) & 1) != 0); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-17 21:49:05
|
Revision: 966 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=966&view=rev Author: arnetheduck Date: 2008-01-17 13:48:59 -0800 (Thu, 17 Jan 2008) Log Message: ----------- More translations Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/Text.h dcplusplus/trunk/win32/AboutDlg.cpp dcplusplus/trunk/win32/DirectoryListingFrame.cpp dcplusplus/trunk/win32/DownloadsFrame.h dcplusplus/trunk/win32/FavHubProperties.cpp dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/HubListsDlg.cpp dcplusplus/trunk/win32/MagnetDlg.cpp dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/PublicHubsFrame.cpp dcplusplus/trunk/win32/QueueFrame.cpp dcplusplus/trunk/win32/SearchFrame.cpp dcplusplus/trunk/win32/SettingsDialog.cpp dcplusplus/trunk/win32/SplashWindow.cpp dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/UploadPage.cpp dcplusplus/trunk/win32/UserInfoBase.h dcplusplus/trunk/win32/UsersFrame.cpp dcplusplus/trunk/win32/WinUtil.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/changelog.txt 2008-01-17 21:48:59 UTC (rev 966) @@ -104,9 +104,9 @@ * [bug 1066] Search for alternates not available on uploads (thanks ullner) * [bug 1104] Better error message on dupe source (thanks ullner) * [bug 1132] Download queue updated when users go offline (thanks stephan hohe) -* [bug 1133] Fixed max tab rows being reset (thanks pothead) +* [bug 1133] Fixed max tab rows being reset (thanks mikejj) * [bug 1134] Use SO_REUSEADDR for connection manager socket (thanks mikael eman) -* [bug 1136] Fixed dupe changelog rebuild (thanks pothead) +* [bug 1136] Fixed dupe changelog rebuild (thanks mikejj) * [bug 1139] Fixed download delay in some cases (thanks mikael eman) * [bug 1144] Added possibility to add many hub lists in one go (use ; as separator) (thanks poy) * [bug 1152] Only refresh if there are directories shared (thanks ullner) @@ -188,7 +188,7 @@ -- 0.696 2006-09-22 -- * Fixed a possible deadlock -* [bug 1058] Removed some whitespace (big thanks to pothead) +* [bug 1058] Removed some whitespace (big thanks to mikejj) * Removed the possibility to download files without TTH * Removed the possibility to read *.DcLst files (no TTH, no i18n support) * Files with no TTH no longer show up in search and directory listings @@ -220,13 +220,13 @@ * [bug 1027] Improved unix socket support (thanks steven sheehy) * [bug 1028] Improved big endian support (thanks steven sheehy) * [bug 1029] Fixed BSD compile issue (thanks steven sheehy) -* [bug 1031] Fixed a crash after closing hub window (thanks bigmuscle/pothead) -* [bug 1032] Fixed certificates help (thanks pothead) +* [bug 1031] Fixed a crash after closing hub window (thanks bigmuscle/mikejj) +* [bug 1032] Fixed certificates help (thanks mikejj) * Added possibility to store configuration files in separate directory * Switched back to unicows for w9x users, opencow was missing too many functions * [bug 876] Fixed lost tooltips (thanks poy and bigmuscle) -* [bug 1041] Fixed about tab order (thanks pothead) -* [bug 1042] Fixed experts tab order (thanks pothead) +* [bug 1041] Fixed about tab order (thanks mikejj) +* [bug 1042] Fixed experts tab order (thanks mikejj) * [bug 1047] Fixed possible nmdc crash (thanks guitarm) * [bug 1049] Added tooltip to tab bar (thanks poy) * [bug 1053] Fixed vista detection (thanks ullner) @@ -245,7 +245,7 @@ * Added language code to example language xml -- 0.692 2006-07-09 -- -* [bug 927] Fixed OP detection bug really (thanks pothead) +* [bug 927] Fixed OP detection bug really (thanks mikejj) * [bug 938] Added a few more ADC info fields (thanks ullner) * [bug 939] Fixed hub info update (thanks ullner) * [bug 940] Fixed a 64-bit compile error (thanks steven sheehy) @@ -254,10 +254,10 @@ * [bug 944] Fixed unix string conversion bug (thanks tobias nygren) * [bug 945] Fixed unix mutex initialiser (thanks tobias nygren) * [bug 946] Tiger hash supports big endian and 64-bit architectures (thanks tobias nygren) -* [bug 941] Updated usercount display (thanks pothead) +* [bug 941] Updated usercount display (thanks mikejj) * [bug 951] Fixed issue with high port numbers (thanks tpo) * [bug 958] Search spy tth option automagically saved (thanks ullner) -* [bug 959] Code cleanup (thanks pothead) +* [bug 959] Code cleanup (thanks mikejj) * [bug 966] Max hash speed fixed when fast hashing method is not used (thanks steven sheehy) * [bug 967] Fixed path case-sensitivity issue (thanks steven sheehy) * Fixed auto-reconnect @@ -270,8 +270,8 @@ * Fixed a crash bug when hash data cannot be saved * Possibly fixed issues with queue items not being updated * Added warning when someone tries to spam hublist.org or dcpp.net with your client -* [bug 968] Fixed unix compile issue (thanks pothead) -* [bug 975] Fixed silly warning (thanks pothead) +* [bug 968] Fixed unix compile issue (thanks mikejj) +* [bug 975] Fixed silly warning (thanks mikejj) * [bug 978] Fixed 64-bit compiler issue (thanks steven sheehy) * [bug 988] Only unique nicks diplayed in title bar * Added protection from hubs/clients sending junk data resulting in high memory usage / crash @@ -283,7 +283,7 @@ * [bug 949] Fixed a crash when reading invalid XML files * TLS port may now be specified in settings and is only opened if TLS is enabled * Added TLS port to /connection -* [bug 977] Added copy hub address to hub right-click menu (thanks pothead) +* [bug 977] Added copy hub address to hub right-click menu (thanks mikejj) * [bug 1001] Fixed assertion on unix (thanks steven sheehy) -- 0.691 2006-06-03 -- @@ -294,7 +294,7 @@ * [bug 878] Added close all ... to window menu (thanks trem) * [bug 903] Holding shift while minimizing will use opposite tray setting (thanks joakim tosteberg) * [bug 923] PM history always read (thanks trem) -* [bug 927] Fixed OP detection bug (thanks pothead) +* [bug 927] Fixed OP detection bug (thanks mikejj) * [bug 929] Fixed list view flicker issues (thanks trem) * [bug 931] Improved keyboard navigation (thanks trem) * Added "all" to hub list field search (thanks trem) @@ -335,7 +335,7 @@ * [bug 853] Fixed missing function in opencow -- 0.688 2006-03-18 -- -* Fixed public hubs sorting (thanks pothead) +* Fixed public hubs sorting (thanks mikejj) * Fixed a ZPipe issue (thanks jove) * [bug 858] Fixed a 100% cpu / crash bug * [bug 872] Fixed a pm issue hopefully @@ -374,7 +374,7 @@ * Added filelist download speed to filelist browser status bar * Added advanced hublist filter (thanks trem) * [bug 579] Fixed 0-byte files not being created if directory doesn't exist -* [bug 804] Cleaned up project files (thanks pothead) +* [bug 804] Cleaned up project files (thanks mikejj) * Socket buffer size = 0 now means use system default * [bug 789] Fixed wrong nick being copied (thanks ullner) * [bug 794] [ADC] Fixed automatic reconnect (thanks ullner) @@ -382,8 +382,8 @@ * Updated to latest ADC specs, this will break 0.68/0.681/0.6811 queue sources and fav users (for NMDC as well) * Fixed a bufferedsocket crash * [ADC] Fixed quitting user processing (thanks ullner) -* Clarified upload speed setting (thanks pothead) -* Manual away setting no longer cleared when un-minimizing (thanks pothead) +* Clarified upload speed setting (thanks mikejj) +* Manual away setting no longer cleared when un-minimizing (thanks mikejj) * Search result automatching waits with match until file list is downloaded if auto-matching enabled * Slight performance improvement when sending files * Fixed an issue with nick names disappearing from hub @@ -409,7 +409,7 @@ * [bug 484] Added a check for multiple refreshes running at the same time (thanks trem) * Fixed a few crashes here and there * Fixed no-slots message not being sent out always -* Fixed yassl build locations (thanks pothead) +* Fixed yassl build locations (thanks mikejj) * Added ip resolve cache when searching (thanks trem) * [bug 413] Failed file moves are now reported to the system log @@ -438,8 +438,8 @@ * Updated bzip2 to 1.0.3 (thanks garg) * Some small *nix fixes (thanks poison) * Source path no longer saved for TTH enabled clients (saves memory and queue file space) -* [bug 335] Search window settings saved automatically (thanks pothead) -* Open folder selects file in explorer (thanks pothead) +* [bug 335] Search window settings saved automatically (thanks mikejj) +* Open folder selects file in explorer (thanks mikejj) * Local echo in pm window formatted as the other side should see it (thanks paka) * Fixed debug assertion (thanks tpo) * Dirty tabs settings improved (thanks ullner) @@ -474,11 +474,11 @@ * Improved hashing error reporting * Fixed hash database rebuild * Added /removefav command to remove a favorite hub (thanks ullner) -* [bug 717] Fixed search combo box (thanks pothead) +* [bug 717] Fixed search combo box (thanks mikejj) * Added option to change auto-refresh interval (thanks ullner) * [bug 740] Removed tab completion option (thanks ullner) * [bug 743] Added registry key creation failure notification (thanks ullner) -* [bug 717] Fixed dropdown sizes (thanks pothead) +* [bug 717] Fixed dropdown sizes (thanks mikejj) * [bug 760] Fixed list subtraction issue (thanks cologic) * Added some right-to-left support, but it probably needs more work * [NMDC] Minislots are no longer given to old DC++ clients (<0.304) Modified: dcplusplus/trunk/dcpp/Text.h =================================================================== --- dcplusplus/trunk/dcpp/Text.h 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/dcpp/Text.h 2008-01-17 21:48:59 UTC (rev 966) @@ -132,25 +132,7 @@ } string toDOS(string tmp); - - template<typename T> - tstring tformat(const tstring& src, T t) { - tstring ret(src.size() + 64, _T('\0')); - int n = _sntprintf(&ret[0], ret.size(), src.c_str(), t); - if(n != -1 && n < static_cast<int>(ret.size())) { - ret.resize(n); - } - return ret; - } - template<typename T, typename T2, typename T3> - tstring tformat(const tstring& src, T t, T2 t2, T3 t3) { - tstring ret(src.size() + 128, _T('\0')); - int n = _sntprintf(&ret[0], ret.size(), src.c_str(), t, t2, t3); - if(n != -1 && n < static_cast<int>(ret.size())) { - ret.resize(n); - } - return ret; - } + } } // namespace dcpp Modified: dcplusplus/trunk/win32/AboutDlg.cpp =================================================================== --- dcplusplus/trunk/win32/AboutDlg.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/AboutDlg.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -40,7 +40,7 @@ "theparanoidone, gadget, naga, tremor, joakim tosteberg, pofis, psf8500, lauris ievins, " "defr, ullner, fleetcommand, liny, xan, olle svensson, mark gillespie, jeremy huddleston, " "bsod, sulan, jonathan stone, tim burton, izzzo, guitarm, paka, nils maier, jens oknelid, yoji, " -"krzysztof tyszecki, poison, pothead, pur, bigmuscle, martin, jove, bart vullings, " +"krzysztof tyszecki, poison, mikejj, pur, bigmuscle, martin, jove, bart vullings, " "steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45, mikael eman, james ross," "stanislav maslovski. " "Keep it coming!"; Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -258,7 +258,7 @@ void DirectoryListingFrame::handleMatchQueue() { int matched = QueueManager::getInstance()->matchListing(*dl); - setStatus(STATUS_STATUS, Text::tformat(TSTRING(MATCHED_FILES), matched)); + setStatus(STATUS_STATUS, str(TFN_("Matched %1% file", "Matched %1% files", matched) % matched)); } void DirectoryListingFrame::handleListDiff() { Modified: dcplusplus/trunk/win32/DownloadsFrame.h =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-17 21:48:59 UTC (rev 966) @@ -22,7 +22,6 @@ #include <dcpp/DownloadManagerListener.h> #include <dcpp/QueueManagerListener.h> #include <dcpp/forward.h> -#include <dcpp/ResourceManager.h> #include "TypedListView.h" #include "StaticFrame.h" Modified: dcplusplus/trunk/win32/FavHubProperties.cpp =================================================================== --- dcplusplus/trunk/win32/FavHubProperties.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/FavHubProperties.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -117,7 +117,7 @@ void FavHubProperties::handleOKClicked() { tstring addressText = address->getText(); if(addressText.empty()) { - createMessageBox().show(T_("Hub address cannot be empty."), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONEXCLAMATION); + createMessageBox().show(T_("Hub address cannot be empty"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONEXCLAMATION); return; } entry->setServer(Text::fromT(addressText)); Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -34,8 +34,16 @@ int HubFrame::columnSizes[] = { 100, 75, 75, 100, 75, 100, 100, 125 }; int HubFrame::columnIndexes[] = { COLUMN_NICK, COLUMN_SHARED, COLUMN_DESCRIPTION, COLUMN_TAG, COLUMN_CONNECTION, COLUMN_IP, COLUMN_EMAIL, COLUMN_CID }; -static ResourceManager::Strings columnNames[] = { ResourceManager::NICK, ResourceManager::SHARED, -ResourceManager::DESCRIPTION, ResourceManager::TAG, ResourceManager::CONNECTION, ResourceManager::IP_BARE, ResourceManager::EMAIL, ResourceManager::CID }; +static const char* columnNames[] = { + N_("Nick"), + N_("Shared"), + N_("Description"), + N_("Tag"), + N_("Connection"), + N_("IP"), + N_("E-Mail"), + N_("CID") +}; HubFrame::FrameList HubFrame::frames; @@ -117,9 +125,9 @@ addWidget(filterType); for(int j=0; j<COLUMN_LAST; j++) { - filterType->addValue(TSTRING_I(columnNames[j])); + filterType->addValue(T_(columnNames[j])); } - filterType->addValue(TSTRING(ANY)); + filterType->addValue(T_("Any")); filterType->setSelectedIndex(COLUMN_LAST); filterType->onSelectionChanged(std::tr1::bind(&HubFrame::updateUserList, this, (UserInfo*)0)); } @@ -130,7 +138,7 @@ paned->setSecond(users); users->setSmallImageList(WinUtil::userImages); - users->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + users->createColumns(WinUtil::getStrings(columnNames)); users->setColumnOrder(WinUtil::splitTokens(SETTING(HUBFRAME_ORDER), columnIndexes)); users->setColumnWidths(WinUtil::splitTokens(SETTING(HUBFRAME_WIDTHS), columnSizes)); users->setColor(WinUtil::textColor, WinUtil::bgColor); @@ -286,16 +294,16 @@ handleFollow(); } } else { - addStatus(TSTRING(SPECIFY_SERVER)); + addStatus(T_("Specify a server to connect to")); } } else if(Util::stricmp(cmd.c_str(), _T("clear")) == 0) { chat->setText(_T("")); } else if(Util::stricmp(cmd.c_str(), _T("ts")) == 0) { timeStamps = !timeStamps; if(timeStamps) { - addStatus(TSTRING(TIMESTAMPS_ENABLED)); + addStatus(T_("Timestamps enabled")); } else { - addStatus(TSTRING(TIMESTAMPS_DISABLED)); + addStatus(T_("Timestamps disabled")); } } else if( (Util::stricmp(cmd.c_str(), _T("password")) == 0) && waitingForPW ) { client->setPassword(Text::fromT(param)); @@ -304,16 +312,16 @@ } else if( Util::stricmp(cmd.c_str(), _T("showjoins")) == 0 ) { showJoins = !showJoins; if(showJoins) { - addStatus(TSTRING(JOIN_SHOWING_ON)); + addStatus(T_("Join/part showing on")); } else { - addStatus(TSTRING(JOIN_SHOWING_OFF)); + addStatus(T_("Join/part showing off")); } } else if( Util::stricmp(cmd.c_str(), _T("favshowjoins")) == 0 ) { favShowJoins = !favShowJoins; if(favShowJoins) { - addStatus(TSTRING(FAV_JOIN_SHOWING_ON)); + addStatus(T_("Join/part of favorite users showing on")); } else { - addStatus(TSTRING(FAV_JOIN_SHOWING_OFF)); + addStatus(T_("Join/part of favorite users showing off")); } } else if(Util::stricmp(cmd.c_str(), _T("close")) == 0) { this->close(true); @@ -491,7 +499,7 @@ addStatus(Text::toT("*** " + STRING(PARTS) + u.identity.getNick())); } } else if(i->first == CONNECTED) { - addStatus(TSTRING(CONNECTED)); + addStatus(T_("Connected")); #ifdef PORT_ME setTabColor(GREEN); #endif @@ -511,7 +519,7 @@ } else if(i->first == GET_PASSWORD) { if(client->getPassword().size() > 0) { client->password(client->getPassword()); - addStatus(TSTRING(STORED_PASSWORD_SENT)); + addStatus(T_("Stored password sent...")); } else { if(!BOOLSETTING(PROMPT_PASSWORD)) { message->setText(_T("/password ")); @@ -519,7 +527,7 @@ message->setSelection(10, 10); waitingForPW = true; } else { - LineDlg linePwd(this, TSTRING(ENTER_PASSWORD), TSTRING(ENTER_PASSWORD), Util::emptyStringT, true); + LineDlg linePwd(this, T_("Please enter a password"), T_("Please enter a password"), Util::emptyStringT, true); if(linePwd.run() == IDOK) { client->setPassword(Text::fromT(linePwd.getLine())); client->password(Text::fromT(linePwd.getLine())); @@ -955,9 +963,9 @@ aEntry.setConnect(false); aEntry.setNick(client->getMyNick()); FavoriteManager::getInstance()->addFavorite(aEntry); - addStatus(TSTRING(FAVORITE_HUB_ADDED)); + addStatus(T_("Favorite hub added")); } else { - addStatus(TSTRING(FAVORITE_HUB_ALREADY_EXISTS)); + addStatus(T_("Hub already exists as a favorite")); } } @@ -965,9 +973,9 @@ FavoriteHubEntry* removeHub = FavoriteManager::getInstance()->getFavoriteHubEntry(client->getHubUrl()); if(removeHub) { FavoriteManager::getInstance()->removeFavorite(removeHub); - addStatus(TSTRING(FAVORITE_HUB_REMOVED)); + addStatus(T_("Favorite hub removed")); } else { - addStatus(TSTRING(FAVORITE_HUB_DOES_NOT_EXIST)); + addStatus(T_("This hub is not a favorite hub")); } } @@ -1151,7 +1159,7 @@ WidgetMenuPtr menu = createMenu(true); appendUserItems(getParent(), menu); - menu->appendItem(IDC_COPY_NICK, TSTRING(COPY_NICK), std::tr1::bind(&HubFrame::handleCopyNick, this)); + menu->appendItem(IDC_COPY_NICK, T_("Copy nick to clipboard"), std::tr1::bind(&HubFrame::handleCopyNick, this)); menu->setDefaultItem(IDC_GETLIST); prepareMenu(menu, UserCommand::CONTEXT_CHAT, client->getHubUrl()); @@ -1167,15 +1175,15 @@ WidgetMenuPtr menu = createMenu(true); if(!FavoriteManager::getInstance()->isFavoriteHub(url)) { - menu->appendItem(IDC_ADD_TO_FAVORITES, TSTRING(ADD_TO_FAVORITES), std::tr1::bind(&HubFrame::addAsFavorite, this)); + menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To Favorites"), std::tr1::bind(&HubFrame::addAsFavorite, this)); } menu->appendItem(IDC_RECONNECT, TSTRING(MENU_RECONNECT), std::tr1::bind(&HubFrame::handleReconnect, this)); - menu->appendItem(IDC_COPY_HUB, TSTRING(COPY_HUB), std::tr1::bind(&HubFrame::handleCopyHub, this)); + menu->appendItem(IDC_COPY_HUB, T_("Copy address to clipboard"), std::tr1::bind(&HubFrame::handleCopyHub, this)); prepareMenu(menu, UserCommand::CONTEXT_HUB, url); menu->appendSeparatorItem(); - menu->appendItem(IDC_CLOSE_WINDOW, TSTRING(CLOSE), std::tr1::bind(&HubFrame::close, this, true)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("Close"), std::tr1::bind(&HubFrame::close, this, true)); inTabMenu = true; @@ -1362,7 +1370,7 @@ void HubFrame::handleFollow() { if(!redirect.empty()) { if(ClientManager::getInstance()->isConnected(redirect)) { - addStatus(TSTRING(REDIRECT_ALREADY_CONNECTED)); + addStatus(T_("Redirect request received to a hub that's already connected")); return; } Modified: dcplusplus/trunk/win32/HubListsDlg.cpp =================================================================== --- dcplusplus/trunk/win32/HubListsDlg.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/HubListsDlg.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -22,7 +22,6 @@ #include "HubListsDlg.h" -#include <dcpp/ResourceManager.h> #include <dcpp/FavoriteManager.h> #include <dcpp/StringTokenizer.h> #include "HoldRedraw.h" Modified: dcplusplus/trunk/win32/MagnetDlg.cpp =================================================================== --- dcplusplus/trunk/win32/MagnetDlg.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/MagnetDlg.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -42,7 +42,7 @@ } bool MagnetDlg::handleInitDialog() { - setText(TSTRING(MAGNET_DLG_TITLE)); + setText(T_("MAGNET Link detected")); ::SetDlgItemText(handle(), IDC_MAGNET_TEXT, CTSTRING(MAGNET_DLG_TEXT_GOOD)); ::SetDlgItemText(handle(), IDC_MAGNET_HASH, CTSTRING(MAGNET_DLG_HASH)); ::SetDlgItemText(handle(), IDC_MAGNET_DISP_HASH, mHash.c_str()); @@ -50,21 +50,21 @@ ::SetDlgItemText(handle(), IDC_MAGNET_DISP_NAME, mFileName.c_str()); //queue = attachRadioButton(IDC_MAGNET_1_QUEUE); - //queue->setText(TSTRING(MAGNET_DLG_QUEUE)); + //queue->setText(T_("Add this file to your download queue")); //queue->onClicked(std::tr1::bind(&MagnetDlg::handleRadioButtonClicked, this, queue)); ::ShowWindow(::GetDlgItem(handle(), IDC_MAGNET_1_QUEUE), false); search = attachRadioButton(IDC_MAGNET_2_SEARCH); - search->setText(TSTRING(MAGNET_DLG_SEARCH)); + search->setText(T_("Start a search for this file")); search->setFocus(); //search->onClicked(std::tr1::bind(&MagnetDlg::handleRadioButtonClicked, this, search)); doNothing = attachRadioButton(IDC_MAGNET_3_NOTHING); - doNothing->setText(TSTRING(MAGNET_DLG_NOTHING)); + doNothing->setText(T_("Do nothing")); //doNothing->onClicked(std::tr1::bind(&MagnetDlg::handleRadioButtonClicked, this, doNothing)); //remember = attachCheckBox(IDC_MAGNET_REMEMBER); - //remember->setText(TSTRING(MAGNET_DLG_REMEMBER)); + //remember->setText(T_("Do the same action next time without asking")); ::ShowWindow(::GetDlgItem(handle(), IDC_MAGNET_REMEMBER), false); ::CheckRadioButton(handle(), IDC_MAGNET_1_QUEUE, IDC_MAGNET_3_NOTHING, IDC_MAGNET_2_SEARCH); Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -141,7 +141,7 @@ ::ShowWindow(handle(), ((cmdShow == SW_SHOWDEFAULT) || (cmdShow == SW_SHOWNORMAL)) ? SETTING(MAIN_WINDOW_STATE) : cmdShow); if(SmartWin::LibraryLoader::getCommonControlsVersion() < PACK_COMCTL_VERSION(5,80)) - createMessageBox().show(TSTRING(COMCTL_TOO_OLD), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONEXCLAMATION); + createMessageBox().show(T_("Your version of windows common controls is too old for DC++ to run correctly, and you will most probably experience problems with the user interface. You should download version 5.80 or higher from the DC++ homepage or from Microsoft directly."), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONEXCLAMATION); } void MainWindow::initWindow() { @@ -181,68 +181,68 @@ WidgetMenuPtr file = mainMenu->appendPopup(CTSTRING(MENU_FILE)); - file->appendItem(IDC_QUICK_CONNECT, TSTRING(MENU_QUICK_CONNECT), std::tr1::bind(&MainWindow::handleQuickConnect, this)); - file->appendItem(IDC_FOLLOW, TSTRING(MENU_FOLLOW_REDIRECT)); - file->appendItem(IDC_RECONNECT, TSTRING(MENU_RECONNECT)); + file->appendItem(IDC_QUICK_CONNECT, T_("&Quick Connect ...\tCtrl+Q"), std::tr1::bind(&MainWindow::handleQuickConnect, this)); + file->appendItem(IDC_FOLLOW, T_("Follow last redirec&t\tCtrl+T")); + file->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R")); file->appendSeparatorItem(); - file->appendItem(IDC_OPEN_FILE_LIST, TSTRING(MENU_OPEN_FILE_LIST), std::tr1::bind(&MainWindow::handleOpenFileList, this)); - file->appendItem(IDC_OPEN_OWN_LIST, TSTRING(MENU_OPEN_OWN_LIST), std::tr1::bind(&MainWindow::handleOpenOwnList, this)); - file->appendItem(IDC_MATCH_ALL, TSTRING(MENU_OPEN_MATCH_ALL), std::tr1::bind(&MainWindow::handleMatchAll, this)); - file->appendItem(IDC_REFRESH_FILE_LIST, TSTRING(MENU_REFRESH_FILE_LIST), std::tr1::bind(&MainWindow::handleRefreshFileList, this)); - file->appendItem(IDC_OPEN_DOWNLOADS, TSTRING(MENU_OPEN_DOWNLOADS_DIR), std::tr1::bind(&MainWindow::handleOpenDownloadsDir, this)); + file->appendItem(IDC_OPEN_FILE_LIST, T_("Open file list...\tCtrl+L"), std::tr1::bind(&MainWindow::handleOpenFileList, this)); + file->appendItem(IDC_OPEN_OWN_LIST, T_("Open own list"), std::tr1::bind(&MainWindow::handleOpenOwnList, this)); + file->appendItem(IDC_MATCH_ALL, T_("Match downloaded lists"), std::tr1::bind(&MainWindow::handleMatchAll, this)); + file->appendItem(IDC_REFRESH_FILE_LIST, T_("Refresh file list\tCtrl+E"), std::tr1::bind(&MainWindow::handleRefreshFileList, this)); + file->appendItem(IDC_OPEN_DOWNLOADS, T_("Open downloads directory"), std::tr1::bind(&MainWindow::handleOpenDownloadsDir, this)); file->appendSeparatorItem(); - file->appendItem(IDC_SETTINGS, TSTRING(MENU_SETTINGS), std::tr1::bind(&MainWindow::handleSettings, this)); + file->appendItem(IDC_SETTINGS, T_("Settings..."), std::tr1::bind(&MainWindow::handleSettings, this)); file->appendSeparatorItem(); - file->appendItem(IDC_EXIT, TSTRING(MENU_EXIT), std::tr1::bind(&MainWindow::handleExit, this)); + file->appendItem(IDC_EXIT, T_("E&xit"), std::tr1::bind(&MainWindow::handleExit, this)); WidgetMenuPtr view = mainMenu->appendPopup(CTSTRING(MENU_VIEW)); - view->appendItem(IDC_PUBLIC_HUBS, TSTRING(MENU_PUBLIC_HUBS), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_FAVORITE_HUBS, TSTRING(MENU_FAVORITE_HUBS), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_FAVUSERS, TSTRING(MENU_FAVORITE_USERS), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_PUBLIC_HUBS, T_("&Public Hubs\tCtrl+P"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_FAVORITE_HUBS, T_("&Favorite Hubs\tCtrl+F"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_FAVUSERS, T_("Favorite &Users\tCtrl+U"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendSeparatorItem(); - view->appendItem(IDC_QUEUE, TSTRING(MENU_DOWNLOAD_QUEUE), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_FINISHED_DL, TSTRING(FINISHED_DOWNLOADS), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_WAITING_USERS, TSTRING(WAITING_USERS), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_FINISHED_UL, TSTRING(FINISHED_UPLOADS), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_QUEUE, T_("&Download Queue\tCtrl+D"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_FINISHED_DL, T_("Finished Downloads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_WAITING_USERS, T_("Waiting Users"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_FINISHED_UL, T_("Finished Uploads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendSeparatorItem(); - view->appendItem(IDC_SEARCH, TSTRING(MENU_SEARCH), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_ADL_SEARCH, TSTRING(MENU_ADL_SEARCH), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_SEARCH_SPY, TSTRING(MENU_SEARCH_SPY), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_SEARCH, T_("&Search\tCtrl+S"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_ADL_SEARCH, T_("ADL Search"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_SEARCH_SPY, T_("Search Spy"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendSeparatorItem(); - view->appendItem(IDC_NOTEPAD, TSTRING(MENU_NOTEPAD), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_SYSTEM_LOG, TSTRING(MENU_SYSTEM_LOG), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_NET_STATS, TSTRING(MENU_NETWORK_STATISTICS), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_NOTEPAD, T_("&Notepad\tCtrl+N"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_SYSTEM_LOG, T_("System Log"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_NET_STATS, T_("Network Statistics"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendItem(IDC_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_HASH_PROGRESS, TSTRING(MENU_HASH_PROGRESS), std::tr1::bind(&MainWindow::handleHashProgress, this)); + view->appendItem(IDC_HASH_PROGRESS, T_("Indexing progress"), std::tr1::bind(&MainWindow::handleHashProgress, this)); WidgetMenuPtr window = mainMenu->appendPopup(CTSTRING(MENU_WINDOW)); - window->appendItem(IDC_CLOSE_ALL_DISCONNECTED, TSTRING(MENU_CLOSE_DISCONNECTED), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - window->appendItem(IDC_CLOSE_ALL_PM, TSTRING(MENU_CLOSE_ALL_PM), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - window->appendItem(IDC_CLOSE_ALL_OFFLINE_PM, TSTRING(MENU_CLOSE_ALL_OFFLINE_PM), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - window->appendItem(IDC_CLOSE_ALL_DIR_LIST, TSTRING(MENU_CLOSE_ALL_DIR_LIST), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - window->appendItem(IDC_CLOSE_ALL_SEARCH_FRAME, TSTRING(MENU_CLOSE_ALL_SEARCHFRAME), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_DISCONNECTED, T_("Close disconnected"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_PM, T_("Close all PM windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_OFFLINE_PM, T_("Close all offline PM windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_DIR_LIST, T_("Close all file list windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_SEARCH_FRAME, T_("Close all search windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); WidgetMenuPtr help = mainMenu->appendPopup(TSTRING(MENU_HELP)); - help->appendItem(IDC_HELP_CONTENTS, TSTRING(MENU_CONTENTS), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); + help->appendItem(IDC_HELP_CONTENTS, T_("Help &Contents\tF1"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); help->appendSeparatorItem(); - help->appendItem(IDC_HELP_CHANGELOG, TSTRING(MENU_CHANGELOG), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); - help->appendItem(IDC_ABOUT, TSTRING(MENU_ABOUT), std::tr1::bind(&MainWindow::handleAbout, this)); + help->appendItem(IDC_HELP_CHANGELOG, T_("Change Log"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); + help->appendItem(IDC_ABOUT, T_("About DC++..."), std::tr1::bind(&MainWindow::handleAbout, this)); help->appendSeparatorItem(); - help->appendItem(IDC_HELP_HOMEPAGE, TSTRING(MENU_HOMEPAGE), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_DOWNLOADS, TSTRING(MENU_HELP_DOWNLOADS), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_GEOIPFILE, TSTRING(MENU_HELP_GEOIPFILE), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_TRANSLATIONS, TSTRING(MENU_HELP_TRANSLATIONS), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_FAQ, TSTRING(MENU_FAQ), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_FORUM, TSTRING(MENU_HELP_FORUM), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_DISCUSS, TSTRING(MENU_DISCUSS), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_REQUEST_FEATURE, TSTRING(MENU_REQUEST_FEATURE), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_REPORT_BUG, TSTRING(MENU_REPORT_BUG), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_DONATE, TSTRING(MENU_DONATE), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_HOMEPAGE, T_("DC++ Homepage"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_GEOIPFILE, T_("GeoIP database update"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_TRANSLATIONS, T_("Translations"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_FAQ, T_("Frequently asked questions"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_FORUM, T_("Help forum"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_DISCUSS, T_("DC++ discussion forum"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_REQUEST_FEATURE, T_("Request a feature"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_REPORT_BUG, T_("Report a bug"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_DONATE, T_("Donate (paypal)"), std::tr1::bind(&MainWindow::handleLink, this, _1)); mainMenu->attach(this); } @@ -342,7 +342,7 @@ if (SETTING(NICK).empty()) return; - LineDlg dlg(this, TSTRING(QUICK_CONNECT), TSTRING(HUB_ADDRESS)); + LineDlg dlg(this, T_("Quick Connect"), T_("Address")); if (dlg.run() == IDOK) { @@ -457,7 +457,7 @@ bool MainWindow::closing() { if (stopperThread == NULL) { - if ( !BOOLSETTING(CONFIRM_EXIT) || (createMessageBox().show(TSTRING(REALLY_EXIT), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_YESNO, WidgetMessageBox::BOX_ICONQUESTION) == IDYES)) { + if ( !BOOLSETTING(CONFIRM_EXIT) || (createMessageBox().show(T_("Really exit?"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_YESNO, WidgetMessageBox::BOX_ICONQUESTION) == IDYES)) { if (c != NULL) { c->removeListener(this); delete c; @@ -610,7 +610,7 @@ try { ConnectionManager::getInstance()->listen(); } catch(const Exception&) { - WidgetMessageBox().show(TSTRING(TCP_PORT_BUSY), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); + WidgetMessageBox().show(T_("Unable to open TCP/TLS port. File transfers will not work correctly until you change settings or turn off any application that might be using the TCP/TLS port"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); } try { SearchManager::getInstance()->listen(); @@ -632,7 +632,7 @@ if ( FAILED(UPnP_UDPConnection->OpenPorts()) || FAILED(UPnP_TCPConnection->OpenPorts()) ) { LogManager::getInstance()->message(STRING(UPNP_FAILED_TO_CREATE_MAPPINGS)); - createMessageBox().show(TSTRING(UPNP_FAILED_TO_CREATE_MAPPINGS), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); + createMessageBox().show(T_("Failed to create port mappings. Please set up your NAT yourself."), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); // We failed! thus reset the objects delete UPnP_TCPConnection; @@ -651,7 +651,7 @@ //:-( Looks like we have to rely on the user setting the external IP manually // no need to do cleanup here because the mappings work LogManager::getInstance()->message(STRING(UPNP_FAILED_TO_GET_EXTERNAL_IP)); - createMessageBox().show(TSTRING(UPNP_FAILED_TO_GET_EXTERNAL_IP), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); + createMessageBox().show(T_("Failed to get external IP via UPnP. Please set it yourself."), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); } } } @@ -690,7 +690,7 @@ if (u) { DirectoryListingFrame::openWindow(getMDIParent(), file, Text::toT(Util::emptyString), u, 0); } else { - createMessageBox().show(TSTRING(INVALID_LISTNAME), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); + createMessageBox().show(T_("Invalid file list name"), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); } } } @@ -999,10 +999,10 @@ } else if(lParam == WM_RBUTTONDOWN || lParam == WM_CONTEXTMENU) { SmartWin::ScreenCoordinate pt; WidgetMenuPtr trayMenu = createMenu(true); - trayMenu->appendItem(IDC_TRAY_SHOW, TSTRING(MENU_SHOW), std::tr1::bind(&MainWindow::handleRestore, this)); + trayMenu->appendItem(IDC_TRAY_SHOW, T_("Show"), std::tr1::bind(&MainWindow::handleRestore, this)); trayMenu->appendItem(IDC_TRAY_QUIT, TSTRING(MENU_EXIT), std::tr1::bind(&MainWindow::close, this, true)); - trayMenu->appendItem(IDC_OPEN_DOWNLOADS, TSTRING(MENU_OPEN_DOWNLOADS_DIR)); - trayMenu->appendItem(IDC_SETTINGS, TSTRING(MENU_SETTINGS)); + trayMenu->appendItem(IDC_OPEN_DOWNLOADS, T_("Open downloads directory")); + trayMenu->appendItem(IDC_SETTINGS, T_("Settings...")); trayMenu->setDefaultItem(0,TRUE); ::GetCursorPos(&pt.getPoint()); ::SetForegroundWindow(handle()); Modified: dcplusplus/trunk/win32/PublicHubsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PublicHubsFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/PublicHubsFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -46,20 +46,19 @@ int PublicHubsFrame::columnSizes[] = { 200, 290, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100 }; -static ResourceManager::Strings columnNames[] = { - ResourceManager::HUB_NAME, - ResourceManager::DESCRIPTION, - ResourceManager::USERS, - ResourceManager::HUB_ADDRESS, - ResourceManager::COUNTRY, - ResourceManager::SHARED, - ResourceManager::MIN_SHARE, - ResourceManager::MIN_SLOTS, - ResourceManager::MAX_HUBS, - ResourceManager::MAX_USERS, - ResourceManager::RELIABILITY, - ResourceManager::RATING, - +static const char* columnNames[] = { + N_("Name"), + N_("Description"), + N_("Users"), + N_("Address"), + N_("Country"), + N_("Shared"), + N_("Min Share"), + N_("Min Slots"), + N_("Max Hubs"), + N_("Max Users"), + N_("Reliability"), + N_("Rating") }; PublicHubsFrame::HubInfo::HubInfo(const HubEntry* entry_) : entry(entry_) { @@ -110,7 +109,7 @@ hubs = SmartWin::WidgetCreator<WidgetHubs>::create(this, cs); addWidget(hubs); - hubs->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + hubs->createColumns(WinUtil::getStrings(columnNames)); hubs->setColumnOrder(WinUtil::splitTokens(SETTING(FAVHUBSFRAME_ORDER), columnIndexes)); hubs->setColumnWidths(WinUtil::splitTokens(SETTING(FAVHUBSFRAME_WIDTHS), columnSizes)); hubs->setColor(WinUtil::textColor, WinUtil::bgColor); @@ -135,9 +134,9 @@ //populate the filter list with the column names for(int j=0; j<COLUMN_LAST; j++) { - filterSel->addValue(TSTRING_I(columnNames[j])); + filterSel->addValue(T_(columnNames[j])); } - filterSel->addValue(TSTRING(ANY)); + filterSel->addValue(T_("Any")); filterSel->setSelectedIndex(COLUMN_LAST); filterSel->onSelectionChanged(std::tr1::bind(&PublicHubsFrame::updateList, this)); @@ -149,13 +148,13 @@ { WidgetButton::Seed cs = WinUtil::Seeds::button; - cs.caption = TSTRING(CONFIGURE); + cs.caption = T_("&Configure"); configure = createButton(cs); configure->onClicked(std::tr1::bind(&PublicHubsFrame::handleConfigure, this)); configure->setFont(WinUtil::font); addWidget(configure); - cs.caption = TSTRING(REFRESH); + cs.caption = T_("&Refresh"); refresh = createButton(cs); refresh->onClicked(std::tr1::bind(&PublicHubsFrame::handleRefresh, this)); refresh->setFont(WinUtil::font); @@ -163,11 +162,11 @@ cs.style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_GROUPBOX; cs.exStyle = WS_EX_TRANSPARENT; - cs.caption = TSTRING(CONFIGURED_HUB_LISTS); + cs.caption = T_("Configured Public Hub Lists"); lists = createButton(cs); lists->setFont(WinUtil::font); - cs.caption = TSTRING(FILTER); + cs.caption = T_("F&ilter"); filterDesc = createButton(cs); filterDesc->setFont(WinUtil::font); } @@ -187,7 +186,7 @@ onSpeaker(std::tr1::bind(&PublicHubsFrame::handleSpeaker, this, _1, _2)); if(FavoriteManager::getInstance()->isDownloading()) { - setStatus(STATUS_STATUS, TSTRING(DOWNLOADING_HUB_LIST)); + setStatus(STATUS_STATUS, T_("Downloading public hub list...")); } else if(entries.empty()) { FavoriteManager::getInstance()->refresh(); } @@ -447,8 +446,8 @@ WidgetMenuPtr menu = createMenu(true); menu->appendItem(IDC_CONNECT, TSTRING(CONNECT), std::tr1::bind(&PublicHubsFrame::handleConnect, this)); - menu->appendItem(IDC_ADD, TSTRING(ADD_TO_FAVORITES), std::tr1::bind(&PublicHubsFrame::handleAdd, this)); - menu->appendItem(IDC_COPY_HUB, TSTRING(COPY_HUB), std::tr1::bind(&PublicHubsFrame::handleCopyHub, this)); + menu->appendItem(IDC_ADD, T_("Add To Favorites"), std::tr1::bind(&PublicHubsFrame::handleAdd, this)); + menu->appendItem(IDC_COPY_HUB, T_("Copy address to clipboard"), std::tr1::bind(&PublicHubsFrame::handleCopyHub, this)); menu->setDefaultItem(IDC_CONNECT); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; @@ -495,7 +494,7 @@ bool PublicHubsFrame::checkNick() { if(SETTING(NICK).empty()) { - createMessageBox().show(TSTRING(ENTER_NICK), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); + createMessageBox().show(T_("Please enter a nickname in the settings dialog!"), _T(APPNAME) _T(" ") _T(VERSIONSTRING)); return false; } return true; Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -25,7 +25,6 @@ #include "PrivateFrame.h" #include <dcpp/QueueManager.h> -#include <dcpp/ResourceManager.h> #include <dcpp/version.h> int QueueFrame::columnIndexes[] = { COLUMN_TARGET, COLUMN_STATUS, COLUMN_SIZE, COLUMN_DOWNLOADED, COLUMN_PRIORITY, @@ -414,42 +413,32 @@ tmp += WinUtil::getNicks(j->getUser()); } - display->columns[COLUMN_USERS] = tmp.empty() ? TSTRING(NO_USERS) : tmp; + display->columns[COLUMN_USERS] = tmp.empty() ? T_("No users") : tmp; } if(colMask & MASK_STATUS) { if(!getRunning()) { - - TCHAR buf[64]; if(online > 0) { if(getSources().size() == 1) { - display->columns[COLUMN_STATUS] = TSTRING(WAITING_USER_ONLINE); + display->columns[COLUMN_STATUS] = T_("Waiting (User online)"); } else { - _sntprintf(buf, 64, CTSTRING(WAITING_USERS_ONLINE), online, getSources().size()); - display->columns[COLUMN_STATUS] = buf; + display->columns[COLUMN_STATUS] = str(TF_("Waiting (%1% of %2% users online)") % online % getSources().size()); } } else { if(getSources().size() == 0) { - display->columns[COLUMN_STATUS] = TSTRING(NO_USERS_TO_DOWNLOAD_FROM); + display->columns[COLUMN_STATUS] = T_("No users to download from"); } else if(getSources().size() == 1) { - display->columns[COLUMN_STATUS] = TSTRING(USER_OFFLINE); - } else if(getSources().size() == 2) { - display->columns[COLUMN_STATUS] = TSTRING(BOTH_USERS_OFFLINE); - } else if(getSources().size() == 3) { - display->columns[COLUMN_STATUS] = TSTRING(ALL_3_USERS_OFFLINE); - } else if(getSources().size() == 4) { - display->columns[COLUMN_STATUS] = TSTRING(ALL_4_USERS_OFFLINE); + display->columns[COLUMN_STATUS] = T_("User offline"); } else { - _sntprintf(buf, 64, CTSTRING(ALL_USERS_OFFLINE), getSources().size()); - display->columns[COLUMN_STATUS] = buf; + display->columns[COLUMN_STATUS] = str(TF_("All %1% users offline") % getSources().size()); } } } else { - display->columns[COLUMN_STATUS] = TSTRING(RUNNING); + display->columns[COLUMN_STATUS] = T_("Running..."); } } if(colMask & MASK_SIZE) { - display->columns[COLUMN_SIZE] = (getSize() == -1) ? TSTRING(UNKNOWN) : Text::toT(Util::formatBytes(getSize())); - display->columns[COLUMN_EXACT_SIZE] = (getSize() == -1) ? TSTRING(UNKNOWN) : Text::toT(Util::formatExactSize(getSize())); + display->columns[COLUMN_SIZE] = (getSize() == -1) ? T_("Unknown") : Text::toT(Util::formatBytes(getSize())); + display->columns[COLUMN_EXACT_SIZE] = (getSize() == -1) ? T_("Unknown") : Text::toT(Util::formatExactSize(getSize())); } if(colMask & MASK_DOWNLOADED) { if(getSize() > 0) @@ -459,12 +448,12 @@ } if(colMask & MASK_PRIORITY) { switch(getPriority()) { - case QueueItem::PAUSED: display->columns[COLUMN_PRIORITY] = TSTRING(PAUSED); break; - case QueueItem::LOWEST: display->columns[COLUMN_PRIORITY] = TSTRING(LOWEST); break; - case QueueItem::LOW: display->columns[COLUMN_PRIORITY] = TSTRING(LOW); break; - case QueueItem::NORMAL: display->columns[COLUMN_PRIORITY] = TSTRING(NORMAL); break; - case QueueItem::HIGH: display->columns[COLUMN_PRIORITY] = TSTRING(HIGH); break; - case QueueItem::HIGHEST: display->columns[COLUMN_PRIORITY] = TSTRING(HIGHEST); break; + case QueueItem::PAUSED: display->columns[COLUMN_PRIORITY] = T_("Paused"); break; + case QueueItem::LOWEST: display->columns[COLUMN_PRIORITY] = T_("Lowest"); break; + case QueueItem::LOW: display->columns[COLUMN_PRIORITY] = T_("Low"); break; + case QueueItem::NORMAL: display->columns[COLUMN_PRIORITY] = T_("Normal"); break; + case QueueItem::HIGH: display->columns[COLUMN_PRIORITY] = T_("High"); break; + case QueueItem::HIGHEST: display->columns[COLUMN_PRIORITY] = T_("Highest"); break; default: dcasserta(0); break; } } @@ -482,22 +471,22 @@ tmp += WinUtil::getNicks(j->getUser()); tmp += _T(" ("); if(j->isSet(QueueItem::Source::FLAG_FILE_NOT_AVAILABLE)) { - tmp += TSTRING(FILE_NOT_AVAILABLE); + tmp += T_("File not available"); } else if(j->isSet(QueueItem::Source::FLAG_PASSIVE)) { - tmp += TSTRING(PASSIVE_USER); + tmp += T_("Passive user"); } else if(j->isSet(QueueItem::Source::FLAG_CRC_FAILED)) { - tmp += TSTRING(SFV_INCONSISTENCY); + tmp += T_("CRC32 inconsistency (SFV-Check)"); } else if(j->isSet(QueueItem::Source::FLAG_BAD_TREE)) { - tmp += TSTRING(INVALID_TREE); + tmp += T_("Full tree does not match TTH root"); } else if(j->isSet(QueueItem::Source::FLAG_SLOW_SOURCE)) { - tmp += TSTRING(SOURCE_TOO_SLOW); + tmp += T_("Source too slow"); } else if(j->isSet(QueueItem::Source::FLAG_NO_TTHF)) { - tmp += TSTRING(SOURCE_TOO_OLD); + tmp += T_("Remote client does not fully support TTH - cannot download"); } tmp += ')'; } } - display->columns[COLUMN_ERRORS] = tmp.empty() ? TSTRING(NO_ERRORS) : tmp; + display->columns[COLUMN_ERRORS] = tmp.empty() ? T_("No errors") : tmp; } if(colMask & MASK_ADDED) { @@ -701,12 +690,12 @@ } void QueueFrame::removeSelected() { - if(!BOOLSETTING(CONFIRM_ITEM_REMOVAL) || createMessageBox().show(TSTRING(REALLY_REMOVE), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_YESNO, WidgetMessageBox::BOX_ICONQUESTION) == IDYES) + if(!BOOLSETTING(CONFIRM_ITEM_REMOVAL) || createMessageBox().show(T_("Really remove?"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_YESNO, WidgetMessageBox::BOX_ICONQUESTION) == IDYES) files->forEachSelected(&QueueItemInfo::remove); } void QueueFrame::removeSelectedDir() { - if(!BOOLSETTING(CONFIRM_ITEM_REMOVAL) || createMessageBox().show(TSTRING(REALLY_REMOVE), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_YESNO, WidgetMessageBox::BOX_ICONQUESTION) == IDYES) + if(!BOOLSETTING(CONFIRM_ITEM_REMOVAL) || createMessageBox().show(T_("Really remove?"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_YESNO, WidgetMessageBox::BOX_ICONQUESTION) == IDYES) removeDir(dirs->getSelection()); } @@ -987,10 +976,10 @@ QueueFrame::WidgetMenuPtr QueueFrame::makeSingleMenu(QueueItemInfo* qii) { WidgetMenuPtr menu = createMenu(true); - menu->appendItem(IDC_SEARCH_ALTERNATES, TSTRING(SEARCH_FOR_ALTERNATES), std::tr1::bind(&QueueFrame::handleSearchAlternates, this)); - menu->appendItem(IDC_BITZI_LOOKUP, TSTRING(LOOKUP_AT_BITZI), std::tr1::bind(&QueueFrame::handleBitziLookup, this)); - menu->appendItem(IDC_COPY_MAGNET, TSTRING(COPY_MAGNET), std::tr1::bind(&QueueFrame::handleCopyMagnet, this)); - menu->appendItem(IDC_MOVE, TSTRING(MOVE), std::tr1::bind(&QueueFrame::handleMove, this)); + menu->appendItem(IDC_SEARCH_ALTERNATES, T_("Search for alternates"), std::tr1::bind(&QueueFrame::handleSearchAlternates, this)); + menu->appendItem(IDC_BITZI_LOOKUP, T_("Lookup TTH at Bitzi.com"), std::tr1::bind(&QueueFrame::handleBitziLookup, this)); + menu->appendItem(IDC_COPY_MAGNET, T_("Copy magnet link to clipboard"), std::tr1::bind(&QueueFrame::handleCopyMagnet, this)); + menu->appendItem(IDC_MOVE, T_("Move/Rename"), std::tr1::bind(&QueueFrame::handleMove, this)); addPriorityMenu(menu); addBrowseMenu(menu, qii); addPMMenu(menu, qii); @@ -1008,7 +997,7 @@ addPriorityMenu(menu); - menu->appendItem(IDC_MOVE, TSTRING(MOVE), std::tr1::bind(&QueueFrame::handleMove, this)); + menu->appendItem(IDC_MOVE, T_("Move/Rename"), std::tr1::bind(&QueueFrame::handleMove, this)); menu->appendSeparatorItem(); menu->appendItem(IDC_REMOVE, TSTRING(REMOVE), std::tr1::bind(&QueueFrame::handleRemove, this)); return menu; @@ -1018,25 +1007,25 @@ WidgetMenuPtr menu = createMenu(true); addPriorityMenu(menu); - menu->appendItem(IDC_MOVE, TSTRING(MOVE), std::tr1::bind(&QueueFrame::handleMove, this)); + menu->appendItem(IDC_MOVE, T_("Move/Rename"), std::tr1::bind(&QueueFrame::handleMove, this)); menu->appendSeparatorItem(); menu->appendItem(IDC_REMOVE, TSTRING(REMOVE), std::tr1::bind(&QueueFrame::handleRemove, this)); return menu; } void QueueFrame::addPriorityMenu(const WidgetMenuPtr& parent) { - WidgetMenuPtr menu = parent->appendPopup(TSTRING(SET_PRIORITY)); - menu->appendItem(IDC_PRIORITY_PAUSED, TSTRING(PAUSED), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); - menu->appendItem(IDC_PRIORITY_LOWEST, TSTRING(LOWEST), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); - menu->appendItem(IDC_PRIORITY_LOW, TSTRING(LOW), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); - menu->appendItem(IDC_PRIORITY_NORMAL, TSTRING(NORMAL), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); - menu->appendItem(IDC_PRIORITY_HIGH, TSTRING(HIGH), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); - menu->appendItem(IDC_PRIORITY_HIGHEST, TSTRING(HIGHEST), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); + WidgetMenuPtr menu = parent->appendPopup(T_("Set priority")); + menu->appendItem(IDC_PRIORITY_PAUSED, T_("Paused"), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); + menu->appendItem(IDC_PRIORITY_LOWEST, T_("Lowest"), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); + menu->appendItem(IDC_PRIORITY_LOW, T_("Low"), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); + menu->appendItem(IDC_PRIORITY_NORMAL, T_("Normal"), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); + menu->appendItem(IDC_PRIORITY_HIGH, T_("High"), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); + menu->appendItem(IDC_PRIORITY_HIGHEST, T_("Highest"), std::tr1::bind(&QueueFrame::handlePriority, this, _1)); } void QueueFrame::addBrowseMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) { unsigned int pos = parent->getCount(); - WidgetMenuPtr menu = parent->appendPopup(TSTRING(GET_FILE_LIST)); + WidgetMenuPtr menu = parent->appendPopup(T_("Get file list")); if(addUsers(menu, IDC_BROWSELIST, &QueueFrame::handleBrowseList, qii, false) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); } @@ -1044,7 +1033,7 @@ void QueueFrame::addPMMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) { unsigned int pos = parent->getCount(); - WidgetMenuPtr menu = parent->appendPopup(TSTRING(SEND_PRIVATE_MESSAGE)); + WidgetMenuPtr menu = parent->appendPopup(T_("Send private message")); if(addUsers(menu, IDC_PM, &QueueFrame::handlePM, qii, false) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); } @@ -1052,9 +1041,9 @@ void QueueFrame::addReaddMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) { unsigned int pos = parent->getCount(); - WidgetMenuPtr menu = parent->appendPopup(TSTRING(READD_SOURCE)); + WidgetMenuPtr menu = parent->appendPopup(T_("Re-add source")); - menu->appendItem(IDC_READD, TSTRING(ALL), std::tr1::bind(&QueueFrame::handleReadd, this, UserPtr())); + menu->appendItem(IDC_READD, T_("All"), std::tr1::bind(&QueueFrame::handleReadd, this, UserPtr())); menu->appendSeparatorItem(); if(addUsers(menu, IDC_READD + 1, &QueueFrame::handleReadd, qii, true) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); @@ -1063,8 +1052,8 @@ void QueueFrame::addRemoveMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) { unsigned int pos = parent->getCount(); - WidgetMenuPtr menu = parent->appendPopup(TSTRING(REMOVE_SOURCE)); - menu->appendItem(IDC_REMOVE_SOURCE, TSTRING(ALL), std::tr1::bind(&QueueFrame::handleRemoveSource, this, UserPtr())); + WidgetMenuPtr menu = parent->appendPopup(T_("Remove source")); + menu->appendItem(IDC_REMOVE_SOURCE, T_("All"), std::tr1::bind(&QueueFrame::handleRemoveSource, this, UserPtr())); menu->appendSeparatorItem(); if(addUsers(menu, IDC_REMOVE_SOURCE + 1, &QueueFrame::handleRemoveSource, qii, true) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); @@ -1073,7 +1062,7 @@ void QueueFrame::addRemoveAllMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) { unsigned int pos = parent->getCount(); - WidgetMenuPtr menu = parent->appendPopup(TSTRING(REMOVE_FROM_ALL)); + WidgetMenuPtr menu = parent->appendPopup(T_("Remove user from queue")); if(addUsers(menu, IDC_REMOVE_SOURCES, &QueueFrame::handleRemoveSources, qii, true) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); } Modified: dcplusplus/trunk/win32/SearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SearchFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) +++ dcplusplus/trunk/win32/SearchFrame.cpp 2008-01-17 21:48:59 UTC (rev 966) @@ -83,7 +83,7 @@ } SearchFrame::SearchFrame(SmartWin::WidgetTabView* mdiParent, const tstring& initialString_, LONGLONG initialSize_, SearchManager::SizeModes initialMode_, SearchManager::TypeModes initialType_) : - BaseType(mdiParent, TSTRING(SEARCH), SmartWin::IconPtr(new SmartWin::Icon(IDR_SEARCH))), + BaseType(mdiParent, T_("Search"), SmartWin::IconPtr(new SmartWin::Icon(IDR_SEARCH))), searchLabel(0), searchBox(0), purge(0), @@ -114,19 +114,19 @@ cs.exStyle = WS_EX_TRANSPARENT; searchLabel = createStatic(cs); - searchLabel->setText(TSTRING(SEARCH_FOR)); + searchLabel->setText(T_("Search for")); sizeLabel = createStatic(cs); - sizeLabel->setText(TSTRING(SIZE)); + sizeLabel->setText(T_("Size")); typeLabel = createStatic(cs); - typeLabel->setText(TSTRING(FILE_TYPE)); + typeLabel->setText(T_("File type")); optionLabel = createStatic(); - optionLabel->setText(TSTRING(SEARCH_OPTIONS)); + optionLabel->setText(T_("Search options")); hubsLabel = createStatic(); - hubsLabel->setText(TSTRING(HUBS)); + hubsLabel->setText(T_("Hubs")); } @@ -143,7 +143,7 @@ { WidgetButton::Seed cs = WinUtil::Seeds::button; cs.style |= BS_DEFPUSHBUTTON; - cs.caption = TSTRING(SEARCH); + cs.caption = T_("Search"); doSearch = createButton(cs); doSearch->onClicked(std::tr1::bind(&SearchFrame::runSearch, this)); @@ -153,9 +153,9 @@ mode = createComboBox(WinUtil::Seeds::comboBoxStatic); addWidget(mode); - mode->addValue(TSTRING(NORMAL)); - mode->addValue(TSTRING(AT_LEAST)); - mode->addValue(TSTRING(AT_MOST)); + mode->addValue(T_("Normal")); + mode->addValue(T_("At least")); + mode->addValue(T_("At most")); } { @@ -169,10 +169,10 @@ sizeMode = createComboBox(WinUtil::Seeds::comboBoxStatic); addWidget(sizeMode); - sizeMode->addValue(TSTRING(B)); - sizeMode->addValue(TSTRING(KiB)); - sizeMode->addValue(TSTRING(MiB)); - sizeMode->addValue(TSTRING(GiB)); + sizeMode->addValue(T_("B")); + sizeMode->addValue(T_("KiB")); + sizeMode->addValue(T_("MiB")); + sizeMode->addValue(T_("GiB")); sizeMode->setSelectedIndex((initialSize == 0) ? 2 : 0); } @@ -180,19 +180,19 @@ fileType = createComboBox(WinUtil::Seeds::comboBoxStatic); addWidget(fileType); - fileType->addValue(TSTRING(ANY)); - fileType->addValue(TSTRING(AUDIO)); - fileType->addValue(TSTRING(COMPRESSED)); - fileType->addValue(TSTRING(DOCUMENT)); - fileType->addValue(TSTRING(EXECUTABLE)); - fileType->addValue(TSTRING(PICTURE)); - fileType->addValue(TSTRING(VIDEO)); - fileType->addValue(TSTRING(DIRECTORY)); - fileType->addValue(_T("TTH")); + fileType->addValue(T_("Any")); + fileType->addValue(T_("Audio")); + fileType->addValue(T_("Compressed")); + fileType->addValue(T_("Document")); + fileType->addValue(T_("Executable")); + fileType->addValue(T_("Picture")); + fileType->addValue(T_("Video")); + fileType->addValue(T_("Directory")); + fileType->addValue(T_("TTH")); } { - WidgetCheckBox::Seed cs(TSTRING(ONLY_FREE_SLOTS)); + WidgetCheckBox::Seed cs(T_("Only users with free slots")); slots = createCheckBox(cs); slots->setChecked(onlyFree); @@ -214,7 +214,7 @@ hubs->onRaw(std::tr1::bind(&SearchFrame::handleHubItemChanged, this, _1, _2), SmartWin::Message(WM_NOTIFY, LVN_ITEMCHANGED)); - hubs->insert(new HubInfo(Util::emptyStringT, TSTRING(ONLY_WHERE_OP), false)); + hubs->insert(new HubInfo(Util::emptyStringT, T_("Only where I'm op"), false)); hubs->setChecked(0, false); @@ -238,7 +238,7 @@ { WidgetButton::Seed cs = WinUtil::Seeds::button; - cs.caption = TSTRING(PURGE); + cs.caption = T_("Purge"); purge = createButton(cs); purge->onClicked(std::tr1::bind(&SearchFrame::handlePurgeClicked, this)); @@ -528,7 +528,7 @@ } else { columns[COLUMN_FILENAME] = Text::toT(sr->getFileName()); columns[COLUMN_PATH] = Text::toT(sr->getFile()); - columns[COLUMN_TYPE] = TSTRING(DIRECTORY); + columns[COLUMN_TYPE] = T_("Directory"); if(sr->getSize() > 0) { columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(sr->getSize())); columns[COLUMN_EXACT_SIZE] = Text::toT(Util::formatExactSize(sr->getSize())); @@ -770,15 +770,15 @@ StringPairList favoriteDirs = FavoriteManager::getInstance()->getFavoriteDirs(); SearchInfo::CheckTTH checkTTH = results->forEachSelectedT(SearchInfo::CheckTTH()); - menu->appendItem(IDC_DOWNLOAD, TSTRING(DOWNLOAD), std::tr1::bind(&SearchFrame::handleDownload, this)); + menu->appendItem(IDC_DOWNLOAD, T_("Download"), std::tr1::bind(&SearchFrame::handleDownload, this)); addTargetMenu(menu, favoriteDirs, checkTTH); - menu->appendItem(IDC_DOWNLOADDIR, TSTRING(DOWNLOAD_WHOLE_DIR), std::tr1::bind(&SearchFrame::handleDownloadDir, this)); + menu->appendItem(IDC_DOWNLOADDIR, T_("Download whole directory"), std::tr1::bind(&SearchFrame::handleDownloadDir, this)); addTargetDirMenu(menu, favoriteDirs); - menu->appendItem(IDC_VIEW_AS_TEXT, TSTRING(VIEW_AS_TEXT), std::tr1::bind(&SearchFrame::handleViewAsText, this)); + menu->appendItem(IDC_VIEW_AS_TEXT, T_("View as text"), std::tr1::bind(&SearchFrame::handleViewAsText, this)); menu->appendSeparatorItem(); - menu->appendItem(IDC_SEARCH_ALTERNATES, TSTRING(SEARCH_FOR_ALTERNATES), std::tr1::bind(&SearchFrame::handleSearchAlternates, this)); - menu->appendItem(IDC_BITZI_LOOKUP, TSTRING(LOOKUP_AT_BITZI), std::tr1::bind(&SearchFrame::handleBitziLookup, this)); - menu->appendItem(IDC_COPY_MAGNET, TSTRING(COPY_MAGNET), std::tr1::bind(&SearchFrame::handleCopyMagnet, this)); + m... [truncated message content] |
From: <arn...@us...> - 2008-01-15 13:54:49
|
Revision: 965 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=965&view=rev Author: arnetheduck Date: 2008-01-15 05:54:45 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Some translations, rework bloom filter implementation Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/HashBloom.cpp dcplusplus/trunk/dcpp/HashBloom.h dcplusplus/trunk/dcpp/HashManager.cpp dcplusplus/trunk/dcpp/HashValue.h dcplusplus/trunk/dcpp/MerkleTree.h dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/dcpp/ShareManager.h dcplusplus/trunk/dcpp/TigerHash.h dcplusplus/trunk/win32/ADLSProperties.cpp dcplusplus/trunk/win32/ADLSearchFrame.cpp dcplusplus/trunk/win32/CommandDlg.cpp dcplusplus/trunk/win32/DirectoryListingFrame.cpp dcplusplus/trunk/win32/DownloadsFrame.cpp dcplusplus/trunk/win32/FavHubProperties.cpp dcplusplus/trunk/win32/FavoriteDirsPage.cpp dcplusplus/trunk/win32/FinishedFrameBase.h dcplusplus/trunk/win32/HashProgressDlg.cpp dcplusplus/trunk/win32/HubListsDlg.cpp dcplusplus/trunk/win32/QueueFrame.cpp dcplusplus/trunk/win32/SearchFrame.cpp dcplusplus/trunk/win32/SpyFrame.cpp dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/UCPage.cpp dcplusplus/trunk/win32/UsersFrame.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -484,26 +484,30 @@ return; } const string& type = c.getParam(0); - string tmp; - if(type == "blom" && c.getParam("BK", 4, tmp)) { + string sk, sh; + if(type == "blom" && c.getParam("BK", 4, sk) && c.getParam("BH", 4, sh)) { ByteVector v; size_t m = Util::toUInt32(c.getParam(3)) * 8; - size_t k = Util::toUInt32(tmp); + size_t k = Util::toUInt32(sk); + size_t h = Util::toUInt32(sh); if(k > 8 || k < 1) { send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_TRANSFER_GENERIC, "Unsupported k")); return; } - + if(h > 64 || h < 1) { + send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_TRANSFER_GENERIC, "Unsupported h")); + return; + } size_t n = ShareManager::getInstance()->getSharedFiles(); // Ideal size for m is n * k / ln(2), but we allow some slack - if(m > (5 * n * k / log(2))) { + if(m > (5 * n * k / log(2)) || m > (1 << h)) { send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_TRANSFER_GENERIC, "Unsupported m")); return; } - ShareManager::getInstance()->getBloom(v, k, m); + ShareManager::getInstance()->getBloom(v, k, m, h); AdcCommand cmd(AdcCommand::CMD_SND, AdcCommand::TYPE_HUB); cmd.addParam(c.getParam(0)); cmd.addParam(c.getParam(1)); @@ -618,7 +622,7 @@ } th.update(pwd.data(), pwd.length()); th.update(buf, saltBytes); - send(AdcCommand(AdcCommand::CMD_PAS, AdcCommand::TYPE_HUB).addParam(Encoder::toBase32(th.finalize(), TigerHash::HASH_SIZE))); + send(AdcCommand(AdcCommand::CMD_PAS, AdcCommand::TYPE_HUB).addParam(Encoder::toBase32(th.finalize(), TigerHash::BYTES))); salt.clear(); } } Modified: dcplusplus/trunk/dcpp/HashBloom.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashBloom.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/HashBloom.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -5,8 +5,8 @@ namespace dcpp { -size_t HashBloom::get_k(size_t n) { - for(size_t k = TTHValue::SIZE/3; k > 1; --k) { +size_t HashBloom::get_k(size_t n, size_t h) { + for(size_t k = TTHValue::BITS/h; k > 1; --k) { uint64_t m = get_m(n, k); if(m >> 24 == 0) { return k; @@ -17,7 +17,8 @@ uint64_t HashBloom::get_m(size_t n, size_t k) { uint64_t m = (static_cast<uint64_t>(ceil(static_cast<double>(n) * k / log(2.)))); - return ((m / 8) + 1) * 8; + // 64-bit boundary as per spec + return ((m + 63 )/ 64) * 64; } void HashBloom::add(const TTHValue& tth) { @@ -42,19 +43,29 @@ bloom.push_back(v); } -void HashBloom::reset(size_t k_, size_t m) { +void HashBloom::reset(size_t k_, size_t m, size_t h_) { bloom.resize(m); k = k_; + h = h_; } size_t HashBloom::pos(const TTHValue& tth, size_t n) const { - uint32_t x = 0; - for(size_t i = n*3; i < TTHValue::SIZE; i += 3*k) { - x ^= static_cast<uint32_t>(tth.data[i]) << 2*8; - x ^= static_cast<uint32_t>(tth.data[i+1]) << 8; - x ^= static_cast<uint32_t>(tth.data[i+2]); + uint64_t x = 0; + + size_t start = n * h; + if((n+1)*h > TTHValue::BITS) { + return 0; } + for(size_t i = 0; i < h; ++i) { + size_t bit = start + i; + size_t byte = bit / 8; + size_t pos = bit % 8; + + if(tth.data[byte] & (1 << pos)) { + x |= (1 << i); + } + } return x % bloom.size(); } Modified: dcplusplus/trunk/dcpp/HashBloom.h =================================================================== --- dcplusplus/trunk/dcpp/HashBloom.h 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/HashBloom.h 2008-01-15 13:54:45 UTC (rev 965) @@ -16,14 +16,16 @@ */ class HashBloom { public: - /** Return the largest k such that get_m returns a value smaller than 2^(TTHValue::SIZE/k) */ - static size_t get_k(size_t n); + HashBloom() : k(0), h(0) { } + + /** Return a suitable value for k based on n */ + static size_t get_k(size_t n, size_t h); /** Optimal number of bits to allocate for n elements when using k hashes */ static uint64_t get_m(size_t n, size_t k); void add(const TTHValue& tth); bool match(const TTHValue& tth) const; - void reset(size_t k, size_t m); + void reset(size_t k, size_t m, size_t h); void push_back(bool v); void copy_to(ByteVector& v) const; @@ -33,6 +35,7 @@ std::vector<bool> bloom; size_t k; + size_t h; }; } Modified: dcplusplus/trunk/dcpp/HashManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashManager.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/HashManager.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -133,13 +133,13 @@ // Check if we should grow the file, we grow by a meg at a time... int64_t datsz = f.getSize(); - if((pos + (int64_t)(tt.getLeaves().size() * TTHValue::SIZE)) >= datsz) { + if((pos + (int64_t)(tt.getLeaves().size() * TTHValue::BYTES)) >= datsz) { f.setPos(datsz + 1024*1024); f.setEOF(); } f.setPos(pos); dcassert(tt.getLeaves().size() > 1); - f.write(tt.getLeaves()[0].data, (tt.getLeaves().size() * TTHValue::SIZE)); + f.write(tt.getLeaves()[0].data, (tt.getLeaves().size() * TTHValue::BYTES)); int64_t p2 = f.getPos(); f.setPos(0); f.write(&p2, sizeof(p2)); @@ -153,7 +153,7 @@ } try { f.setPos(ti.getIndex()); - size_t datalen = TigerTree::calcBlocks(ti.getSize(), ti.getBlockSize()) * TTHValue::SIZE; + size_t datalen = TigerTree::calcBlocks(ti.getSize(), ti.getBlockSize()) * TTHValue::BYTES; AutoArray<uint8_t> buf(datalen); f.read((uint8_t*)buf, datalen); tt = TigerTree(ti.getSize(), ti.getBlockSize(), buf); Modified: dcplusplus/trunk/dcpp/HashValue.h =================================================================== --- dcplusplus/trunk/dcpp/HashValue.h 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/HashValue.h 2008-01-15 13:54:45 UTC (rev 965) @@ -26,21 +26,22 @@ template<class Hasher> struct HashValue : FastAlloc<HashValue<Hasher> >{ - static const size_t SIZE = Hasher::HASH_SIZE; + static const size_t BITS = Hasher::BITS; + static const size_t BYTES = Hasher::BYTES; HashValue() { } - explicit HashValue(uint8_t* aData) { memcpy(data, aData, SIZE); } - explicit HashValue(const std::string& base32) { Encoder::fromBase32(base32.c_str(), data, SIZE); } - HashValue(const HashValue& rhs) { memcpy(data, rhs.data, SIZE); } - HashValue& operator=(const HashValue& rhs) { memcpy(data, rhs.data, SIZE); return *this; } + explicit HashValue(uint8_t* aData) { memcpy(data, aData, BYTES); } + explicit HashValue(const std::string& base32) { Encoder::fromBase32(base32.c_str(), data, BYTES); } + HashValue(const HashValue& rhs) { memcpy(data, rhs.data, BYTES); } + HashValue& operator=(const HashValue& rhs) { memcpy(data, rhs.data, BYTES); return *this; } bool operator!=(const HashValue& rhs) const { return !(*this == rhs); } - bool operator==(const HashValue& rhs) const { return memcmp(data, rhs.data, SIZE) == 0; } - bool operator<(const HashValue& rhs) const { return memcmp(data, rhs.data, SIZE) < 0; } + bool operator==(const HashValue& rhs) const { return memcmp(data, rhs.data, BYTES) == 0; } + bool operator<(const HashValue& rhs) const { return memcmp(data, rhs.data, BYTES) < 0; } - std::string toBase32() const { return Encoder::toBase32(data, SIZE); } - std::string& toBase32(std::string& tmp) const { return Encoder::toBase32(data, SIZE, tmp); } + std::string toBase32() const { return Encoder::toBase32(data, BYTES); } + std::string& toBase32(std::string& tmp) const { return Encoder::toBase32(data, BYTES, tmp); } - uint8_t data[SIZE]; + uint8_t data[BYTES]; }; } // namespace dcpp Modified: dcplusplus/trunk/dcpp/MerkleTree.h =================================================================== --- dcplusplus/trunk/dcpp/MerkleTree.h 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/MerkleTree.h 2008-01-15 13:54:45 UTC (rev 965) @@ -37,8 +37,9 @@ template<class Hasher, size_t baseBlockSize = 1024> class MerkleTree { public: - enum { HASH_SIZE = Hasher::HASH_SIZE }; - enum { BASE_BLOCK_SIZE = baseBlockSize }; + static const size_t BITS = Hasher::BITS; + static const size_t BYTES = Hasher::BYTES; + static const size_t BASE_BLOCK_SIZE = baseBlockSize; typedef HashValue<Hasher> MerkleValue; typedef vector<MerkleValue> MerkleList; @@ -57,7 +58,7 @@ { size_t n = calcBlocks(aFileSize, aBlockSize); for(size_t i = 0; i < n; i++) - leaves.push_back(MerkleValue(aData + i * Hasher::HASH_SIZE)); + leaves.push_back(MerkleValue(aData + i * Hasher::BYTES)); calcRoot(); } @@ -139,7 +140,7 @@ void setFileSize(int64_t aSize) { fileSize = aSize; } bool verifyRoot(const uint8_t* aRoot) { - return memcmp(aRoot, getRoot().data(), HASH_SIZE) == 0; + return memcmp(aRoot, getRoot().data(), BYTES) == 0; } void calcRoot() { @@ -147,10 +148,10 @@ } ByteVector getLeafData() { - ByteVector buf(getLeaves().size() * HASH_SIZE); + ByteVector buf(getLeaves().size() * BYTES); uint8_t* p = &buf[0]; for(size_t i = 0; i < getLeaves().size(); ++i) { - memcpy(p + i * HASH_SIZE, &getLeaves()[i], HASH_SIZE); + memcpy(p + i * BYTES, &getLeaves()[i], BYTES); } return buf; } @@ -186,8 +187,8 @@ uint8_t one = 1; Hasher h; h.update(&one, 1); - h.update(a.data, MerkleValue::SIZE); - h.update(b.data, MerkleValue::SIZE); + h.update(a.data, MerkleValue::BYTES); + h.update(b.data, MerkleValue::BYTES); return MerkleValue(h.finalize()); } Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -714,15 +714,15 @@ uint8_t* b = (uint8_t*)xbuf; while(pos < len) { size_t left = len - pos; - if(bufPos == 0 && left >= TigerTree::HASH_SIZE) { + if(bufPos == 0 && left >= TigerTree::BYTES) { tree.getLeaves().push_back(TTHValue(b + pos)); - pos += TigerTree::HASH_SIZE; + pos += TigerTree::BYTES; } else { - size_t bytes = min(TigerTree::HASH_SIZE - bufPos, left); + size_t bytes = min(TigerTree::BYTES - bufPos, left); memcpy(buf + bufPos, b + pos, bytes); bufPos += bytes; pos += bytes; - if(bufPos == TigerTree::HASH_SIZE) { + if(bufPos == TigerTree::BYTES) { tree.getLeaves().push_back(TTHValue(buf)); bufPos = 0; } @@ -736,7 +736,7 @@ } private: TigerTree& tree; - uint8_t buf[TigerTree::HASH_SIZE]; + uint8_t buf[TigerTree::BYTES]; size_t bufPos; }; Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -832,12 +832,12 @@ return 0; } -void ShareManager::getBloom(ByteVector& v, size_t k, size_t m) const { - dcdebug("Creating bloom filter, k=%u, m=%u\n", k, m); +void ShareManager::getBloom(ByteVector& v, size_t k, size_t m, size_t h) const { + dcdebug("Creating bloom filter, k=%u, m=%u, h=%u\n", k, m, h); Lock l(cs); HashBloom bloom; - bloom.reset(k, m); + bloom.reset(k, m, h); for(HashFileMap::const_iterator i = tthIndex.begin(); i != tthIndex.end(); ++i) { bloom.add(i->first); } Modified: dcplusplus/trunk/dcpp/ShareManager.h =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.h 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/ShareManager.h 2008-01-15 13:54:45 UTC (rev 965) @@ -81,7 +81,7 @@ string getShareSizeString() const { return Util::toString(getShareSize()); } string getShareSizeString(const string& aDir) const { return Util::toString(getShareSize(aDir)); } - void getBloom(ByteVector& v, size_t k, size_t m) const; + void getBloom(ByteVector& v, size_t k, size_t m, size_t h) const; SearchManager::TypeModes getType(const string& fileName) const throw(); Modified: dcplusplus/trunk/dcpp/TigerHash.h =================================================================== --- dcplusplus/trunk/dcpp/TigerHash.h 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/dcpp/TigerHash.h 2008-01-15 13:54:45 UTC (rev 965) @@ -24,7 +24,8 @@ class TigerHash { public: /** Hash size in bytes */ - enum { HASH_SIZE = 24 }; + static const size_t BITS = 192; + static const size_t BYTES = BITS / 8; TigerHash() : pos(0) { res[0]=_ULL(0x0123456789ABCDEF); Modified: dcplusplus/trunk/win32/ADLSProperties.cpp =================================================================== --- dcplusplus/trunk/win32/ADLSProperties.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/ADLSProperties.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -46,7 +46,7 @@ bool ADLSProperties::handleInitDialog() { // Translate dialog - setText(TSTRING(ADLS_PROPERTIES)); + setText(T_("ADLSearch Properties")); ::SetDlgItemText(handle(), IDC_ADLSP_SEARCH, CTSTRING(ADLS_SEARCH_STRING)); ::SetDlgItemText(handle(), IDC_ADLSP_TYPE, CTSTRING(ADLS_TYPE)); ::SetDlgItemText(handle(), IDC_ADLSP_SIZE_MIN, CTSTRING(ADLS_SIZE_MIN)); @@ -59,9 +59,9 @@ searchString->setFocus(); searchType = attachComboBox(IDC_SOURCE_TYPE); - searchType->addValue(TSTRING(FILENAME)); - searchType->addValue(TSTRING(DIRECTORY)); - searchType->addValue(TSTRING(ADLS_FULL_PATH)); + searchType->addValue(T_("Filename")); + searchType->addValue(T_("Directory")); + searchType->addValue(T_("Full Path")); searchType->setSelectedIndex(search->sourceType); minSize = attachTextBox(IDC_MIN_FILE_SIZE); @@ -71,21 +71,21 @@ maxSize->setText((search->maxFileSize > 0) ? Text::toT(Util::toString(search->maxFileSize)) : Util::emptyStringT); sizeType = attachComboBox(IDC_SIZE_TYPE); - sizeType->addValue(TSTRING(B)); - sizeType->addValue(TSTRING(KiB)); - sizeType->addValue(TSTRING(MiB)); - sizeType->addValue(TSTRING(GiB)); + sizeType->addValue(T_("B")); + sizeType->addValue(T_("KiB")); + sizeType->addValue(T_("MiB")); + sizeType->addValue(T_("GiB")); sizeType->setSelectedIndex(search->typeFileSize); destDir = attachTextBox(IDC_DEST_DIR); destDir->setText(Text::toT(search->destDir)); active = attachCheckBox(IDC_IS_ACTIVE); - active->setText(TSTRING(ADLS_ENABLED)); + active->setText(T_("Enabled")); active->setChecked(search->isActive); autoQueue = attachCheckBox(IDC_AUTOQUEUE); - autoQueue->setText(TSTRING(ADLS_DOWNLOAD)); + autoQueue->setText(T_("Download Matches")); autoQueue->setChecked(search->isAutoQueue); WidgetButtonPtr button = attachButton(IDOK); Modified: dcplusplus/trunk/win32/ADLSearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -33,7 +33,7 @@ N_("Source Type"), N_("Destination Directory"), N_("Min Size"), - N_("Max Size"), + N_("Max Size") }; ADLSearchFrame::ADLSearchFrame(SmartWin::WidgetTabView* mdiParent) : Modified: dcplusplus/trunk/win32/CommandDlg.cpp =================================================================== --- dcplusplus/trunk/win32/CommandDlg.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/CommandDlg.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -61,7 +61,7 @@ bool CommandDlg::handleInitDialog() { // Translate - setText(TSTRING(USER_CMD_WINDOW)); + setText(T_("Create / Modify Command")); ::SetDlgItemText(handle(), IDC_SETTINGS_TYPE, CTSTRING(USER_CMD_TYPE)); ::SetDlgItemText(handle(), IDC_SETTINGS_CONTEXT, CTSTRING(USER_CMD_CONTEXT)); ::SetDlgItemText(handle(), IDC_SETTINGS_PARAMETERS, CTSTRING(USER_CMD_PARAMETERS)); @@ -72,32 +72,32 @@ ::SetDlgItemText(handle(), IDC_USER_CMD_PREVIEW, CTSTRING(USER_CMD_PREVIEW)); separator = attachRadioButton(IDC_SETTINGS_SEPARATOR); - separator->setText(TSTRING(SEPARATOR)); + separator->setText(T_("Separator")); separator->onClicked(std::tr1::bind(&CommandDlg::handleTypeChanged, this)); raw = attachRadioButton(IDC_SETTINGS_RAW); - raw->setText(TSTRING(USER_CMD_RAW)); + raw->setText(T_("Raw")); raw->onClicked(std::tr1::bind(&CommandDlg::handleTypeChanged, this)); chat = attachRadioButton(IDC_SETTINGS_CHAT); - chat->setText(TSTRING(USER_CMD_CHAT)); + chat->setText(T_("Chat")); chat->onClicked(std::tr1::bind(&CommandDlg::handleTypeChanged, this)); PM = attachRadioButton(IDC_SETTINGS_PM); - PM->setText(TSTRING(USER_CMD_PM)); + PM->setText(T_("PM")); PM->onClicked(std::tr1::bind(&CommandDlg::handleTypeChanged, this)); hubMenu = attachCheckBox(IDC_SETTINGS_HUB_MENU); - hubMenu->setText(TSTRING(USER_CMD_HUB_MENU)); + hubMenu->setText(T_("Hub Menu")); userMenu = attachCheckBox(IDC_SETTINGS_USER_MENU); - userMenu->setText(TSTRING(USER_CMD_USER_MENU)); + userMenu->setText(T_("User Menu")); searchMenu = attachCheckBox(IDC_SETTINGS_SEARCH_MENU); - searchMenu->setText(TSTRING(USER_CMD_SEARCH_MENU)); + searchMenu->setText(T_("Search Menu")); fileListMenu = attachCheckBox(IDC_SETTINGS_FILELIST_MENU); - fileListMenu->setText(TSTRING(USER_CMD_FILELIST_MENU)); + fileListMenu->setText(T_( "Filelist Menu")); nameBox = attachTextBox(IDC_NAME); @@ -110,12 +110,12 @@ nick->onTextChanged(std::tr1::bind(&CommandDlg::updateCommand, this)); once = attachCheckBox(IDC_SETTINGS_ONCE); - once->setText(TSTRING(USER_CMD_ONCE)); + once->setText(T_("Send once per nick")); result = attachTextBox(IDC_RESULT); openHelp = attachCheckBox(IDC_USER_CMD_OPEN_HELP); - openHelp->setText(TSTRING(SETTINGS_OPEN_USER_CMD_HELP)); + openHelp->setText(T_("Always open help file with this dialog")); bool bOpenHelp = BOOLSETTING(OPEN_USER_CMD_HELP); openHelp->setChecked(bOpenHelp); Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -37,7 +37,13 @@ int DirectoryListingFrame::columnIndexes[] = { COLUMN_FILENAME, COLUMN_TYPE, COLUMN_EXACTSIZE, COLUMN_SIZE, COLUMN_TTH }; int DirectoryListingFrame::columnSizes[] = { 300, 60, 100, 100, 200 }; -static ResourceManager::Strings columnNames[] = { ResourceManager::FILE, ResourceManager::TYPE, ResourceManager::EXACT_SIZE, ResourceManager::SIZE, ResourceManager::TTH_ROOT }; +static const char* columnNames[] = { + N_("File"), + N_("Type"), + N_("Exact size"), + N_("Size"), + N_("TTH Root") +}; DirectoryListingFrame::UserMap DirectoryListingFrame::lists; @@ -137,7 +143,7 @@ paned->setSecond(files); files->setSmallImageList(WinUtil::fileImages); - files->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + files->createColumns(WinUtil::getStrings(columnNames)); files->setColumnOrder(WinUtil::splitTokens(SETTING(QUEUEFRAME_ORDER), columnIndexes)); files->setColumnWidths(WinUtil::splitTokens(SETTING(QUEUEFRAME_WIDTHS), columnSizes)); files->setColor(WinUtil::textColor, WinUtil::bgColor); @@ -152,19 +158,19 @@ { WidgetButton::Seed cs = WinUtil::Seeds::button; - cs.caption = TSTRING(FIND); + cs.caption = T_("Find"); find = createButton(cs); find->onClicked(std::tr1::bind(&DirectoryListingFrame::handleFind, this)); - cs.caption = TSTRING(NEXT); + cs.caption = T_("Next"); findNext = createButton(cs); findNext->onClicked(std::tr1::bind(&DirectoryListingFrame::handleFindNext, this)); - cs.caption = TSTRING(MATCH_QUEUE); + cs.caption = T_("Match queue"); matchQueue = createButton(cs); matchQueue->onClicked(std::tr1::bind(&DirectoryListingFrame::handleMatchQueue, this)); - cs.caption = TSTRING(FILE_LIST_DIFF); + cs.caption = T_("Subtract list"); listDiff = createButton(cs); listDiff->onClicked(std::tr1::bind(&DirectoryListingFrame::handleListDiff, this)); } @@ -172,12 +178,11 @@ initStatus(); // This will set the widths correctly - setStatus(STATUS_FILE_LIST_DIFF, TSTRING(FILE_LIST_DIFF)); + setStatus(STATUS_FILE_LIST_DIFF, T_("Subtract list")); + setStatus(STATUS_MATCH_QUEUE, T_("Match queue")); + setStatus(STATUS_FIND, T_("Find")); + setStatus(STATUS_NEXT, T_("Next")); - setStatus(STATUS_MATCH_QUEUE, TSTRING(MATCH_QUEUE)); - setStatus(STATUS_FIND, TSTRING(FIND)); - setStatus(STATUS_NEXT, TSTRING(NEXT)); - files->onRaw(std::tr1::bind(&DirectoryListingFrame::handleXButtonUp, this, _1, _2), SmartWin::Message(WM_XBUTTONUP)); dirs->onRaw(std::tr1::bind(&DirectoryListingFrame::handleXButtonUp, this, _1, _2), SmartWin::Message(WM_XBUTTONUP)); string nick = ClientManager::getInstance()->getNicks(dl->getUser()->getCID())[0]; @@ -304,23 +309,23 @@ DirectoryListingFrame::WidgetMenuPtr DirectoryListingFrame::makeSingleMenu(ItemInfo* ii) { WidgetMenuPtr menu = createMenu(true); - menu->appendItem(IDC_DOWNLOAD, TSTRING(DOWNLOAD), std::tr1::bind(&DirectoryListingFrame::handleDownload, this)); + menu->appendItem(IDC_DOWNLOAD, T_("Download"), std::tr1::bind(&DirectoryListingFrame::handleDownload, this)); addTargets(menu, ii); if(ii->type == ItemInfo::FILE) { - menu->appendItem(IDC_VIEW_AS_TEXT, TSTRING(VIEW_AS_TEXT), std::tr1::bind(&DirectoryListingFrame::handleViewAsText, this)); + menu->appendItem(IDC_VIEW_AS_TEXT, T_("View as text"), std::tr1::bind(&DirectoryListingFrame::handleViewAsText, this)); menu->appendSeparatorItem(); - menu->appendItem(IDC_SEARCH_ALTERNATES, TSTRING(SEARCH_FOR_ALTERNATES), std::tr1::bind(&DirectoryListingFrame::handleSearchAlternates, this)); - menu->appendItem(IDC_BITZI_LOOKUP, TSTRING(LOOKUP_AT_BITZI), std::tr1::bind(&DirectoryListingFrame::handleLookupBitzi, this)); - menu->appendItem(IDC_COPY_MAGNET, TSTRING(COPY_MAGNET), std::tr1::bind(&DirectoryListingFrame::handleCopyMagnet, this)); + menu->appendItem(IDC_SEARCH_ALTERNATES, T_("Search for alternates"), std::tr1::bind(&DirectoryListingFrame::handleSearchAlternates, this)); + menu->appendItem(IDC_BITZI_LOOKUP, T_("Lookup TTH at Bitzi.com"), std::tr1::bind(&DirectoryListingFrame::handleLookupBitzi, this)); + menu->appendItem(IDC_COPY_MAGNET, T_("Copy magnet link to clipboard"), std::tr1::bind(&DirectoryListingFrame::handleCopyMagnet, this)); } if((ii->type == ItemInfo::FILE && ii->file->getAdls()) || (ii->type == ItemInfo::DIRECTORY && ii->dir->getAdls() && ii->dir->getParent() != dl->getRoot()) ) { menu->appendSeparatorItem(); - menu->appendItem(IDC_GO_TO_DIRECTORY, TSTRING(GO_TO_DIRECTORY), std::tr1::bind(&DirectoryListingFrame::handleGoToDirectory, this)); + menu->appendItem(IDC_GO_TO_DIRECTORY, T_("Go to directory"), std::tr1::bind(&DirectoryListingFrame::handleGoToDirectory, this)); } addUserCommands(menu); @@ -331,7 +336,7 @@ DirectoryListingFrame::WidgetMenuPtr DirectoryListingFrame::makeMultiMenu() { WidgetMenuPtr menu = createMenu(true); - menu->appendItem(IDC_DOWNLOAD, TSTRING(DOWNLOAD), std::tr1::bind(&DirectoryListingFrame::handleDownload, this)); + menu->appendItem(IDC_DOWNLOAD, T_("Download"), std::tr1::bind(&DirectoryListingFrame::handleDownload, this)); addTargets(menu); addUserCommands(menu); @@ -343,7 +348,7 @@ DirectoryListingFrame::WidgetMenuPtr DirectoryListingFrame::makeDirMenu() { WidgetMenuPtr menu = createMenu(true); - menu->appendItem(IDC_DOWNLOAD, TSTRING(DOWNLOAD), std::tr1::bind(&DirectoryListingFrame::handleDownload, this)); + menu->appendItem(IDC_DOWNLOAD, T_("Download"), std::tr1::bind(&DirectoryListingFrame::handleDownload, this)); addTargets(menu); return menu; } @@ -353,7 +358,7 @@ } void DirectoryListingFrame::addTargets(const WidgetMenuPtr& parent, ItemInfo* ii) { - WidgetMenuPtr menu = parent->appendPopup(TSTRING(DOWNLOAD_TO)); + WidgetMenuPtr menu = parent->appendPopup(T_("Download to...")); StringPairList spl = FavoriteManager::getInstance()->getFavoriteDirs(); size_t i = 0; for(; i < spl.size(); ++i) { @@ -364,7 +369,7 @@ menu->appendSeparatorItem(); } - menu->appendItem(IDC_DOWNLOAD_BROWSE, TSTRING(BROWSE), std::tr1::bind(&DirectoryListingFrame::handleDownloadBrowse, this)); + menu->appendItem(IDC_DOWNLOAD_BROWSE, T_("Browse..."), std::tr1::bind(&DirectoryListingFrame::handleDownloadBrowse, this)); targets.clear(); @@ -709,12 +714,12 @@ if(dl->getUser()->isOnline()) { try { QueueManager::getInstance()->addPfs(dl->getUser(), dl->getPath(d)); - setStatus(STATUS_STATUS, TSTRING(DOWNLOADING_LIST)); + setStatus(STATUS_STATUS, T_("Downloading list...")); } catch(const QueueException& e) { setStatus(STATUS_STATUS, Text::toT(e.getError())); } } else { - setStatus(STATUS_STATUS, TSTRING(USER_OFFLINE)); + setStatus(STATUS_STATUS, T_("User offline")); } } } @@ -811,7 +816,7 @@ { if(!findNext) { // Prompt for substring to find - LineDlg dlg(this, TSTRING(SEARCH_FOR_FILE), TSTRING(ENTER_SEARCH_STRING)); + LineDlg dlg(this, T_("Search for file"), T_("Enter search string")); if(dlg.run() != IDOK) return; @@ -874,7 +879,7 @@ } } else { dirs->select(oldDir); - createMessageBox().show(TSTRING(NO_MATCHES), TSTRING(SEARCH_FOR_FILE)); + createMessageBox().show(T_("No matches"), T_("Search for file")); } } Modified: dcplusplus/trunk/win32/DownloadsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -31,8 +31,14 @@ int DownloadsFrame::columnIndexes[] = { COLUMN_FILE, COLUMN_PATH, COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, COLUMN_SIZE }; int DownloadsFrame::columnSizes[] = { 200, 300, 150, 200, 125, 100}; -static ResourceManager::Strings columnNames[] = { ResourceManager::FILENAME, ResourceManager::PATH, - ResourceManager::STATUS, ResourceManager::TIME_LEFT, ResourceManager::SPEED, ResourceManager::SIZE }; +static const char* columnNames[] = { + N_("Filename"), + N_("Path"), + N_("Status"), + N_("Time left"), + N_("Speed"), + N_("Size") +}; DownloadsFrame::DownloadsFrame(SmartWin::WidgetTabView* mdiParent) : BaseType(mdiParent, T_("Downloads")), @@ -43,7 +49,7 @@ downloads = SmartWin::WidgetCreator<WidgetDownloads>::create(this, WinUtil::Seeds::listView); addWidget(downloads); - downloads->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + downloads->createColumns(WinUtil::getStrings(columnNames)); downloads->setColumnOrder(WinUtil::splitTokens(SETTING(HUBFRAME_ORDER), columnIndexes)); downloads->setColumnWidths(WinUtil::splitTokens(SETTING(HUBFRAME_WIDTHS), columnSizes)); downloads->setSort(COLUMN_STATUS); Modified: dcplusplus/trunk/win32/FavHubProperties.cpp =================================================================== --- dcplusplus/trunk/win32/FavHubProperties.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/FavHubProperties.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -45,7 +45,7 @@ bool FavHubProperties::handleInitDialog() { // Translate dialog - setText(TSTRING(FAVORITE_HUB_PROPERTIES)); + setText(T_("Favorite Hub Properties")); ::SetDlgItemText(handle(), IDC_FH_HUB, CTSTRING(HUB)); ::SetDlgItemText(handle(), IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY)); ::SetDlgItemText(handle(), IDC_FH_NAME, CTSTRING(HUB_NAME)); @@ -117,7 +117,7 @@ void FavHubProperties::handleOKClicked() { tstring addressText = address->getText(); if(addressText.empty()) { - createMessageBox().show(TSTRING(INCOMPLETE_FAV_HUB), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONEXCLAMATION); + createMessageBox().show(T_("Hub address cannot be empty."), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONEXCLAMATION); return; } entry->setServer(Text::fromT(addressText)); Modified: dcplusplus/trunk/win32/FavoriteDirsPage.cpp =================================================================== --- dcplusplus/trunk/win32/FavoriteDirsPage.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/FavoriteDirsPage.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -45,8 +45,8 @@ directories->setListViewStyle(LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT); TStringList columns; - columns.push_back(TSTRING(FAVORITE_DIR_NAME)); - columns.push_back(TSTRING(DIRECTORY)); + columns.push_back(T_("Favorite name")); + columns.push_back(T_("Directory")); directories->createColumns(columns); directories->setColumnWidth(0, 100); directories->setColumnWidth(1, directories->getSize().x - 120); @@ -117,13 +117,13 @@ int i = -1; while((i = directories->getNext(i, LVNI_SELECTED)) != -1) { tstring old = directories->getText(i, 0); - LineDlg dlg(this, TSTRING(FAVORITE_DIR_NAME), TSTRING(FAVORITE_DIR_NAME_LONG), old); + LineDlg dlg(this, T_("Favorite name"), T_("Under what name you see the directory"), old); if(dlg.run() == IDOK) { tstring line = dlg.getLine(); if (FavoriteManager::getInstance()->renameFavoriteDir(Text::fromT(old), Text::fromT(line))) { directories->setText(i, 0, line); } else { - createMessageBox().show(TSTRING(DIRECTORY_ADD_ERROR), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); + createMessageBox().show(T_("Directory or directory name already exists"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); } } } @@ -147,7 +147,7 @@ if( path[ path.length() -1 ] != PATH_SEPARATOR ) path += PATH_SEPARATOR; - LineDlg dlg(this, TSTRING(FAVORITE_DIR_NAME), TSTRING(FAVORITE_DIR_NAME_LONG), Util::getLastDir(path)); + LineDlg dlg(this, T_("Favorite name"), T_("Under what name you see the directory"), Util::getLastDir(path)); if(dlg.run() == IDOK) { tstring line = dlg.getLine(); if (FavoriteManager::getInstance()->addFavoriteDir(Text::fromT(path), Text::fromT(line))) { @@ -156,7 +156,7 @@ row.push_back(path); directories->insert(row); } else { - createMessageBox().show(TSTRING(DIRECTORY_ADD_ERROR), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); + createMessageBox().show(T_("Directory or directory name already exists"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); } } } Modified: dcplusplus/trunk/win32/FinishedFrameBase.h =================================================================== --- dcplusplus/trunk/win32/FinishedFrameBase.h 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/FinishedFrameBase.h 2008-01-15 13:54:45 UTC (rev 965) @@ -140,7 +140,7 @@ columns[COLUMN_HUB] = Text::toT(entry->getHub()); columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(entry->getSize())); columns[COLUMN_SPEED] = Text::toT(Util::formatBytes(entry->getAvgSpeed()) + "/s"); - columns[COLUMN_CRC32] = entry->getCrc32Checked() ? TSTRING(YES_STR) : TSTRING(NO_STR); + columns[COLUMN_CRC32] = entry->getCrc32Checked() ? T_("Yes") : T_("No"); } FinishedItemPtr entry; @@ -220,12 +220,12 @@ shellMenu.SetPath(Text::utf8ToWide(path)); typename T::WidgetMenuPtr pShellMenu = this->createMenu(true); - pShellMenu->appendItem(IDC_VIEW_AS_TEXT, TSTRING(VIEW_AS_TEXT), std::tr1::bind(&ThisType::handleViewAsText, this)); - pShellMenu->appendItem(IDC_OPEN_FILE, TSTRING(OPEN), std::tr1::bind(&ThisType::handleOpenFile, this)); - pShellMenu->appendItem(IDC_OPEN_FOLDER, TSTRING(OPEN_FOLDER), std::tr1::bind(&ThisType::handleOpenFolder, this)); + pShellMenu->appendItem(IDC_VIEW_AS_TEXT, T_("View as text"), std::tr1::bind(&ThisType::handleViewAsText, this)); + pShellMenu->appendItem(IDC_OPEN_FILE, T_("Open"), std::tr1::bind(&ThisType::handleOpenFile, this)); + pShellMenu->appendItem(IDC_OPEN_FOLDER, T_("Open folder"), std::tr1::bind(&ThisType::handleOpenFolder, this)); pShellMenu->appendSeparatorItem(); pShellMenu->appendItem(IDC_REMOVE, TSTRING(REMOVE), std::tr1::bind(&ThisType::handleRemove, this)); - pShellMenu->appendItem(IDC_REMOVE_ALL, TSTRING(REMOVE_ALL), std::tr1::bind(&ThisType::handleRemoveAll, this)); + pShellMenu->appendItem(IDC_REMOVE_ALL, T_("Remove all"), std::tr1::bind(&ThisType::handleRemoveAll, this)); pShellMenu->appendSeparatorItem(); UINT idCommand = shellMenu.ShowContextMenu(pShellMenu, static_cast<T*>(this), pt); @@ -236,12 +236,12 @@ } typename T::WidgetMenuPtr contextMenu = this->createMenu(true); - contextMenu->appendItem(IDC_VIEW_AS_TEXT, TSTRING(VIEW_AS_TEXT), std::tr1::bind(&ThisType::handleViewAsText, this)); - contextMenu->appendItem(IDC_OPEN_FILE, TSTRING(OPEN), std::tr1::bind(&ThisType::handleOpenFile, this)); - contextMenu->appendItem(IDC_OPEN_FOLDER, TSTRING(OPEN_FOLDER), std::tr1::bind(&ThisType::handleOpenFolder, this)); + contextMenu->appendItem(IDC_VIEW_AS_TEXT, T_("View as text"), std::tr1::bind(&ThisType::handleViewAsText, this)); + contextMenu->appendItem(IDC_OPEN_FILE, T_("Open"), std::tr1::bind(&ThisType::handleOpenFile, this)); + contextMenu->appendItem(IDC_OPEN_FOLDER, T_("Open folder"), std::tr1::bind(&ThisType::handleOpenFolder, this)); contextMenu->appendSeparatorItem(); contextMenu->appendItem(IDC_REMOVE, TSTRING(REMOVE), std::tr1::bind(&ThisType::handleRemove, this)); - contextMenu->appendItem(IDC_REMOVE_ALL, TSTRING(REMOVE_ALL), std::tr1::bind(&ThisType::handleRemoveAll, this)); + contextMenu->appendItem(IDC_REMOVE_ALL, T_("Remove all"), std::tr1::bind(&ThisType::handleRemoveAll, this)); contextMenu->setDefaultItem(IDC_OPEN_FILE); contextMenu->trackPopupMenu(static_cast<T*>(this), pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; Modified: dcplusplus/trunk/win32/HashProgressDlg.cpp =================================================================== --- dcplusplus/trunk/win32/HashProgressDlg.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/HashProgressDlg.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -38,7 +38,7 @@ } bool HashProgressDlg::handleInitDialog() { - setText(TSTRING(HASH_PROGRESS)); + setText(T_("Creating file index...")); ::SetDlgItemText(handle(), IDC_HASH_INDEXING, CTSTRING(HASH_PROGRESS_TEXT)); ::SetDlgItemText(handle(), IDC_STATISTICS, CTSTRING(HASH_PROGRESS_STATS)); @@ -46,7 +46,7 @@ progress->setRange(0, 10000); WidgetButtonPtr ok = attachButton(IDOK); - ok->setText(TSTRING(HASH_PROGRESS_BACKGROUND)); + ok->setText(T_("Run in background")); ok->onClicked(std::tr1::bind(&HashProgressDlg::endDialog, this, IDOK)); string tmp; Modified: dcplusplus/trunk/win32/HubListsDlg.cpp =================================================================== --- dcplusplus/trunk/win32/HubListsDlg.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/HubListsDlg.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -41,7 +41,7 @@ } bool HubListsDlg::handleInitDialog() { - setText(TSTRING(CONFIGURED_HUB_LISTS)); + setText(T_("Configured Public Hub Lists")); editBox = attachTextBox(IDC_LIST_EDIT_BOX); @@ -61,23 +61,23 @@ hubLists->onKeyDown(std::tr1::bind(&HubListsDlg::handleKeyDown, this, _1)); WidgetButtonPtr button = attachButton(IDC_LIST_ADD); - button->setText(TSTRING(ADD)); + button->setText(T_("&Add")); button->onClicked(std::tr1::bind(&HubListsDlg::handleAddClicked, this)); button = attachButton(IDC_LIST_UP); - button->setText(TSTRING(MOVE_UP)); + button->setText(T_("Move &Up")); button->onClicked(std::tr1::bind(&HubListsDlg::handleMoveUpClicked, this)); button = attachButton(IDC_LIST_DOWN); - button->setText(TSTRING(MOVE_DOWN)); + button->setText(T_("Move &Down")); button->onClicked(std::tr1::bind(&HubListsDlg::handleMoveDownClicked, this)); button = attachButton(IDC_LIST_EDIT); - button->setText(TSTRING(EDIT_ACCEL)); + button->setText(T_("&Edit")); button->onClicked(std::tr1::bind(&HubListsDlg::handleEditClicked, this)); button = attachButton(IDC_LIST_REMOVE); - button->setText(TSTRING(REMOVE)); + button->setText(T_("&Remove")); button->onClicked(std::tr1::bind(&HubListsDlg::handleRemoveClicked, this)); attachButton(IDOK)->onClicked(std::tr1::bind(&HubListsDlg::handleOKClicked, this)); @@ -147,7 +147,7 @@ void HubListsDlg::handleEditClicked() { int i = -1; while((i = hubLists->getNext(i, LVNI_SELECTED)) != -1) { - LineDlg dlg(this, TSTRING(HUB_LIST), TSTRING(HUB_LIST_EDIT), hubLists->getText(i, 0)); + LineDlg dlg(this, T_("Hublist"), T_("Edit the hublist"), hubLists->getText(i, 0)); if(dlg.run() == IDOK) hubLists->setText(i, 0, dlg.getLine()); } Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -33,9 +33,20 @@ int QueueFrame::columnSizes[] = { 200, 300, 75, 110, 75, 200, 200, 75, 200, 100, 125, 75 }; -static ResourceManager::Strings columnNames[] = { ResourceManager::FILENAME, ResourceManager::STATUS, ResourceManager::SIZE, ResourceManager::DOWNLOADED, -ResourceManager::PRIORITY, ResourceManager::USERS, ResourceManager::PATH, ResourceManager::EXACT_SIZE, ResourceManager::ERRORS, -ResourceManager::ADDED, ResourceManager::TTH_ROOT, ResourceManager::TYPE }; +static const char* columnNames[] = { + N_("Filename"), + N_("Status"), + N_("Size"), + N_("Downloaded"), + N_("Priority"), + N_("Users"), + N_("Path"), + N_("Exact size"), + N_("Errors"), + N_("Added"), + N_("TTH Root"), + N_("Type") +}; #define FILE_LIST_NAME _T("File Lists") @@ -73,7 +84,7 @@ addWidget(files); files->setSmallImageList(WinUtil::fileImages); - files->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + files->createColumns(WinUtil::getStrings(columnNames)); files->setColumnOrder(WinUtil::splitTokens(SETTING(QUEUEFRAME_ORDER), columnIndexes)); files->setColumnWidths(WinUtil::splitTokens(SETTING(QUEUEFRAME_WIDTHS), columnSizes)); files->setColor(WinUtil::textColor, WinUtil::bgColor); Modified: dcplusplus/trunk/win32/SearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SearchFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/SearchFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -29,9 +29,20 @@ int SearchFrame::columnIndexes[] = { COLUMN_FILENAME, COLUMN_NICK, COLUMN_TYPE, COLUMN_SIZE, COLUMN_PATH, COLUMN_SLOTS, COLUMN_CONNECTION, COLUMN_HUB, COLUMN_EXACT_SIZE, COLUMN_IP, COLUMN_TTH, COLUMN_CID }; int SearchFrame::columnSizes[] = { 200, 100, 50, 80, 100, 40, 70, 150, 80, 100, 125, 125 }; -static ResourceManager::Strings columnNames[] = { ResourceManager::FILE, ResourceManager::USER, ResourceManager::TYPE, ResourceManager::SIZE, - ResourceManager::PATH, ResourceManager::SLOTS, ResourceManager::CONNECTION, - ResourceManager::HUB, ResourceManager::EXACT_SIZE, ResourceManager::IP_BARE, ResourceManager::TTH_ROOT, ResourceManager::CID }; +static const char* columnNames[] = { + N_("File"), + N_("User"), + N_("Type"), + N_("Size"), + N_("Path"), + N_("Slots"), + N_("Connection"), + N_("Hub"), + N_("Exact size"), + N_("IP"), + N_("TTH Root"), + N_("CID") +}; TStringList SearchFrame::lastSearches; @@ -213,7 +224,7 @@ results = SmartWin::WidgetCreator<WidgetResults>::create(this, WinUtil::Seeds::listView); addWidget(results); - results->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + results->createColumns(WinUtil::getStrings(columnNames)); results->setColumnOrder(WinUtil::splitTokens(SETTING(SEARCHFRAME_ORDER), columnIndexes)); results->setColumnWidths(WinUtil::splitTokens(SETTING(SEARCHFRAME_WIDTHS), columnSizes)); Modified: dcplusplus/trunk/win32/SpyFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SpyFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/SpyFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -31,7 +31,7 @@ static const char* columnNames[] = { N_("Search String"), N_("Count"), - N_("Time"), + N_("Time") }; SpyFrame::SpyFrame(SmartWin::WidgetTabView* mdiParent) : Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -37,9 +37,20 @@ int TransferView::columnIndexes[] = { COLUMN_USER, COLUMN_HUB, COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, COLUMN_FILE, COLUMN_SIZE, COLUMN_PATH, COLUMN_IP, COLUMN_RATIO, COLUMN_CID, COLUMN_CIPHER }; int TransferView::columnSizes[] = { 150, 100, 250, 75, 75, 175, 100, 200, 50, 75, 125, 125 }; -static ResourceManager::Strings columnNames[] = { ResourceManager::USER, ResourceManager::HUB, ResourceManager::STATUS, -ResourceManager::TIME_LEFT, ResourceManager::SPEED, ResourceManager::FILENAME, ResourceManager::SIZE, ResourceManager::PATH, -ResourceManager::IP_BARE, ResourceManager::RATIO, ResourceManager::CID, ResourceManager::CIPHER }; +static const char* columnNames[] = { + N_("User"), + N_("Hub"), + N_("Status"), + N_("Time left"), + N_("Speed"), + N_("Filename"), + N_("Size"), + N_("Path"), + N_("IP"), + N_("Ratio"), + N_("CID"), + N_("Cipher") +}; TransferView::TransferView(SmartWin::Widget* parent, SmartWin::WidgetTabView* mdi_) : WidgetFactory<SmartWin::WidgetChildWindow>(parent), @@ -56,7 +67,7 @@ transfers = SmartWin::WidgetCreator<WidgetTransfers>::create(this, WinUtil::Seeds::listView); transfers->setSmallImageList(arrows); - transfers->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + transfers->createColumns(WinUtil::getStrings(columnNames)); transfers->setColumnOrder(WinUtil::splitTokens(SETTING(MAINFRAME_ORDER), columnIndexes)); transfers->setColumnWidths(WinUtil::splitTokens(SETTING(MAINFRAME_WIDTHS), columnSizes)); transfers->setColor(WinUtil::textColor, WinUtil::bgColor); Modified: dcplusplus/trunk/win32/UCPage.cpp =================================================================== --- dcplusplus/trunk/win32/UCPage.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/UCPage.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -50,9 +50,9 @@ commands->setListViewStyle(LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT); TStringList columns; - columns.push_back(TSTRING(SETTINGS_NAME)); - columns.push_back(TSTRING(SETTINGS_COMMAND)); - columns.push_back(TSTRING(HUB)); + columns.push_back(T_("Name")); + columns.push_back(T_("Command")); + columns.push_back(T_("Hub")); commands->createColumns(columns); commands->setColumnWidth(0, 100); commands->setColumnWidth(1, commands->getSize().x - 220); @@ -120,7 +120,7 @@ CommandDlg dlg(this, uc.getType(), uc.getCtx(), Text::toT(uc.getName()), Text::toT(uc.getCommand()), Text::toT(uc.getHub())); if(dlg.run() == IDOK) { - commands->setText(0, i, (dlg.getType() == UserCommand::TYPE_SEPARATOR) ? TSTRING(SEPARATOR) : dlg.getName()); + commands->setText(0, i, (dlg.getType() == UserCommand::TYPE_SEPARATOR) ? T_("Separator") : dlg.getName()); commands->setText(1, i, dlg.getCommand()); commands->setText(2, i, dlg.getHub()); @@ -178,7 +178,7 @@ void UCPage::addEntry(const UserCommand& uc, int index) { TStringList row; - row.push_back((uc.getType() == UserCommand::TYPE_SEPARATOR) ? TSTRING(SEPARATOR) : Text::toT(uc.getName())); + row.push_back((uc.getType() == UserCommand::TYPE_SEPARATOR) ? T_("Separator") : Text::toT(uc.getName())); row.push_back(Text::toT(uc.getCommand())); row.push_back(Text::toT(uc.getHub())); commands->insert(row, (LPARAM)uc.getId(), index); Modified: dcplusplus/trunk/win32/UsersFrame.cpp =================================================================== --- dcplusplus/trunk/win32/UsersFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) +++ dcplusplus/trunk/win32/UsersFrame.cpp 2008-01-15 13:54:45 UTC (rev 965) @@ -31,7 +31,7 @@ N_("Hub (last seen on if offline)"), N_("Time last seen"), N_("Description"), - N_("CID"), + N_("CID") }; UsersFrame::UsersFrame(SmartWin::WidgetTabView* mdiParent) : This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-15 13:53:59
|
Revision: 127 http://adchpp.svn.sourceforge.net/adchpp/?rev=127&view=rev Author: arnetheduck Date: 2008-01-15 05:53:57 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Rework bloom filter implementation Modified Paths: -------------- adchpp/trunk/adchpp/ClientManager.cpp adchpp/trunk/adchpp/SocketManager.cpp adchpp/trunk/adchpp/TigerHash.h adchpp/trunk/changelog.txt adchpp/trunk/plugins/Bloom/src/BloomManager.cpp adchpp/trunk/plugins/Bloom/src/HashBloom.cpp adchpp/trunk/plugins/Bloom/src/HashBloom.h adchpp/trunk/plugins/Bloom/src/HashValue.h adchpp/trunk/swig/adchpp.i Modified: adchpp/trunk/adchpp/ClientManager.cpp =================================================================== --- adchpp/trunk/adchpp/ClientManager.cpp 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/adchpp/ClientManager.cpp 2008-01-15 13:53:57 UTC (rev 127) @@ -269,9 +269,9 @@ TigerHash tiger; tiger.update(&password[0], password.size()); tiger.update(&salt[0], salt.size()); - uint8_t tmp[TigerHash::HASH_SIZE]; - Encoder::fromBase32(suppliedHash.c_str(), tmp, TigerHash::HASH_SIZE); - if (memcmp(tiger.finalize(), tmp, TigerHash::HASH_SIZE) == 0) { + uint8_t tmp[TigerHash::BYTES]; + Encoder::fromBase32(suppliedHash.c_str(), tmp, TigerHash::BYTES); + if (memcmp(tiger.finalize(), tmp, TigerHash::BYTES) == 0) { return true; } @@ -284,7 +284,7 @@ tiger2.update(c.getCID().data(), CID::SIZE); tiger2.update(&password[0], password.size()); tiger2.update(&salt[0], salt.size()); - if (memcmp(tiger2.finalize(), tmp, TigerHash::HASH_SIZE) == 0) { + if (memcmp(tiger2.finalize(), tmp, TigerHash::BYTES) == 0) { c.send(AdcCommand(AdcCommand::CMD_MSG).addParam("Your client uses an old PAS encoding, please upgrade")); return true; } Modified: adchpp/trunk/adchpp/SocketManager.cpp =================================================================== --- adchpp/trunk/adchpp/SocketManager.cpp 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/adchpp/SocketManager.cpp 2008-01-15 13:53:57 UTC (rev 127) @@ -534,12 +534,16 @@ ssize_t bytes = ::recv(ms->getSocket(), buf->data(), buf->size(), MSG_DONTWAIT); if(bytes == -1) { int error = errno; - if(error != EAGAIN && error != EINTR) { - ms->close(); - disconnect(ms, error); - return false; + if(error == EINTR) { + continue; } - break; + if(error == EAGAIN) { + break; + } + + ms->close(); + disconnect(ms, error); + return false; } else if(bytes == 0) { ms->close(); disconnect(ms, 0); @@ -557,33 +561,31 @@ return; } BufferList buffers; - while(true) { - ms->prepareWrite(buffers); - if(buffers.empty()) { - uint32_t now = GET_TICK(); - if(ms->disc || (ms->isBlocked() && ms->disc < now)) { - disconnect(ms, 0); - } - return; + ms->prepareWrite(buffers); + if(buffers.empty()) { + uint32_t now = GET_TICK(); + if(ms->disc || (ms->isBlocked() && ms->disc < now)) { + disconnect(ms, 0); } - std::vector<iovec> iov(buffers.size()); - for(size_t i = 0; i < buffers.size(); ++i) { - iov[i].iov_base = buffers[i]->data(); - iov[i].iov_len = buffers[i]->size(); - } - ssize_t bytes = ::writev(ms->getSocket(), &iov[0], iov.size()); - if(bytes == -1) { - int error = errno; - if(error == EAGAIN) { - ms->completeWrite(buffers, 0); - return; - } + return; + } + std::vector<iovec> iov(buffers.size()); + for(size_t i = 0; i < buffers.size(); ++i) { + iov[i].iov_base = buffers[i]->data(); + iov[i].iov_len = buffers[i]->size(); + } + ssize_t bytes = ::writev(ms->getSocket(), &iov[0], iov.size()); + if(bytes == -1) { + int error = errno; + if(error == EAGAIN) { + ms->setBlocked(true); + } else if(error != EINTR) { disconnect(ms, error); return; } - if(!ms->completeWrite(buffers, bytes)) { - break; - } + ms->completeWrite(buffers, 0); + } else { + ms->completeWrite(buffers, bytes); } } Modified: adchpp/trunk/adchpp/TigerHash.h =================================================================== --- adchpp/trunk/adchpp/TigerHash.h 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/adchpp/TigerHash.h 2008-01-15 13:53:57 UTC (rev 127) @@ -23,8 +23,9 @@ class TigerHash { public: - /** Hash size in bytes */ - enum { HASH_SIZE = 24 }; + /** Hash size */ + static const size_t BITS = 192; + static const size_t BYTES = BITS / 8; TigerHash() : pos(0) { res[0]=_ULL(0x0123456789ABCDEF); Modified: adchpp/trunk/changelog.txt =================================================================== --- adchpp/trunk/changelog.txt 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/changelog.txt 2008-01-15 13:53:57 UTC (rev 127) @@ -1,2 +1,7 @@ --- 2.1 06.01.2008 -- - * Initial ADC 1.0 release \ No newline at end of file +-- -- +* access.lua: fixed message type for MSG +* Some minor socket fixes +* Initial Bloom filter implementation + +-- 2.1 2008-01-06 -- +* Initial ADC 1.0 release Modified: adchpp/trunk/plugins/Bloom/src/BloomManager.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2008-01-15 13:53:57 UTC (rev 127) @@ -32,6 +32,9 @@ BloomManager* BloomManager::instance = 0; const string BloomManager::className = "BloomManager"; +// TODO Make configurable +const size_t h = 24; + BloomManager::BloomManager() : searches(0), tthSearches(0), stopped(0) { LOG(className, "Starting"); ClientManager* cm = ClientManager::getInstance(); @@ -56,7 +59,7 @@ return; } - size_t k = HashBloom::get_k(n); + size_t k = HashBloom::get_k(n, h); size_t m = HashBloom::get_m(n, k); blooms.erase(c.getSID()); @@ -68,6 +71,7 @@ get.addParam("0"); get.addParam(Util::toString(m/8)); get.addParam("BK", Util::toString(k)); + get.addParam("BH", Util::toString(h)); c.send(get); } } else if(cmd.getCommand() == AdcCommand::CMD_SND) { @@ -149,7 +153,7 @@ if(v.size() == get<1>(i->second) / 8) { HashBloom& bloom = blooms[c.getSID()]; - bloom.reset(v, get<2>(i->second)); + bloom.reset(v, get<2>(i->second), h); pending.erase(i); } } Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2008-01-15 13:53:57 UTC (rev 127) @@ -1,8 +1,9 @@ #include "stdinc.h" + #include "HashBloom.h" -size_t HashBloom::get_k(size_t n) { - for(size_t k = TTHValue::SIZE/3; k > 1; --k) { +size_t HashBloom::get_k(size_t n, size_t h) { + for(size_t k = TTHValue::BITS/h; k > 1; --k) { uint64_t m = get_m(n, k); if(m >> 24 == 0) { return k; @@ -13,8 +14,8 @@ uint64_t HashBloom::get_m(size_t n, size_t k) { uint64_t m = (static_cast<uint64_t>(ceil(static_cast<double>(n) * k / log(2.)))); - // 64-bit boundary allows us to use a bitset based on uint64_t's - return ((m / 64) + 1) * 64; + // 64-bit boundary as per spec + return ((m + 63 )/ 64) * 64; } void HashBloom::add(const TTHValue& tth) { @@ -39,8 +40,9 @@ bloom.push_back(v); } -void HashBloom::reset(ByteVector& v, size_t k_) { +void HashBloom::reset(ByteVector& v, size_t k_, size_t h_) { k = k_; + h = h_; bloom.resize(v.size() * 8); for(size_t i = 0; i < v.size(); ++i) { @@ -51,12 +53,22 @@ } size_t HashBloom::pos(const TTHValue& tth, size_t n) const { - uint32_t x = 0; - for(size_t i = n*3; i < TTHValue::SIZE; i += 3*k) { - x ^= static_cast<uint32_t>(tth.data[i]) << 2*8; - x ^= static_cast<uint32_t>(tth.data[i+1]) << 8; - x ^= static_cast<uint32_t>(tth.data[i+2]); + uint64_t x = 0; + + size_t start = n * h; + if((n+1)*h > TTHValue::BITS) { + return 0; } + + for(size_t i = 0; i < h; ++i) { + size_t bit = start + i; + size_t byte = bit / 8; + size_t pos = bit % 8; + + if(tth.data[byte] & (1 << pos)) { + x |= (1 << i); + } + } return x % bloom.size(); } Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.h =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.h 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.h 2008-01-15 13:53:57 UTC (rev 127) @@ -15,14 +15,16 @@ */ class HashBloom { public: + HashBloom() : k(0), h(0) { } + /** Return a suitable value for k based on n */ - static size_t get_k(size_t n); + static size_t get_k(size_t n, size_t h); /** Optimal number of bits to allocate for n elements when using k hashes */ static uint64_t get_m(size_t n, size_t k); void add(const TTHValue& tth); bool match(const TTHValue& tth) const; - void reset(ByteVector& v, size_t k); + void reset(ByteVector& v, size_t k, size_t h); void push_back(bool v); size_t size() const { return bloom.size(); } @@ -32,6 +34,7 @@ std::vector<bool> bloom; size_t k; + size_t h; }; #endif /*HASHBLOOM_H_*/ Modified: adchpp/trunk/plugins/Bloom/src/HashValue.h =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashValue.h 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/plugins/Bloom/src/HashValue.h 2008-01-15 13:53:57 UTC (rev 127) @@ -24,21 +24,22 @@ template<class Hasher> struct HashValue { - static const size_t SIZE = Hasher::HASH_SIZE; + static const size_t BITS = Hasher::BITS; + static const size_t BYTES = Hasher::BYTES; HashValue() { } - explicit HashValue(uint8_t* aData) { memcpy(data, aData, SIZE); } - explicit HashValue(const std::string& base32) { Encoder::fromBase32(base32.c_str(), data, SIZE); } - HashValue(const HashValue& rhs) { memcpy(data, rhs.data, SIZE); } - HashValue& operator=(const HashValue& rhs) { memcpy(data, rhs.data, SIZE); return *this; } + explicit HashValue(uint8_t* aData) { memcpy(data, aData, BYTES); } + explicit HashValue(const std::string& base32) { Encoder::fromBase32(base32.c_str(), data, BYTES); } + HashValue(const HashValue& rhs) { memcpy(data, rhs.data, BYTES); } + HashValue& operator=(const HashValue& rhs) { memcpy(data, rhs.data, BYTES); return *this; } bool operator!=(const HashValue& rhs) const { return !(*this == rhs); } - bool operator==(const HashValue& rhs) const { return memcmp(data, rhs.data, SIZE) == 0; } - bool operator<(const HashValue& rhs) const { return memcmp(data, rhs.data, SIZE) < 0; } + bool operator==(const HashValue& rhs) const { return memcmp(data, rhs.data, BYTES) == 0; } + bool operator<(const HashValue& rhs) const { return memcmp(data, rhs.data, BYTES) < 0; } - std::string toBase32() const { return Encoder::toBase32(data, SIZE); } - std::string& toBase32(std::string& tmp) const { return Encoder::toBase32(data, SIZE, tmp); } + std::string toBase32() const { return Encoder::toBase32(data, BYTES); } + std::string& toBase32(std::string& tmp) const { return Encoder::toBase32(data, BYTES, tmp); } - uint8_t data[SIZE]; + uint8_t data[BYTES]; }; namespace std { namespace tr1 { Modified: adchpp/trunk/swig/adchpp.i =================================================================== --- adchpp/trunk/swig/adchpp.i 2008-01-06 19:18:26 UTC (rev 126) +++ adchpp/trunk/swig/adchpp.i 2008-01-15 13:53:57 UTC (rev 127) @@ -680,7 +680,7 @@ class TigerHash { public: /** Hash size in bytes */ - enum { HASH_SIZE = 24 }; + enum { BITS = 192, BYTES = BITS / 8 }; // Keep old name for a while TigerHash(); @@ -689,7 +689,7 @@ self->update(data.data(), data.size()); } std::string finalize() { - return std::string(reinterpret_cast<const char*>(self->finalize()), TigerHash::HASH_SIZE); + return std::string(reinterpret_cast<const char*>(self->finalize()), TigerHash::BYTES); } } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-10 11:39:04
|
Revision: 964 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=964&view=rev Author: arnetheduck Date: 2008-01-10 03:39:01 -0800 (Thu, 10 Jan 2008) Log Message: ----------- language patch Modified Paths: -------------- dcplusplus/trunk/win32/ADLSearchFrame.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/SpyFrame.cpp dcplusplus/trunk/win32/UsersFrame.cpp Property Changed: ---------------- dcplusplus/trunk/win32/po/ Modified: dcplusplus/trunk/win32/ADLSearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-01-09 14:26:12 UTC (rev 963) +++ dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) @@ -22,15 +22,18 @@ #include "ADLSearchFrame.h" -#include <dcpp/ResourceManager.h> #include <dcpp/Client.h> #include "HoldRedraw.h" #include "ADLSProperties.h" int ADLSearchFrame::columnIndexes[] = { COLUMN_ACTIVE_SEARCH_STRING, COLUMN_SOURCE_TYPE, COLUMN_DEST_DIR, COLUMN_MIN_FILE_SIZE, COLUMN_MAX_FILE_SIZE }; int ADLSearchFrame::columnSizes[] = { 120, 90, 90, 90, 90 }; -static ResourceManager::Strings columnNames[] = { ResourceManager::ACTIVE_SEARCH_STRING, - ResourceManager::SOURCE_TYPE, ResourceManager::DESTINATION, ResourceManager::MIN_SIZE, ResourceManager::MAX_SIZE, +static const char* columnNames[] = { + N_("Enabled / Search String"), + N_("Source Type"), + N_("Destination Directory"), + N_("Min Size"), + N_("Max Size"), }; ADLSearchFrame::ADLSearchFrame(SmartWin::WidgetTabView* mdiParent) : @@ -48,7 +51,7 @@ items = createListView(cs); addWidget(items); - items->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + items->createColumns(WinUtil::getStrings(columnNames)); items->setColumnOrder(WinUtil::splitTokens(SETTING(ADLSEARCHFRAME_ORDER), columnIndexes)); items->setColumnWidths(WinUtil::splitTokens(SETTING(ADLSEARCHFRAME_WIDTHS), columnSizes)); items->setColor(WinUtil::textColor, WinUtil::bgColor); @@ -62,32 +65,32 @@ { WidgetButton::Seed cs = WinUtil::Seeds::button; - cs.caption = TSTRING(NEW); + cs.caption = T_("&New..."); add = createButton(cs); add->onClicked(std::tr1::bind(&ADLSearchFrame::handleAdd, this)); addWidget(add); - cs.caption = TSTRING(PROPERTIES); + cs.caption = T_("&Properties"); properties = createButton(cs); properties->onClicked(std::tr1::bind(&ADLSearchFrame::handleProperties, this)); addWidget(properties); - cs.caption = TSTRING(MOVE_UP); + cs.caption = T_("Move &Up"); up = createButton(cs); up->onClicked(std::tr1::bind(&ADLSearchFrame::handleUp, this)); addWidget(up); - cs.caption = TSTRING(MOVE_DOWN); + cs.caption = T_("Move &Down"); down = createButton(cs); down->onClicked(std::tr1::bind(&ADLSearchFrame::handleDown, this)); addWidget(down); - cs.caption = TSTRING(REMOVE); + cs.caption = T_("&Remove"); remove = createButton(cs); remove->onClicked(std::tr1::bind(&ADLSearchFrame::handleRemove, this)); addWidget(remove); - cs.caption = TSTRING(MENU_HELP); + cs.caption = T_("&Help"); help = createButton(cs); help->onClicked(std::tr1::bind(&ADLSearchFrame::handleHelp, this)); addWidget(help); @@ -287,9 +290,9 @@ } WidgetMenuPtr contextMenu = createMenu(true); - contextMenu->appendItem(IDC_ADD, TSTRING(NEW), std::tr1::bind(&ADLSearchFrame::handleAdd, this)); - contextMenu->appendItem(IDC_EDIT, TSTRING(PROPERTIES), std::tr1::bind(&ADLSearchFrame::handleProperties, this)); - contextMenu->appendItem(IDC_REMOVE, TSTRING(REMOVE), std::tr1::bind(&ADLSearchFrame::handleRemove, this)); + contextMenu->appendItem(IDC_ADD, T_("&New..."), std::tr1::bind(&ADLSearchFrame::handleAdd, this)); + contextMenu->appendItem(IDC_EDIT, T_("&Properties"), std::tr1::bind(&ADLSearchFrame::handleProperties, this)); + contextMenu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&ADLSearchFrame::handleRemove, this)); bool status = items->hasSelection(); contextMenu->setItemEnabled(IDC_EDIT, status); Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2008-01-09 14:26:12 UTC (rev 963) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2008-01-10 11:39:01 UTC (rev 964) @@ -25,7 +25,6 @@ #include "AspectSpeaker.h" #include "AspectStatus.h" #include <dcpp/SettingsManager.h> -#include <dcpp/ResourceManager.h> #include "resource.h" template<typename T> @@ -188,7 +187,7 @@ bool handleContextMenu(const SmartWin::ScreenCoordinate& pt) { SmartWin::WidgetMenu::ObjectType menu = SmartWin::WidgetCreator<SmartWin::WidgetMenu>::create(SmartWin::WidgetMenu::Seed(true)); - menu->appendItem(IDC_CLOSE_WINDOW, TSTRING(CLOSE), std::tr1::bind(&ThisType::close, this, true)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("Close"), std::tr1::bind(&ThisType::close, this, true)); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-01-09 14:26:12 UTC (rev 963) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) @@ -26,7 +26,6 @@ #include <dcpp/Client.h> #include <dcpp/LogManager.h> #include <dcpp/User.h> -#include <dcpp/ResourceManager.h> #include <dcpp/FavoriteManager.h> #include <dcpp/UploadManager.h> #include <dcpp/QueueItem.h> @@ -283,12 +282,12 @@ chat->setText(Util::emptyStringT); } else if(Util::stricmp(s.c_str(), _T("grant")) == 0) { UploadManager::getInstance()->reserveSlot(replyTo); - addStatus(TSTRING(SLOT_GRANTED)); + addStatus(T_("Slot granted")); } else if(Util::stricmp(s.c_str(), _T("close")) == 0) { postMessage(WM_CLOSE); } else if((Util::stricmp(s.c_str(), _T("favorite")) == 0) || (Util::stricmp(s.c_str(), _T("fav")) == 0)) { FavoriteManager::getInstance()->addFavoriteUser(replyTo); - addStatus(TSTRING(FAVORITE_USER_ADDED)); + addStatus(T_("Favorite user added")); } else if(Util::stricmp(s.c_str(), _T("getlist")) == 0) { // TODO handleGetList(); } else if(Util::stricmp(s.c_str(), _T("log")) == 0) { @@ -313,7 +312,7 @@ if(replyTo->isOnline()) { sendMessage(s); } else { - addStatus(TSTRING(USER_WENT_OFFLINE)); + addStatus(T_("User went offline")); resetText = false; } } @@ -363,15 +362,15 @@ bool PrivateFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { WidgetMenuPtr menu = createMenu(true); - menu->appendItem(IDC_GETLIST, TSTRING(GET_FILE_LIST), std::tr1::bind(&PrivateFrame::handleGetList, this)); - menu->appendItem(IDC_MATCH_QUEUE, TSTRING(MATCH_QUEUE), std::tr1::bind(&PrivateFrame::handleMatchQueue, this)); - menu->appendItem(IDC_GRANTSLOT, TSTRING(GRANT_EXTRA_SLOT), std::tr1::bind(&UploadManager::reserveSlot, UploadManager::getInstance(), replyTo)); + menu->appendItem(IDC_GETLIST, T_("Get file list"), std::tr1::bind(&PrivateFrame::handleGetList, this)); + menu->appendItem(IDC_MATCH_QUEUE, T_("Match queue"), std::tr1::bind(&PrivateFrame::handleMatchQueue, this)); + menu->appendItem(IDC_GRANTSLOT, T_("Grant extra slot"), std::tr1::bind(&UploadManager::reserveSlot, UploadManager::getInstance(), replyTo)); if(!FavoriteManager::getInstance()->isFavoriteUser(replyTo)) - menu->appendItem(IDC_ADD_TO_FAVORITES, TSTRING(ADD_TO_FAVORITES), std::tr1::bind(&FavoriteManager::addFavoriteUser, FavoriteManager::getInstance(), replyTo)); + menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To Favorites"), std::tr1::bind(&FavoriteManager::addFavoriteUser, FavoriteManager::getInstance(), replyTo)); prepareMenu(menu, UserCommand::CONTEXT_CHAT, ClientManager::getInstance()->getHubs(replyTo->getCID())); menu->appendSeparatorItem(); - menu->appendItem(IDC_CLOSE_WINDOW, TSTRING(CLOSE), std::tr1::bind(&PrivateFrame::close, this, true)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("Close"), std::tr1::bind(&PrivateFrame::close, this, true)); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return TRUE; Modified: dcplusplus/trunk/win32/SpyFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SpyFrame.cpp 2008-01-09 14:26:12 UTC (rev 963) +++ dcplusplus/trunk/win32/SpyFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) @@ -28,7 +28,11 @@ int SpyFrame::columnSizes[] = { 305, 70, 85 }; int SpyFrame::columnIndexes[] = { COLUMN_STRING, COLUMN_COUNT, COLUMN_TIME }; -static ResourceManager::Strings columnNames[] = { ResourceManager::SEARCH_STRING, ResourceManager::COUNT, ResourceManager::TIME }; +static const char* columnNames[] = { + N_("Search String"), + N_("Count"), + N_("Time"), +}; SpyFrame::SpyFrame(SmartWin::WidgetTabView* mdiParent) : BaseType(mdiParent), @@ -46,7 +50,7 @@ searches = createListView(cs); addWidget(searches); - searches->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + searches->createColumns(WinUtil::getStrings(columnNames)); searches->setColumnOrder(WinUtil::splitTokens(SETTING(SPYFRAME_ORDER), columnIndexes)); searches->setColumnWidths(WinUtil::splitTokens(SETTING(SPYFRAME_WIDTHS), columnSizes)); searches->setSort(COLUMN_COUNT, SmartWin::WidgetListView::SORT_INT, false); @@ -57,7 +61,7 @@ } { - WidgetCheckBox::Seed cs(TSTRING(IGNORE_TTH_SEARCHES)); + WidgetCheckBox::Seed cs(T_("Ignore TTH searches")); ignoreTTH = createCheckBox(cs); ignoreTTH->setChecked(bIgnoreTTH); ignoreTTH->onClicked(std::tr1::bind(&SpyFrame::handleIgnoreTTHClicked, this)); @@ -182,7 +186,7 @@ searchString = searches->getText(searches->getSelectedIndex(), COLUMN_STRING); WidgetMenuPtr contextMenu = createMenu(true); - contextMenu->appendItem(IDC_SEARCH, TSTRING(SEARCH), std::tr1::bind(&SpyFrame::handleSearch, this)); + contextMenu->appendItem(IDC_SEARCH, T_("Search"), std::tr1::bind(&SpyFrame::handleSearch, this)); contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; Modified: dcplusplus/trunk/win32/UsersFrame.cpp =================================================================== --- dcplusplus/trunk/win32/UsersFrame.cpp 2008-01-09 14:26:12 UTC (rev 963) +++ dcplusplus/trunk/win32/UsersFrame.cpp 2008-01-10 11:39:01 UTC (rev 964) @@ -23,11 +23,16 @@ #include "HoldRedraw.h" #include <dcpp/FavoriteManager.h> -#include <dcpp/ResourceManager.h> int UsersFrame::columnIndexes[] = { COLUMN_NICK, COLUMN_HUB, COLUMN_SEEN, COLUMN_DESCRIPTION, COLUMN_CID }; int UsersFrame::columnSizes[] = { 200, 300, 150, 200, 125 }; -static ResourceManager::Strings columnNames[] = { ResourceManager::AUTO_GRANT, ResourceManager::LAST_HUB, ResourceManager::LAST_SEEN, ResourceManager::DESCRIPTION, ResourceManager::CID }; +static const char* columnNames[] = { + N_("Auto grant slot / Nick"), + N_("Hub (last seen on if offline)"), + N_("Time last seen"), + N_("Description"), + N_("CID"), +}; UsersFrame::UsersFrame(SmartWin::WidgetTabView* mdiParent) : BaseType(mdiParent), @@ -40,7 +45,7 @@ users = SmartWin::WidgetCreator<WidgetUsers>::create(this, cs); addWidget(users); - users->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + users->createColumns(WinUtil::getStrings(columnNames)); users->setColumnOrder(WinUtil::splitTokens(SETTING(HUBFRAME_ORDER), columnIndexes)); users->setColumnWidths(WinUtil::splitTokens(SETTING(HUBFRAME_WIDTHS), columnSizes)); users->setSort(COLUMN_NICK); @@ -100,7 +105,7 @@ void UsersFrame::UserInfo::update(const FavoriteUser& u) { columns[COLUMN_NICK] = Text::toT(u.getNick()); columns[COLUMN_HUB] = user->isOnline() ? WinUtil::getHubNames(u.getUser()).first : Text::toT(u.getUrl()); - columns[COLUMN_SEEN] = user->isOnline() ? TSTRING(ONLINE) : Text::toT(Util::formatTime("%Y-%m-%d %H:%M", u.getLastSeen())); + columns[COLUMN_SEEN] = user->isOnline() ? T_("Online") : Text::toT(Util::formatTime("%Y-%m-%d %H:%M", u.getLastSeen())); columns[COLUMN_DESCRIPTION] = Text::toT(u.getDescription()); columns[COLUMN_CID] = Text::toT(u.getUser()->getCID().toBase32()); } @@ -115,7 +120,7 @@ for(int i = 0; i < users->size(); ++i) { UserInfo *ui = users->getData(i); if(ui->user == aUser) { - ui->columns[COLUMN_SEEN] = aUser->isOnline() ? TSTRING(ONLINE) : Text::toT(Util::formatTime("%Y-%m-%d %H:%M", FavoriteManager::getInstance()->getLastSeen(aUser))); + ui->columns[COLUMN_SEEN] = aUser->isOnline() ? T_("Online") : Text::toT(Util::formatTime("%Y-%m-%d %H:%M", FavoriteManager::getInstance()->getLastSeen(aUser))); users->update(i); } } @@ -135,7 +140,7 @@ if(users->getSelectedCount() == 1) { int i = users->getSelectedIndex(); UserInfo* ui = users->getData(i); - LineDlg dlg(this, ui->columns[COLUMN_NICK], TSTRING(DESCRIPTION), ui->columns[COLUMN_DESCRIPTION]); + LineDlg dlg(this, ui->columns[COLUMN_NICK], T_("Description"), ui->columns[COLUMN_DESCRIPTION]); if(dlg.run() == IDOK) { FavoriteManager::getInstance()->setUserDescription(ui->user, Text::fromT(dlg.getLine())); @@ -178,8 +183,8 @@ WidgetMenuPtr menu = createMenu(true); appendUserItems(getParent(), menu); menu->appendSeparatorItem(); - menu->appendItem(IDC_EDIT, TSTRING(PROPERTIES), std::tr1::bind(&UsersFrame::handleProperties, this)); - menu->appendItem(IDC_REMOVE, TSTRING(REMOVE), std::tr1::bind(&UsersFrame::handleRemove, this)); + menu->appendItem(IDC_EDIT, T_("&Properties"), std::tr1::bind(&UsersFrame::handleProperties, this)); + menu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&UsersFrame::handleRemove, this)); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); Property changes on: dcplusplus/trunk/win32/po ___________________________________________________________________ Name: svn:ignore + dcpp-win32.pot This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-01-09 14:26:19
|
Revision: 963 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=963&view=rev Author: zouzou123gen Date: 2008-01-09 06:26:12 -0800 (Wed, 09 Jan 2008) Log Message: ----------- fix active tab moves Modified Paths: -------------- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-01-08 22:39:07 UTC (rev 962) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-01-09 14:26:12 UTC (rev 963) @@ -310,11 +310,7 @@ tab->addPage(cutTitle(ti->w->getText()), dropPos, reinterpret_cast<LPARAM>(ti), image); - // in case the active tab was moved - if(dragging == active) - active = dropPos; - else if(dropPos == active) - active = dragging; + active = tab->getSelectedIndex(); layout(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-08 22:39:15
|
Revision: 962 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=962&view=rev Author: arnetheduck Date: 2008-01-08 14:39:07 -0800 (Tue, 08 Jan 2008) Log Message: ----------- Turn off some noise Modified Paths: -------------- dcplusplus/trunk/dcpp/SSLSocket.cpp Modified: dcplusplus/trunk/dcpp/SSLSocket.cpp =================================================================== --- dcplusplus/trunk/dcpp/SSLSocket.cpp 2008-01-04 21:04:57 UTC (rev 961) +++ dcplusplus/trunk/dcpp/SSLSocket.cpp 2008-01-08 22:39:07 UTC (rev 962) @@ -66,7 +66,7 @@ if(len > 0) { stats.totalDown += len; - dcdebug("In(s): %.*s\n", len, (char*)aBuffer); + //dcdebug("In(s): %.*s\n", len, (char*)aBuffer); } return len; } @@ -78,7 +78,7 @@ int ret = checkSSL(SSL_write(ssl, aBuffer, aLen)); if(ret > 0) { stats.totalUp += ret; - dcdebug("Out(s): %.*s\n", ret, (char*)aBuffer); + //dcdebug("Out(s): %.*s\n", ret, (char*)aBuffer); } return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-06 19:18:39
|
Revision: 126 http://adchpp.svn.sourceforge.net/adchpp/?rev=126&view=rev Author: arnetheduck Date: 2008-01-06 11:18:26 -0800 (Sun, 06 Jan 2008) Log Message: ----------- fix pm context Modified Paths: -------------- adchpp/trunk/plugins/Script/examples/access.lua Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2008-01-06 11:01:13 UTC (rev 125) +++ adchpp/trunk/plugins/Script/examples/access.lua 2008-01-06 19:18:26 UTC (rev 126) @@ -54,7 +54,7 @@ local context_hub = "[H]" local context_bcast = "[BF]" local context_direct = "[DE]" -local context_send = "[BFD]" +local context_send = "[BFDE]" local context_hubdirect = "[HDE]" local command_contexts = { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pie...@us...> - 2008-01-06 11:01:15
|
Revision: 125 http://adchpp.svn.sourceforge.net/adchpp/?rev=125&view=rev Author: pietricica Date: 2008-01-06 03:01:13 -0800 (Sun, 06 Jan 2008) Log Message: ----------- released 2.1 Added Paths: ----------- adchpp/tags/2.1/ Copied: adchpp/tags/2.1 (from rev 124, adchpp/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pie...@us...> - 2008-01-06 11:00:24
|
Revision: 124 http://adchpp.svn.sourceforge.net/adchpp/?rev=124&view=rev Author: pietricica Date: 2008-01-06 03:00:11 -0800 (Sun, 06 Jan 2008) Log Message: ----------- changelog release date edit Modified Paths: -------------- adchpp/trunk/changelog.txt Modified: adchpp/trunk/changelog.txt =================================================================== --- adchpp/trunk/changelog.txt 2008-01-03 19:43:59 UTC (rev 123) +++ adchpp/trunk/changelog.txt 2008-01-06 11:00:11 UTC (rev 124) @@ -1,2 +1,2 @@ --- 2.1 -- +-- 2.1 06.01.2008 -- * Initial ADC 1.0 release \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-04 21:04:59
|
Revision: 961 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=961&view=rev Author: arnetheduck Date: 2008-01-04 13:04:57 -0800 (Fri, 04 Jan 2008) Log Message: ----------- the po's should be there Added Paths: ----------- dcplusplus/trunk/dcpp/po/ dcplusplus/trunk/win32/po/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-04 21:03:40
|
Revision: 960 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=960&view=rev Author: arnetheduck Date: 2008-01-04 13:03:38 -0800 (Fri, 04 Jan 2008) Log Message: ----------- tab drag/drop Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabSheet.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-01-04 15:55:23 UTC (rev 959) +++ dcplusplus/trunk/changelog.txt 2008-01-04 21:03:38 UTC (rev 960) @@ -10,6 +10,7 @@ * Fixed an issue with nick encodings and nmdc connections (thanks stanislav maslovski) * Added download view which shows per-file download information * Chat timestamps on by default +* Added tab drag/drop (thanks poy) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabSheet.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabSheet.h 2008-01-04 15:55:23 UTC (rev 959) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabSheet.h 2008-01-04 21:03:38 UTC (rev 960) @@ -165,7 +165,9 @@ */ // the negative values are already covered by throwing an exception unsigned int addPage( const SmartUtil::tstring & header, unsigned index, LPARAM lParam = 0, int image = -1 ); - + + int getImage(unsigned idx) const; + LPARAM getData(unsigned idx); void setData(unsigned idx, LPARAM data); @@ -297,6 +299,16 @@ return buffer; } +inline int WidgetTabSheet::getImage(unsigned idx) const +{ + TCITEM item = { TCIF_IMAGE }; + if ( !TabCtrl_GetItem( this->handle(), idx, & item ) ) + { + throw xCeption( _T( "Couldn't get image of item." ) ); + } + return item.iImage; +} + inline LPARAM WidgetTabSheet::getData(unsigned idx) { TCITEM item = { TCIF_PARAM }; Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-01-04 15:55:23 UTC (rev 959) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-01-04 21:03:38 UTC (rev 960) @@ -88,6 +88,7 @@ Rectangle clientSize; std::vector<IconPtr> icons; int active; + int dragging; int findTab(WidgetChildWindow* w); @@ -100,6 +101,8 @@ bool handleTextChanging(WidgetChildWindow* w, const SmartUtil::tstring& newText); bool handleSized(const WidgetSizedEventResult&); void handleTabSelected(); + void handleLeftMouseDown(const MouseEventResult& mouseEventResult); + void handleLeftMouseUp(const MouseEventResult& mouseEventResult); bool handleContextMenu(SmartWin::ScreenCoordinate pt); void handleMiddleMouseDown(const MouseEventResult& mouseEventResult); Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-01-04 15:55:23 UTC (rev 959) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-01-04 21:03:38 UTC (rev 960) @@ -16,7 +16,8 @@ PolicyType(w), tab(0), inTab(false), - active(-1) + active(-1), + dragging(-1) { } void WidgetTabView::create(const Seed & cs) { @@ -30,6 +31,8 @@ tab->onSelectionChanged(std::tr1::bind(&WidgetTabView::handleTabSelected, this)); onSized(std::tr1::bind(&WidgetTabView::handleSized, this, _1)); + tab->onLeftMouseDown(std::tr1::bind(&WidgetTabView::handleLeftMouseDown, this, _1)); + tab->onLeftMouseUp(std::tr1::bind(&WidgetTabView::handleLeftMouseUp, this, _1)); tab->onContextMenu(std::tr1::bind(&WidgetTabView::handleContextMenu, this, _1)); tab->onMiddleMouseDown(std::tr1::bind(&WidgetTabView::handleMiddleMouseDown, this, _1)); } @@ -269,6 +272,56 @@ return image; } +void WidgetTabView::handleLeftMouseDown(const MouseEventResult& mouseEventResult) { + int i = tab->hitTest(mouseEventResult.pos); + if(i != -1) { + if(mouseEventResult.isShiftPressed) + getTabInfo(i)->w->close(); + else { + dragging = i; + ::SetCapture(tab->handle()); + } + } +} + +void WidgetTabView::handleLeftMouseUp(const MouseEventResult& mouseEventResult) { + ::ReleaseCapture(); + + if(dragging != -1) { + int dropPos = tab->hitTest(mouseEventResult.pos); + + if(dropPos == -1) { + // not in the tab control; move the tab to the end + dropPos = tab->size() - 1; + } + + if(dropPos == dragging) { + // the tab hasn't moved; select it + setActive(dropPos); + dragging = -1; + return; + } + + // save some information about the tab before we erase it + TabInfo* ti = getTabInfo(dragging); + int image = tab->getImage(dragging); + + tab->erase(dragging); + + tab->addPage(cutTitle(ti->w->getText()), dropPos, reinterpret_cast<LPARAM>(ti), image); + + // in case the active tab was moved + if(dragging == active) + active = dropPos; + else if(dropPos == active) + active = dragging; + + layout(); + + dragging = -1; + } +} + bool WidgetTabView::handleContextMenu(ScreenCoordinate pt) { TabInfo* ti = 0; if(pt.x() == -1 && pt.y() == -1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-01-04 21:02:35
|
Revision: 958 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=958&view=rev Author: zouzou123gen Date: 2008-01-04 06:18:08 -0800 (Fri, 04 Jan 2008) Log Message: ----------- removed dcpp-win32.pot from the repository Removed Paths: ------------- dcplusplus/trunk/win32/po/dcpp-win32.pot Deleted: dcplusplus/trunk/win32/po/dcpp-win32.pot =================================================================== --- dcplusplus/trunk/win32/po/dcpp-win32.pot 2008-01-04 09:31:40 UTC (rev 957) +++ dcplusplus/trunk/win32/po/dcpp-win32.pot 2008-01-04 14:18:08 UTC (rev 958) @@ -1,107 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Jacek Sieka -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: dcp...@li...\n" -"POT-Creation-Date: 2008-01-04 10:23+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL...@li...>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" - -#: win32/MainWindow.cpp:218 win32/DownloadsFrame.cpp:38 -msgid "Downloads" -msgstr "" - -#: win32/FavHubsFrame.cpp:32 -msgid "Auto connect / Name" -msgstr "" - -#: win32/FavHubsFrame.cpp:33 -msgid "Description" -msgstr "" - -#: win32/FavHubsFrame.cpp:34 -msgid "Nick" -msgstr "" - -#: win32/FavHubsFrame.cpp:35 -msgid "Password" -msgstr "" - -#: win32/FavHubsFrame.cpp:36 -msgid "Server" -msgstr "" - -#: win32/FavHubsFrame.cpp:37 -msgid "User Description" -msgstr "" - -#: win32/FavHubsFrame.cpp:71 win32/FavHubsFrame.cpp:113 -msgid "&Connect" -msgstr "" - -#: win32/FavHubsFrame.cpp:76 win32/FavHubsFrame.cpp:115 -msgid "&New..." -msgstr "" - -#: win32/FavHubsFrame.cpp:81 win32/FavHubsFrame.cpp:116 -msgid "&Properties" -msgstr "" - -#: win32/FavHubsFrame.cpp:86 win32/FavHubsFrame.cpp:117 -msgid "Move &Up" -msgstr "" - -#: win32/FavHubsFrame.cpp:91 win32/FavHubsFrame.cpp:118 -msgid "Move &Down" -msgstr "" - -#: win32/FavHubsFrame.cpp:96 win32/FavHubsFrame.cpp:120 -msgid "&Remove" -msgstr "" - -#: win32/FavHubsFrame.cpp:179 -msgid "Hub already exists as a favorite" -msgstr "" - -#: win32/FavHubsFrame.cpp:243 -msgid "Really remove?" -msgstr "" - -#: win32/FavHubsFrame.cpp:320 -msgid "Please enter a nickname in the settings dialog!" -msgstr "" - -#: win32/DownloadsFrame.cpp:110 -msgid "Waiting for slot" -msgstr "" - -#: win32/DownloadsFrame.cpp:114 -#, boost-format -msgid "Downloading from %1% user" -msgid_plural "Downloading from %1% users" -msgstr[0] "" -msgstr[1] "" - -#: win32/DownloadsFrame.cpp:116 -#, boost-format -msgid "%1%/s" -msgstr "" - -#: win32/SplashWindow.cpp:78 -#, boost-format -msgid "Loading DC++, please wait... (%1%)" -msgstr "" - -#: win32/AppearancePage.cpp:86 win32/AppearancePage.cpp:109 -msgid "Default" -msgstr "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-01-04 21:02:19
|
Revision: 959 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=959&view=rev Author: zouzou123gen Date: 2008-01-04 07:55:23 -0800 (Fri, 04 Jan 2008) Log Message: ----------- removed empty po dirs from the repository Removed Paths: ------------- dcplusplus/trunk/dcpp/po/ dcplusplus/trunk/win32/po/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-04 09:31:43
|
Revision: 957 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=957&view=rev Author: arnetheduck Date: 2008-01-04 01:31:40 -0800 (Fri, 04 Jan 2008) Log Message: ----------- Some more translations Modified Paths: -------------- dcplusplus/trunk/SConstruct dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/StringDefs.h dcplusplus/trunk/dcpp/Text.h dcplusplus/trunk/win32/FavHubsFrame.cpp dcplusplus/trunk/win32/SplashWindow.cpp dcplusplus/trunk/win32/WinUtil.h dcplusplus/trunk/win32/po/dcpp-win32.pot dcplusplus/trunk/win32/stdafx.h Modified: dcplusplus/trunk/SConstruct =================================================================== --- dcplusplus/trunk/SConstruct 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/SConstruct 2008-01-04 09:31:40 UTC (rev 957) @@ -156,10 +156,11 @@ mo_bld = Builder (action = Action([mo_args], 'Compiling message catalog $TARGET from $SOURCES')) env.Append(BUILDERS = {'MoBuild' : mo_bld}) -pot_args = ['xgettext', '--from-code=UTF-8', '--foreign-user', '--package-name=$PACKAGE', +pot_args = ['xgettext', '--from-code=UTF-8', '--foreign-user',# '--package-name=$PACKAGE', '--copyright-holder=Jacek Sieka', '--msgid-bugs-address=dcp...@li...', '--no-wrap', '--keyword=_', '--keyword=T_', '--keyword=TF_', '--keyword=TFN_:1,2', - '--keyword=F_', '--boost', '--output=$TARGET', '$SOURCES'] + '--keyword=F_', '--keyword=gettext_noop', '--keyword=N_', '--boost', + '--output=$TARGET', '$SOURCES'] pot_bld = Builder (action = Action([pot_args], 'Extracting messages to $TARGET from $SOURCES')) env.Append(BUILDERS = {'PotBuild' : pot_bld}) Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/changelog.txt 2008-01-04 09:31:40 UTC (rev 957) @@ -9,6 +9,7 @@ * Replaced homegrown i18n solution with gettext * Fixed an issue with nick encodings and nmdc connections (thanks stanislav maslovski) * Added download view which shows per-file download information +* Chat timestamps on by default -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-01-04 09:31:40 UTC (rev 957) @@ -129,7 +129,7 @@ setDefault(FILTER_MESSAGES, true); setDefault(MINIMIZE_TRAY, true); setDefault(AUTO_SEARCH, false); - setDefault(TIME_STAMPS, false); + setDefault(TIME_STAMPS, true); setDefault(CONFIRM_EXIT, true); setDefault(POPUP_HUB_PMS, true); setDefault(POPUP_BOT_PMS, true); Modified: dcplusplus/trunk/dcpp/StringDefs.h =================================================================== --- dcplusplus/trunk/dcpp/StringDefs.h 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/dcpp/StringDefs.h 2008-01-04 09:31:40 UTC (rev 957) @@ -434,7 +434,7 @@ SETTINGS_DOWNLOADS, // "Downloads" SETTINGS_DOWNLOADS_MAX, // "Maximum simultaneous downloads (0 = infinite)" SETTINGS_DOWNLOADS_SPEED_PAUSE, // "No new downloads if speed exceeds (KiB/s, 0 = disable)" - SETTINGS_EXAMPLE_TEXT, // "Donate :s! (ok, dirty dollars are fine as well =) (see help menu)" + SETTINGS_EXAMPLE_TEXT, // "Donate \342\202\254\342\202\254\342\202\254:s! (ok, dirty dollars are fine as well =) (see help menu)" SETTINGS_EXTERNAL_IP, // "External / WAN IP" SETTINGS_FAV_SHOW_JOINS, // "Only show joins / parts for favorite users" SETTINGS_FAVORITE_DIRS_PAGE, // "Downloads\\Favorites" Modified: dcplusplus/trunk/dcpp/Text.h =================================================================== --- dcplusplus/trunk/dcpp/Text.h 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/dcpp/Text.h 2008-01-04 09:31:40 UTC (rev 957) @@ -81,7 +81,7 @@ #ifdef UNICODE inline const tstring& toT(const string& str, tstring& tmp) throw() { return utf8ToWide(str, tmp); } inline tstring toT(const string& str) throw() { return utf8ToWide(str); } - + inline const string& fromT(const tstring& str, string& tmp) throw() { return wideToUtf8(str, tmp); } inline string fromT(const tstring& str) throw() { return wideToUtf8(str); } #else Modified: dcplusplus/trunk/win32/FavHubsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/FavHubsFrame.cpp 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/win32/FavHubsFrame.cpp 2008-01-04 09:31:40 UTC (rev 957) @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + #include "stdafx.h" #include "FavHubsFrame.h" @@ -28,11 +28,16 @@ int FavHubsFrame::columnIndexes[] = { COLUMN_NAME, COLUMN_DESCRIPTION, COLUMN_NICK, COLUMN_PASSWORD, COLUMN_SERVER, COLUMN_USERDESCRIPTION }; int FavHubsFrame::columnSizes[] = { 200, 290, 125, 100, 100, 125 }; -static ResourceManager::Strings columnNames[] = { ResourceManager::AUTO_CONNECT, ResourceManager::DESCRIPTION, - ResourceManager::NICK, ResourceManager::PASSWORD, ResourceManager::SERVER, ResourceManager::USER_DESCRIPTION +static const char* columnNames[] = { + N_("Auto connect / Name"), + N_("Description"), + N_("Nick"), + N_("Password"), + N_("Server"), + N_("User Description") }; -FavHubsFrame::FavHubsFrame(SmartWin::WidgetTabView* mdiParent) : +FavHubsFrame::FavHubsFrame(SmartWin::WidgetTabView* mdiParent) : BaseType(mdiParent), hubs(0), connect(0), @@ -50,7 +55,7 @@ hubs = createListView(cs); addWidget(hubs); - hubs->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + hubs->createColumns(WinUtil::getStrings(columnNames)); hubs->setColumnOrder(WinUtil::splitTokens(SETTING(FAVHUBSFRAME_ORDER), columnIndexes)); hubs->setColumnWidths(WinUtil::splitTokens(SETTING(FAVHUBSFRAME_WIDTHS), columnSizes)); hubs->setColor(WinUtil::textColor, WinUtil::bgColor); @@ -63,32 +68,32 @@ { WidgetButton::Seed cs = WinUtil::Seeds::button; - cs.caption = TSTRING(CONNECT); + cs.caption = T_("&Connect"); connect = createButton(cs); connect->onClicked(std::tr1::bind(&FavHubsFrame::openSelected, this)); addWidget(connect); - cs.caption = TSTRING(NEW); + cs.caption = T_("&New..."); add = createButton(cs); add->onClicked(std::tr1::bind(&FavHubsFrame::handleAdd, this)); addWidget(add); - cs.caption = TSTRING(PROPERTIES); + cs.caption = T_("&Properties"); properties = createButton(cs); properties->onClicked(std::tr1::bind(&FavHubsFrame::handleProperties, this)); addWidget(properties); - cs.caption = TSTRING(MOVE_UP); + cs.caption = T_("Move &Up"); up = createButton(cs); up->onClicked(std::tr1::bind(&FavHubsFrame::handleUp, this)); addWidget(up); - cs.caption = TSTRING(MOVE_DOWN); + cs.caption = T_("Move &Down"); down = createButton(cs); down->onClicked(std::tr1::bind(&FavHubsFrame::handleDown, this)); addWidget(down); - cs.caption = TSTRING(REMOVE); + cs.caption = T_("&Remove"); remove = createButton(cs); remove->onClicked(std::tr1::bind(&FavHubsFrame::handleRemove, this)); addWidget(remove); @@ -105,20 +110,20 @@ FavoriteManager::getInstance()->addListener(this); hubsMenu = createMenu(true); - hubsMenu->appendItem(IDC_CONNECT, TSTRING(CONNECT), std::tr1::bind(&FavHubsFrame::openSelected, this)); + hubsMenu->appendItem(IDC_CONNECT, T_("&Connect"), std::tr1::bind(&FavHubsFrame::openSelected, this)); hubsMenu->appendSeparatorItem(); - hubsMenu->appendItem(IDC_NEWFAV, TSTRING(NEW), std::tr1::bind(&FavHubsFrame::handleAdd, this)); - hubsMenu->appendItem(IDC_EDIT, TSTRING(PROPERTIES), std::tr1::bind(&FavHubsFrame::handleProperties, this)); - hubsMenu->appendItem(IDC_MOVE_UP, TSTRING(MOVE_UP), std::tr1::bind(&FavHubsFrame::handleUp, this)); - hubsMenu->appendItem(IDC_MOVE_DOWN, TSTRING(MOVE_DOWN), std::tr1::bind(&FavHubsFrame::handleDown, this)); + hubsMenu->appendItem(IDC_NEWFAV, T_("&New..."), std::tr1::bind(&FavHubsFrame::handleAdd, this)); + hubsMenu->appendItem(IDC_EDIT, T_("&Properties"), std::tr1::bind(&FavHubsFrame::handleProperties, this)); + hubsMenu->appendItem(IDC_MOVE_UP, T_("Move &Up"), std::tr1::bind(&FavHubsFrame::handleUp, this)); + hubsMenu->appendItem(IDC_MOVE_DOWN, T_("Move &Down"), std::tr1::bind(&FavHubsFrame::handleDown, this)); hubsMenu->appendSeparatorItem(); - hubsMenu->appendItem(IDC_REMOVE, CTSTRING(REMOVE), std::tr1::bind(&FavHubsFrame::handleRemove, this)); + hubsMenu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&FavHubsFrame::handleRemove, this)); hubsMenu->setDefaultItem(IDC_CONNECT); hubs->onContextMenu(std::tr1::bind(&FavHubsFrame::handleContextMenu, this, _1)); } FavHubsFrame::~FavHubsFrame() { - + } void FavHubsFrame::layout() { @@ -171,7 +176,7 @@ while(true) { if(dlg.run() == IDOK) { if(FavoriteManager::getInstance()->isFavoriteHub(e.getServer())) { - createMessageBox().show(TSTRING(FAVORITE_HUB_ALREADY_EXISTS), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONEXCLAMATION); + createMessageBox().show(T_("Hub already exists as a favorite"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONEXCLAMATION); } else { FavoriteManager::getInstance()->addFavorite(e); break; @@ -235,7 +240,7 @@ } void FavHubsFrame::handleRemove() { - if(hubs->hasSelection() && (!BOOLSETTING(CONFIRM_HUB_REMOVAL) || createMessageBox().show(TSTRING(REALLY_REMOVE), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_YESNO, WidgetMessageBox::BOX_ICONQUESTION) == WidgetMessageBox::RETBOX_YES)) { + if(hubs->hasSelection() && (!BOOLSETTING(CONFIRM_HUB_REMOVAL) || createMessageBox().show(T_("Really remove?"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_YESNO, WidgetMessageBox::BOX_ICONQUESTION) == WidgetMessageBox::RETBOX_YES)) { int i; while((i = hubs->getNext(-1, LVNI_SELECTED)) != -1) FavoriteManager::getInstance()->removeFavorite(reinterpret_cast<FavoriteHubEntryPtr>(hubs->getData(i))); @@ -312,7 +317,7 @@ return; if(SETTING(NICK).empty()) { - createMessageBox().show(TSTRING(ENTER_NICK), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); + createMessageBox().show(T_("Please enter a nickname in the settings dialog!"), _T(APPNAME) _T(" ") _T(VERSIONSTRING), WidgetMessageBox::BOX_OK, WidgetMessageBox::BOX_ICONSTOP); return; } Modified: dcplusplus/trunk/win32/SplashWindow.cpp =================================================================== --- dcplusplus/trunk/win32/SplashWindow.cpp 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/win32/SplashWindow.cpp 2008-01-04 09:31:40 UTC (rev 957) @@ -74,7 +74,7 @@ tmp->close(); } -void SplashWindow::operator()(const string& str) { - text->setText(Text::toT(STRING(LOADING) + "(" + str + ")")); +void SplashWindow::operator()(const string& status) { + text->setText(str(TF_("Loading DC++, please wait... (%1%)") % Text::toT(status) )); text->updateWidget(); } Modified: dcplusplus/trunk/win32/WinUtil.h =================================================================== --- dcplusplus/trunk/win32/WinUtil.h 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/win32/WinUtil.h 2008-01-04 09:31:40 UTC (rev 957) @@ -108,6 +108,16 @@ static std::string toString(const std::vector<int>& tokens); static void splitTokens(int* array, const string& tokens, int maxItems = -1) throw(); + template<typename T> + static TStringList getStrings(const T& t) { + const size_t n = sizeof(t) / sizeof(t[0]); + TStringList ret(n); + for(size_t i = 0; i < n; ++i) { + ret[i] = T_(t[i]); + } + return ret; + } + static int getIconIndex(const tstring& aFileName); static int getDirIconIndex() { return dirIconIndex; } static int getDirMaskedIndex() { return dirMaskedIndex; } Modified: dcplusplus/trunk/win32/po/dcpp-win32.pot =================================================================== --- dcplusplus/trunk/win32/po/dcpp-win32.pot 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/win32/po/dcpp-win32.pot 2008-01-04 09:31:40 UTC (rev 957) @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: dcpp-win32\n" +"Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: dcp...@li...\n" -"POT-Creation-Date: 2008-01-03 22:52+0100\n" +"POT-Creation-Date: 2008-01-04 10:23+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -21,6 +21,66 @@ msgid "Downloads" msgstr "" +#: win32/FavHubsFrame.cpp:32 +msgid "Auto connect / Name" +msgstr "" + +#: win32/FavHubsFrame.cpp:33 +msgid "Description" +msgstr "" + +#: win32/FavHubsFrame.cpp:34 +msgid "Nick" +msgstr "" + +#: win32/FavHubsFrame.cpp:35 +msgid "Password" +msgstr "" + +#: win32/FavHubsFrame.cpp:36 +msgid "Server" +msgstr "" + +#: win32/FavHubsFrame.cpp:37 +msgid "User Description" +msgstr "" + +#: win32/FavHubsFrame.cpp:71 win32/FavHubsFrame.cpp:113 +msgid "&Connect" +msgstr "" + +#: win32/FavHubsFrame.cpp:76 win32/FavHubsFrame.cpp:115 +msgid "&New..." +msgstr "" + +#: win32/FavHubsFrame.cpp:81 win32/FavHubsFrame.cpp:116 +msgid "&Properties" +msgstr "" + +#: win32/FavHubsFrame.cpp:86 win32/FavHubsFrame.cpp:117 +msgid "Move &Up" +msgstr "" + +#: win32/FavHubsFrame.cpp:91 win32/FavHubsFrame.cpp:118 +msgid "Move &Down" +msgstr "" + +#: win32/FavHubsFrame.cpp:96 win32/FavHubsFrame.cpp:120 +msgid "&Remove" +msgstr "" + +#: win32/FavHubsFrame.cpp:179 +msgid "Hub already exists as a favorite" +msgstr "" + +#: win32/FavHubsFrame.cpp:243 +msgid "Really remove?" +msgstr "" + +#: win32/FavHubsFrame.cpp:320 +msgid "Please enter a nickname in the settings dialog!" +msgstr "" + #: win32/DownloadsFrame.cpp:110 msgid "Waiting for slot" msgstr "" @@ -37,6 +97,11 @@ msgid "%1%/s" msgstr "" +#: win32/SplashWindow.cpp:78 +#, boost-format +msgid "Loading DC++, please wait... (%1%)" +msgstr "" + #: win32/AppearancePage.cpp:86 win32/AppearancePage.cpp:109 msgid "Default" msgstr "" Modified: dcplusplus/trunk/win32/stdafx.h =================================================================== --- dcplusplus/trunk/win32/stdafx.h 2008-01-03 21:59:28 UTC (rev 956) +++ dcplusplus/trunk/win32/stdafx.h 2008-01-04 09:31:40 UTC (rev 957) @@ -47,11 +47,14 @@ #define LOCALEDIR dcpp::Util::getLocalePath().c_str() #define PACKAGE "dcpp-win32" #define _(String) gettext(String) +#define gettext_noop(String) String +#define N_(String) gettext_noop (String) #define T_(String) Text::toT(gettext(String)) #ifdef UNICODE #define TF_(String) boost::wformat(Text::toT(gettext(String))) #define TFN_(String1,String2, N) boost::wformat(Text::toT(ngettext(String1, String2, N))) #else #define TF_(String) boost::format(Text::toT(gettext(String))) +#define TFN_(String1,String2, N) boost::format(Text::toT(ngettext(String1, String2, N))) #endif #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-03 21:59:31
|
Revision: 956 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=956&view=rev Author: arnetheduck Date: 2008-01-03 13:59:28 -0800 (Thu, 03 Jan 2008) Log Message: ----------- Add some more download frame stuff Modified Paths: -------------- dcplusplus/trunk/Compile.txt dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/QueueManager.h dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/win32/DownloadsFrame.cpp dcplusplus/trunk/win32/DownloadsFrame.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/TypedListView.h dcplusplus/trunk/win32/WindowsPage.cpp dcplusplus/trunk/win32/po/dcpp-win32.pot Added Paths: ----------- dcplusplus/trunk/win32/MainWindowFactory.cpp Modified: dcplusplus/trunk/Compile.txt =================================================================== --- dcplusplus/trunk/Compile.txt 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/Compile.txt 2008-01-03 21:59:28 UTC (rev 956) @@ -9,6 +9,9 @@ but if you want to experiment you can try the potentially slower sjlj. After installing gcc, you will need to go to the bin folder of your mingw installation and copy g++-dw2/sjlj.exe and gcc-dw2/sjlj.exe to g++.exe and gcc.exe respectively. + You will also need the gettext tools: gettext-0.16.1-1-bin.tar.bz2, gettext-0.16.1-1-dll.tar.bz2 and + libiconv-1.11-1-dll.tar.bz2. Extract and make sure they're in your PATH. + Note; Make sure gcc/g++ is in your path and before any cygwin installation. 1b) or install Microsoft Visual C++ 8.0 (I don't use it so there might be some compile problems) @@ -25,7 +28,7 @@ 3) Download HTML help workshop from http://msdn2.microsoft.com/en-us/library/ms670169.aspx. Copy the include and library files to the respective directories in the htmlhelp folder. Make sure hhc.exe is in your PATH. - + 4) Open a command prompt and type "scons" followed by some options: "tools=mingw" - Use mingw for building (default) "tools=default" - Use msvc for building (yes, the option value is strange) @@ -35,8 +38,6 @@ To see more options, type "scons -h". Tip: You can create a file custom.py and put your options in there. -If you get a linking error citing missing references on the first compile, run scons again. - Note; If you have problems, use google. It works for me. By the way, with doxygen, graphviz and some luck you can use the supplied doxygen configuration file @@ -65,5 +66,6 @@ In order to avoid future licensing issues, I ask you to give me copyright over any submitted code. If you don't like this policy, you are free to start your own distribution (as many have done), and if you're lucky it might become more popular than the original =). Please -state explicitly when submitting the patch that you give me copyright over the code if the submission is larger than trivial. +state explicitly when submitting the patch that you give me copyright over the code if the submission is larger +than trivial. Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/changelog.txt 2008-01-03 21:59:28 UTC (rev 956) @@ -8,6 +8,7 @@ * Fixed a crash with partial list browsing * Replaced homegrown i18n solution with gettext * Fixed an issue with nick encodings and nmdc connections (thanks stanislav maslovski) +* Added download view which shows per-file download information -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-03 21:59:28 UTC (rev 956) @@ -602,6 +602,25 @@ return matches; } +int64_t QueueManager::getPos(const string& target) throw() { + Lock l(cs); + QueueItem* qi = fileQueue.find(target); + if(qi) { + return qi->getDownloadedBytes(); + } + return -1; +} + +int64_t QueueManager::getSize(const string& target) throw() { + Lock l(cs); + QueueItem* qi = fileQueue.find(target); + if(qi) { + return qi->getSize(); + } + return -1; +} + + void QueueManager::move(const string& aSource, const string& aTarget) throw() { string target = Util::validateFileName(aTarget); if(aSource == target) Modified: dcplusplus/trunk/dcpp/QueueManager.h =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.h 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/dcpp/QueueManager.h 2008-01-03 21:59:28 UTC (rev 956) @@ -87,6 +87,9 @@ int matchListing(const DirectoryListing& dl) throw(); bool getTTH(const string& name, TTHValue& tth) throw(); + + int64_t getSize(const string& target) throw(); + int64_t getPos(const string& target) throw(); /** Move the target location of a queued item. Running items are silently ignored */ void move(const string& aSource, const string& aTarget) throw(); Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-01-03 21:59:28 UTC (rev 956) @@ -78,7 +78,7 @@ "UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", "DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients", "TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu", "MinSegmentSize", "FollowLinks", - "SendBloom", + "SendBloom", "OpenDownloads", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -274,6 +274,7 @@ setDefault(MIN_SEGMENT_SIZE, 1024); setDefault(FOLLOW_LINKS, false); setDefault(SEND_BLOOM, true); + setDefault(OPEN_DOWNLOADS, true); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/dcpp/SettingsManager.h =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.h 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/dcpp/SettingsManager.h 2008-01-03 21:59:28 UTC (rev 956) @@ -90,7 +90,7 @@ USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS, TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, MIN_SEGMENT_SIZE, FOLLOW_LINKS, - SEND_BLOOM, + SEND_BLOOM, OPEN_DOWNLOADS, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/win32/DownloadsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-03 21:59:28 UTC (rev 956) @@ -22,9 +22,11 @@ #include <dcpp/QueueItem.h> #include <dcpp/QueueManager.h> #include <dcpp/Download.h> +#include <dcpp/DownloadManager.h> #include "DownloadsFrame.h" #include "HoldRedraw.h" +#include "WinUtil.h" int DownloadsFrame::columnIndexes[] = { COLUMN_FILE, COLUMN_PATH, COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, COLUMN_SIZE }; int DownloadsFrame::columnSizes[] = { 200, 300, 150, 200, 125, 100}; @@ -46,8 +48,8 @@ downloads->setColumnWidths(WinUtil::splitTokens(SETTING(HUBFRAME_WIDTHS), columnSizes)); downloads->setSort(COLUMN_STATUS); downloads->setColor(WinUtil::textColor, WinUtil::bgColor); + downloads->setSmallImageList(WinUtil::fileImages); - downloads->onKeyDown(std::tr1::bind(&DownloadsFrame::handleKeyDown, this, _1)); downloads->onContextMenu(std::tr1::bind(&DownloadsFrame::handleContextMenu, this, _1)); } @@ -58,10 +60,14 @@ startup = false; onSpeaker(std::tr1::bind(&DownloadsFrame::handleSpeaker, this, _1, _2)); + + QueueManager::getInstance()->addListener(this); + DownloadManager::getInstance()->addListener(this); } DownloadsFrame::~DownloadsFrame() { - + QueueManager::getInstance()->removeListener(this); + DownloadManager::getInstance()->removeListener(this); } void DownloadsFrame::layout() { @@ -81,16 +87,22 @@ SettingsManager::getInstance()->set(SettingsManager::DOWNLOADSFRAME_WIDTHS, WinUtil::toString(downloads->getColumnWidths())); } -DownloadsFrame::DownloadInfo::DownloadInfo(const string& filename, int64_t size_) : path(filename), done(0), size(size), users(0) { - columns[COLUMN_FILE] = Text::toT(Util::getFileName(filename)); - columns[COLUMN_PATH] = Text::toT(Util::getFilePath(filename)); - columns[COLUMN_SIZE] = Text::toT(Util::toString(size)); +DownloadsFrame::DownloadInfo::DownloadInfo(const string& target, int64_t size_) : path(target), done(QueueManager::getInstance()->getPos(target)), size(size_), users(0) { + columns[COLUMN_FILE] = Text::toT(Util::getFileName(target)); + columns[COLUMN_PATH] = Text::toT(Util::getFilePath(target)); + columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(size)); + update(); } +int DownloadsFrame::DownloadInfo::getImage() const { + return WinUtil::getIconIndex(Text::toT(path)); +} + void DownloadsFrame::DownloadInfo::update(const DownloadsFrame::TickInfo& ti) { users = ti.users; - done = ti.done; // TODO Add done from queuemanager... + done = ti.done + QueueManager::getInstance()->getInstance()->getPos(ti.path); bps = ti.bps; + update(); } void DownloadsFrame::DownloadInfo::update() { @@ -99,19 +111,12 @@ columns[COLUMN_TIMELEFT].clear(); columns[COLUMN_SPEED].clear(); } else { - double timeleft = bps > 0 ? (size - done) / bps : 0; columns[COLUMN_STATUS] = str(TFN_("Downloading from %1% user", "Downloading from %1% users", users) % users); - columns[COLUMN_TIMELEFT] = Text::toT(Util::formatSeconds(static_cast<int64_t>(timeleft))); + columns[COLUMN_TIMELEFT] = Text::toT(Util::formatSeconds(static_cast<int64_t>(timeleft()))); columns[COLUMN_SPEED] = str(TF_("%1%/s") % Text::toT(Util::formatBytes(static_cast<int64_t>(bps)))); } } -bool DownloadsFrame::handleKeyDown(int c) { - switch(c) { - } - return false; -} - bool DownloadsFrame::handleContextMenu(SmartWin::ScreenCoordinate pt) { if (downloads->hasSelection()) { if(pt.x() == -1 && pt.y() == -1) { @@ -142,19 +147,26 @@ boost::scoped_ptr<TickInfo> ti(reinterpret_cast<TickInfo*>(lParam)); int i = find(ti->path); if(i == -1) { - // TODO get size - i = downloads->insert(new DownloadInfo(ti->path, 0)); + int64_t size = QueueManager::getInstance()->getSize(ti->path); + if(size == -1) { + return 0; + } + i = downloads->insert(new DownloadInfo(ti->path, size)); } DownloadInfo* di = downloads->getData(i); di->update(*ti); + downloads->update(i); } else if(wParam == SPEAKER_DISCONNECTED) { boost::scoped_ptr<string> path(reinterpret_cast<string*>(lParam)); int i = find(*path); if(i != -1) { DownloadInfo* di = downloads->getData(i); - di->users--; + if(--di->users == 0) { + di->bps = 0; + } di->update(); + downloads->update(i); } } else if(wParam == SPEAKER_REMOVED) { boost::scoped_ptr<string> path(reinterpret_cast<string*>(lParam)); @@ -170,6 +182,10 @@ std::vector<TickInfo*> dis; for(DownloadList::const_iterator i = l.begin(); i != l.end(); ++i) { Download* d = *i; + if(d->getType() != Transfer::TYPE_FILE) { + continue; + } + TickInfo* ti = 0; for(std::vector<TickInfo*>::iterator j = dis.begin(); j != dis.end(); ++j) { TickInfo* ti2 = *j; @@ -180,6 +196,7 @@ } if(!ti) { ti = new TickInfo(d->getPath()); + dis.push_back(ti); } ti->users++; ti->bps += d->getAverageSpeed(); Modified: dcplusplus/trunk/win32/DownloadsFrame.h =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-03 21:59:28 UTC (rev 956) @@ -20,7 +20,7 @@ #define DCPLUSPLUS_WIN32_DOWNLOADS_FRAME_H #include <dcpp/DownloadManagerListener.h> -#include <dcpp/ConnectionManagerListener.h> +#include <dcpp/QueueManagerListener.h> #include <dcpp/forward.h> #include <dcpp/ResourceManager.h> @@ -30,8 +30,8 @@ class DownloadsFrame : public StaticFrame<DownloadsFrame>, - private DownloadManagerListener, - private ConnectionManagerListener + public DownloadManagerListener, + public QueueManagerListener { public: enum Status { @@ -88,17 +88,22 @@ return columns[col]; } - int getImage() const { - return 0; - } + int getImage() const; static int compareItems(DownloadInfo* a, DownloadInfo* b, int col) { - return lstrcmpi(a->columns[col].c_str(), b->columns[col].c_str()); + switch(col) { + case COLUMN_STATUS: return compare(a->users, b->users); + case COLUMN_TIMELEFT: return compare(a->timeleft(), b->timeleft()); + case COLUMN_SPEED: return compare(a->bps, b->bps); + case COLUMN_SIZE: return compare(a->size, b->size); + default: return lstrcmpi(a->columns[col].c_str(), b->columns[col].c_str()); + } } void update(); void update(const TickInfo& ti); + int64_t timeleft() { return bps == 0 ? 0 : (size - done) / bps; } string path; int64_t done; int64_t size; @@ -119,7 +124,6 @@ int find(const string& path); - bool handleKeyDown(int c); bool handleContextMenu(SmartWin::ScreenCoordinate pt); LRESULT handleSpeaker(WPARAM wParam, LPARAM lParam); Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-01-03 21:59:28 UTC (rev 956) @@ -21,30 +21,18 @@ #include "MainWindow.h" #include "resource.h" -#include "SystemFrame.h" -#include "NotepadFrame.h" -#include "HubFrame.h" -#include "PublicHubsFrame.h" -#include "FavHubsFrame.h" -#include "QueueFrame.h" -#include "SearchFrame.h" -#include "ADLSearchFrame.h" -#include "SpyFrame.h" -#include "FinishedDLFrame.h" -#include "FinishedULFrame.h" #include "LineDlg.h" #include "HashProgressDlg.h" #include "SettingsDialog.h" #include "TextFrame.h" -#include "DirectoryListingFrame.h" -#include "PrivateFrame.h" #include "SingleInstance.h" -#include "StatsFrame.h" -#include "UsersFrame.h" -#include "WaitingUsersFrame.h" #include "AboutDlg.h" #include "UPnP.h" #include "TransferView.h" +#include "HubFrame.h" +#include "PrivateFrame.h" +#include "DirectoryListingFrame.h" +#include "SearchFrame.h" #include <dcpp/SettingsManager.h> #include <dcpp/ResourceManager.h> @@ -134,6 +122,7 @@ if(BOOLSETTING(OPEN_NOTEPAD)) postMessage(WM_COMMAND, IDC_NOTEPAD); if(BOOLSETTING(OPEN_PUBLIC)) postMessage(WM_COMMAND, IDC_PUBLIC_HUBS); if(BOOLSETTING(OPEN_FAVORITE_HUBS)) postMessage(WM_COMMAND, IDC_FAVORITE_HUBS); + if(BOOLSETTING(OPEN_DOWNLOADS)) postMessage(WM_COMMAND, IDC_DOWNLOADS); if (!WinUtil::isShift()) speak(AUTO_CONNECT); @@ -226,8 +215,9 @@ view->appendItem(IDC_NOTEPAD, TSTRING(MENU_NOTEPAD), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendItem(IDC_SYSTEM_LOG, TSTRING(MENU_SYSTEM_LOG), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendItem(IDC_NET_STATS, TSTRING(MENU_NETWORK_STATISTICS), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); view->appendItem(IDC_HASH_PROGRESS, TSTRING(MENU_HASH_PROGRESS), std::tr1::bind(&MainWindow::handleHashProgress, this)); - + WidgetMenuPtr window = mainMenu->appendPopup(CTSTRING(MENU_WINDOW)); window->appendItem(IDC_CLOSE_ALL_DISCONNECTED, TSTRING(MENU_CLOSE_DISCONNECTED), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); @@ -834,53 +824,6 @@ WinUtil::openFile(Text::toT(SETTING(DOWNLOAD_DIRECTORY))); } -void MainWindow::handleOpenWindow(unsigned id) { - switch (id) { - case IDC_PUBLIC_HUBS: - PublicHubsFrame::openWindow(getMDIParent()); - break; - case IDC_FAVORITE_HUBS: - FavHubsFrame::openWindow(getMDIParent()); - break; - case IDC_FAVUSERS: - UsersFrame::openWindow(getMDIParent()); - break; - case IDC_QUEUE: - QueueFrame::openWindow(getMDIParent()); - break; - case IDC_FINISHED_DL: - FinishedDLFrame::openWindow(getMDIParent()); - break; - case IDC_WAITING_USERS: - WaitingUsersFrame::openWindow(getMDIParent()); - break; - case IDC_FINISHED_UL: - FinishedULFrame::openWindow(getMDIParent()); - break; - case IDC_SEARCH: - SearchFrame::openWindow(getMDIParent()); - break; - case IDC_ADL_SEARCH: - ADLSearchFrame::openWindow(getMDIParent()); - break; - case IDC_SEARCH_SPY: - SpyFrame::openWindow(getMDIParent()); - break; - case IDC_NOTEPAD: - NotepadFrame::openWindow(getMDIParent()); - break; - case IDC_SYSTEM_LOG: - SystemFrame::openWindow(getMDIParent()); - break; - case IDC_NET_STATS: - StatsFrame::openWindow(getMDIParent()); - break; - default: - dcassert(0); - break; - } -} - void MainWindow::on(HttpConnectionListener::Complete, HttpConnection* /*aConn*/, const string&) throw() { try { SimpleXML xml; Added: dcplusplus/trunk/win32/MainWindowFactory.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindowFactory.cpp (rev 0) +++ dcplusplus/trunk/win32/MainWindowFactory.cpp 2008-01-03 21:59:28 UTC (rev 956) @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "stdafx.h" + +#include "MainWindow.h" + +#include "ADLSearchFrame.h" +#include "DownloadsFrame.h" +#include "FavHubsFrame.h" +#include "FinishedDLFrame.h" +#include "FinishedULFrame.h" +#include "NotepadFrame.h" +#include "PublicHubsFrame.h" +#include "QueueFrame.h" +#include "SearchFrame.h" +#include "SpyFrame.h" +#include "StatsFrame.h" +#include "SystemFrame.h" +#include "UsersFrame.h" +#include "WaitingUsersFrame.h" + +void MainWindow::handleOpenWindow(unsigned id) { + switch (id) { + case IDC_PUBLIC_HUBS: + PublicHubsFrame::openWindow(getMDIParent()); + break; + case IDC_FAVORITE_HUBS: + FavHubsFrame::openWindow(getMDIParent()); + break; + case IDC_FAVUSERS: + UsersFrame::openWindow(getMDIParent()); + break; + case IDC_QUEUE: + QueueFrame::openWindow(getMDIParent()); + break; + case IDC_FINISHED_DL: + FinishedDLFrame::openWindow(getMDIParent()); + break; + case IDC_WAITING_USERS: + WaitingUsersFrame::openWindow(getMDIParent()); + break; + case IDC_FINISHED_UL: + FinishedULFrame::openWindow(getMDIParent()); + break; + case IDC_SEARCH: + SearchFrame::openWindow(getMDIParent()); + break; + case IDC_ADL_SEARCH: + ADLSearchFrame::openWindow(getMDIParent()); + break; + case IDC_SEARCH_SPY: + SpyFrame::openWindow(getMDIParent()); + break; + case IDC_NOTEPAD: + NotepadFrame::openWindow(getMDIParent()); + break; + case IDC_SYSTEM_LOG: + SystemFrame::openWindow(getMDIParent()); + break; + case IDC_NET_STATS: + StatsFrame::openWindow(getMDIParent()); + break; + case IDC_DOWNLOADS: + DownloadsFrame::openWindow(getMDIParent()); + break; + default: + dcassert(0); + break; + } +} Modified: dcplusplus/trunk/win32/TypedListView.h =================================================================== --- dcplusplus/trunk/win32/TypedListView.h 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/win32/TypedListView.h 2008-01-03 21:59:28 UTC (rev 956) @@ -112,9 +112,7 @@ } void update(int i) { - unsigned k = this->getColumnCount(); - for(unsigned j = 0; j < k; ++j) - ListView_SetItemText(this->handle(), i, j, LPSTR_TEXTCALLBACK); + redraw(i, i); } void update(ContentType* item) { int i = find(item); if(i != -1) update(i); } Modified: dcplusplus/trunk/win32/WindowsPage.cpp =================================================================== --- dcplusplus/trunk/win32/WindowsPage.cpp 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/win32/WindowsPage.cpp 2008-01-03 21:59:28 UTC (rev 956) @@ -45,6 +45,7 @@ { SettingsManager::OPEN_NOTEPAD, ResourceManager::NOTEPAD }, { SettingsManager::OPEN_PUBLIC, ResourceManager::PUBLIC_HUBS }, { SettingsManager::OPEN_FAVORITE_HUBS, ResourceManager::FAVORITE_HUBS }, + { SettingsManager::OPEN_DOWNLOADS, ResourceManager::DOWNLOADS }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } }; Modified: dcplusplus/trunk/win32/po/dcpp-win32.pot =================================================================== --- dcplusplus/trunk/win32/po/dcpp-win32.pot 2008-01-03 19:21:30 UTC (rev 955) +++ dcplusplus/trunk/win32/po/dcpp-win32.pot 2008-01-03 21:59:28 UTC (rev 956) @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: dcpp-win32\n" "Report-Msgid-Bugs-To: dcp...@li...\n" -"POT-Creation-Date: 2008-01-03 20:12+0100\n" +"POT-Creation-Date: 2008-01-03 22:52+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -17,22 +17,22 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#: win32/DownloadsFrame.cpp:36 +#: win32/MainWindow.cpp:218 win32/DownloadsFrame.cpp:38 msgid "Downloads" msgstr "" -#: win32/DownloadsFrame.cpp:98 +#: win32/DownloadsFrame.cpp:110 msgid "Waiting for slot" msgstr "" -#: win32/DownloadsFrame.cpp:103 +#: win32/DownloadsFrame.cpp:114 #, boost-format msgid "Downloading from %1% user" msgid_plural "Downloading from %1% users" msgstr[0] "" msgstr[1] "" -#: win32/DownloadsFrame.cpp:105 +#: win32/DownloadsFrame.cpp:116 #, boost-format msgid "%1%/s" msgstr "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-03 19:44:06
|
Revision: 123 http://adchpp.svn.sourceforge.net/adchpp/?rev=123&view=rev Author: arnetheduck Date: 2008-01-03 11:43:59 -0800 (Thu, 03 Jan 2008) Log Message: ----------- fix npe Modified Paths: -------------- adchpp/trunk/adchpp/ManagedSocket.cpp adchpp/trunk/adchpp/SocketManager.cpp Modified: adchpp/trunk/adchpp/ManagedSocket.cpp =================================================================== --- adchpp/trunk/adchpp/ManagedSocket.cpp 2008-01-03 15:51:09 UTC (rev 122) +++ adchpp/trunk/adchpp/ManagedSocket.cpp 2008-01-03 19:43:59 UTC (rev 123) @@ -32,9 +32,7 @@ FastMutex ManagedSocket::writeMutex; ManagedSocket::ManagedSocket() throw() : overFlow(0), disc(0) -#ifdef _WIN32 -, writeBuf(0) -#else +#ifndef _WIN32 , blocked(false) #endif { Modified: adchpp/trunk/adchpp/SocketManager.cpp =================================================================== --- adchpp/trunk/adchpp/SocketManager.cpp 2008-01-03 15:51:09 UTC (rev 122) +++ adchpp/trunk/adchpp/SocketManager.cpp 2008-01-03 19:43:59 UTC (rev 123) @@ -322,8 +322,7 @@ DWORD x = 0; ms->writeBuf.push_back(BufferPtr(new Buffer(ACCEPT_BUF_SIZE))); - ms->writeBuf.back()->resize(ACCEPT_BUF_SIZE); - + MSOverlapped* overlapped = pool.get(); *overlapped = MSOverlapped(MSOverlapped::ACCEPT_DONE, ms); @@ -438,7 +437,7 @@ return; } - ms->wsabuf->resize(sizeof(WSABUF) * ms->writeBuf.size()); + ms->wsabuf = BufferPtr(new Buffer(sizeof(WSABUF) * ms->writeBuf.size())); for(size_t i = 0; i < ms->writeBuf.size(); ++i) { WSABUF wsa = { (u_long)ms->writeBuf[i]->size(), (char*)ms->writeBuf[i]->data() }; memcpy(ms->wsabuf->data() + i * sizeof(WSABUF), &wsa, sizeof(WSABUF)); @@ -459,6 +458,7 @@ void handleWriteDone(const ManagedSocketPtr& ms, DWORD bytes) throw() { ms->completeWrite(ms->writeBuf, bytes); + ms->wsabuf = BufferPtr(); } void failWrite(const ManagedSocketPtr& ms, int error) throw() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-03 19:21:34
|
Revision: 955 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=955&view=rev Author: arnetheduck Date: 2008-01-03 11:21:30 -0800 (Thu, 03 Jan 2008) Log Message: ----------- Start work on a downloadsframe Modified Paths: -------------- dcplusplus/trunk/SConstruct dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/ConnectionManager.cpp dcplusplus/trunk/dcpp/DCPlusPlus.h dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/dcpp/UserConnection.cpp dcplusplus/trunk/dcpp/stdinc.h dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetCoolbar.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetListView.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMDIFrame.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetRadioButton.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetRichTextBox.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetWindow.h dcplusplus/trunk/win32/DirectoryListingFrame.h dcplusplus/trunk/win32/FinishedFrameBase.h dcplusplus/trunk/win32/HubFrame.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/PublicHubsFrame.h dcplusplus/trunk/win32/QueueFrame.h dcplusplus/trunk/win32/SearchFrame.h dcplusplus/trunk/win32/StaticFrame.h dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/TransferView.h dcplusplus/trunk/win32/TypedListView.h dcplusplus/trunk/win32/TypedTreeView.h dcplusplus/trunk/win32/UsersFrame.h dcplusplus/trunk/win32/WinUtil.cpp dcplusplus/trunk/win32/WinUtil.h dcplusplus/trunk/win32/main.cpp dcplusplus/trunk/win32/stdafx.h Added Paths: ----------- dcplusplus/trunk/win32/DownloadsFrame.cpp dcplusplus/trunk/win32/DownloadsFrame.h dcplusplus/trunk/win32/po/dcpp-win32.pot Removed Paths: ------------- dcplusplus/trunk/dcpp/po/dcpp.pot Modified: dcplusplus/trunk/SConstruct =================================================================== --- dcplusplus/trunk/SConstruct 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/SConstruct 2008-01-03 19:21:30 UTC (rev 955) @@ -156,9 +156,10 @@ mo_bld = Builder (action = Action([mo_args], 'Compiling message catalog $TARGET from $SOURCES')) env.Append(BUILDERS = {'MoBuild' : mo_bld}) -pot_args = ['xgettext','--from-code=UTF-8', '--foreign-user', '--package-name=$PACKAGE', +pot_args = ['xgettext', '--from-code=UTF-8', '--foreign-user', '--package-name=$PACKAGE', '--copyright-holder=Jacek Sieka', '--msgid-bugs-address=dcp...@li...', - '--no-wrap', '--keyword=_', '--keyword=T_', '--output=$TARGET', '$SOURCES'] + '--no-wrap', '--keyword=_', '--keyword=T_', '--keyword=TF_', '--keyword=TFN_:1,2', + '--keyword=F_', '--boost', '--output=$TARGET', '$SOURCES'] pot_bld = Builder (action = Action([pot_args], 'Extracting messages to $TARGET from $SOURCES')) env.Append(BUILDERS = {'PotBuild' : pot_bld}) Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/changelog.txt 2008-01-03 19:21:30 UTC (rev 955) @@ -7,7 +7,8 @@ * [ADC] Implemented test version of bloom filters which will dramatically reduce hub bandwidth usage for TTH searches * Fixed a crash with partial list browsing * Replaced homegrown i18n solution with gettext -§ +* Fixed an issue with nick encodings and nmdc connections (thanks stanislav maslovski) + -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) * Use system header arrows on common controls 6+ (thanks poy) Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -423,9 +423,12 @@ } aSource->setToken(i.first); aSource->setHubUrl(i.second); + aSource->setEncoding(ClientManager::getInstance()->findHubEncoding(i.second)); } - CID cid = ClientManager::getInstance()->makeCid(aNick, aSource->getHubUrl()); + string nick = Text::toUtf8(aNick, aSource->getEncoding()); + CID cid = ClientManager::getInstance()->makeCid(nick, aSource->getHubUrl()); + // First, we try looking in the pending downloads...hopefully it's one of them... { Lock l(cs); @@ -445,7 +448,7 @@ aSource->setUser(ClientManager::getInstance()->findUser(cid)); if(!aSource->getUser() || !ClientManager::getInstance()->isOnline(aSource->getUser())) { - dcdebug("CM::onMyNick Incoming connection from unknown user %s\n", aNick.c_str()); + dcdebug("CM::onMyNick Incoming connection from unknown user %s\n", nick.c_str()); putConnection(aSource); return; } Modified: dcplusplus/trunk/dcpp/DCPlusPlus.h =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/dcpp/DCPlusPlus.h 2008-01-03 19:21:30 UTC (rev 955) @@ -171,7 +171,8 @@ #ifdef BUILDING_DCPP #define PACKAGE "dcpp" #define LOCALEDIR Util::getLocalePath().c_str() -#define _(String) dgettext(PACKAGE, String) +#define _(String) dgettext(PACKAGE, String) +#define F_(String) boost::format(dgettext(PACKAGE, String)) #endif } // namespace dcpp Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.cpp 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -738,8 +738,9 @@ void NmdcHub::connectToMe(const OnlineUser& aUser) { checkstate(); dcdebug("NmdcHub::connectToMe %s\n", aUser.getIdentity().getNick().c_str()); - ConnectionManager::getInstance()->nmdcExpect(aUser.getIdentity().getNick(), getMyNick(), getHubUrl()); - send("$ConnectToMe " + fromUtf8(aUser.getIdentity().getNick()) + " " + getLocalIp() + ":" + Util::toString(ConnectionManager::getInstance()->getPort()) + "|"); + string nick = fromUtf8(aUser.getIdentity().getNick()); + ConnectionManager::getInstance()->nmdcExpect(nick, getMyNick(), getHubUrl()); + send("$ConnectToMe " + nick + " " + getLocalIp() + ":" + Util::toString(ConnectionManager::getInstance()->getPort()) + "|"); } void NmdcHub::revConnectToMe(const OnlineUser& aUser) { Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -47,7 +47,7 @@ "LogFilePrivateChat", "LogFileStatus", "LogFileUpload", "LogFileDownload", "LogFileSystem", "LogFormatSystem", "LogFormatStatus", "DirectoryListingFrameOrder", "DirectoryListingFrameWidths", "TLSPrivateKeyFile", "TLSCertificateFile", "TLSTrustedCertificatesPath", "BeepFile", - "Language", + "Language", "DownloadsFrameOrder", "DownloadsFrameWidth", "SENTRY", // Ints "IncomingConnections", "InPort", "Slots", "AutoFollow", "ClearSearch", Modified: dcplusplus/trunk/dcpp/SettingsManager.h =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/dcpp/SettingsManager.h 2008-01-03 19:21:30 UTC (rev 955) @@ -58,7 +58,7 @@ LOG_FILE_PRIVATE_CHAT, LOG_FILE_STATUS, LOG_FILE_UPLOAD, LOG_FILE_DOWNLOAD, LOG_FILE_SYSTEM, LOG_FORMAT_SYSTEM, LOG_FORMAT_STATUS, DIRECTORLISTINGFRAME_ORDER, DIRECTORLISTINGFRAME_WIDTHS, TLS_PRIVATE_KEY_FILE, TLS_CERTIFICATE_FILE, TLS_TRUSTED_CERTIFICATES_PATH, BEEPFILE, - LANGUAGE, + LANGUAGE, DOWNLOADSFRAME_ORDER, DOWNLOADSFRAME_WIDTHS, STR_LAST }; enum IntSetting { INT_FIRST = STR_LAST + 1, @@ -90,7 +90,7 @@ USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS, TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, MIN_SEGMENT_SIZE, FOLLOW_LINKS, - SEND_BLOOM, + SEND_BLOOM, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/dcpp/UserConnection.cpp =================================================================== --- dcplusplus/trunk/dcpp/UserConnection.cpp 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/dcpp/UserConnection.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -75,7 +75,7 @@ if(cmd == "$MyNick") { if(!param.empty()) - fire(UserConnectionListener::MyNick(), this, Text::toUtf8(param, encoding)); + fire(UserConnectionListener::MyNick(), this, param); } else if(cmd == "$Direction") { x = param.find(" "); if(x != string::npos) { Deleted: dcplusplus/trunk/dcpp/po/dcpp.pot =================================================================== --- dcplusplus/trunk/dcpp/po/dcpp.pot 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/dcpp/po/dcpp.pot 2008-01-03 19:21:30 UTC (rev 955) @@ -1,22 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Jacek Sieka -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: dcpp\n" -"Report-Msgid-Bugs-To: dcp...@li...\n" -"POT-Creation-Date: 2007-12-29 13:55+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL...@li...>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: dcpp/DCPlusPlus.cpp:92 -#, c-format -msgid "test" -msgstr "" Modified: dcplusplus/trunk/dcpp/stdinc.h =================================================================== --- dcplusplus/trunk/dcpp/stdinc.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/dcpp/stdinc.h 2008-01-03 19:21:30 UTC (rev 955) @@ -119,6 +119,8 @@ #include <limits> #include <libintl.h> +#include <boost/format.hpp> + #ifdef _STLPORT_VERSION #include <unordered_map> Modified: dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h 2008-01-03 19:21:30 UTC (rev 955) @@ -99,7 +99,7 @@ /// Creates a Rich Edit Control and returns a pointer to it. /** DON'T delete the returned pointer!!! */ - WidgetRichTextBoxPtr createRichTextBox( const typename WidgetRichTextBox::Seed & cs = WidgetRichTextBox::getDefaultSeed() ) + WidgetRichTextBoxPtr createRichTextBox( const typename WidgetRichTextBox::Seed & cs = WidgetRichTextBox::Seed() ) { return WidgetCreator< WidgetRichTextBox >::create( this, cs ); } @@ -138,7 +138,7 @@ /// Creates a Cool Bar and returns a pointer to it. /** DON'T delete the returned pointer!!! */ - WidgetCoolbarPtr createCoolbar( const typename WidgetCoolbar::Seed & cs = WidgetCoolbar::getDefaultSeed() ) + WidgetCoolbarPtr createCoolbar( const typename WidgetCoolbar::Seed & cs = WidgetCoolbar::Seed() ) { return WidgetCreator< WidgetCoolbar >::create( this, cs ); } Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetCoolbar.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetCoolbar.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetCoolbar.h 2008-01-03 19:21:30 UTC (rev 955) @@ -114,9 +114,6 @@ Seed(); }; - /// Default values for creation - static const Seed & getDefaultSeed(); - /// ComboBox object type. typedef WidgetComboBox::ObjectType WidgetComboBoxPtr; Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetListView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetListView.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetListView.h 2008-01-03 19:21:30 UTC (rev 955) @@ -127,9 +127,6 @@ SORT_FLOAT }; - /// Default values for creation - static const Seed & getDefaultSeed(); - // Aspect expectation implementation static const Message & getSelectionChangedMessage(); @@ -478,7 +475,7 @@ * directly. <br> * Only if you DERIVE from class you should call this function directly. */ - void create( const Seed & cs = getDefaultSeed() ); + void create( const Seed & cs = Seed() ); // Constructor Taking pointer to parent explicit WidgetListView( SmartWin::Widget * parent ); Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMDIFrame.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMDIFrame.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMDIFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -101,7 +101,7 @@ * is ready, createInvisibleWindow() lets you add Widgets while * the main Widget is not visible. Of course you could do code like <br> * - * Seed defInvisible = getDefaultSeed(); <br> + * Seed defInvisible = Seed(); <br> * defInvisible.style= defInvisible.style & ( ~ WS_VISIBLE ); <br> * createWindow( defInvisible ); <br> * Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetRadioButton.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetRadioButton.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetRadioButton.h 2008-01-03 19:21:30 UTC (rev 955) @@ -73,9 +73,6 @@ Seed(const SmartUtil::tstring& caption_ = SmartUtil::tstring()); }; - /// Default values for creation - static const Seed & getDefaultSeed(); - /// Returns true if the RadioButton is selected /** Call this function to determine if the RadioButton is selected or not, * returns true if it is selected Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetRichTextBox.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetRichTextBox.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetRichTextBox.h 2008-01-03 19:21:30 UTC (rev 955) @@ -85,15 +85,12 @@ Seed(); }; - /// Default values for creation - static const Seed & getDefaultSeed(); - /// Actually creates the Rich Edit Control /** You should call WidgetFactory::createRichTextBox if you instantiate class * directly. <br> * Only if you DERIVE from class you should call this function directly. */ - void create( const Seed & cs = getDefaultSeed() ); + void create( const Seed & cs = Seed() ); /// Sets the background color of the WidgetRichTextBox /** Call this function to alter the background color of the WidgetRichEdit. <br> Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetWindow.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetWindow.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetWindow.h 2008-01-03 19:21:30 UTC (rev 955) @@ -116,7 +116,7 @@ * is ready, createInvisibleWindow() lets you add Widgets while * the main Widget is not visible. Of course you could do code like <br> * - * Seed defInvisible = getDefaultSeed(); <br> + * Seed defInvisible = Seed(); <br> * defInvisible.style= defInvisible.style & ( ~ WS_VISIBLE ); <br> * createWindow( defInvisible ); <br> * @@ -188,7 +188,7 @@ /// Actually creates the window /** This one creates the window. It is implemented in case somebody wants to use * createWindow() without parameters. If it wasn't declared, the compiler would - * call WidgetWindow::create with WidgetWindow::getDefaultSeed, which wouldn't + * call WidgetWindow::create with WidgetWindow::Seed, which wouldn't * create a child window. */ void createWindow( const Seed& cs = Seed() ) Modified: dcplusplus/trunk/win32/DirectoryListingFrame.h =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/DirectoryListingFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -128,10 +128,10 @@ tstring columns[COLUMN_LAST]; }; - typedef TypedTreeView<DirectoryListingFrame, ItemInfo> WidgetDirs; + typedef TypedTreeView<ItemInfo> WidgetDirs; typedef WidgetDirs* WidgetDirsPtr; WidgetDirsPtr dirs; - typedef TypedListView<DirectoryListingFrame, ItemInfo> WidgetFiles; + typedef TypedListView<ItemInfo> WidgetFiles; typedef WidgetFiles* WidgetFilesPtr; WidgetFilesPtr files; Added: dcplusplus/trunk/win32/DownloadsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.cpp (rev 0) +++ dcplusplus/trunk/win32/DownloadsFrame.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "stdafx.h" + +#include <dcpp/SettingsManager.h> +#include <dcpp/QueueItem.h> +#include <dcpp/QueueManager.h> +#include <dcpp/Download.h> + +#include "DownloadsFrame.h" +#include "HoldRedraw.h" + +int DownloadsFrame::columnIndexes[] = { COLUMN_FILE, COLUMN_PATH, COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, COLUMN_SIZE }; +int DownloadsFrame::columnSizes[] = { 200, 300, 150, 200, 125, 100}; + +static ResourceManager::Strings columnNames[] = { ResourceManager::FILENAME, ResourceManager::PATH, + ResourceManager::STATUS, ResourceManager::TIME_LEFT, ResourceManager::SPEED, ResourceManager::SIZE }; + +DownloadsFrame::DownloadsFrame(SmartWin::WidgetTabView* mdiParent) : + BaseType(mdiParent, T_("Downloads")), + downloads(0), + startup(true) +{ + { + downloads = SmartWin::WidgetCreator<WidgetDownloads>::create(this, WinUtil::Seeds::listView); + addWidget(downloads); + + downloads->createColumns(ResourceManager::getInstance()->getStrings(columnNames)); + downloads->setColumnOrder(WinUtil::splitTokens(SETTING(HUBFRAME_ORDER), columnIndexes)); + downloads->setColumnWidths(WinUtil::splitTokens(SETTING(HUBFRAME_WIDTHS), columnSizes)); + downloads->setSort(COLUMN_STATUS); + downloads->setColor(WinUtil::textColor, WinUtil::bgColor); + + downloads->onKeyDown(std::tr1::bind(&DownloadsFrame::handleKeyDown, this, _1)); + downloads->onContextMenu(std::tr1::bind(&DownloadsFrame::handleContextMenu, this, _1)); + } + + initStatus(); + + layout(); + + startup = false; + + onSpeaker(std::tr1::bind(&DownloadsFrame::handleSpeaker, this, _1, _2)); +} + +DownloadsFrame::~DownloadsFrame() { + +} + +void DownloadsFrame::layout() { + SmartWin::Rectangle r(SmartWin::Point(0, 0), getClientAreaSize()); + + layoutStatus(r); + + downloads->setBounds(r); +} + +bool DownloadsFrame::preClosing() { + return true; +} + +void DownloadsFrame::postClosing() { + SettingsManager::getInstance()->set(SettingsManager::DOWNLOADSFRAME_ORDER, WinUtil::toString(downloads->getColumnOrder())); + SettingsManager::getInstance()->set(SettingsManager::DOWNLOADSFRAME_WIDTHS, WinUtil::toString(downloads->getColumnWidths())); +} + +DownloadsFrame::DownloadInfo::DownloadInfo(const string& filename, int64_t size_) : path(filename), done(0), size(size), users(0) { + columns[COLUMN_FILE] = Text::toT(Util::getFileName(filename)); + columns[COLUMN_PATH] = Text::toT(Util::getFilePath(filename)); + columns[COLUMN_SIZE] = Text::toT(Util::toString(size)); +} + +void DownloadsFrame::DownloadInfo::update(const DownloadsFrame::TickInfo& ti) { + users = ti.users; + done = ti.done; // TODO Add done from queuemanager... + bps = ti.bps; +} + +void DownloadsFrame::DownloadInfo::update() { + if(users == 0) { + columns[COLUMN_STATUS] = T_("Waiting for slot"); + columns[COLUMN_TIMELEFT].clear(); + columns[COLUMN_SPEED].clear(); + } else { + double timeleft = bps > 0 ? (size - done) / bps : 0; + columns[COLUMN_STATUS] = str(TFN_("Downloading from %1% user", "Downloading from %1% users", users) % users); + columns[COLUMN_TIMELEFT] = Text::toT(Util::formatSeconds(static_cast<int64_t>(timeleft))); + columns[COLUMN_SPEED] = str(TF_("%1%/s") % Text::toT(Util::formatBytes(static_cast<int64_t>(bps)))); + } +} + +bool DownloadsFrame::handleKeyDown(int c) { + switch(c) { + } + return false; +} + +bool DownloadsFrame::handleContextMenu(SmartWin::ScreenCoordinate pt) { + if (downloads->hasSelection()) { + if(pt.x() == -1 && pt.y() == -1) { + pt = downloads->getContextMenuPos(); + } + + WidgetMenuPtr menu = createMenu(true); + + menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + + return true; + } + return false; +} + +int DownloadsFrame::find(const string& path) { + for(size_t i = 0; i < downloads->size(); ++i) { + DownloadInfo* di = downloads->getData(i); + if(Util::stricmp(di->path, path) == 0) { + return i; + } + } + return -1; +} + +LRESULT DownloadsFrame::handleSpeaker(WPARAM wParam, LPARAM lParam) { + if(wParam == SPEAKER_TICK) { + boost::scoped_ptr<TickInfo> ti(reinterpret_cast<TickInfo*>(lParam)); + int i = find(ti->path); + if(i == -1) { + // TODO get size + i = downloads->insert(new DownloadInfo(ti->path, 0)); + } + DownloadInfo* di = downloads->getData(i); + di->update(*ti); + } else if(wParam == SPEAKER_DISCONNECTED) { + boost::scoped_ptr<string> path(reinterpret_cast<string*>(lParam)); + + int i = find(*path); + if(i != -1) { + DownloadInfo* di = downloads->getData(i); + di->users--; + di->update(); + } + } else if(wParam == SPEAKER_REMOVED) { + boost::scoped_ptr<string> path(reinterpret_cast<string*>(lParam)); + int i = find(*path); + if(i != -1) { + downloads->erase(i); + } + } + return 0; +} + +void DownloadsFrame::on(DownloadManagerListener::Tick, const DownloadList& l) throw() { + std::vector<TickInfo*> dis; + for(DownloadList::const_iterator i = l.begin(); i != l.end(); ++i) { + Download* d = *i; + TickInfo* ti = 0; + for(std::vector<TickInfo*>::iterator j = dis.begin(); j != dis.end(); ++j) { + TickInfo* ti2 = *j; + if(Util::stricmp(ti2->path, d->getPath()) == 0) { + ti = ti2; + break; + } + } + if(!ti) { + ti = new TickInfo(d->getPath()); + } + ti->users++; + ti->bps += d->getAverageSpeed(); + ti->done += d->getPos(); + } + + for(std::vector<TickInfo*>::iterator i = dis.begin(); i != dis.end(); ++i) { + speak(SPEAKER_TICK, reinterpret_cast<LPARAM>(*i)); + } +} + +void DownloadsFrame::on(DownloadManagerListener::Complete, Download* d) throw() { + speak(SPEAKER_DISCONNECTED, reinterpret_cast<LPARAM>(new string(d->getPath()))); +} + +void DownloadsFrame::on(DownloadManagerListener::Failed, Download* d, const string&) throw() { + speak(SPEAKER_DISCONNECTED, reinterpret_cast<LPARAM>(new string(d->getPath()))); +} + +void DownloadsFrame::on(QueueManagerListener::Removed, QueueItem* qi) throw() { + speak(SPEAKER_REMOVED, reinterpret_cast<LPARAM>(new string(qi->getTarget()))); +} Added: dcplusplus/trunk/win32/DownloadsFrame.h =================================================================== --- dcplusplus/trunk/win32/DownloadsFrame.h (rev 0) +++ dcplusplus/trunk/win32/DownloadsFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef DCPLUSPLUS_WIN32_DOWNLOADS_FRAME_H +#define DCPLUSPLUS_WIN32_DOWNLOADS_FRAME_H + +#include <dcpp/DownloadManagerListener.h> +#include <dcpp/ConnectionManagerListener.h> +#include <dcpp/forward.h> +#include <dcpp/ResourceManager.h> + +#include "TypedListView.h" +#include "StaticFrame.h" +#include "AspectSpeaker.h" + +class DownloadsFrame : + public StaticFrame<DownloadsFrame>, + private DownloadManagerListener, + private ConnectionManagerListener +{ +public: + enum Status { + STATUS_STATUS, + STATUS_LAST + }; + static const unsigned ICON_RESOURCE = IDR_QUEUE; + +protected: + typedef StaticFrame<DownloadsFrame> BaseType; + friend class StaticFrame<DownloadsFrame>; + friend class MDIChildFrame<DownloadsFrame>; + + DownloadsFrame(SmartWin::WidgetTabView* mdiParent); + virtual ~DownloadsFrame(); + + void layout(); + + bool preClosing(); + void postClosing(); + +private: + enum { + COLUMN_FIRST, + COLUMN_FILE = COLUMN_FIRST, + COLUMN_PATH, + COLUMN_STATUS, + COLUMN_TIMELEFT, + COLUMN_SPEED, + COLUMN_SIZE, + COLUMN_LAST + }; + + enum { + SPEAKER_DISCONNECTED, + SPEAKER_REMOVED, + SPEAKER_TICK + }; + + struct TickInfo { + TickInfo(const string& path_) : path(path_), done(0), bps(0), users(0) { } + + string path; + int64_t done; + double bps; + int users; + }; + + class DownloadInfo { + public: + DownloadInfo(const string& filename, int64_t size); + + const tstring& getText(int col) const { + return columns[col]; + } + + int getImage() const { + return 0; + } + + static int compareItems(DownloadInfo* a, DownloadInfo* b, int col) { + return lstrcmpi(a->columns[col].c_str(), b->columns[col].c_str()); + } + + void update(); + void update(const TickInfo& ti); + + string path; + int64_t done; + int64_t size; + double bps; + int users; + + tstring columns[COLUMN_LAST]; + }; + + typedef TypedListView<DownloadInfo> WidgetDownloads; + typedef WidgetDownloads* WidgetDownloadsPtr; + WidgetDownloadsPtr downloads; + + static int columnSizes[COLUMN_LAST]; + static int columnIndexes[COLUMN_LAST]; + + bool startup; + + int find(const string& path); + + bool handleKeyDown(int c); + bool handleContextMenu(SmartWin::ScreenCoordinate pt); + LRESULT handleSpeaker(WPARAM wParam, LPARAM lParam); + + virtual void on(DownloadManagerListener::Tick, const DownloadList&) throw(); + virtual void on(DownloadManagerListener::Complete, Download*) throw(); + virtual void on(DownloadManagerListener::Failed, Download*, const string&) throw(); + + virtual void on(QueueManagerListener::Removed, QueueItem*) throw(); +}; + +#endif Modified: dcplusplus/trunk/win32/FinishedFrameBase.h =================================================================== --- dcplusplus/trunk/win32/FinishedFrameBase.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/FinishedFrameBase.h 2008-01-03 19:21:30 UTC (rev 955) @@ -173,7 +173,7 @@ tstring columns[COLUMN_LAST]; }; - typedef TypedListView<T, ItemInfo> WidgetItems; + typedef TypedListView<ItemInfo> WidgetItems; typedef WidgetItems* WidgetItemsPtr; WidgetItemsPtr items; Modified: dcplusplus/trunk/win32/HubFrame.h =================================================================== --- dcplusplus/trunk/win32/HubFrame.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/HubFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -149,7 +149,7 @@ WidgetVPanedPtr paned; WidgetCheckBoxPtr showUsers; - typedef TypedListView<HubFrame, UserInfo, false> WidgetUsers; + typedef TypedListView<UserInfo, false> WidgetUsers; typedef WidgetUsers* WidgetUsersPtr; WidgetUsersPtr users; Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -59,6 +59,7 @@ #include <dcpp/ShareManager.h> #include <dcpp/QueueManager.h> #include <dcpp/ClientManager.h> +#include <dcpp/Download.h> MainWindow::MainWindow() : WidgetFactory<SmartWin::WidgetWindow>(0), Modified: dcplusplus/trunk/win32/PublicHubsFrame.h =================================================================== --- dcplusplus/trunk/win32/PublicHubsFrame.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/PublicHubsFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -94,7 +94,7 @@ tstring columns[COLUMN_LAST]; }; - typedef TypedListView<PublicHubsFrame, HubInfo> WidgetHubs; + typedef TypedListView<HubInfo> WidgetHubs; typedef WidgetHubs* WidgetHubsPtr; WidgetHubsPtr hubs; Modified: dcplusplus/trunk/win32/QueueFrame.h =================================================================== --- dcplusplus/trunk/win32/QueueFrame.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/QueueFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -204,11 +204,11 @@ TaskQueue tasks; - typedef TypedTreeView<QueueFrame, DirItemInfo> WidgetDirs; + typedef TypedTreeView<DirItemInfo> WidgetDirs; typedef WidgetDirs* WidgetDirsPtr; WidgetDirsPtr dirs; - typedef TypedListView<QueueFrame, QueueItemInfo, false> WidgetFiles; + typedef TypedListView<QueueItemInfo, false> WidgetFiles; typedef WidgetFiles* WidgetFilesPtr; WidgetFilesPtr files; WidgetVPanedPtr paned; Modified: dcplusplus/trunk/win32/SearchFrame.h =================================================================== --- dcplusplus/trunk/win32/SearchFrame.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/SearchFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -171,13 +171,13 @@ bool onlyFree; WidgetStaticPtr hubsLabel; - typedef TypedListView<SearchFrame, HubInfo> WidgetHubs; + typedef TypedListView<HubInfo> WidgetHubs; typedef WidgetHubs* WidgetHubsPtr; WidgetHubsPtr hubs; WidgetButtonPtr doSearch; - typedef TypedListView<SearchFrame, SearchInfo> WidgetResults; + typedef TypedListView<SearchInfo> WidgetResults; typedef WidgetResults* WidgetResultsPtr; WidgetResultsPtr results; Modified: dcplusplus/trunk/win32/StaticFrame.h =================================================================== --- dcplusplus/trunk/win32/StaticFrame.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/StaticFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -27,6 +27,13 @@ template<class T> class StaticFrame : public MDIChildFrame<T> { public: + + StaticFrame(SmartWin::WidgetTabView* mdiClient, const tstring& title) : + MDIChildFrame<T>(mdiClient, title, SmartWin::IconPtr(new SmartWin::Icon(T::ICON_RESOURCE))) + { + } + + /** @deprecated */ StaticFrame(SmartWin::WidgetTabView* mdiClient) : MDIChildFrame<T>(mdiClient, TSTRING_I(T::TITLE_RESOURCE), SmartWin::IconPtr(new SmartWin::Icon(T::ICON_RESOURCE))) { Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -31,6 +31,8 @@ #include <dcpp/UploadManager.h> #include <dcpp/QueueManager.h> #include <dcpp/ClientManager.h> +#include <dcpp/Download.h> +#include <dcpp/Upload.h> int TransferView::columnIndexes[] = { COLUMN_USER, COLUMN_HUB, COLUMN_STATUS, COLUMN_TIMELEFT, COLUMN_SPEED, COLUMN_FILE, COLUMN_SIZE, COLUMN_PATH, COLUMN_IP, COLUMN_RATIO, COLUMN_CID, COLUMN_CIPHER }; int TransferView::columnSizes[] = { 150, 100, 250, 75, 75, 175, 100, 200, 50, 75, 125, 125 }; @@ -617,6 +619,14 @@ speak(); } +void TransferView::on(DownloadManagerListener::Complete, Download* aDownload) throw() { + onTransferComplete(aDownload, false); +} + +void TransferView::on(UploadManagerListener::Complete, Upload* aUpload) throw() { + onTransferComplete(aUpload, true); +} + void TransferView::onTransferComplete(Transfer* aTransfer, bool isUpload) { UpdateInfo* ui = new UpdateInfo(aTransfer->getUser(), !isUpload); Modified: dcplusplus/trunk/win32/TransferView.h =================================================================== --- dcplusplus/trunk/win32/TransferView.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/TransferView.h 2008-01-03 19:21:30 UTC (rev 955) @@ -25,8 +25,6 @@ #include <dcpp/TaskQueue.h> #include <dcpp/forward.h> #include <dcpp/Util.h> -#include <dcpp/Download.h> -#include <dcpp/Upload.h> #include "AspectSpeaker.h" #include "TypedListView.h" @@ -173,7 +171,7 @@ static int columnIndexes[]; static int columnSizes[]; - typedef TypedListView<TransferView, ItemInfo> WidgetTransfers; + typedef TypedListView<ItemInfo> WidgetTransfers; typedef WidgetTransfers* WidgetTransfersPtr; WidgetTransfersPtr transfers; SmartWin::WidgetTabView* mdi; @@ -207,14 +205,14 @@ virtual void on(ConnectionManagerListener::Removed, ConnectionQueueItem* aCqi) throw(); virtual void on(ConnectionManagerListener::StatusChanged, ConnectionQueueItem* aCqi) throw(); - virtual void on(DownloadManagerListener::Complete, Download* aDownload) throw() { onTransferComplete(aDownload, false);} + 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(); virtual void on(DownloadManagerListener::Tick, const DownloadList& aDownload) throw(); virtual void on(UploadManagerListener::Starting, Upload* aUpload) throw(); virtual void on(UploadManagerListener::Tick, const UploadList& aUpload) throw(); - virtual void on(UploadManagerListener::Complete, Upload* aUpload) throw() { onTransferComplete(aUpload, true); } + virtual void on(UploadManagerListener::Complete, Upload* aUpload) throw(); void onTransferComplete(Transfer* aTransfer, bool isUpload); Modified: dcplusplus/trunk/win32/TypedListView.h =================================================================== --- dcplusplus/trunk/win32/TypedListView.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/TypedListView.h 2008-01-03 19:21:30 UTC (rev 955) @@ -19,12 +19,14 @@ #ifndef DCPLUSPLUS_WIN32_TYPED_LIST_VIEW_H #define DCPLUSPLUS_WIN32_TYPED_LIST_VIEW_H -template<class T, class ContentType, bool managed = true> -class TypedListView : public T::WidgetListView +#include <dcpp/Util.h> + +template<class ContentType, bool managed = true> +class TypedListView : public SmartWin::WidgetListView { private: - typedef typename T::WidgetListView BaseType; - typedef TypedListView<T, ContentType, managed> ThisType; + typedef typename SmartWin::WidgetListView BaseType; + typedef TypedListView<ContentType, managed> ThisType; public: typedef ThisType* ObjectType; @@ -38,7 +40,7 @@ this->clear(); } - void create( const typename BaseType::Seed & cs = BaseType::getDefaultSeed() ) { + void create( const typename BaseType::Seed & cs = BaseType::Seed() ) { BaseType::create(cs); this->setCallback( Modified: dcplusplus/trunk/win32/TypedTreeView.h =================================================================== --- dcplusplus/trunk/win32/TypedTreeView.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/TypedTreeView.h 2008-01-03 19:21:30 UTC (rev 955) @@ -20,19 +20,19 @@ #define DCPLUSPLUS_WIN32_TYPED_TREE_VIEW_H -template<class T, class ContentType> -class TypedTreeView : public T::WidgetTreeView +template<class ContentType> +class TypedTreeView : public SmartWin::WidgetTreeView { private: - typedef typename T::WidgetTreeView BaseType; - typedef TypedTreeView<T, ContentType> ThisType; + typedef typename SmartWin::WidgetTreeView BaseType; + typedef TypedTreeView<ContentType> ThisType; public: typedef ThisType* ObjectType; explicit TypedTreeView( SmartWin::Widget* parent ) : BaseType(parent) { } - void create( const typename BaseType::Seed & cs = BaseType::getDefaultSeed() ) { + void create( const typename BaseType::Seed & cs = BaseType::Seed() ) { BaseType::create(cs); this->setCallback( SmartWin::Message( WM_NOTIFY, TVN_GETDISPINFO ), &TypedTreeViewDispatcher Modified: dcplusplus/trunk/win32/UsersFrame.h =================================================================== --- dcplusplus/trunk/win32/UsersFrame.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/UsersFrame.h 2008-01-03 19:21:30 UTC (rev 955) @@ -93,7 +93,7 @@ tstring columns[COLUMN_LAST]; }; - typedef TypedListView<UsersFrame, UserInfo> WidgetUsers; + typedef TypedListView<UserInfo> WidgetUsers; typedef WidgetUsers* WidgetUsersPtr; WidgetUsersPtr users; Modified: dcplusplus/trunk/win32/WinUtil.cpp =================================================================== --- dcplusplus/trunk/win32/WinUtil.cpp 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/WinUtil.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -39,6 +39,7 @@ #include "MagnetDlg.h" #include "HubFrame.h" #include "SearchFrame.h" +#include "MainWindow.h" tstring WinUtil::tth; SmartWin::BrushPtr WinUtil::bgBrush; @@ -52,8 +53,7 @@ int WinUtil::dirIconIndex; int WinUtil::dirMaskedIndex; TStringList WinUtil::lastDirs; -SmartWin::Widget* WinUtil::mainWindow = 0; -SmartWin::WidgetTabView* WinUtil::mdiParent = 0; +MainWindow* WinUtil::mainWindow = 0; bool WinUtil::urlDcADCRegistered = false; bool WinUtil::urlMagnetRegistered = false; WinUtil::ImageMap WinUtil::fileIndexes; @@ -252,7 +252,7 @@ } } else if(Util::stricmp(cmd.c_str(), _T("search")) == 0) { if(!param.empty()) { - SearchFrame::openWindow(mdiParent, param); + SearchFrame::openWindow(mainWindow->getMDIParent(), param); } else { status = TSTRING(SPECIFY_SEARCH_STRING); } @@ -373,7 +373,7 @@ } void WinUtil::searchHash(const TTHValue& aHash) { - SearchFrame::openWindow(mdiParent, Text::toT(aHash.toBase32()), 0, SearchManager::SIZE_DONTCARE, SearchManager::TYPE_TTH); + SearchFrame::openWindow(mainWindow->getMDIParent(), Text::toT(aHash.toBase32()), 0, SearchManager::SIZE_DONTCARE, SearchManager::TYPE_TTH); } tstring WinUtil::escapeMenu(tstring str) { @@ -941,7 +941,7 @@ uint16_t port = 411; Util::decodeUrl(Text::fromT(aUrl), server, port, file); if(!server.empty()) { - HubFrame::openWindow(mdiParent, server + ":" + Util::toString(port)); + HubFrame::openWindow(mainWindow->getMDIParent(), server + ":" + Util::toString(port)); } if(!file.empty()) { if(file[0] == '/') // Remove any '/' in from of the file @@ -962,7 +962,7 @@ uint16_t port = 0; //make sure we get a port since adc doesn't have a standard one Util::decodeUrl(Text::fromT(aUrl), server, port, file); if(!server.empty() && port > 0) { - HubFrame::openWindow(mdiParent, "adc://" + server + ":" + Util::toString(port)); + HubFrame::openWindow(mainWindow->getMDIParent(), "adc://" + server + ":" + Util::toString(port)); } } Modified: dcplusplus/trunk/win32/WinUtil.h =================================================================== --- dcplusplus/trunk/win32/WinUtil.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/WinUtil.h 2008-01-03 19:21:30 UTC (rev 955) @@ -40,6 +40,8 @@ #endif +class MainWindow; + class WinUtil { public: static tstring tth; @@ -56,8 +58,8 @@ static int dirIconIndex; static int dirMaskedIndex; static TStringList lastDirs; - static SmartWin::Widget* mainWindow; - static SmartWin::WidgetTabView* mdiParent; + static MainWindow* mainWindow; + //static SmartWin::WidgetTabView* mdiParent; static DWORD helpCookie; typedef unordered_map<string, int> ImageMap; Modified: dcplusplus/trunk/win32/main.cpp =================================================================== --- dcplusplus/trunk/win32/main.cpp 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/main.cpp 2008-01-03 19:21:30 UTC (rev 955) @@ -145,7 +145,7 @@ WinUtil::init(); MainWindow* wnd = new MainWindow; WinUtil::mainWindow = wnd; - WinUtil::mdiParent = wnd->getMDIParent(); + //WinUtil::mdiParent = wnd->getMDIParent(); splash->close(); ret = app.run(); } catch(const SmartWin::xCeption& e) { Added: dcplusplus/trunk/win32/po/dcpp-win32.pot =================================================================== --- dcplusplus/trunk/win32/po/dcpp-win32.pot (rev 0) +++ dcplusplus/trunk/win32/po/dcpp-win32.pot 2008-01-03 19:21:30 UTC (rev 955) @@ -0,0 +1,42 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Jacek Sieka +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: dcpp-win32\n" +"Report-Msgid-Bugs-To: dcp...@li...\n" +"POT-Creation-Date: 2008-01-03 20:12+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL...@li...>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: win32/DownloadsFrame.cpp:36 +msgid "Downloads" +msgstr "" + +#: win32/DownloadsFrame.cpp:98 +msgid "Waiting for slot" +msgstr "" + +#: win32/DownloadsFrame.cpp:103 +#, boost-format +msgid "Downloading from %1% user" +msgid_plural "Downloading from %1% users" +msgstr[0] "" +msgstr[1] "" + +#: win32/DownloadsFrame.cpp:105 +#, boost-format +msgid "%1%/s" +msgstr "" + +#: win32/AppearancePage.cpp:86 win32/AppearancePage.cpp:109 +msgid "Default" +msgstr "" Modified: dcplusplus/trunk/win32/stdafx.h =================================================================== --- dcplusplus/trunk/win32/stdafx.h 2007-12-29 22:04:05 UTC (rev 954) +++ dcplusplus/trunk/win32/stdafx.h 2008-01-03 19:21:30 UTC (rev 955) @@ -48,5 +48,10 @@ #define PACKAGE "dcpp-win32" #define _(String) gettext(String) #define T_(String) Text::toT(gettext(String)) - +#ifdef UNICODE +#define TF_(String) boost::wformat(Text::toT(gettext(String))) +#define TFN_(String1,String2, N) boost::wformat(Text::toT(ngettext(String1, String2, N))) +#else +#define TF_(String) boost::format(Text::toT(gettext(String))) #endif +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pie...@us...> - 2008-01-03 15:51:23
|
Revision: 122 http://adchpp.svn.sourceforge.net/adchpp/?rev=122&view=rev Author: pietricica Date: 2008-01-03 07:51:09 -0800 (Thu, 03 Jan 2008) Log Message: ----------- fixed installer Modified Paths: -------------- adchpp/trunk/ADCHPP.nsi Modified: adchpp/trunk/ADCHPP.nsi =================================================================== --- adchpp/trunk/ADCHPP.nsi 2008-01-03 14:32:05 UTC (rev 121) +++ adchpp/trunk/ADCHPP.nsi 2008-01-03 15:51:09 UTC (rev 122) @@ -80,10 +80,6 @@ File "config\users.txt" SectionEnd -Section "Install as Service" SEC02 - Exec "$INSTDIR\adchppd.exe" -i adchppd -SectionEnd - Section -AdditionalIcons SetOutPath $INSTDIR WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" @@ -92,6 +88,11 @@ CreateShortCut "$SMPROGRAMS\ADCH++\Uninstall.lnk" "$INSTDIR\uninst.exe" SectionEnd +Section -Service + MessageBox MB_ICONQUESTION|MB_YESNO "Do you wish to install ADCH++ as service ?" IDYES Service IDNO End + Service: Exec '"$INSTDIR\adchppd.exe" -i adchppd' + End: +SectionEnd Section -Post WriteUninstaller "$INSTDIR\uninst.exe" @@ -115,6 +116,11 @@ Abort FunctionEnd +Section -un.Service + Exec 'sc delete adchppd' + +SectionEnd + Section Uninstall Delete "$INSTDIR\${PRODUCT_NAME}.url" Delete "$INSTDIR\uninst.exe" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-03 14:32:09
|
Revision: 121 http://adchpp.svn.sourceforge.net/adchpp/?rev=121&view=rev Author: arnetheduck Date: 2008-01-03 06:32:05 -0800 (Thu, 03 Jan 2008) Log Message: ----------- installer as section Modified Paths: -------------- adchpp/trunk/ADCHPP.nsi Modified: adchpp/trunk/ADCHPP.nsi =================================================================== --- adchpp/trunk/ADCHPP.nsi 2008-01-03 13:46:32 UTC (rev 120) +++ adchpp/trunk/ADCHPP.nsi 2008-01-03 14:32:05 UTC (rev 121) @@ -80,6 +80,10 @@ File "config\users.txt" SectionEnd +Section "Install as Service" SEC02 + Exec "$INSTDIR\adchppd.exe" -i adchppd +SectionEnd + Section -AdditionalIcons SetOutPath $INSTDIR WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" @@ -148,4 +152,4 @@ DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true -SectionEnd \ No newline at end of file +SectionEnd This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pie...@us...> - 2008-01-03 13:47:07
|
Revision: 120 http://adchpp.svn.sourceforge.net/adchpp/?rev=120&view=rev Author: pietricica Date: 2008-01-03 05:46:32 -0800 (Thu, 03 Jan 2008) Log Message: ----------- created some installer Added Paths: ----------- adchpp/trunk/ADCHPP.nsi Added: adchpp/trunk/ADCHPP.nsi =================================================================== --- adchpp/trunk/ADCHPP.nsi (rev 0) +++ adchpp/trunk/ADCHPP.nsi 2008-01-03 13:46:32 UTC (rev 120) @@ -0,0 +1,151 @@ +; Script generated by the HM NIS Edit Script Wizard. + +; HM NIS Edit Wizard helper defines +!define PRODUCT_NAME "ADCH++" +!define PRODUCT_VERSION "2.1" +!define PRODUCT_PUBLISHER "Jacek Sieka" +!define PRODUCT_WEB_SITE "http://adchpp.sourceforge.net" +!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\adchppd.exe" +!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" +!define PRODUCT_UNINST_ROOT_KEY "HKLM" + +SetCompressor lzma + +; MUI 1.67 compatible ------ +!include "MUI.nsh" + +; MUI Settings +!define MUI_ABORTWARNING +!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" + +; Welcome page +!insertmacro MUI_PAGE_WELCOME +; License page +!insertmacro MUI_PAGE_LICENSE "License.txt" +; Directory page +!insertmacro MUI_PAGE_DIRECTORY +; Instfiles page +!insertmacro MUI_PAGE_INSTFILES +; Finish page +!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt" +!define MUI_FINISHPAGE_RUN "$INSTDIR\adchppd.exe" +!insertmacro MUI_PAGE_FINISH + +; Uninstaller pages +!insertmacro MUI_UNPAGE_INSTFILES + +; Language files +!insertmacro MUI_LANGUAGE "English" + +; Reserve files +!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS + +; MUI end ------ + +Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" +OutFile "ADCH++.xxx.exe" +InstallDir "$PROGRAMFILES\ADCH++" +InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" +ShowInstDetails show +ShowUnInstDetails show + +Section "MainSection" SEC01 + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + File "adchppd.exe" + File "adchpp.dll" + File "_pyadchpp.dll" + File "aintl.dll" + File "alua.dll" + File "Bloom.dll" + File "changelog.txt" + File "License.txt" + File "luadchpp.dll" + File "pyadchpp.py" + File "readme.txt" + CreateShortCut "$DESKTOP\ADCH++.lnk" "$INSTDIR\adchppd.exe" + CreateDirectory "$SMPROGRAMS\ADCH++" + CreateShortCut "$SMPROGRAMS\ADCH++\ADCH++ Help.lnk" "$INSTDIR\readme.txt" + CreateShortCut "$SMPROGRAMS\ADCH++\Install ADCH++ as windows service.lnk" "$INSTDIR\adchppd.exe" "-i adchppd" + CreateShortCut "$SMPROGRAMS\ADCH++\Remove ADCH++ windows service.lnk" "$INSTDIR\adchppd.exe" "-u adchppd" + File "Script.dll" + SetOutPath "$INSTDIR\Scripts" + File "scripts\access.lua" + File "scripts\json.lua" + SetOverwrite off + SetOutPath "$INSTDIR\config" + File "config\adchpp.xml" + File "config\Script.xml" + File "config\users.txt" +SectionEnd + +Section -AdditionalIcons + SetOutPath $INSTDIR + WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" + CreateShortCut "$SMPROGRAMS\ADCH++\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" + CreateShortCut "$SMPROGRAMS\ADCH++\ADCH++.lnk" "$INSTDIR\adchppd.exe" + CreateShortCut "$SMPROGRAMS\ADCH++\Uninstall.lnk" "$INSTDIR\uninst.exe" +SectionEnd + + +Section -Post + WriteUninstaller "$INSTDIR\uninst.exe" + WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\adchppd.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\adchppd.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" +SectionEnd + + +Function un.onUninstSuccess + HideWindow + MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." +FunctionEnd + +Function un.onInit + MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 + Abort +FunctionEnd + +Section Uninstall + Delete "$INSTDIR\${PRODUCT_NAME}.url" + Delete "$INSTDIR\uninst.exe" + Delete "$INSTDIR\config\users.txt" + Delete "$INSTDIR\config\Script.xml" + Delete "$INSTDIR\config\adchpp.xml" + Delete "$INSTDIR\Scripts\json.lua" + Delete "$INSTDIR\Scripts\access.lua" + Delete "$INSTDIR\Script.dll" + Delete "$INSTDIR\readme.txt" + Delete "$INSTDIR\pyadchpp.py" + Delete "$INSTDIR\luadchpp.dll" + Delete "$INSTDIR\License.txt" + Delete "$INSTDIR\changelog.txt" + Delete "$INSTDIR\Bloom.dll" + Delete "$INSTDIR\alua.dll" + Delete "$INSTDIR\aintl.dll" + Delete "$INSTDIR\_pyadchpp.dll" + Delete "$INSTDIR\adchpp.dll" + Delete "$INSTDIR\adchppd.exe" + + Delete "$SMPROGRAMS\ADCH++\Uninstall.lnk" + Delete "$SMPROGRAMS\ADCH++\ADCH++.lnk" + Delete "$SMPROGRAMS\ADCH++\Website.lnk" + Delete "$SMPROGRAMS\ADCH++\ADCH++ Help.lnk" + Delete "$SMPROGRAMS\ADCH++\Remove ADCH++ windows service.lnk" + Delete "$SMPROGRAMS\ADCH++\Install ADCH++ as windows service.lnk" + Delete "$DESKTOP\ADCH++.lnk" + + RMDir "$SMPROGRAMS\ADCH++" + RMDir "$INSTDIR\Scripts" + RMDir "$INSTDIR\config" + RMDir "$INSTDIR" + + DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" + DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" + SetAutoClose true +SectionEnd \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |