Ignore:
Timestamp:
02/25/14 13:00:48 (6 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
50a696a
Parents:
ff5a5e4
Message:

Clean up the AppCafe? browser home page - now just have a toolbutton to browser categories, and instead put recommended applications on the home page (new defaultrecommendations.txt resource). These recommendations can be automatically updated later if we add that ability for the repo to include an additional file with this information.

File:
1 edited

Legend:

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

    r9cbf5aa r32be23f  
    685685    //Not currently running - hide the display indicators 
    686686    ui->group_install_appStat->setVisible(false); 
    687   /*}else if(stat.startsWith("DLSTAT::")){ 
    688     //Currently downloading - show download status indicators 
    689     QString percent = stat.section("::",1,1); 
    690     QString total = stat.section("::",2,2); 
    691     QString speed = stat.section("::",3,3); 
    692     ui->group_install_appStat->setVisible(TRUE); 
    693       ui->progress_install_DL->setVisible(TRUE); 
    694     if(total == "??"){ ui->label_install_status->setText( tr("Downloading file:") ); } 
    695     else{ ui->label_install_status->setText( QString(tr("Downloading %1 file:")).arg(total) ); } 
    696     if(percent == "??"){ 
    697       ui->progress_install_DL->setMinimum(0); ui->progress_install_DL->setMaximum(0); 
    698     }else{ 
    699       ui->progress_install_DL->setMinimum(0); ui->progress_install_DL->setMaximum(1000); 
    700       ui->progress_install_DL->setValue( int(percent.toFloat()*10) ); 
    701     } 
    702     if(speed == "??"){ ui->label_install_DL->setVisible(FALSE); } 
    703     else{ 
    704       ui->label_install_DL->setVisible(TRUE); 
    705       ui->label_install_DL->setText(speed); 
    706     }*/ 
    707687  }else{ 
    708688    //Currently installing/removing/updating - show last message from process 
     
    710690    else{ ui->label_install_status->setText(stat); } 
    711691    ui->group_install_appStat->setVisible(TRUE); 
    712       //ui->progress_install_DL->setVisible(FALSE); 
    713       //ui->label_install_DL->setVisible(FALSE); 
    714692  } 
    715693} 
     
    727705  //Clear any items left over from the designer form 
    728706  clearScrollArea(ui->scroll_br_home_newapps); 
    729   clearScrollArea(ui->scroll_br_home_cats); 
     707  clearScrollArea(ui->scroll_br_home_rec); 
    730708  //Search functionality 
    731709  searchTimer = new QTimer(); 
     
    757735  //Load the Categories 
    758736  QStringList cats = PBI->browserCategories(); 
    759   clearScrollArea(ui->scroll_br_home_cats); 
    760   QVBoxLayout *catlayout = new QVBoxLayout; 
    761   QStringList info; info << "name" << "description" << "icon"; 
    762   cats.sort(); //sort them alphabetically 
    763   for(int i=0; i<cats.length(); i++){ 
    764     QStringList data = PBI->CatInfo(cats[i],info); 
     737    cats.sort(); 
     738    QMenu *catmenu = new QMenu(this); 
     739    QStringList info; info << "name" << "shortdescription" << "icon"; 
     740    for(int i=0; i<cats.length(); i++){ 
     741      QStringList data = PBI->CatInfo(cats[i],info); 
     742      if(!data.isEmpty()){ 
     743      QAction *act = new QAction(QIcon(data[2]), data[0], this); 
     744        act->setToolTip(data[1]); 
     745        act->setWhatsThis(cats[i]); 
     746        catmenu->addAction(act); 
     747      } 
     748    } 
     749    connect(catmenu, SIGNAL(triggered(QAction*)), this, SLOT(slotGoToCatClicked(QAction*)) ); 
     750    ui->tool_browse_gotocat->setMenu(catmenu); 
     751  //Load the Recommendations 
     752  clearScrollArea(ui->scroll_br_home_rec); 
     753  QVBoxLayout *reclayout = new QVBoxLayout; 
     754  QStringList recList = PBI->getRecommendations(); 
     755  //info.clear(); info << "name" << "shortdescription" << "icon"; 
     756  for(int i=0; i<recList.length(); i++){ 
     757    QStringList data = PBI->AppInfo(recList[i],info); 
    765758    if(!data.isEmpty()){ 
    766       LargeItemWidget *item = new LargeItemWidget(cats[i],data[0],data[1],data[2]); 
    767       connect(item,SIGNAL(appClicked(QString)),this,SLOT(slotGoToCategory(QString)) ); 
    768       catlayout->addWidget(item); 
    769     } 
    770   } 
    771   catlayout->addStretch(); //add a spacer to the end 
    772   ui->scroll_br_home_cats->widget()->setLayout(catlayout); 
     759      LargeItemWidget *item = new LargeItemWidget(recList[i],data[0],data[1],data[2]); 
     760      connect(item,SIGNAL(appClicked(QString)),this,SLOT(slotGoToApp(QString)) ); 
     761      reclayout->addWidget(item); 
     762    } 
     763  } 
     764  reclayout->addStretch(); //add a spacer to the end 
     765  ui->scroll_br_home_rec->widget()->setLayout(reclayout); 
    773766  //Load the newest applications 
    774767  clearScrollArea(ui->scroll_br_home_newapps); 
     
    788781  ui->scroll_br_home_newapps->widget()->setLayout(newapplayout); 
    789782  //Make sure that the newapps scrollarea is the proper fit vertically (no vertical scrolling) 
    790   ui->scroll_br_home_newapps->setMinimumHeight(ui->scroll_br_home_newapps->widget()->minimumSizeHint().height()+ui->scroll_br_home_newapps->horizontalScrollBar()->height()); 
     783  ui->scroll_br_home_newapps->setMinimumHeight(ui->scroll_br_home_newapps->widget()->minimumSizeHint().height()); 
    791784   
    792785  //Make sure the new apps area is invisible if no items available 
     
    805798  ui->stacked_browser->setCurrentWidget(ui->page_home);  
    806799  //Make sure the shortcut buttons are disabled 
    807   ui->tool_browse_cat->setVisible(FALSE); 
    808   ui->tool_browse_app->setVisible(FALSE); 
     800  ui->tool_browse_cat->setVisible(false); 
     801  ui->tool_browse_app->setVisible(false); 
     802  ui->tool_browse_gotocat->setVisible(true); 
    809803} 
    810804 
     
    834828  ui->scroll_br_cat_apps->widget()->setLayout(applayout); 
    835829  //Now enable/disable the shortcut buttons 
    836   ui->tool_browse_app->setVisible(FALSE); 
    837   ui->tool_browse_cat->setVisible(TRUE); 
     830  ui->tool_browse_app->setVisible(false); 
     831  ui->tool_browse_cat->setVisible(true); 
     832  ui->tool_browse_gotocat->setVisible(false); 
    838833    QStringList catinfo = PBI->CatInfo(cat,QStringList() << "name" << "icon"); 
    839834    ui->tool_browse_cat->setText(catinfo[0]); 
     
    844839  //Now save that this category is currently displayed 
    845840  cCat = cat; 
     841} 
     842 
     843void MainUI::slotGoToCatClicked(QAction* act){ 
     844  slotGoToCategory(act->whatsThis());    
    846845} 
    847846 
     
    903902  QStringList catinfo = PBI->CatInfo(Extras::nameToID(data[7]),QStringList() << "name" << "icon"); 
    904903  if(!catinfo.isEmpty()){ 
     904    ui->tool_browse_gotocat->setVisible(false); 
    905905    ui->tool_browse_cat->setVisible(TRUE); 
    906906    ui->tool_browse_cat->setText(catinfo[0]); 
     
    919919  QStringList info = PBI->AppInfo(cApp, QStringList() << "latestversion" << "backupversion" << "requiresroot"); 
    920920  QString pbiID = PBI->isInstalled(cApp); 
    921   qDebug() << "App Download status:" << working << rawstat; 
     921  //qDebug() << "App Download status:" << working << rawstat; 
    922922  if(!working.isEmpty() && !rawstat.isEmpty() ){ //app currently pending or actually doing something 
    923923    if(rawstat.startsWith("DLSTAT::")){ ui->tool_bapp_download->setText(tr("Downloading..")); } 
     
    983983    ui->scroll_bapp_similar->widget()->setLayout(layout); 
    984984    //Make sure that the similar scrollarea is the proper fit vertically (no vertical scrolling) 
    985     ui->scroll_bapp_similar->setMinimumHeight(ui->scroll_bapp_similar->widget()->minimumSizeHint().height()+ui->scroll_bapp_similar->horizontalScrollBar()->height()); 
     985    ui->scroll_bapp_similar->setMinimumHeight(ui->scroll_bapp_similar->widget()->minimumSizeHint().height() +ui->scroll_bapp_similar->horizontalScrollBar()->height()/1.2); 
    986986    //Now make the group visible as appropriate 
    987987    ui->group_bapp_similar->setVisible(TRUE); 
Note: See TracChangeset for help on using the changeset viewer.