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. |