← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n] Rev 404: Translate transfers

 

------------------------------------------------------------
revno: 404
committer: Steven Sheehy <steven.sheehy@xxxxxxxxx>
branch nick: linuxdcpp-i18n
timestamp: Wed 2010-11-17 01:50:41 -0600
message:
  Translate transfers
modified:
  glade/sharebrowser.glade
  linux/transfers.cc


--
lp:~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n

Your team LinuxDC++ Team is subscribed to branch lp:~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n/+edit-subscription
=== modified file 'glade/sharebrowser.glade'
--- glade/sharebrowser.glade	2009-06-17 03:28:37 +0000
+++ glade/sharebrowser.glade	2010-11-17 07:50:41 +0000
@@ -80,7 +80,7 @@
         </child>
         <child>
           <widget class="GtkStatusbar" id="filesStatus">
-            <property name="width_request">120</property>
+            <property name="width_request">130</property>
             <property name="visible">True</property>
             <property name="has_resize_grip">False</property>
           </widget>
@@ -92,7 +92,7 @@
         </child>
         <child>
           <widget class="GtkStatusbar" id="totalStatus">
-            <property name="width_request">120</property>
+            <property name="width_request">150</property>
             <property name="visible">True</property>
             <property name="has_resize_grip">False</property>
           </widget>

=== modified file 'linux/transfers.cc'
--- linux/transfers.cc	2010-10-22 04:05:48 +0000
+++ linux/transfers.cc	2010-11-17 07:50:41 +0000
@@ -506,8 +506,10 @@
 void Transfers::updateParent_gui(GtkTreeIter* iter)
 {
 	int active = 0;
+	int total = 0;
 	GtkTreeIter child;
 	string users;
+	string status;
 	std::set<string> hubs;
 	bool valid;
 	int64_t speed = 0;
@@ -515,7 +517,6 @@
 	int64_t totalSize = 0;
 	int64_t timeLeft = 0;
 	double progress = 0.0;
-	ostringstream stream;
 	ostringstream tmpHubs;
 
 	position = transferView.getValue<int64_t>(iter, "Download Position");
@@ -535,6 +536,7 @@
 				speed += transferView.getValue<int64_t>(&child, "Speed");
 				position += transferView.getValue<int64_t>(&child, "Download Position");	
 			}
+			++total;
 			users += transferView.getString(&child, "User") + string(", ");
 			hubs.insert(transferView.getString(&child, "Hub Name"));
 			valid = WulforUtil::getNextIter_gui(GTK_TREE_MODEL(transferStore), &child, TRUE, FALSE);
@@ -546,31 +548,27 @@
 	if (speed > 0)
 		timeLeft = (totalSize - position) / speed;
 
-	stream << setiosflags(ios::fixed) << setprecision(1);
-
 	if (transferView.getValue<gboolean>(iter, "Failed") == 0)
 	{
 		if (active)
-			stream << _("Downloaded ");
+			status = F_("Downloaded %1% (%2$.1f%%)", % Util::formatBytes(position) % progress);
 		else
-			stream << _("Waiting for slot ");
-
-		stream << Util::formatBytes(position) << " (" << progress;
-		stream << _("%) from ") << active << "/" << gtk_tree_model_iter_n_children(GTK_TREE_MODEL(transferStore), iter) << _(" user(s)");
+			status = _("Waiting for slot");
 	}
 	else
 	{
-		stream << transferView.getString(iter, "Status");
+		status = transferView.getString(iter, "Status");
 	}
 
+	string user = P_("%1% of %2% User", "%1% of %2% Users", % active % total, total);
 	std::copy(hubs.begin(), hubs.end(), std::ostream_iterator<string>(tmpHubs, ", "));
 
 	gtk_tree_store_set(transferStore, iter, 
-		transferView.col("User"), users.substr(0, users.length()-2).c_str(),
+		transferView.col("User"), user.c_str(),
 		transferView.col("Hub Name"), tmpHubs.str().substr(0, tmpHubs.str().length()-2).c_str(),
 		transferView.col("Speed"), speed, 
 		transferView.col("Time Left"), timeLeft,
-		transferView.col("Status"), stream.str().c_str(), 
+		transferView.col("Status"), status.c_str(), 
 		transferView.col("Progress"), static_cast<int>(progress),
 		transferView.col("Sort Order"), active ? (string("d").append(users)).c_str() : (string("w").append(users)).c_str(), 
 		-1);
@@ -729,7 +727,7 @@
 			gtk_tree_store_set(transferStore, &iter,
 				transferView.col("Status"), status.c_str(),
 				transferView.col("Failed"), (gboolean)1, 
-				transferView.col("Speed"), (uint64_t)-1,
+				transferView.col("Speed"), (gint64)-1,
 				-1);
 		}
 	}
@@ -894,22 +892,29 @@
 		
 		getParams_client(params, *it);
 
+		// TODO: These flags in the status are a hack and should be redesigned.
 		if (dl->getUserConnection().isSecure())
 		{
 			if (dl->getUserConnection().isTrusted())
+				// TRANSLATORS: Status flag to indicate transfer is secure and trusted.
 				stream << _("[S]");
 			else
+				// TRANSLATORS: Status flag to indicate transfer is secure but untrusted.
 				stream << _("[U]");
 		}
 		if (dl->isSet(Download::FLAG_TTH_CHECK))
+			// TRANSLATORS: Status flag to indicate a TTH check will be performed on the transfer.
 			stream << _("[T]");
 		if (dl->isSet(Download::FLAG_ZDOWNLOAD))
+			// TRANSLATORS: Status flag to indicate transfer is compressed.
 			stream << _("[Z]");
 
-		stream << setiosflags(ios::fixed) << setprecision(1);
-		stream << " " << _("Downloaded ") << Util::formatBytes(dl->getPos()) << " (" << params["Progress"]
-		<< "%) in " << Util::formatSeconds((GET_TICK() - dl->getStart()) / 1000);
-		params["Status"] = stream.str();
+		string bytes = Util::formatBytes(dl->getPos());
+		double progress = dl->getSize() <= 0 ? 0.0 : static_cast<double>(dl->getPos() * 100.0) / dl->getSize();
+
+		// TRANSLATORS: Shows the bytes downloaded and the percentage completed.
+		string status = F_("Downloaded %1% (%2$.1f%%)", % bytes % progress);
+		params["Status"] = stream.tellp() > 0 ? stream.str() + " " + status : status;
 
 		typedef Func2<Transfers, StringMap, bool> F2;
 		F2* f2 = new F2(this, &Transfers::updateTransfer_gui, params, TRUE);
@@ -1057,7 +1062,7 @@
 		Upload* ul = *it;
 		StringMap params;
 		ostringstream stream;
-		
+
 		getParams_client(params, ul);
 
 		if (ul->getUserConnection().isSecure())
@@ -1070,10 +1075,12 @@
 		if (ul->isSet(Upload::FLAG_ZUPLOAD))
 			stream << _("[Z]");
 
-		stream << setiosflags(ios::fixed) << setprecision(1);
-		stream << " " << _("Uploaded ") << Util::formatBytes(ul->getPos()) << " (" << params["Progress"]
-		<< "%) in " << Util::formatSeconds((GET_TICK() - ul->getStart()) / 1000);
-		params["Status"] = stream.str();
+		string bytes = Util::formatBytes(ul->getPos());
+		double progress = ul->getSize() <= 0 ? 0.0 : static_cast<double>(ul->getPos() * 100.0) / ul->getSize();
+
+		// TRANSLATORS: Shows the bytes uploaded and the percentage completed.
+		string status = F_("Uploaded %1% (%2$.1f%%)", % bytes % progress);
+		params["Status"] = stream.tellp() > 0 ? stream.str() + " " + status : status;
 
 		typedef Func2<Transfers, StringMap, bool> F2;
 		F2* f2 = new F2(this, &Transfers::updateTransfer_gui, params, FALSE);