1 /*******************************************************
2 Copyright (C) 2009 VaDiM
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 ********************************************************/
18
19 #include "constants.h"
20 #include <wx/string.h>
21 #include <wx/filefn.h>
22 #include "lua.hpp"
23 #include "mongoose/mongoose.h"
24
25 /*************************************************************************
26 MMEX_VERSION
27 Update the version definition for the program as follows:
28 Version Format = MAJOR.MINOR.PATCH, increment the:
29 1. MAJOR version when you make incompatible API changes,
30 2. MINOR version when you add functionality in a backwards-compatible manner, and
31 3. PATCH version when you make backwards-compatible bug fixes.
32 Ref: http://semver.org
33
34 Alpha, Beta, RC = -1 (Stable) won't add any suffix
35 Alpha, Beta, RC = 0 (Unstable) will add suffix to version without number
36 Alpha, Beta, RC > 0 (Unstable) will add suffix to version with number
37
38 For Internet Format for update checking read in util.cpp
39 *************************************************************************/
40 const int mmex::version::Major = 1;
41 const int mmex::version::Minor = 2;
42 const int mmex::version::Patch = 7;
43 const int mmex::version::Alpha = -1;
44 const int mmex::version::Beta = -1;
45 const int mmex::version::RC = -1;
46
generateProgramVersion(int Major,int Minor,int Patch,int Alpha,int Beta,int RC)47 const wxString mmex::version::generateProgramVersion(int Major, int Minor, int Patch, int Alpha, int Beta, int RC)
48 {
49 wxString Version = wxString::Format("%i.%i.%i", Major, Minor, Patch);
50 if (Alpha == 0)
51 Version.Append("-Alpha");
52 else if (Alpha > 0)
53 Version.Append(wxString::Format("-Alpha.%i", Alpha));
54 if (Beta == 0)
55 Version.Append("-Beta");
56 else if (Beta > 0)
57 Version.Append(wxString::Format("-Beta.%i", Beta));
58 if (RC == 0)
59 Version.Append("-RC");
60 else if (RC > 0)
61 Version.Append(wxString::Format("-RC.%i", RC));
62
63 return Version;
64 }
65
66 /* End version namespace*/
67
68 const wxSizerFlags g_flags = wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL).Border(wxALL, 5);
69 const wxSizerFlags g_flagsExpand = wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxEXPAND).Border(wxALL, 5).Proportion(1);
70
71 const wxString g_CancelLabel =
72 #if defined(__APPLE__)
73 wxTRANSLATE("Cancel");
74 #else
75 wxTRANSLATE("&Cancel ");
76 #endif
77 const wxString g_CloseLabel =
78 #if defined(__APPLE__)
79 wxTRANSLATE("Close");
80 #else
81 wxTRANSLATE("&Close ");
82 #endif
83
84 //---------------------------------------------------------------------------
85 const int mmex::MIN_DATAVERSION = 2;
86 const wxString mmex::DATAVERSION = "3";
87 const wxString mmex::DEFDATEFORMAT = "%Y-%m-%d"; //ISO 8601
88 const wxString mmex::DEFDELIMTER = ",";
89
getProgramName()90 const wxString mmex::getProgramName()
91 {
92 return wxString("MoneyManagerEx");
93 }
getTitleProgramVersion()94 const wxString mmex::getTitleProgramVersion()
95 {
96 return _("Version: ") + mmex::getProgramVersion();
97 }
getProgramVersion()98 const wxString mmex::getProgramVersion()
99 {
100 return mmex::version::generateProgramVersion
101 (mmex::version::Major, mmex::version::Minor, mmex::version::Patch,
102 mmex::version::Alpha, mmex::version::Beta, mmex::version::RC);
103 }
getProgramCopyright()104 const wxString mmex::getProgramCopyright()
105 {
106 return "(c) 2005-2016 Madhan Kanagavel";
107 }
getProgramDescription()108 const wxString mmex::getProgramDescription()
109 {
110 wxString description;
111 description << _("MMEX is using the following support products") << ":\n"
112 << "======================================\n"
113 << wxVERSION_STRING << "\n"
114 << "SQLite3 " << wxSQLite3Database::GetVersion() << "\n"
115 << wxSQLITE3_VERSION_STRING << "\n"
116 << "Mongoose " << MONGOOSE_VERSION << "\n"
117 << LUA_VERSION << "\n";
118 #if defined(_MSC_VER)
119 description << "Microsoft Visual Studio " << _MSC_VER;
120 #elif defined(__clang__)
121 description << "Clang/LLVM " << __VERSION__;
122 #elif (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__) || defined(__INTEL_COMPILER))
123 description << "GNU GCC/G++ " << __VERSION__;
124 #endif
125
126 return description;
127 }
128
129 /* Namespace weblink */
addReferralToURL(const wxString & BaseURL,const wxString & CampSource)130 const wxString mmex::weblink::addReferralToURL(const wxString& BaseURL, const wxString& CampSource)
131 {
132 /*
133 With Google analytics it's possible to send some data in URL
134 to divide direct access from access through desktop app links
135 https://support.google.com/analytics/answer/1033867?hl=en
136 */
137 wxString url = BaseURL;
138 if (BaseURL.find("/",true) > 5)
139 url += "/";
140
141 url += "?";
142 url += "utm_campaign=Application_Desktop";
143
144 url += "&";
145 url += "utm_source=" + CampSource;
146
147 url += "&";
148 url += "utm_medium=MMEX_v" + mmex::getProgramVersion();
149
150 return url;
151 }
152
153 const wxString mmex::weblink::WebSite = mmex::weblink::addReferralToURL("http://www.moneymanagerex.org", "Website");
154 const wxString mmex::weblink::Update = "http://www.moneymanagerex.org/version.php?Version=" + mmex::getProgramVersion();
155 const wxString mmex::weblink::UpdateLinks = "http://www.moneymanagerex.org/version.php?Version=" + mmex::getProgramVersion() + "&Links=true";
156 const wxString mmex::weblink::Changelog = "http://www.moneymanagerex.org/version.php?Version=" + mmex::getProgramVersion() + "&ChangeLog=";
157 const wxString mmex::weblink::UsageStats = "http://usagestats.moneymanagerex.org/API/main_stats_v1.php";
158 const wxString mmex::weblink::Download = mmex::weblink::addReferralToURL("http://www.moneymanagerex.org/download", "Download");
159 const wxString mmex::weblink::News = mmex::weblink::addReferralToURL("http://www.moneymanagerex.org/news", "News");
160 const wxString mmex::weblink::NewsRSS = "http://www.moneymanagerex.org/news?format=feed";
161 const wxString mmex::weblink::Forum = mmex::weblink::addReferralToURL("http://forum.moneymanagerex.org", "Forum");
162 const wxString mmex::weblink::Wiki = "http://wiki.moneymanagerex.org";
163 const wxString mmex::weblink::BugReport = "http://bugreport.moneymanagerex.org";
164 const wxString mmex::weblink::Donate = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=moneymanagerex%40gmail%2ecom&lc=US&item_name=MoneyManagerEx&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest";
165 const wxString mmex::weblink::Twitter = "https://twitter.com/MoneyManagerEx";
166 const wxString mmex::weblink::Facebook = "http://www.facebook.com/pages/Money-Manager-Ex/242286559144586";
167 const wxString mmex::weblink::YahooQuotes = "http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1c4n&e=.csv";
168 const wxString mmex::weblink::YahooQuotesHistory = "http://ichart.finance.yahoo.com/table.csv?s=";
169 const wxString mmex::weblink::GooglePlay = "https://play.google.com/store/apps/details?id=com.money.manager.ex";
170
171 // Will display the stock page when using Looks up the current value
172 const wxString mmex::weblink::DefStockUrl = "http://finance.yahoo.com/echarts?s=%s";
173 // Looks up the current value
174 // const wxChar *const mmex::DEFSTOCKURL = "http://finance.yahoo.com/lookup?s=%s";
175
176 // Using google: To specify the exchange, use exch:code
177 // Using yahoo: To specify the exchange, use code.exch
178 // const wxChar *const mmex::DEFSTOCKURL = "http://www.google.com/finance?q=%s";
179
180 //US Dollar (USD) in Euro (EUR) Chart
181 //http://www.google.com/finance?q=CURRENCY%3AUSD
182
183 /* End namespace weblink */
184
185 const wxString LANGUAGE_PARAMETER = "LANGUAGE";
186 const wxString INIDB_USE_TRANSACTION_SOUND = "USETRANSSOUND";
187 const wxString INIDB_USE_ORG_DATE_COPYPASTE = "USEORIGDATEONCOPYPASTE";
188 const wxString INIDB_SEND_USAGE_STATS = "SENDUSAGESTATS";
189
190 const wxString VIEW_TRANS_ALL_STR = wxTRANSLATE("View All Transactions");
191 const wxString VIEW_TRANS_TODAY_STR = wxTRANSLATE("View Today");
192 const wxString VIEW_TRANS_CURRENT_MONTH_STR = wxTRANSLATE("View Current Month");
193 const wxString VIEW_TRANS_LAST_30_DAYS_STR = wxTRANSLATE("View Last 30 days");
194 const wxString VIEW_TRANS_LAST_90_DAYS_STR = wxTRANSLATE("View Last 90 days");
195 const wxString VIEW_TRANS_LAST_MONTH_STR = wxTRANSLATE("View Last Month");
196 const wxString VIEW_TRANS_LAST_3MONTHS_STR = wxTRANSLATE("View Last 3 Months");
197 const wxString VIEW_TRANS_LAST_12MONTHS_STR = wxTRANSLATE("View Last 12 Months");
198 const wxString VIEW_TRANS_CURRENT_YEAR_STR = wxTRANSLATE("View Current Year");
199
200 const wxString VIEW_ACCOUNTS_ALL_STR = "ALL";
201 const wxString VIEW_ACCOUNTS_OPEN_STR = "Open";
202 const wxString VIEW_ACCOUNTS_FAVORITES_STR = "Favorites";
203
204 const wxString INIDB_BUDGET_FINANCIAL_YEARS = "BUDGET_FINANCIAL_YEARS";
205 const wxString INIDB_BUDGET_INCLUDE_TRANSFERS = "BUDGET_INCLUDE_TRANSFERS";
206 const wxString INIDB_BUDGET_SETUP_WITHOUT_SUMMARY = "BUDGET_SETUP_WITHOUT_SUMMARY";
207 const wxString INIDB_BUDGET_SUMMARY_WITHOUT_CATEG = "BUDGET_SUMMARY_WITHOUT_CATEGORIES";
208 const wxString INIDB_IGNORE_FUTURE_TRANSACTIONS = "IGNORE_FUTURE_TRANSACTIONS";
209
210 const wxString ATTACHMENTS_FOLDER_DOCUMENTS = "%DOCUMENTS%";
211 const wxString ATTACHMENTS_FOLDER_DATABASE = "%DATABASE%";
212 const wxString ATTACHMENTS_FOLDER_USERPROFILE = "%USERPROFILE%";
213 const wxString ATTACHMENTS_FOLDER_APPDATA = "%APPDATA%";
214
215 const wxString INIDB_DISPLAY_INTERNET_NEWS = "DISPLAY_INTERNET_NEWS";
216 const wxString INIDB_NEWS_LAST_READ_DATE = "NEWS_LAST_READ_DATE";
217