Changeset 12546


Ignore:
Timestamp:
Jul 13, 2011, 5:22:01 PM (10 years ago)
Author:
jordan
Message:

(trunk qt) fix high CPU load on startup caused by frequent updates to the u/d speed tooltips

Location:
trunk/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/mainwin.cc

    r11744 r12546  
    9191    myLastSendTime( 0 ),
    9292    myLastReadTime( 0 ),
    93     myNetworkTimer( this )
     93    myNetworkTimer( this ),
     94    myRefreshTrayIconTimer( this )
    9495{
    9596    setAcceptDrops( true );
     
    200201    connect( &myModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), this, SLOT(onModelReset()));
    201202    connect( &myModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), this, SLOT(onModelReset()));
    202     connect( &myModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(refreshTrayIcon()));
     203    connect( &myModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(refreshTrayIconSoon()));
    203204
    204205    ui.listView->setModel( &myFilterModel );
     
    274275    }
    275276
     277    connect( &myRefreshTrayIconTimer, SIGNAL(timeout()), this, SLOT(refreshTrayIcon()) );
     278
     279
    276280    refreshActionSensitivity( );
    277     refreshTrayIcon( );
     281    refreshTrayIconSoon( );
    278282    refreshStatusBar( );
    279283    refreshTitle( );
     
    319323    refreshActionSensitivity( );
    320324    refreshStatusBar( );
    321     refreshTrayIcon( );
     325    refreshTrayIconSoon( );
    322326}
    323327
     
    642646
    643647void
     648TrMainWindow :: refreshTrayIconSoon( )
     649{
     650    if( !myRefreshTrayIconTimer.isActive( ) )
     651    {
     652        myRefreshTrayIconTimer.setSingleShot( true );
     653        myRefreshTrayIconTimer.start( 500 );
     654    }
     655}
     656void
    644657TrMainWindow :: refreshTrayIcon( )
    645658{
     
    966979            ui.action_TrayIcon->setChecked( b );
    967980            myTrayIcon.setVisible( b );
    968             refreshTrayIcon( );
     981            refreshTrayIconSoon( );
    969982            break;
    970983
  • trunk/qt/mainwin.h

    r11196 r12546  
    7676        time_t myLastReadTime;
    7777        QTimer myNetworkTimer;
     78        QTimer myRefreshTrayIconTimer;
    7879        QAction * myDlimitOffAction;
    7980        QAction * myDlimitOnAction;
     
    106107        void refreshStatusBar( );
    107108        void refreshTrayIcon( );
     109        void refreshTrayIconSoon( );
    108110        void openTorrent( );
    109111        void openURL( );
Note: See TracChangeset for help on using the changeset viewer.