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) //remove the text from the widget : "Updating list..." (see l164)
this->update_status->setText(""); m_update_status->setText("");
this->can_load_list = false; this->can_load_list = false;
} }
// ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------
@ -136,7 +136,7 @@ void AddonsScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
} }
void AddonsScreen::init() 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; std::cout << "Addons dir:" + file_manager->getAddonsDir() << std::endl;
this->type = "track"; this->type = "track";
GUIEngine::ListWidget* w_list = this->getWidget<GUIEngine::ListWidget>("list_addons"); GUIEngine::ListWidget* w_list = this->getWidget<GUIEngine::ListWidget>("list_addons");
@ -144,6 +144,7 @@ void AddonsScreen::init()
//w_list->clear(); //w_list->clear();
std::cout << "icon bank" << std::endl; std::cout << "icon bank" << std::endl;
this->can_load_list = false; this->can_load_list = false;
m_update_status->setText(_("Updating the list..."));
pthread_t thread; pthread_t thread;
pthread_create(&thread, NULL, &AddonsScreen::downloadList, this); pthread_create(&thread, NULL, &AddonsScreen::downloadList, this);
} }
@ -157,7 +158,6 @@ void AddonsScreen::tearDown()
void * AddonsScreen::downloadList( void * pthis) void * AddonsScreen::downloadList( void * pthis)
{ {
AddonsScreen * pt = (AddonsScreen*)pthis; AddonsScreen * pt = (AddonsScreen*)pthis;
pt->update_status->setText(_("Updating the list..."));
//load all karts... //load all karts...
pt->addons = new Addons(); pt->addons = new Addons();
pthread_mutex_lock(&(pt->mutex)); pthread_mutex_lock(&(pt->mutex));

View File

@ -45,7 +45,7 @@ class AddonsScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton
void loadInformations(); void loadInformations();
/** For the addons list, a package when it is installed. */ /** For the addons list, a package when it is installed. */
irr::gui::STKModifiedSpriteBank* m_icon_bank; irr::gui::STKModifiedSpriteBank* m_icon_bank;
GUIEngine::LabelWidget* update_status; GUIEngine::LabelWidget* m_update_status;
public: public:

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()); 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*/ /*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*/ /* Next and previous button*/
IconButtonWidget * next_previous = new IconButtonWidget(); IconButtonWidget * next_previous = new IconButtonWidget();
@ -133,20 +133,20 @@ void AddonsLoading::loadInfo()
this->back_button = new ButtonWidget(); m_back_button = new ButtonWidget();
/*this->back_button->setLabel(std::string("Back").c_str());*/ /*m_back_button->setLabel(std::string("Back").c_str());*/
this->back_button->m_text = _("Back"); m_back_button->m_text = _("Back");
this->back_button->m_properties[PROP_ID] = "cancel"; m_back_button->m_properties[PROP_ID] = "cancel";
this->back_button->x = 20; m_back_button->x = 20;
this->back_button->y = m_area.getHeight()-45; m_back_button->y = m_area.getHeight()-45;
this->back_button->setParent(m_irrlicht_window); m_back_button->setParent(m_irrlicht_window);
m_children.push_back(this->back_button); m_children.push_back(m_back_button);
this->back_button->w = 150; m_back_button->w = 150;
this->back_button->h = 35; m_back_button->h = 35;
this->back_button->add(); m_back_button->add();
this->install_button = new ButtonWidget(); 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") if(this->addons->IsInstalled() == "yes")
this->install_button->m_text = _("Uninstall"); this->install_button->m_text = _("Uninstall");
else else
@ -183,7 +183,7 @@ GUIEngine::EventPropagation AddonsLoading::processEvent(const std::string& event
} }
if(eventSource == "install") if(eventSource == "install")
{ {
this->back_button->setDeactivated(); m_back_button->setDeactivated();
this->install_button->setDeactivated(); this->install_button->setDeactivated();
pthread_t thread; pthread_t thread;
pthread_create(&thread, NULL, &AddonsLoading::startInstall, this); pthread_create(&thread, NULL, &AddonsLoading::startInstall, this);

View File

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