Changeset bdd93eb


Ignore:
Timestamp:
05/05/14 07:46:19 (11 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1
Children:
1d68f4d
Parents:
0381f41
Message:

Clean up the database information (dependencies/reverse dependencies), and also make sure the update notification box is only visible if there are actual updates available.

Location:
src-qt4/pc-softwaremanager
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-softwaremanager/mainUI.cpp

    r0381f41 rbdd93eb  
    277277  slotDisplayStats(); 
    278278  slotCheckSelectedItems(); 
     279  ui->group_updates->setVisible(PBI->checkForUpdates()); 
    279280  //If the browser app page is currently visible for this app 
    280281  if( (ui->stacked_browser->currentWidget() == ui->page_app) && ui->page_app->isVisible() ){ 
     
    643644  ui->label_bapp_type->setText(data.type); 
    644645  ui->text_bapp_description->setText(data.description); 
    645   if(data.rating.isEmpty()){ 
     646  if(data.rating.isEmpty() || data.rating=="0.00"){ 
    646647    ui->tool_app_rank->setText("?? / 5"); 
    647648  }else{ 
     
    10271028 
    10281029  QString msg = tr("Please verify the following removals:")+"\n\n"; 
     1030  apps = PBI->filterBasePkgs(apps); //cannot remove particular packages 
    10291031  for(int i=0; i<apps.length(); i++){ 
    10301032    NGApp app = PBI->singleAppInfo(apps[i]); 
    1031     if(app.rdependancy.contains("pcbsd-base")){ apps.removeAt(i); i--; continue; } //skip it - cannot remove 
    10321033    msg.append(app.name+"\n"); 
    1033     if(!app.rdependancy.isEmpty()){ msg.append( " - "+QString(tr("Also Removes: %1")).arg(app.rdependancy.join(", "))+"\n" ); } 
     1034    if(!app.rdependency.isEmpty()){ msg.append( " - "+QString(tr("Also Removes: %1")).arg(app.rdependency.join(", "))+"\n" ); } 
    10341035  } 
    10351036   
  • src-qt4/pc-softwaremanager/mainUI.ui

    r0381f41 rbdd93eb  
    782782                  <item> 
    783783                   <widget class="QToolButton" name="tool_app_tips"> 
     784                    <property name="styleSheet"> 
     785                     <string notr="true">QToolButton{background: transparent; border-width: 0px;} 
     786QToolButton::hover{border: 1px solid rgba(100,120,255,200); }</string> 
     787                    </property> 
    784788                    <property name="text"> 
    785789                     <string>User Tips</string> 
     
    12321236                 </property> 
    12331237                 <property name="currentIndex"> 
    1234                   <number>2</number> 
     1238                  <number>4</number> 
    12351239                 </property> 
    12361240                 <widget class="QWidget" name="tab_app_desc"> 
     
    14221426                     </property> 
    14231427                     <property name="alternatingRowColors"> 
    1424                       <bool>true</bool> 
     1428                      <bool>false</bool> 
    14251429                     </property> 
    14261430                     <property name="selectionMode"> 
  • src-qt4/pc-softwaremanager/pbiDBAccess.cpp

    rb6102c8 rbdd93eb  
    212212    args.clear();  
    213213    if( !jailID.isEmpty() ){ args << "-j" << jailID; } 
    214     args << "query" << "-a" << "APP=%o::::%rn"; 
     214    args << "query" << "-a" << "APP=%o::::%ro"; 
    215215    out = runCMD("pkg", args).split("APP="); 
    216216    //qDebug() << "Get reverse Deps:" << out; 
     
    220220      if(PKGINSTALLED.contains(info[0])){ app = PKGINSTALLED[info[0]]; } //Update existing info 
    221221      else{ continue; } //invalid 
    222       app.rdependancy.append( info[1].simplified() ); 
     222      app.rdependency.append( info[1].simplified() ); 
    223223      PKGINSTALLED.insert(info[0], app); 
    224224    } 
     
    237237  if(PKGAVAIL.isEmpty() || reload){ 
    238238    PKGAVAIL.clear(); 
    239     QStringList args; args << "rquery" << "APP=%o::::%n::::%v::::%m::::%w::::%c::::%e::::%sh::::%q"; 
     239    QStringList args; args << "rquery" << "-a" << "APP=%o::::%n::::%v::::%m::::%w::::%c::::%e::::%sh::::%q"; 
    240240    QStringList out = runCMD("pkg",args).split("APP=");    
    241241    for(int i=0; i<out.length(); i++){ 
     
    257257            //app = getRemotePkgDetails(app); 
    258258      PKGAVAIL.insert(info[0], app); 
     259    } 
     260    //Now get all the dependency information for the packages 
     261    args.clear(); 
     262    args << "rquery" << "-a" << "APP=%o::::%do"; 
     263    out = runCMD("pkg",args).split("APP="); 
     264    for(int i=0; i<out.length(); i++){ 
     265      QStringList info = out[i].split("::::"); 
     266      if(info.length() < 2){ continue; } 
     267      if(PKGAVAIL.contains(info[0])){ 
     268        NGApp app = PKGAVAIL[info[0]]; 
     269              app.dependency.append(info[1].simplified()); 
     270        PKGAVAIL.insert(info[0], app); 
     271      } 
    259272    } 
    260273  } 
  • src-qt4/pc-softwaremanager/pbiDBAccess.h

    rb6102c8 rbdd93eb  
    3131        QString installedversion, installedsize, installedwhen, installedarch; 
    3232        bool isInstalled, isLocked, isOrphan, isRecommended; 
    33         QStringList similarApps, needsPkgs, tags, screenshots, possiblePlugins, installedPlugins, buildOptions, rdependancy, dependency; 
     33        QStringList similarApps, needsPkgs, tags, screenshots, possiblePlugins, installedPlugins, buildOptions, rdependency, dependency; 
    3434        bool hasDE, hasME, hasMT; //desktop/menu entries, mimetypes, path links 
    3535   
  • src-qt4/pc-softwaremanager/pbiNgBackend.cpp

    r0381f41 rbdd93eb  
    180180        //Not a fully-installed PBI - cancel it instead (probably pending) 
    181181        cancelList << appID[i]; 
    182       }else if( app.rdependancy.contains("pcbsd-base") ){ 
     182      }else if( BASELIST.contains(appID[i]) ){ 
    183183        qDebug() << "PC-BSD base dependency:" << appID[i] << " - cannot remove";               
    184184      }else{ 
     
    439439 
    440440bool PBIBackend::checkForUpdates(){ 
    441   QStringList out = Extras::getCmdOutput("pc-updatemanager pkgcheck"); 
    442   //Now parse the output 
    443   qDebug() << "Update parsing not finished yet\n" << out; 
    444   return false; 
     441  QStringList inst = sysDB->getRawInstalledPackages(); 
     442  bool upd = false; 
     443  for(int i=0; i<inst.length() && !upd; i++){ 
     444    NGApp app; 
     445      if(APPHASH.contains(inst[i])){ app = APPHASH[inst[i]]; } 
     446      else if(PKGHASH.contains(inst[i])){ app = PKGHASH[inst[i]]; } 
     447      else{ continue; } 
     448      if(app.isInstalled && !app.version.isEmpty()){ 
     449        upd = (app.version != app.installedversion); 
     450      } 
     451  } 
     452  return upd; 
    445453} 
    446454 
     
    449457  return QStringList(); 
    450458} 
     459 
     460QStringList PBIBackend::filterBasePkgs(QStringList apps){ 
     461  QStringList out; 
     462  for(int i=0; i<apps.length(); i++){ 
     463    if( !BASELIST.contains(apps[i]) ){ out << apps[i]; } 
     464  }        
     465  return out; 
     466} 
     467 
    451468 // ========================== 
    452469 // ====== PUBLIC SLOTS ====== 
     
    558575} 
    559576  
     577//General Functions 
     578QStringList PBIBackend::listDependencies(QString appID){ 
     579  //This is a recursive function to list all the dependencies of a given application 
     580  QStringList out, dep; 
     581  if(APPHASH.contains(appID)){ dep = APPHASH[appID].dependency; } 
     582  else if(PKGHASH.contains(appID)){ dep = PKGHASH[appID].dependency; } 
     583  for(int i=0; i<dep.length(); i++){ 
     584    if(out.contains(dep[i])){ continue; } //duplicate - just skip it since already found earlier 
     585    out << dep[i]; 
     586    out << listDependencies(dep[i]); 
     587  } 
     588  return out; 
     589} 
     590 
     591QStringList PBIBackend::listRDependencies(QString appID){ 
     592  //This is a recursive function to list all the reverse dependencies of a given application 
     593  QStringList out, dep; 
     594  if(APPHASH.contains(appID)){ dep = APPHASH[appID].rdependency; } 
     595  else if(PKGHASH.contains(appID)){ dep = PKGHASH[appID].rdependency; } 
     596  for(int i=0; i<dep.length(); i++){ 
     597    if(out.contains(dep[i])){ continue; } //duplicate - just skip it since already found earlier 
     598    out << dep[i]; 
     599    out << listRDependencies(dep[i]); 
     600  } 
     601  return out;    
     602} 
    560603 // =============================== 
    561604 // ======   PRIVATE SLOTS   ====== 
     
    693736   PKGHASH = sysDB->DetailedPkgList(); // load the pkg info 
    694737   APPHASH = sysDB->DetailedAppList(); // load the pbi info 
    695  
     738   if(BASELIST.isEmpty()){ 
     739      //populate the list of base dependencies that cannot be removed 
     740      BASELIST = listDependencies("misc/pcbsd-base"); 
     741      BASELIST.removeDuplicates(); 
     742      qDebug() << "Base:" << BASELIST; 
     743   } 
    696744   //qDebug() << "Load CATHASH"; 
    697745   CATHASH = sysDB->Categories(); // load all the different categories info 
     
    714762    pkgAvailable = avail.length(); 
    715763} 
     764 
  • src-qt4/pc-softwaremanager/pbiNgBackend.h

    r0381f41 rbdd93eb  
    9191        bool checkForUpdates(); 
    9292        QStringList updateStats(); 
     93        QStringList filterBasePkgs(QStringList); 
    9394         
    9495public slots: 
     
    103104        QHash<QString, NGApp> APPHASH; 
    104105        QHash<QString, NGApp> PKGHASH; 
    105         QStringList RECLIST, HIGHLIST, NEWLIST; 
     106        QStringList RECLIST, HIGHLIST, NEWLIST, BASELIST; 
    106107 
    107108        //General values 
     
    127128        QHash<QString, QStringList> JAILPKGS; // <name, list of installed pkgs> 
    128129        void checkForJails(QString jailID=""); //parses the "jls" command to get name/JID combinations 
     130         
     131        //General functions 
     132        QStringList listDependencies(QString); 
     133        QStringList listRDependencies(QString); 
    129134         
    130135private slots: 
Note: See TracChangeset for help on using the changeset viewer.