mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +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:
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user