Qt: move ReadJSON in game compat to its own function
This commit is contained in:
@@ -15,10 +15,7 @@ game_compatibility::game_compatibility(std::shared_ptr<gui_settings> settings) :
|
||||
RequestCompatibility();
|
||||
}
|
||||
|
||||
void game_compatibility::RequestCompatibility(bool online)
|
||||
{
|
||||
// Creates new map from database
|
||||
auto ReadJSON = [=](const QJsonObject& json_data, bool after_download)
|
||||
bool game_compatibility::ReadJSON(const QJsonObject& json_data, bool after_download)
|
||||
{
|
||||
int return_code = json_data["return_code"].toInt();
|
||||
|
||||
@@ -81,8 +78,10 @@ void game_compatibility::RequestCompatibility(bool online)
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
void game_compatibility::RequestCompatibility(bool online)
|
||||
{
|
||||
if (!online)
|
||||
{
|
||||
// Retrieve database from file
|
||||
|
||||
@@ -28,6 +28,7 @@ class game_compatibility : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
const std::map<QString, compat_status> Status_Data =
|
||||
{
|
||||
{ "Playable", { 0, "", "#1ebc61", QObject::tr("Playable"), QObject::tr("Games that can be properly played from start to finish") } },
|
||||
@@ -49,6 +50,9 @@ class game_compatibility : public QObject
|
||||
std::unique_ptr<QNetworkAccessManager> m_network_access_manager;
|
||||
std::map<std::string, compat_status> m_compat_database;
|
||||
|
||||
/** Creates new map from the database */
|
||||
bool ReadJSON(const QJsonObject& json_data, bool after_download);
|
||||
|
||||
public:
|
||||
/** Handles reads, writes and downloads for the compatibility database */
|
||||
game_compatibility(std::shared_ptr<gui_settings> settings);
|
||||
|
||||
Reference in New Issue
Block a user