Started work on deleting installed updates; deleted unused variables
and file. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7265 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
93daa15d73
commit
f97067d313
@ -1,30 +0,0 @@
|
|||||||
<stkgui>
|
|
||||||
|
|
||||||
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
|
|
||||||
|
|
||||||
<header text_align="center" width="100%" text="SuperTuxKart Addons"/>
|
|
||||||
<spacer height="15" width="10"/>
|
|
||||||
|
|
||||||
<tabs id="category" height="10%" max_height="110" width="100%" align="center">
|
|
||||||
<icon-button id="tab_kart" width="128" height="128" icon="gui/karts.png"
|
|
||||||
I18N="Section in the addons menu" text="Karts"/>
|
|
||||||
<icon-button id="tab_track" width="128" height="128" icon="gui/mode_normal.png"
|
|
||||||
I18N="Section in the addons menu" text="Tracks"/>
|
|
||||||
<icon-button id="tab_update" width="128" height="128" icon="gui/package.png"
|
|
||||||
I18N="Section in the addons menu" text="Update"/>
|
|
||||||
</tabs>
|
|
||||||
|
|
||||||
<box proportion="1" width="100%" layout="vertical-row">
|
|
||||||
<label id="update_status" width="100%" height="10%" text_align="left" />
|
|
||||||
<spacer height="5%" width="100%"/>
|
|
||||||
<list id="list_addons" height="50%" proportion="5" width="100%" align="center"/>
|
|
||||||
<spacer height="15%" width="100%"/>
|
|
||||||
</box>
|
|
||||||
|
|
||||||
<spacer width="50" height="45" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button id="back" x="20" y="-40" width="250" height="35" align="left"
|
|
||||||
I18N="In the options menu, to go back to the main menu or game" text="Back"/>
|
|
||||||
|
|
||||||
</stkgui>
|
|
@ -89,7 +89,7 @@ public:
|
|||||||
/** True if this addon needs to be updated. */
|
/** True if this addon needs to be updated. */
|
||||||
bool needsUpdate() const
|
bool needsUpdate() const
|
||||||
{
|
{
|
||||||
return getInstalledVersion() < getVersion();
|
return m_installed && getInstalledVersion() < getVersion();
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Marks this addon to be installed. If the addon is marked as being
|
/** Marks this addon to be installed. If the addon is marked as being
|
||||||
|
@ -106,7 +106,6 @@ void AddonsScreen::loadList()
|
|||||||
icon);
|
icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_can_load_list = false;
|
|
||||||
getWidget<GUIEngine::RibbonWidget>("category")->setActivated();
|
getWidget<GUIEngine::RibbonWidget>("category")->setActivated();
|
||||||
getWidget<GUIEngine::LabelWidget>("update_status")->setText("");
|
getWidget<GUIEngine::LabelWidget>("update_status")->setText("");
|
||||||
if(m_type == "kart")
|
if(m_type == "kart")
|
||||||
|
@ -60,8 +60,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool m_can_load_list;
|
|
||||||
|
|
||||||
/** Load the addons into the main list.*/
|
/** Load the addons into the main list.*/
|
||||||
void loadList();
|
void loadList();
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ AddonsLoading::AddonsLoading(const float w, const float h,
|
|||||||
m_progress = NULL;
|
m_progress = NULL;
|
||||||
m_can_install = false;
|
m_can_install = false;
|
||||||
m_percent_update = false;
|
m_percent_update = false;
|
||||||
pthread_mutex_init(&m_mutex_can_install, NULL);
|
|
||||||
|
|
||||||
/*Init the icon here to be able to load a single image*/
|
/*Init the icon here to be able to load a single image*/
|
||||||
m_icon = getWidget<IconButtonWidget>("icon");
|
m_icon = getWidget<IconButtonWidget>("icon");
|
||||||
@ -83,6 +82,7 @@ void * AddonsLoading::downloadIcon( void * pthis)
|
|||||||
std::string icon_name = StringUtils::getBasename(me->m_addon.getIcon());
|
std::string icon_name = StringUtils::getBasename(me->m_addon.getIcon());
|
||||||
std::string icon_path = "icon/" + me->m_addon.getIcon();
|
std::string icon_path = "icon/" + me->m_addon.getIcon();
|
||||||
|
|
||||||
|
// FIXME: addons_loading might be removed before this finishes!
|
||||||
if(network_http->downloadFileSynchron(icon_path, icon_name))
|
if(network_http->downloadFileSynchron(icon_path, icon_name))
|
||||||
{
|
{
|
||||||
me->m_icon_loaded.set(ICON_LOADED);
|
me->m_icon_loaded.set(ICON_LOADED);
|
||||||
@ -98,60 +98,52 @@ void * AddonsLoading::downloadIcon( void * pthis)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
GUIEngine::EventPropagation
|
GUIEngine::EventPropagation
|
||||||
AddonsLoading::processEvent(const std::string& eventSource)
|
AddonsLoading::processEvent(const std::string& event_source)
|
||||||
{
|
{
|
||||||
if(eventSource == "cancel")
|
if(event_source == "cancel")
|
||||||
{
|
{
|
||||||
dismiss();
|
dismiss();
|
||||||
return GUIEngine::EVENT_BLOCK;
|
return GUIEngine::EVENT_BLOCK;
|
||||||
}
|
}
|
||||||
else if(eventSource == "next")
|
else if(event_source == "install")
|
||||||
{
|
{
|
||||||
// addons_manager->nextType(addons_manager->getType());
|
// Only display the progress bar etc. if we are
|
||||||
assert(false);
|
// not uninstalling an addon.
|
||||||
//loadInfo();
|
if(!m_addon.isInstalled() || m_addon.needsUpdate())
|
||||||
}
|
{
|
||||||
else if(eventSource == "previous")
|
assert(m_progress==NULL);
|
||||||
{
|
m_progress = new ProgressBarWidget();
|
||||||
// FIXME: addons_manager->previousType(addons_manager->getType());
|
m_progress->m_x = 180;
|
||||||
assert(false);
|
m_progress->m_y = m_area.getHeight()-45;
|
||||||
//loadInfo();
|
m_progress->m_w = 250;
|
||||||
}
|
m_progress->m_h = 35;
|
||||||
if(eventSource == "install")
|
m_progress->setParent(m_irrlicht_window);
|
||||||
{
|
|
||||||
assert(m_progress==NULL);
|
|
||||||
m_progress = new ProgressBarWidget();
|
|
||||||
m_progress->m_x = 180;
|
|
||||||
m_progress->m_y = m_area.getHeight()-45;
|
|
||||||
m_progress->m_w = 250;
|
|
||||||
m_progress->m_h = 35;
|
|
||||||
m_progress->setParent(m_irrlicht_window);
|
|
||||||
|
|
||||||
m_widgets.push_back(m_progress);
|
m_widgets.push_back(m_progress);
|
||||||
m_progress->add();
|
m_progress->add();
|
||||||
|
|
||||||
/*This widget will show some text as "downloading..." or "installing".*/
|
/*This widget will show some text as "downloading..." or "installing".*/
|
||||||
m_state = new LabelWidget();
|
m_state = new LabelWidget();
|
||||||
m_state->m_properties[PROP_TEXT_ALIGN] = "center";
|
m_state->m_properties[PROP_TEXT_ALIGN] = "center";
|
||||||
/* Center the widget*/
|
/* Center the widget*/
|
||||||
m_state->m_x = 10;
|
m_state->m_x = 10;
|
||||||
m_state->m_y = getHeight()-125;
|
m_state->m_y = getHeight()-125;
|
||||||
m_state->m_w = getWidth() - 20;
|
m_state->m_w = getWidth() - 20;
|
||||||
m_state->m_h = 35;
|
m_state->m_h = 35;
|
||||||
m_state->setParent(m_irrlicht_window);
|
m_state->setParent(m_irrlicht_window);
|
||||||
|
|
||||||
m_widgets.push_back(m_state);
|
m_widgets.push_back(m_state);
|
||||||
m_state->add();
|
m_state->add();
|
||||||
|
|
||||||
getWidget<ButtonWidget>("cancel")->setDeactivated();
|
getWidget<ButtonWidget>("cancel")->setDeactivated();
|
||||||
//FIXME : re-implement this buttons
|
getWidget<ButtonWidget>("install")->setDeactivated();
|
||||||
/*
|
m_percent_update = true;
|
||||||
m_next->setDeactivated();
|
startInstall();
|
||||||
m_previous->setDeactivated();
|
}
|
||||||
*/
|
else // uninstall
|
||||||
getWidget<ButtonWidget>("install")->setDeactivated();
|
{
|
||||||
m_percent_update = true;
|
endInstall();
|
||||||
startInstall();
|
}
|
||||||
}
|
}
|
||||||
return GUIEngine::EVENT_LET;
|
return GUIEngine::EVENT_LET;
|
||||||
} // processEvent
|
} // processEvent
|
||||||
@ -191,24 +183,16 @@ void AddonsLoading::onUpdate(float delta)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pthread_mutex_lock(&(m_mutex_can_install));
|
|
||||||
if(m_can_install)
|
if(m_can_install)
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
if(m_percent_update)
|
|
||||||
{
|
|
||||||
m_progress->setValue(addons_manager->getDownloadState());
|
|
||||||
m_state->setText(addons_manager->getDownloadStateAsStr().c_str());
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&(m_mutex_can_install));
|
|
||||||
} // onUpdate
|
} // onUpdate
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void AddonsLoading::close()
|
void AddonsLoading::close()
|
||||||
{
|
{
|
||||||
AddonsScreen* curr_screen = AddonsScreen::getInstance();
|
AddonsScreen* curr_screen = AddonsScreen::getInstance();
|
||||||
((AddonsScreen*)curr_screen)->m_can_load_list = true;
|
|
||||||
dismiss();
|
dismiss();
|
||||||
} // close
|
} // close
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Creates a modal dialog with given percentage of screen width and height
|
* Creates a modal dialog with given percentage of screen width and height
|
||||||
*/
|
*/
|
||||||
pthread_mutex_t m_mutex_can_install;
|
|
||||||
AddonsLoading(const float percent_width, const float percent_height,
|
AddonsLoading(const float percent_width, const float percent_height,
|
||||||
const std::string &addon_name);
|
const std::string &addon_name);
|
||||||
GUIEngine::EventPropagation processEvent(const std::string& event_source);
|
GUIEngine::EventPropagation processEvent(const std::string& event_source);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user