thumbnail: decouple proc params rank/color/trash
Add a Properties type that contains values for rank, color and trashed Each value will also contain an edited flag. The properties variable is used to store rank, color and trashed. They are fetched from the proc params and will update the proc params when needed. This is the base for future implementations where some properties (like rank) will be also retrieved from other sources like xmp sidecar files.
This commit is contained in:
@@ -78,6 +78,30 @@ class Thumbnail
|
||||
|
||||
bool initial_;
|
||||
|
||||
// Properties holds values and edited states for rank, color and trashed
|
||||
struct Properties {
|
||||
template <class T> struct Property {
|
||||
T value;
|
||||
bool edited;
|
||||
Property(T v): value(v), edited(false) {}
|
||||
Property& operator=(T v)
|
||||
{
|
||||
value = v;
|
||||
edited = true;
|
||||
return *this;
|
||||
}
|
||||
operator T() const { return value; }
|
||||
};
|
||||
Property<int> rank;
|
||||
Property<int> color;
|
||||
Property<bool> trashed;
|
||||
|
||||
explicit Properties(int r=0, int c=0, bool t=false):
|
||||
rank(r), color(c), trashed(t) {}
|
||||
bool edited() const { return rank.edited || color.edited || trashed.edited; }
|
||||
};
|
||||
Properties properties;
|
||||
|
||||
// vector of listeners
|
||||
std::vector<ThumbnailListener*> listeners;
|
||||
|
||||
@@ -90,6 +114,8 @@ class Thumbnail
|
||||
Glib::ustring getCacheFileName (const Glib::ustring& subdir, const Glib::ustring& fext) const;
|
||||
|
||||
void saveMetadata();
|
||||
void loadProperties();
|
||||
void updateProcParamsProperties();
|
||||
|
||||
public:
|
||||
Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageData* cf);
|
||||
|
Reference in New Issue
Block a user