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 const wxString
& GetConfigDir() { return s_configDir
; }
201 static void SetConfigDir(const wxString
& dir
) { s_configDir
= dir
; }
203 static bool Score() { return s_scorsystem
; }
204 static void SetScoreSystem(bool val
) { s_scorsystem
= val
; }
205 static bool Reconnect() { return s_reconnect
; }
206 static void SetReconnect(bool val
) { s_reconnect
= val
; }
207 static bool DeadServer() { return s_deadserver
; }
208 static void SetDeadServer(bool val
) { s_deadserver
= val
; }
209 static const wxString
& GetUserNick() { return s_nick
; }
210 static void SetUserNick(const wxString
& nick
) { s_nick
= nick
; }
211 static Cfg_Lang_Base
* GetCfgLang() { return s_cfgLang
; }
213 static const wxString
& GetAddress() { return s_Addr
; }
214 static uint16
GetPort() { return s_port
; }
215 static void SetPort(uint16 val
);
216 static uint16
GetUDPPort() { return s_udpport
; }
217 static uint16
GetEffectiveUDPPort() { return s_UDPEnable
? s_udpport
: 0; }
218 static void SetUDPPort(uint16 val
) { s_udpport
= val
; }
219 static bool IsUDPDisabled() { return !s_UDPEnable
; }
220 static void SetUDPDisable(bool val
) { s_UDPEnable
= !val
; }
221 static const CPath
& GetIncomingDir() { return s_incomingdir
; }
222 static void SetIncomingDir(const CPath
& dir
){ s_incomingdir
= dir
; }
223 static const CPath
& GetTempDir() { return s_tempdir
; }
224 static void SetTempDir(const CPath
& dir
) { s_tempdir
= dir
; }
225 static const CMD4Hash
& GetUserHash() { return s_userhash
; }
226 static void SetUserHash(const CMD4Hash
& h
) { s_userhash
= h
; }
227 static uint16
GetMaxUpload() { return s_maxupload
; }
228 static uint16
GetSlotAllocation() { return s_slotallocation
; }
229 static bool IsICHEnabled() { return s_ICH
; }
230 static void SetICHEnabled(bool val
) { s_ICH
= val
; }
231 static bool IsTrustingEveryHash() { return s_AICHTrustEveryHash
; }
232 static void SetTrustingEveryHash(bool val
) { s_AICHTrustEveryHash
= val
; }
233 static bool AutoServerlist() { return s_autoserverlist
; }
234 static void SetAutoServerlist(bool val
) { s_autoserverlist
= val
; }
235 static bool DoMinToTray() { return s_mintotray
; }
236 static void SetMinToTray(bool val
) { s_mintotray
= val
; }
237 static bool UseTrayIcon() { return s_trayiconenabled
; }
238 static void SetUseTrayIcon(bool val
) { s_trayiconenabled
= val
; }
239 static bool HideOnClose() { return s_hideonclose
; }
240 static void SetHideOnClose(bool val
) { s_hideonclose
= val
; }
241 static bool DoAutoConnect() { return s_autoconnect
; }
242 static void SetAutoConnect(bool inautoconnect
)
243 {s_autoconnect
= inautoconnect
; }
244 static bool AddServersFromServer() { return s_addserversfromserver
; }
245 static void SetAddServersFromServer(bool val
) { s_addserversfromserver
= val
; }
246 static bool AddServersFromClient() { return s_addserversfromclient
; }
247 static void SetAddServersFromClient(bool val
) { s_addserversfromclient
= val
; }
248 static uint16
GetTrafficOMeterInterval() { return s_trafficOMeterInterval
; }
249 static void SetTrafficOMeterInterval(uint16 in
)
250 { s_trafficOMeterInterval
= in
; }
251 static uint16
GetStatsInterval() { return s_statsInterval
;}
252 static void SetStatsInterval(uint16 in
) { s_statsInterval
= in
; }
253 static bool IsConfirmExitEnabled() { return s_confirmExit
; }
254 static bool FilterLanIPs() { return s_filterLanIP
; }
255 static void SetFilterLanIPs(bool val
) { s_filterLanIP
= val
; }
256 static bool ParanoidFilter() { return s_paranoidfilter
; }
257 static void SetParanoidFilter(bool val
) { s_paranoidfilter
= val
; }
258 static bool IsOnlineSignatureEnabled() { return s_onlineSig
; }
259 static void SetOnlineSignatureEnabled(bool val
) { s_onlineSig
= val
; }
260 static uint32
GetMaxGraphUploadRate() { return s_maxGraphUploadRate
; }
261 static uint32
GetMaxGraphDownloadRate() { return s_maxGraphDownloadRate
; }
262 static void SetMaxGraphUploadRate(uint32 in
){ s_maxGraphUploadRate
=in
; }
263 static void SetMaxGraphDownloadRate(uint32 in
)
264 { s_maxGraphDownloadRate
= in
; }
266 static uint16
GetMaxDownload() { return s_maxdownload
; }
267 static uint16
GetMaxConnections() { return s_maxconnections
; }
268 static uint16
GetMaxSourcePerFile() { return s_maxsourceperfile
; }
269 static uint16
GetMaxSourcePerFileSoft() {
270 uint16 temp
= (uint16
)(s_maxsourceperfile
*0.9);
271 if( temp
> 1000 ) return 1000;
273 static uint16
GetMaxSourcePerFileUDP() {
274 uint16 temp
= (uint16
)(s_maxsourceperfile
*0.75);
275 if( temp
> 100 ) return 100;
277 static uint16
GetDeadserverRetries() { return s_deadserverretries
; }
278 static void SetDeadserverRetries(uint16 val
) { s_deadserverretries
= val
; }
279 static uint32
GetServerKeepAliveTimeout() { return s_dwServerKeepAliveTimeoutMins
*60000; }
280 static void SetServerKeepAliveTimeout(uint32 val
) { s_dwServerKeepAliveTimeoutMins
= val
/60000; }
282 static const wxString
& GetLanguageID() { return s_languageID
; }
283 static void SetLanguageID(const wxString
& new_id
) { s_languageID
= new_id
; }
284 static uint8
CanSeeShares() { return s_iSeeShares
; }
285 static void SetCanSeeShares(uint8 val
) { s_iSeeShares
= val
; }
287 static uint8
GetStatsMax() { return s_statsMax
; }
288 static bool UseFlatBar() { return (s_depth3D
==0); }
289 static uint8
GetStatsAverageMinutes() { return s_statsAverageMinutes
; }
290 static void SetStatsAverageMinutes(uint8 in
){ s_statsAverageMinutes
= in
; }
292 static bool GetStartMinimized() { return s_startMinimized
; }
293 static void SetStartMinimized(bool instartMinimized
)
294 { s_startMinimized
= instartMinimized
;}
295 static bool GetSmartIdCheck() { return s_smartidcheck
; }
296 static void SetSmartIdCheck( bool in_smartidcheck
)
297 { s_smartidcheck
= in_smartidcheck
; }
298 static uint8
GetSmartIdState() { return s_smartidstate
; }
299 static void SetSmartIdState( uint8 in_smartidstate
)
300 { s_smartidstate
= in_smartidstate
; }
301 static bool GetVerbose() { return s_bVerbose
; }
302 static void SetVerbose(bool val
) { s_bVerbose
= val
; }
303 static bool GetVerboseLogfile() { return s_bVerboseLogfile
; }
304 static void SetVerboseLogfile(bool val
) { s_bVerboseLogfile
= val
; }
305 static bool GetPreviewPrio() { return s_bpreviewprio
; }
306 static void SetPreviewPrio(bool in
) { s_bpreviewprio
= in
; }
307 static bool StartNextFile() { return s_bstartnextfile
; }
308 static bool StartNextFileSame() { return s_bstartnextfilesame
; }
309 static bool StartNextFileAlpha() { return s_bstartnextfilealpha
; }
310 static void SetStartNextFile(bool val
) { s_bstartnextfile
= val
; }
311 static void SetStartNextFileSame(bool val
) { s_bstartnextfilesame
= val
; }
312 static void SetStartNextFileAlpha(bool val
) { s_bstartnextfilealpha
= val
; }
313 static bool ShowOverhead() { return s_bshowoverhead
; }
314 static void SetNewAutoUp(bool m_bInUAP
) { s_bUAP
= m_bInUAP
; }
315 static bool GetNewAutoUp() { return s_bUAP
; }
316 static void SetNewAutoDown(bool m_bInDAP
) { s_bDAP
= m_bInDAP
; }
317 static bool GetNewAutoDown() { return s_bDAP
; }
319 static const wxString
& GetVideoPlayer() { return s_VideoPlayer
; }
321 static uint32
GetFileBufferSize() { return s_iFileBufferSize
*15000; }
322 static void SetFileBufferSize(uint32 val
) { s_iFileBufferSize
= val
/15000; }
323 static uint32
GetQueueSize() { return s_iQueueSize
*100; }
324 static void SetQueueSize(uint32 val
) { s_iQueueSize
= val
/100; }
326 static uint8
Get3DDepth() { return s_depth3D
;}
327 static bool AddNewFilesPaused() { return s_addnewfilespaused
; }
328 static void SetAddNewFilesPaused(bool val
) { s_addnewfilespaused
= val
; }
330 static void SetMaxConsPerFive(int in
) { s_MaxConperFive
=in
; }
332 static uint16
GetMaxConperFive() { return s_MaxConperFive
; }
333 static uint16
GetDefaultMaxConperFive();
335 static bool IsSafeServerConnectEnabled() { return s_safeServerConnect
; }
336 static void SetSafeServerConnectEnabled(bool val
) { s_safeServerConnect
= val
; }
338 static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace
; }
339 static void SetCheckDiskspaceEnabled(bool val
) { s_checkDiskspace
= val
; }
340 static uint32
GetMinFreeDiskSpaceMB() { return s_uMinFreeDiskSpace
; }
341 static uint64
GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace
* 1048576ull; }
342 static void SetMinFreeDiskSpaceMB(uint32 val
) { s_uMinFreeDiskSpace
= val
; }
344 static const wxString
& GetYourHostname() { return s_yourHostname
; }
345 static void SetYourHostname(const wxString
& s
) { s_yourHostname
= s
; }
347 static void SetMaxUpload(uint16 in
);
348 static void SetMaxDownload(uint16 in
);
349 static void SetSlotAllocation(uint16 in
) { s_slotallocation
= (in
>= 1) ? in
: 1; };
351 typedef std::vector
<CPath
> PathList
;
352 PathList shareddir_list
;
354 wxArrayString adresses_list
;
356 static bool AutoConnectStaticOnly() { return s_autoconnectstaticonly
; }
357 static void SetAutoConnectStaticOnly(bool val
) { s_autoconnectstaticonly
= val
; }
358 static bool GetUPnPEnabled() { return s_UPnPEnabled
; }
359 static void SetUPnPEnabled(bool val
) { s_UPnPEnabled
= val
; }
360 static bool GetUPnPECEnabled() { return s_UPnPECEnabled
; }
361 static void SetUPnPECEnabled(bool val
) { s_UPnPECEnabled
= val
; }
362 static bool GetUPnPWebServerEnabled() { return s_UPnPWebServerEnabled
; }
363 static void SetUPnPWebServerEnabled(bool val
){ s_UPnPWebServerEnabled
= val
; }
364 static uint16
GetUPnPTCPPort() { return s_UPnPTCPPort
; }
365 static void SetUPnPTCPPort(uint16 val
) { s_UPnPTCPPort
= val
; }
366 static bool IsManualHighPrio() { return s_bmanualhighprio
; }
367 static void SetManualHighPrio(bool val
) { s_bmanualhighprio
= val
; }
369 static const wxString
& GetDateTimeFormat() { return s_datetimeformat
; }
370 // Download Categories
371 uint32
AddCat(Category_Struct
* cat
);
372 void RemoveCat(size_t index
);
373 uint32
GetCatCount();
374 Category_Struct
* GetCategory(size_t index
);
375 const CPath
& GetCatPath(uint8 index
);
376 uint32
GetCatColor(size_t index
);
377 bool CreateCategory(Category_Struct
*& category
, const wxString
& name
, const CPath
& path
,
378 const wxString
& comment
, uint32 color
, uint8 prio
);
379 bool UpdateCategory(uint8 cat
, const wxString
& name
, const CPath
& path
,
380 const wxString
& comment
, uint32 color
, uint8 prio
);
382 static AllCategoryFilter
GetAllcatFilter() { return s_allcatFilter
; }
383 static void SetAllcatFilter(AllCategoryFilter in
) { s_allcatFilter
= in
; }
385 static bool ShowAllNotCats() { return s_showAllNotCats
; }
388 static uint16
GetWSPort() { return s_nWebPort
; }
389 static void SetWSPort(uint16 uPort
) { s_nWebPort
=uPort
; }
390 static uint16
GetWebUPnPTCPPort() { return s_nWebUPnPTCPPort
; }
391 static void SetWebUPnPTCPPort(uint16 val
) { s_nWebUPnPTCPPort
= val
; }
392 static const wxString
& GetWSPass() { return s_sWebPassword
; }
393 static void SetWSPass(const wxString
& pass
) { s_sWebPassword
= pass
; }
394 static const wxString
& GetWSPath() { return s_sWebPath
; }
395 static void SetWSPath(const wxString
& path
) { s_sWebPath
= path
; }
396 static bool GetWSIsEnabled() { return s_bWebEnabled
; }
397 static void SetWSIsEnabled(bool bEnable
) { s_bWebEnabled
=bEnable
; }
398 static bool GetWebUseGzip() { return s_bWebUseGzip
; }
399 static void SetWebUseGzip(bool bUse
) { s_bWebUseGzip
=bUse
; }
400 static uint32
GetWebPageRefresh() { return s_nWebPageRefresh
; }
401 static void SetWebPageRefresh(uint32 nRefresh
) { s_nWebPageRefresh
=nRefresh
; }
402 static bool GetWSIsLowUserEnabled() { return s_bWebLowEnabled
; }
403 static void SetWSIsLowUserEnabled(bool in
) { s_bWebLowEnabled
=in
; }
404 static const wxString
& GetWSLowPass() { return s_sWebLowPassword
; }
405 static void SetWSLowPass(const wxString
& pass
) { s_sWebLowPassword
= pass
; }
406 static const wxString
& GetWebTemplate() { return s_WebTemplate
; }
407 static void SetWebTemplate(const wxString
& val
) { s_WebTemplate
= val
; }
409 static void SetMaxSourcesPerFile(uint16 in
) { s_maxsourceperfile
=in
;}
410 static void SetMaxConnections(uint16 in
) { s_maxconnections
=in
;}
412 static bool ShowCatTabInfos() { return s_showCatTabInfos
; }
413 static void ShowCatTabInfos(bool in
) { s_showCatTabInfos
=in
; }
415 // External Connections
416 static bool AcceptExternalConnections() { return s_AcceptExternalConnections
; }
417 static void EnableExternalConnections( bool val
) { s_AcceptExternalConnections
= val
; }
418 static const wxString
& GetECAddress() { return s_ECAddr
; }
419 static uint32
ECPort() { return s_ECPort
; }
420 static void SetECPort(uint32 val
) { s_ECPort
= val
; }
421 static const wxString
& ECPassword() { return s_ECPassword
; }
422 static void SetECPass(const wxString
& pass
) { s_ECPassword
= pass
; }
423 static bool IsTransmitOnlyUploadingClients() { return s_TransmitOnlyUploadingClients
; }
425 // Fast ED2K Links Handler Toggling
426 static bool GetFED2KLH() { return s_FastED2KLinksHandler
; }
429 static bool IsFilteringClients() { return s_IPFilterClients
; }
430 static void SetFilteringClients(bool val
);
431 static bool IsFilteringServers() { return s_IPFilterServers
; }
432 static void SetFilteringServers(bool val
);
433 static uint8
GetIPFilterLevel() { return s_filterlevel
;}
434 static void SetIPFilterLevel(uint8 level
);
435 static bool IPFilterAutoLoad() { return s_IPFilterAutoLoad
; }
436 static void SetIPFilterAutoLoad(bool val
) { s_IPFilterAutoLoad
= val
; }
437 static const wxString
& IPFilterURL() { return s_IPFilterURL
; }
438 static void SetIPFilterURL(const wxString
& url
) { s_IPFilterURL
= url
; }
439 static bool UseIPFilterSystem() { return s_IPFilterSys
; }
440 static void SetIPFilterSystem(bool val
) { s_IPFilterSys
= val
; }
442 // Source seeds On/Off
443 static bool GetSrcSeedsOn() { return s_UseSrcSeeds
; }
444 static void SetSrcSeedsOn(bool val
) { s_UseSrcSeeds
= val
; }
446 static bool IsSecureIdentEnabled() { return s_SecIdent
; }
447 static void SetSecureIdentEnabled(bool val
) { s_SecIdent
= val
; }
449 static bool GetExtractMetaData() { return s_ExtractMetaData
; }
450 static void SetExtractMetaData(bool val
) { s_ExtractMetaData
= val
; }
452 static bool ShowProgBar() { return s_ProgBar
; }
453 static bool ShowPercent() { return s_Percent
; }
455 static bool GetAllocFullFile() { return s_allocFullFile
; };
456 static void SetAllocFullFile(bool val
) { s_allocFullFile
= val
; }
458 static bool CreateFilesSparse() { return s_createFilesSparse
; }
459 // Beware! This function reverts the value it gets, that's why the name is also different!
460 // In EC we send/receive the reverted value, that's the reason for a reverse setter.
461 static void CreateFilesNormal(bool val
) { s_createFilesSparse
= !val
; }
463 static wxString
GetBrowser();
465 static const wxString
& GetSkin() { return s_Skin
; }
467 static bool VerticalToolbar() { return s_ToolbarOrientation
; }
469 static const CPath
& GetOSDir() { return s_OSDirectory
; }
470 static uint16
GetOSUpdate() { return s_OSUpdate
; }
472 static uint8
GetToolTipDelay() { return s_iToolDelayTime
; }
474 static void UnsetAutoServerStart();
475 static void CheckUlDlRatio();
477 static void BuildItemList( const wxString
& appdir
);
478 static void EraseItemList();
480 static void LoadAllItems(wxConfigBase
* cfg
);
481 static void SaveAllItems(wxConfigBase
* cfg
);
484 static bool ShowVersionOnTitle() { return s_showVersionOnTitle
; }
486 static bool ShowVersionOnTitle() { return true; }
488 static uint8_t GetShowRatesOnTitle() { return s_showRatesOnTitle
; }
489 static void SetShowRatesOnTitle(uint8_t val
) { s_showRatesOnTitle
= val
; }
493 static bool MustFilterMessages() { return s_MustFilterMessages
; }
494 static void SetMustFilterMessages(bool val
) { s_MustFilterMessages
= val
; }
495 static bool IsFilterAllMessages() { return s_FilterAllMessages
; }
496 static void SetFilterAllMessages(bool val
) { s_FilterAllMessages
= val
; }
497 static bool MsgOnlyFriends() { return s_msgonlyfriends
;}
498 static void SetMsgOnlyFriends(bool val
) { s_msgonlyfriends
= val
; }
499 static bool MsgOnlySecure() { return s_msgsecure
;}
500 static void SetMsgOnlySecure(bool val
) { s_msgsecure
= val
; }
501 static bool IsFilterByKeywords() { return s_FilterSomeMessages
; }
502 static void SetFilterByKeywords(bool val
) { s_FilterSomeMessages
= val
; }
503 static const wxString
& GetMessageFilterString() { return s_MessageFilterString
; }
504 static void SetMessageFilterString(const wxString
& val
) { s_MessageFilterString
= val
; }
505 static bool IsMessageFiltered(const wxString
& message
);
506 static bool ShowMessagesInLog() { return s_ShowMessagesInLog
; }
507 static bool IsAdvancedSpamfilterEnabled() { return s_IsAdvancedSpamfilterEnabled
;}
508 static bool IsChatCaptchaEnabled() { return IsAdvancedSpamfilterEnabled() && s_IsChatCaptchaEnabled
; }
510 static bool FilterComments() { return s_FilterComments
; }
511 static void SetFilterComments(bool val
) { s_FilterComments
= val
; }
512 static const wxString
& GetCommentFilterString() { return s_CommentFilterString
; }
513 static void SetCommentFilterString(const wxString
& val
) { s_CommentFilterString
= val
; }
514 static bool IsCommentFiltered(const wxString
& comment
);
516 // Can't have it return a reference, will need a pointer later.
517 static const CProxyData
*GetProxyData() { return &s_ProxyData
; }
521 static bool ShareHiddenFiles() { return s_ShareHiddenFiles
; }
522 static void SetShareHiddenFiles(bool val
) { s_ShareHiddenFiles
= val
; }
524 static bool AutoSortDownload() { return s_AutoSortDownload
; }
525 static bool AutoSortDownload(bool val
) { bool tmp
= s_AutoSortDownload
; s_AutoSortDownload
= val
; return tmp
; }
529 static bool GetCheckNewVersion() { return s_NewVersionCheck
; }
530 static void SetCheckNewVersion(bool val
) { s_NewVersionCheck
= val
; }
533 static bool GetNetworkKademlia() { return s_ConnectToKad
; }
534 static void SetNetworkKademlia(bool val
) { s_ConnectToKad
= val
; }
535 static bool GetNetworkED2K() { return s_ConnectToED2K
; }
536 static void SetNetworkED2K(bool val
) { s_ConnectToED2K
= val
; }
539 static unsigned GetMaxClientVersions() { return s_maxClientVersions
; }
541 // Dropping slow sources
542 static bool GetDropSlowSources() { return s_DropSlowSources
; }
544 // server.met and nodes.dat urls
545 static const wxString
& GetKadNodesUrl() { return s_KadURL
; }
546 static void SetKadNodesUrl(const wxString
& url
) { s_KadURL
= url
; }
548 static const wxString
& GetEd2kServersUrl() { return s_Ed2kURL
; }
549 static void SetEd2kServersUrl(const wxString
& url
) { s_Ed2kURL
= url
; }
552 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported
;}
553 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested
;}
554 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired
;}
555 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
556 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
557 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
558 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
559 static uint32
GetKadUDPKey() {return s_dwKadUDPKey
;}
560 static uint8
GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength
;}
562 static void SetClientCryptLayerSupported(bool v
) {s_IsClientCryptLayerSupported
= v
;}
563 static void SetClientCryptLayerRequested(bool v
) {s_bCryptLayerRequested
= v
; }
564 static void SetClientCryptLayerRequired(bool v
) {s_IsClientCryptLayerRequired
= v
;}
567 static bool IsGeoIPEnabled() {return s_GeoIPEnabled
;}
568 static void SetGeoIPEnabled(bool v
) {s_GeoIPEnabled
= v
;}
569 static const wxString
& GetGeoIPUpdateUrl() {return s_GeoIPUpdateUrl
;}
572 static const wxString
& GetStatsServerName() {return s_StatsServerName
;}
573 static const wxString
& GetStatsServerURL() {return s_StatsServerURL
;}
576 static wxString
GetLastHTTPDownloadURL(uint8 t
);
577 static void SetLastHTTPDownloadURL(uint8 t
, const wxString
& val
);
580 static bool GetPreventSleepWhileDownloading() { return s_preventSleepWhileDownloading
; }
581 static void SetPreventSleepWhileDownloading(bool status
) { s_preventSleepWhileDownloading
= status
; }
583 static int32
GetRecommendedMaxConnections();
585 //! Temporary storage for statistic-colors.
586 static unsigned long s_colors
[cntStatColors
];
587 //! Reference for checking if the colors has changed.
588 static unsigned long s_colors_ref
[cntStatColors
];
590 typedef std::vector
<Cfg_Base
*> CFGList
;
591 typedef std::map
<int, Cfg_Base
*> CFGMap
;
592 typedef std::vector
<Category_Struct
*> CatList
;
595 static CFGMap s_CfgList
;
596 static CFGList s_MiscList
;
600 void LoadPreferences();
601 void SavePreferences();
604 static wxString s_configDir
;
607 static wxString s_nick
;
609 static CMD4Hash s_userhash
;
611 static Cfg_Lang_Base
* s_cfgLang
;
613 ////////////// CONNECTION
614 static uint16 s_maxupload
;
615 static uint16 s_maxdownload
;
616 static uint16 s_slotallocation
;
617 static wxString s_Addr
;
618 static uint16 s_port
;
619 static uint16 s_udpport
;
620 static bool s_UDPEnable
;
621 static uint16 s_maxconnections
;
622 static bool s_reconnect
;
623 static bool s_autoconnect
;
624 static bool s_autoconnectstaticonly
;
625 static bool s_UPnPEnabled
;
626 static bool s_UPnPECEnabled
;
627 static bool s_UPnPWebServerEnabled
;
628 static uint16 s_UPnPTCPPort
;
631 static CProxyData s_ProxyData
;
633 ////////////// SERVERS
634 static bool s_autoserverlist
;
635 static bool s_deadserver
;
638 static CPath s_incomingdir
;
639 static CPath s_tempdir
;
641 static bool s_AICHTrustEveryHash
;
644 static uint8 s_depth3D
;
646 static bool s_scorsystem
;
647 static bool s_hideonclose
;
648 static bool s_mintotray
;
649 static bool s_trayiconenabled
;
650 static bool s_addnewfilespaused
;
651 static bool s_addserversfromserver
;
652 static bool s_addserversfromclient
;
653 static uint16 s_maxsourceperfile
;
654 static uint16 s_trafficOMeterInterval
;
655 static uint16 s_statsInterval
;
656 static uint32 s_maxGraphDownloadRate
;
657 static uint32 s_maxGraphUploadRate
;
658 static bool s_confirmExit
;
661 static bool s_filterLanIP
;
662 static bool s_paranoidfilter
;
663 static bool s_onlineSig
;
665 static wxString s_languageID
;
666 static uint8 s_iSeeShares
; // 0=everybody 1=friends only 2=noone
667 static uint8 s_iToolDelayTime
; // tooltip delay time in seconds
668 static uint8 s_splitterbarPosition
;
669 static uint16 s_deadserverretries
;
670 static uint32 s_dwServerKeepAliveTimeoutMins
;
672 static uint8 s_statsMax
;
673 static uint8 s_statsAverageMinutes
;
675 static bool s_bpreviewprio
;
676 static bool s_smartidcheck
;
677 static uint8 s_smartidstate
;
678 static bool s_safeServerConnect
;
679 static bool s_startMinimized
;
680 static uint16 s_MaxConperFive
;
681 static bool s_checkDiskspace
;
682 static uint32 s_uMinFreeDiskSpace
;
683 static wxString s_yourHostname
;
684 static bool s_bVerbose
;
685 static bool s_bVerboseLogfile
;
686 static bool s_bmanualhighprio
;
687 static bool s_bstartnextfile
;
688 static bool s_bstartnextfilesame
;
689 static bool s_bstartnextfilealpha
;
690 static bool s_bshowoverhead
;
695 static bool s_showVersionOnTitle
;
697 static uint8_t s_showRatesOnTitle
; // 0=no, 1=after app name, 2=before app name
699 static wxString s_VideoPlayer
;
700 static bool s_showAllNotCats
;
702 static bool s_msgonlyfriends
;
703 static bool s_msgsecure
;
705 static uint8 s_iFileBufferSize
;
706 static uint8 s_iQueueSize
;
708 static wxString s_datetimeformat
;
710 static bool s_ToolbarOrientation
;
712 // Web Server [kuchin]
713 static wxString s_sWebPassword
;
714 static wxString s_sWebPath
;
715 static wxString s_sWebLowPassword
;
716 static uint16 s_nWebPort
;
717 static uint16 s_nWebUPnPTCPPort
;
718 static bool s_bWebEnabled
;
719 static bool s_bWebUseGzip
;
720 static uint32 s_nWebPageRefresh
;
721 static bool s_bWebLowEnabled
;
722 static wxString s_WebTemplate
;
724 static bool s_showCatTabInfos
;
725 static AllCategoryFilter s_allcatFilter
;
727 // Kry - external connections
728 static bool s_AcceptExternalConnections
;
729 static wxString s_ECAddr
;
730 static uint32 s_ECPort
;
731 static wxString s_ECPassword
;
732 static bool s_TransmitOnlyUploadingClients
;
735 static bool s_IPFilterClients
;
736 static bool s_IPFilterServers
;
737 static uint8 s_filterlevel
;
738 static bool s_IPFilterAutoLoad
;
739 static wxString s_IPFilterURL
;
740 static bool s_IPFilterSys
;
742 // Kry - Source seeds on/off
743 static bool s_UseSrcSeeds
;
745 static bool s_ProgBar
;
746 static bool s_Percent
;
748 static bool s_SecIdent
;
750 static bool s_ExtractMetaData
;
752 static bool s_allocFullFile
;
753 static bool s_createFilesSparse
;
755 static wxString s_CustomBrowser
;
756 static bool s_BrowserTab
; // Jacobo221 - Open in tabs if possible
758 static CPath s_OSDirectory
;
759 static uint16 s_OSUpdate
;
761 static wxString s_Skin
;
763 static bool s_FastED2KLinksHandler
; // Madcat - Toggle Fast ED2K Links Handler
766 static bool s_MustFilterMessages
;
767 static wxString s_MessageFilterString
;
768 static bool s_FilterAllMessages
;
769 static bool s_FilterSomeMessages
;
770 static bool s_ShowMessagesInLog
;
771 static bool s_IsAdvancedSpamfilterEnabled
;
772 static bool s_IsChatCaptchaEnabled
;
774 static bool s_FilterComments
;
775 static wxString s_CommentFilterString
;
778 // Hidden files sharing
779 static bool s_ShareHiddenFiles
;
781 static bool s_AutoSortDownload
;
784 static bool s_NewVersionCheck
;
787 static bool s_ConnectToKad
;
788 static bool s_ConnectToED2K
;
791 static unsigned s_maxClientVersions
; // 0 = unlimited
793 // Drop slow sources if needed
794 static bool s_DropSlowSources
;
796 static wxString s_Ed2kURL
;
797 static wxString s_KadURL
;
800 static bool s_IsClientCryptLayerSupported
;
801 static bool s_IsClientCryptLayerRequired
;
802 static bool s_bCryptLayerRequested
;
803 static uint32 s_dwKadUDPKey
;
804 static uint8 s_byCryptTCPPaddingLength
;
807 static bool s_GeoIPEnabled
;
808 static wxString s_GeoIPUpdateUrl
;
811 static bool s_preventSleepWhileDownloading
;
814 static wxString s_StatsServerName
;
815 static wxString s_StatsServerURL
;
819 #endif // PREFERENCES_H
820 // File_checked_for_headers