Changeset 306
- Timestamp:
- 09/24/07 15:26:10 (13 years ago)
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/HaliteDialog.cpp
r296 r306 172 172 } 173 173 174 void HaliteDialog::focusChanged( string& torrent_name)174 void HaliteDialog::focusChanged(const hal::TorrentDetail_ptr pT) 175 175 { 176 176 pair<float, float> tranLimit(-1.0, -1.0); 177 177 pair<int, int> connLimit(-1, -1); 178 178 179 if ( hal::bittorrent().isTorrent(torrent_name))180 { 181 tranLimit = hal::bittorrent().getTorrentSpeed( torrent_name);182 connLimit = hal::bittorrent().getTorrentLimit( torrent_name);183 184 if (!hal::bittorrent().isTorrentActive( torrent_name))179 if (pT) 180 { 181 tranLimit = hal::bittorrent().getTorrentSpeed(pT->name()); 182 connLimit = hal::bittorrent().getTorrentLimit(pT->name()); 183 184 if (!hal::bittorrent().isTorrentActive(pT->name())) 185 185 SetDlgItemText(BTNPAUSE, L"Resume"); 186 186 else … … 236 236 string torrent_name = hal::to_utf8(torrent->name()); 237 237 238 if (current_torrent_name_ != torrent_name)239 {240 current_torrent_name_ = torrent_name;241 focusChanged(current_torrent_name_);242 }243 244 238 SetDlgItemText(IDC_NAME, torrent->name().c_str()); 245 239 SetDlgItemText(IDC_TRACKER, torrent->currentTracker().c_str()); … … 266 260 m_list.uiUpdate(tD); 267 261 } 268 else 269 { 270 if (current_torrent_name_ != "") 271 { 272 current_torrent_name_ = ""; 273 focusChanged(current_torrent_name_); 274 } 275 } 276 } 262 } -
src/HaliteDialog.hpp
r303 r306 208 208 209 209 void uiUpdate(const hal::TorrentDetails& allTorrents); 210 void focusChanged( string& torrent_name);210 void focusChanged(const hal::TorrentDetail_ptr pT); 211 211 212 212 protected: -
src/HaliteDialogBase.hpp
r302 r306 24 24 haliteWindow_(haliteWindow) 25 25 { 26 connection_ = haliteWindow.connectUiUpdate(bind(&TBase::uiUpdate, static_cast<TBase*>(this), _1)); 26 connection_ = haliteWindow.connectUiUpdate(bind(&thisClass::handleUiUpdate, this, _1)); 27 } 28 29 BEGIN_MSG_MAP_EX(thisClass) 30 MSG_WM_SHOWWINDOW(OnShow) 31 // REFLECT_NOTIFICATIONS() 32 END_MSG_MAP() 33 34 void OnShow(bool show, int flags) 35 { 36 if (show) 37 { 38 hal::event().post(shared_ptr<hal::EventDetail>( 39 new hal::EventMsg(L"True"))); 40 connection_.unblock(); 41 } 42 else 43 { 44 hal::event().post(shared_ptr<hal::EventDetail>( 45 new hal::EventMsg(L"False"))); 46 connection_.block(); 47 } 27 48 } 28 49 … … 41 62 42 63 void uiUpdate(const hal::TorrentDetails& tD) 64 {} 65 66 void handleUiUpdate(const hal::TorrentDetails& tD) 67 { 68 TBase* pT = static_cast<TBase*>(this); 69 wstring torrent_name = L""; 70 71 if (hal::TorrentDetail_ptr torrent = tD.selectedTorrent()) 72 torrent_name = torrent->filename(); 73 74 if (current_torrent_name_ != torrent_name) 75 { 76 current_torrent_name_ = torrent_name; 77 pT->focusChanged(tD.focusedTorrent()); 78 } 79 80 pT->uiUpdate(tD); 81 } 82 83 void focusChanged(const hal::TorrentDetail_ptr pT) 43 84 {} 44 85 … … 53 94 54 95 protected: 96 wstring current_torrent_name_; 55 97 56 98 private: -
src/HaliteWindow.hpp
r302 r306 182 182 ar & BOOST_SERIALIZATION_NVP(activeTab); 183 183 } 184 184 185 185 friend class GeneralOptions; 186 186 -
src/advtabs/Files.cpp
r305 r306 224 224 hal::event().post(shared_ptr<hal::EventDetail>(new hal::EventDebug(hal::Event::info, (wformat(L"doUiUpdate %1%") % current_torrent_name_).str().c_str()))); 225 225 226 current_torrent_name_ = L"";226 focusChanged(hal::bittorrent().torrentDetails().focusedTorrent()); 227 227 uiUpdate(hal::bittorrent().torrentDetails()); 228 228 } … … 230 230 void AdvFilesDialog::uiUpdate(const hal::TorrentDetails& tD) 231 231 { 232 wstring torrent_name = L"";233 234 if (hal::TorrentDetail_ptr torrent = tD.selectedTorrent())235 torrent_name = torrent->filename();236 237 // hal::event().post(shared_ptr<hal::EventDetail>(new hal::EventDebug(hal::Event::info, (wformat(L"uiUpdate %1%, %2%") % current_torrent_name_ % torrent_name).str().c_str())));238 239 if (current_torrent_name_ != torrent_name)240 {241 focusChanged(torrent_name);242 }243 244 232 if (fileDetails_.empty()) return; 245 233 … … 297 285 } 298 286 299 void AdvFilesDialog::focusChanged(wstring& torrent_name) 300 { 301 hal::event().post(shared_ptr<hal::EventDetail>(new hal::EventDebug(hal::Event::info, (wformat(L"focusChanged %1%, %2% : %3%") % current_torrent_name_ % torrent_name % tree_.focused()).str().c_str()))); 302 303 current_torrent_name_ = torrent_name; 304 305 const hal::TorrentDetails& tD = hal::bittorrent().torrentDetails(); 306 287 void AdvFilesDialog::focusChanged(const hal::TorrentDetail_ptr pT) 288 { 307 289 fileDetails_.clear(); 308 // foreach (const hal::TorrentDetail_ptr torrent, tD.selectedTorrents()) 309 if (hal::TorrentDetail_ptr torrent = tD.focusedTorrent()) 310 { 311 std::copy(torrent->fileDetails().begin(), torrent->fileDetails().end(), 290 if (pT) 291 { 292 std::copy(pT->fileDetails().begin(), pT->fileDetails().end(), 312 293 std::back_inserter(fileDetails_)); 313 294 } 314 295 315 list_.setFocused( tD.focusedTorrent());296 list_.setFocused(pT); 316 297 317 298 std::sort(fileDetails_.begin(), fileDetails_.end()); -
src/advtabs/Files.hpp
r305 r306 354 354 if (PreTranslateMessage((LPMSG)lParam)) return TRUE; 355 355 356 CHAIN_MSG_MAP(dialogBaseClass) 356 357 CHAIN_MSG_MAP(resizeClass) 357 358 CHAIN_MSG_MAP(baseClass) … … 376 377 void doUiUpdate(); 377 378 void uiUpdate(const hal::TorrentDetails& tD); 378 void focusChanged( wstring& torrent_name);379 void focusChanged(const hal::TorrentDetail_ptr pT); 379 380 380 381 protected: -
src/advtabs/Torrent.cpp
r270 r306 57 57 } 58 58 59 void AdvTorrentDialog::focusChanged( string& torrent_name)59 void AdvTorrentDialog::focusChanged(const hal::TorrentDetail_ptr pT) 60 60 { 61 61 pair<float, float> tranLimit(-1.0, -1.0); … … 63 63 float ratio = 0; 64 64 65 if ( hal::bittorrent().isTorrent(torrent_name))65 if (pT) 66 66 { 67 tranLimit = hal::bittorrent().getTorrentSpeed( torrent_name);68 connLimit = hal::bittorrent().getTorrentLimit( torrent_name);67 tranLimit = hal::bittorrent().getTorrentSpeed(pT->name()); 68 connLimit = hal::bittorrent().getTorrentLimit(pT->name()); 69 69 70 ratio = hal::bittorrent().getTorrentRatio( torrent_name);70 ratio = hal::bittorrent().getTorrentRatio(pT->name()); 71 71 72 72 ::EnableWindow(GetDlgItem(IDC_EDITTLD), true); … … 110 110 void AdvTorrentDialog::uiUpdate(const hal::TorrentDetails& tD) 111 111 { 112 if (hal::TorrentDetail_ptr torrent = tD.selectedTorrent()) 113 { 114 string torrent_name = hal::to_utf8(torrent->filename()); 115 116 if (current_torrent_name_ != torrent_name) 117 { 118 current_torrent_name_ = torrent_name; 119 focusChanged(current_torrent_name_); 120 } 121 122 uiUpdateSingle(tD.selectedTorrent()); 123 } 124 else 125 { 126 if (current_torrent_name_ != "") 127 { 128 current_torrent_name_ = ""; 129 focusChanged(current_torrent_name_); 130 } 112 if (hal::TorrentDetail_ptr torrent = tD.focusedTorrent()) 113 { 114 uiUpdateSingle(torrent); 131 115 } 132 116 } … … 142 126 HAL_RATE "Downloading at %1$.2fkb/s, Uploading at %2$.2fkb/s, Ratio %3$.2f." 143 127 */ 144 145 128 SetDlgItemInfo(IDC_NAME_STATUS, 146 129 wformat(hal::app().res_wstr(HAL_NAME_STATUS)) -
src/advtabs/Torrent.hpp
r282 r306 135 135 void uiUpdateSingle(const hal::TorrentDetail_ptr& torrent); 136 136 void uiUpdateNone(); 137 void focusChanged( string& torrent_name);137 void focusChanged(const hal::TorrentDetail_ptr pT); 138 138 139 139 protected:
Note: See TracChangeset
for help on using the changeset viewer.