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

Method Compare

src/GenericClientListCtrl.cpp:1176–1338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1174}
1175
1176int CGenericClientListCtrl::Compare(
1177 const CClientRef& client1, const CClientRef& client2, long lParamSort)
1178{
1179 switch (lParamSort) {
1180 // Sort by name
1181 case ColumnUserName:
1182 return CmpAny( client1.GetUserName(), client2.GetUserName() );
1183
1184 // Sort by transferred in the following fields
1185 case ColumnUserDownloaded:
1186 return CmpAny( client1.GetTransferredDown(), client2.GetTransferredDown() );
1187
1188 // Sort by transferred in the following fields
1189 case ColumnUserUploaded:
1190 return CmpAny( client1.GetTransferredUp(), client2.GetTransferredUp() );
1191
1192 // Sort by speed
1193 case ColumnUserSpeedDown:
1194 return CmpAny( client1.GetKBpsDown(), client2.GetKBpsDown() );
1195
1196 // Sort by speed
1197 case ColumnUserSpeedUp:
1198 return CmpAny( client1.GetUploadDatarate(), client2.GetUploadDatarate() );
1199
1200 // Sort by parts offered
1201 case ColumnUserProgress:
1202 return CmpAny(
1203 client1.GetAvailablePartCount(),
1204 client2.GetAvailablePartCount() );
1205
1206 // Sort by client version
1207 case ColumnUserVersion: {
1208 int cmp = client1.GetSoftStr().Cmp(client2.GetSoftStr());
1209
1210 if (cmp == 0) {
1211 cmp = CmpAny(client1.GetVersion(), client2.GetVersion());
1212 }
1213 if (cmp == 0) {
1214 cmp = client1.GetClientModString().Cmp(client2.GetClientModString());
1215 }
1216 return cmp;
1217 }
1218
1219 // Sort by Queue-Rank
1220 case ColumnUserQueueRankRemote: {
1221 // This will sort by download state: Downloading, OnQueue, Connecting ...
1222 // However, Asked For Another will always be placed last, due to
1223 // sorting in SortProc
1224 if ( client1.GetDownloadState() != client2.GetDownloadState() ) {
1225 return client1.GetDownloadState() - client2.GetDownloadState();
1226 }
1227
1228 // Placing items on queue before items on full queues
1229 if ( client1.IsRemoteQueueFull() ) {
1230 if ( client2.IsRemoteQueueFull() ) {
1231 return 0;
1232 } else {
1233 return 1;

Callers

nothing calls this directly

Calls 15

GetPrintableMethod · 0.80
CmpAnyFunction · 0.70
GetTransferredDownMethod · 0.45
GetTransferredUpMethod · 0.45
GetKBpsDownMethod · 0.45
GetUploadDatarateMethod · 0.45
GetAvailablePartCountMethod · 0.45
GetVersionMethod · 0.45
GetDownloadStateMethod · 0.45
IsRemoteQueueFullMethod · 0.45
GetRemoteQueueRankMethod · 0.45
GetUploadStateMethod · 0.45

Tested by

no test coverage detected