Civ backgrounds for minimap
[0ad.git] / source / ps / UserReport.h
blob166726d41e897d3f1a2ba11f83ac39610c884316
1 /* Copyright (C) 2018 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef INCLUDED_USERREPORT
19 #define INCLUDED_USERREPORT
21 #include <string>
23 class CUserReporterWorker;
25 class CUserReporter
27 public:
28 CUserReporter();
29 ~CUserReporter();
31 void Initialize();
32 void Deinitialize();
34 /**
35 * Must be called frequently (preferably every frame), to update some
36 * internal reconnection timers.
38 void Update();
40 // Functions for the GUI to control the reporting:
41 bool IsReportingEnabled();
42 void SetReportingEnabled(bool enabled);
43 std::string GetStatus();
45 /**
46 * Submit a report to be transmitted to the online server.
47 * Nothing will be transmitted until reporting is enabled by the user, so
48 * you don't need to check for that first.
49 * @param type short string identifying the type of data ("hwdetect", "message", etc)
50 * @param version positive integer that should be incremented if the data is changed in
51 * a non-compatible way and the server will have to distinguish old and new formats
52 * @param data the actual data (typically UTF-8-encoded text, or JSON, but could be binary)
53 * @param dataHumanReadable an optional, readable representation of the same data, allowing users to assess for privacy concerns
55 void SubmitReport(const std::string& type, int version, const std::string& data, const std::string& dataHumanReadable);
57 private:
58 std::string LoadUserID();
60 CUserReporterWorker* m_Worker;
63 extern CUserReporter g_UserReporter;
65 #endif // INCLUDED_USERREPORT