ProjectExplorer: Introduce per-kit debugger configuration page

Change-Id: I65c76f3ff43e1479075926c7e3fa460cca74d8fe
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
hjk
2013-08-14 18:30:40 +02:00
parent c90df2b35b
commit 36227d5c3a
8 changed files with 1313 additions and 536 deletions

View File

@@ -33,34 +33,47 @@
#include "debugger_global.h"
#include "debuggerconstants.h"
#include <projectexplorer/abi.h>
#include <projectexplorer/kitinformation.h>
namespace Debugger {
class DEBUGGER_EXPORT DebuggerItem
{
public:
DebuggerItem();
bool looksLike(const DebuggerItem &rhs) const;
bool canClone() const { return true; }
bool isValid() const { return true; }
QString engineTypeName() const;
QString userOutput() const;
QVariantMap toMap() const;
void fromMap(const QVariantMap &data);
void reinitializeFromFile();
public:
QVariant id;
QString displayName;
DebuggerEngineType engineType;
Utils::FileName command;
bool isAutoDetected;
QList<ProjectExplorer::Abi> abis;
};
class DEBUGGER_EXPORT DebuggerKitInformation : public ProjectExplorer::KitInformation
{
Q_OBJECT
public:
class DEBUGGER_EXPORT DebuggerItem {
public:
DebuggerItem();
DebuggerItem(DebuggerEngineType engineType, const Utils::FileName &fn);
bool equals(const DebuggerItem &rhs) const { return engineType == rhs.engineType && binary == rhs.binary; }
DebuggerEngineType engineType;
Utils::FileName binary;
};
DebuggerKitInformation();
Core::Id dataId() const;
unsigned int priority() const; // the higher the closer to the top.
static DebuggerItem autoDetectItem(const ProjectExplorer::Kit *k);
QVariant defaultValue(ProjectExplorer::Kit *k) const
{ return DebuggerKitInformation::itemToVariant(DebuggerKitInformation::autoDetectItem(k)); }
QVariant defaultValue(ProjectExplorer::Kit *k) const;
QList<ProjectExplorer::Task> validate(const ProjectExplorer::Kit *k) const
{ return DebuggerKitInformation::validateDebugger(k); }
@@ -73,34 +86,26 @@ public:
ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const;
ItemList toUserOutput(const ProjectExplorer::Kit *k) const;
static QString userOutput(const DebuggerItem &item);
static DebuggerItem debuggerItem(const ProjectExplorer::Kit *k);
static void setDebuggerItem(ProjectExplorer::Kit *k, const DebuggerItem &item);
static void setDebuggerItem(ProjectExplorer::Kit *k,
DebuggerEngineType type, const Utils::FileName &command);
static Utils::FileName debuggerCommand(const ProjectExplorer::Kit *k)
{ return debuggerItem(k).binary; }
{ return debuggerItem(k).command; }
static void setDebuggerCommand(ProjectExplorer::Kit *k, const Utils::FileName &command);
static DebuggerEngineType engineType(const ProjectExplorer::Kit *k)
{ return debuggerItem(k).engineType; }
static void setEngineType(ProjectExplorer::Kit *k, DebuggerEngineType type);
static QString debuggerEngineName(DebuggerEngineType t);
static void makeSticky(ProjectExplorer::Kit *k);
private:
static DebuggerItem variantToItem(const QVariant &v);
static QVariant itemToVariant(const DebuggerItem &i);
};
inline bool operator==(const DebuggerKitInformation::DebuggerItem &i1, const DebuggerKitInformation::DebuggerItem &i2)
{ return i1.equals(i2); }
inline bool operator!=(const DebuggerKitInformation::DebuggerItem &i1, const DebuggerKitInformation::DebuggerItem &i2)
{ return !i1.equals(i2); }
inline bool operator==(const DebuggerItem &i1, const DebuggerItem &i2)
{ return i1.looksLike(i2); }
inline bool operator!=(const DebuggerItem &i1, const DebuggerItem &i2)
{ return !i1.looksLike(i2); }
} // namespace Debugger