MauiKit Terminal
Filter.cpp
126void TerminalImageFilterChain::setImage(std::span<const Character> image, int lines, int columns, const QVector<LineProperty> &lineProperties)
377std::unique_ptr<RegExpFilter::HotSpot> RegExpFilter::newHotSpot(int startLine, int startColumn, int endLine, int endColumn)
382std::unique_ptr<RegExpFilter::HotSpot> UrlFilter::newHotSpot(int startLine, int startColumn, int endLine, int endColumn)
419 if (actionName.isEmpty() || actionName == QLatin1String("open-action") || actionName == QLatin1String("click-action")) {
430 _urlObject->emitActivated(QUrl(url, QUrl::StrictMode), actionName != QLatin1String("click-action"));
434// Note: Altering these regular expressions can have a major effect on the performance of the filters
435// used for finding URLs in the text, especially if they are very general and could match very long
441// protocolname:// or www. followed by anything other than whitespaces, <, >, ' or ", and ends before whitespaces, <, >, ', ", ], !, comma and dot
442const QRegExp UrlFilter::FullUrlRegExp(QLatin1String("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]]"));
445const QRegExp UrlFilter::EmailAddressRegExp(QLatin1String("\\b(\\w|\\.|-)+@(\\w|\\.|-)+\\.\\w+\\b"));
448const QRegExp UrlFilter::CompleteUrlRegExp(QLatin1Char('(') + FullUrlRegExp.pattern() + QLatin1Char('|') + EmailAddressRegExp.pattern() + QLatin1Char(')'));
bool containsFilter(Filter *filter)
Returns true if the chain contains filter.
Definition Filter.cpp:59
void addFilter(std::unique_ptr< Filter > &&filter)
Adds a new filter to the chain.
Definition Filter.cpp:47
Filter::HotSpot * hotSpotAt(int line, int column) const
Returns the first hotspot which occurs at line, column or 0 if no hotspot was found.
Definition Filter.cpp:90
QList< Filter::HotSpot * > hotSpots() const
Returns a list of all the hotspots in all the chain's filters.
Definition Filter.cpp:102
void setBuffer(const QString *buffer, const QList< int > *linePositions)
Sets the buffer for each filter in the chain to process.
Definition Filter.cpp:76
Represents an area of text which matched the pattern a particular filter has been looking for.
Definition Filter.h:69
A filter processes blocks of text looking for certain patterns (such as URLs or keywords from a list)...
Definition Filter.h:54
void setBuffer(const QString *buffer, const QList< int > *linePositions)
TODO: Document me.
Definition Filter.cpp:188
const std::vector< std::unique_ptr< HotSpot > > & hotSpots() const
Returns the list of hotspots identified by the filter.
Definition Filter.cpp:237
QList< HotSpot * > hotSpotsAtLine(int line) const
Returns the list of hotspots identified by the filter which occur on a given line.
Definition Filter.cpp:242
HotSpot * hotSpotAt(int line, int column) const
Adds a new line of text to the filter and increments the line count.
Definition Filter.cpp:251
void addHotSpot(std::unique_ptr< HotSpot > &&)
Adds a new hotspot to the list.
Definition Filter.cpp:228
void reset()
Empties the filters internal buffer and resets the line count back to 0.
Definition Filter.cpp:182
void getLineColumn(int position, int &startLine, int &startColumn)
Converts a character position within buffer() to a line and column.
Definition Filter.cpp:194
A terminal character decoder which produces plain text, ignoring colours and other appearance-related...
Definition TerminalCharacterDecoder.h:72
void setTrailingWhitespace(bool enable)
Set whether trailing whitespace at the end of lines should be included in the output.
Definition TerminalCharacterDecoder.cpp:47
void decodeLine(std::span< const Character > characters, LineProperty properties) override
Converts a line of terminal characters with associated properties into a text string and writes the s...
Definition TerminalCharacterDecoder.cpp:75
void begin(QTextStream *output) override
Begin decoding characters.
Definition TerminalCharacterDecoder.cpp:55
void activate(const QString &action=QString()) override
Causes the an action associated with a hotspot to be triggered.
Definition Filter.cpp:314
QStringList capturedTexts() const
Returns the texts found by the filter when matching the filter's regular expression.
Definition Filter.cpp:322
void setCapturedTexts(const QStringList &texts)
Sets the captured texts associated with this hotspot.
Definition Filter.cpp:318
A filter which searches for sections of text matching a regular expression and creates a new RegExpFi...
Definition Filter.h:181
void setRegExp(const QRegExp &text)
Sets the regular expression which the filter searches for in blocks of text.
Definition Filter.cpp:327
void process() override
Reimplemented to search the filter's text buffer for text matching regExp()
Definition Filter.cpp:339
virtual std::unique_ptr< HotSpot > newHotSpot(int startLine, int startColumn, int endLine, int endColumn)
Called when a match for the regular expression is encountered.
Definition Filter.cpp:377
QRegExp regExp() const
Returns the regular expression which the filter searches for in blocks of text.
Definition Filter.cpp:331
void setImage(std::span< const Character > image, int lines, int columns, const QVector< LineProperty > &lineProperties)
Set the current terminal image to image.
Definition Filter.cpp:126
void activate(const QString &action=QString()) override
Open a web browser at the current URL.
Definition Filter.cpp:408
QList< QAction * > actions() override
Returns a list of actions associated with the hotspot which can be used in a menu or toolbar.
Definition Filter.cpp:475
std::unique_ptr< RegExpFilter::HotSpot > newHotSpot(int, int, int, int) override
Called when a match for the regular expression is encountered.
Definition Filter.cpp:382
void setText(const QString &text)
void triggered(bool checked)
void setText(const QString &text, Mode mode)
QClipboard * clipboard()
void append(QList< T > &&value)
const T & constFirst() const const
qsizetype count() const const
void push_back(parameter_type value)
T value(qsizetype i) const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
objectName
QObject * sender() const const
void setObjectName(QAnyStringView name)
QString tr(const char *sourceText, const char *disambiguation, int n)
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
qsizetype length() const const
QString & prepend(QChar ch)
StrictMode
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.