Skip to content

Commit

Permalink
Unbreak compile with KFSyntaxHighlighting_FOUND=0
Browse files Browse the repository at this point in the history
Fixes: #597
  • Loading branch information
milianw committed Jan 19, 2024
1 parent 8b353b0 commit 5a974a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 10 additions & 9 deletions src/models/highlightedtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,22 @@ class HighlightingImplementation : public KSyntaxHighlighting::AbstractHighlight
class HighlightingImplementation
{
public:
virtual HighlightingImplementation(KSyntaxHighlighting::Repository*) = default;
~HighlightingImplementation() override = default;
HighlightingImplementation(KSyntaxHighlighting::Repository* /*repository*/) { }
virtual ~HighlightingImplementation() = default;

virtual QVector<QTextLayout::FormatRange> format(const QStringList& text) override
virtual QVector<QTextLayout::FormatRange> format(const QString& /*text*/)
{
return {};
}

virtual void themeChanged() override { }
virtual void themeChanged() { }

virtual void setHighlightingDefinition(const KSyntaxHighlighting::Definition& /*definition*/) override { }
virtual QString definitionName() const override
virtual void setHighlightingDefinition(const KSyntaxHighlighting::Definition& /*definition*/) { }
virtual QString definitionName() const
{
return {};
};
}
};
#endif

class AnsiHighlightingImplementation : public HighlightingImplementation
Expand Down Expand Up @@ -238,9 +239,7 @@ class HighlightedLine

HighlightedText::HighlightedText(KSyntaxHighlighting::Repository* repository, QObject* parent)
: QObject(parent)
#if KFSyntaxHighlighting_FOUND
, m_repository(repository)
#endif
{
}

Expand Down Expand Up @@ -277,7 +276,9 @@ void HighlightedText::setDefinition(const KSyntaxHighlighting::Definition& defin
{
Q_ASSERT(m_highlighter);
m_highlighter->setHighlightingDefinition(definition);
#if KFSyntaxHighlighting_FOUND
emit definitionChanged(definition.name());
#endif
}

QString HighlightedText::textAt(int index) const
Expand Down
2 changes: 0 additions & 2 deletions src/models/highlightedtext.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public slots:
void updateHighlighting();

private:
#if KFSyntaxHighlighting_FOUND
KSyntaxHighlighting::Repository* m_repository;
#endif
std::unique_ptr<HighlightingImplementation> m_highlighter;
mutable std::vector<HighlightedLine> m_highlightedLines;
QStringList m_lines;
Expand Down

0 comments on commit 5a974a4

Please sign in to comment.