← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3330: Fix transfer painting issues

 

------------------------------------------------------------
revno: 3330
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2013-08-01 00:14:05 +0200
message:
  Fix transfer painting issues
modified:
  changelog.txt
  win32/TransferView.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2013-07-31 21:49:25 +0000
+++ changelog.txt	2013-07-31 22:14:05 +0000
@@ -1,4 +1,5 @@
 * [L#1010996] Correct search responses (maksis, poy)
+* [L#1206658] Fix transfer painting issues (poy)
 
 -- 0.828 2013-07-23 --
 * Translation fixes

=== modified file 'win32/TransferView.cpp'
--- win32/TransferView.cpp	2013-07-20 14:27:45 +0000
+++ win32/TransferView.cpp	2013-07-31 22:14:05 +0000
@@ -732,17 +732,17 @@
 }
 
 void TransferView::addConn(const UpdateInfo& ui) {
+	auto conn = findConn(ui.user, ui.download);
+	if(conn) {
+		removeConn(*conn);
+	}
+
 	TransferInfo* transfer = nullptr;
-	auto conn = findConn(ui.user, ui.download);
 
 	if(ui.updateMask & UpdateInfo::MASK_PATH) {
 		// adding a connection we know the transfer of.
 		dcassert(!ui.path.empty()); // transfers are indexed by path; it can't be empty.
 		transfer = findTransfer(ui.path, ui.download);
-		if(conn && &conn->parent != transfer) {
-			removeConn(*conn);
-			conn = nullptr;
-		}
 		if(!transfer) {
 			transferItems.emplace_back(ui.tth, ui.download, ui.path, ui.tempPath);
 			transfer = &transferItems.back();
@@ -756,28 +756,22 @@
 
 	} else {
 		// this connection has just been created; we don't know what file it is for yet.
-		if(conn) {
-			removeConn(*conn);
-			conn = nullptr;
-		}
 		transferItems.emplace_back(TTHValue(), ui.download, ui.user.user->getCID().toBase32(), Util::emptyString);
 		transfer = &transferItems.back();
 		transfers->insert(transfer);
 	}
 
-	if(!conn) {
-		transfer->conns.emplace_back(ui.user, *transfer);
-		conn = &transfer->conns.back();
+	transfer->conns.emplace_back(ui.user, *transfer);
+	conn = &transfer->conns.back();
 
-		// only show the child connection item when there are multiple children.
-		auto connCount = transfer->conns.size();
-		if(connCount > 1) {
-			if(connCount == 2) {
-				// add the previous child.
-				transfers->insertChild(reinterpret_cast<LPARAM>(transfer), reinterpret_cast<LPARAM>(&transfer->conns.front()));
-			}
-			transfers->insertChild(reinterpret_cast<LPARAM>(transfer), reinterpret_cast<LPARAM>(conn));
+	// only show the child connection item when there are multiple children.
+	auto connCount = transfer->conns.size();
+	if(connCount > 1) {
+		if(connCount == 2) {
+			// add the previous child.
+			transfers->insertChild(reinterpret_cast<LPARAM>(transfer), reinterpret_cast<LPARAM>(&transfer->conns.front()));
 		}
+		transfers->insertChild(reinterpret_cast<LPARAM>(transfer), reinterpret_cast<LPARAM>(conn));
 	}
 
 	conn->update(ui);