Example #1
0
void Melder_appendError (Melder_4_ARGS) {
	appendError (arg1. _arg);
	appendError (arg2. _arg);
	appendError (arg3. _arg);
	appendError (arg4. _arg);
	appendError (U"\n");
}
bool FileFormatManager::addFormat(FileFormat *format)
{
  if (!format) {
    appendError("Supplied format was null.");
    return false;
  }
  if (m_identifiers.count(format->identifier()) > 0) {
    appendError("Format " + format->identifier() + " already loaded.");
    return false;
  }
  for (std::vector<FileFormat *>::const_iterator it = m_formats.begin();
       it != m_formats.end(); ++it) {
    if (*it == format) {
      appendError("The format object was already loaded.");
      return false;
    }
  }

  // If we got here then the format is unique enough to be added.
  size_t index = m_formats.size();
  m_formats.push_back(format);
  m_identifiers[format->identifier()].push_back(index);
  std::vector<std::string> mimes = format->mimeTypes();
  for (std::vector<std::string>::const_iterator it = mimes.begin();
       it != mimes.end(); ++it) {
    m_mimeTypes[*it].push_back(index);
  }
  std::vector<std::string> extensions = format->fileExtensions();
  for (std::vector<std::string>::const_iterator it = extensions.begin();
       it != extensions.end(); ++it) {
    m_fileExtensions[*it].push_back(index);
  }

  return true;
}
void QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void *block )
{
  Q_UNUSED( xBlock );
  QgsDebugMsg( "Entered" );
  clearLastError();
  // TODO: optimize, see extent()

  QgsDebugMsg( "yBlock = "  + QString::number( yBlock ) );

  QStringList arguments;
  arguments.append( "map=" +  mMapName + "@" + mMapset );

  QgsRectangle ext = extent();


  // TODO: cut the last block
  double cellHeight = ext.height() / mRows;
  double yMaximum = ext.yMaximum() - cellHeight * yBlock * mYBlockSize;
  double yMinimum = yMaximum - cellHeight * mYBlockSize;

  QgsDebugMsg( "mYBlockSize = " + QString::number( mYBlockSize ) );
  arguments.append(( QString( "window=%1,%2,%3,%4,%5,%6" )
                     .arg( QgsRasterBlock::printValue( ext.xMinimum() ),
                           QgsRasterBlock::printValue( yMinimum ),
                           QgsRasterBlock::printValue( ext.xMaximum() ),
                           QgsRasterBlock::printValue( yMaximum ) )
                     .arg( mCols ).arg( mYBlockSize ) ) );

  arguments.append( "format=value" );
  QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.d.rast";
  QByteArray data;
  try
  {
    data = QgsGrass::runModule( mGisdbase, mLocation, mMapset, cmd, arguments );
  }
  catch ( QgsGrass::Exception &e )
  {
    QString error = tr( "Cannot read raster" ) + " : " + e.what();
    QgsDebugMsg( error );
    appendError( error );
    // We don't set mValid to false, because the raster can be recreated and work next time
  }
  QgsDebugMsg( QString( "%1 bytes read from modules stdout" ).arg( data.size() ) );
  // byteCount() in Qt >= 4.6
  //int size = image->byteCount() < data.size() ? image->byteCount() : data.size();
  int size = mCols * mYBlockSize * dataTypeSize( bandNo );
  QgsDebugMsg( QString( "mCols = %1 mYBlockSize = %2 dataTypeSize = %3" ).arg( mCols ).arg( mYBlockSize ).arg( dataTypeSize( bandNo ) ) );
  if ( size != data.size() )
  {
    QString error = tr( "%1 bytes expected but %2 byte were read from qgis.d.rast" ).arg( size ).arg( data.size() );
    QgsDebugMsg( error );
    appendError( error );
    size = size < data.size() ? size : data.size();
  }
  memcpy( block, data.data(), size );
}
Example #4
0
 OutputProxy()
 {
     // Users of this class can either be in the GUI thread or in other threads.
     // Use Qt::AutoConnection to always append in the GUI thread (directly or queued)
     VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
     connect(this, SIGNAL(append(QString)), outputWindow, SLOT(append(QString)));
     connect(this, SIGNAL(appendSilently(QString)), outputWindow, SLOT(appendSilently(QString)));
     connect(this, SIGNAL(appendError(QString)), outputWindow, SLOT(appendError(QString)));
     connect(this, SIGNAL(appendCommand(QString,QString,QStringList)),
             outputWindow, SLOT(appendCommand(QString,QString,QStringList)));
     connect(this, SIGNAL(appendMessage(QString)), outputWindow, SLOT(appendMessage(QString)));
 }
Example #5
0
void Melder_appendError (Melder_9_ARGS) {
	appendError (arg1. _arg);
	appendError (arg2. _arg);
	appendError (arg3. _arg);
	appendError (arg4. _arg);
	appendError (arg5. _arg);
	appendError (arg6. _arg);
	appendError (arg7. _arg);
	appendError (arg8. _arg);
	appendError (arg9. _arg);
	appendError (U"\n");
}
Example #6
0
bool Driver::setOpResult(NodePtr &pVar, NodePtr &pRes) {
	QVariant &res = pRes->val();
	QVariantMap &var = pVar->map();
	QVariant::Type opDataType;
	QString opDataTypeStr;
	switch (var[NODE_KEY_DATA_TYPE].toString()[0].toAscii()) {
		case TYPE_VAL_VOID[0]:
			return appendError("Error: invalid variable type void");
		case TYPE_VAL_ANY[0]:
			opDataType = QVariant::Invalid;
			break;
		case TYPE_VAL_BOOLEAN[0]:
			opDataType = QVariant::Bool;
			break;
		case TYPE_VAL_BYTE[0]:
			opDataType = QVariant::Char;
			break;
		case TYPE_VAL_UINT32[0]:
			opDataType = QVariant::UInt;
			break;
		case TYPE_VAL_INT32[0]:
			opDataType = QVariant::Int;
			break;
		case TYPE_VAL_UINT64[0]:
			opDataType = QVariant::ULongLong;
			break;
		case TYPE_VAL_INT64[0]:
			opDataType = QVariant::LongLong;
			break;
		case TYPE_VAL_DOUBLE[0]:
			opDataType = QVariant::Double;
			break;
		case TYPE_VAL_STRING[0]:
			opDataType = QVariant::String;
			break;
		case TYPE_VAL_BYTEARRAY[0]:
			opDataType = QVariant::BitArray;
			break;
		case TYPE_VAL_DATETIME[0]:
			opDataType = QVariant::DateTime;
			break;
		default:
			return appendError("Error: invalid variable type");
			break;
	}
	if (!res.convert(opDataType)) {
		return appendError("Error: the result cannot be converted to " + type2str(opDataType));
	}
	var.insert(NODE_KEY_VALUE, res);
	return true;
}
Example #7
0
void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle  const &viewExtent, int pixelWidth, int pixelHeight, void *block, QgsRasterBlockFeedback *feedback )
{
  Q_UNUSED( feedback );
  QgsDebugMsg( "pixelWidth = "  + QString::number( pixelWidth ) );
  QgsDebugMsg( "pixelHeight = "  + QString::number( pixelHeight ) );
  QgsDebugMsg( "viewExtent: " + viewExtent.toString() );
  clearLastError();

  if ( pixelWidth <= 0 || pixelHeight <= 0 )
    return;

  QStringList arguments;
  arguments.append( "map=" +  mMapName + "@" + mMapset );

  arguments.append( ( QStringLiteral( "window=%1,%2,%3,%4,%5,%6" )
                      .arg( QgsRasterBlock::printValue( viewExtent.xMinimum() ),
                            QgsRasterBlock::printValue( viewExtent.yMinimum() ),
                            QgsRasterBlock::printValue( viewExtent.xMaximum() ),
                            QgsRasterBlock::printValue( viewExtent.yMaximum() ) )
                      .arg( pixelWidth ).arg( pixelHeight ) ) );
  arguments.append( QStringLiteral( "format=value" ) );
  QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.d.rast";
  QByteArray data;
  try
  {
    data = QgsGrass::runModule( mGisdbase, mLocation, mMapset, cmd, arguments );
  }
  catch ( QgsGrass::Exception &e )
  {
    QString error = tr( "Cannot read raster" ) + " : " + e.what();
    QgsDebugMsg( error );
    appendError( error );

    // We don't set mValid to false, because the raster can be recreated and work next time
    return;
  }
  QgsDebugMsg( QString( "%1 bytes read from modules stdout" ).arg( data.size() ) );
  // byteCount() in Qt >= 4.6
  //int size = image->byteCount() < data.size() ? image->byteCount() : data.size();
  int size = pixelWidth * pixelHeight * dataTypeSize( bandNo );
  if ( size != data.size() )
  {
    QString error = tr( "%1 bytes expected but %2 byte were read from qgis.d.rast" ).arg( size ).arg( data.size() );
    QgsDebugMsg( error );
    appendError( error );
    size = size < data.size() ? size : data.size();
  }
  memcpy( block, data.data(), size );
}
Example #8
0
void QgsGrassRasterProvider::appendIfError( const QString &error )
{
  if ( !error.isEmpty() )
  {
    appendError( ERR( error ) );
  }
}
Example #9
0
unsigned int MACHFile::getSectionHeaderOffset(unsigned int nSection)
{
    unsigned int nNumberOfSegments=getNumberOfSegments();
    unsigned int nResult=0;
    unsigned int nCurrentSection=0;

    for(int i=0; i<nNumberOfSegments; i++)
    {
        nResult=getSegmentHeaderOffset(i);
        nResult+=getSegmentHeaderSize();

        for(int j=0; j<getSegment_nsects(i); j++)
        {


            if(nCurrentSection+j==nSection)
            {
                return nResult;
            }

            nResult+=getSectionHeaderSize();
        }

        nCurrentSection+=getSegment_nsects(i);
    }

    emit appendError(QString("Invalid section number: %1").arg(nSection));

    return 0;
}
Example #10
0
QgsAmsProvider::QgsAmsProvider( const QString &uri, const ProviderOptions &options )
  : QgsRasterDataProvider( uri, options )
{
  mLegendFetcher = new QgsAmsLegendFetcher( this );

  QgsDataSourceUri dataSource( dataSourceUri() );
  const QString authcfg = dataSource.authConfigId();

  mServiceInfo = QgsArcGisRestUtils::getServiceInfo( dataSource.param( QStringLiteral( "url" ) ), authcfg, mErrorTitle, mError );
  mLayerInfo = QgsArcGisRestUtils::getLayerInfo( dataSource.param( QStringLiteral( "url" ) ) + "/" + dataSource.param( QStringLiteral( "layer" ) ), authcfg, mErrorTitle, mError );

  const QVariantMap extentData = mLayerInfo.value( QStringLiteral( "extent" ) ).toMap();
  mExtent.setXMinimum( extentData[QStringLiteral( "xmin" )].toDouble() );
  mExtent.setYMinimum( extentData[QStringLiteral( "ymin" )].toDouble() );
  mExtent.setXMaximum( extentData[QStringLiteral( "xmax" )].toDouble() );
  mExtent.setYMaximum( extentData[QStringLiteral( "ymax" )].toDouble() );
  mCrs = QgsArcGisRestUtils::parseSpatialReference( extentData[QStringLiteral( "spatialReference" )].toMap() );
  if ( !mCrs.isValid() )
  {
    appendError( QgsErrorMessage( tr( "Could not parse spatial reference" ), QStringLiteral( "AMSProvider" ) ) );
    return;
  }
  const QVariantList subLayersList = mLayerInfo.value( QStringLiteral( "subLayers" ) ).toList();
  mSubLayers.reserve( subLayersList.size() );
  for ( const QVariant &sublayer : subLayersList )
  {
    mSubLayers.append( sublayer.toMap()[QStringLiteral( "id" )].toString() );
    mSubLayerVisibilities.append( true );
  }

  mTimestamp = QDateTime::currentDateTime();
  mValid = true;
}
Example #11
0
VCSJobRunner::VCSJobRunner() : d(new VCSJobRunnerPrivate)
{
    VCSBase::VCSBaseOutputWindow *ow = VCSBase::VCSBaseOutputWindow::instance();
    connect(this, SIGNAL(error(QString)),
            ow, SLOT(appendError(QString)), Qt::QueuedConnection);
    connect(this, SIGNAL(commandStarted(QString)),
            ow, SLOT(appendCommand(QString)), Qt::QueuedConnection);
}
Example #12
0
bool CoreEngine::endSession(QString *appendableErrorMessage)
{
    const HRESULT hr = m_cif.debugClient->EndSession(DEBUG_END_PASSIVE);
    if (FAILED(hr)) {
        appendError(msgComFailed("EndSession", hr), appendableErrorMessage);
        return false;
    }
    return true;
}
Example #13
0
bool CoreEngine::terminateProcesses(QString *appendableErrorMessage)
{
    const HRESULT hr = m_cif.debugClient->TerminateProcesses();
    if (FAILED(hr)) {
        appendError(msgComFailed("TerminateProcesses", hr), appendableErrorMessage);
        return false;
    }
    return true;
}
Example #14
0
bool CoreEngine::detachCurrentProcess(QString *appendableErrorMessage)
{
    const HRESULT hr = m_cif.debugClient->DetachCurrentProcess();
    if (FAILED(hr)) {
        appendError(msgComFailed("DetachCurrentProcess", hr), appendableErrorMessage);
        return false;
    }
    return true;
}
Example #15
0
bool TextFile::isValid()
{
    if(isPlainText())
    {
        return true;
    }
    emit appendError("Invalid Text file");

    return false;
}
Example #16
0
bool MACHFile::isSectionPresent(unsigned int nSection)
{
    if(nSection<getNumberOfSections())
    {
        return true;
    }

    emit appendError(QString("Invalid Section number: %1").arg(nSection));

    return false;
}
Example #17
0
bool MACHFile::isLoadCommandPresent(unsigned int nLoadCommand)
{
    if(nLoadCommand<getHeader_ncmds())
    {
        return true;
    }

    emit appendError(QString("Invalid LoadCommand number: %1").arg(nLoadCommand));

    return false;
}
Example #18
0
bool Compiler::exportData(QDataStream &output)
{
    Q_D(Compiler);

    if (!d->compilation->checkData()) {
        QQmlError error;
        error.setDescription("Compiled data not valid. Internal error.");
        appendError(error);
        return false;
    }

    QmcExporter exporter(d->compilation);
    bool ret = exporter.exportQmc(output);
    if (!ret) {
        QQmlError error;
        error.setDescription("Error saving data");
        appendError(error);
    }
    return ret;
}
Example #19
0
QScriptValue PluginsScript::call(QString sScript, QString sFunctionName, QScriptValueList valuelist,QString sExtra)
{
    // TODO check if function
    QScriptValue script = evaluate(sScript);

    if(!script.isError())
    {
        QScriptValue detect=globalObject().property(sFunctionName);

        if(!detect.isError())
        {

            QScriptValue result=detect.call(script,valuelist);

            if(!result.isError())
            {
                return result;
            }
            else
            {
                if(sExtra!="")
                {
                    emit appendError(QString("%1: %2").arg(sExtra).arg(result.toString()));
                }
                else
                {
                    emit appendError(QString("%1").arg(result.toString()));
                }
            }
        }
        else
        {
            if(sExtra!="")
            {
                emit appendError(QString("%1: %2").arg(sExtra).arg(detect.toString()));
            }
            else
            {
                emit appendError(QString("%1").arg(detect.toString()));
            }
        }
    }
    else
    {
        if(sExtra!="")
        {
            emit appendError(QString("%1: %2").arg(sExtra).arg(script.toString()));
        }
        else
        {
            emit appendError(QString("%1").arg(script.toString()));
        }
    }

    return 0;
}
Example #20
0
bool VersionResource::isValid()
{
    if(pbaData->size()>=4)
    {
        if(((_VS_VERSION_INFO *)pbaData->data())->wLength<=pbaData->size())
        {
            if(((_VS_VERSION_INFO *)pbaData->data())->wValueLength<((_VS_VERSION_INFO *)pbaData->data())->wLength)
            {
                return true;
            }
        }
    }

    emit appendError("Invalid version resource");
    return false;
}
Example #21
0
bool Driver::include(const QString& filename) {
	QString filePath = QFileInfo(m_filedir.absoluteFilePath(filename)).canonicalFilePath();
	if (m_rootCtx->m_fileList.contains(filePath)) {
		// already parsed
		return true;
	}
	try {
		Scanner scanner(filePath);
		Driver driver(filePath, scanner, m_rootCtx);
		Parser parser(driver);
		parser.parse();
	} catch(IOException &e) {
		appendError(e.message());
	}
	return m_rootCtx->m_errors.isEmpty();
}
Example #22
0
bool MACHFile::isValid()
{

    if(size()>=(int)sizeof(mach_header))
    {
        unsigned int nMagic=readDword(0);

        if((nMagic==MH_MAGIC)||(nMagic==MH_CIGAM)||(nMagic==MH_MAGIC_64)||(nMagic==MH_CIGAM_64))
        {
            return true;
        }

    }

    emit appendError("Invalid MACH file");

    return false;
}
Example #23
0
bool PluginsScript::isFunctionPresent(QString sScript, QString sFunctionName)
{
    QScriptValue script = evaluate(sScript);
    if(!script.isError())
    {
        QScriptValue detect=globalObject().property(sFunctionName);
        if(!detect.isError())
        {
            return detect.isFunction();
        }
    }
    else
    {
        emit appendError(QString("%1").arg(script.toString()));
    }

    return false;
}
Example #24
0
bool Compiler::addImport(const QV4::CompiledData::Import *import, QList<QQmlError> *errors)
{
    Q_D(Compiler);
    const QString &importUri = stringAt(import->uriIndex);
    const QString &importQualifier = stringAt(import->qualifierIndex);

    if (import->type == QV4::CompiledData::Import::ImportScript) {
        // TBD: qqmltypeloader.cpp:1320
        QmlCompilation::ScriptReference scriptRef;
        scriptRef.location = import->location;
        scriptRef.qualifier = importQualifier;
        scriptRef.compilation = NULL;
        d->compilation->scripts.append(scriptRef);
    } else if (import->type == QV4::CompiledData::Import::ImportLibrary) {
        QString qmldirFilePath;
        QString qmldirUrl;
        if (QQmlMetaType::isLockedModule(importUri, import->majorVersion)) {
            //Locked modules are checked first, to save on filesystem checks
            if (!d->compilation->importCache->addLibraryImport(d->compilation->importDatabase, importUri, importQualifier, import->majorVersion,
                                          import->minorVersion, QString(), QString(), false, errors))
                return false;

        } else if (d->compilation->importCache->locateQmldir(d->compilation->importDatabase, importUri, import->majorVersion, import->minorVersion,
                                 &qmldirFilePath, &qmldirUrl)) {
            // This is a local library import
            if (!d->compilation->importCache->addLibraryImport(d->compilation->importDatabase, importUri, importQualifier, import->majorVersion,
                                          import->minorVersion, qmldirFilePath, qmldirUrl, false, errors))
                return false;

            if (!importQualifier.isEmpty()) {
                // Does this library contain any qualified scripts?
                QUrl libraryUrl(qmldirUrl);
                QQmlTypeLoader* typeLoader = &QQmlEnginePrivate::get(d->compilation->engine)->typeLoader;
                const QQmlTypeLoader::QmldirContent *qmldir = typeLoader->qmldirContent(qmldirFilePath, qmldirUrl);
                foreach (const QQmlDirParser::Script &script, qmldir->scripts()) {
                    // TBD: qqmltypeloader.cpp:1343
                    qDebug() << "Library contains scripts";
                    QQmlError error;
                    error.setDescription("Libraries with scripts not supported");
                    appendError(error);
                    return false;
                }
            }
        } else {
Example #25
0
bool Compiler::compile(const QString &url)
{
    Q_D(Compiler);
    clearError();

    // set env var so one can test in plugins if needed
    setenv("QMC_COMPILE", "1", 1);

    // check that engine is using correct factory
    if (!qgetenv("QV4_FORCE_INTERPRETER").isEmpty()) {
        QQmlError error;
        error.setDescription("Compiler is forced to use interpreter");
        appendError(error);
        return false;
    }


    Q_ASSERT(d->compilation == NULL);
    QmlCompilation* c = new QmlCompilation(url, QUrl(url), d->engine);
    d->compilation = c;
    c->importCache = new QQmlImports(&QQmlEnginePrivate::get(d->compilation->engine)->typeLoader);
    c->importDatabase = new QQmlImportDatabase(d->compilation->engine);
    c->loadUrl = url;
    int lastSlash = url.lastIndexOf('/');
    if (lastSlash == -1)
        c->url = url;
    else if (lastSlash + 1 < url.length())
        c->url = url.mid(lastSlash + 1);
    else
        c->url = "";

    if (!loadData()) {
        delete takeCompilation();
        return false;
    }

    if (!compileData()) {
        delete takeCompilation();
        return false;
    }

    return true;
}
Example #26
0
QImage* QgsGrassRasterProvider::draw( QgsRectangle  const & viewExtent, int pixelWidth, int pixelHeight )
{
  QgsDebugMsg( "pixelWidth = "  + QString::number( pixelWidth ) );
  QgsDebugMsg( "pixelHeight = "  + QString::number( pixelHeight ) );
  QgsDebugMsg( "viewExtent: " + viewExtent.toString() );
  clearLastError();

  QImage *image = new QImage( pixelWidth, pixelHeight, QImage::Format_ARGB32 );
  image->fill( QColor( Qt::gray ).rgb() );

  QStringList arguments;
  arguments.append( "map=" +  mMapName + "@" + mMapset );

  arguments.append(( QString( "window=%1,%2,%3,%4,%5,%6" )
                     .arg( QgsRasterBlock::printValue( viewExtent.xMinimum() ),
                           QgsRasterBlock::printValue( viewExtent.yMinimum() ),
                           QgsRasterBlock::printValue( viewExtent.xMaximum() ),
                           QgsRasterBlock::printValue( viewExtent.yMaximum() ) )
                     .arg( pixelWidth ).arg( pixelHeight ) ) );
  QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.d.rast";
  QByteArray data;
  try
  {
    data = QgsGrass::runModule( mGisdbase, mLocation, mMapset, cmd, arguments );
  }
  catch ( QgsGrass::Exception &e )
  {
    QString error = tr( "Cannot draw raster" ) + " : " + e.what();
    QgsDebugMsg( error );
    appendError( error );
    // We don't set mValid to false, because the raster can be recreated and work next time
    return image;
  }
  QgsDebugMsg( QString( "%1 bytes read from modules stdout" ).arg( data.size() ) );
  uchar * ptr = image->bits();
  // byteCount() in Qt >= 4.6
  //int size = image->byteCount() < data.size() ? image->byteCount() : data.size();
  int size = pixelWidth * pixelHeight * 4 < data.size() ? pixelWidth * pixelHeight * 4 : data.size();
  memcpy( ptr, data.data(), size );

  return image;
}
Example #27
0
bool Compiler::loadData()
{
    Q_D(Compiler);
    const QUrl& url = d->compilation->loadUrl;
    if (!url.isValid() || url.isEmpty())
        return false;
    QQmlFile f;
    f.load(d->compilation->engine, url);
    if (!f.isReady()) {
        if (f.isError()) {
            QQmlError error;
            error.setUrl(url);
            error.setDescription(f.error());
            appendError(error);
        }
        return false;
    }
    d->compilation->code = QString::fromUtf8(f.data());
    return true;
}
Example #28
0
bool Compiler::compile(const QString &url, const QString &outputFile)
{
    // open output file
    QFile f(outputFile);
    if (!f.open(QFile::WriteOnly | QFile::Truncate)) {
        QQmlError error;
        error.setDescription("Could not open file for writing");
        error.setUrl(QUrl(outputFile));
        appendError(error);
        return false;
    }
    QDataStream out(&f);

    bool ret = compile(url, out);
    f.close();
    if (!ret)
        f.remove();

    return ret;
}
Example #29
0
QScriptValue PluginsScript::callFromFile(QString sScriptFile, QString sFunctionName, QScriptValueList valuelist)
{
    QFile file;
    QString sScriptData;

    file.setFileName(sScriptFile);

    if(file.open(QIODevice::ReadOnly))
    {
        sScriptData.append(file.readAll());
        file.close();

        return call(sScriptData,sFunctionName,valuelist);
    }
    else
    {
        emit appendError(QString("Cannot open file: %1").arg(sScriptFile));
    }

    return 0;
}
Example #30
0
bool PluginsScript::isFunctionPresentInFile(QString sScriptFile, QString sFunctionName)
{
    QFile file;
    QString sScriptData;

    file.setFileName(sScriptFile);

    if(file.open(QIODevice::ReadOnly))
    {
        sScriptData.append(file.readAll());
        file.close();

        return isFunctionPresent(sScriptData,sFunctionName);
    }
    else
    {
        emit appendError(QString("Cannot open file: %1").arg(sScriptFile));
    }

    return false;
}