// DIE's signature file

init("library","Qt");

function getQTVersion()
{
    var sResult="";
    var nSize=ELF.getSize();
    var nOffset=ELF.findString(0,nSize,"/usr/local/Trolltech/Qt-");
    if(nOffset!=-1)
    {
        sResult=ELF.getString(nOffset+24);
        var aVersion=sResult.match(/(.*)\//);
        if(aVersion)
        {
            sResult=aVersion[1];
        }
    }

    return sResult;
}

function detect(bShowType,bShowVersion,bShowOptions)
{

    if(ELF.isStringInTablePresent(".dynstr","libQtCore.so.4"))
    {
        sVersion="4.X";
        bDetected=1;
    }
    else if(ELF.isStringInTablePresent(".dynstr","libQtCore.so.5"))
    {
        sVersion="5.X";
        bDetected=1;
    }

    if(bDetected)
    {
        var sQTVersion=getQTVersion();
        if(sQTVersion!="")
        {
            sVersion=sQTVersion;
        }
    }

    return result(bShowType,bShowVersion,bShowOptions);
}
