forked from qt-creator/qt-creator
Axivion: Open issue information semi-automatic
This patch adds another way of opening issue information. Double clicking an issue on the issues table will now open the related information automatically beside jumping to the respective location. The original way of using a button on the tool tip of the issue's text mark is clumsy, but still present. Change-Id: I7b0fcafb8b01675fc020f8cc8174121ba7f52adc Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -189,28 +189,34 @@ void DashboardWidget::updateUi()
|
||||
class IssueTreeItem final : public StaticTreeItem
|
||||
{
|
||||
public:
|
||||
IssueTreeItem(const QStringList &data, const QStringList &toolTips)
|
||||
IssueTreeItem(const QString &id, const QStringList &data, const QStringList &toolTips)
|
||||
: StaticTreeItem(data, toolTips)
|
||||
, m_id(id)
|
||||
{}
|
||||
|
||||
void setLinks(const Links &links) { m_links = links; }
|
||||
|
||||
bool setData(int column, const QVariant &value, int role) final
|
||||
{
|
||||
if (role == BaseTreeView::ItemActivatedRole && !m_links.isEmpty()) {
|
||||
// TODO for now only simple - just the first..
|
||||
Link link = m_links.first();
|
||||
Project *project = ProjectManager::startupProject();
|
||||
FilePath baseDir = project ? project->projectDirectory() : FilePath{};
|
||||
link.targetFilePath = baseDir.resolvePath(link.targetFilePath);
|
||||
if (link.targetFilePath.exists())
|
||||
EditorManager::openEditorAt(link);
|
||||
if (role == BaseTreeView::ItemActivatedRole) {
|
||||
if (!m_links.isEmpty()) {
|
||||
// TODO for now only simple - just the first..
|
||||
Link link = m_links.first();
|
||||
Project *project = ProjectManager::startupProject();
|
||||
FilePath baseDir = project ? project->projectDirectory() : FilePath{};
|
||||
link.targetFilePath = baseDir.resolvePath(link.targetFilePath);
|
||||
if (link.targetFilePath.exists())
|
||||
EditorManager::openEditorAt(link);
|
||||
}
|
||||
if (!m_id.isEmpty())
|
||||
fetchIssueInfo(m_id);
|
||||
return true;
|
||||
}
|
||||
return StaticTreeItem::setData(column, value, role);
|
||||
}
|
||||
|
||||
private:
|
||||
const QString m_id;
|
||||
Links m_links;
|
||||
};
|
||||
|
||||
@@ -425,17 +431,20 @@ void IssuesWidget::addIssues(const Dto::IssueTableDto &dto)
|
||||
const std::vector<Dto::ColumnInfoDto> &tableColumns = m_currentTableInfo->columns;
|
||||
const std::vector<std::map<QString, Dto::Any>> &rows = dto.rows;
|
||||
for (const auto &row : rows) {
|
||||
QString id;
|
||||
QStringList data;
|
||||
for (const auto &column : tableColumns) {
|
||||
const auto it = row.find(column.key);
|
||||
if (it != row.end()) {
|
||||
QString value = anyToSimpleString(it->second);
|
||||
if (column.key == "id")
|
||||
if (column.key == "id") {
|
||||
value.prepend(m_currentPrefix);
|
||||
id = value;
|
||||
}
|
||||
data << value;
|
||||
}
|
||||
}
|
||||
IssueTreeItem *it = new IssueTreeItem(data, data);
|
||||
IssueTreeItem *it = new IssueTreeItem(id, data, data);
|
||||
it->setLinks(linksForIssue(row));
|
||||
m_issuesModel->rootItem()->appendChild(it);
|
||||
}
|
||||
|
||||
@@ -887,6 +887,12 @@ class AxivionPlugin final : public ExtensionSystem::IPlugin
|
||||
}
|
||||
};
|
||||
|
||||
void fetchIssueInfo(const QString &id)
|
||||
{
|
||||
QTC_ASSERT(dd, return);
|
||||
dd->fetchIssueInfo(id);
|
||||
}
|
||||
|
||||
} // Axivion::Internal
|
||||
|
||||
#include "axivionplugin.moc"
|
||||
|
||||
@@ -72,6 +72,7 @@ bool handleCertificateIssue();
|
||||
|
||||
QIcon iconForIssue(const QString &prefix);
|
||||
QString anyToSimpleString(const Dto::Any &any);
|
||||
void fetchIssueInfo(const QString &id);
|
||||
|
||||
} // Axivion::Internal
|
||||
|
||||
|
||||
Reference in New Issue
Block a user