Ignore:
Timestamp:
02/26/14 09:53:11 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
9474a65
Parents:
c4ff3c1
Message:

Change the new Category browser to it's own page instead of using the menu on the toolbutton.

File:
1 edited

Legend:

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

    rc4ff3c1 r316d4d3  
    784784  connect(ui->tool_browse_search,SIGNAL(clicked()),this,SLOT(slotGoToSearch()) ); 
    785785  connect(ui->line_browse_searchbar,SIGNAL(returnPressed()),this,SLOT(slotGoToSearch()) ); 
     786  connect(ui->tool_browse_gotocat, SIGNAL(clicked()), this, SLOT(slotGoToCatBrowser()) ); 
    786787} 
    787788 
     
    804805 
    805806void MainUI::slotUpdateBrowserHome(){ 
    806   //Load the Categories 
    807   QStringList cats = PBI->browserCategories(); 
    808     cats.sort(); 
    809     QMenu *catmenu = new QMenu(this); 
    810     QStringList info; info << "name" << "shortdescription" << "icon"; 
    811     for(int i=0; i<cats.length(); i++){ 
    812       QStringList data = PBI->CatInfo(cats[i],info); 
    813       if(!data.isEmpty()){ 
    814       QAction *act = new QAction(QIcon(data[2]), data[0], this); 
    815         act->setToolTip(data[1]); 
    816         act->setWhatsThis(cats[i]); 
    817         catmenu->addAction(act); 
    818       } 
    819     } 
    820     connect(catmenu, SIGNAL(triggered(QAction*)), this, SLOT(slotGoToCatClicked(QAction*)) ); 
    821     ui->tool_browse_gotocat->setMenu(catmenu); 
    822807  //Load the Recommendations 
    823808  clearScrollArea(ui->scroll_br_home_rec); 
    824809  QVBoxLayout *reclayout = new QVBoxLayout; 
    825810  QStringList recList = PBI->getRecommendations(); 
    826   info.clear(); info << "name" << "shortdescription" << "icon" << "type"; 
     811  QStringList info; info << "name" << "shortdescription" << "icon" << "type"; 
    827812  for(int i=0; i<recList.length(); i++){ 
    828813    QStringList data = PBI->AppInfo(recList[i],info); 
     
    865850  ui->tool_browse_app->setVisible(FALSE);  
    866851   
     852  //Now update the category browser page (since it only needs to be done once like the home menu) 
     853  //Load the Categories 
     854  QStringList cats = PBI->browserCategories(); 
     855    cats.sort(); 
     856    clearScrollArea(ui->scroll_br_cats); 
     857    QVBoxLayout *catlayout = new QVBoxLayout; 
     858    info.clear(); info << "name" << "description" << "icon"; 
     859    for(int i=0; i<cats.length(); i++){ 
     860      QStringList data = PBI->CatInfo(cats[i],info); 
     861      if(!data.isEmpty()){ 
     862        LargeItemWidget *item = new LargeItemWidget(cats[i],data[0],data[1],data[2]); 
     863        connect(item,SIGNAL(appClicked(QString)),this,SLOT(slotGoToCategory(QString)) ); 
     864        catlayout->addWidget(item); 
     865      } 
     866    } 
     867    catlayout->addStretch(); //add a spacer to the end 
     868    ui->scroll_br_cats->widget()->setLayout(catlayout); 
    867869} 
    868870 
     
    874876  ui->tool_browse_app->setVisible(false); 
    875877  ui->tool_browse_gotocat->setVisible(true); 
     878} 
     879 
     880void MainUI::slotGoToCatBrowser(){ 
     881  ui->tabWidget->setCurrentWidget(ui->tab_browse); 
     882  ui->stacked_browser->setCurrentWidget(ui->page_browsecats); 
     883  //Make sure the shortcut buttons are diabled 
     884  ui->tool_browse_cat->setVisible(false); 
     885  ui->tool_browse_app->setVisible(false); 
     886  ui->tool_browse_gotocat->setVisible(false); 
    876887} 
    877888 
Note: See TracChangeset for help on using the changeset viewer.