MCPcopy Create free account
hub / github.com/amule-project/amule / SelectionUpdated

Method SelectionUpdated

src/SharedFilesWnd.cpp:106–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104
105
106void CSharedFilesWnd::SelectionUpdated()
107{
108 if (!sharedfilesctrl->IsSorting()) {
109 uint64 lTransferred = theApp->knownfiles->transferred;
110 uint32 lAccepted = theApp->knownfiles->accepted;
111 uint32 lRequested = theApp->knownfiles->requested;
112 m_bar_requests->SetRange( lRequested );
113 m_bar_accepted->SetRange( lAccepted );
114 m_bar_transfer->SetRange( lTransferred / 1024 );
115
116 CKnownFileVector fileVector;
117
118 // Create a total statistic for the selected item(s)
119 uint32 session_requests = 0;
120 uint32 session_accepted = 0;
121 uint64 session_transferred = 0;
122 uint32 all_requests = 0;
123 uint32 all_accepted = 0;
124 uint64 all_transferred = 0;
125
126 long index = -1;
127 int filter = (m_clientShow == ClientShowSelected) ? wxLIST_STATE_SELECTED : wxLIST_STATE_DONTCARE;
128 while ( (index = sharedfilesctrl->GetNextItem( index, wxLIST_NEXT_ALL, filter)) != -1) {
129 CKnownFile* file = reinterpret_cast<CKnownFile*>(sharedfilesctrl->GetItemData(index));
130 wxASSERT(file);
131
132 // Bars are always for selected files
133 if (sharedfilesctrl->GetItemState(index, wxLIST_STATE_SELECTED)) {
134 session_requests += file->statistic.GetRequests();
135 session_accepted += file->statistic.GetAccepts();
136 session_transferred += file->statistic.GetTransferred();
137
138 all_requests += file->statistic.GetAllTimeRequests();
139 all_accepted += file->statistic.GetAllTimeAccepts();
140 all_transferred += file->statistic.GetAllTimeTransferred();
141 }
142
143 if (m_clientShow != ClientShowUploading) {
144 fileVector.push_back(file);
145 }
146 }
147
148 if (fileVector.empty()) {
149 // Requests
150 m_bar_requests->SetValue( 0 );
151 CastChild(IDC_SREQUESTED, wxStaticText)->SetLabel( "- / -" );
152
153 // Accepted requests
154 m_bar_accepted->SetValue( 0 );
155 CastChild(IDC_SACCEPTED, wxStaticText)->SetLabel( "- / -" );
156
157 // Transferred
158 m_bar_transfer->SetValue( 0 );
159 CastChild(IDC_STRANSFERRED, wxStaticText)->SetLabel( "- / -" );
160
161 } else {
162 std::sort(fileVector.begin(), fileVector.end());
163

Callers 3

UpdateItemMethod · 0.80
EndBulkUpdateMethod · 0.80
ShowFilesCountMethod · 0.80

Calls 15

CFormatClass · 0.85
CastItoXBytesFunction · 0.85
IsSortingMethod · 0.80
SetRangeMethod · 0.80
GetNextItemMethod · 0.80
GetItemDataMethod · 0.80
GetItemStateMethod · 0.80
GetAllTimeRequestsMethod · 0.80
GetAllTimeAcceptsMethod · 0.80
GetAllTimeTransferredMethod · 0.80
GetRequestsMethod · 0.45

Tested by

no test coverage detected