Adding update support for the addons and increase the size of the buttons in the addon dialog
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6230 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
8ad1bcbcd8
commit
a087e00214
@ -16,12 +16,12 @@
|
||||
|
||||
<div x="5%" y="80%" width="40%" height="10%" layout="horizontal-row">
|
||||
<spacer proportion="1" />
|
||||
<button id="cancel" I18N="Addons" text="Back" align="center"/>
|
||||
<button id="cancel" width="70%" I18N="Addons" text="Back" align="center"/>
|
||||
<spacer proportion="1" />
|
||||
</div>
|
||||
<div x="50%" y="80%" width="40%" height="10%" layout="horizontal-row" >
|
||||
<spacer proportion="1" />
|
||||
<button id="install" I18N="Addons" text="Install" align="center"/>
|
||||
<button id="install" width="70%" I18N="Addons" text="Install" align="center"/>
|
||||
<spacer proportion="1" />
|
||||
</div>
|
||||
</stkgui>
|
||||
|
@ -412,4 +412,11 @@ std::string Addons::getDownloadStateAsStr()
|
||||
pthread_mutex_unlock(&m_str_mutex);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool Addons::NeedUpdate()
|
||||
{
|
||||
return GetInstalledVersion() < GetVersion();
|
||||
}
|
||||
#endif
|
||||
|
@ -81,6 +81,9 @@ class Addons
|
||||
int GetInstalledVersion();
|
||||
std::string GetInstalledVersionAsStr();
|
||||
|
||||
/** Return a simple bool to know if the addon needs to be updated */
|
||||
bool NeedUpdate();
|
||||
|
||||
/** Get the installed version of the selected addon. */
|
||||
std::string GetIdAsStr();
|
||||
|
||||
|
@ -172,13 +172,13 @@ void AddonsLoading::close()
|
||||
void * AddonsLoading::startInstall(void* pthis)
|
||||
{
|
||||
AddonsLoading * obj = (AddonsLoading*)pthis;
|
||||
if(obj->addons->IsInstalled() == "yes")
|
||||
if(!obj->addons->IsInstalledAsBool() or obj->addons->NeedUpdate())
|
||||
{
|
||||
obj->addons->UnInstall();
|
||||
obj->addons->Install();
|
||||
}
|
||||
else
|
||||
{
|
||||
obj->addons->Install();
|
||||
obj->addons->UnInstall();
|
||||
}
|
||||
pthread_mutex_lock(&(obj->m_mutex_can_install));
|
||||
obj->m_can_install = true;
|
||||
|
Loading…
Reference in New Issue
Block a user