Skip to content

An API for connecting C++ applications using Qt to the Garuda platform

License

Notifications You must be signed in to change notification settings

skieffer/garuda-cpp-qt-api

Repository files navigation

Garuda API for C++ / Qt applications

This API provides an interface to the Garuda platform, for C++ applications. It relies on the Qt libraries, and the github repository ereilin/qt-json. If you do not have / do not want to use Qt, then you cannot use this API.

Activate / Register

To activate and register your gadget, you simply construct an instance of the GarudaClient class. The constructor signature and doctext is as follows:

/**
 * parent: a QObject, such as a QApplication object, which is to "own" this
 *   client object. May be set to 0 if there is no obvious parent.
 *
 * gadgetName: the name of the gadget
 *
 * gadgetUUID: the UUID of the gadget
 *
 * providerName: the name and affiliation of the provider of the gadget
 *
 * description: a description of the gadget
 *
 * categoryList: a list of Garuda-approved category names, to which this
 *   gadget belongs
 *
 * inputFiles: an even-length list of strings, giving extension-format pairs
 *   for files that this gadget can open.
 *   For example, [ "xml", "sbml" ]. If you provide an odd number of strings,
 *   the final entry will simply be ignored.
 *
 * outputFiles: same format as inputFiles, this time specifying the kinds of
 *   files that this gadget creates.
 *
 * iconPath: absolute path to icon file
 *
 * screenshotPaths: list of absolute paths to screenshot files
 *
 * launchCommand: the full command line string that launches the gadget
 */
GarudaClient(QObject *parent, QString gadgetName,
             QString gadgetUUID, QString providerName,
             QString description, QList<QString> categoryList,
             QList<QString> inputFiles, QList<QString> outputFiles,
             QString iconPath, QList<QString> screenshotPaths,
             QString launchCommand)

GetCompatibleGadgetList

To request a list of compatible gadgets, you make a function call:

showCompatibleSoftwareFor(QString extension, QString format);

naming the file extension and format that you are interested in. For example:

QString extension = "xml";
QString format = "sbml";

When the information is ready, it will be returned using the GarudaClient's Qt SIGNAL

void showCompatibleSoftwareResponse(const QVariantMap& response);

Therefore, in order to receive the signal your application should implement a slot and connect it using a line like:

connect (m_garuda_client, SIGNAL(showCompatibleSoftwareResponse(QVariantMap)),
         this, SLOT(myShowCompatibleSoftwareResponse(QVariantMap)));

where m_garuda_client is the GarudaClient instance that you constructed, and myShowCompatibleSoftwareResponse is your function which accepts a QVariantMap describing the available compatible gadgets.

SendData / LoadData

When you want to ask another gadget to open a file, you make a function call:

loadFileIntoSoftware(QFileInfo fileInfo, QString softwareName, QString softwareUUID);

For example, you could have

QFileInfo fileInfo = QFileInfo("glycolysis.xml");
QString softwareName = "Dunnart";
QString softwareUUID = "593387e0-7183-11e2-bcfd-0800200c9a66";

When another gadget asks you to open a file, GarudaClient will emit the signal:

void fileOpenRequest(const QString& filename);

So in your application, include a line like:

connect( m_garuda_client,
         SIGNAL(fileOpenRequest(QString)),
         this,
         SLOT(myFileOpenRequest(QString))
);

which connects to a function you define, called myFileOpenRequest.

LoadGadget

Not yet supported ... Check back soon!

About

An API for connecting C++ applications using Qt to the Garuda platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages