← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2260: Separate IP and Country coloumn

 

------------------------------------------------------------
revno: 2260
author: iceman50 <bdcdevel@xxxxxxxxx>
committer: eMTee <emtee11@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Wed 2010-10-20 22:49:31 +0200
message:
  Separate IP and Country coloumn
modified:
  changelog.txt
  win32/AboutDlg.cpp
  win32/HubFrame.cpp
  win32/HubFrame.h
  win32/TransferView.cpp
  win32/TransferView.h


--
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	2010-10-07 16:54:32 +0000
+++ changelog.txt	2010-10-20 20:49:31 +0000
@@ -21,6 +21,7 @@
 * Customize the font selection dialog, save the charset (poy)
 * Blacklist rogue hub-lists (poy)
 * Fix some wrong menu fonts (poy)
+* Separate IP and Country coloumn in the list of users and connections (thanks iceman50)
 
 -- 0.770 2010-07-05 --
 * [L#550300] Catch more potential file corruptions (thanks bigmuscle)

=== modified file 'win32/AboutDlg.cpp'
--- win32/AboutDlg.cpp	2010-08-30 14:04:10 +0000
+++ win32/AboutDlg.cpp	2010-10-20 20:49:31 +0000
@@ -46,7 +46,7 @@
 "steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45, mikael eman, james ross, "
 "stanislav maslovski, david grundberg, pavel andreev, yakov suraev, kulmegil, smir, emtee, individ, "
 "pseudonym, crise, ben, ximin luo, radox, razzloss, andrew browne, darkklor, vasily.n, netcelli, "
-"gennady proskurin. Keep it coming!";
+"gennady proskurin, iceman50. Keep it coming!";
 
 AboutDlg::AboutDlg(dwt::Widget* parent) :
 dwt::ModalDialog(parent),

=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp	2010-10-07 16:40:23 +0000
+++ win32/HubFrame.cpp	2010-10-20 20:49:31 +0000
@@ -46,6 +46,7 @@
 	{ N_("Tag"), 100, false },
 	{ N_("Connection"), 75, false },
 	{ N_("IP"), 100, false },
+	{ N_("Country"), 50, false },
 	{ N_("E-Mail"), 100, false },
 	{ N_("CID"), 300, false}
 };
@@ -639,9 +640,8 @@
 	columns[COLUMN_CONNECTION] = Text::toT(identity.getConnection());
 	string ip = identity.getIp();
 	string country = ip.empty()?Util::emptyString:Util::getIpCountry(ip);
-	if (!country.empty())
-		ip = country + " (" + ip + ")";
 	columns[COLUMN_IP] = Text::toT(ip);
+	columns[COLUMN_COUNTRY] = Text::toT(country);
 	columns[COLUMN_EMAIL] = Text::toT(identity.getEmail());
 	columns[COLUMN_CID] = Text::toT(identity.getUser()->getCID().toBase32());
 

=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h	2010-09-08 15:32:07 +0000
+++ win32/HubFrame.h	2010-10-20 20:49:31 +0000
@@ -99,6 +99,7 @@
 		COLUMN_TAG,
 		COLUMN_CONNECTION,
 		COLUMN_IP,
+		COLUMN_COUNTRY,
 		COLUMN_EMAIL,
 		COLUMN_CID,
 		COLUMN_LAST

=== modified file 'win32/TransferView.cpp'
--- win32/TransferView.cpp	2010-08-06 21:02:04 +0000
+++ win32/TransferView.cpp	2010-10-20 20:49:31 +0000
@@ -34,8 +34,8 @@
 
 #include <boost/scoped_ptr.hpp>
 
-int TransferView::connectionIndexes[] = { CONNECTION_COLUMN_USER, CONNECTION_COLUMN_HUB, CONNECTION_COLUMN_STATUS, CONNECTION_COLUMN_SPEED, CONNECTION_COLUMN_CHUNK, CONNECTION_COLUMN_TRANSFERED, CONNECTION_COLUMN_QUEUED, CONNECTION_COLUMN_CIPHER, CONNECTION_COLUMN_IP };
-int TransferView::connectionSizes[] = { 125, 100, 375, 100, 125, 125, 75, 100, 100 };
+int TransferView::connectionIndexes[] = { CONNECTION_COLUMN_USER, CONNECTION_COLUMN_HUB, CONNECTION_COLUMN_STATUS, CONNECTION_COLUMN_SPEED, CONNECTION_COLUMN_CHUNK, CONNECTION_COLUMN_TRANSFERED, CONNECTION_COLUMN_QUEUED, CONNECTION_COLUMN_CIPHER, CONNECTION_COLUMN_IP, CONNECTION_COLUMN_COUNTRY };
+int TransferView::connectionSizes[] = { 125, 100, 375, 100, 125, 125, 75, 100, 100, 50 };
 
 int TransferView::downloadIndexes[] = { DOWNLOAD_COLUMN_FILE, DOWNLOAD_COLUMN_PATH, DOWNLOAD_COLUMN_STATUS, DOWNLOAD_COLUMN_TIMELEFT, DOWNLOAD_COLUMN_SPEED, DOWNLOAD_COLUMN_DONE, DOWNLOAD_COLUMN_SIZE };
 int TransferView::downloadSizes[] = { 200, 300, 150, 200, 125, 100, 100 };
@@ -49,7 +49,8 @@
 	{ N_("Transferred (Ratio)"), 125, true },
 	{ N_("Queued"), 80, true },
 	{ N_("Cipher"), 150, false },
-	{ N_("IP"), 100, false }
+	{ N_("IP"), 100, false },
+	{ N_("Country"), 50, false }
 };
 
 static const ColumnInfo downloadColumns[] = {
@@ -624,6 +625,10 @@
 	if(ui.updateMask & UpdateInfo::MASK_IP) {
 		columns[CONNECTION_COLUMN_IP] = ui.ip;
 	}
+	
+	if(ui.updateMask & UpdateInfo::MASK_COUNTRY) {
+		columns[CONNECTION_COLUMN_COUNTRY] = ui.country;
+	}
 
 	if(ui.updateMask & UpdateInfo::MASK_CIPHER) {
 		columns[CONNECTION_COLUMN_CIPHER] = ui.cipher;
@@ -720,12 +725,9 @@
 	const UserConnection& uc = t->getUserConnection();
 	ui->setCipher(Text::toT(uc.getCipherName()));
 	tstring country = Text::toT(Util::getIpCountry(uc.getRemoteIp()));
-	tstring ip = Text::toT(uc.getRemoteIp());
-	if(country.empty()) {
-		ui->setIP(ip);
-	} else {
-		ui->setIP(country + _T(" (") + ip + _T(")"));
-	}
+	if(!country.empty())
+		ui->setCountry(country);
+	ui->setIP(Text::toT(uc.getRemoteIp()));
 }
 
 void TransferView::on(DownloadManagerListener::Requesting, Download* d) throw() {

=== modified file 'win32/TransferView.h'
--- win32/TransferView.h	2010-02-11 21:44:13 +0000
+++ win32/TransferView.h	2010-10-20 20:49:31 +0000
@@ -85,6 +85,7 @@
 		CONNECTION_COLUMN_QUEUED,
 		CONNECTION_COLUMN_CIPHER,
 		CONNECTION_COLUMN_IP,
+		CONNECTION_COLUMN_COUNTRY,
 		CONNECTION_COLUMN_LAST
 	};
 
@@ -143,7 +144,8 @@
 			MASK_TRANSFERED = 1 << 3,
 			MASK_IP = 1 << 4,
 			MASK_CIPHER = 1 << 5,
-			MASK_CHUNK = 1 << 6
+			MASK_CHUNK = 1 << 6,
+			MASK_COUNTRY = 1 << 7
 		};
 
 		bool operator==(const ConnectionInfo& ii) { return download == ii.download && user == ii.getUser(); }
@@ -172,6 +174,8 @@
 		int64_t chunkPos;
 		int64_t chunk;
 
+		void setCountry(const tstring& aCountry) { country = aCountry; updateMask |= MASK_COUNTRY; }
+		tstring country;
 		void setIP(const tstring& aIp) { ip = aIp; updateMask |= MASK_IP; }
 		tstring ip;
 		void setCipher(const tstring& aCipher) { cipher = aCipher; updateMask |= MASK_CIPHER; }