| 3676 | |
| 3677 | |
| 3678 | void CPartFile::UpdateFileRatingCommentAvail() |
| 3679 | { |
| 3680 | bool prevComment = m_hasComment; |
| 3681 | int prevRating = m_iUserRating; |
| 3682 | |
| 3683 | m_hasComment = false; |
| 3684 | m_iUserRating = 0; |
| 3685 | int ratingCount = 0; |
| 3686 | |
| 3687 | SourceSet::iterator it = m_SrcList.begin(); |
| 3688 | for (; it != m_SrcList.end(); ++it) { |
| 3689 | CUpDownClient* cur_src = it->GetClient(); |
| 3690 | |
| 3691 | if (!cur_src->GetFileComment().IsEmpty()) { |
| 3692 | if (thePrefs::IsCommentFiltered(cur_src->GetFileComment())) { |
| 3693 | continue; |
| 3694 | } |
| 3695 | m_hasComment = true; |
| 3696 | } |
| 3697 | |
| 3698 | uint8 rating = cur_src->GetFileRating(); |
| 3699 | if (rating) { |
| 3700 | wxASSERT(rating <= 5); |
| 3701 | |
| 3702 | ratingCount++; |
| 3703 | m_iUserRating += rating; |
| 3704 | } |
| 3705 | } |
| 3706 | |
| 3707 | if (ratingCount) { |
| 3708 | m_iUserRating /= ratingCount; |
| 3709 | wxASSERT(m_iUserRating > 0 && m_iUserRating <= 5); |
| 3710 | } |
| 3711 | |
| 3712 | if ((prevComment != m_hasComment) || (prevRating != m_iUserRating)) { |
| 3713 | UpdateDisplayedInfo(); |
| 3714 | // EC exports EC_TAG_PARTFILE_COMMENTS (rating + comments tag |
| 3715 | // tree). Sources can deliver new comments at any time via |
| 3716 | // OP_MESSAGE; without a mark here amulegui would only refresh |
| 3717 | // when something else on the file changes. |
| 3718 | MarkECChanged(); |
| 3719 | } |
| 3720 | } |
| 3721 | |
| 3722 | |
| 3723 | void CPartFile::SetCategory(uint8 cat) |
no test coverage detected