Either the comment is wrong or it's not needed anymore
[amule.git] / src / Preferences.h
blob8e3abf40fc7309182d115858c1acc1cbe418922e
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 // Copyright (c) 2002-2011 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.
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
31 #include <wx/arrstr.h> // Needed for wxArrayString
33 #include <map>
35 #include "Proxy.h"
36 #include "OtherStructs.h"
38 #include <common/ClientVersion.h> // Needed for __SVN__
40 class CPreferences;
41 class wxConfigBase;
42 class wxWindow;
44 enum EViewSharedFilesAccess {
45 vsfaEverybody = 0,
46 vsfaFriends = 1,
47 vsfaNobody = 2
50 enum AllCategoryFilter {
51 acfAll = 0,
52 acfAllOthers,
53 acfIncomplete,
54 acfCompleted,
55 acfWaiting,
56 acfDownloading,
57 acfErroneous,
58 acfPaused,
59 acfStopped,
60 acfVideo,
61 acfAudio,
62 acfArchive,
63 acfCDImages,
64 acfPictures,
65 acfText,
66 acfActive
69 /**
70 * Base-class for automatically loading and saving of preferences.
72 * The purpose of this class is to perform two tasks:
73 * 1) To load and save a variable using wxConfig
74 * 2) If nescecarry, to syncronize it with a widget
76 * This pure-virtual class servers as the base of all the Cfg types
77 * defined below, and exposes the entire interface.
79 * Please note that for reasons of simplicity these classes dont provide
80 * direct access to the variables they maintain, as there is no real need
81 * for this.
83 * To create a sub-class you need only provide the Load/Save functionality,
84 * as it is given that not all variables have a widget assosiated.
86 class Cfg_Base
88 public:
89 /**
90 * Constructor.
92 * @param keyname This is the keyname under which the variable is to be saved.
94 Cfg_Base( const wxString& keyname )
95 : m_key( keyname ),
96 m_changed( false )
99 /**
100 * Destructor.
102 virtual ~Cfg_Base() {}
105 * This function loads the assosiated variable from the provided config object.
107 virtual void LoadFromFile(wxConfigBase* cfg) = 0;
109 * This function saves the assosiated variable to the provided config object.
111 virtual void SaveToFile(wxConfigBase* cfg) = 0;
114 * Syncs the variable with the contents of the widget.
116 * @return True of success, false otherwise.
118 virtual bool TransferFromWindow() { return false; }
120 * Syncs the widget with the contents of the variable.
122 * @return True of success, false otherwise.
124 virtual bool TransferToWindow() { return false; }
127 * Connects a widget with the specified ID to the Cfg object.
129 * @param id The ID of the widget.
130 * @param parent A pointer to the widgets parent, to speed up searches.
131 * @return True on success, false otherwise.
133 * This function only makes sense for Cfg-classes that have the capability
134 * to interact with a widget, see Cfg_Tmpl::ConnectToWidget().
136 virtual bool ConnectToWidget( int WXUNUSED(id), wxWindow* WXUNUSED(parent) = NULL ) { return false; }
139 * Gets the key assosiated with Cfg object.
141 * @return The config-key of this object.
143 virtual const wxString& GetKey() { return m_key; }
147 * Specifies if the variable has changed since the TransferFromWindow() call.
149 * @return True if the variable has changed, false otherwise.
151 virtual bool HasChanged() { return m_changed; }
154 protected:
156 * Sets the changed status.
158 * @param changed The new status.
160 virtual void SetChanged( bool changed )
162 m_changed = changed;
165 private:
167 //! The Config-key under which to save the variable
168 wxString m_key;
170 //! The changed-status of the variable
171 bool m_changed;
175 class Cfg_Lang_Base {
176 public:
177 virtual void UpdateChoice(int pos);
180 const int cntStatColors = 15;
183 //! This typedef is a shortcut similar to the theApp shortcut, but uses :: instead of .
184 //! It only allows access to static preference functions, however this is to be desired anyway.
185 typedef CPreferences thePrefs;
188 class CPreferences
190 public:
191 friend class PrefsUnifiedDlg;
193 CPreferences();
194 ~CPreferences();
196 void Save();
197 void SaveCats();
198 void ReloadSharedFolders();
200 static const wxString& GetConfigDir() { return s_configDir; }
201 static void SetConfigDir(const wxString& dir) { s_configDir = dir; }
203 static bool Score() { return s_scorsystem; }
204 static void SetScoreSystem(bool val) { s_scorsystem = val; }
205 static bool Reconnect() { return s_reconnect; }
206 static void SetReconnect(bool val) { s_reconnect = val; }
207 static bool DeadServer() { return s_deadserver; }
208 static void SetDeadServer(bool val) { s_deadserver = val; }
209 static const wxString& GetUserNick() { return s_nick; }
210 static void SetUserNick(const wxString& nick) { s_nick = nick; }
211 static Cfg_Lang_Base * GetCfgLang() { return s_cfgLang; }
213 static const wxString& GetAddress() { return s_Addr; }
214 static uint16 GetPort() { return s_port; }
215 static void SetPort(uint16 val);
216 static uint16 GetUDPPort() { return s_udpport; }
217 static uint16 GetEffectiveUDPPort() { return s_UDPEnable ? s_udpport : 0; }
218 static void SetUDPPort(uint16 val) { s_udpport = val; }
219 static bool IsUDPDisabled() { return !s_UDPEnable; }
220 static void SetUDPDisable(bool val) { s_UDPEnable = !val; }
221 static const CPath& GetIncomingDir() { return s_incomingdir; }
222 static void SetIncomingDir(const CPath& dir){ s_incomingdir = dir; }
223 static const CPath& GetTempDir() { return s_tempdir; }
224 static void SetTempDir(const CPath& dir) { s_tempdir = dir; }
225 static const CMD4Hash& GetUserHash() { return s_userhash; }
226 static void SetUserHash(const CMD4Hash& h) { s_userhash = h; }
227 static uint16 GetMaxUpload() { return s_maxupload; }
228 static uint16 GetSlotAllocation() { return s_slotallocation; }
229 static bool IsICHEnabled() { return s_ICH; }
230 static void SetICHEnabled(bool val) { s_ICH = val; }
231 static bool IsTrustingEveryHash() { return s_AICHTrustEveryHash; }
232 static void SetTrustingEveryHash(bool val) { s_AICHTrustEveryHash = val; }
233 static bool AutoServerlist() { return s_autoserverlist; }
234 static void SetAutoServerlist(bool val) { s_autoserverlist = val; }
235 static bool DoMinToTray() { return s_mintotray; }
236 static void SetMinToTray(bool val) { s_mintotray = val; }
237 static bool UseTrayIcon() { return s_trayiconenabled; }
238 static void SetUseTrayIcon(bool val) { s_trayiconenabled = val; }
239 static bool HideOnClose() { return s_hideonclose; }
240 static void SetHideOnClose(bool val) { s_hideonclose = val; }
241 static bool DoAutoConnect() { return s_autoconnect; }
242 static void SetAutoConnect(bool inautoconnect)
243 {s_autoconnect = inautoconnect; }
244 static bool AddServersFromServer() { return s_addserversfromserver; }
245 static void SetAddServersFromServer(bool val) { s_addserversfromserver = val; }
246 static bool AddServersFromClient() { return s_addserversfromclient; }
247 static void SetAddServersFromClient(bool val) { s_addserversfromclient = val; }
248 static uint16 GetTrafficOMeterInterval() { return s_trafficOMeterInterval; }
249 static void SetTrafficOMeterInterval(uint16 in)
250 { s_trafficOMeterInterval = in; }
251 static uint16 GetStatsInterval() { return s_statsInterval;}
252 static void SetStatsInterval(uint16 in) { s_statsInterval = in; }
253 static bool IsConfirmExitEnabled() { return s_confirmExit; }
254 static bool FilterLanIPs() { return s_filterLanIP; }
255 static void SetFilterLanIPs(bool val) { s_filterLanIP = val; }
256 static bool ParanoidFilter() { return s_paranoidfilter; }
257 static void SetParanoidFilter(bool val) { s_paranoidfilter = val; }
258 static bool IsOnlineSignatureEnabled() { return s_onlineSig; }
259 static void SetOnlineSignatureEnabled(bool val) { s_onlineSig = val; }
260 static uint32 GetMaxGraphUploadRate() { return s_maxGraphUploadRate; }
261 static uint32 GetMaxGraphDownloadRate() { return s_maxGraphDownloadRate; }
262 static void SetMaxGraphUploadRate(uint32 in){ s_maxGraphUploadRate=in; }
263 static void SetMaxGraphDownloadRate(uint32 in)
264 { s_maxGraphDownloadRate = in; }
266 static uint16 GetMaxDownload() { return s_maxdownload; }
267 static uint16 GetMaxConnections() { return s_maxconnections; }
268 static uint16 GetMaxSourcePerFile() { return s_maxsourceperfile; }
269 static uint16 GetMaxSourcePerFileSoft() {
270 uint16 temp = (uint16)(s_maxsourceperfile*0.9);
271 if( temp > 1000 ) return 1000;
272 return temp; }
273 static uint16 GetMaxSourcePerFileUDP() {
274 uint16 temp = (uint16)(s_maxsourceperfile*0.75);
275 if( temp > 100 ) return 100;
276 return temp; }
277 static uint16 GetDeadserverRetries() { return s_deadserverretries; }
278 static void SetDeadserverRetries(uint16 val) { s_deadserverretries = val; }
279 static uint32 GetServerKeepAliveTimeout() { return s_dwServerKeepAliveTimeoutMins*60000; }
280 static void SetServerKeepAliveTimeout(uint32 val) { s_dwServerKeepAliveTimeoutMins = val/60000; }
282 static const wxString& GetLanguageID() { return s_languageID; }
283 static void SetLanguageID(const wxString& new_id) { s_languageID = new_id; }
284 static uint8 CanSeeShares() { return s_iSeeShares; }
285 static void SetCanSeeShares(uint8 val) { s_iSeeShares = val; }
287 static uint8 GetStatsMax() { return s_statsMax; }
288 static bool UseFlatBar() { return (s_depth3D==0); }
289 static uint8 GetStatsAverageMinutes() { return s_statsAverageMinutes; }
290 static void SetStatsAverageMinutes(uint8 in){ s_statsAverageMinutes = in; }
292 static bool GetStartMinimized() { return s_startMinimized; }
293 static void SetStartMinimized(bool instartMinimized)
294 { s_startMinimized = instartMinimized;}
295 static bool GetSmartIdCheck() { return s_smartidcheck; }
296 static void SetSmartIdCheck( bool in_smartidcheck )
297 { s_smartidcheck = in_smartidcheck; }
298 static uint8 GetSmartIdState() { return s_smartidstate; }
299 static void SetSmartIdState( uint8 in_smartidstate )
300 { s_smartidstate = in_smartidstate; }
301 static bool GetVerbose() { return s_bVerbose; }
302 static void SetVerbose(bool val) { s_bVerbose = val; }
303 static bool GetVerboseLogfile() { return s_bVerboseLogfile; }
304 static void SetVerboseLogfile(bool val) { s_bVerboseLogfile = val; }
305 static bool GetPreviewPrio() { return s_bpreviewprio; }
306 static void SetPreviewPrio(bool in) { s_bpreviewprio = in; }
307 static bool StartNextFile() { return s_bstartnextfile; }
308 static bool StartNextFileSame() { return s_bstartnextfilesame; }
309 static bool StartNextFileAlpha() { return s_bstartnextfilealpha; }
310 static void SetStartNextFile(bool val) { s_bstartnextfile = val; }
311 static void SetStartNextFileSame(bool val) { s_bstartnextfilesame = val; }
312 static void SetStartNextFileAlpha(bool val) { s_bstartnextfilealpha = val; }
313 static bool ShowOverhead() { return s_bshowoverhead; }
314 static void SetNewAutoUp(bool m_bInUAP) { s_bUAP = m_bInUAP; }
315 static bool GetNewAutoUp() { return s_bUAP; }
316 static void SetNewAutoDown(bool m_bInDAP) { s_bDAP = m_bInDAP; }
317 static bool GetNewAutoDown() { return s_bDAP; }
319 static const wxString& GetVideoPlayer() { return s_VideoPlayer; }
321 static uint32 GetFileBufferSize() { return s_iFileBufferSize*15000; }
322 static void SetFileBufferSize(uint32 val) { s_iFileBufferSize = val/15000; }
323 static uint32 GetQueueSize() { return s_iQueueSize*100; }
324 static void SetQueueSize(uint32 val) { s_iQueueSize = val/100; }
326 static uint8 Get3DDepth() { return s_depth3D;}
327 static bool AddNewFilesPaused() { return s_addnewfilespaused; }
328 static void SetAddNewFilesPaused(bool val) { s_addnewfilespaused = val; }
330 static void SetMaxConsPerFive(int in) { s_MaxConperFive=in; }
332 static uint16 GetMaxConperFive() { return s_MaxConperFive; }
333 static uint16 GetDefaultMaxConperFive();
335 static bool IsSafeServerConnectEnabled() { return s_safeServerConnect; }
336 static void SetSafeServerConnectEnabled(bool val) { s_safeServerConnect = val; }
338 static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace; }
339 static void SetCheckDiskspaceEnabled(bool val) { s_checkDiskspace = val; }
340 static uint32 GetMinFreeDiskSpaceMB() { return s_uMinFreeDiskSpace; }
341 static uint64 GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace * 1048576ull; }
342 static void SetMinFreeDiskSpaceMB(uint32 val) { s_uMinFreeDiskSpace = val; }
344 static const wxString& GetYourHostname() { return s_yourHostname; }
345 static void SetYourHostname(const wxString& s) { s_yourHostname = s; }
347 static void SetMaxUpload(uint16 in);
348 static void SetMaxDownload(uint16 in);
349 static void SetSlotAllocation(uint16 in) { s_slotallocation = (in >= 1) ? in : 1; };
351 typedef std::vector<CPath> PathList;
352 PathList shareddir_list;
354 wxArrayString adresses_list;
356 static bool AutoConnectStaticOnly() { return s_autoconnectstaticonly; }
357 static void SetAutoConnectStaticOnly(bool val) { s_autoconnectstaticonly = val; }
358 static bool GetUPnPEnabled() { return s_UPnPEnabled; }
359 static void SetUPnPEnabled(bool val) { s_UPnPEnabled = val; }
360 static bool GetUPnPECEnabled() { return s_UPnPECEnabled; }
361 static void SetUPnPECEnabled(bool val) { s_UPnPECEnabled = val; }
362 static bool GetUPnPWebServerEnabled() { return s_UPnPWebServerEnabled; }
363 static void SetUPnPWebServerEnabled(bool val){ s_UPnPWebServerEnabled = val; }
364 static uint16 GetUPnPTCPPort() { return s_UPnPTCPPort; }
365 static void SetUPnPTCPPort(uint16 val) { s_UPnPTCPPort = val; }
366 static bool IsManualHighPrio() { return s_bmanualhighprio; }
367 static void SetManualHighPrio(bool val) { s_bmanualhighprio = val; }
368 void LoadCats();
369 static const wxString& GetDateTimeFormat() { return s_datetimeformat; }
370 // Download Categories
371 uint32 AddCat(Category_Struct* cat);
372 void RemoveCat(size_t index);
373 uint32 GetCatCount();
374 Category_Struct* GetCategory(size_t index);
375 const CPath& GetCatPath(uint8 index);
376 uint32 GetCatColor(size_t index);
377 bool CreateCategory(Category_Struct *& category, const wxString& name, const CPath& path,
378 const wxString& comment, uint32 color, uint8 prio);
379 bool UpdateCategory(uint8 cat, const wxString& name, const CPath& path,
380 const wxString& comment, uint32 color, uint8 prio);
382 static AllCategoryFilter GetAllcatFilter() { return s_allcatFilter; }
383 static void SetAllcatFilter(AllCategoryFilter in) { s_allcatFilter = in; }
385 static bool ShowAllNotCats() { return s_showAllNotCats; }
387 // WebServer
388 static uint16 GetWSPort() { return s_nWebPort; }
389 static void SetWSPort(uint16 uPort) { s_nWebPort=uPort; }
390 static uint16 GetWebUPnPTCPPort() { return s_nWebUPnPTCPPort; }
391 static void SetWebUPnPTCPPort(uint16 val) { s_nWebUPnPTCPPort = val; }
392 static const wxString& GetWSPass() { return s_sWebPassword; }
393 static void SetWSPass(const wxString& pass) { s_sWebPassword = pass; }
394 static const wxString& GetWSPath() { return s_sWebPath; }
395 static void SetWSPath(const wxString& path) { s_sWebPath = path; }
396 static bool GetWSIsEnabled() { return s_bWebEnabled; }
397 static void SetWSIsEnabled(bool bEnable) { s_bWebEnabled=bEnable; }
398 static bool GetWebUseGzip() { return s_bWebUseGzip; }
399 static void SetWebUseGzip(bool bUse) { s_bWebUseGzip=bUse; }
400 static uint32 GetWebPageRefresh() { return s_nWebPageRefresh; }
401 static void SetWebPageRefresh(uint32 nRefresh) { s_nWebPageRefresh=nRefresh; }
402 static bool GetWSIsLowUserEnabled() { return s_bWebLowEnabled; }
403 static void SetWSIsLowUserEnabled(bool in) { s_bWebLowEnabled=in; }
404 static const wxString& GetWSLowPass() { return s_sWebLowPassword; }
405 static void SetWSLowPass(const wxString& pass) { s_sWebLowPassword = pass; }
406 static const wxString& GetWebTemplate() { return s_WebTemplate; }
407 static void SetWebTemplate(const wxString& val) { s_WebTemplate = val; }
409 static void SetMaxSourcesPerFile(uint16 in) { s_maxsourceperfile=in;}
410 static void SetMaxConnections(uint16 in) { s_maxconnections =in;}
412 static bool ShowCatTabInfos() { return s_showCatTabInfos; }
413 static void ShowCatTabInfos(bool in) { s_showCatTabInfos=in; }
415 // External Connections
416 static bool AcceptExternalConnections() { return s_AcceptExternalConnections; }
417 static void EnableExternalConnections( bool val ) { s_AcceptExternalConnections = val; }
418 static const wxString& GetECAddress() { return s_ECAddr; }
419 static uint32 ECPort() { return s_ECPort; }
420 static void SetECPort(uint32 val) { s_ECPort = val; }
421 static const wxString& ECPassword() { return s_ECPassword; }
422 static void SetECPass(const wxString& pass) { s_ECPassword = pass; }
423 static bool IsTransmitOnlyUploadingClients() { return s_TransmitOnlyUploadingClients; }
425 // Fast ED2K Links Handler Toggling
426 static bool GetFED2KLH() { return s_FastED2KLinksHandler; }
428 // Ip filter
429 static bool IsFilteringClients() { return s_IPFilterClients; }
430 static void SetFilteringClients(bool val);
431 static bool IsFilteringServers() { return s_IPFilterServers; }
432 static void SetFilteringServers(bool val);
433 static uint8 GetIPFilterLevel() { return s_filterlevel;}
434 static void SetIPFilterLevel(uint8 level);
435 static bool IPFilterAutoLoad() { return s_IPFilterAutoLoad; }
436 static void SetIPFilterAutoLoad(bool val) { s_IPFilterAutoLoad = val; }
437 static const wxString& IPFilterURL() { return s_IPFilterURL; }
438 static void SetIPFilterURL(const wxString& url) { s_IPFilterURL = url; }
439 static bool UseIPFilterSystem() { return s_IPFilterSys; }
440 static void SetIPFilterSystem(bool val) { s_IPFilterSys = val; }
442 // Source seeds On/Off
443 static bool GetSrcSeedsOn() { return s_UseSrcSeeds; }
444 static void SetSrcSeedsOn(bool val) { s_UseSrcSeeds = val; }
446 static bool IsSecureIdentEnabled() { return s_SecIdent; }
447 static void SetSecureIdentEnabled(bool val) { s_SecIdent = val; }
449 static bool GetExtractMetaData() { return s_ExtractMetaData; }
450 static void SetExtractMetaData(bool val) { s_ExtractMetaData = val; }
452 static bool ShowProgBar() { return s_ProgBar; }
453 static bool ShowPercent() { return s_Percent; }
455 static bool GetAllocFullFile() { return s_allocFullFile; };
456 static void SetAllocFullFile(bool val) { s_allocFullFile = val; }
458 static wxString GetBrowser();
460 static const wxString& GetSkin() { return s_Skin; }
462 static bool VerticalToolbar() { return s_ToolbarOrientation; }
464 static const CPath& GetOSDir() { return s_OSDirectory; }
465 static uint16 GetOSUpdate() { return s_OSUpdate; }
467 static uint8 GetToolTipDelay() { return s_iToolDelayTime; }
469 static void UnsetAutoServerStart();
470 static void CheckUlDlRatio();
472 static void BuildItemList( const wxString& appdir );
473 static void EraseItemList();
475 static void LoadAllItems(wxConfigBase* cfg);
476 static void SaveAllItems(wxConfigBase* cfg);
478 #ifndef __SVN__
479 static bool ShowVersionOnTitle() { return s_showVersionOnTitle; }
480 #else
481 static bool ShowVersionOnTitle() { return true; }
482 #endif
483 static uint8_t GetShowRatesOnTitle() { return s_showRatesOnTitle; }
484 static void SetShowRatesOnTitle(uint8_t val) { s_showRatesOnTitle = val; }
486 // Message Filters
488 static bool MustFilterMessages() { return s_MustFilterMessages; }
489 static void SetMustFilterMessages(bool val) { s_MustFilterMessages = val; }
490 static bool IsFilterAllMessages() { return s_FilterAllMessages; }
491 static void SetFilterAllMessages(bool val) { s_FilterAllMessages = val; }
492 static bool MsgOnlyFriends() { return s_msgonlyfriends;}
493 static void SetMsgOnlyFriends(bool val) { s_msgonlyfriends = val; }
494 static bool MsgOnlySecure() { return s_msgsecure;}
495 static void SetMsgOnlySecure(bool val) { s_msgsecure = val; }
496 static bool IsFilterByKeywords() { return s_FilterSomeMessages; }
497 static void SetFilterByKeywords(bool val) { s_FilterSomeMessages = val; }
498 static const wxString& GetMessageFilterString() { return s_MessageFilterString; }
499 static void SetMessageFilterString(const wxString& val) { s_MessageFilterString = val; }
500 static bool IsMessageFiltered(const wxString& message);
501 static bool ShowMessagesInLog() { return s_ShowMessagesInLog; }
502 static bool IsAdvancedSpamfilterEnabled() { return s_IsAdvancedSpamfilterEnabled;}
503 static bool IsChatCaptchaEnabled() { return IsAdvancedSpamfilterEnabled() && s_IsChatCaptchaEnabled; }
505 static bool FilterComments() { return s_FilterComments; }
506 static void SetFilterComments(bool val) { s_FilterComments = val; }
507 static const wxString& GetCommentFilterString() { return s_CommentFilterString; }
508 static void SetCommentFilterString(const wxString& val) { s_CommentFilterString = val; }
509 static bool IsCommentFiltered(const wxString& comment);
511 // Can't have it return a reference, will need a pointer later.
512 static const CProxyData *GetProxyData() { return &s_ProxyData; }
514 // Hidden files
516 static bool ShareHiddenFiles() { return s_ShareHiddenFiles; }
517 static void SetShareHiddenFiles(bool val) { s_ShareHiddenFiles = val; }
519 static bool AutoSortDownload() { return s_AutoSortDownload; }
520 static bool AutoSortDownload(bool val) { bool tmp = s_AutoSortDownload; s_AutoSortDownload = val; return tmp; }
522 // Version check
524 static bool GetCheckNewVersion() { return s_NewVersionCheck; }
525 static void SetCheckNewVersion(bool val) { s_NewVersionCheck = val; }
527 // Networks
528 static bool GetNetworkKademlia() { return s_ConnectToKad; }
529 static void SetNetworkKademlia(bool val) { s_ConnectToKad = val; }
530 static bool GetNetworkED2K() { return s_ConnectToED2K; }
531 static void SetNetworkED2K(bool val) { s_ConnectToED2K = val; }
533 // Statistics
534 static unsigned GetMaxClientVersions() { return s_maxClientVersions; }
536 // Dropping slow sources
537 static bool GetDropSlowSources() { return s_DropSlowSources; }
539 // server.met and nodes.dat urls
540 static const wxString& GetKadNodesUrl() { return s_KadURL; }
541 static void SetKadNodesUrl(const wxString& url) { s_KadURL = url; }
543 static const wxString& GetEd2kServersUrl() { return s_Ed2kURL; }
544 static void SetEd2kServersUrl(const wxString& url) { s_Ed2kURL = url; }
546 // Crypt
547 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported;}
548 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested;}
549 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired;}
550 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
551 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
552 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
553 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
554 static uint32 GetKadUDPKey() {return s_dwKadUDPKey;}
555 static uint8 GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength;}
557 static void SetClientCryptLayerSupported(bool v) {s_IsClientCryptLayerSupported = v;}
558 static void SetClientCryptLayerRequested(bool v) {s_bCryptLayerRequested = v; }
559 static void SetClientCryptLayerRequired(bool v) {s_IsClientCryptLayerRequired = v;}
561 // GeoIP
562 static bool IsGeoIPEnabled() {return s_GeoIPEnabled;}
563 static void SetGeoIPEnabled(bool v) {s_GeoIPEnabled = v;}
564 static const wxString& GetGeoIPUpdateUrl() {return s_GeoIPUpdateUrl;}
566 // Stats server
567 static const wxString& GetStatsServerName() {return s_StatsServerName;}
568 static const wxString& GetStatsServerURL() {return s_StatsServerURL;}
570 // HTTP download
571 static wxString GetLastHTTPDownloadURL(uint8 t);
572 static void SetLastHTTPDownloadURL(uint8 t, const wxString& val);
574 // Sleep
575 static bool GetPreventSleepWhileDownloading() { return s_preventSleepWhileDownloading; }
576 static void SetPreventSleepWhileDownloading(bool status) { s_preventSleepWhileDownloading = status; }
577 protected:
578 static int32 GetRecommendedMaxConnections();
580 //! Temporary storage for statistic-colors.
581 static unsigned long s_colors[cntStatColors];
582 //! Reference for checking if the colors has changed.
583 static unsigned long s_colors_ref[cntStatColors];
585 typedef std::vector<Cfg_Base*> CFGList;
586 typedef std::map<int, Cfg_Base*> CFGMap;
587 typedef std::vector<Category_Struct*> CatList;
590 static CFGMap s_CfgList;
591 static CFGList s_MiscList;
592 CatList m_CatList;
594 private:
595 void LoadPreferences();
596 void SavePreferences();
598 protected:
599 static wxString s_configDir;
601 ////////////// USER
602 static wxString s_nick;
604 static CMD4Hash s_userhash;
606 static Cfg_Lang_Base * s_cfgLang;
608 ////////////// CONNECTION
609 static uint16 s_maxupload;
610 static uint16 s_maxdownload;
611 static uint16 s_slotallocation;
612 static wxString s_Addr;
613 static uint16 s_port;
614 static uint16 s_udpport;
615 static bool s_UDPEnable;
616 static uint16 s_maxconnections;
617 static bool s_reconnect;
618 static bool s_autoconnect;
619 static bool s_autoconnectstaticonly;
620 static bool s_UPnPEnabled;
621 static bool s_UPnPECEnabled;
622 static bool s_UPnPWebServerEnabled;
623 static uint16 s_UPnPTCPPort;
625 ////////////// PROXY
626 static CProxyData s_ProxyData;
628 ////////////// SERVERS
629 static bool s_autoserverlist;
630 static bool s_deadserver;
632 ////////////// FILES
633 static CPath s_incomingdir;
634 static CPath s_tempdir;
635 static bool s_ICH;
636 static bool s_AICHTrustEveryHash;
638 ////////////// GUI
639 static uint8 s_depth3D;
641 static bool s_scorsystem;
642 static bool s_hideonclose;
643 static bool s_mintotray;
644 static bool s_trayiconenabled;
645 static bool s_addnewfilespaused;
646 static bool s_addserversfromserver;
647 static bool s_addserversfromclient;
648 static uint16 s_maxsourceperfile;
649 static uint16 s_trafficOMeterInterval;
650 static uint16 s_statsInterval;
651 static uint32 s_maxGraphDownloadRate;
652 static uint32 s_maxGraphUploadRate;
653 static bool s_confirmExit;
656 static bool s_filterLanIP;
657 static bool s_paranoidfilter;
658 static bool s_onlineSig;
660 static wxString s_languageID;
661 static uint8 s_iSeeShares; // 0=everybody 1=friends only 2=noone
662 static uint8 s_iToolDelayTime; // tooltip delay time in seconds
663 static uint8 s_splitterbarPosition;
664 static uint16 s_deadserverretries;
665 static uint32 s_dwServerKeepAliveTimeoutMins;
667 static uint8 s_statsMax;
668 static uint8 s_statsAverageMinutes;
670 static bool s_bpreviewprio;
671 static bool s_smartidcheck;
672 static uint8 s_smartidstate;
673 static bool s_safeServerConnect;
674 static bool s_startMinimized;
675 static uint16 s_MaxConperFive;
676 static bool s_checkDiskspace;
677 static uint32 s_uMinFreeDiskSpace;
678 static wxString s_yourHostname;
679 static bool s_bVerbose;
680 static bool s_bVerboseLogfile;
681 static bool s_bmanualhighprio;
682 static bool s_bstartnextfile;
683 static bool s_bstartnextfilesame;
684 static bool s_bstartnextfilealpha;
685 static bool s_bshowoverhead;
686 static bool s_bDAP;
687 static bool s_bUAP;
689 #ifndef __SVN__
690 static bool s_showVersionOnTitle;
691 #endif
692 static uint8_t s_showRatesOnTitle; // 0=no, 1=after app name, 2=before app name
694 static wxString s_VideoPlayer;
695 static bool s_showAllNotCats;
697 static bool s_msgonlyfriends;
698 static bool s_msgsecure;
700 static uint8 s_iFileBufferSize;
701 static uint8 s_iQueueSize;
703 static wxString s_datetimeformat;
705 static bool s_ToolbarOrientation;
707 // Web Server [kuchin]
708 static wxString s_sWebPassword;
709 static wxString s_sWebPath;
710 static wxString s_sWebLowPassword;
711 static uint16 s_nWebPort;
712 static uint16 s_nWebUPnPTCPPort;
713 static bool s_bWebEnabled;
714 static bool s_bWebUseGzip;
715 static uint32 s_nWebPageRefresh;
716 static bool s_bWebLowEnabled;
717 static wxString s_WebTemplate;
719 static bool s_showCatTabInfos;
720 static AllCategoryFilter s_allcatFilter;
722 // Kry - external connections
723 static bool s_AcceptExternalConnections;
724 static wxString s_ECAddr;
725 static uint32 s_ECPort;
726 static wxString s_ECPassword;
727 static bool s_TransmitOnlyUploadingClients;
729 // Kry - IPFilter
730 static bool s_IPFilterClients;
731 static bool s_IPFilterServers;
732 static uint8 s_filterlevel;
733 static bool s_IPFilterAutoLoad;
734 static wxString s_IPFilterURL;
735 static bool s_IPFilterSys;
737 // Kry - Source seeds on/off
738 static bool s_UseSrcSeeds;
740 static bool s_ProgBar;
741 static bool s_Percent;
743 static bool s_SecIdent;
745 static bool s_ExtractMetaData;
747 static bool s_allocFullFile;
749 static wxString s_CustomBrowser;
750 static bool s_BrowserTab; // Jacobo221 - Open in tabs if possible
752 static CPath s_OSDirectory;
753 static uint16 s_OSUpdate;
755 static wxString s_Skin;
757 static bool s_FastED2KLinksHandler; // Madcat - Toggle Fast ED2K Links Handler
759 // Message Filtering
760 static bool s_MustFilterMessages;
761 static wxString s_MessageFilterString;
762 static bool s_FilterAllMessages;
763 static bool s_FilterSomeMessages;
764 static bool s_ShowMessagesInLog;
765 static bool s_IsAdvancedSpamfilterEnabled;
766 static bool s_IsChatCaptchaEnabled;
768 static bool s_FilterComments;
769 static wxString s_CommentFilterString;
772 // Hidden files sharing
773 static bool s_ShareHiddenFiles;
775 static bool s_AutoSortDownload;
777 // Version check
778 static bool s_NewVersionCheck;
780 // Kad
781 static bool s_ConnectToKad;
782 static bool s_ConnectToED2K;
784 // Statistics
785 static unsigned s_maxClientVersions; // 0 = unlimited
787 // Drop slow sources if needed
788 static bool s_DropSlowSources;
790 static wxString s_Ed2kURL;
791 static wxString s_KadURL;
793 // Crypt
794 static bool s_IsClientCryptLayerSupported;
795 static bool s_IsClientCryptLayerRequired;
796 static bool s_bCryptLayerRequested;
797 static uint32 s_dwKadUDPKey;
798 static uint8 s_byCryptTCPPaddingLength;
800 // GeoIP
801 static bool s_GeoIPEnabled;
802 static wxString s_GeoIPUpdateUrl;
804 // Sleep vetoing
805 static bool s_preventSleepWhileDownloading;
807 // Stats server
808 static wxString s_StatsServerName;
809 static wxString s_StatsServerURL;
813 #endif // PREFERENCES_H
814 // File_checked_for_headers