Remove do-nothing command and add warning about it
[amule.git] / src / Preferences.h
blob624d921199583d43c1af20e58ca96510fbb786b9
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 bool ShowNotifications() { return s_notify; }
237 static void SetMinToTray(bool val) { s_mintotray = val; }
238 static bool UseTrayIcon() { return s_trayiconenabled; }
239 static void SetUseTrayIcon(bool val) { s_trayiconenabled = val; }
240 static bool HideOnClose() { return s_hideonclose; }
241 static void SetHideOnClose(bool val) { s_hideonclose = val; }
242 static bool DoAutoConnect() { return s_autoconnect; }
243 static void SetAutoConnect(bool inautoconnect)
244 {s_autoconnect = inautoconnect; }
245 static bool AddServersFromServer() { return s_addserversfromserver; }
246 static void SetAddServersFromServer(bool val) { s_addserversfromserver = val; }
247 static bool AddServersFromClient() { return s_addserversfromclient; }
248 static void SetAddServersFromClient(bool val) { s_addserversfromclient = val; }
249 static uint16 GetTrafficOMeterInterval() { return s_trafficOMeterInterval; }
250 static void SetTrafficOMeterInterval(uint16 in)
251 { s_trafficOMeterInterval = in; }
252 static uint16 GetStatsInterval() { return s_statsInterval;}
253 static void SetStatsInterval(uint16 in) { s_statsInterval = in; }
254 static bool IsConfirmExitEnabled() { return s_confirmExit; }
255 static bool FilterLanIPs() { return s_filterLanIP; }
256 static void SetFilterLanIPs(bool val) { s_filterLanIP = val; }
257 static bool ParanoidFilter() { return s_paranoidfilter; }
258 static void SetParanoidFilter(bool val) { s_paranoidfilter = val; }
259 static bool IsOnlineSignatureEnabled() { return s_onlineSig; }
260 static void SetOnlineSignatureEnabled(bool val) { s_onlineSig = val; }
261 static uint32 GetMaxGraphUploadRate() { return s_maxGraphUploadRate; }
262 static uint32 GetMaxGraphDownloadRate() { return s_maxGraphDownloadRate; }
263 static void SetMaxGraphUploadRate(uint32 in){ s_maxGraphUploadRate=in; }
264 static void SetMaxGraphDownloadRate(uint32 in)
265 { s_maxGraphDownloadRate = in; }
267 static uint16 GetMaxDownload() { return s_maxdownload; }
268 static uint16 GetMaxConnections() { return s_maxconnections; }
269 static uint16 GetMaxSourcePerFile() { return s_maxsourceperfile; }
270 static uint16 GetMaxSourcePerFileSoft() {
271 uint16 temp = (uint16)(s_maxsourceperfile*0.9);
272 if( temp > 1000 ) return 1000;
273 return temp; }
274 static uint16 GetMaxSourcePerFileUDP() {
275 uint16 temp = (uint16)(s_maxsourceperfile*0.75);
276 if( temp > 100 ) return 100;
277 return temp; }
278 static uint16 GetDeadserverRetries() { return s_deadserverretries; }
279 static void SetDeadserverRetries(uint16 val) { s_deadserverretries = val; }
280 static uint32 GetServerKeepAliveTimeout() { return s_dwServerKeepAliveTimeoutMins*60000; }
281 static void SetServerKeepAliveTimeout(uint32 val) { s_dwServerKeepAliveTimeoutMins = val/60000; }
283 static const wxString& GetLanguageID() { return s_languageID; }
284 static void SetLanguageID(const wxString& new_id) { s_languageID = new_id; }
285 static uint8 CanSeeShares() { return s_iSeeShares; }
286 static void SetCanSeeShares(uint8 val) { s_iSeeShares = val; }
288 static uint8 GetStatsMax() { return s_statsMax; }
289 static bool UseFlatBar() { return (s_depth3D==0); }
290 static uint8 GetStatsAverageMinutes() { return s_statsAverageMinutes; }
291 static void SetStatsAverageMinutes(uint8 in){ s_statsAverageMinutes = in; }
293 static bool GetStartMinimized() { return s_startMinimized; }
294 static void SetStartMinimized(bool instartMinimized)
295 { s_startMinimized = instartMinimized;}
296 static bool GetSmartIdCheck() { return s_smartidcheck; }
297 static void SetSmartIdCheck( bool in_smartidcheck )
298 { s_smartidcheck = in_smartidcheck; }
299 static uint8 GetSmartIdState() { return s_smartidstate; }
300 static void SetSmartIdState( uint8 in_smartidstate )
301 { s_smartidstate = in_smartidstate; }
302 static bool GetVerbose() { return s_bVerbose; }
303 static void SetVerbose(bool val) { s_bVerbose = val; }
304 static bool GetVerboseLogfile() { return s_bVerboseLogfile; }
305 static void SetVerboseLogfile(bool val) { s_bVerboseLogfile = val; }
306 static bool GetPreviewPrio() { return s_bpreviewprio; }
307 static void SetPreviewPrio(bool in) { s_bpreviewprio = in; }
308 static bool StartNextFile() { return s_bstartnextfile; }
309 static bool StartNextFileSame() { return s_bstartnextfilesame; }
310 static bool StartNextFileAlpha() { return s_bstartnextfilealpha; }
311 static void SetStartNextFile(bool val) { s_bstartnextfile = val; }
312 static void SetStartNextFileSame(bool val) { s_bstartnextfilesame = val; }
313 static void SetStartNextFileAlpha(bool val) { s_bstartnextfilealpha = val; }
314 static bool ShowOverhead() { return s_bshowoverhead; }
315 static void SetNewAutoUp(bool m_bInUAP) { s_bUAP = m_bInUAP; }
316 static bool GetNewAutoUp() { return s_bUAP; }
317 static void SetNewAutoDown(bool m_bInDAP) { s_bDAP = m_bInDAP; }
318 static bool GetNewAutoDown() { return s_bDAP; }
320 static const wxString& GetVideoPlayer() { return s_VideoPlayer; }
322 static uint32 GetFileBufferSize() { return s_iFileBufferSize*15000; }
323 static void SetFileBufferSize(uint32 val) { s_iFileBufferSize = val/15000; }
324 static uint32 GetQueueSize() { return s_iQueueSize*100; }
325 static void SetQueueSize(uint32 val) { s_iQueueSize = val/100; }
327 static uint8 Get3DDepth() { return s_depth3D;}
328 static bool AddNewFilesPaused() { return s_addnewfilespaused; }
329 static void SetAddNewFilesPaused(bool val) { s_addnewfilespaused = val; }
331 static void SetMaxConsPerFive(int in) { s_MaxConperFive=in; }
333 static uint16 GetMaxConperFive() { return s_MaxConperFive; }
334 static uint16 GetDefaultMaxConperFive();
336 static bool IsSafeServerConnectEnabled() { return s_safeServerConnect; }
337 static void SetSafeServerConnectEnabled(bool val) { s_safeServerConnect = val; }
339 static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace; }
340 static void SetCheckDiskspaceEnabled(bool val) { s_checkDiskspace = val; }
341 static uint32 GetMinFreeDiskSpaceMB() { return s_uMinFreeDiskSpace; }
342 static uint64 GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace * 1048576ull; }
343 static void SetMinFreeDiskSpaceMB(uint32 val) { s_uMinFreeDiskSpace = val; }
345 static const wxString& GetYourHostname() { return s_yourHostname; }
346 static void SetYourHostname(const wxString& s) { s_yourHostname = s; }
348 static void SetMaxUpload(uint16 in);
349 static void SetMaxDownload(uint16 in);
350 static void SetSlotAllocation(uint16 in) { s_slotallocation = (in >= 1) ? in : 1; };
352 typedef std::vector<CPath> PathList;
353 PathList shareddir_list;
355 wxArrayString adresses_list;
357 static bool AutoConnectStaticOnly() { return s_autoconnectstaticonly; }
358 static void SetAutoConnectStaticOnly(bool val) { s_autoconnectstaticonly = val; }
359 static bool GetUPnPEnabled() { return s_UPnPEnabled; }
360 static void SetUPnPEnabled(bool val) { s_UPnPEnabled = val; }
361 static bool GetUPnPECEnabled() { return s_UPnPECEnabled; }
362 static void SetUPnPECEnabled(bool val) { s_UPnPECEnabled = val; }
363 static bool GetUPnPWebServerEnabled() { return s_UPnPWebServerEnabled; }
364 static void SetUPnPWebServerEnabled(bool val){ s_UPnPWebServerEnabled = val; }
365 static uint16 GetUPnPTCPPort() { return s_UPnPTCPPort; }
366 static void SetUPnPTCPPort(uint16 val) { s_UPnPTCPPort = val; }
367 static bool IsManualHighPrio() { return s_bmanualhighprio; }
368 static void SetManualHighPrio(bool val) { s_bmanualhighprio = val; }
369 void LoadCats();
370 static const wxString& GetDateTimeFormat() { return s_datetimeformat; }
371 // Download Categories
372 uint32 AddCat(Category_Struct* cat);
373 void RemoveCat(size_t index);
374 uint32 GetCatCount();
375 Category_Struct* GetCategory(size_t index);
376 const CPath& GetCatPath(uint8 index);
377 uint32 GetCatColor(size_t index);
378 bool CreateCategory(Category_Struct *& category, const wxString& name, const CPath& path,
379 const wxString& comment, uint32 color, uint8 prio);
380 bool UpdateCategory(uint8 cat, const wxString& name, const CPath& path,
381 const wxString& comment, uint32 color, uint8 prio);
383 static AllCategoryFilter GetAllcatFilter() { return s_allcatFilter; }
384 static void SetAllcatFilter(AllCategoryFilter in) { s_allcatFilter = in; }
386 static bool ShowAllNotCats() { return s_showAllNotCats; }
388 // WebServer
389 static uint16 GetWSPort() { return s_nWebPort; }
390 static void SetWSPort(uint16 uPort) { s_nWebPort=uPort; }
391 static uint16 GetWebUPnPTCPPort() { return s_nWebUPnPTCPPort; }
392 static void SetWebUPnPTCPPort(uint16 val) { s_nWebUPnPTCPPort = val; }
393 static const wxString& GetWSPass() { return s_sWebPassword; }
394 static void SetWSPass(const wxString& pass) { s_sWebPassword = pass; }
395 static const wxString& GetWSPath() { return s_sWebPath; }
396 static void SetWSPath(const wxString& path) { s_sWebPath = path; }
397 static bool GetWSIsEnabled() { return s_bWebEnabled; }
398 static void SetWSIsEnabled(bool bEnable) { s_bWebEnabled=bEnable; }
399 static bool GetWebUseGzip() { return s_bWebUseGzip; }
400 static void SetWebUseGzip(bool bUse) { s_bWebUseGzip=bUse; }
401 static uint32 GetWebPageRefresh() { return s_nWebPageRefresh; }
402 static void SetWebPageRefresh(uint32 nRefresh) { s_nWebPageRefresh=nRefresh; }
403 static bool GetWSIsLowUserEnabled() { return s_bWebLowEnabled; }
404 static void SetWSIsLowUserEnabled(bool in) { s_bWebLowEnabled=in; }
405 static const wxString& GetWSLowPass() { return s_sWebLowPassword; }
406 static void SetWSLowPass(const wxString& pass) { s_sWebLowPassword = pass; }
407 static const wxString& GetWebTemplate() { return s_WebTemplate; }
408 static void SetWebTemplate(const wxString& val) { s_WebTemplate = val; }
410 static void SetMaxSourcesPerFile(uint16 in) { s_maxsourceperfile=in;}
411 static void SetMaxConnections(uint16 in) { s_maxconnections =in;}
413 static bool ShowCatTabInfos() { return s_showCatTabInfos; }
414 static void ShowCatTabInfos(bool in) { s_showCatTabInfos=in; }
416 // External Connections
417 static bool AcceptExternalConnections() { return s_AcceptExternalConnections; }
418 static void EnableExternalConnections( bool val ) { s_AcceptExternalConnections = val; }
419 static const wxString& GetECAddress() { return s_ECAddr; }
420 static uint32 ECPort() { return s_ECPort; }
421 static void SetECPort(uint32 val) { s_ECPort = val; }
422 static const wxString& ECPassword() { return s_ECPassword; }
423 static void SetECPass(const wxString& pass) { s_ECPassword = pass; }
424 static bool IsTransmitOnlyUploadingClients() { return s_TransmitOnlyUploadingClients; }
426 // Fast ED2K Links Handler Toggling
427 static bool GetFED2KLH() { return s_FastED2KLinksHandler; }
429 // Ip filter
430 static bool IsFilteringClients() { return s_IPFilterClients; }
431 static void SetFilteringClients(bool val);
432 static bool IsFilteringServers() { return s_IPFilterServers; }
433 static void SetFilteringServers(bool val);
434 static uint8 GetIPFilterLevel() { return s_filterlevel;}
435 static void SetIPFilterLevel(uint8 level);
436 static bool IPFilterAutoLoad() { return s_IPFilterAutoLoad; }
437 static void SetIPFilterAutoLoad(bool val) { s_IPFilterAutoLoad = val; }
438 static const wxString& IPFilterURL() { return s_IPFilterURL; }
439 static void SetIPFilterURL(const wxString& url) { s_IPFilterURL = url; }
440 static bool UseIPFilterSystem() { return s_IPFilterSys; }
441 static void SetIPFilterSystem(bool val) { s_IPFilterSys = val; }
443 // Source seeds On/Off
444 static bool GetSrcSeedsOn() { return s_UseSrcSeeds; }
445 static void SetSrcSeedsOn(bool val) { s_UseSrcSeeds = val; }
447 static bool IsSecureIdentEnabled() { return s_SecIdent; }
448 static void SetSecureIdentEnabled(bool val) { s_SecIdent = val; }
450 static bool GetExtractMetaData() { return s_ExtractMetaData; }
451 static void SetExtractMetaData(bool val) { s_ExtractMetaData = val; }
453 static bool ShowProgBar() { return s_ProgBar; }
454 static bool ShowPercent() { return s_Percent; }
456 static bool GetAllocFullFile() { return s_allocFullFile; };
457 static void SetAllocFullFile(bool val) { s_allocFullFile = val; }
459 static bool CreateFilesSparse() { return s_createFilesSparse; }
460 // Beware! This function reverts the value it gets, that's why the name is also different!
461 // In EC we send/receive the reverted value, that's the reason for a reverse setter.
462 static void CreateFilesNormal(bool val) { s_createFilesSparse = !val; }
464 static wxString GetBrowser();
466 static const wxString& GetSkin() { return s_Skin; }
468 static bool VerticalToolbar() { return s_ToolbarOrientation; }
470 static const CPath& GetOSDir() { return s_OSDirectory; }
471 static uint16 GetOSUpdate() { return s_OSUpdate; }
473 static uint8 GetToolTipDelay() { return s_iToolDelayTime; }
475 static void UnsetAutoServerStart();
476 static void CheckUlDlRatio();
478 static void BuildItemList( const wxString& appdir );
479 static void EraseItemList();
481 static void LoadAllItems(wxConfigBase* cfg);
482 static void SaveAllItems(wxConfigBase* cfg);
484 #ifndef __SVN__
485 static bool ShowVersionOnTitle() { return s_showVersionOnTitle; }
486 #else
487 static bool ShowVersionOnTitle() { return true; }
488 #endif
489 static uint8_t GetShowRatesOnTitle() { return s_showRatesOnTitle; }
490 static void SetShowRatesOnTitle(uint8_t val) { s_showRatesOnTitle = val; }
492 // Message Filters
494 static bool MustFilterMessages() { return s_MustFilterMessages; }
495 static void SetMustFilterMessages(bool val) { s_MustFilterMessages = val; }
496 static bool IsFilterAllMessages() { return s_FilterAllMessages; }
497 static void SetFilterAllMessages(bool val) { s_FilterAllMessages = val; }
498 static bool MsgOnlyFriends() { return s_msgonlyfriends;}
499 static void SetMsgOnlyFriends(bool val) { s_msgonlyfriends = val; }
500 static bool MsgOnlySecure() { return s_msgsecure;}
501 static void SetMsgOnlySecure(bool val) { s_msgsecure = val; }
502 static bool IsFilterByKeywords() { return s_FilterSomeMessages; }
503 static void SetFilterByKeywords(bool val) { s_FilterSomeMessages = val; }
504 static const wxString& GetMessageFilterString() { return s_MessageFilterString; }
505 static void SetMessageFilterString(const wxString& val) { s_MessageFilterString = val; }
506 static bool IsMessageFiltered(const wxString& message);
507 static bool ShowMessagesInLog() { return s_ShowMessagesInLog; }
508 static bool IsAdvancedSpamfilterEnabled() { return s_IsAdvancedSpamfilterEnabled;}
509 static bool IsChatCaptchaEnabled() { return IsAdvancedSpamfilterEnabled() && s_IsChatCaptchaEnabled; }
511 static bool FilterComments() { return s_FilterComments; }
512 static void SetFilterComments(bool val) { s_FilterComments = val; }
513 static const wxString& GetCommentFilterString() { return s_CommentFilterString; }
514 static void SetCommentFilterString(const wxString& val) { s_CommentFilterString = val; }
515 static bool IsCommentFiltered(const wxString& comment);
517 // Can't have it return a reference, will need a pointer later.
518 static const CProxyData *GetProxyData() { return &s_ProxyData; }
520 // Hidden files
522 static bool ShareHiddenFiles() { return s_ShareHiddenFiles; }
523 static void SetShareHiddenFiles(bool val) { s_ShareHiddenFiles = val; }
525 static bool AutoSortDownload() { return s_AutoSortDownload; }
526 static bool AutoSortDownload(bool val) { bool tmp = s_AutoSortDownload; s_AutoSortDownload = val; return tmp; }
528 // Version check
530 static bool GetCheckNewVersion() { return s_NewVersionCheck; }
531 static void SetCheckNewVersion(bool val) { s_NewVersionCheck = val; }
533 // Networks
534 static bool GetNetworkKademlia() { return s_ConnectToKad; }
535 static void SetNetworkKademlia(bool val) { s_ConnectToKad = val; }
536 static bool GetNetworkED2K() { return s_ConnectToED2K; }
537 static void SetNetworkED2K(bool val) { s_ConnectToED2K = val; }
539 // Statistics
540 static unsigned GetMaxClientVersions() { return s_maxClientVersions; }
542 // Dropping slow sources
543 static bool GetDropSlowSources() { return s_DropSlowSources; }
545 // server.met and nodes.dat urls
546 static const wxString& GetKadNodesUrl() { return s_KadURL; }
547 static void SetKadNodesUrl(const wxString& url) { s_KadURL = url; }
549 static const wxString& GetEd2kServersUrl() { return s_Ed2kURL; }
550 static void SetEd2kServersUrl(const wxString& url) { s_Ed2kURL = url; }
552 // Crypt
553 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported;}
554 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested;}
555 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired;}
556 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
557 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
558 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
559 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
560 static uint32 GetKadUDPKey() {return s_dwKadUDPKey;}
561 static uint8 GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength;}
563 static void SetClientCryptLayerSupported(bool v) {s_IsClientCryptLayerSupported = v;}
564 static void SetClientCryptLayerRequested(bool v) {s_bCryptLayerRequested = v; }
565 static void SetClientCryptLayerRequired(bool v) {s_IsClientCryptLayerRequired = v;}
567 // GeoIP
568 static bool IsGeoIPEnabled() {return s_GeoIPEnabled;}
569 static void SetGeoIPEnabled(bool v) {s_GeoIPEnabled = v;}
570 static const wxString& GetGeoIPUpdateUrl() {return s_GeoIPUpdateUrl;}
572 // Stats server
573 static const wxString& GetStatsServerName() {return s_StatsServerName;}
574 static const wxString& GetStatsServerURL() {return s_StatsServerURL;}
576 // HTTP download
577 static wxString GetLastHTTPDownloadURL(uint8 t);
578 static void SetLastHTTPDownloadURL(uint8 t, const wxString& val);
580 // Sleep
581 static bool GetPreventSleepWhileDownloading() { return s_preventSleepWhileDownloading; }
582 static void SetPreventSleepWhileDownloading(bool status) { s_preventSleepWhileDownloading = status; }
583 protected:
584 static int32 GetRecommendedMaxConnections();
586 //! Temporary storage for statistic-colors.
587 static unsigned long s_colors[cntStatColors];
588 //! Reference for checking if the colors has changed.
589 static unsigned long s_colors_ref[cntStatColors];
591 typedef std::vector<Cfg_Base*> CFGList;
592 typedef std::map<int, Cfg_Base*> CFGMap;
593 typedef std::vector<Category_Struct*> CatList;
596 static CFGMap s_CfgList;
597 static CFGList s_MiscList;
598 CatList m_CatList;
600 private:
601 void LoadPreferences();
602 void SavePreferences();
604 protected:
605 static wxString s_configDir;
607 ////////////// USER
608 static wxString s_nick;
610 static CMD4Hash s_userhash;
612 static Cfg_Lang_Base * s_cfgLang;
614 ////////////// CONNECTION
615 static uint16 s_maxupload;
616 static uint16 s_maxdownload;
617 static uint16 s_slotallocation;
618 static wxString s_Addr;
619 static uint16 s_port;
620 static uint16 s_udpport;
621 static bool s_UDPEnable;
622 static uint16 s_maxconnections;
623 static bool s_reconnect;
624 static bool s_autoconnect;
625 static bool s_autoconnectstaticonly;
626 static bool s_UPnPEnabled;
627 static bool s_UPnPECEnabled;
628 static bool s_UPnPWebServerEnabled;
629 static uint16 s_UPnPTCPPort;
631 ////////////// PROXY
632 static CProxyData s_ProxyData;
634 ////////////// SERVERS
635 static bool s_autoserverlist;
636 static bool s_deadserver;
638 ////////////// FILES
639 static CPath s_incomingdir;
640 static CPath s_tempdir;
641 static bool s_ICH;
642 static bool s_AICHTrustEveryHash;
644 ////////////// GUI
645 static uint8 s_depth3D;
647 static bool s_scorsystem;
648 static bool s_hideonclose;
649 static bool s_mintotray;
650 static bool s_notify;
651 static bool s_trayiconenabled;
652 static bool s_addnewfilespaused;
653 static bool s_addserversfromserver;
654 static bool s_addserversfromclient;
655 static uint16 s_maxsourceperfile;
656 static uint16 s_trafficOMeterInterval;
657 static uint16 s_statsInterval;
658 static uint32 s_maxGraphDownloadRate;
659 static uint32 s_maxGraphUploadRate;
660 static bool s_confirmExit;
663 static bool s_filterLanIP;
664 static bool s_paranoidfilter;
665 static bool s_onlineSig;
667 static wxString s_languageID;
668 static uint8 s_iSeeShares; // 0=everybody 1=friends only 2=noone
669 static uint8 s_iToolDelayTime; // tooltip delay time in seconds
670 static uint8 s_splitterbarPosition;
671 static uint16 s_deadserverretries;
672 static uint32 s_dwServerKeepAliveTimeoutMins;
674 static uint8 s_statsMax;
675 static uint8 s_statsAverageMinutes;
677 static bool s_bpreviewprio;
678 static bool s_smartidcheck;
679 static uint8 s_smartidstate;
680 static bool s_safeServerConnect;
681 static bool s_startMinimized;
682 static uint16 s_MaxConperFive;
683 static bool s_checkDiskspace;
684 static uint32 s_uMinFreeDiskSpace;
685 static wxString s_yourHostname;
686 static bool s_bVerbose;
687 static bool s_bVerboseLogfile;
688 static bool s_bmanualhighprio;
689 static bool s_bstartnextfile;
690 static bool s_bstartnextfilesame;
691 static bool s_bstartnextfilealpha;
692 static bool s_bshowoverhead;
693 static bool s_bDAP;
694 static bool s_bUAP;
696 #ifndef __SVN__
697 static bool s_showVersionOnTitle;
698 #endif
699 static uint8_t s_showRatesOnTitle; // 0=no, 1=after app name, 2=before app name
701 static wxString s_VideoPlayer;
702 static bool s_showAllNotCats;
704 static bool s_msgonlyfriends;
705 static bool s_msgsecure;
707 static uint8 s_iFileBufferSize;
708 static uint8 s_iQueueSize;
710 static wxString s_datetimeformat;
712 static bool s_ToolbarOrientation;
714 // Web Server [kuchin]
715 static wxString s_sWebPassword;
716 static wxString s_sWebPath;
717 static wxString s_sWebLowPassword;
718 static uint16 s_nWebPort;
719 static uint16 s_nWebUPnPTCPPort;
720 static bool s_bWebEnabled;
721 static bool s_bWebUseGzip;
722 static uint32 s_nWebPageRefresh;
723 static bool s_bWebLowEnabled;
724 static wxString s_WebTemplate;
726 static bool s_showCatTabInfos;
727 static AllCategoryFilter s_allcatFilter;
729 // Kry - external connections
730 static bool s_AcceptExternalConnections;
731 static wxString s_ECAddr;
732 static uint32 s_ECPort;
733 static wxString s_ECPassword;
734 static bool s_TransmitOnlyUploadingClients;
736 // Kry - IPFilter
737 static bool s_IPFilterClients;
738 static bool s_IPFilterServers;
739 static uint8 s_filterlevel;
740 static bool s_IPFilterAutoLoad;
741 static wxString s_IPFilterURL;
742 static bool s_IPFilterSys;
744 // Kry - Source seeds on/off
745 static bool s_UseSrcSeeds;
747 static bool s_ProgBar;
748 static bool s_Percent;
750 static bool s_SecIdent;
752 static bool s_ExtractMetaData;
754 static bool s_allocFullFile;
755 static bool s_createFilesSparse;
757 static wxString s_CustomBrowser;
758 static bool s_BrowserTab; // Jacobo221 - Open in tabs if possible
760 static CPath s_OSDirectory;
761 static uint16 s_OSUpdate;
763 static wxString s_Skin;
765 static bool s_FastED2KLinksHandler; // Madcat - Toggle Fast ED2K Links Handler
767 // Message Filtering
768 static bool s_MustFilterMessages;
769 static wxString s_MessageFilterString;
770 static bool s_FilterAllMessages;
771 static bool s_FilterSomeMessages;
772 static bool s_ShowMessagesInLog;
773 static bool s_IsAdvancedSpamfilterEnabled;
774 static bool s_IsChatCaptchaEnabled;
776 static bool s_FilterComments;
777 static wxString s_CommentFilterString;
780 // Hidden files sharing
781 static bool s_ShareHiddenFiles;
783 static bool s_AutoSortDownload;
785 // Version check
786 static bool s_NewVersionCheck;
788 // Kad
789 static bool s_ConnectToKad;
790 static bool s_ConnectToED2K;
792 // Statistics
793 static unsigned s_maxClientVersions; // 0 = unlimited
795 // Drop slow sources if needed
796 static bool s_DropSlowSources;
798 static wxString s_Ed2kURL;
799 static wxString s_KadURL;
801 // Crypt
802 static bool s_IsClientCryptLayerSupported;
803 static bool s_IsClientCryptLayerRequired;
804 static bool s_bCryptLayerRequested;
805 static uint32 s_dwKadUDPKey;
806 static uint8 s_byCryptTCPPaddingLength;
808 // GeoIP
809 static bool s_GeoIPEnabled;
810 static wxString s_GeoIPUpdateUrl;
812 // Sleep vetoing
813 static bool s_preventSleepWhileDownloading;
815 // Stats server
816 static wxString s_StatsServerName;
817 static wxString s_StatsServerURL;
821 #endif // PREFERENCES_H
822 // File_checked_for_headers