Upstream tarball 10114
[amule.git] / src / DataToText.cpp
blob92d9ad20f6782fd57d4de61a04a776dc63725d2f
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
28 #define __need_convstatus // Only the conversion status enum is needed
29 #include "PartFileConvert.h" // Needed by GetConversionState
31 #include <protocol/ed2k/ClientSoftware.h>
33 wxString PriorityToStr( int priority, bool isAuto )
35 if ( isAuto ) {
36 switch ( priority ) {
37 case PR_LOW: return _("Auto [Lo]");
38 case PR_NORMAL: return _("Auto [No]");
39 case PR_HIGH: return _("Auto [Hi]");
41 } else {
42 switch ( priority ) {
43 case PR_VERYLOW: return _("Very low");
44 case PR_LOW: return _("Low");
45 case PR_NORMAL: return _("Normal");
46 case PR_HIGH: return _("High");
47 case PR_VERYHIGH: return _("Very High");
48 case PR_POWERSHARE: return _("Release");
52 wxFAIL;
54 return _("Unknown");
58 wxString DownloadStateToStr( int state, bool queueFull )
60 switch ( state ) {
61 case DS_CONNECTING: return _("Connecting");
62 case DS_CONNECTED: return _("Asking");
63 case DS_WAITCALLBACK: return _("Connecting via server");
64 case DS_ONQUEUE: return ( queueFull ? _("Queue Full") : _("On Queue") );
65 case DS_DOWNLOADING: return _("Transferring");
66 case DS_REQHASHSET: return _("Receiving hashset");
67 case DS_NONEEDEDPARTS: return _("No needed parts");
68 case DS_LOWTOLOWIP: return _("Cannot connect LowID to LowID");
69 case DS_TOOMANYCONNS: return _("Too many connections");
70 case DS_NONE: return _("Unknown");
71 case DS_WAITCALLBACKKAD: return _("Connecting via Kad");
72 case DS_TOOMANYCONNSKAD: return _("Too many Kad connections");
73 case DS_BANNED: return _("Banned");
74 case DS_ERROR: return _("Connection Error");
75 case DS_REMOTEQUEUEFULL: return _("Remote Queue Full");
78 wxFAIL;
80 return _("Unknown");
84 const wxString GetSoftName(unsigned int software_ident)
86 switch (software_ident) {
87 case SO_OLDEMULE:
88 case SO_EMULE:
89 return wxT("eMule");
90 case SO_CDONKEY:
91 return wxT("cDonkey");
92 case SO_LXMULE:
93 return wxT("(l/x)Mule");
94 case SO_AMULE:
95 return wxT("aMule");
96 case SO_SHAREAZA:
97 case SO_NEW_SHAREAZA:
98 case SO_NEW2_SHAREAZA:
99 return wxT("Shareaza");
100 case SO_EMULEPLUS:
101 return wxT("eMule+");
102 case SO_HYDRANODE:
103 return wxT("HydraNode");
104 case SO_MLDONKEY:
105 return wxTRANSLATE("Old MLDonkey");
106 case SO_NEW_MLDONKEY:
107 case SO_NEW2_MLDONKEY:
108 return wxTRANSLATE("New MLDonkey");
109 case SO_LPHANT:
110 return wxT("lphant");
111 case SO_EDONKEYHYBRID:
112 return wxT("eDonkeyHybrid");
113 case SO_EDONKEY:
114 return wxT("eDonkey");
115 case SO_UNKNOWN:
116 return wxTRANSLATE("Unknown");
117 case SO_COMPAT_UNK:
118 return wxTRANSLATE("eMule Compatible");
119 default:
120 return wxEmptyString;
125 wxString OriginToText(unsigned int source_from)
127 switch ((ESourceFrom)source_from) {
128 case SF_LOCAL_SERVER: return wxTRANSLATE("Local Server");
129 case SF_REMOTE_SERVER: return wxTRANSLATE("Remote Server");
130 case SF_KADEMLIA: return wxTRANSLATE("Kad");
131 case SF_SOURCE_EXCHANGE: return wxTRANSLATE("Source Exchange");
132 case SF_PASSIVE: return wxTRANSLATE("Passive");
133 case SF_LINK: return wxTRANSLATE("Link");
134 case SF_SOURCE_SEEDS: return wxTRANSLATE("Source Seeds");
135 case SF_SEARCH_RESULT: return wxTRANSLATE("Search Result");
136 case SF_NONE:
137 default: return wxTRANSLATE("Unknown");
142 wxString GetConversionState(unsigned int state)
144 switch (state) {
145 case CONV_OK : return _("Completed");
146 case CONV_INPROGRESS : return _("In progress");
147 case CONV_OUTOFDISKSPACE : return _("ERROR: Out of diskspace");
148 case CONV_PARTMETNOTFOUND : return _("ERROR: Partmet not found");
149 case CONV_IOERROR : return _("ERROR: IO error!");
150 case CONV_FAILED : return _("ERROR: Failed!");
151 case CONV_QUEUE : return _("Queued");
152 case CONV_ALREADYEXISTS : return _("Already downloading");
153 case CONV_BADFORMAT : return _("Unknown or bad tempfile format.");
154 default: return wxT("?");
157 // File_checked_for_headers