Allow disabling of hw stats collection.

This commit is contained in:
hiker 2014-10-22 08:20:26 +11:00
parent 690ad4ce95
commit c012e98f9b
5 changed files with 63 additions and 5 deletions

View File

@ -33,6 +33,12 @@
<label height="100%" I18N="In the ui settings" text="Display FPS"/>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<checkbox id="show-login"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Always show login screen"/>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<checkbox id="enable-internet"/>
<spacer width="20" height="100%" />
@ -40,9 +46,10 @@
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<checkbox id="show-login"/>
<checkbox id="enable-hw-report"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Always show login screen"/>
<label id="label-hw-report" height="100%" I18N="In the ui settings"
text="Allow STK to send anonymous HW statistics"/>
</div>
<spacer height="18" width="4"/>

View File

@ -257,6 +257,9 @@ const std::string& getOSVersion()
*/
void reportHardwareStats()
{
if(!UserConfigParams::m_hw_report_enable)
return;
// Version of the hw report, which is stored in the DB. If new fields
// are added, increase this version. Each STK installation will report
// its configuration only once (per version number). So if the version

View File

@ -698,6 +698,12 @@ namespace UserConfigParams
&m_hw_report_group,
"The server used for reporting statistics to."));
PARAM_PREFIX BoolUserConfigParam m_hw_report_enable
PARAM_DEFAULT( BoolUserConfigParam( true,
"hw-report-enabled",
&m_hw_report_group,
"If HW reports are enabled."));
// ---- User management
PARAM_PREFIX BoolUserConfigParam m_always_show_login_screen

View File

@ -1150,11 +1150,12 @@ void askForInternetPermission()
}; // ConfirmServer
new MessageDialog(_("SuperTuxKart may connect to a server "
"to download add-ons and notify you of updates. Would you "
"like this feature to be enabled? (To change this setting "
"to download add-ons and notify you of updates. We also collect "
"anonymous hardware statistics to help with the development of STK. "
"Would you like this feature to be enabled? (To change this setting "
"at a later time, go to options, select tab "
"'User Interface', and edit \"Allow STK to connect to the "
"Internet\")."),
"Internet\" and \"Allow STK to send anonymous HW statistics\")."),
MessageDialog::MESSAGE_DIALOG_CONFIRM,
new ConfirmServer(), true);
}
@ -1302,6 +1303,8 @@ int main(int argc, char *argv[] )
}
}
// Note that on the very first run of STK internet status is set to
// "not asked", so the report will only be sent in the next run.
if(UserConfigParams::m_internet_status==Online::RequestManager::IPERM_ALLOWED)
{
HardwareStats::reportHardwareStats();

View File

@ -21,12 +21,14 @@
#include "audio/music_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "config/hardware_stats.hpp"
#include "config/user_config.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widgets/button_widget.hpp"
#include "guiengine/widgets/check_box_widget.hpp"
#include "guiengine/widgets/dynamic_ribbon_widget.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "guiengine/widgets/list_widget.hpp"
#include "guiengine/widgets/spinner_widget.hpp"
#include "guiengine/widget.hpp"
@ -130,6 +132,23 @@ void OptionsScreenUI::init()
assert( news != NULL );
news->setState( UserConfigParams::m_internet_status
==RequestManager::IPERM_ALLOWED );
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
assert( stats != NULL );
LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
assert( stats_label );
stats->setState(UserConfigParams::m_hw_report_enable);
if(news->getState())
{
stats_label->setVisible(true);
stats->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
}
else
{
stats_label->setVisible(false);
stats->setVisible(false);
}
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login!= NULL );
@ -251,8 +270,28 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
// If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be
// downloaded if necessary.
CheckBoxWidget *stats = getWidget<CheckBoxWidget>("enable-hw-report");
LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
if(internet->getState())
{
NewsManager::get()->init(false);
stats->setVisible(true);
stats_label->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
}
else
{
stats->setVisible(false);
stats_label->setVisible(false);
}
}
else if (name=="enable-hw-report")
{
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
UserConfigParams::m_hw_report_enable = stats->getState();
if(stats->getState())
HardwareStats::reportHardwareStats();
}
else if (name=="show-login")
{