Store designer and status flag for addons. Designer is now
shown in table view of all addons. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8629 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c83a6c990f
commit
078ba48e63
@ -31,6 +31,8 @@ Addon::Addon(const XMLNode &xml)
|
|||||||
{
|
{
|
||||||
m_name = "";
|
m_name = "";
|
||||||
m_id = "";
|
m_id = "";
|
||||||
|
m_designer = "";
|
||||||
|
m_status = 0;
|
||||||
m_installed = false;
|
m_installed = false;
|
||||||
m_installed_revision = 0;
|
m_installed_revision = 0;
|
||||||
m_revision = 0 ;
|
m_revision = 0 ;
|
||||||
@ -45,7 +47,9 @@ Addon::Addon(const XMLNode &xml)
|
|||||||
|
|
||||||
xml.get("name", &m_name );
|
xml.get("name", &m_name );
|
||||||
m_id = StringUtils::toLowerCase(m_name);
|
m_id = StringUtils::toLowerCase(m_name);
|
||||||
xml.get("id", &m_id);
|
xml.get("id", &m_id );
|
||||||
|
xml.get("designer", &m_designer );
|
||||||
|
xml.get("status", &m_status );
|
||||||
xml.get("installed", &m_installed );
|
xml.get("installed", &m_installed );
|
||||||
xml.get("installed-revision", &m_installed_revision);
|
xml.get("installed-revision", &m_installed_revision);
|
||||||
xml.get("revision", &m_revision );
|
xml.get("revision", &m_revision );
|
||||||
@ -72,6 +76,8 @@ void Addon::copyInstallData(const Addon &addon)
|
|||||||
m_icon_url = addon.m_icon_url;
|
m_icon_url = addon.m_icon_url;
|
||||||
m_icon_basename = addon.m_icon_basename;
|
m_icon_basename = addon.m_icon_basename;
|
||||||
m_icon_revision = addon.m_revision;
|
m_icon_revision = addon.m_revision;
|
||||||
|
m_designer = addon.m_designer;
|
||||||
|
m_status = addon.m_status;
|
||||||
} // copyInstallData
|
} // copyInstallData
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -84,6 +90,8 @@ void Addon::writeXML(std::ofstream *out_stream)
|
|||||||
(*out_stream) << " <" << m_type
|
(*out_stream) << " <" << m_type
|
||||||
<< " name=\"" << m_name
|
<< " name=\"" << m_name
|
||||||
<< "\" id=\"" << m_id
|
<< "\" id=\"" << m_id
|
||||||
|
<< "\" designer=\"" << m_designer
|
||||||
|
<< "\" status=\"" << m_status
|
||||||
<< "\" installed=\""
|
<< "\" installed=\""
|
||||||
<< (m_installed ? "true" : "false" )
|
<< (m_installed ? "true" : "false" )
|
||||||
<< "\" installed-revision=\"" << m_installed_revision
|
<< "\" installed-revision=\"" << m_installed_revision
|
||||||
@ -92,4 +100,3 @@ void Addon::writeXML(std::ofstream *out_stream)
|
|||||||
<< "\"/>\n";
|
<< "\"/>\n";
|
||||||
} // writeXML
|
} // writeXML
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,17 +29,33 @@ class XMLNode;
|
|||||||
class Addon
|
class Addon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/** AddonStatus flags - a bit pattern. */
|
||||||
|
enum AddonStatus {AS_APPROVED = 0x0001,
|
||||||
|
AS_ALPHA = 0x0002,
|
||||||
|
AS_BETA = 0x0004,
|
||||||
|
AS_RC = 0x0008,
|
||||||
|
AS_FAN = 0x0010,
|
||||||
|
AS_HQ = 0x0020,
|
||||||
|
AS_DFSG = 0x0040,
|
||||||
|
AS_FEATURED = 0x0080,
|
||||||
|
AS_LATEST = 0X0100,
|
||||||
|
AS_BAD_DIM = 0x0200
|
||||||
|
};
|
||||||
/** The name to be displayed. */
|
/** The name to be displayed. */
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
/** Internal id for this addon, which is the name in lower case.
|
/** Internal id for this addon, which is the name in lower case.
|
||||||
* This is used to create a subdirectory for this addon. */
|
* This is used to create a subdirectory for this addon. */
|
||||||
std::string m_id;
|
std::string m_id;
|
||||||
|
/** The name of the designer of the addon. */
|
||||||
|
std::string m_designer;
|
||||||
/** The (highest) revision number available online. */
|
/** The (highest) revision number available online. */
|
||||||
int m_revision;
|
int m_revision;
|
||||||
/** The currently installed revision. */
|
/** The currently installed revision. */
|
||||||
int m_installed_revision;
|
int m_installed_revision;
|
||||||
/** The version of the icon that was downloaded. */
|
/** The version of the icon that was downloaded. */
|
||||||
int m_icon_revision;
|
int m_icon_revision;
|
||||||
|
/** The status flags of this addon. */
|
||||||
|
int m_status;
|
||||||
/** A description of this addon. */
|
/** A description of this addon. */
|
||||||
std::string m_description;
|
std::string m_description;
|
||||||
/** The URL of the icon (relative to the server) */
|
/** The URL of the icon (relative to the server) */
|
||||||
@ -97,6 +113,9 @@ public:
|
|||||||
/** Returns the ID of this addon. */
|
/** Returns the ID of this addon. */
|
||||||
const std::string& getId() const { return m_id; }
|
const std::string& getId() const { return m_id; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the designer of the addon. */
|
||||||
|
const std::string &getDesigner() const { return m_designer; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
/** True if this addon needs to be updated. */
|
/** True if this addon needs to be updated. */
|
||||||
bool needsUpdate() const
|
bool needsUpdate() const
|
||||||
{
|
{
|
||||||
@ -152,6 +171,9 @@ public:
|
|||||||
return ""; // Ignore compiler warning
|
return ""; // Ignore compiler warning
|
||||||
} // getTypeDirectory
|
} // getTypeDirectory
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns if a certain status flag is set. */
|
||||||
|
bool testStatus(AddonStatus n) const {return (m_status & n) !=0; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the directory in which this addon is installed. */
|
/** Returns the directory in which this addon is installed. */
|
||||||
std::string getDataDir() const
|
std::string getDataDir() const
|
||||||
|
@ -105,8 +105,13 @@ void AddonsScreen::loadList()
|
|||||||
else
|
else
|
||||||
icon = m_icon_not_installed;
|
icon = m_icon_not_installed;
|
||||||
|
|
||||||
w_list->addItem(addon.getId(), addon.getName().c_str(),
|
core::stringw s;
|
||||||
icon);
|
if(addon.getDesigner().size()==0)
|
||||||
|
s = addon.getName().c_str();
|
||||||
|
else
|
||||||
|
s = _("%s by %s", addon.getName().c_str(),
|
||||||
|
addon.getDesigner().c_str());
|
||||||
|
w_list->addItem(addon.getId(), s.c_str(), icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWidget<GUIEngine::RibbonWidget>("category")->setActivated();
|
getWidget<GUIEngine::RibbonWidget>("category")->setActivated();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user