Upstream tarball 9574
[amule.git] / src / DataToText.cpp
blob09e79f380526ce91d46d0e608a8dce3d640396fc
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2008 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.
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
26 #include "KnownFile.h" // Needed by PriorityToStr
27 #include "updownclient.h" // Needed by DownloadStateToStr and GetSoftName
29 #include <protocol/ed2k/ClientSoftware.h>
31 wxString PriorityToStr( int priority, bool isAuto )
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]");
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");
50 wxFAIL;
52 return _("Unknown");
56 wxString DownloadStateToStr( int state, bool queueFull )
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 _("Transferring");
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");
76 wxFAIL;
78 return _("Unknown");
82 const wxString GetSoftName(unsigned int software_ident)
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;
123 wxString OriginToText(unsigned int source_from)
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");
138 // File_checked_for_headers