← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2338: tooltip tweaks

 

------------------------------------------------------------
revno: 2338
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-12-09 00:15:35 +0100
message:
  tooltip tweaks
modified:
  dwt/src/widgets/Table.cpp
  win32/UserInfoBase.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 'dwt/src/widgets/Table.cpp'
--- dwt/src/widgets/Table.cpp	2010-12-08 17:21:01 +0000
+++ dwt/src/widgets/Table.cpp	2010-12-08 23:15:35 +0000
@@ -572,6 +572,11 @@
 
 void Table::setTooltips(const TooltipDispatcher::F& f) {
 	addRemoveTableExtendedStyle(LVS_EX_INFOTIP, true);
+	HWND tip = ListView_GetToolTips(handle());
+	if(tip) {
+		// make tooltips last longer
+		::SendMessage(tip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM(::SendMessage(tip, TTM_GETDELAYTIME, TTDT_AUTOPOP, 0) * 3, 0));
+	}
 	addCallback(Message(WM_NOTIFY, LVN_GETINFOTIP), TooltipDispatcher(f));
 }
 

=== modified file 'win32/UserInfoBase.cpp'
--- win32/UserInfoBase.cpp	2010-12-08 16:54:29 +0000
+++ win32/UserInfoBase.cpp	2010-12-08 23:15:35 +0000
@@ -104,9 +104,9 @@
 		return ret;
 	const Identity& id = ou->getIdentity();
 
-	auto getField = [&id](const char* code) -> tstring {
-		string field = id.get(code);
-		return field.empty() ? _T("?") : Text::toT(field);
+	auto addValue = [&id, &addLine](const tstring& descr, const string& value) {
+		if(!value.empty())
+			addLine(str(TF_("%1%: %2%") % descr % Text::toT(value)));
 	};
 
 	if(id.isHidden())
@@ -118,16 +118,21 @@
 	if(id.isAway())
 		addLine(T_("In away mode"));
 
-	addLine(str(TF_("Shared: %1%") % Text::toT(Util::formatBytes(id.getBytesShared()))));
-	addLine(str(TF_("Description: %1%") % Text::toT(id.getDescription())));
-	addLine(str(TF_("Tag: %1%") % Text::toT(id.getTag())));
-	addLine(str(TF_("Connection: %1%") % Text::toT(id.getConnection())));
-	addLine(str(TF_("IP: %1%") % getField("I4")));
-	const string country = id.getCountry();
-	if(!country.empty())
-		addLine(str(TF_("Country: %1%") % Text::toT(country)));
-	addLine(str(TF_("E-mail: %1%") % Text::toT(id.getEmail())));
-	addLine(str(TF_("Slots: %1%/%2%") % getField("FS") % getField("SL")));
+	addValue(T_("Shared"), Util::formatBytes(id.getBytesShared()));
+	addValue(T_("Description"), id.getDescription());
+	addValue(T_("Tag"), id.getTag());
+	addValue(T_("Connection"), id.getConnection());
+	addValue(T_("IP"), id.getIp());
+	addValue(T_("Country"), id.getCountry());
+	addValue(T_("E-mail"), id.getEmail());
+	string slots = id.get("SL");
+	if(!slots.empty()) {
+		tstring value = Text::toT(slots);
+		string fs = id.get("FS");
+		if(!fs.empty())
+			value = str(TF_("%1%/%2%") % Text::toT(fs) % value);
+		addLine(str(TF_("%1%: %2%") % T_("Slots") % value));
+	}
 
 	return ret;
 }