Updated Hungarian translation by GonoszTopi
[amule.git] / src / Preferences.h
blob0d92ab5ddef6e275382b34df168297d54a33f4bb
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 bool Score() { return s_scorsystem; }
201 static void SetScoreSystem(bool val) { s_scorsystem = val; }
202 static bool Reconnect() { return s_reconnect; }
203 static void SetReconnect(bool val) { s_reconnect = val; }
204 static bool DeadServer() { return s_deadserver; }
205 static void SetDeadServer(bool val) { s_deadserver = val; }
206 static const wxString& GetUserNick() { return s_nick; }
207 static void SetUserNick(const wxString& nick) { s_nick = nick; }
208 static Cfg_Lang_Base * GetCfgLang() { return s_cfgLang; }
210 static const wxString& GetAddress() { return s_Addr; }
211 static uint16 GetPort() { return s_port; }
212 static void SetPort(uint16 val);
213 static uint16 GetUDPPort() { return s_udpport; }
214 static uint16 GetEffectiveUDPPort() { return s_UDPEnable ? s_udpport : 0; }
215 static void SetUDPPort(uint16 val) { s_udpport = val; }
216 static bool IsUDPDisabled() { return !s_UDPEnable; }
217 static void SetUDPDisable(bool val) { s_UDPEnable = !val; }
218 static const CPath& GetIncomingDir() { return s_incomingdir; }
219 static void SetIncomingDir(const CPath& dir){ s_incomingdir = dir; }
220 static const CPath& GetTempDir() { return s_tempdir; }
221 static void SetTempDir(const CPath& dir) { s_tempdir = dir; }
222 static const CMD4Hash& GetUserHash() { return s_userhash; }
223 static void SetUserHash(const CMD4Hash& h) { s_userhash = h; }
224 static uint16 GetMaxUpload() { return s_maxupload; }
225 static uint16 GetSlotAllocation() { return s_slotallocation; }
226 static bool IsICHEnabled() { return s_ICH; }
227 static void SetICHEnabled(bool val) { s_ICH = val; }
228 static bool IsTrustingEveryHash() { return s_AICHTrustEveryHash; }
229 static void SetTrustingEveryHash(bool val) { s_AICHTrustEveryHash = val; }
230 static bool AutoServerlist() { return s_autoserverlist; }
231 static void SetAutoServerlist(bool val) { s_autoserverlist = val; }
232 static bool DoMinToTray() { return s_mintotray; }
233 static void SetMinToTray(bool val) { s_mintotray = val; }
234 static bool UseTrayIcon() { return s_trayiconenabled; }
235 static void SetUseTrayIcon(bool val) { s_trayiconenabled = val; }
236 static bool HideOnClose() { return s_hideonclose; }
237 static void SetHideOnClose(bool val) { s_hideonclose = val; }
238 static bool DoAutoConnect() { return s_autoconnect; }
239 static void SetAutoConnect(bool inautoconnect)
240 {s_autoconnect = inautoconnect; }
241 static bool AddServersFromServer() { return s_addserversfromserver; }
242 static void SetAddServersFromServer(bool val) { s_addserversfromserver = val; }
243 static bool AddServersFromClient() { return s_addserversfromclient; }
244 static void SetAddServersFromClient(bool val) { s_addserversfromclient = val; }
245 static uint16 GetTrafficOMeterInterval() { return s_trafficOMeterInterval; }
246 static void SetTrafficOMeterInterval(uint16 in)
247 { s_trafficOMeterInterval = in; }
248 static uint16 GetStatsInterval() { return s_statsInterval;}
249 static void SetStatsInterval(uint16 in) { s_statsInterval = in; }
250 static bool IsConfirmExitEnabled() { return s_confirmExit; }
251 static bool FilterLanIPs() { return s_filterLanIP; }
252 static void SetFilterLanIPs(bool val) { s_filterLanIP = val; }
253 static bool ParanoidFilter() { return s_paranoidfilter; }
254 static void SetParanoidFilter(bool val) { s_paranoidfilter = val; }
255 static bool IsOnlineSignatureEnabled() { return s_onlineSig; }
256 static void SetOnlineSignatureEnabled(bool val) { s_onlineSig = val; }
257 static uint32 GetMaxGraphUploadRate() { return s_maxGraphUploadRate; }
258 static uint32 GetMaxGraphDownloadRate() { return s_maxGraphDownloadRate; }
259 static void SetMaxGraphUploadRate(uint32 in){ s_maxGraphUploadRate=in; }
260 static void SetMaxGraphDownloadRate(uint32 in)
261 { s_maxGraphDownloadRate = in; }
263 static uint16 GetMaxDownload() { return s_maxdownload; }
264 static uint16 GetMaxConnections() { return s_maxconnections; }
265 static uint16 GetMaxSourcePerFile() { return s_maxsourceperfile; }
266 static uint16 GetMaxSourcePerFileSoft() {
267 uint16 temp = (uint16)(s_maxsourceperfile*0.9);
268 if( temp > 1000 ) return 1000;
269 return temp; }
270 static uint16 GetMaxSourcePerFileUDP() {
271 uint16 temp = (uint16)(s_maxsourceperfile*0.75);
272 if( temp > 100 ) return 100;
273 return temp; }
274 static uint16 GetDeadserverRetries() { return s_deadserverretries; }
275 static void SetDeadserverRetries(uint16 val) { s_deadserverretries = val; }
276 static uint32 GetServerKeepAliveTimeout() { return s_dwServerKeepAliveTimeoutMins*60000; }
277 static void SetServerKeepAliveTimeout(uint32 val) { s_dwServerKeepAliveTimeoutMins = val/60000; }
279 static const wxString& GetLanguageID() { return s_languageID; }
280 static void SetLanguageID(const wxString& new_id) { s_languageID = new_id; }
281 static uint8 CanSeeShares() { return s_iSeeShares; }
282 static void SetCanSeeShares(uint8 val) { s_iSeeShares = val; }
284 static uint8 GetStatsMax() { return s_statsMax; }
285 static bool UseFlatBar() { return (s_depth3D==0); }
286 static uint8 GetStatsAverageMinutes() { return s_statsAverageMinutes; }
287 static void SetStatsAverageMinutes(uint8 in){ s_statsAverageMinutes = in; }
289 static bool GetStartMinimized() { return s_startMinimized; }
290 static void SetStartMinimized(bool instartMinimized)
291 { s_startMinimized = instartMinimized;}
292 static bool GetSmartIdCheck() { return s_smartidcheck; }
293 static void SetSmartIdCheck( bool in_smartidcheck )
294 { s_smartidcheck = in_smartidcheck; }
295 static uint8 GetSmartIdState() { return s_smartidstate; }
296 static void SetSmartIdState( uint8 in_smartidstate )
297 { s_smartidstate = in_smartidstate; }
298 static bool GetVerbose() { return s_bVerbose; }
299 static void SetVerbose(bool val) { s_bVerbose = val; }
300 static bool GetPreviewPrio() { return s_bpreviewprio; }
301 static void SetPreviewPrio(bool in) { s_bpreviewprio = in; }
302 static bool StartNextFile() { return s_bstartnextfile; }
303 static bool StartNextFileSame() { return s_bstartnextfilesame; }
304 static bool StartNextFileAlpha() { return s_bstartnextfilealpha; }
305 static void SetStartNextFile(bool val) { s_bstartnextfile = val; }
306 static void SetStartNextFileSame(bool val) { s_bstartnextfilesame = val; }
307 static void SetStartNextFileAlpha(bool val) { s_bstartnextfilealpha = val; }
308 static bool ShowOverhead() { return s_bshowoverhead; }
309 static void SetNewAutoUp(bool m_bInUAP) { s_bUAP = m_bInUAP; }
310 static bool GetNewAutoUp() { return s_bUAP; }
311 static void SetNewAutoDown(bool m_bInDAP) { s_bDAP = m_bInDAP; }
312 static bool GetNewAutoDown() { return s_bDAP; }
314 static const wxString& GetVideoPlayer() { return s_VideoPlayer; }
316 static uint32 GetFileBufferSize() { return s_iFileBufferSize*15000; }
317 static void SetFileBufferSize(uint32 val) { s_iFileBufferSize = val/15000; }
318 static uint32 GetQueueSize() { return s_iQueueSize*100; }
319 static void SetQueueSize(uint32 val) { s_iQueueSize = val/100; }
321 static uint8 Get3DDepth() { return s_depth3D;}
322 static bool AddNewFilesPaused() { return s_addnewfilespaused; }
323 static void SetAddNewFilesPaused(bool val) { s_addnewfilespaused = val; }
325 static void SetMaxConsPerFive(int in) { s_MaxConperFive=in; }
327 static uint16 GetMaxConperFive() { return s_MaxConperFive; }
328 static uint16 GetDefaultMaxConperFive();
330 static bool IsSafeServerConnectEnabled() { return s_safeServerConnect; }
331 static void SetSafeServerConnectEnabled(bool val) { s_safeServerConnect = val; }
333 static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace; }
334 static void SetCheckDiskspaceEnabled(bool val) { s_checkDiskspace = val; }
335 static uint32 GetMinFreeDiskSpaceMB() { return s_uMinFreeDiskSpace; }
336 static uint64 GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace * 1048576ull; }
337 static void SetMinFreeDiskSpaceMB(uint32 val) { s_uMinFreeDiskSpace = val; }
339 static const wxString& GetYourHostname() { return s_yourHostname; }
340 static void SetYourHostname(const wxString& s) { s_yourHostname = s; }
342 static void SetMaxUpload(uint16 in);
343 static void SetMaxDownload(uint16 in);
344 static void SetSlotAllocation(uint16 in) { s_slotallocation = (in >= 1) ? in : 1; };
346 typedef std::vector<CPath> PathList;
347 PathList shareddir_list;
349 wxArrayString adresses_list;
351 static bool AutoConnectStaticOnly() { return s_autoconnectstaticonly; }
352 static void SetAutoConnectStaticOnly(bool val) { s_autoconnectstaticonly = val; }
353 static bool GetUPnPEnabled() { return s_UPnPEnabled; }
354 static void SetUPnPEnabled(bool val) { s_UPnPEnabled = val; }
355 static bool GetUPnPECEnabled() { return s_UPnPECEnabled; }
356 static void SetUPnPECEnabled(bool val) { s_UPnPECEnabled = val; }
357 static bool GetUPnPWebServerEnabled() { return s_UPnPWebServerEnabled; }
358 static void SetUPnPWebServerEnabled(bool val){ s_UPnPWebServerEnabled = val; }
359 static uint16 GetUPnPTCPPort() { return s_UPnPTCPPort; }
360 static void SetUPnPTCPPort(uint16 val) { s_UPnPTCPPort = val; }
361 static bool IsManualHighPrio() { return s_bmanualhighprio; }
362 static void SetManualHighPrio(bool val) { s_bmanualhighprio = val; }
363 void LoadCats();
364 static const wxString& GetDateTimeFormat() { return s_datetimeformat; }
365 // Download Categories
366 uint32 AddCat(Category_Struct* cat);
367 void RemoveCat(size_t index);
368 uint32 GetCatCount();
369 Category_Struct* GetCategory(size_t index);
370 const CPath& GetCatPath(uint8 index);
371 uint32 GetCatColor(size_t index);
372 bool CreateCategory(Category_Struct *& category, const wxString& name, const CPath& path,
373 const wxString& comment, uint32 color, uint8 prio);
374 bool UpdateCategory(uint8 cat, const wxString& name, const CPath& path,
375 const wxString& comment, uint32 color, uint8 prio);
377 static AllCategoryFilter GetAllcatFilter() { return s_allcatFilter; }
378 static void SetAllcatFilter(AllCategoryFilter in) { s_allcatFilter = in; }
380 static bool ShowAllNotCats() { return s_showAllNotCats; }
382 // WebServer
383 static uint16 GetWSPort() { return s_nWebPort; }
384 static void SetWSPort(uint16 uPort) { s_nWebPort=uPort; }
385 static uint16 GetWebUPnPTCPPort() { return s_nWebUPnPTCPPort; }
386 static void SetWebUPnPTCPPort(uint16 val) { s_nWebUPnPTCPPort = val; }
387 static const wxString& GetWSPass() { return s_sWebPassword; }
388 static void SetWSPass(const wxString& pass) { s_sWebPassword = pass; }
389 static const wxString& GetWSPath() { return s_sWebPath; }
390 static void SetWSPath(const wxString& path) { s_sWebPath = path; }
391 static bool GetWSIsEnabled() { return s_bWebEnabled; }
392 static void SetWSIsEnabled(bool bEnable) { s_bWebEnabled=bEnable; }
393 static bool GetWebUseGzip() { return s_bWebUseGzip; }
394 static void SetWebUseGzip(bool bUse) { s_bWebUseGzip=bUse; }
395 static uint32 GetWebPageRefresh() { return s_nWebPageRefresh; }
396 static void SetWebPageRefresh(uint32 nRefresh) { s_nWebPageRefresh=nRefresh; }
397 static bool GetWSIsLowUserEnabled() { return s_bWebLowEnabled; }
398 static void SetWSIsLowUserEnabled(bool in) { s_bWebLowEnabled=in; }
399 static const wxString& GetWSLowPass() { return s_sWebLowPassword; }
400 static void SetWSLowPass(const wxString& pass) { s_sWebLowPassword = pass; }
401 static const wxString& GetWebTemplate() { return s_WebTemplate; }
402 static void SetWebTemplate(const wxString& val) { s_WebTemplate = val; }
404 static void SetMaxSourcesPerFile(uint16 in) { s_maxsourceperfile=in;}
405 static void SetMaxConnections(uint16 in) { s_maxconnections =in;}
407 static bool ShowCatTabInfos() { return s_showCatTabInfos; }
408 static void ShowCatTabInfos(bool in) { s_showCatTabInfos=in; }
410 // Sources Dropping Tweaks
411 static bool DropNoNeededSources() { return s_NoNeededSources > 0; }
412 static bool SwapNoNeededSources() { return s_NoNeededSources == 2; }
413 static uint8 GetNoNeededSources() { return s_NoNeededSources; }
414 static void SetNoNeededSources(uint8 val) { s_NoNeededSources = val; }
415 static bool DropFullQueueSources() { return s_DropFullQueueSources; }
416 static void SetDropFullQueueSources(bool val) { s_DropFullQueueSources = val; }
417 static bool DropHighQueueRankingSources() { return s_DropHighQueueRankingSources; }
418 static void SetDropHighQueueRankingSources(bool val) { s_DropHighQueueRankingSources = val; }
419 static uint32 HighQueueRanking() { return s_HighQueueRanking; }
420 static void SetHighQueueRanking(uint32 val) { s_HighQueueRanking = val; }
421 static uint32 GetAutoDropTimer() { return s_AutoDropTimer; }
422 static void SetAutoDropTimer(uint32 val) { s_AutoDropTimer = val; }
424 // External Connections
425 static bool AcceptExternalConnections() { return s_AcceptExternalConnections; }
426 static void EnableExternalConnections( bool val ) { s_AcceptExternalConnections = val; }
427 static const wxString& GetECAddress() { return s_ECAddr; }
428 static uint32 ECPort() { return s_ECPort; }
429 static void SetECPort(uint32 val) { s_ECPort = val; }
430 static const wxString& ECPassword() { return s_ECPassword; }
431 static void SetECPass(const wxString& pass) { s_ECPassword = pass; }
432 static bool IsTransmitOnlyUploadingClients() { return s_TransmitOnlyUploadingClients; }
434 // Fast ED2K Links Handler Toggling
435 static bool GetFED2KLH() { return s_FastED2KLinksHandler; }
437 // Ip filter
438 static bool IsFilteringClients() { return s_IPFilterClients; }
439 static void SetFilteringClients(bool val);
440 static bool IsFilteringServers() { return s_IPFilterServers; }
441 static void SetFilteringServers(bool val);
442 static uint8 GetIPFilterLevel() { return s_filterlevel;}
443 static void SetIPFilterLevel(uint8 level);
444 static bool IPFilterAutoLoad() { return s_IPFilterAutoLoad; }
445 static void SetIPFilterAutoLoad(bool val) { s_IPFilterAutoLoad = val; }
446 static const wxString& IPFilterURL() { return s_IPFilterURL; }
447 static void SetIPFilterURL(const wxString& url) { s_IPFilterURL = url; }
448 static bool UseIPFilterSystem() { return s_IPFilterSys; }
449 static void SetIPFilterSystem(bool val) { s_IPFilterSys = val; }
451 // Source seeds On/Off
452 static bool GetSrcSeedsOn() { return s_UseSrcSeeds; }
453 static void SetSrcSeedsOn(bool val) { s_UseSrcSeeds = val; }
455 static bool IsSecureIdentEnabled() { return s_SecIdent; }
456 static void SetSecureIdentEnabled(bool val) { s_SecIdent = val; }
458 static bool GetExtractMetaData() { return s_ExtractMetaData; }
459 static void SetExtractMetaData(bool val) { s_ExtractMetaData = val; }
461 static bool ShowProgBar() { return s_ProgBar; }
462 static bool ShowPercent() { return s_Percent; }
464 static bool GetAllocFullFile() { return s_allocFullFile; };
465 static void SetAllocFullFile(bool val) { s_allocFullFile = val; }
467 static wxString GetBrowser();
469 static const wxString& GetSkin() { return s_Skin; }
471 static bool VerticalToolbar() { return s_ToolbarOrientation; }
473 static const CPath& GetOSDir() { return s_OSDirectory; }
474 static uint16 GetOSUpdate() { return s_OSUpdate; }
476 static uint8 GetToolTipDelay() { return s_iToolDelayTime; }
478 static void UnsetAutoServerStart();
479 static void CheckUlDlRatio();
481 static void BuildItemList( const wxString& appdir );
482 static void EraseItemList();
484 static void LoadAllItems(wxConfigBase* cfg);
485 static void SaveAllItems(wxConfigBase* cfg);
487 #ifndef __SVN__
488 static bool ShowVersionOnTitle() { return s_showVersionOnTitle; }
489 #else
490 static bool ShowVersionOnTitle() { return true; }
491 #endif
492 static uint8_t GetShowRatesOnTitle() { return s_showRatesOnTitle; }
493 static void SetShowRatesOnTitle(uint8_t val) { s_showRatesOnTitle = val; }
495 // Message Filters
497 static bool MustFilterMessages() { return s_MustFilterMessages; }
498 static void SetMustFilterMessages(bool val) { s_MustFilterMessages = val; }
499 static bool IsFilterAllMessages() { return s_FilterAllMessages; }
500 static void SetFilterAllMessages(bool val) { s_FilterAllMessages = val; }
501 static bool MsgOnlyFriends() { return s_msgonlyfriends;}
502 static void SetMsgOnlyFriends(bool val) { s_msgonlyfriends = val; }
503 static bool MsgOnlySecure() { return s_msgsecure;}
504 static void SetMsgOnlySecure(bool val) { s_msgsecure = val; }
505 static bool IsFilterByKeywords() { return s_FilterSomeMessages; }
506 static void SetFilterByKeywords(bool val) { s_FilterSomeMessages = val; }
507 static const wxString& GetMessageFilterString() { return s_MessageFilterString; }
508 static void SetMessageFilterString(const wxString& val) { s_MessageFilterString = val; }
509 static bool IsMessageFiltered(const wxString& message);
510 static bool ShowMessagesInLog() { return s_ShowMessagesInLog; }
511 static bool IsAdvancedSpamfilterEnabled() { return s_IsAdvancedSpamfilterEnabled;}
512 static bool IsChatCaptchaEnabled() { return IsAdvancedSpamfilterEnabled() && s_IsChatCaptchaEnabled; }
514 static bool FilterComments() { return s_FilterComments; }
515 static void SetFilterComments(bool val) { s_FilterComments = val; }
516 static const wxString& GetCommentFilterString() { return s_CommentFilterString; }
517 static void SetCommentFilterString(const wxString& val) { s_CommentFilterString = val; }
518 static bool IsCommentFiltered(const wxString& comment);
520 // Can't have it return a reference, will need a pointer later.
521 static const CProxyData *GetProxyData() { return &s_ProxyData; }
523 // Hidden files
525 static bool ShareHiddenFiles() { return s_ShareHiddenFiles; }
526 static void SetShareHiddenFiles(bool val) { s_ShareHiddenFiles = val; }
528 static bool AutoSortDownload() { return s_AutoSortDownload; }
529 static bool AutoSortDownload(bool val) { bool tmp = s_AutoSortDownload; s_AutoSortDownload = val; return tmp; }
531 // Version check
533 static bool GetCheckNewVersion() { return s_NewVersionCheck; }
534 static void SetCheckNewVersion(bool val) { s_NewVersionCheck = val; }
536 // Networks
537 static bool GetNetworkKademlia() { return s_ConnectToKad; }
538 static void SetNetworkKademlia(bool val) { s_ConnectToKad = val; }
539 static bool GetNetworkED2K() { return s_ConnectToED2K; }
540 static void SetNetworkED2K(bool val) { s_ConnectToED2K = val; }
542 // Statistics
543 static unsigned GetMaxClientVersions() { return s_maxClientVersions; }
545 // Dropping slow sources
546 static bool GetDropSlowSources() { return s_DropSlowSources; }
548 // server.met and nodes.dat urls
549 static const wxString& GetKadNodesUrl() { return s_KadURL; }
550 static void SetKadNodesUrl(const wxString& url) { s_KadURL = url; }
552 static const wxString& GetEd2kServersUrl() { return s_Ed2kURL; }
553 static void SetEd2kServersUrl(const wxString& url) { s_Ed2kURL = url; }
555 // Crypt
556 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported;}
557 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested;}
558 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired;}
559 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
560 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
561 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
562 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
563 static uint32 GetKadUDPKey() {return s_dwKadUDPKey;}
564 static uint8 GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength;}
566 static void SetClientCryptLayerSupported(bool v) {s_IsClientCryptLayerSupported = v;}
567 static void SetClientCryptLayerRequested(bool v) {s_bCryptLayerRequested = v; }
568 static void SetClientCryptLayerRequired(bool v) {s_IsClientCryptLayerRequired = v;}
570 // GeoIP
571 static bool IsGeoIPEnabled() {return s_GeoIPEnabled;}
572 static void SetGeoIPEnabled(bool v) {s_GeoIPEnabled = v;}
573 static const wxString& GetGeoIPUpdateUrl() {return s_GeoIPUpdateUrl;}
575 // Stats server
576 static const wxString& GetStatsServerName() {return s_StatsServerName;}
577 static const wxString& GetStatsServerURL() {return s_StatsServerURL;}
579 // HTTP download
580 static wxString GetLastHTTPDownloadURL(uint8 t);
581 static void SetLastHTTPDownloadURL(uint8 t, const wxString& val);
583 // Sleep
584 static bool GetPreventSleepWhileDownloading() { return s_preventSleepWhileDownloading; }
585 static void SetPreventSleepWhileDownloading(bool status) { s_preventSleepWhileDownloading = status; }
586 protected:
587 static int32 GetRecommendedMaxConnections();
589 //! Temporary storage for statistic-colors.
590 static unsigned long s_colors[cntStatColors];
591 //! Reference for checking if the colors has changed.
592 static unsigned long s_colors_ref[cntStatColors];
594 typedef std::vector<Cfg_Base*> CFGList;
595 typedef std::map<int, Cfg_Base*> CFGMap;
596 typedef std::vector<Category_Struct*> CatList;
599 static CFGMap s_CfgList;
600 static CFGList s_MiscList;
601 CatList m_CatList;
603 private:
604 void LoadPreferences();
605 void SavePreferences();
607 protected:
608 ////////////// USER
609 static wxString s_nick;
611 static CMD4Hash s_userhash;
613 static Cfg_Lang_Base * s_cfgLang;
615 ////////////// CONNECTION
616 static uint16 s_maxupload;
617 static uint16 s_maxdownload;
618 static uint16 s_slotallocation;
619 static wxString s_Addr;
620 static uint16 s_port;
621 static uint16 s_udpport;
622 static bool s_UDPEnable;
623 static uint16 s_maxconnections;
624 static bool s_reconnect;
625 static bool s_autoconnect;
626 static bool s_autoconnectstaticonly;
627 static bool s_UPnPEnabled;
628 static bool s_UPnPECEnabled;
629 static bool s_UPnPWebServerEnabled;
630 static uint16 s_UPnPTCPPort;
632 ////////////// PROXY
633 static CProxyData s_ProxyData;
635 ////////////// SERVERS
636 static bool s_autoserverlist;
637 static bool s_deadserver;
639 ////////////// FILES
640 static CPath s_incomingdir;
641 static CPath s_tempdir;
642 static bool s_ICH;
643 static bool s_AICHTrustEveryHash;
645 ////////////// GUI
646 static uint8 s_depth3D;
648 static bool s_scorsystem;
649 static bool s_hideonclose;
650 static bool s_mintotray;
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_bmanualhighprio;
688 static bool s_bstartnextfile;
689 static bool s_bstartnextfilesame;
690 static bool s_bstartnextfilealpha;
691 static bool s_bshowoverhead;
692 static bool s_bDAP;
693 static bool s_bUAP;
695 #ifndef __SVN__
696 static bool s_showVersionOnTitle;
697 #endif
698 static uint8_t s_showRatesOnTitle; // 0=no, 1=after app name, 2=before app name
700 static wxString s_VideoPlayer;
701 static bool s_showAllNotCats;
703 static bool s_msgonlyfriends;
704 static bool s_msgsecure;
706 static uint8 s_iFileBufferSize;
707 static uint8 s_iQueueSize;
709 static wxString s_datetimeformat;
711 static bool s_ToolbarOrientation;
713 // Web Server [kuchin]
714 static wxString s_sWebPassword;
715 static wxString s_sWebPath;
716 static wxString s_sWebLowPassword;
717 static uint16 s_nWebPort;
718 static uint16 s_nWebUPnPTCPPort;
719 static bool s_bWebEnabled;
720 static bool s_bWebUseGzip;
721 static uint32 s_nWebPageRefresh;
722 static bool s_bWebLowEnabled;
723 static wxString s_WebTemplate;
725 static bool s_showCatTabInfos;
726 static AllCategoryFilter s_allcatFilter;
728 // Madcat - Sources Dropping Tweaks
729 static uint8 s_NoNeededSources; // 0: Keep, 1: Drop, 2:Swap
730 static bool s_DropFullQueueSources;
731 static bool s_DropHighQueueRankingSources;
732 static uint32 s_HighQueueRanking;
733 static uint32 s_AutoDropTimer;
735 // Kry - external connections
736 static bool s_AcceptExternalConnections;
737 static wxString s_ECAddr;
738 static uint32 s_ECPort;
739 static wxString s_ECPassword;
740 static bool s_TransmitOnlyUploadingClients;
742 // Kry - IPFilter
743 static bool s_IPFilterClients;
744 static bool s_IPFilterServers;
745 static uint8 s_filterlevel;
746 static bool s_IPFilterAutoLoad;
747 static wxString s_IPFilterURL;
748 static bool s_IPFilterSys;
750 // Kry - Source seeds on/off
751 static bool s_UseSrcSeeds;
753 static bool s_ProgBar;
754 static bool s_Percent;
756 static bool s_SecIdent;
758 static bool s_ExtractMetaData;
760 static bool s_allocFullFile;
762 static wxString s_CustomBrowser;
763 static bool s_BrowserTab; // Jacobo221 - Open in tabs if possible
765 static CPath s_OSDirectory;
766 static uint16 s_OSUpdate;
768 static wxString s_Skin;
770 static bool s_FastED2KLinksHandler; // Madcat - Toggle Fast ED2K Links Handler
772 // Message Filtering
773 static bool s_MustFilterMessages;
774 static wxString s_MessageFilterString;
775 static bool s_FilterAllMessages;
776 static bool s_FilterSomeMessages;
777 static bool s_ShowMessagesInLog;
778 static bool s_IsAdvancedSpamfilterEnabled;
779 static bool s_IsChatCaptchaEnabled;
781 static bool s_FilterComments;
782 static wxString s_CommentFilterString;
785 // Hidden files sharing
786 static bool s_ShareHiddenFiles;
788 static bool s_AutoSortDownload;
790 // Version check
791 static bool s_NewVersionCheck;
793 // Kad
794 static bool s_ConnectToKad;
795 static bool s_ConnectToED2K;
797 // Statistics
798 static unsigned s_maxClientVersions; // 0 = unlimited
800 // Drop slow sources if needed
801 static bool s_DropSlowSources;
803 static wxString s_Ed2kURL;
804 static wxString s_KadURL;
806 // Crypt
807 static bool s_IsClientCryptLayerSupported;
808 static bool s_IsClientCryptLayerRequired;
809 static bool s_bCryptLayerRequested;
810 static uint32 s_dwKadUDPKey;
811 static uint8 s_byCryptTCPPaddingLength;
813 // GeoIP
814 static bool s_GeoIPEnabled;
815 static wxString s_GeoIPUpdateUrl;
817 // Sleep vetoing
818 static bool s_preventSleepWhileDownloading;
820 // Stats server
821 static wxString s_StatsServerName;
822 static wxString s_StatsServerURL;
826 #endif // PREFERENCES_H
827 // File_checked_for_headers