Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Move QgsHistoryEntry to separate file
- Loading branch information
1 parent
d5cd4c9
commit e84ce19
Showing
10 changed files
with
202 additions
and
142 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/history/qgshistoryentry.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 "qgshistoryentry.h" | ||
%End | ||
public: | ||
|
||
QgsHistoryEntry(); | ||
%Docstring | ||
Constructor for an invalid entry. | ||
%End | ||
|
||
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 | ||
|
||
bool isValid() const; | ||
%Docstring | ||
Returns ``True`` if the entry is valid. | ||
|
||
.. versionadded:: 3.32 | ||
%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 | ||
|
||
}; | ||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/history/qgshistoryentry.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*************************************************************************** | ||
qgshistoryentry.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 "qgshistoryentry.h" | ||
|
||
QgsHistoryEntry::QgsHistoryEntry( const QString &providerId, const QDateTime ×tamp, const QVariantMap &entry ) | ||
: timestamp( timestamp ) | ||
, providerId( providerId ) | ||
, entry( entry ) | ||
{ | ||
|
||
} | ||
|
||
QgsHistoryEntry::QgsHistoryEntry( const QVariantMap &entry ) | ||
: timestamp( QDateTime::currentDateTime() ) | ||
, entry( entry ) | ||
{ | ||
|
||
} | ||
|
||
bool QgsHistoryEntry::isValid() const | ||
{ | ||
return !providerId.isEmpty(); | ||
} |
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,88 @@ | ||
/*************************************************************************** | ||
qgshistoryentry.h | ||
-------------------------- | ||
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. * | ||
* * | ||
***************************************************************************/ | ||
#ifndef QGSHISTORYENTRY_H | ||
#define QGSHISTORYENTRY_H | ||
|
||
#include "qgis_gui.h" | ||
#include "qgis_sip.h" | ||
#include "qgis.h" | ||
|
||
#include <QMap> | ||
#include <QString> | ||
#include <QDateTime> | ||
#include <QVariant> | ||
|
||
/** | ||
* Encapsulates a history entry. | ||
* | ||
* \ingroup gui | ||
* \since QGIS 3.24 | ||
*/ | ||
class GUI_EXPORT QgsHistoryEntry | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructor for an invalid entry. | ||
*/ | ||
QgsHistoryEntry() = default; | ||
|
||
/** | ||
* Constructor for QgsHistoryEntry \a entry, with the specified \a providerId and \a timestamp. | ||
*/ | ||
QgsHistoryEntry( const QString &providerId, const QDateTime ×tamp, const QVariantMap &entry ); | ||
|
||
/** | ||
* Constructor for QgsHistoryEntry \a entry. | ||
* | ||
* The entry timestamp will be automatically set to the current date/time. | ||
*/ | ||
QgsHistoryEntry( const QVariantMap &entry ); | ||
|
||
/** | ||
* Returns TRUE if the entry is valid. | ||
* | ||
* \since QGIS 3.32 | ||
*/ | ||
bool isValid() const; | ||
|
||
//! Entry timestamp | ||
QDateTime timestamp; | ||
|
||
//! Associated history provider ID | ||
QString providerId; | ||
|
||
/** | ||
* Entry details. | ||
* | ||
* Entries details are stored as a free-form map. Interpretation of this map is the responsibility of the | ||
* associated history provider. | ||
*/ | ||
QVariantMap entry; | ||
|
||
#ifdef SIP_RUN | ||
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 | ||
#endif | ||
|
||
}; | ||
|
||
Q_DECLARE_METATYPE( QgsHistoryEntry ); | ||
|
||
#endif // QGSHISTORYENTRY |
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
Oops, something went wrong.