forked from qt-creator/qt-creator
Debugger: Refactor DebuggerItemManager class
Task-number: QTCREATORBUG-10252 Change-Id: Ia8545fd0255f59290a6bab6e35ef1c082649f794 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -36,9 +36,15 @@
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
|
||||
#include <utils/persistentsettings.h>
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
namespace Internal { class DebuggerItemManager; }
|
||||
namespace Internal { class DebuggerItemModel; }
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// DebuggerItem
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
class DEBUGGER_EXPORT DebuggerItem
|
||||
{
|
||||
@@ -74,7 +80,8 @@ public:
|
||||
QStringList abiNames() const;
|
||||
|
||||
private:
|
||||
friend class Debugger::Internal::DebuggerItemManager;
|
||||
friend class Debugger::Internal::DebuggerItemModel;
|
||||
friend class DebuggerItemManager;
|
||||
void setId(const QVariant &id);
|
||||
|
||||
QVariant m_id;
|
||||
@@ -85,6 +92,56 @@ private:
|
||||
QList<ProjectExplorer::Abi> m_abis;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// DebuggerItemManager
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
class DEBUGGER_EXPORT DebuggerItemManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QObject *instance();
|
||||
~DebuggerItemManager();
|
||||
|
||||
static QList<DebuggerItem> debuggers();
|
||||
static Debugger::Internal::DebuggerItemModel *model();
|
||||
|
||||
static void registerDebugger(const DebuggerItem &item);
|
||||
static void deregisterDebugger(const DebuggerItem &item);
|
||||
|
||||
static const DebuggerItem *findByCommand(const Utils::FileName &command);
|
||||
static const DebuggerItem *findById(const QVariant &id);
|
||||
|
||||
static QVariant defaultDebugger(ProjectExplorer::ToolChain *tc);
|
||||
static void restoreDebuggers();
|
||||
static QString uniqueDisplayName(const QString &base);
|
||||
static void setItemData(const QVariant &id, const QString& displayName, const Utils::FileName &fileName);
|
||||
|
||||
public slots:
|
||||
void saveDebuggers();
|
||||
|
||||
signals:
|
||||
void debuggerAdded(const DebuggerItem &item);
|
||||
void debuggerRemoved(const QVariant &id);
|
||||
void debuggerUpdated(const QVariant &id);
|
||||
|
||||
private:
|
||||
explicit DebuggerItemManager(QObject *parent = 0);
|
||||
static void autoDetectDebuggers();
|
||||
static void autoDetectCdbDebugger();
|
||||
static void readLegacyDebuggers();
|
||||
static void addDebugger(const DebuggerItem &item);
|
||||
static void removeDebugger(const QVariant &id);
|
||||
|
||||
static Utils::PersistentSettingsWriter *m_writer;
|
||||
static QList<DebuggerItem> m_debuggers;
|
||||
static Debugger::Internal::DebuggerItemModel *m_model;
|
||||
|
||||
friend class Internal::DebuggerItemModel;
|
||||
friend class DebuggerPlugin; // Enable constrcutor for DebuggerPlugin
|
||||
};
|
||||
|
||||
class DEBUGGER_EXPORT DebuggerKitInformation : public ProjectExplorer::KitInformation
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -99,6 +156,8 @@ public:
|
||||
|
||||
void setup(ProjectExplorer::Kit *k);
|
||||
|
||||
static const DebuggerItem *debugger(const ProjectExplorer::Kit *kit);
|
||||
|
||||
static QList<ProjectExplorer::Task> validateDebugger(const ProjectExplorer::Kit *k);
|
||||
static bool isValidDebugger(const ProjectExplorer::Kit *k);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user