2017-10-20 11:26:15 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <boost/filesystem.hpp>
|
|
|
|
#include "Types.h"
|
|
|
|
#include "Singleton.h"
|
|
|
|
#include "sqlite/SqliteDb.h"
|
2017-10-20 12:23:10 -04:00
|
|
|
#include "sqlite/SqliteStatement.h"
|
2017-10-20 11:26:15 -04:00
|
|
|
|
|
|
|
namespace BootablesDb
|
|
|
|
{
|
|
|
|
struct Bootable
|
|
|
|
{
|
|
|
|
boost::filesystem::path path;
|
|
|
|
std::string discId;
|
2017-10-20 12:23:10 -04:00
|
|
|
std::string title;
|
|
|
|
std::string coverUrl;
|
2019-01-05 22:57:08 +00:00
|
|
|
std::string overview;
|
2017-10-20 11:26:15 -04:00
|
|
|
time_t lastBootedTime = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CClient : public CSingleton<CClient>
|
|
|
|
{
|
|
|
|
public:
|
2019-02-11 13:23:13 -05:00
|
|
|
//NOTE: This is duplicated in the Android Java code (in BootablesInterop.java) - values matter
|
|
|
|
enum SORT_METHOD
|
|
|
|
{
|
|
|
|
SORT_METHOD_RECENT,
|
|
|
|
SORT_METHOD_HOMEBREW,
|
|
|
|
SORT_METHOD_NONE,
|
|
|
|
};
|
|
|
|
|
2017-10-20 11:26:15 -04:00
|
|
|
CClient();
|
|
|
|
virtual ~CClient() = default;
|
|
|
|
|
|
|
|
Bootable GetBootable(const boost::filesystem::path&);
|
2019-02-11 13:23:13 -05:00
|
|
|
std::vector<Bootable> GetBootables(int32_t = SORT_METHOD_NONE);
|
2017-10-20 11:26:15 -04:00
|
|
|
|
2019-01-06 14:09:34 +00:00
|
|
|
void RegisterBootable(const boost::filesystem::path&, const char*, const char*);
|
2017-10-27 18:06:59 -04:00
|
|
|
void UnregisterBootable(const boost::filesystem::path&);
|
2017-10-20 11:26:15 -04:00
|
|
|
|
|
|
|
void SetDiscId(const boost::filesystem::path&, const char*);
|
2017-10-20 12:23:10 -04:00
|
|
|
void SetTitle(const boost::filesystem::path&, const char*);
|
2017-10-23 07:27:42 -04:00
|
|
|
void SetCoverUrl(const boost::filesystem::path&, const char*);
|
2017-10-20 11:26:15 -04:00
|
|
|
void SetLastBootedTime(const boost::filesystem::path&, time_t);
|
2019-01-06 12:27:31 +00:00
|
|
|
void SetOverview(const boost::filesystem::path& path, const char* overview);
|
2017-10-20 11:26:15 -04:00
|
|
|
|
|
|
|
private:
|
2017-10-20 12:23:10 -04:00
|
|
|
static Bootable ReadBootable(Framework::CSqliteStatement&);
|
|
|
|
|
2017-10-20 11:26:15 -04:00
|
|
|
void CheckDbVersion();
|
|
|
|
|
|
|
|
boost::filesystem::path m_dbPath;
|
|
|
|
Framework::CSqliteDb m_db;
|
|
|
|
};
|
|
|
|
};
|