QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Classes | Public Member Functions | Static Public Member Functions | List of all members
QgsHistoryProviderRegistry Class Reference

The QgsHistoryProviderRegistry is a registry for objects which track user history (i.e. More...

#include <qgshistoryproviderregistry.h>

Inheritance diagram for QgsHistoryProviderRegistry:
Inheritance graph
[legend]

Classes

class  HistoryEntryOptions
 Contains options for storing history entries. More...
 

Public Member Functions

 QgsHistoryProviderRegistry (QObject *parent=nullptr, bool useMemoryDatabase=false)
 Creates a new empty history provider registry. More...
 
 ~QgsHistoryProviderRegistry () override
 
void addDefaultProviders ()
 Adds the default history providers to the registry. More...
 
bool addEntries (const QList< QgsHistoryEntry > &entries, QgsHistoryProviderRegistry::HistoryEntryOptions options=QgsHistoryProviderRegistry::HistoryEntryOptions())
 Adds a list of entries to the history logs. More...
 
long long addEntry (const QgsHistoryEntry &entry, bool &ok, QgsHistoryProviderRegistry::HistoryEntryOptions options=QgsHistoryProviderRegistry::HistoryEntryOptions())
 Adds an entry to the history logs. More...
 
long long addEntry (const QString &providerId, const QVariantMap &entry, bool &ok, QgsHistoryProviderRegistry::HistoryEntryOptions options=QgsHistoryProviderRegistry::HistoryEntryOptions())
 Adds an entry to the history logs. More...
 
bool addProvider (QgsAbstractHistoryProvider *provider)
 Adds a provider to the registry. More...
 
bool clearHistory (Qgis::HistoryProviderBackend backend)
 Clears the history for the specified backend. More...
 
QgsHistoryEntry entry (long long id, bool &ok, Qgis::HistoryProviderBackend backend=Qgis::HistoryProviderBackend::LocalProfile) const
 Returns the entry with matching ID, from the specified backend. More...
 
QgsAbstractHistoryProviderproviderById (const QString &id)
 Returns the provider with matching id, or nullptr if no matching provider is registered. More...
 
QStringList providerIds () const
 Returns a list of the registered provider IDs. More...
 
QList< QgsHistoryEntryqueryEntries (const QDateTime &start=QDateTime(), const QDateTime &end=QDateTime(), const QString &providerId=QString(), Qgis::HistoryProviderBackends backends=Qgis::HistoryProviderBackend::LocalProfile) const
 Queries history entries which occurred between the specified start and end times. More...
 
bool removeProvider (const QString &id)
 Removes the provider with matching id. More...
 
bool updateEntry (long long id, const QVariantMap &entry, Qgis::HistoryProviderBackend backend=Qgis::HistoryProviderBackend::LocalProfile)
 Updates the existing entry with matching id. More...
 

Static Public Member Functions

static QString userHistoryDbPath ()
 Returns the path to user's local history database. More...
 

Detailed Description

The QgsHistoryProviderRegistry is a registry for objects which track user history (i.e.

operations performed through the GUI).

QgsHistoryProviderRegistry is not usually directly created, but rather accessed through QgsGui::historyProviderRegistry().

Since
QGIS 3.24

Definition at line 89 of file qgshistoryproviderregistry.h.

Constructor & Destructor Documentation

◆ QgsHistoryProviderRegistry()

QgsHistoryProviderRegistry::QgsHistoryProviderRegistry ( QObject *  parent = nullptr,
bool  useMemoryDatabase = false 
)

Creates a new empty history provider registry.

QgsHistoryProviderRegistry is not usually directly created, but rather accessed through QgsGui::historyProviderRegistry().

Definition at line 51 of file qgshistoryproviderregistry.cpp.

◆ ~QgsHistoryProviderRegistry()

QgsHistoryProviderRegistry::~QgsHistoryProviderRegistry ( )
override

Definition at line 76 of file qgshistoryproviderregistry.cpp.

Member Function Documentation

◆ addDefaultProviders()

void QgsHistoryProviderRegistry::addDefaultProviders ( )

Adds the default history providers to the registry.

Note
Not available through Python bindings.

Definition at line 81 of file qgshistoryproviderregistry.cpp.

◆ addEntries()

bool QgsHistoryProviderRegistry::addEntries ( const QList< QgsHistoryEntry > &  entries,
QgsHistoryProviderRegistry::HistoryEntryOptions  options = QgsHistoryProviderRegistry::HistoryEntryOptions() 
)

Adds a list of entries to the history logs.

Definition at line 144 of file qgshistoryproviderregistry.cpp.

◆ addEntry() [1/2]

long long QgsHistoryProviderRegistry::addEntry ( const QgsHistoryEntry entry,
bool &  ok,
QgsHistoryProviderRegistry::HistoryEntryOptions  options = QgsHistoryProviderRegistry::HistoryEntryOptions() 
)

Adds an entry to the history logs.

Parameters
entryentry to add
okwill be set to true if entry was successfully added
optionsoptions
Returns
ID of newly added entry.

Definition at line 119 of file qgshistoryproviderregistry.cpp.

◆ addEntry() [2/2]

long long QgsHistoryProviderRegistry::addEntry ( const QString &  providerId,
const QVariantMap &  entry,
bool &  ok,
QgsHistoryProviderRegistry::HistoryEntryOptions  options = QgsHistoryProviderRegistry::HistoryEntryOptions() 
)

Adds an entry to the history logs.

The entry will be tagged with the current date/time as the timestamp.

The providerId specifies the history provider responsible for this entry. Entry options are specified via the options argument.

Parameters
providerIdassociated QgsAbstractHistoryProvider::id()
entryentry to add
okwill be set to true if entry was successfully added
optionsoptions
Returns
ID of newly added entry.

Definition at line 114 of file qgshistoryproviderregistry.cpp.

◆ addProvider()

bool QgsHistoryProviderRegistry::addProvider ( QgsAbstractHistoryProvider provider)

Adds a provider to the registry.

Ownership of the provider is transferred to the registry.

Returns true if the provider was successfully added.

Definition at line 86 of file qgshistoryproviderregistry.cpp.

◆ clearHistory()

bool QgsHistoryProviderRegistry::clearHistory ( Qgis::HistoryProviderBackend  backend)

Clears the history for the specified backend.

Definition at line 280 of file qgshistoryproviderregistry.cpp.

◆ entry()

QgsHistoryEntry QgsHistoryProviderRegistry::entry ( long long  id,
bool &  ok,
Qgis::HistoryProviderBackend  backend = Qgis::HistoryProviderBackend::LocalProfile 
) const

Returns the entry with matching ID, from the specified backend.

Parameters
idID of entry to find
okwill be set to true if entry was found
backendassociated backend
Returns
matching entry if found

Definition at line 158 of file qgshistoryproviderregistry.cpp.

◆ providerById()

QgsAbstractHistoryProvider * QgsHistoryProviderRegistry::providerById ( const QString &  id)

Returns the provider with matching id, or nullptr if no matching provider is registered.

Definition at line 95 of file qgshistoryproviderregistry.cpp.

◆ providerIds()

QStringList QgsHistoryProviderRegistry::providerIds ( ) const

Returns a list of the registered provider IDs.

Definition at line 109 of file qgshistoryproviderregistry.cpp.

◆ queryEntries()

QList< QgsHistoryEntry > QgsHistoryProviderRegistry::queryEntries ( const QDateTime &  start = QDateTime(),
const QDateTime &  end = QDateTime(),
const QString &  providerId = QString(),
Qgis::HistoryProviderBackends  backends = Qgis::HistoryProviderBackend::LocalProfile 
) const

Queries history entries which occurred between the specified start and end times.

The optional providerId and backends arguments can be used to filter entries.

Definition at line 223 of file qgshistoryproviderregistry.cpp.

◆ removeProvider()

bool QgsHistoryProviderRegistry::removeProvider ( const QString &  id)

Removes the provider with matching id.

The provider will be deleted.

Returns true if the provider was successfully removed.

Definition at line 100 of file qgshistoryproviderregistry.cpp.

◆ updateEntry()

bool QgsHistoryProviderRegistry::updateEntry ( long long  id,
const QVariantMap &  entry,
Qgis::HistoryProviderBackend  backend = Qgis::HistoryProviderBackend::LocalProfile 
)

Updates the existing entry with matching id.

This method allows the content of an entry to be updated, e.g. to add additional properties to the content. (Such as recording the results of after a long-running operation completes).

Definition at line 200 of file qgshistoryproviderregistry.cpp.

◆ userHistoryDbPath()

QString QgsHistoryProviderRegistry::userHistoryDbPath ( )
static

Returns the path to user's local history database.

Definition at line 275 of file qgshistoryproviderregistry.cpp.


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