2022-02-27 07:53:44 -05:00
|
|
|
#include <STDInclude.hpp>
|
2017-02-04 12:42:12 -05:00
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
std::mutex Changelog::Mutex;
|
|
|
|
std::vector<std::string> Changelog::Lines;
|
2017-02-04 12:42:12 -05:00
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
void Changelog::LoadChangelog()
|
2017-02-04 12:42:12 -05:00
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
//if (!Changelog::Lines.empty())
|
|
|
|
// return;
|
2017-02-04 13:07:02 -05:00
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
std::lock_guard<std::mutex> _(Changelog::Mutex);
|
|
|
|
Changelog::Lines.clear();
|
2020-12-09 15:56:19 -05:00
|
|
|
std::string data = Utils::Cache::GetFile("/develop/CHANGELOG.md");
|
2017-02-04 12:42:12 -05:00
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
if (data.empty())
|
2017-02-04 12:42:12 -05:00
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
data = "^1Unable to get changelog.";
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|
|
|
|
|
2022-02-26 17:50:53 -05:00
|
|
|
Changelog::Lines = Utils::String::Split(data, '\n');
|
2017-02-04 12:42:12 -05:00
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
for (auto& line : Changelog::Lines)
|
|
|
|
{
|
2017-02-04 12:42:12 -05:00
|
|
|
Utils::String::Replace(line, "\r", "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int Changelog::GetChangelogCount()
|
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
return Changelog::Lines.size();
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Omit column here
|
|
|
|
const char* Changelog::GetChangelogText(unsigned int item, int /*column*/)
|
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
std::lock_guard<std::mutex> _(Changelog::Mutex);
|
|
|
|
if (item < Changelog::Lines.size())
|
2017-02-04 12:42:12 -05:00
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
return Utils::String::VA("%s", Changelog::Lines[item].data());
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
void Changelog::SelectChangelog(unsigned int /*index*/)
|
|
|
|
{
|
|
|
|
// Don't do anything in here
|
|
|
|
}
|
2017-02-04 12:42:12 -05:00
|
|
|
|
|
|
|
Changelog::Changelog()
|
|
|
|
{
|
2017-02-25 06:54:26 -05:00
|
|
|
if (Dedicated::IsEnabled()) return;
|
|
|
|
|
2017-02-04 12:42:12 -05:00
|
|
|
// Changelog
|
2017-02-06 15:23:15 -05:00
|
|
|
UIFeeder::Add(62.0f, Changelog::GetChangelogCount, Changelog::GetChangelogText, Changelog::SelectChangelog);
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|
|
|
|
}
|