Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
recentitems.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
5 #include <QObject>
6 
7 #include "recentitem.h"
8 
9 namespace geometrize
10 {
11 
16 class RecentItems : public QObject
17 {
18  Q_OBJECT
19 public:
25  RecentItems(const QString& group, unsigned int maxItems);
26 
27  RecentItems& operator=(RecentItems&) = delete;
28  RecentItems(RecentItems&) = delete;
29  RecentItems(RecentItems&&) = delete;
30  virtual ~RecentItems();
31 
36  QList<RecentItem> getItems() const;
37 
43  void add(const QString& itemId, const QString& itemDisplayName);
44 
49  void remove(const QString& itemId);
50 
54  void clear();
55 
56 signals:
61  void signal_added(const RecentItem& item);
62 
67  void signal_removed(const QString& itemId);
68 
72  void signal_cleared();
73 
74 private:
75  friend void swap(RecentItems& first, RecentItems& second);
76 
78  std::unique_ptr<RecentItemsImpl> d;
79 };
80 
86 
87 }
std::unique_ptr< RecentItemsImpl > d
Definition: recentitems.h:77
RecentItems & operator=(RecentItems &)=delete
void signal_removed(const QString &itemId)
signal_removed is emitted after an item is removed.
RecentItems & getRecentItems()
getRecentItems Gets a reference to the recent files list.
Definition: recentitems.cpp:206
void add(const QString &itemId, const QString &itemDisplayName)
add Adds an item to the recent items.
Definition: recentitems.cpp:177
Definition: recentitems.cpp:13
RecentItems(const QString &group, unsigned int maxItems)
RecentItems Creates a new RecentItems instance.
Definition: recentitems.cpp:164
The RecentItems class encapsulates a list of items that were recently interacted with. The class keeps a record of these items stored in preferences. Useful for keeping track of recently opened files.
Definition: recentitems.h:16
friend void swap(RecentItems &first, RecentItems &second)
QList< RecentItem > getItems() const
getItems Gets the recent items.
Definition: recentitems.cpp:172
void clear()
clear Removes all items from the recent items.
Definition: recentitems.cpp:196
void signal_added(const RecentItem &item)
signal_added is emitted after an item is added.
The RecentItem class models an item that was recently interacted with.
Definition: recentitem.h:11
virtual ~RecentItems()
Definition: recentitems.cpp:168
void signal_cleared()
signal_cleared is emitted after the recent items are cleared.