2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2008 Merkur ( devs@emule-project.net / http://www.emule-project.net )
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"
42 enum EViewSharedFilesAccess
{
49 * Base-class for automatically loading and saving of preferences.
51 * The purpose of this class is to perform two tasks:
52 * 1) To load and save a variable using wxConfig
53 * 2) If nescecarry, to syncronize it with a widget
55 * This pure-virtual class servers as the base of all the Cfg types
56 * defined below, and exposes the entire interface.
58 * Please note that for reasons of simplicity these classes dont provide
59 * direct access to the variables they maintain, as there is no real need
62 * To create a sub-class you need only provide the Load/Save functionality,
63 * as it is given that not all variables have a widget assosiated.
71 * @param keyname This is the keyname under which the variable is to be saved.
73 Cfg_Base( const wxString
& keyname
)
81 virtual ~Cfg_Base() {}
84 * This function loads the assosiated variable from the provided config object.
86 virtual void LoadFromFile(wxConfigBase
* cfg
) = 0;
88 * This function saves the assosiated variable to the provided config object.
90 virtual void SaveToFile(wxConfigBase
* cfg
) = 0;
93 * Syncs the variable with the contents of the widget.
95 * @return True of success, false otherwise.
97 virtual bool TransferFromWindow() { return false; }
99 * Syncs the widget with the contents of the variable.
101 * @return True of success, false otherwise.
103 virtual bool TransferToWindow() { return false; }
106 * Connects a widget with the specified ID to the Cfg object.
108 * @param id The ID of the widget.
109 * @param parent A pointer to the widgets parent, to speed up searches.
110 * @return True on success, false otherwise.
112 * This function only makes sense for Cfg-classes that have the capability
113 * to interact with a widget, see Cfg_Tmpl::ConnectToWidget().
115 virtual bool ConnectToWidget( int WXUNUSED(id
), wxWindow
* WXUNUSED(parent
) = NULL
) { return false; }
118 * Gets the key assosiated with Cfg object.
120 * @return The config-key of this object.
122 virtual const wxString
& GetKey() { return m_key
; }
126 * Specifies if the variable has changed since the TransferFromWindow() call.
128 * @return True if the variable has changed, false otherwise.
130 virtual bool HasChanged() { return m_changed
; }
135 * Sets the changed status.
137 * @param changed The new status.
139 virtual void SetChanged( bool changed
)
146 //! The Config-key under which to save the variable
149 //! The changed-status of the variable
154 class Cfg_Lang_Base
{
156 virtual void UpdateChoice(int pos
);
159 const int cntStatColors
= 15;
162 //! This typedef is a shortcut similar to the theApp shortcut, but uses :: instead of .
163 //! It only allows access to static preference functions, however this is to be desired anyway.
164 typedef CPreferences thePrefs
;
170 friend class PrefsUnifiedDlg
;
177 void ReloadSharedFolders();
179 static bool Score() { return s_scorsystem
; }
180 static void SetScoreSystem(bool val
) { s_scorsystem
= val
; }
181 static bool Reconnect() { return s_reconnect
; }
182 static void SetReconnect(bool val
) { s_reconnect
= val
; }
183 static bool DeadServer() { return s_deadserver
; }
184 static void SetDeadServer(bool val
) { s_deadserver
= val
; }
185 static const wxString
& GetUserNick() { return s_nick
; }
186 static void SetUserNick(const wxString
& nick
) { s_nick
= nick
; }
187 static Cfg_Lang_Base
* GetCfgLang() { return s_cfgLang
; }
189 static const wxString
& GetAddress() { return s_Addr
; }
190 static uint16
GetPort() { return s_port
; }
191 static void SetPort(uint16 val
);
192 static uint16
GetUDPPort() { return s_udpport
; }
193 static uint16
GetEffectiveUDPPort() { return s_UDPEnable
? s_udpport
: 0; }
194 static void SetUDPPort(uint16 val
) { s_udpport
= val
; }
195 static bool IsUDPDisabled() { return !s_UDPEnable
; }
196 static void SetUDPDisable(bool val
) { s_UDPEnable
= !val
; }
197 static const CPath
& GetIncomingDir() { return s_incomingdir
; }
198 static void SetIncomingDir(const CPath
& dir
){ s_incomingdir
= dir
; }
199 static const CPath
& GetTempDir() { return s_tempdir
; }
200 static void SetTempDir(const CPath
& dir
) { s_tempdir
= dir
; }
201 static const CMD4Hash
& GetUserHash() { return s_userhash
; }
202 static void SetUserHash(const CMD4Hash
& h
) { s_userhash
= h
; }
203 static uint16
GetMaxUpload() { return s_maxupload
; }
204 static uint16
GetSlotAllocation() { return s_slotallocation
; }
205 static bool IsICHEnabled() { return s_ICH
; }
206 static void SetICHEnabled(bool val
) { s_ICH
= val
; }
207 static bool IsTrustingEveryHash() { return s_AICHTrustEveryHash
; }
208 static void SetTrustingEveryHash(bool val
) { s_AICHTrustEveryHash
= val
; }
209 static bool AutoServerlist() { return s_autoserverlist
; }
210 static void SetAutoServerlist(bool val
) { s_autoserverlist
= val
; }
211 static bool DoMinToTray() { return s_mintotray
; }
212 static void SetMinToTray(bool val
) { s_mintotray
= val
; }
213 static bool UseTrayIcon() { return s_trayiconenabled
; }
214 static void SetUseTrayIcon(bool val
) { s_trayiconenabled
= val
; }
215 static bool DoAutoConnect() { return s_autoconnect
; }
216 static void SetAutoConnect(bool inautoconnect
)
217 {s_autoconnect
= inautoconnect
; }
218 static bool AddServersFromServer() { return s_addserversfromserver
; }
219 static void SetAddServersFromServer(bool val
) { s_addserversfromserver
= val
; }
220 static bool AddServersFromClient() { return s_addserversfromclient
; }
221 static void SetAddServersFromClient(bool val
) { s_addserversfromclient
= val
; }
222 static uint16
GetTrafficOMeterInterval() { return s_trafficOMeterInterval
; }
223 static void SetTrafficOMeterInterval(uint16 in
)
224 { s_trafficOMeterInterval
= in
; }
225 static uint16
GetStatsInterval() { return s_statsInterval
;}
226 static void SetStatsInterval(uint16 in
) { s_statsInterval
= in
; }
227 static void Add2TotalDownloaded(uint64 in
) { s_totalDownloadedBytes
+= in
; }
228 static void Add2TotalUploaded(uint64 in
) { s_totalUploadedBytes
+= in
; }
229 static uint64
GetTotalDownloaded() { return s_totalDownloadedBytes
; }
230 static uint64
GetTotalUploaded() { return s_totalUploadedBytes
; }
231 static bool IsConfirmExitEnabled() { return s_confirmExit
; }
232 static bool FilterLanIPs() { return s_filterLanIP
; }
233 static void SetFilterLanIPs(bool val
) { s_filterLanIP
= val
; }
234 static bool ParanoidFilter() { return s_paranoidfilter
; }
235 static void SetParanoidFilter(bool val
) { s_paranoidfilter
= val
; }
236 static bool IsOnlineSignatureEnabled() { return s_onlineSig
; }
237 static void SetOnlineSignatureEnabled(bool val
) { s_onlineSig
= val
; }
238 static uint32
GetMaxGraphUploadRate() { return s_maxGraphUploadRate
; }
239 static uint32
GetMaxGraphDownloadRate() { return s_maxGraphDownloadRate
; }
240 static void SetMaxGraphUploadRate(uint32 in
){ s_maxGraphUploadRate
=in
; }
241 static void SetMaxGraphDownloadRate(uint32 in
)
242 { s_maxGraphDownloadRate
= in
; }
244 static uint16
GetMaxDownload() { return s_maxdownload
; }
245 static uint16
GetMaxConnections() { return s_maxconnections
; }
246 static uint16
GetMaxSourcePerFile() { return s_maxsourceperfile
; }
247 static uint16
GetMaxSourcePerFileSoft() {
248 uint16 temp
= (uint16
)(s_maxsourceperfile
*0.9);
249 if( temp
> 1000 ) return 1000;
251 static uint16
GetMaxSourcePerFileUDP() {
252 uint16 temp
= (uint16
)(s_maxsourceperfile
*0.75);
253 if( temp
> 100 ) return 100;
255 static uint16
GetDeadserverRetries() { return s_deadserverretries
; }
256 static void SetDeadserverRetries(uint16 val
) { s_deadserverretries
= val
; }
257 static uint32
GetServerKeepAliveTimeout() { return s_dwServerKeepAliveTimeoutMins
*60000; }
258 static void SetServerKeepAliveTimeout(uint32 val
) { s_dwServerKeepAliveTimeoutMins
= val
/60000; }
260 static const wxString
& GetLanguageID() { return s_languageID
; }
261 static void SetLanguageID(const wxString
& new_id
) { s_languageID
= new_id
; }
262 static uint8
CanSeeShares() { return s_iSeeShares
; }
263 static void SetCanSeeShares(uint8 val
) { s_iSeeShares
= val
; }
265 static uint8
GetStatsMax() { return s_statsMax
; }
266 static bool UseFlatBar() { return (s_depth3D
==0); }
267 static uint8
GetStatsAverageMinutes() { return s_statsAverageMinutes
; }
268 static void SetStatsAverageMinutes(uint8 in
){ s_statsAverageMinutes
= in
; }
270 static bool GetStartMinimized() { return s_startMinimized
; }
271 static void SetStartMinimized(bool instartMinimized
)
272 { s_startMinimized
= instartMinimized
;}
273 static bool GetSmartIdCheck() { return s_smartidcheck
; }
274 static void SetSmartIdCheck( bool in_smartidcheck
)
275 { s_smartidcheck
= in_smartidcheck
; }
276 static uint8
GetSmartIdState() { return s_smartidstate
; }
277 static void SetSmartIdState( uint8 in_smartidstate
)
278 { s_smartidstate
= in_smartidstate
; }
279 static bool GetVerbose() { return s_bVerbose
; }
280 static void SetVerbose(bool val
) { s_bVerbose
= val
; }
281 static bool GetPreviewPrio() { return s_bpreviewprio
; }
282 static void SetPreviewPrio(bool in
) { s_bpreviewprio
= in
; }
283 static bool TransferFullChunks() { return s_btransferfullchunks
; }
284 static void SetTransferFullChunks( bool m_bintransferfullchunks
)
285 {s_btransferfullchunks
= m_bintransferfullchunks
; }
286 static bool StartNextFile() { return s_bstartnextfile
; }
287 static bool StartNextFileSame() { return s_bstartnextfilesame
; }
288 static void SetStartNextFile(bool val
) { s_bstartnextfile
= val
; }
289 static void SetStartNextFileSame(bool val
) { s_bstartnextfilesame
= val
; }
290 static bool ShowOverhead() { return s_bshowoverhead
; }
291 static void SetNewAutoUp(bool m_bInUAP
) { s_bUAP
= m_bInUAP
; }
292 static bool GetNewAutoUp() { return s_bUAP
; }
293 static void SetNewAutoDown(bool m_bInDAP
) { s_bDAP
= m_bInDAP
; }
294 static bool GetNewAutoDown() { return s_bDAP
; }
296 static const wxString
& GetVideoPlayer() { return s_VideoPlayer
; }
298 static uint32
GetFileBufferSize() { return s_iFileBufferSize
*15000; }
299 static void SetFileBufferSize(uint32 val
) { s_iFileBufferSize
= val
/15000; }
300 static uint32
GetQueueSize() { return s_iQueueSize
*100; }
301 static void SetQueueSize(uint32 val
) { s_iQueueSize
= val
/100; }
303 static uint8
Get3DDepth() { return s_depth3D
;}
304 static bool AddNewFilesPaused() { return s_addnewfilespaused
; }
305 static void SetAddNewFilesPaused(bool val
) { s_addnewfilespaused
= val
; }
307 static void SetMaxConsPerFive(int in
) { s_MaxConperFive
=in
; }
309 static uint16
GetMaxConperFive() { return s_MaxConperFive
; }
310 static uint16
GetDefaultMaxConperFive();
312 static bool IsSafeServerConnectEnabled() { return s_safeServerConnect
; }
313 static void SetSafeServerConnectEnabled(bool val
) { s_safeServerConnect
= val
; }
315 static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace
; }
316 static void SetCheckDiskspaceEnabled(bool val
) { s_checkDiskspace
= val
; }
317 static uint32
GetMinFreeDiskSpaceMB() { return s_uMinFreeDiskSpace
; }
318 static uint64
GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace
* 1048576ull; }
319 static void SetMinFreeDiskSpaceMB(uint32 val
) { s_uMinFreeDiskSpace
= val
; }
321 static const wxString
& GetYourHostname() { return s_yourHostname
; }
322 static void SetYourHostname(const wxString
& s
) { s_yourHostname
= s
; }
324 static void SetMaxUpload(uint16 in
);
325 static void SetMaxDownload(uint16 in
);
326 static void SetSlotAllocation(uint16 in
) { s_slotallocation
= (in
>= 1) ? in
: 1; };
328 typedef std::vector
<CPath
> PathList
;
329 PathList shareddir_list
;
331 wxArrayString adresses_list
;
333 static bool AutoConnectStaticOnly() { return s_autoconnectstaticonly
; }
334 static void SetAutoConnectStaticOnly(bool val
) { s_autoconnectstaticonly
= val
; }
335 static bool GetUPnPEnabled() { return s_UPnPEnabled
; }
336 static void SetUPnPEnabled(bool val
) { s_UPnPEnabled
= val
; }
337 static bool GetUPnPECEnabled() { return s_UPnPECEnabled
; }
338 static void SetUPnPECEnabled(bool val
) { s_UPnPECEnabled
= val
; }
339 static bool GetUPnPWebServerEnabled() { return s_UPnPWebServerEnabled
; }
340 static void SetUPnPWebServerEnabled(bool val
){ s_UPnPWebServerEnabled
= val
; }
341 static uint16
GetUPnPTCPPort() { return s_UPnPTCPPort
; }
342 static void SetUPnPTCPPort(uint16 val
) { s_UPnPTCPPort
= val
; }
343 static bool IsManualHighPrio() { return s_bmanualhighprio
; }
344 static void SetManualHighPrio(bool val
) { s_bmanualhighprio
= val
; }
346 static const wxString
& GetDateTimeFormat() { return s_datetimeformat
; }
347 // Download Categories
348 uint32
AddCat(Category_Struct
* cat
);
349 void RemoveCat(size_t index
);
350 uint32
GetCatCount();
351 Category_Struct
* GetCategory(size_t index
);
352 const CPath
& GetCatPath(uint8 index
);
353 uint32
GetCatColor(size_t index
);
354 bool CreateCategory(Category_Struct
*& category
, const wxString
& name
, const CPath
& path
,
355 const wxString
& comment
, uint32 color
, uint8 prio
);
356 bool UpdateCategory(uint8 cat
, const wxString
& name
, const CPath
& path
,
357 const wxString
& comment
, uint32 color
, uint8 prio
);
359 static uint32
GetAllcatType() { return s_allcatType
; }
360 static void SetAllcatType(uint32 in
) { s_allcatType
= in
; }
361 static bool ShowAllNotCats() { return s_showAllNotCats
; }
364 static uint16
GetWSPort() { return s_nWebPort
; }
365 static void SetWSPort(uint16 uPort
) { s_nWebPort
=uPort
; }
366 static uint16
GetWebUPnPTCPPort() { return s_nWebUPnPTCPPort
; }
367 static void SetWebUPnPTCPPort(uint16 val
) { s_nWebUPnPTCPPort
= val
; }
368 static const wxString
& GetWSPass() { return s_sWebPassword
; }
369 static void SetWSPass(const wxString
& pass
) { s_sWebPassword
= pass
; }
370 static const wxString
& GetWSPath() { return s_sWebPath
; }
371 static void SetWSPath(const wxString
& path
) { s_sWebPath
= path
; }
372 static bool GetWSIsEnabled() { return s_bWebEnabled
; }
373 static void SetWSIsEnabled(bool bEnable
) { s_bWebEnabled
=bEnable
; }
374 static bool GetWebUseGzip() { return s_bWebUseGzip
; }
375 static void SetWebUseGzip(bool bUse
) { s_bWebUseGzip
=bUse
; }
376 static uint32
GetWebPageRefresh() { return s_nWebPageRefresh
; }
377 static void SetWebPageRefresh(uint32 nRefresh
) { s_nWebPageRefresh
=nRefresh
; }
378 static bool GetWSIsLowUserEnabled() { return s_bWebLowEnabled
; }
379 static void SetWSIsLowUserEnabled(bool in
) { s_bWebLowEnabled
=in
; }
380 static const wxString
& GetWSLowPass() { return s_sWebLowPassword
; }
381 static void SetWSLowPass(const wxString
& pass
) { s_sWebLowPassword
= pass
; }
382 static const wxString
& GetWebTemplate() { return s_WebTemplate
; }
383 static void SetWebTemplate(const wxString
& val
) { s_WebTemplate
= val
; }
385 static void SetMaxSourcesPerFile(uint16 in
) { s_maxsourceperfile
=in
;}
386 static void SetMaxConnections(uint16 in
) { s_maxconnections
=in
;}
388 static bool ShowCatTabInfos() { return s_showCatTabInfos
; }
389 static void ShowCatTabInfos(bool in
) { s_showCatTabInfos
=in
; }
391 // Sources Dropping Tweaks
392 static bool DropNoNeededSources() { return s_NoNeededSources
> 0; }
393 static bool SwapNoNeededSources() { return s_NoNeededSources
== 2; }
394 static uint8
GetNoNeededSources() { return s_NoNeededSources
; }
395 static void SetNoNeededSources(uint8 val
) { s_NoNeededSources
= val
; }
396 static bool DropFullQueueSources() { return s_DropFullQueueSources
; }
397 static void SetDropFullQueueSources(bool val
) { s_DropFullQueueSources
= val
; }
398 static bool DropHighQueueRankingSources() { return s_DropHighQueueRankingSources
; }
399 static void SetDropHighQueueRankingSources(bool val
) { s_DropHighQueueRankingSources
= val
; }
400 static uint32
HighQueueRanking() { return s_HighQueueRanking
; }
401 static void SetHighQueueRanking(uint32 val
) { s_HighQueueRanking
= val
; }
402 static uint32
GetAutoDropTimer() { return s_AutoDropTimer
; }
403 static void SetAutoDropTimer(uint32 val
) { s_AutoDropTimer
= val
; }
405 // External Connections
406 static bool AcceptExternalConnections() { return s_AcceptExternalConnections
; }
407 static void EnableExternalConnections( bool val
) { s_AcceptExternalConnections
= val
; }
408 static const wxString
& GetECAddress() { return s_ECAddr
; }
409 static uint32
ECPort() { return s_ECPort
; }
410 static void SetECPort(uint32 val
) { s_ECPort
= val
; }
411 static const wxString
& ECPassword() { return s_ECPassword
; }
412 static void SetECPass(const wxString
& pass
) { s_ECPassword
= pass
; }
413 // Fast ED2K Links Handler Toggling
414 static bool GetFED2KLH() { return s_FastED2KLinksHandler
; }
417 static bool IsFilteringClients() { return s_IPFilterClients
; }
418 static void SetFilteringClients(bool val
);
419 static bool IsFilteringServers() { return s_IPFilterServers
; }
420 static void SetFilteringServers(bool val
);
421 static uint8
GetIPFilterLevel() { return s_filterlevel
;}
422 static void SetIPFilterLevel(uint8 level
);
423 static bool IPFilterAutoLoad() { return s_IPFilterAutoLoad
; }
424 static void SetIPFilterAutoLoad(bool val
) { s_IPFilterAutoLoad
= val
; }
425 static const wxString
& IPFilterURL() { return s_IPFilterURL
; }
426 static void SetIPFilterURL(const wxString
& url
) { s_IPFilterURL
= url
; }
427 static bool UseIPFilterSystem() { return s_IPFilterSys
; }
428 static void SetIPFilterSystem(bool val
) { s_IPFilterSys
= val
; }
430 // Source seeds On/Off
431 static bool GetSrcSeedsOn() { return s_UseSrcSeeds
; }
432 static void SetSrcSeedsOn(bool val
) { s_UseSrcSeeds
= val
; }
434 static bool IsSecureIdentEnabled() { return s_SecIdent
; }
435 static void SetSecureIdentEnabled(bool val
) { s_SecIdent
= val
; }
437 static bool GetExtractMetaData() { return s_ExtractMetaData
; }
438 static void SetExtractMetaData(bool val
) { s_ExtractMetaData
= val
; }
440 static bool ShowProgBar() { return s_ProgBar
; }
441 static bool ShowPercent() { return s_Percent
; }
443 static bool GetAllocFullFile() { return s_allocFullFile
; };
444 static void SetAllocFullFile(bool val
) { s_allocFullFile
= val
; }
446 static wxString
GetBrowser();
448 static const wxString
& GetSkin() { return s_Skin
; }
450 static bool VerticalToolbar() { return s_ToolbarOrientation
; }
452 static const CPath
& GetOSDir() { return s_OSDirectory
; }
453 static uint16
GetOSUpdate() { return s_OSUpdate
; }
455 static uint8
GetToolTipDelay() { return s_iToolDelayTime
; }
457 static void UnsetAutoServerStart();
458 static void CheckUlDlRatio();
460 static void BuildItemList( const wxString
& appdir
);
461 static void EraseItemList();
463 static void LoadAllItems(wxConfigBase
* cfg
);
464 static void SaveAllItems(wxConfigBase
* cfg
);
466 static uint8_t GetShowRatesOnTitle() { return s_showRatesOnTitle
; }
467 static void SetShowRatesOnTitle(uint8_t val
) { s_showRatesOnTitle
= val
; }
471 static bool MustFilterMessages() { return s_MustFilterMessages
; }
472 static void SetMustFilterMessages(bool val
) { s_MustFilterMessages
= val
; }
473 static bool IsFilterAllMessages() { return s_FilterAllMessages
; }
474 static void SetFilterAllMessages(bool val
) { s_FilterAllMessages
= val
; }
475 static bool MsgOnlyFriends() { return s_msgonlyfriends
;}
476 static void SetMsgOnlyFriends(bool val
) { s_msgonlyfriends
= val
; }
477 static bool MsgOnlySecure() { return s_msgsecure
;}
478 static void SetMsgOnlySecure(bool val
) { s_msgsecure
= val
; }
479 static bool IsFilterByKeywords() { return s_FilterSomeMessages
; }
480 static void SetFilterByKeywords(bool val
) { s_FilterSomeMessages
= val
; }
481 static const wxString
& GetMessageFilterString() { return s_MessageFilterString
; }
482 static void SetMessageFilterString(const wxString
& val
) { s_MessageFilterString
= val
; }
483 static bool IsMessageFiltered(const wxString
& message
);
484 static bool ShowMessagesInLog() { return s_ShowMessagesInLog
; }
485 static bool IsAdvancedSpamfilterEnabled() { return s_IsAdvancedSpamfilterEnabled
;}
486 static bool IsChatCaptchaEnabled() { return IsAdvancedSpamfilterEnabled() && s_IsChatCaptchaEnabled
; }
488 static bool FilterComments() { return s_FilterComments
; }
489 static void SetFilterComments(bool val
) { s_FilterComments
= val
; }
490 static const wxString
& GetCommentFilterString() { return s_CommentFilterString
; }
491 static void SetCommentFilterString(const wxString
& val
) { s_CommentFilterString
= val
; }
492 static bool IsCommentFiltered(const wxString
& comment
);
494 // Can't have it return a reference, will need a pointer later.
495 static const CProxyData
*GetProxyData() { return &s_ProxyData
; }
499 static bool ShareHiddenFiles() { return s_ShareHiddenFiles
; }
500 static void SetShareHiddenFiles(bool val
) { s_ShareHiddenFiles
= val
; }
502 static bool AutoSortDownload() { return s_AutoSortDownload
; }
503 static bool AutoSortDownload(bool val
) { bool tmp
= s_AutoSortDownload
; s_AutoSortDownload
= val
; return tmp
; }
507 static bool GetCheckNewVersion() { return s_NewVersionCheck
; }
508 static void SetCheckNewVersion(bool val
) { s_NewVersionCheck
= val
; }
511 static bool GetNetworkKademlia() { return s_ConnectToKad
; }
512 static void SetNetworkKademlia(bool val
) { s_ConnectToKad
= val
; }
513 static bool GetNetworkED2K() { return s_ConnectToED2K
; }
514 static void SetNetworkED2K(bool val
) { s_ConnectToED2K
= val
; }
517 static unsigned GetMaxClientVersions() { return s_maxClientVersions
; }
519 // Dropping slow sources
520 static bool GetDropSlowSources() { return s_DropSlowSources
; }
522 // server.met and nodes.dat urls
523 static const wxString
& GetKadNodesUrl() { return s_KadURL
; }
524 static void SetKadNodesUrl(const wxString
& url
) { s_KadURL
= url
; }
526 static const wxString
& GetEd2kServersUrl() { return s_Ed2kURL
; }
527 static void SetEd2kServersUrl(const wxString
& url
) { s_Ed2kURL
= url
; }
530 static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported
;}
531 static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested
;}
532 static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired
;}
533 static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered
534 static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();}
535 static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();}
536 static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();}
537 static uint32
GetKadUDPKey() {return s_dwKadUDPKey
;}
538 static uint8
GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength
;}
540 static void SetClientCryptLayerSupported(bool v
) {s_IsClientCryptLayerSupported
= v
;}
541 static void SetClientCryptLayerRequested(bool v
) {s_bCryptLayerRequested
= v
; }
542 static void SetClientCryptLayerRequired(bool v
) {s_IsClientCryptLayerRequired
= v
;}
545 static bool IsGeoIPEnabled() {return s_GeoIPEnabled
;}
546 static void SetGeoIPEnabled(bool v
) {s_GeoIPEnabled
= v
;}
547 static const wxString
& GetGeoIPUpdateUrl() {return s_GeoIPUpdateUrl
;}
550 static wxString
GetLastHTTPDownloadURL(uint8 t
);
551 static void SetLastHTTPDownloadURL(uint8 t
, const wxString
& val
);
554 static int32
GetRecommendedMaxConnections();
556 //! Temporary storage for statistic-colors.
557 static unsigned long s_colors
[cntStatColors
];
558 //! Reference for checking if the colors has changed.
559 static unsigned long s_colors_ref
[cntStatColors
];
561 typedef std::vector
<Cfg_Base
*> CFGList
;
562 typedef std::map
<int, Cfg_Base
*> CFGMap
;
563 typedef std::vector
<Category_Struct
*> CatList
;
566 static CFGMap s_CfgList
;
567 static CFGList s_MiscList
;
571 void LoadPreferences();
572 void SavePreferences();
576 static wxString s_nick
;
578 static CMD4Hash s_userhash
;
580 static Cfg_Lang_Base
* s_cfgLang
;
582 ////////////// CONNECTION
583 static uint16 s_maxupload
;
584 static uint16 s_maxdownload
;
585 static uint16 s_slotallocation
;
586 static wxString s_Addr
;
587 static uint16 s_port
;
588 static uint16 s_udpport
;
589 static bool s_UDPEnable
;
590 static uint16 s_maxconnections
;
591 static bool s_reconnect
;
592 static bool s_autoconnect
;
593 static bool s_autoconnectstaticonly
;
594 static bool s_UPnPEnabled
;
595 static bool s_UPnPECEnabled
;
596 static bool s_UPnPWebServerEnabled
;
597 static uint16 s_UPnPTCPPort
;
600 static CProxyData s_ProxyData
;
602 ////////////// SERVERS
603 static bool s_autoserverlist
;
604 static bool s_deadserver
;
607 static CPath s_incomingdir
;
608 static CPath s_tempdir
;
610 static bool s_AICHTrustEveryHash
;
613 static uint8 s_depth3D
;
615 static bool s_scorsystem
;
616 static bool s_mintotray
;
617 static bool s_trayiconenabled
;
618 static bool s_addnewfilespaused
;
619 static bool s_addserversfromserver
;
620 static bool s_addserversfromclient
;
621 static uint16 s_maxsourceperfile
;
622 static uint16 s_trafficOMeterInterval
;
623 static uint16 s_statsInterval
;
624 static uint32 s_maxGraphDownloadRate
;
625 static uint32 s_maxGraphUploadRate
;
626 static bool s_confirmExit
;
629 static bool s_filterLanIP
;
630 static bool s_paranoidfilter
;
631 static bool s_onlineSig
;
633 static uint64 s_totalDownloadedBytes
;
634 static uint64 s_totalUploadedBytes
;
635 static wxString s_languageID
;
636 static uint8 s_iSeeShares
; // 0=everybody 1=friends only 2=noone
637 static uint8 s_iToolDelayTime
; // tooltip delay time in seconds
638 static uint8 s_splitterbarPosition
;
639 static uint16 s_deadserverretries
;
640 static uint32 s_dwServerKeepAliveTimeoutMins
;
642 static uint8 s_statsMax
;
643 static uint8 s_statsAverageMinutes
;
645 static bool s_bpreviewprio
;
646 static bool s_smartidcheck
;
647 static uint8 s_smartidstate
;
648 static bool s_safeServerConnect
;
649 static bool s_startMinimized
;
650 static uint16 s_MaxConperFive
;
651 static bool s_checkDiskspace
;
652 static uint32 s_uMinFreeDiskSpace
;
653 static wxString s_yourHostname
;
654 static bool s_bVerbose
;
655 static bool s_bmanualhighprio
;
656 static bool s_btransferfullchunks
;
657 static bool s_bstartnextfile
;
658 static bool s_bstartnextfilesame
;
659 static bool s_bshowoverhead
;
663 static uint8_t s_showRatesOnTitle
; // 0=no, 1=after app name, 2=before app name
665 static wxString s_VideoPlayer
;
666 static bool s_showAllNotCats
;
668 static bool s_msgonlyfriends
;
669 static bool s_msgsecure
;
671 static uint8 s_iFileBufferSize
;
672 static uint8 s_iQueueSize
;
674 static wxString s_datetimeformat
;
676 static bool s_ToolbarOrientation
;
678 // Web Server [kuchin]
679 static wxString s_sWebPassword
;
680 static wxString s_sWebPath
;
681 static wxString s_sWebLowPassword
;
682 static uint16 s_nWebPort
;
683 static uint16 s_nWebUPnPTCPPort
;
684 static bool s_bWebEnabled
;
685 static bool s_bWebUseGzip
;
686 static uint32 s_nWebPageRefresh
;
687 static bool s_bWebLowEnabled
;
688 static wxString s_WebTemplate
;
690 static bool s_showCatTabInfos
;
691 static uint32 s_allcatType
;
693 // Madcat - Sources Dropping Tweaks
694 static uint8 s_NoNeededSources
; // 0: Keep, 1: Drop, 2:Swap
695 static bool s_DropFullQueueSources
;
696 static bool s_DropHighQueueRankingSources
;
697 static uint32 s_HighQueueRanking
;
698 static uint32 s_AutoDropTimer
;
700 // Kry - external connections
701 static bool s_AcceptExternalConnections
;
702 static wxString s_ECAddr
;
703 static uint32 s_ECPort
;
704 static wxString s_ECPassword
;
707 static bool s_IPFilterClients
;
708 static bool s_IPFilterServers
;
709 static uint8 s_filterlevel
;
710 static bool s_IPFilterAutoLoad
;
711 static wxString s_IPFilterURL
;
712 static bool s_IPFilterSys
;
714 // Kry - Source seeds on/off
715 static bool s_UseSrcSeeds
;
717 static bool s_ProgBar
;
718 static bool s_Percent
;
720 static bool s_SecIdent
;
722 static bool s_ExtractMetaData
;
724 static bool s_allocFullFile
;
726 static wxString s_CustomBrowser
;
727 static bool s_BrowserTab
; // Jacobo221 - Open in tabs if possible
729 static CPath s_OSDirectory
;
730 static uint16 s_OSUpdate
;
732 static wxString s_Skin
;
734 static bool s_FastED2KLinksHandler
; // Madcat - Toggle Fast ED2K Links Handler
737 static bool s_MustFilterMessages
;
738 static wxString s_MessageFilterString
;
739 static bool s_FilterAllMessages
;
740 static bool s_FilterSomeMessages
;
741 static bool s_ShowMessagesInLog
;
742 static bool s_IsAdvancedSpamfilterEnabled
;
743 static bool s_IsChatCaptchaEnabled
;
745 static bool s_FilterComments
;
746 static wxString s_CommentFilterString
;
749 // Hidden files sharing
750 static bool s_ShareHiddenFiles
;
752 static bool s_AutoSortDownload
;
755 static bool s_NewVersionCheck
;
758 static bool s_ConnectToKad
;
759 static bool s_ConnectToED2K
;
762 static unsigned s_maxClientVersions
; // 0 = unlimited
764 // Drop slow sources if needed
765 static bool s_DropSlowSources
;
767 static wxString s_Ed2kURL
;
768 static wxString s_KadURL
;
771 static bool s_IsClientCryptLayerSupported
;
772 static bool s_IsClientCryptLayerRequired
;
773 static bool s_bCryptLayerRequested
;
774 static uint32 s_dwKadUDPKey
;
775 static uint8 s_byCryptTCPPaddingLength
;
778 static bool s_GeoIPEnabled
;
779 static wxString s_GeoIPUpdateUrl
;
783 #endif // PREFERENCES_H
784 // File_checked_for_headers