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.
More...
#include <recentitems.h>
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.
geometrize::RecentItems::RecentItems |
( |
const QString & |
group, |
|
|
unsigned int |
maxItems |
|
) |
| |
RecentItems Creates a new RecentItems instance.
- Parameters
-
group | The base path group to use for storing the recent items in settings e.g. "recent_image_paths", "recent_video_names" etc. |
maxItems | The maximum number of items to load. The most recent items will be loaded initially, and the oldest items will be replaced when new items are added over the limit. |
164 :
d{std::make_unique<RecentItemsImpl>(group, maxItems)}
std::unique_ptr< RecentItemsImpl > d
Definition: recentitems.h:77
geometrize::RecentItems::RecentItems |
( |
RecentItems && |
| ) |
|
|
delete |
geometrize::RecentItems::~RecentItems |
( |
| ) |
|
|
virtual |
void geometrize::RecentItems::add |
( |
const QString & |
itemId, |
|
|
const QString & |
itemDisplayName |
|
) |
| |
add Adds an item to the recent items.
- Parameters
-
itemId | A unique id for the item (e.g. a complete file path). |
itemDisplayName | A display name for the item (e.g. a file name). |
179 if(
d->getItemCount() >
d->getMaxItemCount()) {
180 remove(
d->getOldestItemKey());
183 const bool preexisting{
d->contains(itemId)};
185 const RecentItem item{
d->addItem(itemId, itemDisplayName)};
std::unique_ptr< RecentItemsImpl > d
Definition: recentitems.h:77
void signal_added(const RecentItem &item)
signal_added is emitted after an item is added.
void geometrize::RecentItems::clear |
( |
| ) |
|
clear Removes all items from the recent items.
std::unique_ptr< RecentItemsImpl > d
Definition: recentitems.h:77
void signal_cleared()
signal_cleared is emitted after the recent items are cleared.
QList< RecentItem > geometrize::RecentItems::getItems |
( |
| ) |
const |
getItems Gets the recent items.
- Returns
- A list of the recent items, sorted from most recently interacted with to oldest.
174 return d->getItems();
std::unique_ptr< RecentItemsImpl > d
Definition: recentitems.h:77
void geometrize::RecentItems::remove |
( |
const QString & |
itemId | ) |
|
remove Removes an item from the recent items.
- Parameters
-
itemId | The item id to remove. |
192 d->removeItem(itemId);
std::unique_ptr< RecentItemsImpl > d
Definition: recentitems.h:77
void signal_removed(const QString &itemId)
signal_removed is emitted after an item is removed.
void geometrize::RecentItems::signal_added |
( |
const RecentItem & |
item | ) |
|
|
signal |
signal_added is emitted after an item is added.
- Parameters
-
item | The item that was added. |
void geometrize::RecentItems::signal_cleared |
( |
| ) |
|
|
signal |
signal_cleared is emitted after the recent items are cleared.
void geometrize::RecentItems::signal_removed |
( |
const QString & |
itemId | ) |
|
|
signal |
signal_removed is emitted after an item is removed.
- Parameters
-
itemId | The id of the item that was removed. |
The documentation for this class was generated from the following files:
- /home/travis/build/Tw1ddle/geometrize-docs/geometrize/geometrize/recents/recentitems.h
- /home/travis/build/Tw1ddle/geometrize-docs/geometrize/geometrize/recents/recentitems.cpp