46 |
cycrow |
1 |
|
|
|
2 |
#include "CorePackage.h"
|
|
|
3 |
|
|
|
4 |
#include <File.h>
|
|
|
5 |
#include "InstallText.h"
|
|
|
6 |
|
|
|
7 |
namespace SPK {
|
|
|
8 |
namespace Package {
|
|
|
9 |
|
|
|
10 |
CCorePackage::CCorePackage(void) : _bChanged(false), _pIconFile(NULL), _pInstallText(NULL), _pUninstallText(NULL)
|
|
|
11 |
{
|
|
|
12 |
_setDefaults();
|
|
|
13 |
}
|
|
|
14 |
|
|
|
15 |
CCorePackage::~CCorePackage(void)
|
|
|
16 |
{
|
|
|
17 |
delete _pIconFile;
|
|
|
18 |
delete _pInstallText;
|
|
|
19 |
delete _pUninstallText;
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
void CCorePackage::setIcon(C_File *file, const Utils::String ext)
|
|
|
23 |
{
|
|
|
24 |
delete _pIconFile;
|
|
|
25 |
_sIconExt = ext;
|
|
|
26 |
_pIconFile = file;
|
|
|
27 |
_changed();
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
void CCorePackage::_setDefaults()
|
|
|
31 |
{
|
|
|
32 |
_iRecommended = -1;
|
|
|
33 |
_iGameChanging = -1;
|
|
|
34 |
_iEaseOfUse = -1;
|
|
|
35 |
|
|
|
36 |
delete _pIconFile;
|
|
|
37 |
_pIconFile = NULL;
|
|
|
38 |
|
|
|
39 |
delete _pInstallText;
|
|
|
40 |
delete _pUninstallText;
|
|
|
41 |
|
|
|
42 |
_pInstallText = new CInstallText;
|
|
|
43 |
_pUninstallText = new CInstallText;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
void CCorePackage::_setRatings(int iEase, int iChanging, int iRec)
|
|
|
47 |
{
|
|
|
48 |
_iRecommended = iRec;
|
|
|
49 |
_iGameChanging = iChanging;
|
|
|
50 |
_iEaseOfUse = iEase;
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
void CCorePackage::_merge(CCorePackage *pPackage)
|
|
|
54 |
{
|
|
|
55 |
_iRecommended = pPackage->recommended();
|
|
|
56 |
_iGameChanging = pPackage->gameChanging();
|
|
|
57 |
_iEaseOfUse = pPackage->easeOfUse();
|
|
|
58 |
|
|
|
59 |
_pInstallText->merge(pPackage->installText());
|
|
|
60 |
_pUninstallText->merge(pPackage->uninstallText());
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
64 |
// Install/Uninstall Texts
|
|
|
65 |
///////
|
|
|
66 |
|
|
|
67 |
Utils::String CCorePackage::_installText(int iLang, bool bBefore, bool bIncludeDefault, const CInstallText *pText) const
|
|
|
68 |
{
|
|
|
69 |
return (bBefore) ? pText->getBefore(iLang, bIncludeDefault) : pText->getAfter(iLang, bIncludeDefault);
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
Utils::String CCorePackage::installText(int iLang, bool bBefore, bool bIncludeDefault) const
|
|
|
73 |
{
|
|
|
74 |
return _installText(iLang, bBefore, bIncludeDefault, _pInstallText);
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
Utils::String CCorePackage::uninstallText(int iLang, bool bBefore, bool bIncludeDefault) const
|
|
|
78 |
{
|
|
|
79 |
return _installText(iLang, bBefore, bIncludeDefault, _pUninstallText);
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
void CCorePackage::addInstallText(int iLang, bool bBefore, const Utils::String &sText)
|
|
|
83 |
{
|
|
|
84 |
_addInstallText(iLang, bBefore, sText, _pInstallText);
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
void CCorePackage::addUninstallText(int iLang, bool bBefore, const Utils::String &sText)
|
|
|
88 |
{
|
|
|
89 |
_addInstallText(iLang, bBefore, sText, _pUninstallText);
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
void CCorePackage::removeInstallText(int iLang, bool bInstall)
|
|
|
93 |
{
|
|
|
94 |
if ( bInstall ) _pInstallText->remove(iLang);
|
|
|
95 |
else _pUninstallText->remove(iLang);
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
void CCorePackage::_addInstallText(int iLang, bool bBefore, const Utils::String &sText, CInstallText *pText)
|
|
|
100 |
{
|
|
|
101 |
if ( bBefore ) pText->addBefore(iLang, sText);
|
|
|
102 |
else pText->addAfter(iLang, sText);
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
}}//NAMESPACE
|