Ignore:
Timestamp:
Apr 29, 2013 1:36:34 PM (12 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.1-release, 9.2-release, releng/10.0, releng/10.0.1
Children:
21bd9d7
Parents:
a43929d
Message:

Some cosmetic improvements to PKGNG manager, now when we click a package
we will be shown a details widget, which has name / size / desc / options
/ depends / URL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-pkgmanager/mainWin.cpp

    ra43929d r287e037  
    442442{ 
    443443  qDebug() << "Starting metaWidget..."; 
     444  groupInfo->setVisible(false); 
    444445 
    445446  // Running in basic mode 
     
    461462  new QTreeWidgetItem(treeNGPkgs, QStringList() << tr("Loading... Please wait...") ); 
    462463 
    463   if ( ! pkgList.isEmpty() ) 
     464  if ( ! pkgList.isEmpty() ) { 
    464465        disconnect(treeNGPkgs, SIGNAL(itemChanged(QTreeWidgetItem *, int)), 0, 0); 
     466        disconnect(treeNGPkgs, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), 0, 0); 
     467  } 
    465468  pkgList.clear(); 
    466469  selPkgList.clear(); 
     
    543546 
    544547  connect(treeNGPkgs, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotEnableApply())); 
     548  connect(treeNGPkgs, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(slotNGItemChanged())); 
     549} 
     550 
     551void mainWin::slotNGItemChanged() 
     552{ 
     553  if ( ! treeNGPkgs->currentItem() ) { 
     554     groupInfo->setVisible(false); 
     555     return; 
     556  } 
     557  QString desc, size, maint, weburl; 
     558 
     559  QTreeWidgetItem *cItem = treeNGPkgs->currentItem(); 
     560  QString pName = cItem->text(0).section("(", 1, 1).section(")", 0, 0); 
     561  if ( pName.isEmpty() ) { 
     562     groupInfo->setVisible(false); 
     563     return; 
     564  } 
     565  qDebug() << "Checking: " + pName; 
     566 
     567  QRegExp rx("*:::" + pName + ":::*"); 
     568  rx.setPatternSyntax(QRegExp::Wildcard); 
     569  int pAt = tmpPkgList.indexOf(rx); 
     570  if (pAt == -1 ) { 
     571     qDebug() << "Unable to find package: " + pName; 
     572     groupInfo->setVisible(false); 
     573     return; 
     574  } 
     575 
     576  desc = tmpPkgList.at(pAt).section(":::", 2,2); 
     577  size = tmpPkgList.at(pAt).section(":::", 3,3); 
     578  maint = tmpPkgList.at(pAt).section(":::", 4,4); 
     579  weburl = tmpPkgList.at(pAt).section(":::", 5,5); 
     580  labelPkgNameVer->setText(pName); 
     581  labelSize->setText(size); 
     582  labelWeb->setText(weburl); 
     583  textDesc->setText(desc); 
     584  textOptions->clear(); 
     585 
     586  QCoreApplication::processEvents(); 
     587 
     588  // Display the depends 
     589  QString depTxt; 
     590  QRegExp rxd( pName + ":::*"); 
     591  rxd.setPatternSyntax(QRegExp::Wildcard); 
     592  QStringList aDeps = pkgDepList.filter(rxd); 
     593  for ( int r=0; r < aDeps.size(); ++r) { 
     594      QString dName = aDeps.at(r).section(":::", 1, 1); 
     595      // Is this package installed? 
     596      if ( pkgList.indexOf(dName) != -1 ) 
     597         depTxt+= dName + " (Installed)\n"; 
     598      else 
     599         depTxt+= dName + "\n"; 
     600  } 
     601 
     602  textDeps->setText(depTxt); 
     603 
     604  groupInfo->setVisible(true); 
     605 
     606  getNGInfo = new QProcess(); 
     607  qDebug() << "Getting Info for " + pName; 
     608  connect( getNGInfo, SIGNAL(readyReadStandardOutput()), this, SLOT(slotNGReadInfo()) ); 
     609  getNGInfo->setProcessChannelMode(QProcess::MergedChannels); 
     610  if ( wDir.isEmpty() ) 
     611    getNGInfo->start(QString("pkg"), QStringList() << "rquery" << "%Ok=%Ov" << pName ); 
     612  else 
     613    getNGInfo->start(QString("chroot"), QStringList() << wDir << "pkg" << "rquery" << "%Ok=%Ov" << pName); 
     614} 
     615 
     616void mainWin::slotNGReadInfo() 
     617{ 
     618  while (getNGInfo->canReadLine()) 
     619     textOptions->append(getNGInfo->readLine().simplified() ); 
     620 
     621  textOptions->moveCursor(QTextCursor::Start); 
    545622} 
    546623 
Note: See TracChangeset for help on using the changeset viewer.