Add code to resume next file alphabetically, keeping in mind categories and priority.
[amule.git] / src / Preferences.h
blob8176934168dbae5dc1d767b2738c93899ece3ffb
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2008 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #ifndef PREFERENCES_H
27 #define PREFERENCES_H
29 #include "MD4Hash.h" // Needed for CMD4Hash
31 #include <wx/arrstr.h> // Needed for wxArrayString
33 #include <map>
35 #include "Proxy.h"
36 #include "OtherStructs.h"
38 class CPreferences;
39 class wxConfigBase;
40 class wxWindow;
42 enum EViewSharedFilesAccess {
43 vsfaEverybody = 0,
44 vsfaFriends = 1,
45 vsfaNobody = 2
48 enum AllCategoryFilter {
49 acfAll = 0,
50 acfAllOthers,
51 acfIncomplete,
52 acfCompleted,
53 acfWaiting,
54 acfDownloading,
55 acfErroneous,
56 acfPaused,
57 acfStopped,
58 acfVideo,
59 acfAudio,
60 acfArchive,
61 acfCDImages,
62 acfPictures,
63 acfText,
64 acfActive
67 /**
68 * Base-class for automatically loading and saving of preferences.
70 * The purpose of this class is to perform two tasks:
71 * 1) To load and save a variable using wxConfig
72 * 2) If nescecarry, to syncronize it with a widget
74 * This pure-virtual class servers as the base of all the Cfg types
75 * defined below, and exposes the entire interface.
77 * Please note that for reasons of simplicity these classes dont provide
78 * direct access to the variables they maintain, as there is no real need
79 * for this.
81 * To create a sub-class you need only provide the Load/Save functionality,
82 * as it is given that not all variables have a widget assosiated.
84 class Cfg_Base
86 public:
87 /**
88 * Constructor.
90 * @param keyname This is the keyname under which the variable is to be saved.
92 Cfg_Base( const wxString& keyname )
93 : m_key( keyname ),
94 m_changed( false )
97 /**
98 * Destructor.
100 virtual ~Cfg_Base() {}
103 * This function loads the assosiated variable from the provided config object.
105 virtual void LoadFromFile(wxConfigBase* cfg) = 0;
107 * This function saves the assosiated variable to the provided config object.
109 virtual void SaveToFile(wxConfigBase* cfg) = 0;
112 * Syncs the variable with the contents of the widget.
114 * @return True of success, false otherwise.
116 virtual bool TransferFromWindow() { return false; }
118 * Syncs the widget with the contents of the variable.
120 * @return True of success, false otherwise.
122 virtual bool TransferToWindow() { return false; }
125 * Connects a widget with the specified ID to the Cfg object.
127 * @param id The ID of the widget.
128 * @param parent A pointer to the widgets parent, to speed up searches.
129 * @return True on success, false otherwise.
131 * This function only makes sense for Cfg-classes that have the capability
132 * to interact with a widget, see Cfg_Tmpl::ConnectToWidget().
134 virtual bool ConnectToWidget( int WXUNUSED(id), wxWindow* WXUNUSED(parent) = NULL ) { return false; }
137 * Gets the key assosiated with Cfg object.
139 * @return The config-key of this object.
141 virtual const wxString& GetKey() { return m_key; }
145 * Specifies if the variable has changed since the TransferFromWindow() call.
147 * @return True if the variable has changed, false otherwise.
149 virtual bool HasChanged() { return m_changed; }
152 protected:
154 * Sets the changed status.
156 * @param changed The new status.
158 virtual void SetChanged( bool changed )
160 m_changed = changed;
163 private:
165 //! The Config-key under which to save the variable
166 wxString m_key;
168 //! The changed-status of the variable
169 bool m_changed;
173 class Cfg_Lang_Base {
174 public:
175 virtual void UpdateChoice(int pos);
178 const int cntStatColors = 15;
181 //! This typedef is a shortcut similar to the theApp shortcut, but uses :: instead of .
182 //! It only allows access to static preference functions, however this is to be desired anyway.
183 typedef CPreferences thePrefs;
186 class CPreferences
188 public:
189 friend class PrefsUnifiedDlg;
191 CPreferences();
192 ~CPreferences();
194 void Save();
195 void SaveCats();
196 void ReloadSharedFolders();
198 static bool Score() { return s_scorsystem; }
199 static void SetScoreSystem(bool val) { s_scorsystem = val; }
200 static bool Reconnect() { return s_reconnect; }
201 static void SetReconnect(bool val) { s_reconnect = val; }
202 static bool DeadServer() { return s_deadserver; }
203 static void SetDeadServer(bool val) { s_deadserver = val; }
204 static const wxString& GetUserNick() { return s_nick; }
205 static void SetUserNick(const wxString& nick) { s_nick = nick; }
206 static Cfg_Lang_Base * GetCfgLang() { return s_cfgLang; }
208 static const wxString& GetAddress() { return s_Addr; }
209 static uint16 GetPort() { return s_port; }
210 static void SetPort(uint16 val);
211 static uint16 GetUDPPort() { return s_udpport; }
212 static uint16 GetEffectiveUDPPort() { return s_UDPEnable ? s_udpport : 0; }
213 static void SetUDPPort(uint16 val) { s_udpport = val; }
214 static bool IsUDPDisabled() { return !s_UDPEnable; }
215 static void SetUDPDisable(bool val) { s_UDPEnable = !val; }
216 static const CPath& GetIncomingDir() { return s_incomingdir; }
217 static void SetIncomingDir(const CPath& dir){ s_incomingdir = dir; }
218 static const CPath& GetTempDir() { return s_tempdir; }
219 static void SetTempDir(const CPath& dir) { s_tempdir = dir; }
220 static const CMD4Hash& GetUserHash() { return s_userhash; }
221 static void SetUserHash(const CMD4Hash& h) { s_userhash = h; }
222 static uint16 GetMaxUpload() { return s_maxupload; }
223 static uint16 GetSlotAllocation() { return s_slotallocation; }
224 static bool IsICHEnabled() { return s_ICH; }
225 static void SetICHEnabled(bool val) { s_ICH = val; }
226 static bool IsTrustingEveryHash() { return s_AICHTrustEveryHash; }
227 static void SetTrustingEveryHash(bool val) { s_AICHTrustEveryHash = val; }
228 static bool AutoServerlist() { return s_autoserverlist; }
229 static void SetAutoServerlist(bool val) { s_autoserverlist = val; }
230 static bool DoMinToTray() { return s_mintotray; }
231 static void SetMinToTray(bool val) { s_mintotray = val; }
232 static bool UseTrayIcon() { return s_trayiconenabled; }
233 static void SetUseTrayIcon(bool val) { s_trayiconenabled = val; }
234 static bool DoAutoConnect() { return s_autoconnect; }
235 static void SetAutoConnect(bool inautoconnect)
236 {s_autoconnect = inautoconnect; }
237 static bool AddServersFromServer() { return s_addserversfromserver; }
238 static void SetAddServersFromServer(bool val) { s_addserversfromserver = val; }
239 static bool AddServersFromClient() { return s_addserversfromclient; }
240 static void SetAddServersFromClient(bool val) { s_addserversfromclient = val; }
241 static uint16 GetTrafficOMeterInterval() { return s_trafficOMeterInterval; }
242 static void SetTrafficOMeterInterval(uint16 in)
243 { s_trafficOMeterInterval = in; }
244 static uint16 GetStatsInterval() { return s_statsInterval;}
245 static void SetStatsInterval(uint16 in) { s_statsInterval = in; }
246 static void Add2TotalDownloaded(uint64 in) { s_totalDownloadedBytes += in; }
247 static void Add2TotalUploaded(uint64 in) { s_totalUploadedBytes += in; }
248 static uint64 GetTotalDownloaded() { return s_totalDownloadedBytes; }
249 static uint64 GetTotalUploaded() { return s_totalUploadedBytes; }
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 // Fast ED2K Links Handler Toggling
433 static bool GetFED2KLH() { return s_FastED2KLinksHandler; }
435 // Ip filter
436 static bool IsFilteringClients() { return s_IPFilterClients; }
437 static void SetFilteringClients(bool val);
438 static bool IsFilteringServers() { return s_IPFilterServers; }
439 static void SetFilteringServers(bool val);
440 static uint8 GetIPFilterLevel() { return s_filterlevel;}
441 static void SetIPFilterLevel(uint8 level);
442 static bool IPFilterAutoLoad() { return s_IPFilterAutoLoad; }
443 static void SetIPFilterAutoLoad(bool val) { s_IPFilterAutoLoad = val; }
444 static const wxString& IPFilterURL() { return s_IPFilterURL; }
445 static void SetIPFilterURL(const wxString& url) { s_IPFilterURL = url; }
446 static bool UseIPFilterSystem() { return s_IPFilterSys; }
447 static void SetIPFilterSystem(bool val) { s_IPFilterSys = val; }
449 // Source seeds On/Off
450 static bool GetSrcSeedsOn() { return s_UseSrcSeeds; }
451 static void SetSrcSeedsOn(bool val) { s_UseSrcSeeds = val; }
453 static bool IsSecureIdentEnabled() { return s_SecIdent; }
454 static void SetSecureIdentEnabled(bool val) { s_SecIdent = val; }
456 static bool GetExtractMetaData() { return s_ExtractMetaData; }
457 static void SetExtractMetaData(bool val) { s_ExtractMetaData = val; }
459 static bool ShowProgBar() { return s_ProgBar; }
460 static bool ShowPercent() { return s_Percent; }
462 static bool GetAllocFullFile() { return s_allocFullFile; };
463 static void SetAllocFullFile(bool val) { s_allocFullFile = val; }
465 static wxString GetBrowser();
467 static const wxString& GetSkin() { return s_Skin; }
469 static bool VerticalToolbar() { return s_ToolbarOrientation; }
471 static const CPath& GetOSDir() { return s_OSDirectory; }
472 static uint16 GetOSUpdate() { return s_OSUpdate; }
474 static uint8 GetToolTipDelay() { return s_iToolDelayTime; }
476 static void UnsetAutoServerStart();
477 static void CheckUlDlRatio();
479 static void BuildItemList( const wxString& appdir );
480 static void EraseItemList();
482 static void LoadAllItems(wxConfigBase* cfg);
483 static void SaveAllItems(wxConfigBase* cfg);
485 static uint8_t GetShowRatesOnTitle() { return s_showRatesOnTitle; }
486 static void SetShowRatesOnTitle(uint8_t val) { s_showRatesOnTitle = val; }
488 // Message Filters
490 static bool MustFilterMessages() { return s_MustFilterMessages; }
491 static void SetMustFilterMessages(bool val) { s_MustFilterMessages = val; }
492 static bool IsFilterAllMessages() { return s_FilterAllMessages; }
493 static void SetFilterAllMessages(bool val) { s_FilterAllMessages = val; }
494 static bool MsgOnlyFriends() { return s_msgonlyfriends;}
495 static void SetMsgOnlyFriends(bool val) { s_msgonlyfriends = val; }
496 static bool MsgOnlySecure() { return s_msgsecure;}
497 static void SetMsgOnlySecure(bool val) { s_msgsecure = val; }
498 static bool IsFilterByKeywords() { return s_FilterSomeMessages; }
499 static void SetFilterByKeywords(bool val) { s_FilterSomeMessages = val; }
500 static const wxString& GetMessageFilterString() { return s_MessageFilterString; }
501 static void SetMessageFilterString(const wxString& val) { s_MessageFilterString = val; }
502 static bool IsMessageFiltered(const wxString& message);
503 static bool ShowMessagesInLog() { return s_ShowMessagesInLog; }
504 static bool IsAdvancedSpamfilterEnabled() { return s_IsAdvancedSpamfilterEnabled;}
505 static bool IsChatCaptchaEnabled() { return IsAdvancedSpamfilterEnabled() && s_IsChatCaptchaEnabled; }
507 static bool FilterComments() { return s_FilterComments; }
508 static void SetFilterComments(bool val) { s_FilterComments = val; }
509 static const wxString& GetCommentFilterString() { return s_CommentFilterString; }
510 static void SetCommentFilterString(const wxString& val) { s_CommentFilterString = val; }
511 static bool IsCommentFiltered(const wxString& comment);
513 // Can't have it return a reference, will need a pointer later.
514 static const CProxyData *GetProxyData() { return &s_ProxyData; }
516 // Hidden files
518 static bool ShareHiddenFiles() { return s_ShareHiddenFiles; }
519 static void SetShareHiddenFiles(bool val) { s_ShareHiddenFiles = val; }
521 static bool AutoSortDownload() { return s_AutoSortDownload; }
522 static bool AutoSortDownload(bool val) { bool tmp = s_AutoSortDownload; s_AutoSortDownload = val; return tmp; }
524 // Version check
526 static bool GetCheckNewVersion() { return s_NewVersionCheck; }
527 static void SetCheckNewVersion(bool val) { s_NewVersionCheck = val; }
529 // Networks
530 static bool GetNetworkKademlia() { return s_ConnectToKad; }
531 static void SetNetworkKademlia(bool val) { s_ConnectToKad = val; }
532 static bool GetNetworkED2K() { return s_ConnectToED2K; }
533 static void SetNetworkED2K(bool val) { s_ConnectToED2K = val; }
535 // Statistics
536 static unsigned GetMaxClientVersions() { return s_maxClientVersions; }
538 // Dropping slow sources
539 static bool GetDropSlowSources() { return s_DropSlowSources; }
541 // server.met and nodes.dat urls
542 static const wxString& GetKadNodesUrl() { return s_KadURL; }
543 static void SetKadNodesUrl(const wxString& url) { s_KadURL = url; }
545 static const wxString& GetEd2kServersUrl() { return s_Ed2kURL; }
546 static void SetEd2kServersUrl(const wxString& url) { s_Ed2kURL = url; }
548 // Crypt
549 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported;}
550 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested;}
551 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired;}
552 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
553 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
554 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
555 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
556 static uint32 GetKadUDPKey() {return s_dwKadUDPKey;}
557 static uint8 GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength;}
559 static void SetClientCryptLayerSupported(bool v) {s_IsClientCryptLayerSupported = v;}
560 static void SetClientCryptLayerRequested(bool v) {s_bCryptLayerRequested = v; }
561 static void SetClientCryptLayerRequired(bool v) {s_IsClientCryptLayerRequired = v;}
563 // GeoIP
564 static bool IsGeoIPEnabled() {return s_GeoIPEnabled;}
565 static void SetGeoIPEnabled(bool v) {s_GeoIPEnabled = v;}
566 static const wxString& GetGeoIPUpdateUrl() {return s_GeoIPUpdateUrl;}
568 // HTTP download
569 static wxString GetLastHTTPDownloadURL(uint8 t);
570 static void SetLastHTTPDownloadURL(uint8 t, const wxString& val);
572 protected:
573 static int32 GetRecommendedMaxConnections();
575 //! Temporary storage for statistic-colors.
576 static unsigned long s_colors[cntStatColors];
577 //! Reference for checking if the colors has changed.
578 static unsigned long s_colors_ref[cntStatColors];
580 typedef std::vector<Cfg_Base*> CFGList;
581 typedef std::map<int, Cfg_Base*> CFGMap;
582 typedef std::vector<Category_Struct*> CatList;
585 static CFGMap s_CfgList;
586 static CFGList s_MiscList;
587 CatList m_CatList;
589 private:
590 void LoadPreferences();
591 void SavePreferences();
593 protected:
594 ////////////// USER
595 static wxString s_nick;
597 static CMD4Hash s_userhash;
599 static Cfg_Lang_Base * s_cfgLang;
601 ////////////// CONNECTION
602 static uint16 s_maxupload;
603 static uint16 s_maxdownload;
604 static uint16 s_slotallocation;
605 static wxString s_Addr;
606 static uint16 s_port;
607 static uint16 s_udpport;
608 static bool s_UDPEnable;
609 static uint16 s_maxconnections;
610 static bool s_reconnect;
611 static bool s_autoconnect;
612 static bool s_autoconnectstaticonly;
613 static bool s_UPnPEnabled;
614 static bool s_UPnPECEnabled;
615 static bool s_UPnPWebServerEnabled;
616 static uint16 s_UPnPTCPPort;
618 ////////////// PROXY
619 static CProxyData s_ProxyData;
621 ////////////// SERVERS
622 static bool s_autoserverlist;
623 static bool s_deadserver;
625 ////////////// FILES
626 static CPath s_incomingdir;
627 static CPath s_tempdir;
628 static bool s_ICH;
629 static bool s_AICHTrustEveryHash;
631 ////////////// GUI
632 static uint8 s_depth3D;
634 static bool s_scorsystem;
635 static bool s_mintotray;
636 static bool s_trayiconenabled;
637 static bool s_addnewfilespaused;
638 static bool s_addserversfromserver;
639 static bool s_addserversfromclient;
640 static uint16 s_maxsourceperfile;
641 static uint16 s_trafficOMeterInterval;
642 static uint16 s_statsInterval;
643 static uint32 s_maxGraphDownloadRate;
644 static uint32 s_maxGraphUploadRate;
645 static bool s_confirmExit;
648 static bool s_filterLanIP;
649 static bool s_paranoidfilter;
650 static bool s_onlineSig;
652 static uint64 s_totalDownloadedBytes;
653 static uint64 s_totalUploadedBytes;
654 static wxString s_languageID;
655 static uint8 s_iSeeShares; // 0=everybody 1=friends only 2=noone
656 static uint8 s_iToolDelayTime; // tooltip delay time in seconds
657 static uint8 s_splitterbarPosition;
658 static uint16 s_deadserverretries;
659 static uint32 s_dwServerKeepAliveTimeoutMins;
661 static uint8 s_statsMax;
662 static uint8 s_statsAverageMinutes;
664 static bool s_bpreviewprio;
665 static bool s_smartidcheck;
666 static uint8 s_smartidstate;
667 static bool s_safeServerConnect;
668 static bool s_startMinimized;
669 static uint16 s_MaxConperFive;
670 static bool s_checkDiskspace;
671 static uint32 s_uMinFreeDiskSpace;
672 static wxString s_yourHostname;
673 static bool s_bVerbose;
674 static bool s_bmanualhighprio;
675 static bool s_bstartnextfile;
676 static bool s_bstartnextfilesame;
677 static bool s_bstartnextfilealpha;
678 static bool s_bshowoverhead;
679 static bool s_bDAP;
680 static bool s_bUAP;
682 static uint8_t s_showRatesOnTitle; // 0=no, 1=after app name, 2=before app name
684 static wxString s_VideoPlayer;
685 static bool s_showAllNotCats;
687 static bool s_msgonlyfriends;
688 static bool s_msgsecure;
690 static uint8 s_iFileBufferSize;
691 static uint8 s_iQueueSize;
693 static wxString s_datetimeformat;
695 static bool s_ToolbarOrientation;
697 // Web Server [kuchin]
698 static wxString s_sWebPassword;
699 static wxString s_sWebPath;
700 static wxString s_sWebLowPassword;
701 static uint16 s_nWebPort;
702 static uint16 s_nWebUPnPTCPPort;
703 static bool s_bWebEnabled;
704 static bool s_bWebUseGzip;
705 static uint32 s_nWebPageRefresh;
706 static bool s_bWebLowEnabled;
707 static wxString s_WebTemplate;
709 static bool s_showCatTabInfos;
710 static AllCategoryFilter s_allcatFilter;
712 // Madcat - Sources Dropping Tweaks
713 static uint8 s_NoNeededSources; // 0: Keep, 1: Drop, 2:Swap
714 static bool s_DropFullQueueSources;
715 static bool s_DropHighQueueRankingSources;
716 static uint32 s_HighQueueRanking;
717 static uint32 s_AutoDropTimer;
719 // Kry - external connections
720 static bool s_AcceptExternalConnections;
721 static wxString s_ECAddr;
722 static uint32 s_ECPort;
723 static wxString s_ECPassword;
725 // Kry - IPFilter
726 static bool s_IPFilterClients;
727 static bool s_IPFilterServers;
728 static uint8 s_filterlevel;
729 static bool s_IPFilterAutoLoad;
730 static wxString s_IPFilterURL;
731 static bool s_IPFilterSys;
733 // Kry - Source seeds on/off
734 static bool s_UseSrcSeeds;
736 static bool s_ProgBar;
737 static bool s_Percent;
739 static bool s_SecIdent;
741 static bool s_ExtractMetaData;
743 static bool s_allocFullFile;
745 static wxString s_CustomBrowser;
746 static bool s_BrowserTab; // Jacobo221 - Open in tabs if possible
748 static CPath s_OSDirectory;
749 static uint16 s_OSUpdate;
751 static wxString s_Skin;
753 static bool s_FastED2KLinksHandler; // Madcat - Toggle Fast ED2K Links Handler
755 // Message Filtering
756 static bool s_MustFilterMessages;
757 static wxString s_MessageFilterString;
758 static bool s_FilterAllMessages;
759 static bool s_FilterSomeMessages;
760 static bool s_ShowMessagesInLog;
761 static bool s_IsAdvancedSpamfilterEnabled;
762 static bool s_IsChatCaptchaEnabled;
764 static bool s_FilterComments;
765 static wxString s_CommentFilterString;
768 // Hidden files sharing
769 static bool s_ShareHiddenFiles;
771 static bool s_AutoSortDownload;
773 // Version check
774 static bool s_NewVersionCheck;
776 // Kad
777 static bool s_ConnectToKad;
778 static bool s_ConnectToED2K;
780 // Statistics
781 static unsigned s_maxClientVersions; // 0 = unlimited
783 // Drop slow sources if needed
784 static bool s_DropSlowSources;
786 static wxString s_Ed2kURL;
787 static wxString s_KadURL;
789 // Crypt
790 static bool s_IsClientCryptLayerSupported;
791 static bool s_IsClientCryptLayerRequired;
792 static bool s_bCryptLayerRequested;
793 static uint32 s_dwKadUDPKey;
794 static uint8 s_byCryptTCPPaddingLength;
796 // GeoIP
797 static bool s_GeoIPEnabled;
798 static wxString s_GeoIPUpdateUrl;
802 #endif // PREFERENCES_H
803 // File_checked_for_headers