Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement framework for history providers
- Loading branch information
1 parent
0d332d3
commit 6783347
Showing
17 changed files
with
957 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
python/gui/auto_generated/history/qgshistoryprovider.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/history/qgshistoryprovider.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsAbstractHistoryProvider | ||
{ | ||
%Docstring(signature="appended") | ||
Abstract base class for objects which track user history (i.e. operations performed through the GUI). | ||
|
||
:py:class:`QgsAbstractHistoryProvider` subclasses are accessible through the :py:class:`QgsHistoryProviderRegistry` class. | ||
|
||
.. versionadded:: 3.24 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgshistoryprovider.h" | ||
%End | ||
public: | ||
|
||
virtual ~QgsAbstractHistoryProvider(); | ||
|
||
virtual QString id() const = 0; | ||
%Docstring | ||
Returns the provider's unique id, which is used to associate existing history entries with the provider. | ||
%End | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/history/qgshistoryprovider.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
163 changes: 163 additions & 0 deletions
163
python/gui/auto_generated/history/qgshistoryproviderregistry.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/history/qgshistoryproviderregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsHistoryEntry | ||
{ | ||
%Docstring(signature="appended") | ||
Encapsulates a history entry. | ||
|
||
.. versionadded:: 3.24 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgshistoryproviderregistry.h" | ||
%End | ||
public: | ||
|
||
QgsHistoryEntry( const QString &providerId, const QDateTime ×tamp, const QVariantMap &entry ); | ||
%Docstring | ||
Constructor for QgsHistoryEntry ``entry``, with the specified ``providerId`` and ``timestamp``. | ||
%End | ||
|
||
QgsHistoryEntry( const QVariantMap &entry ); | ||
%Docstring | ||
Constructor for QgsHistoryEntry ``entry``. | ||
|
||
The entry timestamp will be automatically set to the current date/time. | ||
%End | ||
|
||
QDateTime timestamp; | ||
|
||
QString providerId; | ||
|
||
QVariantMap entry; | ||
|
||
SIP_PYOBJECT __repr__(); | ||
%MethodCode | ||
const QString str = QStringLiteral( "<QgsHistoryEntry: %1 %2>" ).arg( sipCpp->providerId, sipCpp->timestamp.toString( Qt::ISODate ) ); | ||
sipRes = PyUnicode_FromString( str.toUtf8().constData() ); | ||
%End | ||
|
||
}; | ||
|
||
class QgsHistoryProviderRegistry : QObject | ||
{ | ||
%Docstring(signature="appended") | ||
The :py:class:`QgsHistoryProviderRegistry` is a registry for objects which track user history (i.e. operations performed through the GUI). | ||
|
||
:py:class:`QgsHistoryProviderRegistry` is not usually directly created, but rather accessed through | ||
:py:func:`QgsGui.historyProviderRegistry()`. | ||
|
||
.. versionadded:: 3.24 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgshistoryproviderregistry.h" | ||
%End | ||
public: | ||
|
||
QgsHistoryProviderRegistry( QObject *parent = 0, bool useMemoryDatabase = false ); | ||
%Docstring | ||
Creates a new empty history provider registry. | ||
|
||
QgsHistoryProviderRegistry is not usually directly created, but rather accessed through | ||
:py:func:`QgsGui.historyProviderRegistry()`. | ||
%End | ||
|
||
~QgsHistoryProviderRegistry(); | ||
|
||
bool addProvider( QgsAbstractHistoryProvider *provider /Transfer/ ); | ||
%Docstring | ||
Adds a ``provider`` to the registry. Ownership of the provider is | ||
transferred to the registry. | ||
|
||
Returns ``True`` if the provider was successfully added. | ||
%End | ||
|
||
QgsAbstractHistoryProvider *providerById( const QString &id ); | ||
%Docstring | ||
Returns the provider with matching ``id``, or ``None`` if no matching | ||
provider is registered. | ||
%End | ||
|
||
bool removeProvider( const QString &id ); | ||
%Docstring | ||
Removes the provider with matching ``id``. | ||
|
||
The provider will be deleted. | ||
|
||
Returns ``True`` if the provider was successfully removed. | ||
%End | ||
|
||
QStringList providerIds() const; | ||
%Docstring | ||
Returns a list of the registered provider IDs. | ||
%End | ||
|
||
class HistoryEntryOptions | ||
{ | ||
%Docstring(signature="appended") | ||
Contains options for storing history entries. | ||
|
||
.. versionadded:: 3.24 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgshistoryproviderregistry.h" | ||
%End | ||
public: | ||
|
||
HistoryEntryOptions(); | ||
%Docstring | ||
Constructor for HistoryEntryOptions. | ||
%End | ||
|
||
Qgis::HistoryProviderBackends storageBackends; | ||
}; | ||
|
||
bool addEntry( const QString &providerId, const QVariantMap &entry, QgsHistoryProviderRegistry::HistoryEntryOptions options = QgsHistoryProviderRegistry::HistoryEntryOptions() ); | ||
%Docstring | ||
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. | ||
%End | ||
|
||
bool addEntry( const QgsHistoryEntry &entry, QgsHistoryProviderRegistry::HistoryEntryOptions options = QgsHistoryProviderRegistry::HistoryEntryOptions() ); | ||
%Docstring | ||
Adds an ``entry`` to the history logs. | ||
%End | ||
|
||
QList< QgsHistoryEntry > queryEntries( const QDateTime &start = QDateTime(), const QDateTime &end = QDateTime(), | ||
const QString &providerId = QString(), Qgis::HistoryProviderBackends backends = Qgis::HistoryProviderBackend::LocalProfile ) const; | ||
%Docstring | ||
Queries history entries which occurred between the specified ``start`` and ``end`` times. | ||
|
||
The optional ``providerId`` and ``backends`` arguments can be used to filter entries. | ||
%End | ||
|
||
static QString userHistoryDbPath(); | ||
%Docstring | ||
Returns the path to user's local history database. | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/history/qgshistoryproviderregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*************************************************************************** | ||
qgshistoryprovider.cpp | ||
------------------------- | ||
begin : April 2019 | ||
copyright : (C) 2019 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgshistoryprovider.h" | ||
|
||
QgsAbstractHistoryProvider::~QgsAbstractHistoryProvider() = default; |
Oops, something went wrong.