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 DoAutoConnect() { return s_autoconnect
; }
237 static void SetAutoConnect(bool inautoconnect
)
238 {s_autoconnect
= inautoconnect
; }
239 static bool AddServersFromServer() { return s_addserversfromserver
; }
240 static void SetAddServersFromServer(bool val
) { s_addserversfromserver
= val
; }
241 static bool AddServersFromClient() { return s_addserversfromclient
; }
242 static void SetAddServersFromClient(bool val
) { s_addserversfromclient
= val
; }
243 static uint16
GetTrafficOMeterInterval() { return s_trafficOMeterInterval
; }
244 static void SetTrafficOMeterInterval(uint16 in
)
245 { s_trafficOMeterInterval
= in
; }
246 static uint16
GetStatsInterval() { return s_statsInterval
;}
247 static void SetStatsInterval(uint16 in
) { s_statsInterval
= in
; }
248 static bool IsConfirmExitEnabled() { return s_confirmExit
; }
249 static bool FilterLanIPs() { return s_filterLanIP
; }
250 static void SetFilterLanIPs(bool val
) { s_filterLanIP
= val
; }
251 static bool ParanoidFilter() { return s_paranoidfilter
; }
252 static void SetParanoidFilter(bool val
) { s_paranoidfilter
= val
; }
253 static bool IsOnlineSignatureEnabled() { return s_onlineSig
; }
254 static void SetOnlineSignatureEnabled(bool val
) { s_onlineSig
= val
; }
255 static uint32
GetMaxGraphUploadRate() { return s_maxGraphUploadRate
; }
256 static uint32
GetMaxGraphDownloadRate() { return s_maxGraphDownloadRate
; }
257 static void SetMaxGraphUploadRate(uint32 in
){ s_maxGraphUploadRate
=in
; }
258 static void SetMaxGraphDownloadRate(uint32 in
)
259 { s_maxGraphDownloadRate
= in
; }
261 static uint16
GetMaxDownload() { return s_maxdownload
; }
262 static uint16
GetMaxConnections() { return s_maxconnections
; }
263 static uint16
GetMaxSourcePerFile() { return s_maxsourceperfile
; }
264 static uint16
GetMaxSourcePerFileSoft() {
265 uint16 temp
= (uint16
)(s_maxsourceperfile
*0.9);
266 if( temp
> 1000 ) return 1000;
268 static uint16
GetMaxSourcePerFileUDP() {
269 uint16 temp
= (uint16
)(s_maxsourceperfile
*0.75);
270 if( temp
> 100 ) return 100;
272 static uint16
GetDeadserverRetries() { return s_deadserverretries
; }
273 static void SetDeadserverRetries(uint16 val
) { s_deadserverretries
= val
; }
274 static uint32
GetServerKeepAliveTimeout() { return s_dwServerKeepAliveTimeoutMins
*60000; }
275 static void SetServerKeepAliveTimeout(uint32 val
) { s_dwServerKeepAliveTimeoutMins
= val
/60000; }
277 static const wxString
& GetLanguageID() { return s_languageID
; }
278 static void SetLanguageID(const wxString
& new_id
) { s_languageID
= new_id
; }
279 static uint8
CanSeeShares() { return s_iSeeShares
; }
280 static void SetCanSeeShares(uint8 val
) { s_iSeeShares
= val
; }
282 static uint8
GetStatsMax() { return s_statsMax
; }
283 static bool UseFlatBar() { return (s_depth3D
==0); }
284 static uint8
GetStatsAverageMinutes() { return s_statsAverageMinutes
; }
285 static void SetStatsAverageMinutes(uint8 in
){ s_statsAverageMinutes
= in
; }
287 static bool GetStartMinimized() { return s_startMinimized
; }
288 static void SetStartMinimized(bool instartMinimized
)
289 { s_startMinimized
= instartMinimized
;}
290 static bool GetSmartIdCheck() { return s_smartidcheck
; }
291 static void SetSmartIdCheck( bool in_smartidcheck
)
292 { s_smartidcheck
= in_smartidcheck
; }
293 static uint8
GetSmartIdState() { return s_smartidstate
; }
294 static void SetSmartIdState( uint8 in_smartidstate
)
295 { s_smartidstate
= in_smartidstate
; }
296 static bool GetVerbose() { return s_bVerbose
; }
297 static void SetVerbose(bool val
) { s_bVerbose
= val
; }
298 static bool GetPreviewPrio() { return s_bpreviewprio
; }
299 static void SetPreviewPrio(bool in
) { s_bpreviewprio
= in
; }
300 static bool StartNextFile() { return s_bstartnextfile
; }
301 static bool StartNextFileSame() { return s_bstartnextfilesame
; }
302 static bool StartNextFileAlpha() { return s_bstartnextfilealpha
; }
303 static void SetStartNextFile(bool val
) { s_bstartnextfile
= val
; }
304 static void SetStartNextFileSame(bool val
) { s_bstartnextfilesame
= val
; }
305 static void SetStartNextFileAlpha(bool val
) { s_bstartnextfilealpha
= val
; }
306 static bool ShowOverhead() { return s_bshowoverhead
; }
307 static void SetNewAutoUp(bool m_bInUAP
) { s_bUAP
= m_bInUAP
; }
308 static bool GetNewAutoUp() { return s_bUAP
; }
309 static void SetNewAutoDown(bool m_bInDAP
) { s_bDAP
= m_bInDAP
; }
310 static bool GetNewAutoDown() { return s_bDAP
; }
312 static const wxString
& GetVideoPlayer() { return s_VideoPlayer
; }
314 static uint32
GetFileBufferSize() { return s_iFileBufferSize
*15000; }
315 static void SetFileBufferSize(uint32 val
) { s_iFileBufferSize
= val
/15000; }
316 static uint32
GetQueueSize() { return s_iQueueSize
*100; }
317 static void SetQueueSize(uint32 val
) { s_iQueueSize
= val
/100; }
319 static uint8
Get3DDepth() { return s_depth3D
;}
320 static bool AddNewFilesPaused() { return s_addnewfilespaused
; }
321 static void SetAddNewFilesPaused(bool val
) { s_addnewfilespaused
= val
; }
323 static void SetMaxConsPerFive(int in
) { s_MaxConperFive
=in
; }
325 static uint16
GetMaxConperFive() { return s_MaxConperFive
; }
326 static uint16
GetDefaultMaxConperFive();
328 static bool IsSafeServerConnectEnabled() { return s_safeServerConnect
; }
329 static void SetSafeServerConnectEnabled(bool val
) { s_safeServerConnect
= val
; }
331 static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace
; }
332 static void SetCheckDiskspaceEnabled(bool val
) { s_checkDiskspace
= val
; }
333 static uint32
GetMinFreeDiskSpaceMB() { return s_uMinFreeDiskSpace
; }
334 static uint64
GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace
* 1048576ull; }
335 static void SetMinFreeDiskSpaceMB(uint32 val
) { s_uMinFreeDiskSpace
= val
; }
337 static const wxString
& GetYourHostname() { return s_yourHostname
; }
338 static void SetYourHostname(const wxString
& s
) { s_yourHostname
= s
; }
340 static void SetMaxUpload(uint16 in
);
341 static void SetMaxDownload(uint16 in
);
342 static void SetSlotAllocation(uint16 in
) { s_slotallocation
= (in
>= 1) ? in
: 1; };
344 typedef std::vector
<CPath
> PathList
;
345 PathList shareddir_list
;
347 wxArrayString adresses_list
;
349 static bool AutoConnectStaticOnly() { return s_autoconnectstaticonly
; }
350 static void SetAutoConnectStaticOnly(bool val
) { s_autoconnectstaticonly
= val
; }
351 static bool GetUPnPEnabled() { return s_UPnPEnabled
; }
352 static void SetUPnPEnabled(bool val
) { s_UPnPEnabled
= val
; }
353 static bool GetUPnPECEnabled() { return s_UPnPECEnabled
; }
354 static void SetUPnPECEnabled(bool val
) { s_UPnPECEnabled
= val
; }
355 static bool GetUPnPWebServerEnabled() { return s_UPnPWebServerEnabled
; }
356 static void SetUPnPWebServerEnabled(bool val
){ s_UPnPWebServerEnabled
= val
; }
357 static uint16
GetUPnPTCPPort() { return s_UPnPTCPPort
; }
358 static void SetUPnPTCPPort(uint16 val
) { s_UPnPTCPPort
= val
; }
359 static bool IsManualHighPrio() { return s_bmanualhighprio
; }
360 static void SetManualHighPrio(bool val
) { s_bmanualhighprio
= val
; }
362 static const wxString
& GetDateTimeFormat() { return s_datetimeformat
; }
363 // Download Categories
364 uint32
AddCat(Category_Struct
* cat
);
365 void RemoveCat(size_t index
);
366 uint32
GetCatCount();
367 Category_Struct
* GetCategory(size_t index
);
368 const CPath
& GetCatPath(uint8 index
);
369 uint32
GetCatColor(size_t index
);
370 bool CreateCategory(Category_Struct
*& category
, const wxString
& name
, const CPath
& path
,
371 const wxString
& comment
, uint32 color
, uint8 prio
);
372 bool UpdateCategory(uint8 cat
, const wxString
& name
, const CPath
& path
,
373 const wxString
& comment
, uint32 color
, uint8 prio
);
375 static AllCategoryFilter
GetAllcatFilter() { return s_allcatFilter
; }
376 static void SetAllcatFilter(AllCategoryFilter in
) { s_allcatFilter
= in
; }
378 static bool ShowAllNotCats() { return s_showAllNotCats
; }
381 static uint16
GetWSPort() { return s_nWebPort
; }
382 static void SetWSPort(uint16 uPort
) { s_nWebPort
=uPort
; }
383 static uint16
GetWebUPnPTCPPort() { return s_nWebUPnPTCPPort
; }
384 static void SetWebUPnPTCPPort(uint16 val
) { s_nWebUPnPTCPPort
= val
; }
385 static const wxString
& GetWSPass() { return s_sWebPassword
; }
386 static void SetWSPass(const wxString
& pass
) { s_sWebPassword
= pass
; }
387 static const wxString
& GetWSPath() { return s_sWebPath
; }
388 static void SetWSPath(const wxString
& path
) { s_sWebPath
= path
; }
389 static bool GetWSIsEnabled() { return s_bWebEnabled
; }
390 static void SetWSIsEnabled(bool bEnable
) { s_bWebEnabled
=bEnable
; }
391 static bool GetWebUseGzip() { return s_bWebUseGzip
; }
392 static void SetWebUseGzip(bool bUse
) { s_bWebUseGzip
=bUse
; }
393 static uint32
GetWebPageRefresh() { return s_nWebPageRefresh
; }
394 static void SetWebPageRefresh(uint32 nRefresh
) { s_nWebPageRefresh
=nRefresh
; }
395 static bool GetWSIsLowUserEnabled() { return s_bWebLowEnabled
; }
396 static void SetWSIsLowUserEnabled(bool in
) { s_bWebLowEnabled
=in
; }
397 static const wxString
& GetWSLowPass() { return s_sWebLowPassword
; }
398 static void SetWSLowPass(const wxString
& pass
) { s_sWebLowPassword
= pass
; }
399 static const wxString
& GetWebTemplate() { return s_WebTemplate
; }
400 static void SetWebTemplate(const wxString
& val
) { s_WebTemplate
= val
; }
402 static void SetMaxSourcesPerFile(uint16 in
) { s_maxsourceperfile
=in
;}
403 static void SetMaxConnections(uint16 in
) { s_maxconnections
=in
;}
405 static bool ShowCatTabInfos() { return s_showCatTabInfos
; }
406 static void ShowCatTabInfos(bool in
) { s_showCatTabInfos
=in
; }
408 // Sources Dropping Tweaks
409 static bool DropNoNeededSources() { return s_NoNeededSources
> 0; }
410 static bool SwapNoNeededSources() { return s_NoNeededSources
== 2; }
411 static uint8
GetNoNeededSources() { return s_NoNeededSources
; }
412 static void SetNoNeededSources(uint8 val
) { s_NoNeededSources
= val
; }
413 static bool DropFullQueueSources() { return s_DropFullQueueSources
; }
414 static void SetDropFullQueueSources(bool val
) { s_DropFullQueueSources
= val
; }
415 static bool DropHighQueueRankingSources() { return s_DropHighQueueRankingSources
; }
416 static void SetDropHighQueueRankingSources(bool val
) { s_DropHighQueueRankingSources
= val
; }
417 static uint32
HighQueueRanking() { return s_HighQueueRanking
; }
418 static void SetHighQueueRanking(uint32 val
) { s_HighQueueRanking
= val
; }
419 static uint32
GetAutoDropTimer() { return s_AutoDropTimer
; }
420 static void SetAutoDropTimer(uint32 val
) { s_AutoDropTimer
= val
; }
422 // External Connections
423 static bool AcceptExternalConnections() { return s_AcceptExternalConnections
; }
424 static void EnableExternalConnections( bool val
) { s_AcceptExternalConnections
= val
; }
425 static const wxString
& GetECAddress() { return s_ECAddr
; }
426 static uint32
ECPort() { return s_ECPort
; }
427 static void SetECPort(uint32 val
) { s_ECPort
= val
; }
428 static const wxString
& ECPassword() { return s_ECPassword
; }
429 static void SetECPass(const wxString
& pass
) { s_ECPassword
= pass
; }
430 static bool IsTransmitOnlyUploadingClients() { return s_TransmitOnlyUploadingClients
; }
432 // Fast ED2K Links Handler Toggling
433 static bool GetFED2KLH() { return s_FastED2KLinksHandler
; }
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
);
486 static bool ShowVersionOnTitle() { return s_showVersionOnTitle
; }
488 static bool ShowVersionOnTitle() { return true; }
490 static uint8_t GetShowRatesOnTitle() { return s_showRatesOnTitle
; }
491 static void SetShowRatesOnTitle(uint8_t val
) { s_showRatesOnTitle
= val
; }
495 static bool MustFilterMessages() { return s_MustFilterMessages
; }
496 static void SetMustFilterMessages(bool val
) { s_MustFilterMessages
= val
; }
497 static bool IsFilterAllMessages() { return s_FilterAllMessages
; }
498 static void SetFilterAllMessages(bool val
) { s_FilterAllMessages
= val
; }
499 static bool MsgOnlyFriends() { return s_msgonlyfriends
;}
500 static void SetMsgOnlyFriends(bool val
) { s_msgonlyfriends
= val
; }
501 static bool MsgOnlySecure() { return s_msgsecure
;}
502 static void SetMsgOnlySecure(bool val
) { s_msgsecure
= val
; }
503 static bool IsFilterByKeywords() { return s_FilterSomeMessages
; }
504 static void SetFilterByKeywords(bool val
) { s_FilterSomeMessages
= val
; }
505 static const wxString
& GetMessageFilterString() { return s_MessageFilterString
; }
506 static void SetMessageFilterString(const wxString
& val
) { s_MessageFilterString
= val
; }
507 static bool IsMessageFiltered(const wxString
& message
);
508 static bool ShowMessagesInLog() { return s_ShowMessagesInLog
; }
509 static bool IsAdvancedSpamfilterEnabled() { return s_IsAdvancedSpamfilterEnabled
;}
510 static bool IsChatCaptchaEnabled() { return IsAdvancedSpamfilterEnabled() && s_IsChatCaptchaEnabled
; }
512 static bool FilterComments() { return s_FilterComments
; }
513 static void SetFilterComments(bool val
) { s_FilterComments
= val
; }
514 static const wxString
& GetCommentFilterString() { return s_CommentFilterString
; }
515 static void SetCommentFilterString(const wxString
& val
) { s_CommentFilterString
= val
; }
516 static bool IsCommentFiltered(const wxString
& comment
);
518 // Can't have it return a reference, will need a pointer later.
519 static const CProxyData
*GetProxyData() { return &s_ProxyData
; }
523 static bool ShareHiddenFiles() { return s_ShareHiddenFiles
; }
524 static void SetShareHiddenFiles(bool val
) { s_ShareHiddenFiles
= val
; }
526 static bool AutoSortDownload() { return s_AutoSortDownload
; }
527 static bool AutoSortDownload(bool val
) { bool tmp
= s_AutoSortDownload
; s_AutoSortDownload
= val
; return tmp
; }
531 static bool GetCheckNewVersion() { return s_NewVersionCheck
; }
532 static void SetCheckNewVersion(bool val
) { s_NewVersionCheck
= val
; }
535 static bool GetNetworkKademlia() { return s_ConnectToKad
; }
536 static void SetNetworkKademlia(bool val
) { s_ConnectToKad
= val
; }
537 static bool GetNetworkED2K() { return s_ConnectToED2K
; }
538 static void SetNetworkED2K(bool val
) { s_ConnectToED2K
= val
; }
541 static unsigned GetMaxClientVersions() { return s_maxClientVersions
; }
543 // Dropping slow sources
544 static bool GetDropSlowSources() { return s_DropSlowSources
; }
546 // server.met and nodes.dat urls
547 static const wxString
& GetKadNodesUrl() { return s_KadURL
; }
548 static void SetKadNodesUrl(const wxString
& url
) { s_KadURL
= url
; }
550 static const wxString
& GetEd2kServersUrl() { return s_Ed2kURL
; }
551 static void SetEd2kServersUrl(const wxString
& url
) { s_Ed2kURL
= url
; }
554 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported
;}
555 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested
;}
556 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired
;}
557 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
558 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
559 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
560 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
561 static uint32
GetKadUDPKey() {return s_dwKadUDPKey
;}
562 static uint8
GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength
;}
564 static void SetClientCryptLayerSupported(bool v
) {s_IsClientCryptLayerSupported
= v
;}
565 static void SetClientCryptLayerRequested(bool v
) {s_bCryptLayerRequested
= v
; }
566 static void SetClientCryptLayerRequired(bool v
) {s_IsClientCryptLayerRequired
= v
;}
569 static bool IsGeoIPEnabled() {return s_GeoIPEnabled
;}
570 static void SetGeoIPEnabled(bool v
) {s_GeoIPEnabled
= v
;}
571 static const wxString
& GetGeoIPUpdateUrl() {return s_GeoIPUpdateUrl
;}
574 static const wxString
& GetStatsServerName() {return s_StatsServerName
;}
575 static const wxString
& GetStatsServerURL() {return s_StatsServerURL
;}
578 static wxString
GetLastHTTPDownloadURL(uint8 t
);
579 static void SetLastHTTPDownloadURL(uint8 t
, const wxString
& val
);
582 static bool GetPreventSleepWhileDownloading() { return s_preventSleepWhileDownloading
; }
583 static void SetPreventSleepWhileDownloading(bool status
) { s_preventSleepWhileDownloading
= status
; }
585 static int32
GetRecommendedMaxConnections();
587 //! Temporary storage for statistic-colors.
588 static unsigned long s_colors
[cntStatColors
];
589 //! Reference for checking if the colors has changed.
590 static unsigned long s_colors_ref
[cntStatColors
];
592 typedef std::vector
<Cfg_Base
*> CFGList
;
593 typedef std::map
<int, Cfg_Base
*> CFGMap
;
594 typedef std::vector
<Category_Struct
*> CatList
;
597 static CFGMap s_CfgList
;
598 static CFGList s_MiscList
;
602 void LoadPreferences();
603 void SavePreferences();
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_mintotray
;
648 static bool s_trayiconenabled
;
649 static bool s_addnewfilespaused
;
650 static bool s_addserversfromserver
;
651 static bool s_addserversfromclient
;
652 static uint16 s_maxsourceperfile
;
653 static uint16 s_trafficOMeterInterval
;
654 static uint16 s_statsInterval
;
655 static uint32 s_maxGraphDownloadRate
;
656 static uint32 s_maxGraphUploadRate
;
657 static bool s_confirmExit
;
660 static bool s_filterLanIP
;
661 static bool s_paranoidfilter
;
662 static bool s_onlineSig
;
664 static wxString s_languageID
;
665 static uint8 s_iSeeShares
; // 0=everybody 1=friends only 2=noone
666 static uint8 s_iToolDelayTime
; // tooltip delay time in seconds
667 static uint8 s_splitterbarPosition
;
668 static uint16 s_deadserverretries
;
669 static uint32 s_dwServerKeepAliveTimeoutMins
;
671 static uint8 s_statsMax
;
672 static uint8 s_statsAverageMinutes
;
674 static bool s_bpreviewprio
;
675 static bool s_smartidcheck
;
676 static uint8 s_smartidstate
;
677 static bool s_safeServerConnect
;
678 static bool s_startMinimized
;
679 static uint16 s_MaxConperFive
;
680 static bool s_checkDiskspace
;
681 static uint32 s_uMinFreeDiskSpace
;
682 static wxString s_yourHostname
;
683 static bool s_bVerbose
;
684 static bool s_bmanualhighprio
;
685 static bool s_bstartnextfile
;
686 static bool s_bstartnextfilesame
;
687 static bool s_bstartnextfilealpha
;
688 static bool s_bshowoverhead
;
693 static bool s_showVersionOnTitle
;
695 static uint8_t s_showRatesOnTitle
; // 0=no, 1=after app name, 2=before app name
697 static wxString s_VideoPlayer
;
698 static bool s_showAllNotCats
;
700 static bool s_msgonlyfriends
;
701 static bool s_msgsecure
;
703 static uint8 s_iFileBufferSize
;
704 static uint8 s_iQueueSize
;
706 static wxString s_datetimeformat
;
708 static bool s_ToolbarOrientation
;
710 // Web Server [kuchin]
711 static wxString s_sWebPassword
;
712 static wxString s_sWebPath
;
713 static wxString s_sWebLowPassword
;
714 static uint16 s_nWebPort
;
715 static uint16 s_nWebUPnPTCPPort
;
716 static bool s_bWebEnabled
;
717 static bool s_bWebUseGzip
;
718 static uint32 s_nWebPageRefresh
;
719 static bool s_bWebLowEnabled
;
720 static wxString s_WebTemplate
;
722 static bool s_showCatTabInfos
;
723 static AllCategoryFilter s_allcatFilter
;
725 // Madcat - Sources Dropping Tweaks
726 static uint8 s_NoNeededSources
; // 0: Keep, 1: Drop, 2:Swap
727 static bool s_DropFullQueueSources
;
728 static bool s_DropHighQueueRankingSources
;
729 static uint32 s_HighQueueRanking
;
730 static uint32 s_AutoDropTimer
;
732 // Kry - external connections
733 static bool s_AcceptExternalConnections
;
734 static wxString s_ECAddr
;
735 static uint32 s_ECPort
;
736 static wxString s_ECPassword
;
737 static bool s_TransmitOnlyUploadingClients
;
740 static bool s_IPFilterClients
;
741 static bool s_IPFilterServers
;
742 static uint8 s_filterlevel
;
743 static bool s_IPFilterAutoLoad
;
744 static wxString s_IPFilterURL
;
745 static bool s_IPFilterSys
;
747 // Kry - Source seeds on/off
748 static bool s_UseSrcSeeds
;
750 static bool s_ProgBar
;
751 static bool s_Percent
;
753 static bool s_SecIdent
;
755 static bool s_ExtractMetaData
;
757 static bool s_allocFullFile
;
759 static wxString s_CustomBrowser
;
760 static bool s_BrowserTab
; // Jacobo221 - Open in tabs if possible
762 static CPath s_OSDirectory
;
763 static uint16 s_OSUpdate
;
765 static wxString s_Skin
;
767 static bool s_FastED2KLinksHandler
; // Madcat - Toggle Fast ED2K Links Handler
770 static bool s_MustFilterMessages
;
771 static wxString s_MessageFilterString
;
772 static bool s_FilterAllMessages
;
773 static bool s_FilterSomeMessages
;
774 static bool s_ShowMessagesInLog
;
775 static bool s_IsAdvancedSpamfilterEnabled
;
776 static bool s_IsChatCaptchaEnabled
;
778 static bool s_FilterComments
;
779 static wxString s_CommentFilterString
;
782 // Hidden files sharing
783 static bool s_ShareHiddenFiles
;
785 static bool s_AutoSortDownload
;
788 static bool s_NewVersionCheck
;
791 static bool s_ConnectToKad
;
792 static bool s_ConnectToED2K
;
795 static unsigned s_maxClientVersions
; // 0 = unlimited
797 // Drop slow sources if needed
798 static bool s_DropSlowSources
;
800 static wxString s_Ed2kURL
;
801 static wxString s_KadURL
;
804 static bool s_IsClientCryptLayerSupported
;
805 static bool s_IsClientCryptLayerRequired
;
806 static bool s_bCryptLayerRequested
;
807 static uint32 s_dwKadUDPKey
;
808 static uint8 s_byCryptTCPPaddingLength
;
811 static bool s_GeoIPEnabled
;
812 static wxString s_GeoIPUpdateUrl
;
815 static bool s_preventSleepWhileDownloading
;
818 static wxString s_StatsServerName
;
819 static wxString s_StatsServerURL
;
823 #endif // PREFERENCES_H
824 // File_checked_for_headers