Changeset 10627


Ignore:
Timestamp:
May 5, 2010, 9:41:14 AM (9 years ago)
Author:
charles
Message:

(trunk Qt) #2050 "Properties dialog changes seem to undo themselves" -- use patch from Longinus00

Location:
trunk/qt
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/details.cc

    r10536 r10627  
    124124    myPrefs( prefs ),
    125125    myModel( model ),
     126    myChangedTorrents( false ),
    126127    myHavePendingRefresh( false )
    127128{
     
    164165    if( ids == myIds )
    165166        return;
     167
     168    myChangedTorrents = true;
    166169
    167170    // stop listening to the old torrents
     
    535538    ///
    536539
    537     if( !torrents.empty( ) )
     540    if( myChangedTorrents && !torrents.empty( ) )
    538541    {
    539542        int i;
     
    833836
    834837    if( single )
    835         myFileTreeView->update( torrents[0]->files( ) );
     838    {
     839        myFileTreeView->update( torrents[0]->files( ) , myChangedTorrents );
     840    }
    836841    else
    837842        myFileTreeView->clear( );
    838843
     844    myChangedTorrents = false;
    839845    myHavePendingRefresh = false;
    840846    foreach( QWidget * w, myWidgets )
  • trunk/qt/details.h

    r10442 r10627  
    7070        QSet<int> myIds;
    7171        QTimer myTimer;
     72        bool myChangedTorrents;
    7273        bool myHavePendingRefresh;
    7374
  • trunk/qt/file-tree.cc

    r10440 r10627  
    128128
    129129bool
    130 FileTreeItem :: update( int index, bool wanted, int priority, uint64_t totalSize, uint64_t haveSize )
     130FileTreeItem :: update( int index, bool wanted, int priority, uint64_t totalSize, uint64_t haveSize, bool torrentChanged )
    131131{
    132132    bool changed = false;
     
    137137        changed = true;
    138138    }
    139     if( myIsWanted != wanted )
     139    if( torrentChanged && myIsWanted != wanted )
    140140    {
    141141        myIsWanted = wanted;
    142142        changed = true;
    143143    }
    144     if( myPriority != priority )
     144    if( torrentChanged && myPriority != priority )
    145145    {
    146146        myPriority = priority;
     
    414414                          uint64_t              size,
    415415                          uint64_t              have,
    416                           QList<QModelIndex>  & rowsAdded )
     416                          QList<QModelIndex>  & rowsAdded,
     417                          bool                  torrentChanged )
    417418{
    418419    FileTreeItem * i( rootItem );
     
    434435
    435436    if( i != rootItem )
    436         if( i->update( index, wanted, priority, size, have ) )
     437        if( i->update( index, wanted, priority, size, have, torrentChanged ) )
    437438            dataChanged( indexOf( i, 0 ), indexOf( i, NUM_COLUMNS-1 ) );
    438439}
     
    648649FileTreeView :: update( const FileList& files )
    649650{
     651    update( files, true );
     652}
     653
     654void
     655FileTreeView :: update( const FileList& files, bool torrentChanged )
     656{
    650657    foreach( const TrFile file, files ) {
    651658        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 );
    653660        foreach( QModelIndex i, added )
    654661            expand( i );
  • trunk/qt/file-tree.h

    r10440 r10627  
    5252        const QString& name( ) const { return myName; }
    5353        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 );
    5555        void twiddleWanted( QSet<int>& fileIds, bool& );
    5656        void twiddlePriority( QSet<int>& fileIds, int& );
     
    103103                      bool wanted, int priority,
    104104                      uint64_t size, uint64_t have,
    105                       QList<QModelIndex>& rowsAdded );
     105                      QList<QModelIndex>& rowsAdded,
     106                      bool torrentChanged );
    106107
    107108    private:
     
    141142        void clear( );
    142143        void update( const FileList& files );
     144        void update( const FileList& files, bool torrentChanged );
    143145
    144146    signals:
  • trunk/qt/prefs-dialog.cc

    r10611 r10627  
    624624    myLayout->addWidget( buttons );
    625625
    626     connect( &myPrefs, SIGNAL(changed(int)), this, SLOT(updatePref(int)));
    627626    connect( &mySession, SIGNAL(sessionUpdated()), this, SLOT(sessionUpdated()));
    628627
Note: See TracChangeset for help on using the changeset viewer.