Public Types | Signals | Public Member Functions | List of all members
pqRecentlyUsedResourcesList Class Reference

manages recently used resources More...

#include <pqRecentlyUsedResourcesList.h>

Inherits QObject.

Public Types

typedef QList< pqServerResourceListT
 convenience typedef. More...
 

Signals

void changed ()
 Signal emitted whenever the collection is changed i.e. More...
 

Public Member Functions

 pqRecentlyUsedResourcesList (QObject *parent=nullptr)
 
 ~pqRecentlyUsedResourcesList () override
 
void add (const pqServerResource &resource)
 Add a resource to the collection. More...
 
const QList< pqServerResource > & list () const
 Returns the contents of the collection ordered from most-recently-used to least-recently-used. More...
 
void load (pqSettings &)
 Load the collection (from local user preferences) More...
 
void save (pqSettings &) const
 Save the collection (to local user preferences) More...
 

Detailed Description

manages recently used resources

pqRecentlyUsedResourcesList manages recently used resources, such as data files, state files, etc. When user performs an action (e.g. loading of data, loading of state file) that should be saved to the recently used resource list, simply add it using pqRecentlyUsedResourcesList::add(). One stats with the pqServerResource obtained from the server on which the action was performed and the can add meta-data to it, as needed e.g.

pqServerResource resource = server->getResource();
resource.setPath(...);
resource.addData("foo1", "bar1");
resource.addData("foo2", "bar2");
core->recentlyUsedResources().add(resource);

Now, applications can use pqRecentFilesMenu (or something similar) to show these resources in some menu or other UI element.

pqRecentlyUsedResourcesList itself doesn't handle reloading the resource from the list. That is left to the application. pqRecentFilesMenu, for example, uses implementations of pqRecentlyUsedResourceLoaderInterface registered with the pqInterfaceTracker to attempt to load the resource.

See also
pqServerResource, pqRecentlyUsedResourcesList, pqRecentlyUsedResourceLoaderInterface

Definition at line 48 of file pqRecentlyUsedResourcesList.h.

Member Typedef Documentation

◆ ListT

convenience typedef.

Definition at line 60 of file pqRecentlyUsedResourcesList.h.

Constructor & Destructor Documentation

◆ pqRecentlyUsedResourcesList()

pqRecentlyUsedResourcesList::pqRecentlyUsedResourcesList ( QObject *  parent = nullptr)

◆ ~pqRecentlyUsedResourcesList()

pqRecentlyUsedResourcesList::~pqRecentlyUsedResourcesList ( )
override

Member Function Documentation

◆ add()

void pqRecentlyUsedResourcesList::add ( const pqServerResource resource)

Add a resource to the collection.

Moves the resource to the beginning of the list.

◆ list()

const QList<pqServerResource>& pqRecentlyUsedResourcesList::list ( ) const
inline

Returns the contents of the collection ordered from most-recently-used to least-recently-used.

Definition at line 72 of file pqRecentlyUsedResourcesList.h.

◆ load()

void pqRecentlyUsedResourcesList::load ( pqSettings )

Load the collection (from local user preferences)

◆ save()

void pqRecentlyUsedResourcesList::save ( pqSettings ) const

Save the collection (to local user preferences)

◆ changed

void pqRecentlyUsedResourcesList::changed ( )
signal

Signal emitted whenever the collection is changed i.e.

new items are added or removed.


The documentation for this class was generated from the following file: