Upstream tarball 20080414
[amule.git] / src / Preferences.h
blob498ab68cd964fcc450401478a67fc3ac176facc0
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 // Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #ifndef PREFERENCES_H
27 #define PREFERENCES_H
29 #include "MD4Hash.h" // Needed for CMD4Hash
30 #include "Color.h" // Needed for COLORREF
32 #include <wx/arrstr.h> // Needed for wxArrayString
34 #include <map>
36 #include "Proxy.h"
37 #include "OtherStructs.h"
39 class CPreferences;
40 class wxConfigBase;
41 class wxWindow;
44 enum EViewSharedFilesAccess{
45 vsfaEverybody = 0,
46 vsfaFriends = 1,
47 vsfaNobody = 2
50 /**
51 * Base-class for automatically loading and saving of preferences.
53 * The purpose of this class is to perform two tasks:
54 * 1) To load and save a variable using wxConfig
55 * 2) If nescecarry, to syncronize it with a widget
57 * This pure-virtual class servers as the base of all the Cfg types
58 * defined below, and exposes the entire interface.
60 * Please note that for reasons of simplicity these classes dont provide
61 * direct access to the variables they maintain, as there is no real need
62 * for this.
64 * To create a sub-class you need only provide the Load/Save functionality,
65 * as it is given that not all variables have a widget assosiated.
67 class Cfg_Base
69 public:
70 /**
71 * Constructor.
73 * @param keyname This is the keyname under which the variable is to be saved.
75 Cfg_Base( const wxString& keyname )
76 : m_key( keyname ),
77 m_changed( false )
80 /**
81 * Destructor.
83 virtual ~Cfg_Base() {}
85 /**
86 * This function loads the assosiated variable from the provided config object.
88 virtual void LoadFromFile(wxConfigBase* cfg) = 0;
89 /**
90 * This function saves the assosiated variable to the provided config object.
92 virtual void SaveToFile(wxConfigBase* cfg) = 0;
94 /**
95 * Syncs the variable with the contents of the widget.
97 * @return True of success, false otherwise.
99 virtual bool TransferFromWindow() { return false; }
101 * Syncs the widget with the contents of the variable.
103 * @return True of success, false otherwise.
105 virtual bool TransferToWindow() { return false; }
108 * Connects a widget with the specified ID to the Cfg object.
110 * @param id The ID of the widget.
111 * @param parent A pointer to the widgets parent, to speed up searches.
112 * @return True on success, false otherwise.
114 * This function only makes sense for Cfg-classes that have the capability
115 * to interact with a widget, see Cfg_Tmpl::ConnectToWidget().
117 virtual bool ConnectToWidget( int WXUNUSED(id), wxWindow* WXUNUSED(parent) = NULL ) { return false; }
120 * Gets the key assosiated with Cfg object.
122 * @return The config-key of this object.
124 virtual const wxString& GetKey() { return m_key; }
128 * Specifies if the variable has changed since the TransferFromWindow() call.
130 * @return True if the variable has changed, false otherwise.
132 virtual bool HasChanged() { return m_changed; }
135 protected:
137 * Sets the changed status.
139 * @param changed The new status.
141 virtual void SetChanged( bool changed )
143 m_changed = changed;
146 private:
148 //! The Config-key under which to save the variable
149 wxString m_key;
151 //! The changed-status of the variable
152 bool m_changed;
157 const int cntStatColors = 15;
160 //! This typedef is a shortcut similar to the theApp shortcut, but uses :: instead of .
161 //! It only allows access to static preference functions, however this is to be desired anyway.
162 typedef CPreferences thePrefs;
165 class CPreferences
167 public:
168 friend class PrefsUnifiedDlg;
170 CPreferences();
171 ~CPreferences();
173 void Save();
174 void SaveCats();
175 void ReloadSharedFolders();
177 static bool Score() { return s_scorsystem; }
178 static void SetScoreSystem(bool val) { s_scorsystem = val; }
179 static bool Reconnect() { return s_reconnect; }
180 static void SetReconnect(bool val) { s_reconnect = val; }
181 static bool DeadServer() { return s_deadserver; }
182 static void SetDeadServer(bool val) { s_deadserver = val; }
183 static const wxString& GetUserNick() { return s_nick; }
184 static void SetUserNick(const wxString& nick) { s_nick = nick; }
186 static const wxString& GetAddress() { return s_Addr; }
187 static uint16 GetPort() { return s_port; }
188 static void SetPort(uint16 val);
189 static uint16 GetUDPPort() { return s_udpport; }
190 static uint16 GetEffectiveUDPPort() { return s_UDPDisable ? 0 : s_udpport; }
191 static void SetUDPPort(uint16 val) { s_udpport = val; }
192 static bool IsUDPDisabled() { return s_UDPDisable; }
193 static void SetUDPDisable(bool val) { s_UDPDisable = val; }
194 static const CPath& GetIncomingDir() { return s_incomingdir; }
195 static void SetIncomingDir(const CPath& dir){ s_incomingdir = dir; }
196 static const CPath& GetTempDir() { return s_tempdir; }
197 static void SetTempDir(const CPath& dir) { s_tempdir = dir; }
198 static const CMD4Hash& GetUserHash() { return s_userhash; }
199 static void SetUserHash(const CMD4Hash& h) { s_userhash = h; }
200 static uint16 GetMaxUpload() { return s_maxupload; }
201 static uint16 GetSlotAllocation() { return s_slotallocation; }
202 static bool IsICHEnabled() { return s_ICH; }
203 static void SetICHEnabled(bool val) { s_ICH = val; }
204 static bool IsTrustingEveryHash() { return s_AICHTrustEveryHash; }
205 static void SetTrustingEveryHash(bool val) { s_AICHTrustEveryHash = val; }
206 static bool AutoServerlist() { return s_autoserverlist; }
207 static void SetAutoServerlist(bool val) { s_autoserverlist = val; }
208 static bool DoMinToTray() { return s_mintotray; }
209 static void SetMinToTray(bool val) { s_mintotray = val; }
210 static bool UseTrayIcon() { return s_trayiconenabled; }
211 static void SetUseTrayIcon(bool val) { s_trayiconenabled = val; }
212 static bool DoAutoConnect() { return s_autoconnect; }
213 static void SetAutoConnect(bool inautoconnect)
214 {s_autoconnect = inautoconnect; }
215 static bool AddServersFromServer() { return s_addserversfromserver; }
216 static void SetAddServersFromServer(bool val) { s_addserversfromserver = val; }
217 static bool AddServersFromClient() { return s_addserversfromclient; }
218 static void SetAddServersFromClient(bool val) { s_addserversfromclient = val; }
219 static uint16 GetTrafficOMeterInterval() { return s_trafficOMeterInterval; }
220 static void SetTrafficOMeterInterval(uint16 in)
221 { s_trafficOMeterInterval = in; }
222 static uint16 GetStatsInterval() { return s_statsInterval;}
223 static void SetStatsInterval(uint16 in) { s_statsInterval = in; }
224 static void Add2TotalDownloaded(uint64 in) { s_totalDownloadedBytes += in; }
225 static void Add2TotalUploaded(uint64 in) { s_totalUploadedBytes += in; }
226 static uint64 GetTotalDownloaded() { return s_totalDownloadedBytes; }
227 static uint64 GetTotalUploaded() { return s_totalUploadedBytes; }
228 static bool IsConfirmExitEnabled() { return s_confirmExit; }
229 static bool FilterLanIPs() { return s_filterLanIP; }
230 static void SetFilterLanIPs(bool val) { s_filterLanIP = val; }
231 static bool ParanoidFilter() { return s_paranoidfilter; }
232 static void SetParanoidFilter(bool val) { s_paranoidfilter = val; }
233 static bool IsOnlineSignatureEnabled() { return s_onlineSig; }
234 static void SetOnlineSignatureEnabled(bool val) { s_onlineSig = val; }
235 static uint32 GetMaxGraphUploadRate() { return s_maxGraphUploadRate; }
236 static uint32 GetMaxGraphDownloadRate() { return s_maxGraphDownloadRate; }
237 static void SetMaxGraphUploadRate(uint32 in){ s_maxGraphUploadRate=in; }
238 static void SetMaxGraphDownloadRate(uint32 in)
239 { s_maxGraphDownloadRate = in; }
241 static uint16 GetMaxDownload() { return s_maxdownload; }
242 static uint16 GetMaxConnections() { return s_maxconnections; }
243 static uint16 GetMaxSourcePerFile() { return s_maxsourceperfile; }
244 static uint16 GetMaxSourcePerFileSoft() {
245 uint16 temp = (uint16)(s_maxsourceperfile*0.9);
246 if( temp > 1000 ) return 1000;
247 return temp; }
248 static uint16 GetMaxSourcePerFileUDP() {
249 uint16 temp = (uint16)(s_maxsourceperfile*0.75);
250 if( temp > 100 ) return 100;
251 return temp; }
252 static uint16 GetDeadserverRetries() { return s_deadserverretries; }
253 static void SetDeadserverRetries(uint16 val) { s_deadserverretries = val; }
254 static uint32 GetServerKeepAliveTimeout() { return s_dwServerKeepAliveTimeoutMins*60000; }
255 static void SetServerKeepAliveTimeout(uint32 val) { s_dwServerKeepAliveTimeoutMins = val/60000; }
257 static const wxString& GetLanguageID() { return s_languageID; }
258 static void SetLanguageID(const wxString& new_id) { s_languageID = new_id; }
259 static uint8 CanSeeShares() { return s_iSeeShares; }
260 static void SetCanSeeShares(uint8 val) { s_iSeeShares = val; }
262 static uint8 GetStatsMax() { return s_statsMax; }
263 static bool UseFlatBar() { return (s_depth3D==0); }
264 static uint8 GetStatsAverageMinutes() { return s_statsAverageMinutes; }
265 static void SetStatsAverageMinutes(uint8 in){ s_statsAverageMinutes = in; }
267 static bool GetStartMinimized() { return s_startMinimized; }
268 static void SetStartMinimized(bool instartMinimized)
269 { s_startMinimized = instartMinimized;}
270 static bool GetSmartIdCheck() { return s_smartidcheck; }
271 static void SetSmartIdCheck( bool in_smartidcheck )
272 { s_smartidcheck = in_smartidcheck; }
273 static uint8 GetSmartIdState() { return s_smartidstate; }
274 static void SetSmartIdState( uint8 in_smartidstate )
275 { s_smartidstate = in_smartidstate; }
276 static bool GetVerbose() { return s_bVerbose; }
277 static void SetVerbose(bool val) { s_bVerbose = val; }
278 static bool GetPreviewPrio() { return s_bpreviewprio; }
279 static void SetPreviewPrio(bool in) { s_bpreviewprio = in; }
280 static bool TransferFullChunks() { return s_btransferfullchunks; }
281 static void SetTransferFullChunks( bool m_bintransferfullchunks )
282 {s_btransferfullchunks = m_bintransferfullchunks; }
283 static bool StartNextFile() { return s_bstartnextfile; }
284 static bool StartNextFileSame() { return s_bstartnextfilesame; }
285 static void SetStartNextFile(bool val) { s_bstartnextfile = val; }
286 static void SetStartNextFileSame(bool val) { s_bstartnextfilesame = val; }
287 static bool ShowOverhead() { return s_bshowoverhead; }
288 static void SetNewAutoUp(bool m_bInUAP) { s_bUAP = m_bInUAP; }
289 static bool GetNewAutoUp() { return s_bUAP; }
290 static void SetNewAutoDown(bool m_bInDAP) { s_bDAP = m_bInDAP; }
291 static bool GetNewAutoDown() { return s_bDAP; }
293 static const wxString& GetVideoPlayer() { return s_VideoPlayer; }
295 static uint32 GetFileBufferSize() { return s_iFileBufferSize*15000; }
296 static void SetFileBufferSize(uint32 val) { s_iFileBufferSize = val/15000; }
297 static uint32 GetQueueSize() { return s_iQueueSize*100; }
298 static void SetQueueSize(uint32 val) { s_iQueueSize = val/100; }
300 static uint8 Get3DDepth() { return s_depth3D;}
301 static bool AddNewFilesPaused() { return s_addnewfilespaused; }
302 static void SetAddNewFilesPaused(bool val) { s_addnewfilespaused = val; }
304 static void SetMaxConsPerFive(int in) { s_MaxConperFive=in; }
306 static uint16 GetMaxConperFive() { return s_MaxConperFive; }
307 static uint16 GetDefaultMaxConperFive();
309 static bool IsSafeServerConnectEnabled() { return s_safeServerConnect; }
310 static void SetSafeServerConnectEnabled(bool val) { s_safeServerConnect = val; }
311 static bool IsMoviePreviewBackup() { return s_moviePreviewBackup; }
313 static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace; }
314 static void SetCheckDiskspaceEnabled(bool val) { s_checkDiskspace = val; }
315 static uint32 GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace; }
316 static void SetMinFreeDiskSpace(uint32 val) { s_uMinFreeDiskSpace = val; }
318 static const wxString& GetYourHostname() { return s_yourHostname; }
319 static void SetYourHostname(const wxString& s) { s_yourHostname = s; }
321 static void SetMaxUpload(uint16 in);
322 static void SetMaxDownload(uint16 in);
323 static void SetSlotAllocation(uint16 in) { s_slotallocation = in; };
325 typedef std::vector<CPath> PathList;
326 PathList shareddir_list;
328 wxArrayString adresses_list;
330 static bool AutoConnectStaticOnly() { return s_autoconnectstaticonly; }
331 static void SetAutoConnectStaticOnly(bool val) { s_autoconnectstaticonly = val; }
332 static bool GetUPnPEnabled() { return s_UPnPEnabled; }
333 static void SetUPnPEnabled(bool val) { s_UPnPEnabled = val; }
334 static bool GetUPnPECEnabled() { return s_UPnPECEnabled; }
335 static void SetUPnPECEnabled(bool val) { s_UPnPECEnabled = val; }
336 static bool GetUPnPWebServerEnabled() { return s_UPnPWebServerEnabled; }
337 static void SetUPnPWebServerEnabled(bool val){ s_UPnPWebServerEnabled = val; }
338 static uint16 GetUPnPTCPPort() { return s_UPnPTCPPort; }
339 static void SetUPnPTCPPort(uint16 val) { s_UPnPTCPPort = val; }
340 static bool IsManualHighPrio() { return s_bmanualhighprio; }
341 static void SetManualHighPrio(bool val) { s_bmanualhighprio = val; }
342 void LoadCats();
343 static const wxString& GetDateTimeFormat() { return s_datetimeformat; }
344 // Download Categories
345 uint32 AddCat(Category_Struct* cat);
346 void RemoveCat(size_t index);
347 uint32 GetCatCount();
348 Category_Struct* GetCategory(size_t index);
349 const CPath& GetCatPath(uint8 index);
350 uint32 GetCatColor(size_t index);
351 Category_Struct *CreateCategory(const wxString& name, const CPath& path,
352 const wxString& comment, uint32 color, uint8 prio);
353 void UpdateCategory(uint8 cat, const wxString& name, const CPath& path,
354 const wxString& comment, uint32 color, uint8 prio);
356 static uint32 GetAllcatType() { return s_allcatType; }
357 static void SetAllcatType(uint32 in) { s_allcatType = in; }
358 static bool ShowAllNotCats() { return s_showAllNotCats; }
360 // WebServer
361 static uint16 GetWSPort() { return s_nWebPort; }
362 static void SetWSPort(uint16 uPort) { s_nWebPort=uPort; }
363 static uint16 GetWebUPnPTCPPort() { return s_nWebUPnPTCPPort; }
364 static void SetWebUPnPTCPPort(uint16 val) { s_nWebUPnPTCPPort = val; }
365 static const wxString& GetWSPass() { return s_sWebPassword; }
366 static void SetWSPass(const wxString& pass) { s_sWebPassword = pass; }
367 static bool GetWSIsEnabled() { return s_bWebEnabled; }
368 static void SetWSIsEnabled(bool bEnable) { s_bWebEnabled=bEnable; }
369 static bool GetWebUseGzip() { return s_bWebUseGzip; }
370 static void SetWebUseGzip(bool bUse) { s_bWebUseGzip=bUse; }
371 static uint32 GetWebPageRefresh() { return s_nWebPageRefresh; }
372 static void SetWebPageRefresh(uint32 nRefresh) { s_nWebPageRefresh=nRefresh; }
373 static bool GetWSIsLowUserEnabled() { return s_bWebLowEnabled; }
374 static void SetWSIsLowUserEnabled(bool in) { s_bWebLowEnabled=in; }
375 static const wxString& GetWSLowPass() { return s_sWebLowPassword; }
376 static void SetWSLowPass(const wxString& pass) { s_sWebLowPassword = pass; }
377 static const wxString& GetWebTemplate() { return s_WebTemplate; }
378 static void SetWebTemplate(const wxString& val) { s_WebTemplate = val; }
380 static void SetMaxSourcesPerFile(uint16 in) { s_maxsourceperfile=in;}
381 static void SetMaxConnections(uint16 in) { s_maxconnections =in;}
383 static bool ShowCatTabInfos() { return s_showCatTabInfos; }
384 static void ShowCatTabInfos(bool in) { s_showCatTabInfos=in; }
386 // Sources Dropping Tweaks
387 static bool DropNoNeededSources() { return s_NoNeededSources > 0; }
388 static bool SwapNoNeededSources() { return s_NoNeededSources == 2; }
389 static uint8 GetNoNeededSources() { return s_NoNeededSources; }
390 static void SetNoNeededSources(uint8 val) { s_NoNeededSources = val; }
391 static bool DropFullQueueSources() { return s_DropFullQueueSources; }
392 static void SetDropFullQueueSources(bool val) { s_DropFullQueueSources = val; }
393 static bool DropHighQueueRankingSources() { return s_DropHighQueueRankingSources; }
394 static void SetDropHighQueueRankingSources(bool val) { s_DropHighQueueRankingSources = val; }
395 static uint32 HighQueueRanking() { return s_HighQueueRanking; }
396 static void SetHighQueueRanking(uint32 val) { s_HighQueueRanking = val; }
397 static uint32 GetAutoDropTimer() { return s_AutoDropTimer; }
398 static void SetAutoDropTimer(uint32 val) { s_AutoDropTimer = val; }
400 // External Connections
401 static bool AcceptExternalConnections() { return s_AcceptExternalConnections; }
402 static void EnableExternalConnections( bool val ) { s_AcceptExternalConnections = val; }
403 static const wxString& GetECAddress() { return s_ECAddr; }
404 static uint32 ECPort() { return s_ECPort; }
405 static void SetECPort(uint32 val) { s_ECPort = val; }
406 static const wxString& ECPassword() { return s_ECPassword; }
407 static void SetECPass(const wxString& pass) { s_ECPassword = pass; }
408 // Fast ED2K Links Handler Toggling
409 static bool GetFED2KLH() { return s_FastED2KLinksHandler; }
411 // Ip filter
412 static bool IsFilteringClients() { return s_IPFilterClients; }
413 static void SetFilteringClients(bool val) { s_IPFilterClients = val; }
414 static bool IsFilteringServers() { return s_IPFilterServers; }
415 static void SetFilteringServers(bool val) { s_IPFilterServers = val; }
416 static uint8 GetIPFilterLevel() { return s_filterlevel;}
417 static void SetIPFilterLevel(uint8 level);
418 static bool IPFilterAutoLoad() { return s_IPFilterAutoLoad; }
419 static void SetIPFilterAutoLoad(bool val) { s_IPFilterAutoLoad = val; }
420 static const wxString& IPFilterURL() { return s_IPFilterURL; }
421 static void SetIPFilterURL(const wxString& url) { s_IPFilterURL = url; }
422 static bool UseIPFilterSystem() { return s_IPFilterSys; }
423 static void SetIPFilterSystem(bool val) { s_IPFilterSys = val; }
425 // Source seeds On/Off
426 static bool GetSrcSeedsOn() { return s_UseSrcSeeds; }
427 static void SetSrcSeedsOn(bool val) { s_UseSrcSeeds = val; }
429 static bool IsSecureIdentEnabled() { return s_SecIdent; }
430 static void SetSecureIdentEnabled(bool val) { s_SecIdent = val; }
432 static bool GetExtractMetaData() { return s_ExtractMetaData; }
433 static void SetExtractMetaData(bool val) { s_ExtractMetaData = val; }
435 static bool ShowProgBar() { return s_ProgBar; }
436 static bool ShowPercent() { return s_Percent; }
438 static bool GetAllocFullPart() { return s_AllocFullPart; };
439 static void SetAllocFullPart(bool val) { s_AllocFullPart = val; }
440 static bool GetAllocFullChunk() { return s_AllocFullChunk; };
441 static void SetAllocFullChunk(bool val) { s_AllocFullChunk = val; }
443 static wxString GetBrowser();
445 static const wxString& GetSkin() { return s_Skin; }
447 static bool UseSkins() { return s_UseSkinFiles; }
449 static bool VerticalToolbar() { return s_ToolbarOrientation; }
451 static bool ShowPartFileNumber() { return s_ShowPartFileNumber; }
453 static const CPath& GetOSDir() { return s_OSDirectory; }
454 static uint16 GetOSUpdate() { return s_OSUpdate; }
456 static uint8 GetToolTipDelay() { return s_iToolDelayTime; }
458 static void UnsetAutoServerStart();
459 static void CheckUlDlRatio();
461 static void BuildItemList( const wxString& appdir );
462 static void EraseItemList();
464 static void LoadAllItems(wxConfigBase* cfg);
465 static void SaveAllItems(wxConfigBase* cfg);
467 static bool GetShowRatesOnTitle() { return s_ShowRatesOnTitle; }
469 // Message Filters
471 static bool MustFilterMessages() { return s_MustFilterMessages; }
472 static void SetMustFilterMessages(bool val) { s_MustFilterMessages = val; }
473 static bool IsFilterAllMessages() { return s_FilterAllMessages; }
474 static void SetFilterAllMessages(bool val) { s_FilterAllMessages = val; }
475 static bool MsgOnlyFriends() { return s_msgonlyfriends;}
476 static void SetMsgOnlyFriends(bool val) { s_msgonlyfriends = val; }
477 static bool MsgOnlySecure() { return s_msgsecure;}
478 static void SetMsgOnlySecure(bool val) { s_msgsecure = val; }
479 static bool IsFilterByKeywords() { return s_FilterSomeMessages; }
480 static void SetFilterByKeywords(bool val) { s_FilterSomeMessages = val; }
481 static const wxString& GetMessageFilterString() { return s_MessageFilterString; }
482 static void SetMessageFilterString(const wxString& val) { s_MessageFilterString = val; }
483 static bool IsMessageFiltered(const wxString& message);
485 static bool FilterComments() { return s_FilterComments; }
486 static void SetFilterComments(bool val) { s_FilterComments = val; }
487 static const wxString& GetCommentFilterString() { return s_CommentFilterString; }
488 static void SetCommentFilterString(const wxString& val) { s_CommentFilterString = val; }
489 static bool IsCommentFiltered(const wxString& comment);
491 // Can't have it return a reference, will need a pointer later.
492 static const CProxyData *GetProxyData() { return &s_ProxyData; }
494 // Hidden files
496 static bool ShareHiddenFiles() { return s_ShareHiddenFiles; }
498 static bool AutoSortDownload() { return s_AutoSortDownload; }
500 // Version check
502 static bool CheckNewVersion() { return s_NewVersionCheck; }
504 // Networks
505 static bool GetNetworkKademlia() { return s_ConnectToKad; }
506 static void SetNetworkKademlia(bool val) { s_ConnectToKad = val; }
507 static bool GetNetworkED2K() { return s_ConnectToED2K; }
508 static void SetNetworkED2K(bool val) { s_ConnectToED2K = val; }
510 // Statistics
511 static unsigned GetMaxClientVersions() { return s_maxClientVersions; }
513 // Dropping slow sources
514 static bool GetDropSlowSources() { return s_DropSlowSources; }
516 // server.met and nodes.dat urls
517 static const wxString& GetKadNodesUrl() { return s_KadURL; }
518 static void SetKadNodesUrl(const wxString& url) { s_KadURL = url; }
520 static const wxString& GetEd2kServersUrl() { return s_Ed2kURL; }
521 static void SetEd2kServersUrl(const wxString& url) { s_Ed2kURL = url; }
523 // Crypt
524 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported;}
525 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested;}
526 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired;}
527 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
528 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
529 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
530 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
531 static uint32 GetKadUDPKey() {return s_dwKadUDPKey;}
532 static uint8 GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength;}
534 static void SetClientCryptLayerSupported(bool v) {s_IsClientCryptLayerSupported = v;}
535 static void SetClientCryptLayerRequested(bool v) {s_bCryptLayerRequested = v; }
536 static void SetClientCryptLayerRequired(bool v) {s_IsClientCryptLayerRequired = v;}
538 protected:
539 static int32 GetRecommendedMaxConnections();
541 //! Temporary storage for statistic-colors.
542 static COLORREF s_colors[cntStatColors];
543 //! Reference for checking if the colors has changed.
544 static COLORREF s_colors_ref[cntStatColors];
546 typedef std::vector<Cfg_Base*> CFGList;
547 typedef std::map<int, Cfg_Base*> CFGMap;
548 typedef std::vector<Category_Struct*> CatList;
551 static CFGMap s_CfgList;
552 static CFGList s_MiscList;
553 CatList m_CatList;
555 private:
556 void LoadPreferences();
557 void SavePreferences();
559 protected:
560 ////////////// USER
561 static wxString s_nick;
563 static CMD4Hash s_userhash;
565 ////////////// CONNECTION
566 static uint16 s_maxupload;
567 static uint16 s_maxdownload;
568 static uint16 s_slotallocation;
569 static wxString s_Addr;
570 static uint16 s_port;
571 static uint16 s_udpport;
572 static bool s_UDPDisable;
573 static uint16 s_maxconnections;
574 static bool s_reconnect;
575 static bool s_autoconnect;
576 static bool s_autoconnectstaticonly;
577 static bool s_UPnPEnabled;
578 static bool s_UPnPECEnabled;
579 static bool s_UPnPWebServerEnabled;
580 static uint16 s_UPnPTCPPort;
582 ////////////// PROXY
583 static CProxyData s_ProxyData;
585 ////////////// SERVERS
586 static bool s_autoserverlist;
587 static bool s_deadserver;
589 ////////////// FILES
590 static CPath s_incomingdir;
591 static CPath s_tempdir;
592 static bool s_ICH;
593 static bool s_AICHTrustEveryHash;
595 ////////////// GUI
596 static uint8 s_depth3D;
598 static bool s_scorsystem;
599 static bool s_mintotray;
600 static bool s_trayiconenabled;
601 static bool s_addnewfilespaused;
602 static bool s_addserversfromserver;
603 static bool s_addserversfromclient;
604 static uint16 s_maxsourceperfile;
605 static uint16 s_trafficOMeterInterval;
606 static uint16 s_statsInterval;
607 static uint32 s_maxGraphDownloadRate;
608 static uint32 s_maxGraphUploadRate;
609 static bool s_confirmExit;
612 static bool s_filterLanIP;
613 static bool s_paranoidfilter;
614 static bool s_onlineSig;
616 static uint64 s_totalDownloadedBytes;
617 static uint64 s_totalUploadedBytes;
618 static wxString s_languageID;
619 static uint8 s_iSeeShares; // 0=everybody 1=friends only 2=noone
620 static uint8 s_iToolDelayTime; // tooltip delay time in seconds
621 static uint8 s_splitterbarPosition;
622 static uint16 s_deadserverretries;
623 static uint32 s_dwServerKeepAliveTimeoutMins;
625 static uint8 s_statsMax;
626 static uint8 s_statsAverageMinutes;
628 static bool s_bpreviewprio;
629 static bool s_smartidcheck;
630 static uint8 s_smartidstate;
631 static bool s_safeServerConnect;
632 static bool s_startMinimized;
633 static uint16 s_MaxConperFive;
634 static bool s_checkDiskspace;
635 static uint32 s_uMinFreeDiskSpace;
636 static wxString s_yourHostname;
637 static bool s_bVerbose;
638 static bool s_bmanualhighprio;
639 static bool s_btransferfullchunks;
640 static bool s_bstartnextfile;
641 static bool s_bstartnextfilesame;
642 static bool s_bshowoverhead;
643 static bool s_bDAP;
644 static bool s_bUAP;
646 static bool s_ShowRatesOnTitle;
648 static wxString s_VideoPlayer;
649 static bool s_moviePreviewBackup;
650 static bool s_showAllNotCats;
652 static bool s_msgonlyfriends;
653 static bool s_msgsecure;
655 static uint8 s_iFileBufferSize;
656 static uint8 s_iQueueSize;
658 static wxString s_datetimeformat;
660 static bool s_ToolbarOrientation;
661 static bool s_ShowPartFileNumber;
663 // Web Server [kuchin]
664 static wxString s_sWebPassword;
665 static wxString s_sWebLowPassword;
666 static uint16 s_nWebPort;
667 static uint16 s_nWebUPnPTCPPort;
668 static bool s_bWebEnabled;
669 static bool s_bWebUseGzip;
670 static uint32 s_nWebPageRefresh;
671 static bool s_bWebLowEnabled;
672 static wxString s_WebTemplate;
674 static bool s_showCatTabInfos;
675 static uint32 s_allcatType;
677 // Madcat - Sources Dropping Tweaks
678 static uint8 s_NoNeededSources; // 0: Keep, 1: Drop, 2:Swap
679 static bool s_DropFullQueueSources;
680 static bool s_DropHighQueueRankingSources;
681 static uint32 s_HighQueueRanking;
682 static uint32 s_AutoDropTimer;
684 // Kry - external connections
685 static bool s_AcceptExternalConnections;
686 static wxString s_ECAddr;
687 static uint32 s_ECPort;
688 static wxString s_ECPassword;
690 // Kry - IPFilter
691 static bool s_IPFilterClients;
692 static bool s_IPFilterServers;
693 static uint8 s_filterlevel;
694 static bool s_IPFilterAutoLoad;
695 static wxString s_IPFilterURL;
696 static bool s_IPFilterSys;
698 // Kry - Source seeds on/off
699 static bool s_UseSrcSeeds;
701 static bool s_ProgBar;
702 static bool s_Percent;
704 static bool s_SecIdent;
706 static bool s_ExtractMetaData;
708 static bool s_AllocFullPart;
709 static bool s_AllocFullChunk;
711 static uint16 s_Browser;
712 static wxString s_CustomBrowser;
713 static bool s_BrowserTab; // Jacobo221 - Open in tabs if possible
715 static CPath s_OSDirectory;
716 static uint16 s_OSUpdate;
718 static wxString s_Skin;
719 static bool s_UseSkinFiles;
721 static bool s_FastED2KLinksHandler; // Madcat - Toggle Fast ED2K Links Handler
723 // Message Filtering
724 static bool s_MustFilterMessages;
725 static wxString s_MessageFilterString;
726 static bool s_FilterAllMessages;
727 static bool s_FilterSomeMessages;
729 static bool s_FilterComments;
730 static wxString s_CommentFilterString;
733 // Hidden files sharing
734 static bool s_ShareHiddenFiles;
736 static bool s_AutoSortDownload;
738 // Version check
739 static bool s_NewVersionCheck;
741 // Kad
742 static bool s_ConnectToKad;
743 static bool s_ConnectToED2K;
745 // Statistics
746 static unsigned s_maxClientVersions; // 0 = unlimited
748 // Drop slow sources if needed
749 static bool s_DropSlowSources;
751 static wxString s_Ed2kURL;
752 static wxString s_KadURL;
754 // Crypt
755 static bool s_IsClientCryptLayerSupported;
756 static bool s_IsClientCryptLayerRequired;
757 static bool s_bCryptLayerRequested;
758 static uint32 s_dwKadUDPKey;
759 static uint8 s_byCryptTCPPaddingLength;
763 #endif // PREFERENCES_H
764 // File_checked_for_headers