forked from qt-creator/qt-creator
Extract text mark functionality into own class
Enhance issue information by id of the issue to be able to retrieve further details later. Change-Id: Ia6ff5c8a0064c45b50f9c712a05f6271f356e59a Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -60,6 +60,26 @@ public:
|
|||||||
static AxivionPlugin *s_instance = nullptr;
|
static AxivionPlugin *s_instance = nullptr;
|
||||||
static AxivionPluginPrivate *dd = nullptr;
|
static AxivionPluginPrivate *dd = nullptr;
|
||||||
|
|
||||||
|
class AxivionTextMark : public TextEditor::TextMark
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AxivionTextMark(const Utils::FilePath &filePath, const ShortIssue &issue);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
AxivionTextMark::AxivionTextMark(const Utils::FilePath &filePath, const ShortIssue &issue)
|
||||||
|
: TextEditor::TextMark(filePath, issue.lineNumber, {Tr::tr("Axivion"), AxivionTextMarkId})
|
||||||
|
, m_id(issue.id)
|
||||||
|
{
|
||||||
|
const QString markText = issue.entity.isEmpty() ? issue.message
|
||||||
|
: issue.entity + ": " + issue.message;
|
||||||
|
setToolTip(issue.errorNumber + " " + markText);
|
||||||
|
setPriority(TextEditor::TextMark::NormalPriority);
|
||||||
|
setLineAnnotation(markText);
|
||||||
|
}
|
||||||
|
|
||||||
AxivionPlugin::AxivionPlugin()
|
AxivionPlugin::AxivionPlugin()
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
@@ -298,13 +318,7 @@ void AxivionPluginPrivate::handleIssuesForFile(const IssuesList &issues)
|
|||||||
// FIXME the line location can be wrong (even the whole issue could be wrong)
|
// FIXME the line location can be wrong (even the whole issue could be wrong)
|
||||||
// depending on whether this line has been changed since the last axivion run and the
|
// depending on whether this line has been changed since the last axivion run and the
|
||||||
// current state of the file - some magic has to happen here
|
// current state of the file - some magic has to happen here
|
||||||
auto mark = new TextEditor::TextMark(filePath, issue.lineNumber,
|
new AxivionTextMark(filePath, issue);
|
||||||
{Tr::tr("Axivion"), axivionId});
|
|
||||||
const QString markText = issue.entity.isEmpty() ? issue.message
|
|
||||||
: issue.entity + ": " + issue.message;
|
|
||||||
mark->setToolTip(issue.errorNumber + " " + markText);
|
|
||||||
mark->setPriority(TextEditor::TextMark::NormalPriority);
|
|
||||||
mark->setLineAnnotation(markText);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -307,6 +307,7 @@ static void parseCsvIssue(const QByteArray &csv, QList<ShortIssue> *issues)
|
|||||||
QTC_ASSERT(match.hasMatch(), continue);
|
QTC_ASSERT(match.hasMatch(), continue);
|
||||||
// FIXME: some of these are not present for all issue kinds! Limited to SV for now
|
// FIXME: some of these are not present for all issue kinds! Limited to SV for now
|
||||||
ShortIssue issue;
|
ShortIssue issue;
|
||||||
|
issue.id = match.captured("Id");
|
||||||
issue.state = match.captured("State");
|
issue.state = match.captured("State");
|
||||||
issue.errorNumber = match.captured("ErrorNumber");
|
issue.errorNumber = match.captured("ErrorNumber");
|
||||||
issue.message = match.captured("Message");
|
issue.message = match.captured("Message");
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ public:
|
|||||||
class ShortIssue : public BaseResult
|
class ShortIssue : public BaseResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QString id;
|
||||||
QString state;
|
QString state;
|
||||||
QString errorNumber;
|
QString errorNumber;
|
||||||
QString message;
|
QString message;
|
||||||
|
|||||||
Reference in New Issue
Block a user