diff --git qt/details.cc qt/details.cc
index 1f98894..a16ea42 100644
|
|
Details :: Details( Session& session, Prefs& prefs, TorrentModel& model, QWidget |
123 | 123 | mySession( session ), |
124 | 124 | myPrefs( prefs ), |
125 | 125 | myModel( model ), |
| 126 | myChangedTorrents( false ), |
126 | 127 | myHavePendingRefresh( false ) |
127 | 128 | { |
128 | 129 | QVBoxLayout * layout = new QVBoxLayout( this ); |
… |
… |
Details :: setIds( const QSet<int>& ids ) |
164 | 165 | if( ids == myIds ) |
165 | 166 | return; |
166 | 167 | |
| 168 | myChangedTorrents = true; |
| 169 | |
167 | 170 | // stop listening to the old torrents |
168 | 171 | foreach( int id, myIds ) { |
169 | 172 | const Torrent * tor = myModel.getTorrentFromId( id ); |
… |
… |
Details :: refresh( ) |
534 | 537 | /// Options Tab |
535 | 538 | /// |
536 | 539 | |
537 | | if( !torrents.empty( ) ) |
| 540 | if( myChangedTorrents && !torrents.empty( ) ) |
538 | 541 | { |
539 | 542 | int i; |
540 | 543 | const Torrent * baseline = *torrents.begin(); |
… |
… |
Details :: refresh( ) |
832 | 835 | myPeers = peers2; |
833 | 836 | |
834 | 837 | if( single ) |
835 | | myFileTreeView->update( torrents[0]->files( ) ); |
| 838 | { |
| 839 | myFileTreeView->update( torrents[0]->files( ) , myChangedTorrents ); |
| 840 | } |
836 | 841 | else |
837 | 842 | myFileTreeView->clear( ); |
838 | 843 | |
| 844 | myChangedTorrents = false; |
839 | 845 | myHavePendingRefresh = false; |
840 | 846 | foreach( QWidget * w, myWidgets ) |
841 | 847 | w->setEnabled( true ); |
diff --git qt/details.h qt/details.h
index 51d494d..3702ffd 100644
|
|
class Details: public QDialog |
69 | 69 | TorrentModel& myModel; |
70 | 70 | QSet<int> myIds; |
71 | 71 | QTimer myTimer; |
| 72 | bool myChangedTorrents; |
72 | 73 | bool myHavePendingRefresh; |
73 | 74 | |
74 | 75 | QLabel * myStateLabel; |
diff --git qt/file-tree.cc qt/file-tree.cc
index 6eb5df4..0a27b8c 100644
|
|
FileTreeItem :: fileSizeName( ) const |
127 | 127 | } |
128 | 128 | |
129 | 129 | bool |
130 | | FileTreeItem :: update( int index, bool wanted, int priority, uint64_t totalSize, uint64_t haveSize ) |
| 130 | FileTreeItem :: update( int index, bool wanted, int priority, uint64_t totalSize, uint64_t haveSize, bool torrentChanged ) |
131 | 131 | { |
132 | 132 | bool changed = false; |
133 | 133 | |
… |
… |
FileTreeItem :: update( int index, bool wanted, int priority, uint64_t totalSize |
136 | 136 | myIndex = index; |
137 | 137 | changed = true; |
138 | 138 | } |
139 | | if( myIsWanted != wanted ) |
| 139 | if( torrentChanged && myIsWanted != wanted ) |
140 | 140 | { |
141 | 141 | myIsWanted = wanted; |
142 | 142 | changed = true; |
143 | 143 | } |
144 | | if( myPriority != priority ) |
| 144 | if( torrentChanged && myPriority != priority ) |
145 | 145 | { |
146 | 146 | myPriority = priority; |
147 | 147 | changed = true; |
… |
… |
FileTreeModel :: addFile( int index, |
413 | 413 | int priority, |
414 | 414 | uint64_t size, |
415 | 415 | uint64_t have, |
416 | | QList<QModelIndex> & rowsAdded ) |
| 416 | QList<QModelIndex> & rowsAdded, |
| 417 | bool torrentChanged ) |
417 | 418 | { |
418 | 419 | FileTreeItem * i( rootItem ); |
419 | 420 | |
… |
… |
FileTreeModel :: addFile( int index, |
433 | 434 | } |
434 | 435 | |
435 | 436 | if( i != rootItem ) |
436 | | if( i->update( index, wanted, priority, size, have ) ) |
| 437 | if( i->update( index, wanted, priority, size, have, torrentChanged ) ) |
437 | 438 | dataChanged( indexOf( i, 0 ), indexOf( i, NUM_COLUMNS-1 ) ); |
438 | 439 | } |
439 | 440 | |
… |
… |
FileTreeView :: eventFilter( QObject * o, QEvent * event ) |
647 | 648 | void |
648 | 649 | FileTreeView :: update( const FileList& files ) |
649 | 650 | { |
| 651 | update( files, true ); |
| 652 | } |
| 653 | |
| 654 | void |
| 655 | FileTreeView :: update( const FileList& files, bool torrentChanged ) |
| 656 | { |
650 | 657 | foreach( const TrFile file, files ) { |
651 | 658 | QList<QModelIndex> added; |
652 | | myModel.addFile( file.index, file.filename, file.wanted, file.priority, file.size, file.have, added ); |
| 659 | myModel.addFile( file.index, file.filename, file.wanted, file.priority, file.size, file.have, added, torrentChanged ); |
653 | 660 | foreach( QModelIndex i, added ) |
654 | 661 | expand( i ); |
655 | 662 | } |
diff --git qt/file-tree.h qt/file-tree.h
index 7714afc..11c07ea 100644
|
|
class FileTreeItem: public QObject |
51 | 51 | int row( ) const; |
52 | 52 | const QString& name( ) const { return myName; } |
53 | 53 | QVariant data( int column ) const; |
54 | | bool update( int index, bool want, int priority, uint64_t total, uint64_t have ); |
| 54 | bool update( int index, bool want, int priority, uint64_t total, uint64_t have, bool torrentChanged ); |
55 | 55 | void twiddleWanted( QSet<int>& fileIds, bool& ); |
56 | 56 | void twiddlePriority( QSet<int>& fileIds, int& ); |
57 | 57 | |
… |
… |
class FileTreeModel: public QAbstractItemModel |
102 | 102 | void addFile( int index, const QString& filename, |
103 | 103 | bool wanted, int priority, |
104 | 104 | uint64_t size, uint64_t have, |
105 | | QList<QModelIndex>& rowsAdded ); |
| 105 | QList<QModelIndex>& rowsAdded, |
| 106 | bool torrentChanged ); |
106 | 107 | |
107 | 108 | private: |
108 | 109 | void clearSubtree( const QModelIndex & ); |
… |
… |
class FileTreeView: public QTreeView |
140 | 141 | virtual ~FileTreeView( ) { } |
141 | 142 | void clear( ); |
142 | 143 | void update( const FileList& files ); |
| 144 | void update( const FileList& files, bool torrentChanged ); |
143 | 145 | |
144 | 146 | signals: |
145 | 147 | void priorityChanged( const QSet<int>& fileIndices, int ); |
diff --git qt/prefs-dialog.cc qt/prefs-dialog.cc
index 89715ae..68adf26 100644
|
|
PrefsDialog :: PrefsDialog( Session& session, Prefs& prefs, QWidget * parent ): |
623 | 623 | connect( buttons, SIGNAL(rejected()), this, SLOT(hide()) ); // "close" triggers rejected |
624 | 624 | myLayout->addWidget( buttons ); |
625 | 625 | |
626 | | connect( &myPrefs, SIGNAL(changed(int)), this, SLOT(updatePref(int))); |
627 | 626 | connect( &mySession, SIGNAL(sessionUpdated()), this, SLOT(sessionUpdated())); |
628 | 627 | |
629 | 628 | QList<int> keys; |