2 // This file is part of the aMule Project.
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 )
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
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
29 #include "MD4Hash.h" // Needed for CMD4Hash
31 #include <wx/arrstr.h> // Needed for wxArrayString
36 #include "OtherStructs.h"
38 #include <common/ClientVersion.h> // Needed for __SVN__
44 enum EViewSharedFilesAccess
{
50 enum AllCategoryFilter
{
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
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.
92 * @param keyname This is the keyname under which the variable is to be saved.
94 Cfg_Base( const wxString
& keyname
)
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
; }
156 * Sets the changed status.
158 * @param changed The new status.
160 virtual void SetChanged( bool changed
)
167 //! The Config-key under which to save the variable
170 //! The changed-status of the variable
175 class Cfg_Lang_Base
{
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
;
191 friend class PrefsUnifiedDlg
;
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;
270 static uint16
GetMaxSourcePerFileUDP() {
271 uint16 temp
= (uint16
)(s_maxsourceperfile
*0.75);
272 if( temp
> 100 ) return 100;
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 GetVerboseLogfile() { return s_bVerboseLogfile
; }
301 static void SetVerboseLogfile(bool val
) { s_bVerboseLogfile
= val
; }
302 static bool GetPreviewPrio() { return s_bpreviewprio
; }
303 static void SetPreviewPrio(bool in
) { s_bpreviewprio
= in
; }
304 static bool StartNextFile() { return s_bstartnextfile
; }
305 static bool StartNextFileSame() { return s_bstartnextfilesame
; }
306 static bool StartNextFileAlpha() { return s_bstartnextfilealpha
; }
307 static void SetStartNextFile(bool val
) { s_bstartnextfile
= val
; }
308 static void SetStartNextFileSame(bool val
) { s_bstartnextfilesame
= val
; }
309 static void SetStartNextFileAlpha(bool val
) { s_bstartnextfilealpha
= val
; }
310 static bool ShowOverhead() { return s_bshowoverhead
; }
311 static void SetNewAutoUp(bool m_bInUAP
) { s_bUAP
= m_bInUAP
; }
312 static bool GetNewAutoUp() { return s_bUAP
; }
313 static void SetNewAutoDown(bool m_bInDAP
) { s_bDAP
= m_bInDAP
; }
314 static bool GetNewAutoDown() { return s_bDAP
; }
316 static const wxString
& GetVideoPlayer() { return s_VideoPlayer
; }
318 static uint32
GetFileBufferSize() { return s_iFileBufferSize
*15000; }
319 static void SetFileBufferSize(uint32 val
) { s_iFileBufferSize
= val
/15000; }
320 static uint32
GetQueueSize() { return s_iQueueSize
*100; }
321 static void SetQueueSize(uint32 val
) { s_iQueueSize
= val
/100; }
323 static uint8
Get3DDepth() { return s_depth3D
;}
324 static bool AddNewFilesPaused() { return s_addnewfilespaused
; }
325 static void SetAddNewFilesPaused(bool val
) { s_addnewfilespaused
= val
; }
327 static void SetMaxConsPerFive(int in
) { s_MaxConperFive
=in
; }
329 static uint16
GetMaxConperFive() { return s_MaxConperFive
; }
330 static uint16
GetDefaultMaxConperFive();
332 static bool IsSafeServerConnectEnabled() { return s_safeServerConnect
; }
333 static void SetSafeServerConnectEnabled(bool val
) { s_safeServerConnect
= val
; }
335 static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace
; }
336 static void SetCheckDiskspaceEnabled(bool val
) { s_checkDiskspace
= val
; }
337 static uint32
GetMinFreeDiskSpaceMB() { return s_uMinFreeDiskSpace
; }
338 static uint64
GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace
* 1048576ull; }
339 static void SetMinFreeDiskSpaceMB(uint32 val
) { s_uMinFreeDiskSpace
= val
; }
341 static const wxString
& GetYourHostname() { return s_yourHostname
; }
342 static void SetYourHostname(const wxString
& s
) { s_yourHostname
= s
; }
344 static void SetMaxUpload(uint16 in
);
345 static void SetMaxDownload(uint16 in
);
346 static void SetSlotAllocation(uint16 in
) { s_slotallocation
= (in
>= 1) ? in
: 1; };
348 typedef std::vector
<CPath
> PathList
;
349 PathList shareddir_list
;
351 wxArrayString adresses_list
;
353 static bool AutoConnectStaticOnly() { return s_autoconnectstaticonly
; }
354 static void SetAutoConnectStaticOnly(bool val
) { s_autoconnectstaticonly
= val
; }
355 static bool GetUPnPEnabled() { return s_UPnPEnabled
; }
356 static void SetUPnPEnabled(bool val
) { s_UPnPEnabled
= val
; }
357 static bool GetUPnPECEnabled() { return s_UPnPECEnabled
; }
358 static void SetUPnPECEnabled(bool val
) { s_UPnPECEnabled
= val
; }
359 static bool GetUPnPWebServerEnabled() { return s_UPnPWebServerEnabled
; }
360 static void SetUPnPWebServerEnabled(bool val
){ s_UPnPWebServerEnabled
= val
; }
361 static uint16
GetUPnPTCPPort() { return s_UPnPTCPPort
; }
362 static void SetUPnPTCPPort(uint16 val
) { s_UPnPTCPPort
= val
; }
363 static bool IsManualHighPrio() { return s_bmanualhighprio
; }
364 static void SetManualHighPrio(bool val
) { s_bmanualhighprio
= val
; }
366 static const wxString
& GetDateTimeFormat() { return s_datetimeformat
; }
367 // Download Categories
368 uint32
AddCat(Category_Struct
* cat
);
369 void RemoveCat(size_t index
);
370 uint32
GetCatCount();
371 Category_Struct
* GetCategory(size_t index
);
372 const CPath
& GetCatPath(uint8 index
);
373 uint32
GetCatColor(size_t index
);
374 bool CreateCategory(Category_Struct
*& category
, const wxString
& name
, const CPath
& path
,
375 const wxString
& comment
, uint32 color
, uint8 prio
);
376 bool UpdateCategory(uint8 cat
, const wxString
& name
, const CPath
& path
,
377 const wxString
& comment
, uint32 color
, uint8 prio
);
379 static AllCategoryFilter
GetAllcatFilter() { return s_allcatFilter
; }
380 static void SetAllcatFilter(AllCategoryFilter in
) { s_allcatFilter
= in
; }
382 static bool ShowAllNotCats() { return s_showAllNotCats
; }
385 static uint16
GetWSPort() { return s_nWebPort
; }
386 static void SetWSPort(uint16 uPort
) { s_nWebPort
=uPort
; }
387 static uint16
GetWebUPnPTCPPort() { return s_nWebUPnPTCPPort
; }
388 static void SetWebUPnPTCPPort(uint16 val
) { s_nWebUPnPTCPPort
= val
; }
389 static const wxString
& GetWSPass() { return s_sWebPassword
; }
390 static void SetWSPass(const wxString
& pass
) { s_sWebPassword
= pass
; }
391 static const wxString
& GetWSPath() { return s_sWebPath
; }
392 static void SetWSPath(const wxString
& path
) { s_sWebPath
= path
; }
393 static bool GetWSIsEnabled() { return s_bWebEnabled
; }
394 static void SetWSIsEnabled(bool bEnable
) { s_bWebEnabled
=bEnable
; }
395 static bool GetWebUseGzip() { return s_bWebUseGzip
; }
396 static void SetWebUseGzip(bool bUse
) { s_bWebUseGzip
=bUse
; }
397 static uint32
GetWebPageRefresh() { return s_nWebPageRefresh
; }
398 static void SetWebPageRefresh(uint32 nRefresh
) { s_nWebPageRefresh
=nRefresh
; }
399 static bool GetWSIsLowUserEnabled() { return s_bWebLowEnabled
; }
400 static void SetWSIsLowUserEnabled(bool in
) { s_bWebLowEnabled
=in
; }
401 static const wxString
& GetWSLowPass() { return s_sWebLowPassword
; }
402 static void SetWSLowPass(const wxString
& pass
) { s_sWebLowPassword
= pass
; }
403 static const wxString
& GetWebTemplate() { return s_WebTemplate
; }
404 static void SetWebTemplate(const wxString
& val
) { s_WebTemplate
= val
; }
406 static void SetMaxSourcesPerFile(uint16 in
) { s_maxsourceperfile
=in
;}
407 static void SetMaxConnections(uint16 in
) { s_maxconnections
=in
;}
409 static bool ShowCatTabInfos() { return s_showCatTabInfos
; }
410 static void ShowCatTabInfos(bool in
) { s_showCatTabInfos
=in
; }
412 // Sources Dropping Tweaks
413 static bool DropNoNeededSources() { return s_NoNeededSources
> 0; }
414 static bool SwapNoNeededSources() { return s_NoNeededSources
== 2; }
415 static uint8
GetNoNeededSources() { return s_NoNeededSources
; }
416 static void SetNoNeededSources(uint8 val
) { s_NoNeededSources
= val
; }
417 static bool DropFullQueueSources() { return s_DropFullQueueSources
; }
418 static void SetDropFullQueueSources(bool val
) { s_DropFullQueueSources
= val
; }
419 static bool DropHighQueueRankingSources() { return s_DropHighQueueRankingSources
; }
420 static void SetDropHighQueueRankingSources(bool val
) { s_DropHighQueueRankingSources
= val
; }
421 static uint32
HighQueueRanking() { return s_HighQueueRanking
; }
422 static void SetHighQueueRanking(uint32 val
) { s_HighQueueRanking
= val
; }
423 static uint32
GetAutoDropTimer() { return s_AutoDropTimer
; }
424 static void SetAutoDropTimer(uint32 val
) { s_AutoDropTimer
= val
; }
426 // External Connections
427 static bool AcceptExternalConnections() { return s_AcceptExternalConnections
; }
428 static void EnableExternalConnections( bool val
) { s_AcceptExternalConnections
= val
; }
429 static const wxString
& GetECAddress() { return s_ECAddr
; }
430 static uint32
ECPort() { return s_ECPort
; }
431 static void SetECPort(uint32 val
) { s_ECPort
= val
; }
432 static const wxString
& ECPassword() { return s_ECPassword
; }
433 static void SetECPass(const wxString
& pass
) { s_ECPassword
= pass
; }
434 static bool IsTransmitOnlyUploadingClients() { return s_TransmitOnlyUploadingClients
; }
436 // Fast ED2K Links Handler Toggling
437 static bool GetFED2KLH() { return s_FastED2KLinksHandler
; }
440 static bool IsFilteringClients() { return s_IPFilterClients
; }
441 static void SetFilteringClients(bool val
);
442 static bool IsFilteringServers() { return s_IPFilterServers
; }
443 static void SetFilteringServers(bool val
);
444 static uint8
GetIPFilterLevel() { return s_filterlevel
;}
445 static void SetIPFilterLevel(uint8 level
);
446 static bool IPFilterAutoLoad() { return s_IPFilterAutoLoad
; }
447 static void SetIPFilterAutoLoad(bool val
) { s_IPFilterAutoLoad
= val
; }
448 static const wxString
& IPFilterURL() { return s_IPFilterURL
; }
449 static void SetIPFilterURL(const wxString
& url
) { s_IPFilterURL
= url
; }
450 static bool UseIPFilterSystem() { return s_IPFilterSys
; }
451 static void SetIPFilterSystem(bool val
) { s_IPFilterSys
= val
; }
453 // Source seeds On/Off
454 static bool GetSrcSeedsOn() { return s_UseSrcSeeds
; }
455 static void SetSrcSeedsOn(bool val
) { s_UseSrcSeeds
= val
; }
457 static bool IsSecureIdentEnabled() { return s_SecIdent
; }
458 static void SetSecureIdentEnabled(bool val
) { s_SecIdent
= val
; }
460 static bool GetExtractMetaData() { return s_ExtractMetaData
; }
461 static void SetExtractMetaData(bool val
) { s_ExtractMetaData
= val
; }
463 static bool ShowProgBar() { return s_ProgBar
; }
464 static bool ShowPercent() { return s_Percent
; }
466 static bool GetAllocFullFile() { return s_allocFullFile
; };
467 static void SetAllocFullFile(bool val
) { s_allocFullFile
= val
; }
469 static wxString
GetBrowser();
471 static const wxString
& GetSkin() { return s_Skin
; }
473 static bool VerticalToolbar() { return s_ToolbarOrientation
; }
475 static const CPath
& GetOSDir() { return s_OSDirectory
; }
476 static uint16
GetOSUpdate() { return s_OSUpdate
; }
478 static uint8
GetToolTipDelay() { return s_iToolDelayTime
; }
480 static void UnsetAutoServerStart();
481 static void CheckUlDlRatio();
483 static void BuildItemList( const wxString
& appdir
);
484 static void EraseItemList();
486 static void LoadAllItems(wxConfigBase
* cfg
);
487 static void SaveAllItems(wxConfigBase
* cfg
);
490 static bool ShowVersionOnTitle() { return s_showVersionOnTitle
; }
492 static bool ShowVersionOnTitle() { return true; }
494 static uint8_t GetShowRatesOnTitle() { return s_showRatesOnTitle
; }
495 static void SetShowRatesOnTitle(uint8_t val
) { s_showRatesOnTitle
= val
; }
499 static bool MustFilterMessages() { return s_MustFilterMessages
; }
500 static void SetMustFilterMessages(bool val
) { s_MustFilterMessages
= val
; }
501 static bool IsFilterAllMessages() { return s_FilterAllMessages
; }
502 static void SetFilterAllMessages(bool val
) { s_FilterAllMessages
= val
; }
503 static bool MsgOnlyFriends() { return s_msgonlyfriends
;}
504 static void SetMsgOnlyFriends(bool val
) { s_msgonlyfriends
= val
; }
505 static bool MsgOnlySecure() { return s_msgsecure
;}
506 static void SetMsgOnlySecure(bool val
) { s_msgsecure
= val
; }
507 static bool IsFilterByKeywords() { return s_FilterSomeMessages
; }
508 static void SetFilterByKeywords(bool val
) { s_FilterSomeMessages
= val
; }
509 static const wxString
& GetMessageFilterString() { return s_MessageFilterString
; }
510 static void SetMessageFilterString(const wxString
& val
) { s_MessageFilterString
= val
; }
511 static bool IsMessageFiltered(const wxString
& message
);
512 static bool ShowMessagesInLog() { return s_ShowMessagesInLog
; }
513 static bool IsAdvancedSpamfilterEnabled() { return s_IsAdvancedSpamfilterEnabled
;}
514 static bool IsChatCaptchaEnabled() { return IsAdvancedSpamfilterEnabled() && s_IsChatCaptchaEnabled
; }
516 static bool FilterComments() { return s_FilterComments
; }
517 static void SetFilterComments(bool val
) { s_FilterComments
= val
; }
518 static const wxString
& GetCommentFilterString() { return s_CommentFilterString
; }
519 static void SetCommentFilterString(const wxString
& val
) { s_CommentFilterString
= val
; }
520 static bool IsCommentFiltered(const wxString
& comment
);
522 // Can't have it return a reference, will need a pointer later.
523 static const CProxyData
*GetProxyData() { return &s_ProxyData
; }
527 static bool ShareHiddenFiles() { return s_ShareHiddenFiles
; }
528 static void SetShareHiddenFiles(bool val
) { s_ShareHiddenFiles
= val
; }
530 static bool AutoSortDownload() { return s_AutoSortDownload
; }
531 static bool AutoSortDownload(bool val
) { bool tmp
= s_AutoSortDownload
; s_AutoSortDownload
= val
; return tmp
; }
535 static bool GetCheckNewVersion() { return s_NewVersionCheck
; }
536 static void SetCheckNewVersion(bool val
) { s_NewVersionCheck
= val
; }
539 static bool GetNetworkKademlia() { return s_ConnectToKad
; }
540 static void SetNetworkKademlia(bool val
) { s_ConnectToKad
= val
; }
541 static bool GetNetworkED2K() { return s_ConnectToED2K
; }
542 static void SetNetworkED2K(bool val
) { s_ConnectToED2K
= val
; }
545 static unsigned GetMaxClientVersions() { return s_maxClientVersions
; }
547 // Dropping slow sources
548 static bool GetDropSlowSources() { return s_DropSlowSources
; }
550 // server.met and nodes.dat urls
551 static const wxString
& GetKadNodesUrl() { return s_KadURL
; }
552 static void SetKadNodesUrl(const wxString
& url
) { s_KadURL
= url
; }
554 static const wxString
& GetEd2kServersUrl() { return s_Ed2kURL
; }
555 static void SetEd2kServersUrl(const wxString
& url
) { s_Ed2kURL
= url
; }
558 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported
;}
559 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested
;}
560 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired
;}
561 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
562 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
563 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
564 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
565 static uint32
GetKadUDPKey() {return s_dwKadUDPKey
;}
566 static uint8
GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength
;}
568 static void SetClientCryptLayerSupported(bool v
) {s_IsClientCryptLayerSupported
= v
;}
569 static void SetClientCryptLayerRequested(bool v
) {s_bCryptLayerRequested
= v
; }
570 static void SetClientCryptLayerRequired(bool v
) {s_IsClientCryptLayerRequired
= v
;}
573 static bool IsGeoIPEnabled() {return s_GeoIPEnabled
;}
574 static void SetGeoIPEnabled(bool v
) {s_GeoIPEnabled
= v
;}
575 static const wxString
& GetGeoIPUpdateUrl() {return s_GeoIPUpdateUrl
;}
578 static const wxString
& GetStatsServerName() {return s_StatsServerName
;}
579 static const wxString
& GetStatsServerURL() {return s_StatsServerURL
;}
582 static wxString
GetLastHTTPDownloadURL(uint8 t
);
583 static void SetLastHTTPDownloadURL(uint8 t
, const wxString
& val
);
586 static bool GetPreventSleepWhileDownloading() { return s_preventSleepWhileDownloading
; }
587 static void SetPreventSleepWhileDownloading(bool status
) { s_preventSleepWhileDownloading
= status
; }
589 static int32
GetRecommendedMaxConnections();
591 //! Temporary storage for statistic-colors.
592 static unsigned long s_colors
[cntStatColors
];
593 //! Reference for checking if the colors has changed.
594 static unsigned long s_colors_ref
[cntStatColors
];
596 typedef std::vector
<Cfg_Base
*> CFGList
;
597 typedef std::map
<int, Cfg_Base
*> CFGMap
;
598 typedef std::vector
<Category_Struct
*> CatList
;
601 static CFGMap s_CfgList
;
602 static CFGList s_MiscList
;
606 void LoadPreferences();
607 void SavePreferences();
611 static wxString s_nick
;
613 static CMD4Hash s_userhash
;
615 static Cfg_Lang_Base
* s_cfgLang
;
617 ////////////// CONNECTION
618 static uint16 s_maxupload
;
619 static uint16 s_maxdownload
;
620 static uint16 s_slotallocation
;
621 static wxString s_Addr
;
622 static uint16 s_port
;
623 static uint16 s_udpport
;
624 static bool s_UDPEnable
;
625 static uint16 s_maxconnections
;
626 static bool s_reconnect
;
627 static bool s_autoconnect
;
628 static bool s_autoconnectstaticonly
;
629 static bool s_UPnPEnabled
;
630 static bool s_UPnPECEnabled
;
631 static bool s_UPnPWebServerEnabled
;
632 static uint16 s_UPnPTCPPort
;
635 static CProxyData s_ProxyData
;
637 ////////////// SERVERS
638 static bool s_autoserverlist
;
639 static bool s_deadserver
;
642 static CPath s_incomingdir
;
643 static CPath s_tempdir
;
645 static bool s_AICHTrustEveryHash
;
648 static uint8 s_depth3D
;
650 static bool s_scorsystem
;
651 static bool s_hideonclose
;
652 static bool s_mintotray
;
653 static bool s_trayiconenabled
;
654 static bool s_addnewfilespaused
;
655 static bool s_addserversfromserver
;
656 static bool s_addserversfromclient
;
657 static uint16 s_maxsourceperfile
;
658 static uint16 s_trafficOMeterInterval
;
659 static uint16 s_statsInterval
;
660 static uint32 s_maxGraphDownloadRate
;
661 static uint32 s_maxGraphUploadRate
;
662 static bool s_confirmExit
;
665 static bool s_filterLanIP
;
666 static bool s_paranoidfilter
;
667 static bool s_onlineSig
;
669 static wxString s_languageID
;
670 static uint8 s_iSeeShares
; // 0=everybody 1=friends only 2=noone
671 static uint8 s_iToolDelayTime
; // tooltip delay time in seconds
672 static uint8 s_splitterbarPosition
;
673 static uint16 s_deadserverretries
;
674 static uint32 s_dwServerKeepAliveTimeoutMins
;
676 static uint8 s_statsMax
;
677 static uint8 s_statsAverageMinutes
;
679 static bool s_bpreviewprio
;
680 static bool s_smartidcheck
;
681 static uint8 s_smartidstate
;
682 static bool s_safeServerConnect
;
683 static bool s_startMinimized
;
684 static uint16 s_MaxConperFive
;
685 static bool s_checkDiskspace
;
686 static uint32 s_uMinFreeDiskSpace
;
687 static wxString s_yourHostname
;
688 static bool s_bVerbose
;
689 static bool s_bVerboseLogfile
;
690 static bool s_bmanualhighprio
;
691 static bool s_bstartnextfile
;
692 static bool s_bstartnextfilesame
;
693 static bool s_bstartnextfilealpha
;
694 static bool s_bshowoverhead
;
699 static bool s_showVersionOnTitle
;
701 static uint8_t s_showRatesOnTitle
; // 0=no, 1=after app name, 2=before app name
703 static wxString s_VideoPlayer
;
704 static bool s_showAllNotCats
;
706 static bool s_msgonlyfriends
;
707 static bool s_msgsecure
;
709 static uint8 s_iFileBufferSize
;
710 static uint8 s_iQueueSize
;
712 static wxString s_datetimeformat
;
714 static bool s_ToolbarOrientation
;
716 // Web Server [kuchin]
717 static wxString s_sWebPassword
;
718 static wxString s_sWebPath
;
719 static wxString s_sWebLowPassword
;
720 static uint16 s_nWebPort
;
721 static uint16 s_nWebUPnPTCPPort
;
722 static bool s_bWebEnabled
;
723 static bool s_bWebUseGzip
;
724 static uint32 s_nWebPageRefresh
;
725 static bool s_bWebLowEnabled
;
726 static wxString s_WebTemplate
;
728 static bool s_showCatTabInfos
;
729 static AllCategoryFilter s_allcatFilter
;
731 // Madcat - Sources Dropping Tweaks
732 static uint8 s_NoNeededSources
; // 0: Keep, 1: Drop, 2:Swap
733 static bool s_DropFullQueueSources
;
734 static bool s_DropHighQueueRankingSources
;
735 static uint32 s_HighQueueRanking
;
736 static uint32 s_AutoDropTimer
;
738 // Kry - external connections
739 static bool s_AcceptExternalConnections
;
740 static wxString s_ECAddr
;
741 static uint32 s_ECPort
;
742 static wxString s_ECPassword
;
743 static bool s_TransmitOnlyUploadingClients
;
746 static bool s_IPFilterClients
;
747 static bool s_IPFilterServers
;
748 static uint8 s_filterlevel
;
749 static bool s_IPFilterAutoLoad
;
750 static wxString s_IPFilterURL
;
751 static bool s_IPFilterSys
;
753 // Kry - Source seeds on/off
754 static bool s_UseSrcSeeds
;
756 static bool s_ProgBar
;
757 static bool s_Percent
;
759 static bool s_SecIdent
;
761 static bool s_ExtractMetaData
;
763 static bool s_allocFullFile
;
765 static wxString s_CustomBrowser
;
766 static bool s_BrowserTab
; // Jacobo221 - Open in tabs if possible
768 static CPath s_OSDirectory
;
769 static uint16 s_OSUpdate
;
771 static wxString s_Skin
;
773 static bool s_FastED2KLinksHandler
; // Madcat - Toggle Fast ED2K Links Handler
776 static bool s_MustFilterMessages
;
777 static wxString s_MessageFilterString
;
778 static bool s_FilterAllMessages
;
779 static bool s_FilterSomeMessages
;
780 static bool s_ShowMessagesInLog
;
781 static bool s_IsAdvancedSpamfilterEnabled
;
782 static bool s_IsChatCaptchaEnabled
;
784 static bool s_FilterComments
;
785 static wxString s_CommentFilterString
;
788 // Hidden files sharing
789 static bool s_ShareHiddenFiles
;
791 static bool s_AutoSortDownload
;
794 static bool s_NewVersionCheck
;
797 static bool s_ConnectToKad
;
798 static bool s_ConnectToED2K
;
801 static unsigned s_maxClientVersions
; // 0 = unlimited
803 // Drop slow sources if needed
804 static bool s_DropSlowSources
;
806 static wxString s_Ed2kURL
;
807 static wxString s_KadURL
;
810 static bool s_IsClientCryptLayerSupported
;
811 static bool s_IsClientCryptLayerRequired
;
812 static bool s_bCryptLayerRequested
;
813 static uint32 s_dwKadUDPKey
;
814 static uint8 s_byCryptTCPPaddingLength
;
817 static bool s_GeoIPEnabled
;
818 static wxString s_GeoIPUpdateUrl
;
821 static bool s_preventSleepWhileDownloading
;
824 static wxString s_StatsServerName
;
825 static wxString s_StatsServerURL
;
829 #endif // PREFERENCES_H
830 // File_checked_for_headers