Subversion Repositories spk

Rev

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

Rev 204 Rev 206
Line 2... Line 2...
2
 
2
 
3
#include "spkdefines.h"
3
#include "spkdefines.h"
4
#include "../Utils/String.h"
-
 
5
#include "../Utils/List.h"
4
#include "../Utils/List.h"
6
#include <map>
5
#include <map>
7
 
6
 
8
enum {PLUGIN_NORMAL, PLUGIN_STABLE, PLUGIN_EXPERIMENTAL, PLUGIN_CHEAT, PLUGIN_MOD}; // filters for browsing packages
7
enum {PLUGIN_NORMAL, PLUGIN_STABLE, PLUGIN_EXPERIMENTAL, PLUGIN_CHEAT, PLUGIN_MOD}; // filters for browsing packages
9
 
8
 
Line 17... Line 16...
17
{
16
{
18
private:
17
private:
19
	Utils::WString _sName;
18
	Utils::WString _sName;
20
	Utils::WString _sVersion;
19
	Utils::WString _sVersion;
21
	Utils::WString _sAuthor;
20
	Utils::WString _sAuthor;
22
	Utils::String _sWebSite;
21
	Utils::WString _sWebSite;
23
	Utils::String _sWebAddress;
22
	Utils::WString _sWebAddress;
24
	Utils::String _sEmail;
23
	Utils::WString _sEmail;
25
	Utils::String _sDescription;
24
	Utils::WString _sDescription;
26
	Utils::WString _sCreationDate;
25
	Utils::WString _sCreationDate;
27
	Utils::String _sForumLink;
26
	Utils::WString _sForumLink;
28
 
27
 
29
	Utils::WString _sFilename;
28
	Utils::WString _sFilename;
30
	Utils::WString _sExportFilename;
29
	Utils::WString _sExportFilename;
31
 
30
 
32
	std::map<unsigned int, Utils::String> *_pAutoExtract;
31
	std::map<unsigned int, Utils::WString> *_pAutoExtract;
33
	std::map<unsigned int, Utils::String> *_pAutoExport;
32
	std::map<unsigned int, Utils::WString> *_pAutoExport;
34
	Utils::CList<SNames> *_lNames;
33
	Utils::CList<SNames> *_lNames;
35
 
34
 
36
	CInstallText *_pInstallText;
35
	CInstallText *_pInstallText;
37
	CInstallText *_pUninstallText;
36
	CInstallText *_pUninstallText;
38
 
37
 
Line 51... Line 50...
51
 
50
 
52
	//getters
51
	//getters
53
	const Utils::WString &name				() const { return _sName; }
52
	const Utils::WString &name				() const { return _sName; }
54
	const Utils::WString &version	 		() const { return _sVersion; }
53
	const Utils::WString &version	 		() const { return _sVersion; }
55
	const Utils::WString &author			() const { return _sAuthor; }
54
	const Utils::WString &author			() const { return _sAuthor; }
56
	const Utils::String	&webSite			() const { return _sWebSite; }
55
	const Utils::WString &webSite			() const { return _sWebSite; }
57
	const Utils::String	&webAddress			() const { return _sWebAddress; }
56
	const Utils::WString &webAddress		() const { return _sWebAddress; }
58
	const Utils::String	&email				() const { return _sEmail; }
57
	const Utils::WString &email				() const { return _sEmail; }
59
	const Utils::WString &creationDate		() const { return _sCreationDate; }
58
	const Utils::WString &creationDate		() const { return _sCreationDate; }
60
	const Utils::String	&description		() const { return _sDescription; }
59
	const Utils::WString &description		() const { return _sDescription; }
61
	const Utils::String	&forumLink			() const { return _sForumLink; }
60
	const Utils::WString &forumLink			() const { return _sForumLink; }
62
	int					 recommended		() const { return _iRecommended; }
61
	int					 recommended		() const { return _iRecommended; }
63
	int					 easeOfUse			() const { return _iEaseOfUse; }
62
	int					 easeOfUse			() const { return _iEaseOfUse; }
64
	int					 gameChanging		() const { return _iGameChanging; }
63
	int					 gameChanging		() const { return _iGameChanging; }
65
	const Utils::WString &filename			() const { return _sFilename; }
64
	const Utils::WString &filename			() const { return _sFilename; }
66
	const Utils::WString &exportFilename	() const { return _sExportFilename; }
65
	const Utils::WString &exportFilename	() const { return _sExportFilename; }
67
	const CInstallText  *installText		() const { return _pInstallText; }
66
	const CInstallText  *installText		() const { return _pInstallText; }
68
	const CInstallText  *uninstallText		() const { return _pUninstallText; }
67
	const CInstallText  *uninstallText		() const { return _pUninstallText; }
69
	int					 pluginType			() const { return _iPluginType; }
68
	int					 pluginType			() const { return _iPluginType; }
70
	bool				 hasChanged			() const { return _bChanged; }
69
	bool				 hasChanged			() const { return _bChanged; }
71
	const Utils::WString	&name			(int lang) const;
70
	const Utils::WString	&name			(int lang) const;
72
	const std::map<unsigned int, Utils::String> *autoExtraction() const { return _pAutoExtract; }
71
	const std::map<unsigned int, Utils::WString> *autoExtraction() const { return _pAutoExtract; }
73
	const std::map<unsigned int, Utils::String> *autoExporter() const { return _pAutoExport; }
72
	const std::map<unsigned int, Utils::WString> *autoExporter() const { return _pAutoExport; }
74
	const Utils::CList<SNames> *namesList() const { return _lNames; }
73
	const Utils::CList<SNames> *namesList() const { return _lNames; }
75
 
74
 
76
	//setters
75
	//setters
77
	void setName			( const Utils::WString &str ) { _changed(); _sName = str.remove(L'|'); }
76
	void setName			( const Utils::WString &str ) { _changed(); _sName = str.remove(L'|'); }
78
	void setVersion			( const Utils::WString &str ) { _changed(); _sVersion = str; }
77
	void setVersion			( const Utils::WString &str ) { _changed(); _sVersion = str; }
79
	void setAuthor			( const Utils::WString &str ) { _changed(); _sAuthor = str.remove(L'|'); }
78
	void setAuthor			( const Utils::WString &str ) { _changed(); _sAuthor = str.remove(L'|'); }
80
	void setWebAddress		( const Utils::String &str ) { _changed(); _sWebAddress = str; }
79
	void setWebAddress		( const Utils::WString &str ) { _changed(); _sWebAddress = str; }
81
	void setWebSite			( const Utils::String &str ) { _changed(); _sWebSite = str; }
80
	void setWebSite			( const Utils::WString &str ) { _changed(); _sWebSite = str; }
82
	void setEmail			( const Utils::String &str ) { _changed(); _sEmail = str; }
81
	void setEmail			( const Utils::WString &str ) { _changed(); _sEmail = str; }
83
	void setCreationDate	( const Utils::WString &str ) { _changed(); _sCreationDate = str; }
82
	void setCreationDate	( const Utils::WString &str ) { _changed(); _sCreationDate = str; }
84
	void setDescription		( const Utils::String &str ) { _changed(); _parseDescription(str); }
83
	void setDescription		( const Utils::WString &str ) { _changed(); _parseDescription(str); }
85
	void setFilename		( const Utils::WString &str ) { _sFilename = str; }
84
	void setFilename		( const Utils::WString &str ) { _sFilename = str; }
86
	void setExportFilename	( const Utils::WString &str ) { _sExportFilename = str; }
85
	void setExportFilename	( const Utils::WString &str ) { _sExportFilename = str; }
87
	void setForumLink		( const Utils::String &str ) { _changed(); _sForumLink = str; }
86
	void setForumLink		( const Utils::WString &str ) { _changed(); _sForumLink = str; }
88
	void setRecommended		( int i )					 { _changed(); _iRecommended = i; }
87
	void setRecommended		( int i )					 { _changed(); _iRecommended = i; }
89
	void setGameChanging	( int i )					 { _changed(); _iGameChanging = i; }
88
	void setGameChanging	( int i )					 { _changed(); _iGameChanging = i; }
90
	void setEaseOfUse		( int i )					 { _changed(); _iEaseOfUse = i; }
89
	void setEaseOfUse		( int i )					 { _changed(); _iEaseOfUse = i; }
91
	void setPluginType		( int i )					 { _changed(); _iPluginType = i; }
90
	void setPluginType		( int i )					 { _changed(); _iPluginType = i; }
92
	void adjustChanged		( bool bChanged )			 { _bChanged = bChanged; }
91
	void adjustChanged		( bool bChanged )			 { _bChanged = bChanged; }
93
	
92
	
94
	void addAutoExtract(unsigned int game, const Utils::String &dir);
93
	void addAutoExtract(unsigned int game, const Utils::WString &dir);
95
	void addAutoExport(unsigned int game, const Utils::String &file);
94
	void addAutoExport(unsigned int game, const Utils::WString &file);
96
	void clearAutoExtract();
95
	void clearAutoExtract();
97
	void clearAutoExport();
96
	void clearAutoExport();
98
 
97
 
99
	void addName(int iLang, const Utils::WString& name);
98
	void addName(int iLang, const Utils::WString& name);
100
	void removeName(int iLang);
99
	void removeName(int iLang);
101
	void clearNames();
100
	void clearNames();
102
 
101
 
103
	// install texts
102
	// install texts
104
	Utils::String installText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
103
	Utils::WString installText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
105
	Utils::String uninstallText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
104
	Utils::WString uninstallText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
106
	void addInstallText(int iLang, bool bBefore, const Utils::String &sText);
105
	void addInstallText(int iLang, bool bBefore, const Utils::WString &sText);
107
	void addUninstallText(int iLang, bool bBefore, const Utils::String &sText);
106
	void addUninstallText(int iLang, bool bBefore, const Utils::WString &sText);
108
	void removeInstallText(int iLang, bool bInstall);
107
	void removeInstallText(int iLang, bool bInstall);
109
 
108
 
110
protected:
109
protected:
111
	virtual void _changed() { _bChanged = true; }
110
	virtual void _changed() { _bChanged = true; }
112
	virtual void _setDefaults();
111
	virtual void _setDefaults();
113
	void _setRatings(int iEase, int iChanging, int iRec);
112
	void _setRatings(int iEase, int iChanging, int iRec);
114
	void _parseDescription(const Utils::String &sDesc);
113
	void _parseDescription(const Utils::WString &sDesc);
115
 
114
 
116
	bool _noRatings() const { return (_iRecommended == -1 && _iEaseOfUse == -1 && _iGameChanging == -1) ? true : false; }
115
	bool _noRatings() const { return (_iRecommended == -1 && _iEaseOfUse == -1 && _iGameChanging == -1) ? true : false; }
117
	void _merge(CCorePackage *pPackage);
116
	void _merge(CCorePackage *pPackage);
118
 
117
 
119
	Utils::String _installText(int iLang, bool bBefore, bool bIncludeDefault, const CInstallText *pText) const;
118
	Utils::WString _installText(int iLang, bool bBefore, bool bIncludeDefault, const CInstallText *pText) const;
120
	void _addInstallText(int iLang, bool bBefore, const Utils::String &sText, CInstallText *pText);
119
	void _addInstallText(int iLang, bool bBefore, const Utils::WString &sText, CInstallText *pText);
121
};
120
};
122
 
121
 
123
 
122
 
124
}}//NAMESPACE
123
}}//NAMESPACE