Feature: Plugin framework for Social Integration with Steam, Discord, GOG, etc (#11628)
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
#include "base_media_base.h"
|
||||
#include "blitter/factory.hpp"
|
||||
|
||||
#include "social_integration.h"
|
||||
|
||||
#ifdef WITH_ALLEGRO
|
||||
# include <allegro.h>
|
||||
#endif /* WITH_ALLEGRO */
|
||||
@@ -81,6 +83,17 @@ NLOHMANN_JSON_SERIALIZE_ENUM(GRFStatus, {
|
||||
{GRFStatus::GCS_ACTIVATED, "activated"},
|
||||
})
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(SocialIntegrationPlugin::State, {
|
||||
{SocialIntegrationPlugin::State::RUNNING, "running"},
|
||||
{SocialIntegrationPlugin::State::FAILED, "failed"},
|
||||
{SocialIntegrationPlugin::State::PLATFORM_NOT_RUNNING, "platform_not_running"},
|
||||
{SocialIntegrationPlugin::State::UNLOADED, "unloaded"},
|
||||
{SocialIntegrationPlugin::State::DUPLICATE, "duplicate"},
|
||||
{SocialIntegrationPlugin::State::UNSUPPORTED_API, "unsupported_api"},
|
||||
{SocialIntegrationPlugin::State::INVALID_SIGNATURE, "invalid_signature"},
|
||||
})
|
||||
|
||||
|
||||
/** Lookup table to convert a VehicleType to a string. */
|
||||
static const std::string _vehicle_type_to_string[] = {
|
||||
"train",
|
||||
@@ -435,6 +448,26 @@ void SurveyLibraries(nlohmann::json &survey)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert plugin information to JSON.
|
||||
*
|
||||
* @param survey The JSON object.
|
||||
*/
|
||||
void SurveyPlugins(nlohmann::json &survey)
|
||||
{
|
||||
auto _plugins = SocialIntegration::GetPlugins();
|
||||
|
||||
for (auto &plugin : _plugins) {
|
||||
auto &platform = survey[plugin->social_platform];
|
||||
platform.push_back({
|
||||
{"name", plugin->name},
|
||||
{"version", plugin->version},
|
||||
{"basepath", plugin->basepath},
|
||||
{"state", plugin->state},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the bytes of memory into a textual version rounded up to the biggest unit.
|
||||
*
|
||||
|
Reference in New Issue
Block a user