1 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 /// Name: wxCasCte Structure
4 /// Purpose: Store constants used in wxCas application
6 /// Author: ThePolish <thepolish@vipmail.ru>
8 /// Copyright (C) 2004 by ThePolish
10 /// Derived from CAS by Pedro de Oliveira <falso@rdk.homeip.net>
12 /// Pixmats from aMule http://www.amule.org
14 /// This program is free software; you can redistribute it and/or modify
15 /// it under the terms of the GNU General Public License as published by
16 /// the Free Software Foundation; either version 2 of the License, or
17 /// (at your option) any later version.
19 /// This program is distributed in the hope that it will be useful,
20 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
21 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 /// GNU General Public License for more details.
24 /// You should have received a copy of the GNU General Public License
25 /// along with this program; if not, write to the
26 /// Free Software Foundation, Inc.,
27 /// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
30 // For compilers that support precompilation
36 #include <wx/filename.h>
39 #include <CoreServices/CoreServices.h> // Do_not_auto_remove
40 #include <wx/mac/corefoundation/cfstring.h> // Do_not_auto_remove
41 #include <wx/intl.h> // Do_not_auto_remove
42 #elif defined(__WINDOWS__)
43 #include <winerror.h> // Do_not_auto_remove
44 #include <shlobj.h> // Do_not_auto_remove
50 WxCasCte::AMULESIG_FILENAME ( wxT( "amulesig.dat" ) );
52 WxCasCte::AMULESIG_IMG_NAME ( wxT( "aMule-online-sign" ) );
54 // Refresh rate limits
56 WxCasCte::MIN_REFRESH_RATE
= 1;
58 WxCasCte::MAX_REFRESH_RATE
= 3600;
62 WxCasCte::MIN_FTP_RATE
= 1;
64 WxCasCte::MAX_FTP_RATE
= 1440;
69 WxCasCte::AMULESIG_PATH_KEY ( wxT( "OSDirectory" ) );
71 WxCasCte::REFRESH_RATE_KEY ( wxT( "RefreshRate" ) );
74 WxCasCte::ENABLE_AUTOSTATIMG_KEY ( wxT( "EnableAutoStatImg" ) );
76 WxCasCte::AUTOSTATIMG_DIR_KEY ( wxT( "StatImgDirectory" ) );
78 WxCasCte::AUTOSTATIMG_TYPE_KEY ( wxT( "StatImgType" ) );
81 WxCasCte::ENABLE_FTP_UPDATE_KEY( wxT( "EnableFtpUpdate" ) );
83 WxCasCte::FTP_UPDATE_RATE_KEY ( wxT( "FtpUpdateRate" ) );
85 WxCasCte::FTP_URL_KEY ( wxT( "FtpUrl" ) );
87 WxCasCte::FTP_PATH_KEY ( wxT( "FtpPath" ) );
89 WxCasCte::FTP_USER_KEY ( wxT( "FtpUser" ) );
91 WxCasCte::FTP_PASSWD_KEY ( wxT( "FtpPasswd" ) );
94 WxCasCte::ABSOLUTE_MAX_DL_KEY ( wxT( "AbsoluteMaxDL" ) );
96 WxCasCte::ABSOLUTE_MAX_DL_DATE_KEY ( wxT( "AbsoluteMaxDlDate" ) );
98 // Default config parameters
100 WxCasCte::DEFAULT_AMULESIG_PATH ( GetDefaultAmulesigPath() );
102 WxCasCte::DEFAULT_REFRESH_RATE
= 5;
105 WxCasCte::DEFAULT_AUTOSTATIMG_ISENABLED
= FALSE
;
107 WxCasCte::DEFAULT_AUTOSTATIMG_PATH ( wxFileName::GetHomeDir () );
109 WxCasCte::DEFAULT_AUTOSTATIMG_TYPE ( wxT( "PNG" ) );
112 WxCasCte::DEFAULT_FTP_UPDATE_ISENABLED
= FALSE
;
114 WxCasCte::DEFAULT_FTP_UPDATE_RATE
= 10;
116 WxCasCte::DEFAULT_FTP_URL( wxT( "ftp.myftp.cx" ) );
118 WxCasCte::DEFAULT_FTP_PATH( wxT( "/pub/myamuledir" ) );
120 WxCasCte::DEFAULT_FTP_USER( wxT( "anonymous" ) );
122 WxCasCte::DEFAULT_FTP_PASSWD( wxT( "whiterabit@here" ) );
124 wxString
GetDefaultAmulesigPath()
131 if (FSFindFolder(kUserDomain
, kApplicationSupportFolderType
, kCreateFolder
, &fsRef
) == noErr
)
133 CFURLRef urlRef
= CFURLCreateFromFSRef(NULL
, &fsRef
);
134 CFStringRef cfString
= CFURLCopyFileSystemPath(urlRef
, kCFURLPOSIXPathStyle
);
136 strDir
= wxMacCFStringHolder(cfString
).AsString(wxLocale::GetSystemEncoding())
137 + wxFileName::GetPathSeparator() + wxT("aMule");
140 #elif defined(__WINDOWS__)
144 HRESULT hr
= SHGetSpecialFolderLocation(NULL
, CSIDL_APPDATA
, &pidl
);
147 if (!SHGetPathFromIDList(pidl
, wxStringBuffer(strDir
, MAX_PATH
))) {
148 strDir
= wxEmptyString
;
150 strDir
= strDir
+ wxFileName::GetPathSeparator() + wxT("aMule");
156 SHGetMalloc(&pMalloc
);
165 strDir
= wxFileName::GetHomeDir() + wxFileName::GetPathSeparator() + wxT(".aMule");
171 // File_checked_for_headers