Move UserReporter C++/JS functions from JSInterface_Debug.cpp to JSInterface_UserReport.cpp, refs #4772.
This way it stands out more as a separate feature that can be more easily exchanged, extended, maintained or conditionally removed from the build and leaves more transparent includes, refs #5257. Add missing string includes following7c2e9027c2
andd6cb9c845b
. Remove unused Profile include following38d6f81d71
andd6cb9c845b
. Remove unused CLogger include, add missing debug include followingd6cb9c845b
. Remove unused CConsole include following9f0484e5ce
/ D1073. Remove unused ProfilerViewer include following2af94c5898
. This was SVN commit r21866.
This commit is contained in:
parent
22791af91f
commit
9e712fa0c5
@ -34,6 +34,7 @@
|
||||
#include "ps/scripting/JSInterface_Mod.h"
|
||||
#include "ps/scripting/JSInterface_ModIo.h"
|
||||
#include "ps/scripting/JSInterface_SavedGame.h"
|
||||
#include "ps/scripting/JSInterface_UserReport.h"
|
||||
#include "ps/scripting/JSInterface_VFS.h"
|
||||
#include "ps/scripting/JSInterface_VisualReplay.h"
|
||||
#include "renderer/scripting/JSInterface_Renderer.h"
|
||||
@ -67,6 +68,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
|
||||
JSI_SavedGame::RegisterScriptFunctions(scriptInterface);
|
||||
JSI_Simulation::RegisterScriptFunctions(scriptInterface);
|
||||
JSI_Sound::RegisterScriptFunctions(scriptInterface);
|
||||
JSI_UserReport::RegisterScriptFunctions(scriptInterface);
|
||||
JSI_VFS::RegisterScriptFunctions_GUI(scriptInterface);
|
||||
JSI_VisualReplay::RegisterScriptFunctions(scriptInterface);
|
||||
}
|
||||
|
@ -21,13 +21,11 @@
|
||||
|
||||
#include "i18n/L10n.h"
|
||||
#include "lib/svn_revision.h"
|
||||
#include "ps/CConsole.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/ProfileViewer.h"
|
||||
#include "ps/UserReport.h"
|
||||
#include "lib/debug.h"
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* Microseconds since the epoch.
|
||||
*/
|
||||
@ -117,21 +115,6 @@ std::wstring JSI_Debug::GetBuildTimestamp(ScriptInterface::CxPrivate* UNUSED(pCx
|
||||
return wstring_from_utf8(buf);
|
||||
}
|
||||
|
||||
bool JSI_Debug::IsUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
return g_UserReporter.IsReportingEnabled();
|
||||
}
|
||||
|
||||
void JSI_Debug::SetUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled)
|
||||
{
|
||||
g_UserReporter.SetReportingEnabled(enabled);
|
||||
}
|
||||
|
||||
std::string JSI_Debug::GetUserReportStatus(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
return g_UserReporter.GetStatus();
|
||||
}
|
||||
|
||||
void JSI_Debug::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<double, &GetMicroseconds>("GetMicroseconds");
|
||||
@ -139,9 +122,4 @@ void JSI_Debug::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<void, &DebugWarn>("DebugWarn");
|
||||
scriptInterface.RegisterFunction<void, std::wstring, &DisplayErrorDialog>("DisplayErrorDialog");
|
||||
scriptInterface.RegisterFunction<std::wstring, int, &GetBuildTimestamp>("GetBuildTimestamp");
|
||||
|
||||
// User report functions
|
||||
scriptInterface.RegisterFunction<bool, &IsUserReportEnabled>("IsUserReportEnabled");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetUserReportEnabled>("SetUserReportEnabled");
|
||||
scriptInterface.RegisterFunction<std::string, &GetUserReportStatus>("GetUserReportStatus");
|
||||
}
|
||||
|
@ -20,14 +20,13 @@
|
||||
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace JSI_Debug
|
||||
{
|
||||
int Crash(ScriptInterface::CxPrivate* UNUSED(pCxPrivate));
|
||||
void DebugWarn(ScriptInterface::CxPrivate* UNUSED(pCxPrivate));
|
||||
void DisplayErrorDialog(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& msg);
|
||||
bool IsUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate));
|
||||
void SetUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled);
|
||||
std::string GetUserReportStatus(ScriptInterface::CxPrivate* UNUSED(pCxPrivate));
|
||||
std::wstring GetBuildTimestamp(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int mode);
|
||||
double GetMicroseconds(ScriptInterface::CxPrivate* UNUSED(pCxPrivate));
|
||||
|
||||
|
47
source/ps/scripting/JSInterface_UserReport.cpp
Normal file
47
source/ps/scripting/JSInterface_UserReport.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "JSInterface_UserReport.h"
|
||||
|
||||
#include "ps/UserReport.h"
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
bool JSI_UserReport::IsUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
return g_UserReporter.IsReportingEnabled();
|
||||
}
|
||||
|
||||
void JSI_UserReport::SetUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled)
|
||||
{
|
||||
g_UserReporter.SetReportingEnabled(enabled);
|
||||
}
|
||||
|
||||
std::string JSI_UserReport::GetUserReportStatus(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
return g_UserReporter.GetStatus();
|
||||
}
|
||||
|
||||
void JSI_UserReport::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<bool, &IsUserReportEnabled>("IsUserReportEnabled");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetUserReportEnabled>("SetUserReportEnabled");
|
||||
scriptInterface.RegisterFunction<std::string, &GetUserReportStatus>("GetUserReportStatus");
|
||||
}
|
34
source/ps/scripting/JSInterface_UserReport.h
Normal file
34
source/ps/scripting/JSInterface_UserReport.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_JSI_USERREPORT
|
||||
#define INCLUDED_JSI_USERREPORT
|
||||
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace JSI_UserReport
|
||||
{
|
||||
bool IsUserReportEnabled(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
void SetUserReportEnabled(ScriptInterface::CxPrivate* pCxPrivate, bool enabled);
|
||||
std::string GetUserReportStatus(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
|
||||
void RegisterScriptFunctions(const ScriptInterface& ScriptInterface);
|
||||
}
|
||||
|
||||
#endif // INCLUDED_JSI_USERREPORT
|
Loading…
Reference in New Issue
Block a user