// INFO FUNCTIONS NGApp PBIBackend::singleAppInfo( QString app, QString injail){ if(JAILPKGS.contains(injail)){ QHash<QString, NGApp> hash = JAILPKGS[injail]; if( hash.contains(app) ){ return hash[app]; } else{ return NGApp(); } }else if(APPHASH.contains(app)){ return APPHASH[app]; }else if(PKGHASH.contains(app)){ return PKGHASH[app]; }else{ return NGApp(); } }
// INFO FUNCTIONS NGApp PBIBackend::singleAppInfo( QString app, QString injail){ if(JAILPKGS.contains(injail)){ QHash<QString, NGApp> hash = JAILPKGS[injail]; if( hash.contains(app) ){ return hash[app]; } else{ //Still load the info - but be sure to mark it as not installed within this jail NGApp info = singleAppInfo(app); info.isInstalled = false; return info; } }else if(APPHASH.contains(app)){ return APPHASH[app]; }else if(PKGHASH.contains(app)){ return PKGHASH[app]; }else{ return NGApp(); } }
//------------------- // PARSERS //------------------- NGApp PBIDBAccess::parseNgIndexLine(QString line){ //PBI= index line: [port, name, +ports, author, website, license, app type, category, tags, maintainer, shortdesc, fulldesc, screenshots, related, plugins, conf dir] // screenshots = list of URL's for screenshots (empty space delimiter? Note "%20"->" " conversion within a single URL) // related = list of ports that are similar to this one QStringList lineInfo = line.split("::::"); if(lineInfo.length() < 18){ return NGApp(); } //invalid entry - skip it QString orig = lineInfo[0]; NGApp app; if(PKGINSTALLED.contains(orig)){ app = PKGINSTALLED[orig]; } //Try to start with the known info else if(PKGAVAIL.contains(orig)){ app = PKGAVAIL[orig]; } app.origin = orig; app.name = lineInfo[1]; app.needsPkgs = lineInfo[2].split(" ", QString::SkipEmptyParts); app.author = lineInfo[3]; app.website = lineInfo[4]; app.license = lineInfo[5]; app.type = lineInfo[6]; app.category = app.origin.section("/",0,0); app.tags = lineInfo[8].split(","); app.maintainer = lineInfo[9]; app.shortdescription = cleanupDescription( lineInfo[10].split("<br>") ); app.description = cleanupDescription( lineInfo[11].split("<br>") ); app.screenshots = lineInfo[12].split(" ", QString::SkipEmptyParts); app.screenshots = app.screenshots.replaceInStrings("%20"," "); app.similarApps = lineInfo[13].split(" ", QString::SkipEmptyParts); app.possiblePlugins = lineInfo[14].split(" ", QString::SkipEmptyParts); app.pbiorigin = lineInfo[15]; app.buildOptions = lineInfo[16].split(" ",QString::SkipEmptyParts); app.rating = lineInfo[17]; //all ratings out of 5 total //Now check for different types of shortcuts for this app app.hasDE = QFile::exists( PBI_DBDIR+app.pbiorigin+"/xdg-desktop" ); app.hasME = QFile::exists( PBI_DBDIR+app.pbiorigin+"/xdg-menu" ); app.hasMT = QFile::exists( PBI_DBDIR+app.pbiorigin+"/xdg-mime" ); app.hasWiki = true; //PBI-apps have wiki pages //Now create the path to the icon in the index app.icon = PBI_DBDIR+app.pbiorigin+"/icon.png"; //qDebug() << "Found App:" << app.name << app.origin; return app; }