code cleanup in addons_loading (remove the use of 'this' for the back button, I am going to remove all 'this')

move this->update_status to m_update_status in addons_screen
disable the focus on the image in the addon dialog

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5617 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
xapantu 2010-07-02 14:59:21 +00:00
parent f4f78803b3
commit 088efbb96a
4 changed files with 25 additions and 25 deletions

View File

@ -93,7 +93,7 @@ void AddonsScreen::loadList()
}
//remove the text from the widget : "Updating list..." (see l164)
this->update_status->setText("");
m_update_status->setText("");
this->can_load_list = false;
}
// ------------------------------------------------------------------------------------------------------
@ -119,7 +119,7 @@ void AddonsScreen::eventCallback(GUIEngine::Widget* widget, const std::string& n
if (name == "category")
{
std::string selection = ((GUIEngine::RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "tab_update") StateManager::get()->replaceTopMostScreen(AddonsUpdateScreen::getInstance());
}
}
@ -136,7 +136,7 @@ void AddonsScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
}
void AddonsScreen::init()
{
this->update_status = this->getWidget<GUIEngine::LabelWidget>("update_status");
m_update_status = this->getWidget<GUIEngine::LabelWidget>("update_status");
std::cout << "Addons dir:" + file_manager->getAddonsDir() << std::endl;
this->type = "track";
GUIEngine::ListWidget* w_list = this->getWidget<GUIEngine::ListWidget>("list_addons");
@ -144,6 +144,7 @@ void AddonsScreen::init()
//w_list->clear();
std::cout << "icon bank" << std::endl;
this->can_load_list = false;
m_update_status->setText(_("Updating the list..."));
pthread_t thread;
pthread_create(&thread, NULL, &AddonsScreen::downloadList, this);
}
@ -157,7 +158,6 @@ void AddonsScreen::tearDown()
void * AddonsScreen::downloadList( void * pthis)
{
AddonsScreen * pt = (AddonsScreen*)pthis;
pt->update_status->setText(_("Updating the list..."));
//load all karts...
pt->addons = new Addons();
pthread_mutex_lock(&(pt->mutex));

View File

@ -38,15 +38,15 @@ namespace GUIEngine { class Widget; }
class AddonsScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<AddonsScreen>
{
friend class GUIEngine::ScreenSingleton<AddonsScreen>;
AddonsScreen();
Addons * addons;
AddonsLoading * load;
void loadInformations();
/** For the addons list, a package when it is installed. */
irr::gui::STKModifiedSpriteBank* m_icon_bank;
GUIEngine::LabelWidget* update_status;
GUIEngine::LabelWidget* m_update_status;
public:
bool can_load_list;
@ -55,13 +55,13 @@ public:
void loadList();
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile();
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void init();
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void tearDown();
friend void * startInstall(void *);

View File

@ -47,7 +47,7 @@ AddonsLoading::AddonsLoading(Addons * id, const float w, const float h) :
core::rect< s32 > area_left(m_area.getWidth()/2 + 20, 0, m_area.getWidth(), m_area.getHeight());
/*Init the icon here to be able to load a single image*/
icon = new IconButtonWidget();
icon = new IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO, false, /*focusbale*/ false);
/* Next and previous button*/
IconButtonWidget * next_previous = new IconButtonWidget();
@ -133,20 +133,20 @@ void AddonsLoading::loadInfo()
this->back_button = new ButtonWidget();
/*this->back_button->setLabel(std::string("Back").c_str());*/
this->back_button->m_text = _("Back");
this->back_button->m_properties[PROP_ID] = "cancel";
this->back_button->x = 20;
this->back_button->y = m_area.getHeight()-45;
this->back_button->setParent(m_irrlicht_window);
m_children.push_back(this->back_button);
this->back_button->w = 150;
this->back_button->h = 35;
this->back_button->add();
m_back_button = new ButtonWidget();
/*m_back_button->setLabel(std::string("Back").c_str());*/
m_back_button->m_text = _("Back");
m_back_button->m_properties[PROP_ID] = "cancel";
m_back_button->x = 20;
m_back_button->y = m_area.getHeight()-45;
m_back_button->setParent(m_irrlicht_window);
m_children.push_back(m_back_button);
m_back_button->w = 150;
m_back_button->h = 35;
m_back_button->add();
this->install_button = new ButtonWidget();
/*this->back_button->setLabel(std::string("Back").c_str());*/
/*m_back_button->setLabel(std::string("Back").c_str());*/
if(this->addons->IsInstalled() == "yes")
this->install_button->m_text = _("Uninstall");
else
@ -183,7 +183,7 @@ GUIEngine::EventPropagation AddonsLoading::processEvent(const std::string& event
}
if(eventSource == "install")
{
this->back_button->setDeactivated();
m_back_button->setDeactivated();
this->install_button->setDeactivated();
pthread_t thread;
pthread_create(&thread, NULL, &AddonsLoading::startInstall, this);

View File

@ -34,7 +34,7 @@ private:
GUIEngine::LabelWidget * description;
GUIEngine::LabelWidget * version;
GUIEngine::LabelWidget * author;
GUIEngine::ButtonWidget * back_button;
GUIEngine::ButtonWidget * m_back_button;
GUIEngine::ButtonWidget * install_button;
GUIEngine::IconButtonWidget * icon;
static void * startInstall(void*);