39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#pragma once
|
|
#include "platform.h"
|
|
#include <mutex>
|
|
namespace ks
|
|
{
|
|
Settings loadSettings(const std::filesystem::path &, const std::vector<Layout> &);
|
|
Settings decodeSettings(const Bytes &, const std::vector<Layout> &);
|
|
Bytes encodeSettings(const Settings &);
|
|
void saveSettings(const std::filesystem::path &, const Settings &);
|
|
void validateSettings(const Settings &);
|
|
struct Entry
|
|
{
|
|
std::wstring id, preview, app;
|
|
uint64_t bytes{}, at{};
|
|
bool pinned{}, image{}, files{};
|
|
};
|
|
class History
|
|
{
|
|
std::filesystem::path folder_;
|
|
std::vector<Entry> entries_;
|
|
mutable std::mutex mutex_;
|
|
void saveIndex();
|
|
void prune(const Settings &);
|
|
|
|
public:
|
|
explicit History(const std::filesystem::path &);
|
|
std::vector<Entry> entries() const;
|
|
Clip load(const std::wstring &id) const;
|
|
void add(const Clip &, const std::wstring &app, const Settings &);
|
|
void remove(const std::wstring &);
|
|
void pin(const std::wstring &);
|
|
void clear();
|
|
std::vector<Entry> search(const std::wstring &) const;
|
|
};
|
|
Bytes encodeClip(const Clip &);
|
|
Clip decodeClip(const Bytes &);
|
|
bool sameClipboardImage(const Clip &, const Clip &);
|
|
} // namespace ks
|