Changeset 13883
- Timestamp:
- Jan 27, 2013, 5:19:51 PM (8 years ago)
- Location:
- trunk/qt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/mainwin.cc
r13735 r13883 283 283 connect( &mySession, SIGNAL(sourceChanged()), this, SLOT(onSessionSourceChanged()) ); 284 284 connect( &mySession, SIGNAL(statsUpdated()), this, SLOT(refreshStatusBar()) ); 285 connect( &mySession, SIGNAL(sessionUpdated()), this, SLOT(refreshFreeSpace()) ); 285 286 connect( &mySession, SIGNAL(dataReadProgress()), this, SLOT(dataReadProgress()) ); 286 287 connect( &mySession, SIGNAL(dataSendProgress()), this, SLOT(dataSendProgress()) ); … … 301 302 refreshTrayIconSoon( ); 302 303 refreshStatusBar( ); 304 refreshFreeSpace( ); 303 305 refreshTitle( ); 304 306 refreshVisibleCount( ); … … 393 395 h->addWidget( l ); 394 396 397 //h->addStretch( 1 ); 398 h->addSpacing ( HIG::PAD_BIG ); 399 400 l = myFreeSpaceTextLabel = new QLabel (this); 401 const int minimumFreeSpaceWidth = l->fontMetrics().width( Formatter::sizeToString(1024 * 1024)); 402 l->setMinimumWidth( minimumFreeSpaceWidth ); 403 h->addWidget( l ); 404 l = myFreeSpaceIconLabel = new QLabel (this); 405 l->setPixmap( getStockIcon( "drive-harddisk", QStyle::SP_DriveHDIcon ).pixmap( smallIconSize ) ); 406 h->addWidget( l ); 407 395 408 h->addStretch( 1 ); 396 409 410 l = myStatsLabel = new QLabel( this ); 411 h->addWidget( l ); 397 412 a = new QActionGroup( this ); 398 413 a->addAction( ui.action_TotalRatio ); … … 415 430 p->setMenu( m ); 416 431 h->addWidget( p ); 417 l = myStatsLabel = new QLabel( this ); 418 h->addWidget( l ); 419 420 h->addStretch( 1 ); 432 433 //h->addStretch( 1 ); 434 h->addSpacing ( HIG::PAD ); 421 435 422 436 l = myDownloadSpeedLabel = new QLabel( this ); … … 429 443 h->addWidget( l ); 430 444 431 h->addS tretch( 1);445 h->addSpacing ( HIG::PAD ); 432 446 433 447 l = myUploadSpeedLabel = new QLabel; … … 718 732 719 733 void 734 TrMainWindow :: refreshFreeSpace( ) 735 { 736 const int64_t bytes (mySession.downloadDirFreeSpace()); 737 738 if (bytes >= 0) 739 { 740 const QString text = Formatter::sizeToString (bytes); 741 742 const QString tip = tr("Download directory \"%1\" has %2 space free") 743 .arg(myPrefs.getString(Prefs::DOWNLOAD_DIR)) 744 .arg(text); 745 746 myFreeSpaceTextLabel->setText (text); 747 myFreeSpaceTextLabel->setToolTip (tip); 748 myFreeSpaceIconLabel->setToolTip (tip); 749 } 750 751 myFreeSpaceTextLabel->setVisible (bytes >= 0); 752 myFreeSpaceIconLabel->setVisible (bytes >= 0); 753 } 754 755 void 720 756 TrMainWindow :: refreshTrayIconSoon( ) 721 757 { -
trunk/qt/mainwin.h
r13733 r13883 106 106 void showSessionTransfer( ); 107 107 void refreshVisibleCount( ); 108 void refreshFreeSpace( ); 108 109 void refreshTitle( ); 109 110 void refreshStatusBar( ); … … 160 161 QLabel * myDownloadSpeedLabel; 161 162 QLabel * myUploadSpeedLabel; 163 QLabel * myFreeSpaceTextLabel; 164 QLabel * myFreeSpaceIconLabel; 162 165 QLabel * myNetworkLabel; 163 166 -
trunk/qt/session.cc
r13864 r13883 248 248 mySession( 0 ), 249 249 myConfigDir( QString::fromUtf8( configDir ) ), 250 myNAM( 0 ) 250 myNAM( 0 ), 251 myDownloadDirFreeSpace( -1 ) 251 252 { 252 253 myStats.ratio = TR_RATIO_NA; … … 993 994 mySessionVersion = str; 994 995 996 if( tr_variantDictFindInt( d, TR_KEY_download_dir_free_space, &i ) && ( myDownloadDirFreeSpace != i ) ) 997 myDownloadDirFreeSpace = i; 998 995 999 //std::cerr << "Session :: updateInfo end" << std::endl; 996 1000 connect( &myPrefs, SIGNAL(changed(int)), this, SLOT(updatePref(int)) ); -
trunk/qt/session.h
r13864 r13883 58 58 const struct tr_session_stats& getCumulativeStats( ) const { return myCumulativeStats; } 59 59 const QString& sessionVersion( ) const { return mySessionVersion; } 60 int64_t downloadDirFreeSpace( ) const { return myDownloadDirFreeSpace; } 60 61 61 62 public: … … 160 161 struct tr_session_stats myCumulativeStats; 161 162 QString mySessionVersion; 163 int64_t myDownloadDirFreeSpace; 162 164 }; 163 165
Note: See TracChangeset
for help on using the changeset viewer.