Changeset f3baeb9


Ignore:
Timestamp:
07/09/13 14:57:42 (14 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
a3c7851
Parents:
e7d8648
Message:

Add a quick "cancel" button to the AppCafe?, and make the quick buttons dynamically visible as necessary. Also fix up and add a couple icons for the small update button.

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

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-softwaremanager/SoftwareManager.qrc

    r78fa8b2 rf3baeb9  
    3333    <file>icons/app_needroot.png</file> 
    3434    <file>icons/app_upgrade.png</file> 
     35    <file>icons/app_upgrade_small.png</file> 
     36    <file>icons/app_upgrade_small-root.png</file> 
    3537    <file>icons/xdg_desktop.png</file> 
    3638    <file>icons/xdg_menu.png</file> 
  • src-qt4/pc-softwaremanager/mainUI.cpp

    re7d8648 rf3baeb9  
    314314  vals << "name" << "icon" << "author" << "website" << "version" << "license"; 
    315315  QStringList bools; 
    316   bools << "autoupdate" << "hasdesktopicons" << "hasmenuicons"; 
     316  bools << "autoupdate" << "hasdesktopicons" << "hasmenuicons" << "requiresroot"; 
    317317  vals = PBI->PBIInfo(appID,vals); 
    318318  bools = PBI->PBIInfo(appID,bools); 
     
    327327  bool desktopSC = (bools[1] == "true"); // XDG desktop entries available 
    328328  bool menuSC= (bools[2] == "true");     // XDG menu entries available 
    329   bool autoupdate = (bools[0] == "true");   
     329  bool autoupdate = (bools[0] == "true"); //auto-update enabled 
     330  bool rootonly = (bools[3] == "true"); //requires root 
    330331  //Create the shortcuts string 
    331332  QString shortcuts; 
     
    348349  ui->label_install_shortcuts->setText(shortcuts); 
    349350  ui->check_install_autoupdate->setChecked(autoupdate); 
    350   //Make the upgrade button invisible if no upgrade available 
    351   if(PBI->upgradeAvailable(appID).isEmpty()){ ui->tool_install_update->setVisible(FALSE); } 
    352   else{ ui->tool_install_update->setVisible(TRUE); } 
     351   
     352  //Adjust the quick action buttons as necessary 
     353  if(!PBI->currentAppStatus(appID).isEmpty()){ 
     354    //Actions pending/working only show cancel button 
     355    ui->tool_install_cancel->setVisible(TRUE); 
     356    ui->tool_install_remove->setVisible(FALSE); 
     357    ui->tool_install_update->setVisible(FALSE); 
     358  }else{ 
     359    //Nothing pending 
     360    ui->tool_install_cancel->setVisible(FALSE); 
     361    if( !PBI->isInstalled(appID).isEmpty() ){  
     362      //Remove Button 
     363      ui->tool_install_remove->setVisible(TRUE); 
     364      if(rootonly){ ui->tool_install_remove->setIcon(QIcon(":icons/remove-root.png")); } 
     365      else{ ui->tool_install_remove->setIcon(QIcon(":icons/remove.png")); } 
     366      //Upgrade button 
     367      if(PBI->upgradeAvailable(appID).isEmpty()){ ui->tool_install_update->setVisible(FALSE); } 
     368      else{ 
     369        ui->tool_install_update->setVisible(TRUE);  
     370        if(rootonly){ ui->tool_install_update->setIcon(QIcon(":icons/app_upgrade_small-root.png")); } 
     371        else{ ui->tool_install_update->setIcon(QIcon(":icons/app_upgrade_small.png")); } 
     372      } 
     373    }else{  
     374      ui->tool_install_remove->setVisible(FALSE);  
     375      ui->tool_install_update->setVisible(FALSE);  
     376    }    
     377  } 
    353378   
    354379} 
     
    388413    PBI->removePBI(QStringList() << appID); 
    389414  } 
     415} 
     416 
     417void MainUI::on_tool_install_cancel_clicked(){ 
     418  //Get the current item 
     419  QString appID; 
     420  if(ui->tree_install_apps->topLevelItemCount() > 0){ 
     421    appID = ui->tree_install_apps->currentItem()->whatsThis(0); 
     422  } 
     423  if(appID.isEmpty()){return;} 
     424  PBI->cancelActions(QStringList() << appID); 
     425   
    390426} 
    391427 
  • src-qt4/pc-softwaremanager/mainUI.h

    r0314e57 rf3baeb9  
    6363  void on_tool_install_update_clicked(); 
    6464  void on_tool_install_remove_clicked(); 
     65  void on_tool_install_cancel_clicked(); 
    6566  void slotActionAddDesktop(); 
    6667  void slotActionRemoveDesktop(); 
  • src-qt4/pc-softwaremanager/pbiBackend.cpp

    recf5153 rf3baeb9  
    159159// ===== Local/Repo Interaction Functions ===== 
    160160QString PBIBackend::isInstalled(QString appID){ 
     161  //check if the pbiID was given (quick) 
     162  if(PBIHASH.contains(appID)){ 
     163    if(PBIHASH[appID].path.isEmpty()){ return ""; } 
     164    else{ return appID; } 
     165  } 
    161166  //Returns pbiID of the installed application 
    162167  QString output; 
     
    167172  QStringList pbiID = PBIHASH.keys(); //get list of installed PBI's 
    168173  for(int i=0; i<pbiID.length();i++){ 
    169     QString pbi = Extras::nameToID(PBIHASH[pbiID[i]].name); 
     174    QString pbi = Extras::nameToID(PBIHASH[pbiID[i]].metaID); 
    170175    if( (pbi == appID) && !PBIHASH[pbiID[i]].path.isEmpty() ){ 
    171176      output = pbiID[i]; 
     
    179184  QString output; 
    180185  if(!PBIHASH.contains(pbiID)){return output;} 
    181   QString appID = Extras::nameToID(PBIHASH[pbiID].name); 
     186  QString appID = Extras::nameToID(PBIHASH[pbiID].metaID); 
    182187  if(APPHASH.contains(appID)){ 
    183188    if(APPHASH[appID].latestVersion != PBIHASH[pbiID].version){output = APPHASH[appID].latestVersion;}   
     
    247252  //Now check/start the remove process 
    248253  QTimer::singleShot(0,this,SLOT(checkProcesses()) ); 
    249 } 
    250  
    251 void PBIBackend::stopUpdate(QStringList pbiID){ 
    252   qDebug() << "Stop Update requested for:" << pbiID; 
    253254} 
    254255 
     
    522523 
    523524QString PBIBackend::currentAppStatus( QString appID ){ 
     525  QString output; 
     526  int status = -999; 
     527  //pbiID given (quicker) 
     528  if(PBIHASH.contains(appID)){ status = PBIHASH[appID].status; } 
     529  else{ 
     530    //appID given 
     531    if(!APPHASH.contains(appID)){ return ""; } 
     532    QStringList pbilist = PBIHASH.keys(); 
     533    for(int i=0; i<pbilist.length(); i++){ 
     534      if(PBIHASH[pbilist[i]].metaID == appID){ status = PBIHASH[pbilist[i]].status; } 
     535    } 
     536  } 
    524537  //Determine if the app is currently in a pending state 
    525   if(!APPHASH.contains(appID)){ return ""; } 
    526   QString output; 
    527   QStringList pbilist = PBIHASH.keys(); 
     538  switch (status){ 
     539        case InstalledPBI::DOWNLOADING: 
     540          output = tr("Downloading"); break; 
     541        case InstalledPBI::INSTALLING: 
     542          output = tr("Installing"); break; 
     543        case InstalledPBI::REMOVING: 
     544          output = tr("Removing"); break; 
     545        case InstalledPBI::UPDATING: 
     546          output = tr("Updating"); break; 
     547        case InstalledPBI::PENDINGDOWNLOAD: 
     548          output = tr("Pending Download"); break; 
     549        case InstalledPBI::PENDINGINSTALL: 
     550          output = tr("Pending Install"); break; 
     551        case InstalledPBI::PENDINGREMOVAL: 
     552          output = tr("Pending Removal"); break; 
     553        case InstalledPBI::PENDINGUPDATE: 
     554          output = tr("Pending Update"); break; 
     555        default: //do nothing for the rest 
     556          output.clear(); 
     557  } 
     558  return output; 
     559  /* 
    528560  for(int i=0; i<pbilist.length(); i++){ 
    529561    if(PBIHASH[pbilist[i]].metaID == appID){ 
     
    551583    } 
    552584  } 
    553   return output; 
     585  return output;*/ 
    554586} 
    555587 
  • src-qt4/pc-softwaremanager/pbiBackend.h

    r78fa8b2 rf3baeb9  
    5151        void upgradePBI(QStringList pbiID); //start upgrade process for list of PBI's 
    5252        void removePBI(QStringList pbiID); //start the removal process 
    53         void stopUpdate(QStringList pbiID); //stop upgrade/downgrade/removal process 
    5453        void installApp(QStringList appID); //[install/upgrade/downgrade] application from the repo (as appropriate) 
    5554        void addDesktopIcons(QStringList pbiID, bool allusers); // add XDG desktop icons 
Note: See TracChangeset for help on using the changeset viewer.