Subversion Repositories spk

Rev

Rev 131 | Rev 171 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 131 Rev 170
Line 12... Line 12...
12
	_pInstallText(NULL),
12
	_pInstallText(NULL),
13
	_pUninstallText(NULL),
13
	_pUninstallText(NULL),
14
	_pAutoExtract(NULL),
14
	_pAutoExtract(NULL),
15
	_pAutoExport(NULL)
15
	_pAutoExport(NULL)
16
{
16
{
-
 
17
	_lNames = new Utils::CList<SNames>();
17
	_setDefaults();
18
	_setDefaults();
18
}
19
}
19
 
20
 
20
CCorePackage::~CCorePackage(void)
21
CCorePackage::~CCorePackage(void)
21
{
22
{
-
 
23
	if (_lNames)
-
 
24
		delete _lNames;
22
	if(_pInstallText)
25
	if(_pInstallText)
23
		delete _pInstallText;
26
		delete _pInstallText;
24
	if(_pUninstallText)
27
	if(_pUninstallText)
25
		delete _pUninstallText;
28
		delete _pUninstallText;
26
	if (_pAutoExtract)
29
	if (_pAutoExtract)
27
		delete _pAutoExtract;
30
		delete _pAutoExtract;
28
	if (_pAutoExport)
31
	if (_pAutoExport)
29
		delete _pAutoExport;
32
		delete _pAutoExport;
-
 
33
}
-
 
34
 
-
 
35
const Utils::String& CCorePackage::name(int lang) const
-
 
36
{ 
-
 
37
	for(auto itr = _lNames->begin(); itr != _lNames->end(); itr++)
-
 
38
	{
-
 
39
		if ((*itr)->iLanguage == lang)
-
 
40
			return (*itr)->sName;
-
 
41
	}
-
 
42
	return _sName; 
30
}
43
}
31
 
44
 
32
void CCorePackage::_setDefaults()
45
void CCorePackage::_setDefaults()
33
{
46
{
34
	_iRecommended = -1;
47
	_iRecommended = -1;
35
	_iGameChanging = -1;
48
	_iGameChanging = -1;
36
	_iEaseOfUse = -1;
49
	_iEaseOfUse = -1;
37
 
50
 
38
	if(_pInstallText)
51
	if(_pInstallText)
39
		delete _pInstallText;
52
		delete _pInstallText;
40
	if(_pUninstallText)
53
	if(_pUninstallText)
41
		delete _pUninstallText;
54
		delete _pUninstallText;
42
	if (_pAutoExtract)
55
	if (_pAutoExtract)
43
		delete _pAutoExtract;
56
		delete _pAutoExtract;
44
	if (_pAutoExport)
57
	if (_pAutoExport)
45
		delete _pAutoExport;
58
		delete _pAutoExport;
46
 
59
 
47
	_pAutoExtract = NULL;
60
	_pAutoExtract = NULL;
48
	_pAutoExport = NULL;
61
	_pAutoExport = NULL;
49
	_pInstallText = new CInstallText;
62
	_pInstallText = new CInstallText;
50
	_pUninstallText = new CInstallText;
63
	_pUninstallText = new CInstallText;
51
 
64
 
52
	_iPluginType = PLUGIN_NORMAL;
65
	_iPluginType = PLUGIN_NORMAL;
-
 
66
 
-
 
67
	_lNames->deleteItems();
53
}
68
}
54
 
69
 
55
void CCorePackage::_setRatings(int iEase, int iChanging, int iRec)
70
void CCorePackage::_setRatings(int iEase, int iChanging, int iRec)
56
{
71
{
57
	_iRecommended = iRec;
72
	_iRecommended = iRec;
58
	_iGameChanging = iChanging;
73
	_iGameChanging = iChanging;
59
	_iEaseOfUse = iEase;
74
	_iEaseOfUse = iEase;
60
}
75
}
61
 
76
 
62
void CCorePackage::_parseDescription(const Utils::String &sDesc)
77
void CCorePackage::_parseDescription(const Utils::String &sDesc)
63
{
78
{
64
	_sDescription = sDesc;
79
	_sDescription = sDesc;
65
	//_sDescription.RemoveFirstChar('\n');
80
	//_sDescription.RemoveFirstChar('\n');
66
	//_sDescription.RemoveFirstChar('\r');
81
	//_sDescription.RemoveFirstChar('\r');
Line 84... Line 99...
84
				break;
99
				break;
85
			char c = _sDescription[pos];
100
			char c = _sDescription[pos];
86
 
101
 
87
			if ( c != '<' )
102
			if ( c != '<' )
88
				foundFirst = pos;
103
				foundFirst = pos;
89
		}
104
		}
90
 
105
 
91
		if ( foundFirst == -1 )
106
		if ( foundFirst == -1 )
92
			_sDescription = "";
107
			_sDescription = "";
93
		else
108
		else
94
		{
109
		{
95
			Utils::String firstStr = _sDescription.left(foundFirst).findRemove("<br />").findRemove("<br/>");
110
			Utils::String firstStr = _sDescription.left(foundFirst).findRemove("<br />").findRemove("<br/>");
Line 100... Line 115...
100
	}
115
	}
101
 
116
 
102
}
117
}
103
 
118
 
104
void CCorePackage::_merge(CCorePackage *pPackage)
119
void CCorePackage::_merge(CCorePackage *pPackage)
105
{
120
{
106
	_iRecommended	= pPackage->recommended();
121
	_iRecommended	= pPackage->recommended();
107
	_iGameChanging	= pPackage->gameChanging();
122
	_iGameChanging	= pPackage->gameChanging();
108
	_iEaseOfUse		= pPackage->easeOfUse();
123
	_iEaseOfUse		= pPackage->easeOfUse();
109
 
124
 
110
	_pInstallText->merge(pPackage->installText());
125
	_pInstallText->merge(pPackage->installText());
Line 144... Line 159...
144
void CCorePackage::clearAutoExtract()
159
void CCorePackage::clearAutoExtract()
145
{
160
{
146
	if (_pAutoExtract)
161
	if (_pAutoExtract)
147
		delete _pAutoExtract;
162
		delete _pAutoExtract;
148
	_pAutoExtract = NULL;
163
	_pAutoExtract = NULL;
-
 
164
}
-
 
165
 
-
 
166
 
-
 
167
void CCorePackage::removeName(int lang)
-
 
168
{
-
 
169
	auto itr = _lNames->begin();
-
 
170
	while (itr != _lNames->end())
-
 
171
	{
-
 
172
		if ((*itr)->iLanguage == lang)
-
 
173
		{
-
 
174
			SNames* n = *itr;
-
 
175
			itr = _lNames->remove(itr);
-
 
176
			delete n;
-
 
177
			_changed();
-
 
178
		}
-
 
179
		else 
-
 
180
			itr++;
-
 
181
	}
-
 
182
}
-
 
183
 
-
 
184
void CCorePackage::clearNames()
-
 
185
{
-
 
186
	_lNames->deleteItems();
-
 
187
}
-
 
188
 
-
 
189
void CCorePackage::addName(int lang, const Utils::String& name)
-
 
190
{
-
 
191
	for (auto n = _lNames->first(); n; n = _lNames->next())
-
 
192
	{
-
 
193
		if (n->iLanguage == lang)
-
 
194
		{
-
 
195
			n->sName = name;
-
 
196
			_changed();
-
 
197
			return;
-
 
198
		}
-
 
199
	}
-
 
200
 
-
 
201
	// not found, add a new entry
-
 
202
	SNames *n = new SNames;
-
 
203
	n->iLanguage = lang;
-
 
204
	n->sName = name;
-
 
205
	_lNames->push_back(n);
-
 
206
 
-
 
207
	_changed();
149
}
208
}
150
 
209
 
151
///////////////////////////////////////////////////////////////////////////////////////////////
210
///////////////////////////////////////////////////////////////////////////////////////////////
152
//	Install/Uninstall Texts
211
//	Install/Uninstall Texts
153
///////
212
///////