forked from qt-creator/qt-creator
DebuggerItem: Make sure DebuggerItems have an Id
The default constructor now sets an id on debuggerItem. fromMap was removed and a new constructor (taking a const QVariantMap &) was added in place of that. There are no more friends on the DebuggerItem class since those were only necessary to make sure the item has an Id when it gets added. Change-Id: Ia1a6c9ffea67a8e0a1e5685ef93f67df8686d4c9 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QProcess>
|
||||
#include <QUuid>
|
||||
|
||||
using namespace Debugger::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
@@ -54,10 +55,27 @@ namespace Debugger {
|
||||
|
||||
DebuggerItem::DebuggerItem()
|
||||
{
|
||||
m_id = QUuid::createUuid().toString();
|
||||
m_engineType = NoEngineType;
|
||||
m_isAutoDetected = false;
|
||||
}
|
||||
|
||||
DebuggerItem::DebuggerItem(const QVariantMap &data)
|
||||
{
|
||||
m_command = FileName::fromUserInput(data.value(QLatin1String(DEBUGGER_INFORMATION_COMMAND)).toString());
|
||||
m_id = data.value(QLatin1String(DEBUGGER_INFORMATION_ID)).toString();
|
||||
m_displayName = data.value(QLatin1String(DEBUGGER_INFORMATION_DISPLAYNAME)).toString();
|
||||
m_isAutoDetected = data.value(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTED), false).toBool();
|
||||
m_engineType = DebuggerEngineType(data.value(QLatin1String(DEBUGGER_INFORMATION_ENGINETYPE),
|
||||
static_cast<int>(NoEngineType)).toInt());
|
||||
|
||||
foreach (const QString &a, data.value(QLatin1String(DEBUGGER_INFORMATION_ABIS)).toStringList()) {
|
||||
Abi abi(a);
|
||||
if (abi.isValid())
|
||||
m_abis.append(abi);
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerItem::reinitializeFromFile()
|
||||
{
|
||||
QProcess proc;
|
||||
@@ -133,27 +151,6 @@ QVariantMap DebuggerItem::toMap() const
|
||||
return data;
|
||||
}
|
||||
|
||||
void DebuggerItem::fromMap(const QVariantMap &data)
|
||||
{
|
||||
m_command = FileName::fromUserInput(data.value(QLatin1String(DEBUGGER_INFORMATION_COMMAND)).toString());
|
||||
m_id = data.value(QLatin1String(DEBUGGER_INFORMATION_ID)).toString();
|
||||
m_displayName = data.value(QLatin1String(DEBUGGER_INFORMATION_DISPLAYNAME)).toString();
|
||||
m_isAutoDetected = data.value(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTED)).toBool();
|
||||
m_engineType = DebuggerEngineType(data.value(QLatin1String(DEBUGGER_INFORMATION_ENGINETYPE)).toInt());
|
||||
|
||||
m_abis.clear();
|
||||
foreach (const QString &a, data.value(QLatin1String(DEBUGGER_INFORMATION_ABIS)).toStringList()) {
|
||||
Abi abi(a);
|
||||
if (abi.isValid())
|
||||
m_abis.append(abi);
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerItem::setId(const QVariant &id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void DebuggerItem::setDisplayName(const QString &displayName)
|
||||
{
|
||||
m_displayName = displayName;
|
||||
|
||||
Reference in New Issue
Block a user