forked from qt-creator/qt-creator
Debugger: Partially dissolve DebuggerRunControlFactory
Aspect creation must stay for now as the object pool is the only central registry for it right now. Change-Id: Ibe42009db6b0351aaa36e9ac8f0f6f7a0562167e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -420,7 +420,18 @@ namespace Internal {
|
||||
|
||||
void addCdbOptionPages(QList<IOptionsPage*> *opts);
|
||||
void addGdbOptionPages(QList<IOptionsPage*> *opts);
|
||||
QObject *createDebuggerRunControlFactory(QObject *parent);
|
||||
|
||||
/// DebuggerRunControlFactory
|
||||
|
||||
class DebuggerRunControlFactory : public IRunControlFactory
|
||||
{
|
||||
public:
|
||||
IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc) override
|
||||
{
|
||||
return new DebuggerRunConfigurationAspect(rc);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static QIcon visibleStartIcon(Id id, bool toolBarStyle)
|
||||
{
|
||||
@@ -1482,7 +1493,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
||||
m_localsAndExpressionsWindow->setObjectName(QLatin1String(DOCKWIDGET_WATCHERS));
|
||||
m_localsAndExpressionsWindow->setWindowTitle(m_localsWindow->windowTitle());
|
||||
|
||||
m_plugin->addAutoReleasedObject(createDebuggerRunControlFactory(m_plugin));
|
||||
m_plugin->addAutoReleasedObject(new DebuggerRunControlFactory);
|
||||
|
||||
// The main "Start Debugging" action.
|
||||
act = m_startAction = new QAction(this);
|
||||
@@ -3033,6 +3044,28 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
cmd->setAttribute(Command::CA_NonConfigurable);
|
||||
}
|
||||
}
|
||||
|
||||
auto constraint = [](RunConfiguration *runConfig) {
|
||||
Runnable runnable = runConfig->runnable();
|
||||
if (runnable.is<StandardRunnable>()) {
|
||||
IDevice::ConstPtr device = runnable.as<StandardRunnable>().device;
|
||||
if (device && device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (DeviceTypeKitInformation::deviceTypeId(runConfig->target()->kit())
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
return true;
|
||||
|
||||
QString mainScript = runConfig->property("mainScript").toString();
|
||||
const bool isDebuggableScript = mainScript.endsWith(".py"); // Only Python for now.
|
||||
return isDebuggableScript;
|
||||
};
|
||||
|
||||
RunControl::registerWorker<DebuggerRunTool>
|
||||
(ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
|
||||
RunControl::registerWorker<DebuggerRunTool>
|
||||
(ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN, constraint);
|
||||
}
|
||||
|
||||
DebuggerEngine *currentEngine()
|
||||
|
||||
Reference in New Issue
Block a user