From: <zou...@us...> - 2007-12-11 18:25:25
|
Revision: 932 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=932&view=rev Author: zouzou123gen Date: 2007-12-11 10:25:18 -0800 (Tue, 11 Dec 2007) Log Message: ----------- fix DirectoryListingFrame's status bar Modified Paths: -------------- dcplusplus/trunk/win32/DirectoryListingFrame.cpp Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2007-12-11 17:07:20 UTC (rev 931) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2007-12-11 18:25:18 UTC (rev 932) @@ -204,7 +204,7 @@ error = WinUtil::getNicks(dl->getUser()) + Text::toT(": " + e.getError()); } - initStatus(); + initStatusText(); } void DirectoryListingFrame::loadXML(const string& txt) { @@ -214,16 +214,9 @@ error = WinUtil::getNicks(dl->getUser()) + Text::toT(": " + e.getError()); } - initStatus(); + initStatusText(); } - -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")); -} - void DirectoryListingFrame::layout() { SmartWin::Rectangle r(getClientAreaSize()); @@ -271,7 +264,7 @@ dirList.loadFile(Text::fromT(file)); dl->getRoot()->filterList(dirList); refreshTree(Util::emptyStringT); - initStatus(); + initStatusText(); updateStatus(); } catch(const Exception&) { /// @todo report to user? @@ -533,7 +526,7 @@ } } } catch(const Exception& e) { - setStatus(STATUS_STATUS, Text::toT(e.getError()).c_str()); + setStatus(STATUS_STATUS, Text::toT(e.getError())); } } else { tstring target = Text::toT(SETTING(DOWNLOAD_DIRECTORY)); @@ -577,7 +570,7 @@ try { dl->download(ii->file, target, false, WinUtil::isShift()); } catch(const Exception& e) { - setStatus(STATUS_STATUS, Text::toT(e.getError()).c_str()); + setStatus(STATUS_STATUS, Text::toT(e.getError())); } } @@ -658,6 +651,12 @@ } } +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")); +} + void DirectoryListingFrame::updateStatus() { if(!searching && !updating) { int cnt = files->getSelectedCount(); @@ -669,11 +668,9 @@ total = files->forEachSelectedT(ItemInfo::TotalSize()).total; } - tstring tmp = Text::toT(STRING(ITEMS) + ": " + Util::toString(cnt)); - setStatus(STATUS_SELECTED_FILES, tmp.c_str()); + setStatus(STATUS_SELECTED_FILES, Text::toT(STRING(ITEMS) + ": " + Util::toString(cnt))); - tmp = Text::toT(STRING(SIZE) + ": " + Util::formatBytes(total)); - setStatus(STATUS_SELECTED_SIZE, tmp.c_str()); + setStatus(STATUS_SELECTED_SIZE, Text::toT(STRING(SIZE) + ": " + Util::formatBytes(total))); } } @@ -710,12 +707,12 @@ if(dl->getUser()->isOnline()) { try { QueueManager::getInstance()->addPfs(dl->getUser(), dl->getPath(d)); - setStatus(STATUS_STATUS, CTSTRING(DOWNLOADING_LIST)); + setStatus(STATUS_STATUS, TSTRING(DOWNLOADING_LIST)); } catch(const QueueException& e) { - setStatus(STATUS_STATUS, Text::toT(e.getError()).c_str()); + setStatus(STATUS_STATUS, Text::toT(e.getError())); } } else { - setStatus(STATUS_STATUS, CTSTRING(USER_OFFLINE)); + setStatus(STATUS_STATUS, TSTRING(USER_OFFLINE)); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |