So what exactly is the problem? It seems you should use IRunConfigurationFactory::createFactory() to get a factory for the run configuration you'd like to use and then call its create() method to create the run configuration.
So what exactly is the problem? It seems you should use IRunConfigurationFactory::createFactory() to get a factory for the run configuration you'd like to use and then call its create() method to create the run configuration.
/home/akiva/Autopilot/autopilotplugin.cpp:203: error: 'createFactory' is not a member of 'ProjectExplorer::IRunConfigurationFactory'
ProjectExplorer::IRunConfigurationFactory::createF actory(ProjectExplorer::ProjectExplorerPlugin::cur rentProject()->activeTarget(),"wysotaiscool");
^
Am I reading old documentation, or is there something obvious I am missing here?
I don't know if you are reading old documentation. I always look into the source code as Creator API often changes.
Edit: Yes, looks like you are reading old docs.
Here is how the class currently looks like:
Qt Code:
{ Q_OBJECT public: virtual ~IRunConfigurationFactory(); enum CreationMode {UserCreate, AutoCreate}; virtual QList<Core::Id> availableCreationIds(Target *parent, CreationMode mode = UserCreate) const = 0; virtual bool canCreate(Target *parent, Core::Id id) const = 0; RunConfiguration *create(Target *parent, Core::Id id); virtual bool canRestore(Target *parent, const QVariantMap &map) const = 0; RunConfiguration *restore(Target *parent, const QVariantMap &map); virtual bool canClone(Target *parent, RunConfiguration *product) const = 0; virtual RunConfiguration *clone(Target *parent, RunConfiguration *product) = 0; static IRunConfigurationFactory *find(Target *parent, const QVariantMap &map); static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc); static QList<IRunConfigurationFactory *> find(Target *parent); signals: void availableCreationIdsChanged(); private: virtual RunConfiguration *doCreate(Target *parent, Core::Id id) = 0; virtual RunConfiguration *doRestore(Target *parent, const QVariantMap &map) = 0; };To copy to clipboard, switch view to plain text mode
You should probably use find() and then find the factory you need in the list.
Akiva (30th January 2015)
I got a bit farther. Learned how to use Ctrl+k
I checked out the factories available, but none of as far as I could tell, returned a class that could set arguments and the executable. The only class that allowed that was:
Qt Code:
#ifndef CUSTOMEXECUTABLERUNCONFIGURATION_H #define CUSTOMEXECUTABLERUNCONFIGURATION_H #include "qtsupport_global.h" #include <projectexplorer/localapplicationrunconfiguration.h> #include <QVariantMap> namespace ProjectExplorer { class Target; } namespace QtSupport { namespace Internal { class CustomExecutableConfigurationWidget; } class CustomExecutableRunConfigurationFactory; class QTSUPPORT_EXPORT CustomExecutableRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration { Q_OBJECT // the configuration widget needs to setExecutable setWorkingDirectory and setCommandLineArguments friend class Internal::CustomExecutableConfigurationWidget; friend class CustomExecutableRunConfigurationFactory; public: explicit CustomExecutableRunConfiguration(ProjectExplorer::Target *parent); ~CustomExecutableRunConfiguration(); /** * Returns the executable, looks in the environment for it and might even * ask the user if none is specified */ /** Returns whether this runconfiguration ever was configured with an executable */ bool isConfigured() const; RunMode runMode() const; ProjectExplorer::Abi abi() const; QVariantMap toMap() const; signals: void changed(); protected: CustomExecutableRunConfiguration(ProjectExplorer::Target *parent, CustomExecutableRunConfiguration *source); virtual bool fromMap(const QVariantMap &map); private: void ctor(); void setRunMode(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode); QString m_executable; QString m_workingDirectory; QString m_cmdArguments; RunMode m_runMode; }; class CustomExecutableRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory { Q_OBJECT public: ~CustomExecutableRunConfigurationFactory(); QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const; ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); private: bool canHandle(ProjectExplorer::Target *parent) const; ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent, const QVariantMap &map); }; } // namespace QtSupport #endif // CUSTOMEXECUTABLERUNCONFIGURATION_HTo copy to clipboard, switch view to plain text mode
The CustomExecutableRunConfigurationFactory is a friend of the class, but it does not seem to have any means to edit the arguments or executable. The same goes for the widget which takes a manual input.
My issue (and feel free to yell "RTFM" at me for this) is that I can't figure out how to instantiate customExecutableRunConfiguration. Currently what I am thinking, is trying to create a class that inherits one of these classes, and write the method myself. I'm not sure if this is the proper way or if it will work.
Sorry! And thanks for the help so far!
I just thought I would share my code for getting this to work
Basically I went ahead and created a new class derived from LocalApplicationRunConfiguration
Header:
http://paste.ubuntu.com/10036050/
Source:
http://paste.ubuntu.com/10036058/
I probably could have trimmed a bit more fat; I don't even know what ctor() is for.
In any case, the implementation is very simple:
http://paste.ubuntu.com/10036124/
Thanks for your help, and I hope someone else benefits from this as well.
Bookmarks