Commit 5b039912 authored by Nikita Sirgienko's avatar Nikita Sirgienko

Some improvments in GraphicPackage and the code, which used it, in Session

parent c67765bd
......@@ -94,7 +94,7 @@ if(LIBSPECTRE_FOUND)
target_link_libraries(cantorlibs ${LIBSPECTRE_LIBRARY})
endif(LIBSPECTRE_FOUND)
set (CANTORLIBS_SOVERSION 26)
set (CANTORLIBS_SOVERSION 27)
set_target_properties( cantorlibs PROPERTIES VERSION ${RELEASE_SERVICE_VERSION} SOVERSION ${CANTORLIBS_SOVERSION})
ecm_setup_version(${RELEASE_SERVICE_VERSION}
......
......@@ -79,9 +79,9 @@ QString Cantor::GraphicPackage::disableSupportCommand() const
return d->disableSupportCommand;
}
QString Cantor::GraphicPackage::savePlotCommand(QString filenamePrefix, int plotNumber) const
QString Cantor::GraphicPackage::savePlotCommand(QString filenamePrefix, int plotNumber, QString additionalInfo) const
{
return d->saveToFileCommandTemplate.arg(filenamePrefix, QString::number(plotNumber));
return d->saveToFileCommandTemplate.arg(filenamePrefix, QString::number(plotNumber), additionalInfo);
}
bool Cantor::GraphicPackage::isHavePlotCommand() const
......@@ -97,23 +97,25 @@ QList<GraphicPackage> Cantor::GraphicPackage::loadFromFile(const QString& filena
return packages;
QFile fin(filename);
qDebug() << "!!!! " << filename;
if (fin.open(QFile::ReadOnly))
{
QDomDocument doc;
if (doc.setContent(fin.readAll()) && doc.firstChildElement(QLatin1String("GraphicPackages")).isNull() == false)
{
const auto& elements = doc.elementsByTagName(QLatin1String("GraphicPackage"));
qDebug() << "!!!! " << elements.size();
for (int i = 0; i < elements.size(); i++)
{
const QDomNode& root = elements.item(i);
GraphicPackage package;
package.d->id = root.firstChildElement(QLatin1String("Id")).text();
package.d->name = root.firstChildElement(QLatin1String("Name")).text();
package.d->testPresenceCommand = root.firstChildElement(QLatin1String("TestPresenceCommand")).text();
package.d->enableSupportCommand = root.firstChildElement(QLatin1String("EnableCommand")).text();
package.d->disableSupportCommand = root.firstChildElement(QLatin1String("DisableCommand")).text();
package.d->saveToFileCommandTemplate = root.firstChildElement(QLatin1String("ToFileCommandTemplate")).text();
package.d->id = root.firstChildElement(QLatin1String("Id")).text().trimmed();
package.d->name = root.firstChildElement(QLatin1String("Name")).text().trimmed();
package.d->testPresenceCommand = root.firstChildElement(QLatin1String("TestPresenceCommand")).text().trimmed();
package.d->enableSupportCommand = root.firstChildElement(QLatin1String("EnableCommand")).text().trimmed();
package.d->disableSupportCommand = root.firstChildElement(QLatin1String("DisableCommand")).text().trimmed();
package.d->saveToFileCommandTemplate = root.firstChildElement(QLatin1String("ToFileCommandTemplate")).text().trimmed();
packages.append(package);
}
......
......@@ -88,9 +88,10 @@ public:
* @brief This function return command for saving image result(s) from expression (if results are existed).
* @param filenamePrefix Prefix of files with plots. Can be something like @c "/tmp/cantor_octave_2432_plot". Optional parameter.
* @param plotNumber Currect plot number, should be used for full filename construction. Optional parameter.
* @param additionalInfo This is additional parameter from backend, which go to @c "%3" template. Optional parameter.
* @return Command which will save plot to certain file or empty string (see isHavePlotCommand())
*/
QString savePlotCommand(QString filenamePrefix = QString(), int plotNumber = -1) const;
QString savePlotCommand(QString filenamePrefix = QString(), int plotNumber = -1, QString additionalInfo = QString()) const;
/**
* @brief Load graphic packages from XML file.
......
......@@ -89,7 +89,9 @@ void Cantor::Session::testGraphicsPackages(QList<GraphicPackage> packages)
this->d->usableGraphicPackages.push_back(package);
}
} else {
qDebug() << "test presence command for " << package.id() << "finished because of " << (status == Expression::Error ? "error" : "interrupt");
qDebug() << "test presence command for" << package.id() << "finished because of" << (status == Expression::Error ? "error" : "interrupt");
if (status == Expression::Error && expr)
qDebug() << "error message:" << expr->errorMessage();
}
handlingStatus[package.id()] = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment