close <div id="moderation_required">Attachments you submit will be routed for moderation. If you have an account, please <a href="/login">log in</a> first.</div>

Ticket #3116: qt_showFileSize.patch

File qt_showFileSize.patch, 1.4 KB (added by Longinus00, 6 years ago)
  • qt/file-tree.cc

    diff --git qt/file-tree.cc qt/file-tree.cc
    index 006e710..6eb5df4 100644
    FileTreeItem :: data( int column ) const 
    8686    QVariant value;
    8787
    8888    switch( column ) {
    89         case COL_NAME: value.setValue( name() ); break;
     89        case COL_NAME: value.setValue( fileSizeName( ) ); break;
    9090        case COL_PROGRESS: value.setValue( progress( ) ); break;
    9191        case COL_WANTED: value.setValue( isSubtreeWanted( ) ); break;
    9292        case COL_PRIORITY: value.setValue( priorityString( ) ); break;
    FileTreeItem :: progress( ) const 
    116116    return d;
    117117}
    118118
     119QString
     120FileTreeItem :: fileSizeName( ) const
     121{
     122    uint64_t have(0), total(0);
     123    QString str;
     124    getSubtreeSize( have, total );
     125    str = QString( name() + " (%1)" ).arg( Utils::sizeToString( total ) );
     126    return str;
     127}
     128
    119129bool
    120130FileTreeItem :: update( int index, bool wanted, int priority, uint64_t totalSize, uint64_t haveSize )
    121131{
  • qt/file-tree.h

    diff --git qt/file-tree.h qt/file-tree.h
    index 226621a..7714afc 100644
    class FileTreeItem: public QObject 
    6060        void setSubtreeWanted( bool, QSet<int>& fileIds );
    6161        QString priorityString( ) const;
    6262        void getSubtreeSize( uint64_t& have, uint64_t& total ) const;
     63        QString fileSizeName( ) const;
    6364        double progress( ) const;
    6465        int priority( ) const;
    6566        int isSubtreeWanted( ) const;