Subversion Repositories spk

Rev

Rev 204 | Rev 208 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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