mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 15:17:37 +03:00
40 lines
940 B
C++
40 lines
940 B
C++
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
struct RecentBookInfo {
|
|
std::string title;
|
|
std::string author;
|
|
std::string coverBmpPath;
|
|
std::string path;
|
|
};
|
|
|
|
class RecentBooksStore {
|
|
// Static instance
|
|
static RecentBooksStore instance;
|
|
|
|
std::vector<std::string> recentBooks;
|
|
|
|
public:
|
|
~RecentBooksStore() = default;
|
|
|
|
// Get singleton instance
|
|
static RecentBooksStore& getInstance() { return instance; }
|
|
|
|
// Add a book path to the recent list (moves to front if already exists)
|
|
void addBook(const std::string& path);
|
|
|
|
// Get the list of recent book paths (most recent first)
|
|
const std::vector<std::string>& getBooks() const { return recentBooks; }
|
|
|
|
// Get the count of recent books
|
|
int getCount() const { return static_cast<int>(recentBooks.size()); }
|
|
|
|
bool saveToFile() const;
|
|
|
|
bool loadFromFile();
|
|
};
|
|
|
|
// Helper macro to access recent books store
|
|
#define RECENT_BOOKS RecentBooksStore::getInstance()
|