-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.cpccAppInfo.h
More file actions
160 lines (127 loc) · 4.28 KB
/
app.cpccAppInfo.h
File metadata and controls
160 lines (127 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/* *****************************************
* File: app.cpccAppInfo.h
* Purpose: Portable (cross-platform), light-weight, library
* *****************************************
* Library: Cross Platform C++ Classes (cpcc)
* Copyright: 2013 StarMessage software.
* License: Free for opensource projects.
* Commercial license for closed source projects.
* Web: http://www.StarMessageSoftware.com
* http://www.24hsoftware.com/portable-cpp-filesystem-library
* https://github.com/starmessage/cpcc
* email: sales -at- starmessage.info
* *****************************************
*/
#pragma once
#include <string.h>
#include "cpccUnicodeSupport.h"
#include "core.cpccOS.h"
/* you need to allocate these global variables somewhere in one of your cpp files like this:
const cpcc_char *cpccAppInfo::CompanyName = "StarMessage software";
const cpcc_char *cpccAppInfo::ProgramName = "StarMessage screensaver";
const cpcc_char *cpccAppInfo::Version = "5.0";
const cpcc_char *cpccAppInfo::ProgramNameAndVersion = "StarMessage screensaver vX.X";
const cpcc_char *cpccAppInfo::WebSiteNoHttp = "www.StarMessageSoftware.com";
const cpcc_char *cpccAppInfo::WebSite = "www.StarMessageSoftware.com";
const char *cpccAppInfo::EmailSales = "xxx@ccc.aaa";
const char *cpccAppInfo::EmailSupport = "yyy@ccc.aaa";
*/
struct sAppInfo
{
enum class eLicenseType { eltFree, eltFreeInAppleStore, eltPaidInAppleStore, eltFreeTrialPeriod, eltPaid, eltSpecialEdition, eltCommercial };
const cpcc_char
* CompanyName,
* ProgramName,
* Version,
* Build,
* MacBundleId; // ignored under Windows
const char
* VersionA,
* BuildA;
const cpcc_char
* WebSiteNoHttp,
* WebSite,
* WebPrivacyPolicy,
* BuyURL,
* DonateURL,
* CheckForUpdatesURL,
* Email;
// int licenseType;
eLicenseType licenseType;
};
class cpccAppInfo: public sAppInfo
{
private:
static cpcc_string createHtmlLink(const cpcc_char *label, const cpcc_char *url)
{
cpcc_string result(_T("<a href=\""));
result.append(url);
result.append(_T("\">"));
result.append(label);
result.append(_T("</a>"));
return result;
}
public:
enum xtraInfo { includeEmail=1, includeWebsite=4, useHtmlLinks=8 };
cpcc_string getText_pleaseBuyTheFullVersion_html(const cpcc_char *aProgramName)
{
cpcc_string tmp_callToAction = _T("If you like ");
tmp_callToAction.append(aProgramName);
tmp_callToAction.append(", please <A HREF=\"");
tmp_callToAction.append(cpccAppInfo::BuyURL);
tmp_callToAction.append(_T("\">buy now</a> the full version."));
return tmp_callToAction;
}
cpcc_string getText_AboutThisSoftware(const int xi, const cpcc_char *aLineBreak, const cpcc_char *aLicenseInfo, const cpcc_char *aCallToAction)
{
cpcc_string infoText(cpccAppInfo::ProgramName);
infoText += _T(" ");
infoText += cpccAppInfo::Version;
if (!aLineBreak)
{
infoText += _T("#8572: const char *aLineBreak was null\n");
return infoText;
}
const bool htmlLinks = ((xi & useHtmlLinks)!=0);
if (aLicenseInfo)
if (cpcc_strlen(aLicenseInfo) > 0)
{
infoText.append(aLineBreak);
infoText.append(_T("License: "));
infoText.append(aLicenseInfo);
}
infoText.append(aLineBreak);
infoText.append(aLineBreak);
infoText.append(_T("Build: "));
infoText.append(Build);
infoText.append(aLineBreak);
infoText.append(_T("(c) "));
infoText.append(cpccAppInfo::CompanyName);
if ((cpcc_strlen(WebSiteNoHttp)>0) && (xi & includeWebsite))
{
infoText.append(aLineBreak);
infoText.append(_T("Website: "));
if (htmlLinks)
infoText.append(createHtmlLink(WebSiteNoHttp, WebSite));
else
infoText.append(WebSiteNoHttp);
}
if ((cpcc_strlen(Email) > 0) && (xi & includeEmail))
{
infoText.append(aLineBreak);
infoText.append(_T("Email: "));
if (htmlLinks)
infoText.append(createHtmlLink(Email, (cpcc_string(_T("mailto:")) + Email).c_str()));
else
infoText.append(Email);
}
if (aCallToAction)
if (cpcc_strlen(aCallToAction) > 0)
{
infoText.append(aLineBreak);
infoText.append(aLineBreak);
infoText.append(aCallToAction);
}
return infoText;
}
};