00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "LiveList.h"
00025 #include "DlgDownloadReviews.h"
00026 #include "Settings.h"
00027 #include "Download.h"
00028 #include "CoolInterface.h"
00029 #include "Skin.h"
00030 #include "Downloads.h"
00031 #include "Transfers.h"
00032
00033
00034
00035 IMPLEMENT_DYNAMIC(CDownloadReviewDlg, CSkinDialog)
00036
00037 BEGIN_MESSAGE_MAP(CDownloadReviewDlg, CSkinDialog)
00038 END_MESSAGE_MAP()
00039
00040
00042
00043
00044 CDownloadReviewDlg::CDownloadReviewDlg(CWnd* pParent, CDownload* pDownload) : CSkinDialog( CDownloadReviewDlg::IDD, pParent )
00045 {
00046 m_pDownload = pDownload;
00047 }
00048
00049 CDownloadReviewDlg::~CDownloadReviewDlg()
00050 {
00051
00052 }
00053
00054 void CDownloadReviewDlg::DoDataExchange(CDataExchange* pDX)
00055 {
00056 CSkinDialog::DoDataExchange(pDX);
00057 DDX_Control(pDX, IDC_REVIEWS, m_wndReviews);
00058 DDX_Text(pDX, IDC_REVIEW_FILENAME, m_sReviewFileName);
00059
00060 }
00061
00063
00064
00065 BOOL CDownloadReviewDlg::OnInitDialog()
00066 {
00067 CSkinDialog::OnInitDialog();
00068
00069 CRect rcList;
00070 m_wndReviews.GetClientRect( &rcList );
00071 rcList.right -= GetSystemMetrics( SM_CXVSCROLL );
00072
00073 m_wndReviews.SetImageList( &CoolInterface.m_pImages, LVSIL_SMALL );
00074
00075 m_wndReviews.InsertColumn( 0, _T("User"), LVCFMT_LEFT, 100, -1 );
00076 m_wndReviews.InsertColumn( 1, _T("Rating"), LVCFMT_CENTER, 90, 0 );
00077 m_wndReviews.InsertColumn( 2, _T("Comments"), LVCFMT_CENTER, rcList.right- 100 - 80, 1 );
00078 m_wndReviews.InsertColumn( 3, _T("Order"), LVCFMT_CENTER, 0, 2 );
00079 Skin.Translate( _T("CReviewList"), m_wndReviews.GetHeaderCtrl() );
00080
00081 m_wndReviews.SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE,
00082 LVS_EX_FULLROWSELECT|LVS_EX_LABELTIP, LVS_EX_FULLROWSELECT|LVS_EX_LABELTIP );
00083 m_wndReviews.EnableToolTips();
00084
00085
00086 CLiveList::Sort( &m_wndReviews, 3, FALSE );
00087 CLiveList::Sort( &m_wndReviews, 3, FALSE );
00088
00089
00090 CLiveList pReviews( 4 );
00091 int nIndex = 1;
00092
00093 CSingleLock pLock( &Transfers.m_pSection, TRUE );
00094
00095 if ( ! m_pDownload ) return FALSE;
00096
00097 m_sReviewFileName = m_pDownload->m_sRemoteName;
00098
00099 CDownloadReview* pReview = m_pDownload->GetFirstReview();
00100
00101 while ( pReview )
00102 {
00103 CLiveItem* pItem = pReviews.Add( pReview );
00104
00105
00106
00107
00108 switch ( pReview->m_nUserPicture )
00109 {
00110 case 0:
00111 pItem->m_nImage = CoolInterface.ImageForID( ID_TOOLS_WIZARD );
00112 break;
00113 case 1:
00114 pItem->m_nImage = CoolInterface.ImageForID( ID_TOOLS_PROFILE );
00115 break;
00116 case 2:
00117 pItem->m_nImage = CoolInterface.ImageForID( ID_TOOLS_WIZARD );
00118 break;
00119 case 3:
00120 pItem->m_nImage = CoolInterface.ImageForID( ID_TOOLS_PROFILE );
00121 break;
00122 default:
00123 pItem->m_nImage = CoolInterface.ImageForID( ID_TOOLS_PROFILE );
00124 }
00125
00126 pItem->Set( 0, pReview->m_sUserName );
00127
00128 int nRating = min( pReview->m_nFileRating, 6 );
00129 nRating = max ( nRating, 0 );
00130 CString strRating;
00131 LoadString( strRating, IDS_RATING_NORATING + nRating );
00132 pItem->Set( 1, strRating );
00133
00134
00135 pItem->Set( 2, pReview->m_sFileComments );
00136 pItem->Format( 3, _T("%i"), nIndex );
00137
00138
00139 nIndex++;
00140 pReview = pReview->m_pNext;
00141 }
00142
00143 pLock.Unlock();
00144
00145
00146
00147 pReviews.Apply( &m_wndReviews, TRUE );
00148
00149
00150 SkinMe( NULL, IDR_MEDIAFRAME );
00151
00152 UpdateData( FALSE );
00153
00154 return TRUE;
00155 }
00156
00157
00158
00159 void CDownloadReviewDlg::OnOK()
00160 {
00161 UpdateData( TRUE );
00162
00163 CSkinDialog::OnOK();
00164 }
00165