1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-04 10:38:13 +00:00

(trunk qt) #3116 "show file sizes in the file tree" -- implemented for 2.00 by a patch from Longinus00

This commit is contained in:
Charles Kerr 2010-04-03 13:56:23 +00:00
parent 19d1e5dc23
commit a5ca4d45f1
2 changed files with 12 additions and 1 deletions

View file

@ -86,7 +86,7 @@ FileTreeItem :: data( int column ) const
QVariant value;
switch( column ) {
case COL_NAME: value.setValue( name() ); break;
case COL_NAME: value.setValue( fileSizeName( ) ); break;
case COL_PROGRESS: value.setValue( progress( ) ); break;
case COL_WANTED: value.setValue( isSubtreeWanted( ) ); break;
case COL_PRIORITY: value.setValue( priorityString( ) ); break;
@ -116,6 +116,16 @@ FileTreeItem :: progress( ) const
return d;
}
QString
FileTreeItem :: fileSizeName( ) const
{
uint64_t have(0), total(0);
QString str;
getSubtreeSize( have, total );
str = QString( name() + " (%1)" ).arg( Utils::sizeToString( total ) );
return str;
}
bool
FileTreeItem :: update( int index, bool wanted, int priority, uint64_t totalSize, uint64_t haveSize )
{

View file

@ -60,6 +60,7 @@ class FileTreeItem: public QObject
void setSubtreeWanted( bool, QSet<int>& fileIds );
QString priorityString( ) const;
void getSubtreeSize( uint64_t& have, uint64_t& total ) const;
QString fileSizeName( ) const;
double progress( ) const;
int priority( ) const;
int isSubtreeWanted( ) const;