1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 //
6 // Any parts of this program derived from the xMule, lMule or eMule project,
7 // or contributed by third-party developers are copyrighted by their
8 // respective authors.
9 //
10 // This program is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
23 //
24 
25 #include <wx/intl.h>
26 
27 #include "DataToText.h"
28 #include "Constants.h"
29 #include <protocol/ed2k/ClientSoftware.h>
30 
PriorityToStr(int priority,bool isAuto)31 wxString PriorityToStr( int priority, bool isAuto )
32 {
33 	if ( isAuto ) {
34 		switch ( priority ) {
35 			case PR_LOW:		return _("Auto [Lo]");
36 			case PR_NORMAL:		return _("Auto [No]");
37 			case PR_HIGH:		return _("Auto [Hi]");
38 		}
39 	} else {
40 		switch ( priority ) {
41 			case PR_VERYLOW:	return _("Very low");
42 			case PR_LOW:		return _("Low");
43 			case PR_NORMAL:		return _("Normal");
44 			case PR_HIGH:		return _("High");
45 			case PR_VERYHIGH:	return _("Very High");
46 			case PR_POWERSHARE:	return _("Release");
47 		}
48 	}
49 
50 	wxFAIL;
51 
52 	return _("Unknown");
53 }
54 
55 
DownloadStateToStr(int state,bool queueFull)56 wxString DownloadStateToStr( int state, bool queueFull )
57 {
58 	switch ( state ) {
59 		case DS_CONNECTING:		return  _("Connecting");
60 		case DS_CONNECTED:		return _("Asking");
61 		case DS_WAITCALLBACK:		return _("Connecting via server");
62 		case DS_ONQUEUE:		return ( queueFull ? _("Queue Full") : _("On Queue") );
63 		case DS_DOWNLOADING:		return _("Downloading");
64 		case DS_REQHASHSET:		return _("Receiving hashset");
65 		case DS_NONEEDEDPARTS:		return _("No needed parts");
66 		case DS_LOWTOLOWIP:		return _("Cannot connect LowID to LowID");
67 		case DS_TOOMANYCONNS:		return _("Too many connections");
68 		case DS_NONE:			return _("Unknown");
69 		case DS_WAITCALLBACKKAD:	return _("Connecting via Kad");
70 		case DS_TOOMANYCONNSKAD:	return _("Too many Kad connections");
71 		case DS_BANNED:			return _("Banned");
72 		case DS_ERROR:			return _("Connection Error");
73 		case DS_REMOTEQUEUEFULL:	return _("Remote Queue Full");
74 	}
75 
76 	wxFAIL;
77 
78 	return _("Unknown");
79 }
80 
81 
GetSoftName(unsigned int software_ident)82 const wxString GetSoftName(unsigned int software_ident)
83 {
84 	switch (software_ident) {
85 		case SO_OLDEMULE:
86 		case SO_EMULE:
87 			return wxT("eMule");
88 		case SO_CDONKEY:
89 			return wxT("cDonkey");
90 		case SO_LXMULE:
91 			return wxT("(l/x)Mule");
92 		case SO_AMULE:
93 			return wxT("aMule");
94 		case SO_SHAREAZA:
95 		case SO_NEW_SHAREAZA:
96 		case SO_NEW2_SHAREAZA:
97 			return wxT("Shareaza");
98 		case SO_EMULEPLUS:
99 			return wxT("eMule+");
100 		case SO_HYDRANODE:
101 			return wxT("HydraNode");
102 		case SO_MLDONKEY:
103 			return wxTRANSLATE("Old MLDonkey");
104 		case SO_NEW_MLDONKEY:
105 		case SO_NEW2_MLDONKEY:
106 			return wxTRANSLATE("New MLDonkey");
107 		case SO_LPHANT:
108 			return wxT("lphant");
109 		case SO_EDONKEYHYBRID:
110 			return wxT("eDonkeyHybrid");
111 		case SO_EDONKEY:
112 			return wxT("eDonkey");
113 		case SO_UNKNOWN:
114 			return wxTRANSLATE("Unknown");
115 		case SO_COMPAT_UNK:
116 			return wxTRANSLATE("eMule Compatible");
117 		default:
118 			return wxEmptyString;
119 	}
120 }
121 
122 
OriginToText(unsigned int source_from)123 wxString OriginToText(unsigned int source_from)
124 {
125 	switch ((ESourceFrom)source_from) {
126 		case SF_LOCAL_SERVER:		return wxTRANSLATE("Local Server");
127 		case SF_REMOTE_SERVER:		return wxTRANSLATE("Remote Server");
128 		case SF_KADEMLIA:		return wxTRANSLATE("Kad");
129 		case SF_SOURCE_EXCHANGE:	return wxTRANSLATE("Source Exchange");
130 		case SF_PASSIVE:		return wxTRANSLATE("Passive");
131 		case SF_LINK:			return wxTRANSLATE("Link");
132 		case SF_SOURCE_SEEDS:		return wxTRANSLATE("Source Seeds");
133 		case SF_SEARCH_RESULT:		return wxTRANSLATE("Search Result");
134 		case SF_NONE:
135 		default:		return wxTRANSLATE("Unknown");
136 	}
137 }
138 
139 
GetConversionState(unsigned int state)140 wxString GetConversionState(unsigned int state)
141 {
142 	switch (state) {
143 		case CONV_OK			: return _("Completed");
144 		case CONV_INPROGRESS		: return _("In progress");
145 		case CONV_OUTOFDISKSPACE	: return _("ERROR: Out of diskspace");
146 		case CONV_PARTMETNOTFOUND	: return _("ERROR: Partmet not found");
147 		case CONV_IOERROR		: return _("ERROR: IO error!");
148 		case CONV_FAILED		: return _("ERROR: Failed!");
149 		case CONV_QUEUE			: return _("Queued");
150 		case CONV_ALREADYEXISTS		: return _("Already downloading");
151 		case CONV_BADFORMAT		: return _("Unknown or bad tempfile format.");
152 		default: return wxT("?");
153 	}
154 }
155 // File_checked_for_headers
156