← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3232: fix transfer sorting

 

------------------------------------------------------------
revno: 3232
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2013-03-22 16:34:41 +0100
message:
  fix transfer sorting
modified:
  dcpp/SettingsManager.cpp
  dcpp/SettingsManager.h
  help/settings_appearance.html
  win32/AppearancePage.cpp
  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 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp	2013-03-21 23:03:56 +0000
+++ dcpp/SettingsManager.cpp	2013-03-22 15:34:41 +0000
@@ -85,7 +85,7 @@
 	"SettingsSaveInterval", "Slots", "TabStyle", "TabWidth", "ToolbarSize",
 	"SENTRY",
 	// Bools
-	"AddFinishedInstantly", "AdlsBreakOnFirst", "AltSortOrder",
+	"AddFinishedInstantly", "AdlsBreakOnFirst",
 	"AllowUntrustedClients", "AllowUntrustedHubs", "AlwaysTray", "AutoAway",
 	"AutoDetectIncomingConnection", "AutoFollow", "AutoKick", "AutoKickNoFavs", "AutoSearch",
 	"AutoSearchAutoMatch", "AutoDropAll", "AutoDropDisconnect", "AutoDropFilelists",
@@ -293,7 +293,6 @@
 	setDefault(BOLD_SYSTEM_LOG, true);
 	setDefault(AUTO_REFRESH_TIME, 60);
 	setDefault(AUTO_SEARCH_LIMIT, 5);
-	setDefault(ALT_SORT_ORDER, false);
 	setDefault(AUTO_KICK_NO_FAVS, false);
 	setDefault(PROMPT_PASSWORD, false);
 	setDefault(DONT_DL_ALREADY_QUEUED, false);

=== modified file 'dcpp/SettingsManager.h'
--- dcpp/SettingsManager.h	2013-03-21 23:03:56 +0000
+++ dcpp/SettingsManager.h	2013-03-22 15:34:41 +0000
@@ -122,7 +122,7 @@
 		INT_LAST };
 
 	enum BoolSetting { BOOL_FIRST = INT_LAST + 1,
-		ADD_FINISHED_INSTANTLY = BOOL_FIRST, ADLS_BREAK_ON_FIRST, ALT_SORT_ORDER,
+		ADD_FINISHED_INSTANTLY = BOOL_FIRST, ADLS_BREAK_ON_FIRST,
 		ALLOW_UNTRUSTED_CLIENTS, ALLOW_UNTRUSTED_HUBS, ALWAYS_TRAY, AUTO_AWAY,
 		AUTO_DETECT_CONNECTION, AUTO_FOLLOW, AUTO_KICK, AUTO_KICK_NO_FAVS, AUTO_SEARCH,
 		AUTO_SEARCH_AUTO_MATCH, AUTODROP_ALL, AUTODROP_DISCONNECT, AUTODROP_FILELISTS,

=== modified file 'help/settings_appearance.html'
--- help/settings_appearance.html	2013-01-18 21:54:55 +0000
+++ help/settings_appearance.html	2013-03-22 15:34:41 +0000
@@ -11,8 +11,6 @@
 that you restart DC++; they won't be applied while DC++ is running. Some settings apply to specific windows and will therefore be loaded when opening a new window.</p>
 <h2>Options</h2>
 <dl style="margin-left: 40px;">
-  <dt>Sort all downloads first</dt>
-  <dd cshelp="IDH_SETTINGS_APPEARANCE_ALT_SORT_ORDER">With this option enabled, DC++ will sort the downloads and uploads; Current download(s), waiting download(s), current upload(s) and waiting upload(s). <br/>With this option disabled, DC++ will sort downloads and uploads; Current download(s), current uploads(s), waiting download(s) and waiting upload(s).</dd>
   <dt>Minimize to tray</dt>
   <dd cshelp="IDH_SETTINGS_APPEARANCE_MINIMIZE_TRAY">When enabled, minimizing DC++ will cause it to appear as an icon
 in the windows system tray. If you left click, it will be

=== modified file 'win32/AppearancePage.cpp'
--- win32/AppearancePage.cpp	2013-01-18 21:28:38 +0000
+++ win32/AppearancePage.cpp	2013-03-22 15:34:41 +0000
@@ -36,7 +36,6 @@
 using dwt::Spinner;
 
 PropPage::ListItem AppearancePage::listItems[] = {
-	{ SettingsManager::ALT_SORT_ORDER, N_("Sort all downloads first"), IDH_SETTINGS_APPEARANCE_ALT_SORT_ORDER },
 	{ SettingsManager::MINIMIZE_TRAY, N_("Minimize to tray"), IDH_SETTINGS_APPEARANCE_MINIMIZE_TRAY },
 	{ SettingsManager::ALWAYS_TRAY, N_("Always display tray icon"), IDH_SETTINGS_APPEARANCE_ALWAYS_TRAY },
 	{ SettingsManager::TIME_STAMPS, N_("Show timestamps in chat by default"), IDH_SETTINGS_APPEARANCE_TIME_STAMPS },

=== modified file 'win32/TransferView.cpp'
--- win32/TransferView.cpp	2013-03-22 14:59:39 +0000
+++ win32/TransferView.cpp	2013-03-22 15:34:41 +0000
@@ -120,25 +120,18 @@
 }
 
 int TransferView::ItemInfo::compareItems(const ItemInfo* a, const ItemInfo* b, int col) {
-	/* todo
-	if(SETTING(ALT_SORT_ORDER)) {
-		if(a->download == b->download) {
-			if(a->status != b->status) {
-				return (a->status == ConnectionInfo::STATUS_RUNNING) ? -1 : 1;
-			}
-		} else {
-			return a->download ? -1 : 1;
-		}
-	} else {
-		if(a->status == b->status) {
-			if(a->download != b->download) {
-				return a->download ? -1 : 1;
-			}
-		} else {
-			return (a->status == ConnectionInfo::STATUS_RUNNING) ? -1 : 1;
-		}
-	}
-	*/
+	auto ta = dynamic_cast<const TransferInfo*>(a), tb = dynamic_cast<const TransferInfo*>(b);
+	if(ta && tb && ta->download != tb->download) {
+		// sort downloads before uploads.
+		return ta->download ? -1 : 1;
+	}
+
+	auto ca = dynamic_cast<const ConnectionInfo*>(a), cb = dynamic_cast<const ConnectionInfo*>(b);
+	if(ca && cb && ca->status != cb->status) {
+		// sort running conns first.
+		return ca->status == ConnectionInfo::STATUS_RUNNING ? -1 : 1;
+	}
+
 	switch(col) {
 	case COLUMN_STATUS:
 		{