Debugger: Mark bad debuggger entries with an error icon

Change-Id: If3f7ab4ea015be6f580f748f9d0ee19c608a0239
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
hjk
2015-09-07 12:13:03 +02:00
parent b932a61d77
commit b0e7368d58
3 changed files with 26 additions and 0 deletions

View File

@@ -202,6 +202,18 @@ QStringList DebuggerItem::abiNames() const
return list; return list;
} }
bool DebuggerItem::isGood() const
{
return m_engineType != NoEngineType;
}
QString DebuggerItem::validityMessage() const
{
if (m_engineType == NoEngineType)
return DebuggerOptionsPage::tr("Could not determine debugger type");
return QString();
}
bool DebuggerItem::operator==(const DebuggerItem &other) const bool DebuggerItem::operator==(const DebuggerItem &other) const
{ {
return m_id == other.m_id return m_id == other.m_id

View File

@@ -98,6 +98,9 @@ public:
QStringList abiNames() const; QStringList abiNames() const;
bool isGood() const;
QString validityMessage() const;
bool operator==(const DebuggerItem &other) const; bool operator==(const DebuggerItem &other) const;
bool operator!=(const DebuggerItem &other) const { return !operator==(other); } bool operator!=(const DebuggerItem &other) const { return !operator==(other); }

View File

@@ -32,6 +32,8 @@
#include "debuggeritemmanager.h" #include "debuggeritemmanager.h"
#include "debuggeritem.h" #include "debuggeritem.h"
#include <coreplugin/coreconstants.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
@@ -68,6 +70,8 @@ public:
QVariant data(int column, int role) const QVariant data(int column, int role) const
{ {
static QIcon errorIcon(QString::fromLatin1(Core::Constants::ICON_ERROR));
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
switch (column) { switch (column) {
@@ -81,6 +85,13 @@ public:
font.setBold(m_changed); font.setBold(m_changed);
return font; return font;
} }
case Qt::DecorationRole: {
if (column == 0 && !m_item.isGood())
return errorIcon;
}
case Qt::ToolTipRole: {
return m_item.validityMessage();
}
} }
return QVariant(); return QVariant();
} }