The internet status saved in the user config file can now have
three values: not-asked, allowed, not allowed. It defaults to 'not asked', which will enable us to show a popup message the first time STK is started. NOTE: you have to enable internet news in the UI settings now! git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8142 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
bca295bb97
commit
9e8a53631e
@ -65,7 +65,7 @@ NetworkHttp::NetworkHttp() : m_news(std::vector<NewsMessage>()),
|
||||
{
|
||||
m_current_news_message = -1;
|
||||
// Don't even start the network threads if networking is disabled.
|
||||
if(!UserConfigParams::m_enable_internet)
|
||||
if(!UserConfigParams::m_internet_status==NetworkHttp::IPERM_ALLOWED)
|
||||
return;
|
||||
|
||||
pthread_mutex_init(&m_mutex_command, NULL);
|
||||
@ -185,7 +185,7 @@ void *NetworkHttp::mainLoop(void *obj)
|
||||
*/
|
||||
NetworkHttp::~NetworkHttp()
|
||||
{
|
||||
if(!UserConfigParams::m_enable_internet)
|
||||
if(!UserConfigParams::m_internet_status==NetworkHttp::IPERM_ALLOWED)
|
||||
return;
|
||||
|
||||
// if a download should be active (which means it was cancelled by the
|
||||
|
@ -44,7 +44,17 @@ public:
|
||||
HC_QUIT,
|
||||
HC_INIT,
|
||||
HC_DOWNLOAD_FILE,
|
||||
HC_NEWS } ;
|
||||
HC_NEWS };
|
||||
|
||||
/** If stk has permission to access the internet (for news
|
||||
* server etc).
|
||||
* IPERM_NOT_ASKED: The user needs to be asked if he wants to
|
||||
* grant permission
|
||||
* IPERM_ALLOWED: STK is allowed to access server.
|
||||
* IPERM_NOT_ALLOWED: STK must not access external servers. */
|
||||
enum InternetPermission {IPERM_NOT_ASKED =0,
|
||||
IPERM_ALLOWED =1,
|
||||
IPERM_NOT_ALLOWED=2 };
|
||||
private:
|
||||
// A wrapper class to store news message together with
|
||||
// a message id and a display count.
|
||||
|
@ -442,10 +442,10 @@ namespace UserConfigParams
|
||||
&m_addon_group,
|
||||
"Ignore all messages with this id and lower") );
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_enable_internet
|
||||
PARAM_DEFAULT( BoolUserConfigParam(true, "enable_internet",
|
||||
PARAM_PREFIX IntUserConfigParam m_internet_status
|
||||
PARAM_DEFAULT( IntUserConfigParam(0, "enable_internet",
|
||||
&m_addon_group,
|
||||
"Enable news and addons server") );
|
||||
"Status of internet: 0 user wasn't asked, 1: allowe, 2: not allowed") );
|
||||
|
||||
PARAM_PREFIX TimeUserConfigParam m_addons_last_updated
|
||||
PARAM_DEFAULT( TimeUserConfigParam(0, "addon_last_updated",
|
||||
|
@ -121,7 +121,8 @@ void OptionsScreenUI::init()
|
||||
fps->setState( UserConfigParams::m_display_fps );
|
||||
CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
|
||||
assert( news != NULL );
|
||||
news->setState( UserConfigParams::m_enable_internet );
|
||||
news->setState( UserConfigParams::m_internet_status
|
||||
==NetworkHttp::IPERM_ALLOWED );
|
||||
CheckBoxWidget* min_gui = getWidget<CheckBoxWidget>("minimal-racegui");
|
||||
assert( min_gui != NULL );
|
||||
min_gui->setState( UserConfigParams::m_minimal_race_gui);
|
||||
@ -190,7 +191,9 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
|
||||
CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
|
||||
assert( news != NULL );
|
||||
delete network_http;
|
||||
UserConfigParams::m_enable_internet = news->getState();
|
||||
UserConfigParams::m_internet_status =
|
||||
news->getState() ? NetworkHttp::IPERM_ALLOWED
|
||||
: NetworkHttp::IPERM_NOT_ALLOWED;
|
||||
network_http = new NetworkHttp();
|
||||
}
|
||||
else if (name=="minimal-racegui")
|
||||
|
Loading…
Reference in New Issue
Block a user