forked from qt-creator/qt-creator
Debugger: Make icons and tooltips consistent in options page
Change-Id: Ib64e5d359253c02541e2f5b58561340ef8a49cfe Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -306,24 +306,46 @@ QDateTime DebuggerItem::lastModified() const
|
||||
return m_lastModified;
|
||||
}
|
||||
|
||||
QIcon DebuggerItem::decoration() const
|
||||
DebuggerItem::Problem DebuggerItem::problem() const
|
||||
{
|
||||
if (isGeneric())
|
||||
return {};
|
||||
return Problem::None;
|
||||
if (m_engineType == NoEngineType)
|
||||
return Icons::CRITICAL.icon();
|
||||
return Problem::NoEngine;
|
||||
if (!m_command.isExecutableFile())
|
||||
return Icons::WARNING.icon();
|
||||
return Problem::InvalidCommand;
|
||||
if (!m_workingDirectory.isEmpty() && !m_workingDirectory.isDir())
|
||||
return Problem::InvalidWorkingDir;
|
||||
return Problem::None;
|
||||
}
|
||||
|
||||
QIcon DebuggerItem::decoration() const
|
||||
{
|
||||
switch (problem()) {
|
||||
case Problem::NoEngine:
|
||||
return Icons::CRITICAL.icon();
|
||||
case Problem::InvalidCommand:
|
||||
case Problem::InvalidWorkingDir:
|
||||
return Icons::WARNING.icon();
|
||||
case Problem::None:
|
||||
break;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
QString DebuggerItem::validityMessage() const
|
||||
{
|
||||
if (m_engineType == NoEngineType)
|
||||
switch (problem()) {
|
||||
case Problem::NoEngine:
|
||||
return Tr::tr("Could not determine debugger type");
|
||||
return QString();
|
||||
case Problem::InvalidCommand:
|
||||
return Tr::tr("Invalid debugger command");
|
||||
case Problem::InvalidWorkingDir:
|
||||
return Tr::tr("Invalid working directory");
|
||||
case Problem::None:
|
||||
break;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool DebuggerItem::operator==(const DebuggerItem &other) const
|
||||
|
@@ -67,6 +67,8 @@ public:
|
||||
QStringList abiNames() const;
|
||||
QDateTime lastModified() const;
|
||||
|
||||
enum class Problem { NoEngine, InvalidCommand, InvalidWorkingDir, None };
|
||||
Problem problem() const;
|
||||
QIcon decoration() const;
|
||||
QString validityMessage() const;
|
||||
|
||||
|
Reference in New Issue
Block a user