Permalink
Browse files

Setup the AppCafe to read the new shortdescription, maintainer, and t…

…imeadded fields in the 10 meta files.

NOTE: This update CANNOT be backported to 9.x without breaking the compatibility with the 9.x meta file format (rendering the AppCafe browser useless).
  • Loading branch information...
1 parent 901829d commit d9f2085b9a725bd75d0a8fef7b9004e45e9e23a9 Ken Moore committed Nov 14, 2013
@@ -53,7 +53,7 @@ class InstalledPBI{
class MetaPBI{
public:
- QString name, category, remoteIcon, localIcon, author, website, license, appType, description;
+ QString name, category, remoteIcon, localIcon, author, website, license, appType, description, shortdescription,maintainer,dateadded;
QStringList tags;
QString latestVersion, latestDatetime, latestArch, latestSizeK, latestFilename; //newest version in the index
QString backupVersion, backupDatetime, backupArch, backupSizeK, backupFilename; //next-to-newest version in the index
@@ -696,7 +696,7 @@ void MainUI::slotGoToCategory(QString cat){
clearScrollArea(ui->scroll_br_cat_apps);
apps.sort();
QVBoxLayout *applayout = new QVBoxLayout;
- QStringList info; info << "name" << "description" << "icon";
+ QStringList info; info << "name" << "shortdescription" << "icon";
for(int i=0; i<apps.length(); i++){
QStringList data = PBI->AppInfo(apps[i],info);
if(!data.isEmpty()){
@@ -470,6 +470,8 @@ QStringList PBIBackend::AppInfo( QString appID, QStringList infoList){
else if(infoList[i]=="license"){ output << APPHASH[appID].license; }
else if(infoList[i]=="type"){ output << APPHASH[appID].appType; }
else if(infoList[i]=="description"){ output << APPHASH[appID].description; }
+ else if(infoList[i]=="shortdescription"){ output << APPHASH[appID].shortdescription; }
+ else if(infoList[i]=="maintainer"){ output << APPHASH[appID].maintainer; }
else if(infoList[i]=="category"){ output << APPHASH[appID].category; }
else if(infoList[i]=="latestversion"){ output << APPHASH[appID].latestVersion; }
else if(infoList[i]=="latestarch"){ output << APPHASH[appID].latestArch; }
@@ -1317,6 +1319,9 @@ void PBIBackend::slotProcessError(int ID, QStringList log){
app.description=info[8];
if(info[9]=="true"){ app.requiresroot=TRUE; }
else{ app.requiresroot=FALSE; }
+ app.dateadded=info[10];
+ app.maintainer=info[11];
+ app.shortdescription=info[12];
//Fix the website if needed
if(app.website.endsWith("/")){ app.website.chop(1); }
//Add it to the hash
@@ -207,15 +207,48 @@ QStringList PBIDBAccess::parseIndexLine(QString line){
}
QStringList PBIDBAccess::parseAppMetaLine(QString line){
- // line format 5/1/2013: [name,category,remoteIcon,author,website,license,apptype,tags,description,requiresroot]
- QStringList output = line.split(";");
- if(output.length() < 10){ output.clear();} //invalid line
- else if(output[9]=="YES"){ output[9]="true"; } //change to the same true/false syntax as elsewhere
+ // line format 11/14/2013 (10.x PBI format):
+ // [name,category,remoteIcon,author,website,license,apptype,tags,description,requiresroot,dateadded,maintainerEmail,shortDescription]
+ QStringList list = line.split(";");
+ //Format the output list
+ QStringList output;
+ if(output.length() < 13){ return output;} //invalid line
+ output << list[0]; //NAME
+ output << list[1]; //CATEGORY
+ output << list[2]; //remoteIcon
+ output << list[3]; //AUTHOR
+ output << list[4]; //WEBSITE
+ output << list[5]; //LICENSE
+ output << list[6]; //APP-TYPE
+ output << list[7]; //TAGS
+ //Cleanup the description (try to format the text properly)
+ QStringList tmp = list[8].split("<br>");
+ for(int i=1; i<tmp.length(); i++){
+ tmp[i-1] = tmp[i-1].simplified();
+ if(tmp[i=1].isEmpty() || tmp[i].isEmpty() ){continue;}
+ else if(tmp[i=1].endsWith(".") || tmp[i-1].endsWith(":") || tmp[i-1].endsWith(";") || tmp[i-1].endsWith("?") || tmp[i-1].endsWith("!") ){ continue; }
+ else if( tmp[i].startsWith("*") || tmp[i].startsWith("0") || tmp[i].startsWith("-") || tmp[i].startsWith("o ") ){ continue; }
+ else{
+ //Bad line break, combine it with the previous line
+ tmp[i-1].append(" "+tmp[i]);
+ tmp.removeAt(i);
+ i--;
+ }
+ }
+ output << tmp.join("\n"); //DESCRIPTION
+ if(list[9]=="YES"){ list[9]="true"; } //change to the same true/false syntax as elsewhere
+ output << list[9]; //REQUIRESROOT
+ output << list[10]; //DATE ADDED (just a number - not human-readable)
+ output << list[11]; //MAINTAINER EMAIL
+ //Cleanup the short description (remove any line breaks)
+ tmp = list[12].split("<br>", QString::SkipEmptyParts);
+ list[12] = tmp.join(" ").simplified();
+ output << list[12]; //SHORT DESCRIPTION
return output;
}
QStringList PBIDBAccess::parseCatMetaLine(QString line){
- // line format 5/1/2013: [name,remoteicon,description,?]
+ // line format 11/14/2013: [name,remoteicon,description]
QStringList output = line.split(";");
if(output.length() < 3){output.clear(); } //incomplete line
return output;

0 comments on commit d9f2085

Please sign in to comment.