Changeset 1460

Show
Ignore:
Timestamp:
07/12/05 12:32:23 (3 years ago)
Author:
madcat
Message:

Downloadlist is now sorted by name; fixed minor display issues when the list included downloads at 100%

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • hydranode/modules/hnsh/shellcommands.cpp

    r1456 r1460  
    466466                PartData *pd = (*i)->getPartData(); 
    467467                m_downloads.push_back(pd); 
    468                 helperPrintDownload(m_downloads.size() - 1, pd); 
    469468 
    470469                completed.push_back(pd->getCompleted()); 
     
    475474        if (!m_downloads.size()) { 
    476475                return true; 
     476        } 
     477 
     478        std::sort( 
     479                m_downloads.begin(), m_downloads.end(), 
     480                boost::bind( 
     481                        std::less<std::string>(), 
     482                        bind(&PartData::getName, _1), 
     483                        bind(&PartData::getName, _2) 
     484                ) 
     485        ); 
     486 
     487        for (uint32_t num = 0; num < m_downloads.size(); ++num) { 
     488                helperPrintDownload(num, m_downloads[num]); 
    477489        } 
    478490 
     
    916928                } 
    917929        } 
    918         boost::format fmt("%3d) %s %5.2f%% %9s %4s %s"); 
     930 
     931        boost::format fmt("%3d) %s %6.2f%% %9s %4s %s"); 
    919932        fmt % num % buf % perc % Utils::bytesToString(pd->getSize()); 
    920933        fmt % pd->getSourceCnt(); 
    921934        std::string filename = pd->getDestination().leaf(); 
    922         if (filename.size() > m_parent->getWidth() - 45u) { 
    923                 std::string beg = filename.substr(0, m_parent->getWidth() - 49); 
     935        if (filename.size() > m_parent->getWidth() - 44u) { 
     936                std::string beg = filename.substr(0,m_parent->getWidth() - 50); 
    924937                std::string end = filename.substr(filename.size() - 4); 
    925938                filename = beg + "[...]" + end;