In the addons screen, show a tip to remember that the Internet connection is disabled. (Issue #1763). (#2605)

This commit is contained in:
Alpt 2016-08-20 00:28:59 +02:00 committed by auriamg
parent a1c09c4adb
commit 67e94e73ce
3 changed files with 63 additions and 1 deletions

View File

@ -33,5 +33,8 @@
<box proportion="1" width="98%" align="center" layout="vertical-row" padding="6"> <box proportion="1" width="98%" align="center" layout="vertical-row" padding="6">
<list id="list_addons" x="0" y="0" width="100%" height="100%"/> <list id="list_addons" x="0" y="0" width="100%" height="100%"/>
</box> </box>
<bright width="97%" id="tips_label" text="" align="center"/>
</div> </div>
</stkgui> </stkgui>

View File

@ -65,6 +65,7 @@ AddonsScreen::AddonsScreen() : Screen("addons_screen.stkgui")
m_date_filters.push_back(filter_1y); m_date_filters.push_back(filter_1y);
m_date_filters.push_back(filter_2y); m_date_filters.push_back(filter_2y);
m_show_tips = true;
} // AddonsScreen } // AddonsScreen
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -95,7 +96,11 @@ void AddonsScreen::loadedFromFile()
GUIEngine::ListWidget* w_list = GUIEngine::ListWidget* w_list =
getWidget<GUIEngine::ListWidget>("list_addons"); getWidget<GUIEngine::ListWidget>("list_addons");
w_list->setColumnListener(this); w_list->setColumnListener(this);
GUIEngine::LabelWidget* w_tips =
getWidget<GUIEngine::LabelWidget>("tips_label");
w_tips->setScrollSpeed(15);
} // loadedFromFile } // loadedFromFile
@ -130,6 +135,26 @@ void AddonsScreen::beforeAddingWidget()
{ {
w_filter_rating->addLabel(StringUtils::toWString(n / 2.0)); w_filter_rating->addLabel(StringUtils::toWString(n / 2.0));
} }
GUIEngine::LabelWidget *w_tips =
getWidget<GUIEngine::LabelWidget>("tips_label");
bool ip = UserConfigParams::m_internet_status == RequestManager::IPERM_ALLOWED;
if(!ip)
{
w_tips->setVisible(true);
w_tips->setText( _("Access to the Internet is disabled. "
"(To enable it, go to options and "
"select tab 'User Interface')"),
false);
w_tips->m_properties[GUIEngine::PROP_HEIGHT] = "fit";
calculateLayout();
m_show_tips = true;
}
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -157,7 +182,21 @@ void AddonsScreen::init()
w_list->setIcons(m_icon_bank, (int)(m_icon_height)); w_list->setIcons(m_icon_bank, (int)(m_icon_height));
m_type = "kart"; m_type = "kart";
bool ip = UserConfigParams::m_internet_status == RequestManager::IPERM_ALLOWED; bool ip = UserConfigParams::m_internet_status == RequestManager::IPERM_ALLOWED;
if(ip)
{
// Nothing to show in the tips label, disable it.
GUIEngine::LabelWidget *w_tips =
getWidget<GUIEngine::LabelWidget>("tips_label");
w_tips->setVisible(false);
w_tips->m_properties[GUIEngine::PROP_HEIGHT] = "0";
calculateLayout();
m_show_tips = false;
} // ip
getWidget<GUIEngine::IconButtonWidget>("reload")->setActive(ip); getWidget<GUIEngine::IconButtonWidget>("reload")->setActive(ip);
// Reset filter. // Reset filter.
@ -525,4 +564,22 @@ void AddonsScreen::onUpdate(float dt)
// Addons manager is still initialising/downloading. // Addons manager is still initialising/downloading.
} }
} }
if(m_show_tips)
{
GUIEngine::LabelWidget *w_tips =
getWidget<GUIEngine::LabelWidget>("tips_label");
w_tips->update(dt);
if(w_tips->scrolledOff())
{
// Tips have been shown once. Disable tips_label.
w_tips->setVisible(false);
w_tips->m_properties[GUIEngine::PROP_HEIGHT] = "0";
calculateLayout();
m_show_tips = false;
}
}
} // onUpdate } // onUpdate

View File

@ -84,6 +84,8 @@ private:
/** List of date filters **/ /** List of date filters **/
std::vector<DateFilter> m_date_filters; std::vector<DateFilter> m_date_filters;
bool m_show_tips;
public: public:
/** Load the addons into the main list.*/ /** Load the addons into the main list.*/