Changeset 13992
- Timestamp:
- Feb 9, 2013, 4:42:07 AM (8 years ago)
- Location:
- trunk/qt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/freespace-label.cc
r13991 r13992 29 29 mySession (session), 30 30 myTag (-1), 31 myPath (path),32 31 myTimer (this) 33 32 { … … 41 40 this, SLOT(onSessionExecuted(int64_t, const QString&, struct tr_variant*))); 42 41 43 onTimer (); 42 setPath (path); 43 } 44 45 void 46 FreespaceLabel :: setPath (const QString& path) 47 { 48 if (myPath != path) 49 { 50 setText (tr("<i>Counting Free Space...</i>")); 51 myPath = path; 52 onTimer (); 53 } 44 54 } 45 55 -
trunk/qt/freespace-label.h
r13991 r13992 28 28 FreespaceLabel (Session&, const QString& path, QWidget *parent=0); 29 29 virtual ~FreespaceLabel () {} 30 void setPath (const QString& folder) { myPath=folder; onTimer(); }30 void setPath (const QString& folder); 31 31 32 32 private: -
trunk/qt/options.cc
r13991 r13992 10 10 * $Id$ 11 11 */ 12 13 #include <cstdio>14 12 15 13 #include <QApplication> … … 88 86 myVerifyButton( 0 ), 89 87 myVerifyFile( 0 ), 90 myVerifyHash( QCryptographicHash::Sha1 ) 91 88 myVerifyHash( QCryptographicHash::Sha1 ), 89 myEditTimer (this) 92 90 { 93 91 setWindowTitle( tr( "Open Torrent" ) ); … … 95 93 QGridLayout * layout = new QGridLayout( this ); 96 94 int row = 0; 95 96 myEditTimer.setInterval (2000); 97 myEditTimer.setSingleShot (true); 98 connect (&myEditTimer, SIGNAL(timeout()), this, SLOT(onDestinationEditedIdle())); 97 99 98 100 const int iconSize( style( )->pixelMetric( QStyle :: PM_SmallIconSize ) ); … … 121 123 layout->addWidget( l, ++row, 0, Qt::AlignLeft ); 122 124 const QString downloadDir (prefs.getString (Prefs::DOWNLOAD_DIR)); 125 myFreespaceLabel = new FreespaceLabel (mySession, downloadDir, this); 123 126 124 127 if( session.isLocal( ) ) … … 139 142 layout->addWidget( e, row, 1 ); 140 143 l->setBuddy( e ); 141 } 142 143 l = myFreespaceLabel = new FreespaceLabel (mySession, downloadDir, this); 144 connect (e, SIGNAL(textEdited(const QString&)), this, SLOT(onDestinationEdited(const QString&))); 145 } 146 147 l = myFreespaceLabel; 144 148 layout->addWidget (l, ++row, 0, 1, 2, Qt::Alignment (Qt::AlignRight | Qt::AlignTop)); 145 149 layout->setRowMinimumHeight (row, l->height() + HIG::PAD); … … 464 468 refreshDestinationButton (); 465 469 } 470 } 471 472 void 473 Options :: onDestinationEdited (const QString& text) 474 { 475 Q_UNUSED (text); 476 477 myEditTimer.start (); 478 } 479 480 void 481 Options :: onDestinationEditedIdle () 482 { 483 myFreespaceLabel->setPath (myDestinationEdit->text()); 466 484 } 467 485 -
trunk/qt/options.h
r13991 r13992 103 103 void onFilesSelected( const QStringList& ); 104 104 void onDestinationsSelected( const QStringList& ); 105 void onDestinationEdited (const QString&); 106 void onDestinationEditedIdle (); 105 107 106 108 private: … … 120 122 typedef QMap<uint32_t,int32_t> mybins_t; 121 123 mybins_t myVerifyBins; 124 QTimer myEditTimer; 122 125 123 126 };
Note: See TracChangeset
for help on using the changeset viewer.