void VideoPreview::AddTempFileToPreview(QueueItem* tempItem, HWND serverReadyReport) { if (tempItem != NULL) { _canUseFile = false; clear(); _callWnd = serverReadyReport; _currentFilePreview = tempItem->getTarget(); _previewFileSize = tempItem->getSize(); m_tempFilename = tempItem->getTempTarget(); _fileRoadMap = unique_ptr<FileRoadMap>(new FileRoadMap(_previewFileSize)); QueueItem::SegmentSet segments; { RLock(*QueueItem::g_cs); segments = tempItem->getDoneL(); } for (auto i = segments.cbegin(); i != segments.cend(); ++i) { addSegment(i->getStart(), i->getEnd()); } tempItem->setDelegate(this); _canUseFile = true; StartServer(); _viewStarted = false; } }
bool operator<(const this_type& m) const { bool ret; RLock(); m.RLock(); ret = parent_type::operator<(m); m.RUnlock(); RUnlock(); return ret; }
// !SMT!-UI void UserInfoSimple::addSummaryMenu() { // TODO: move obtain information about the user in the UserManager if (!getUser()) return; CWaitCursor l_cursor_wait; //-V808 UserInfoGuiTraits::userSummaryMenu.InsertSeparatorLast(getUser()->getLastNickT()); ClientManager::UserParams l_params; if (ClientManager::getUserParams(getUser(), l_params)) { tstring userInfo = TSTRING(SLOTS) + _T(": ") + Util::toStringW(l_params.m_slots) + _T(", ") + TSTRING(SHARED) + _T(": ") + Util::formatBytesW(l_params.m_bytesShared); if (l_params.m_limit) { userInfo += _T(", ") + TSTRING(SPEED_LIMIT) + _T(": ") + Util::formatBytesW(l_params.m_limit) + _T('/') + WSTRING(SEC); } UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_STRING | MF_DISABLED, IDC_NONE, userInfo.c_str()); const time_t slot = UploadManager::getReservedSlotTime(getUser()); if (slot) { const tstring note = TSTRING(EXTRA_SLOT_TIMEOUT) + _T(": ") + Util::formatSecondsW((slot - GET_TICK()) / 1000); UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_STRING | MF_DISABLED, IDC_NONE, note.c_str()); } if (!l_params.m_ip.empty()) { UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_STRING | MF_DISABLED, IDC_NONE, l_params.getTagIP().c_str()); const Util::CustomNetworkIndex l_location = Util::getIpCountry(l_params.m_ip, true); // Не обращаемся в базу данных const tstring loc = TSTRING(COUNTRY) + _T(": ") + l_location.getCountry() + _T(", ") + l_location.getDescription(); UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_STRING | MF_DISABLED, IDC_NONE, loc.c_str()); HubFrame::addDupeUsersToSummaryMenu(l_params); } else { UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_STRING | MF_DISABLED, IDC_NONE, l_params.getTagIP().c_str()); HubFrame::addDupeUsersToSummaryMenu(l_params); } } //UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_SEPARATOR); bool caption = false; { UploadManager::LockInstanceQueue lockedInstance; const auto& users = lockedInstance->getUploadQueueL(); for (auto uit = users.cbegin(); uit != users.cend(); ++uit) { if (uit->getUser() == getUser()) { uint8_t l_count_menu = 0; // [+]PPA for (auto i = uit->m_waiting_files.cbegin(); i != uit->m_waiting_files.cend(); ++i) { if (!caption) { UserInfoGuiTraits::userSummaryMenu.InsertSeparatorLast(TSTRING(USER_WAIT_MENU)); caption = true; } const tstring note = _T('[') + Util::toStringW((double)(*i)->getPos() * 100.0 / (double)(*i)->getSize()) + _T("% ") + Util::formatSecondsW(GET_TIME() - (*i)->getTime()) + _T("]\t") + Text::toT((*i)->getFile()); UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_STRING | MF_DISABLED, IDC_NONE, note.c_str()); if (l_count_menu++ == 10) //[+]PPA { UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_STRING | MF_DISABLED, IDC_NONE, _T("...")); break; } } } } } caption = false; { uint8_t l_count_menu = 0; // [+]PPA RLock(*QueueItem::g_cs); QueueManager::LockFileQueueShared l_fileQueue; const auto& downloads = l_fileQueue.getQueueL(); for (auto j = downloads.cbegin(); j != downloads.cend(); ++j) { const QueueItemPtr& aQI = j->second; const bool src = aQI->isSourceL(getUser()); bool badsrc = false; if (!src) { badsrc = aQI->isBadSourceL(getUser()); } if (src || badsrc) { if (!caption) { UserInfoGuiTraits::userSummaryMenu.InsertSeparatorLast(TSTRING(NEED_USER_FILES_MENU)); caption = true; } tstring note = Text::toT(aQI->getTarget()); if (aQI->getSize() > 0) { note += tstring(_T("\t(")) + Util::toStringW((double)aQI->getDownloadedBytes() * 100.0 / (double)aQI->getSize()) + tstring(_T("%)")); } const UINT flags = MF_STRING | MF_DISABLED | (badsrc ? MF_GRAYED : 0); UserInfoGuiTraits::userSummaryMenu.AppendMenu(flags, IDC_NONE, note.c_str()); if (l_count_menu++ == 10) //[+]PPA { UserInfoGuiTraits::userSummaryMenu.AppendMenu(MF_STRING | MF_DISABLED, IDC_NONE, _T("...")); break; } } } } }