[PC-BSD Commits] r12305 - pcbsd/current/src-qt4/pc-sysmanager

svn at pcbsd.org svn at pcbsd.org
Thu Aug 25 13:28:54 PDT 2011


Author: kris
Date: 2011-08-25 13:28:54 -0700 (Thu, 25 Aug 2011)
New Revision: 12305

Added:
   pcbsd/current/src-qt4/pc-sysmanager/dialogInfoBox.cpp
   pcbsd/current/src-qt4/pc-sysmanager/dialogInfoBox.h
   pcbsd/current/src-qt4/pc-sysmanager/dialogInfoBox.ui
Modified:
   pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp
   pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h
   pcbsd/current/src-qt4/pc-sysmanager/pc-sysmanager.pro
Log:

Add new feature to pc-sysmanager, you can now right-click meta-pkg and select
to view a pkg-listing of what that particular meta-pkg requires. Need to port
this over to pc-sysinstaller as well. 



Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp	2011-08-25 18:36:12 UTC (rev 12304)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp	2011-08-25 20:28:54 UTC (rev 12305)
@@ -66,6 +66,8 @@
     // Connect the mirror radio buttons, so we can enable disable objects based on status
     connect(radioSelectMirror, SIGNAL( clicked() ), this, SLOT( slotCheckMirrorRadio() ) );
     connect(radioCustomMirror, SIGNAL( clicked() ), this, SLOT( slotCheckMirrorRadio() ) );
+    treeMetaPkgs->setContextMenuPolicy(Qt::CustomContextMenu);
+    connect(treeMetaPkgs, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotMetaRightClick()) );
 
     // Display the meta-pkgs
     populateMetaPkgs();
@@ -687,7 +689,7 @@
 // Parse the pc-metapkg saved output
 void PBSystemTab::parseTmpMetaList()
 {
-  QString tmp, mName, mDesc, mIcon, mParent, mDesktop, mInstalled;
+  QString tmp, mName, mDesc, mIcon, mParent, mDesktop, mInstalled, mPkgFileList;
   QStringList package;
 
   for ( int i = 0 ; i < tmpMetaPkgList.size(); i++ )
@@ -706,6 +708,8 @@
 	}
 	if ( tmp.indexOf("Icon: ") == 0) {
 		mIcon = tmp.replace("Icon: ", "");
+		mPkgFileList = mIcon;
+		mPkgFileList.replace("pkg-icon.png", "pkg-list");
 		continue;
 	}
 	if ( tmp.indexOf("Parent: ") == 0) {
@@ -725,23 +729,23 @@
 		mInstalled = "CATEGORY";
 		package << mName << mDesc << mIcon << mParent << mDesktop << mInstalled;
 		metaPkgList.append(package);
-		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop=""; mInstalled="";
+		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop=""; mInstalled=""; mPkgFileList="";
 	}
 
 	// We have a Meta-Pkg
 	if ( tmp.indexOf("Required Packages:") == 0) {
 		// Now add this meta-pkg to the string list
 		package.clear();
-		qDebug() << "Found Package" << mName << mDesc << mIcon << mParent << mDesktop;
+		qDebug() << "Found Package" << mName << mDesc << mIcon << mParent << mDesktop << mPkgFileList;
 
 		if ( isMetaPkgInstalled(mName) )
 			mInstalled = "YES";
 		else
 			mInstalled = "NO";
 
-		package << mName << mDesc << mIcon << mParent << mDesktop << mInstalled;
+		package << mName << mDesc << mIcon << mParent << mDesktop << mInstalled << mPkgFileList;
 		metaPkgList.append(package);
-		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop=""; mInstalled="";
+		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop=""; mInstalled=""; mPkgFileList="";
 	}
 
     }
@@ -1097,3 +1101,52 @@
          ++it;
         }
 }
+
+void PBSystemTab::slotMetaRightClick()
+{
+        QTreeWidgetItemIterator it(treeMetaPkgs);
+        while (*it) {
+          for (int z=0; z < metaPkgList.count(); ++z) {
+            if ( (*it)->isSelected() && (*it)->text(0) == metaPkgList.at(z).at(0) ) {
+	      if (metaPkgList.at(z).at(5) == "CATEGORY")
+	        return;
+	      popup = new QMenu;
+	      popup->setTitle((*it)->text(0));
+	      popup->addAction(tr("View Packages"), this, SLOT(slotMetaViewPkgs()));
+	      popup->exec( QCursor::pos() );
+	    }
+	  }
+         ++it;
+        }
+}
+
+void PBSystemTab::slotMetaViewPkgs()
+{
+	QStringList packageList;
+        QTreeWidgetItemIterator it(treeMetaPkgs);
+        while (*it) {
+          for (int z=0; z < metaPkgList.count(); ++z) {
+            if ( (*it)->isSelected() && (*it)->text(0) == metaPkgList.at(z).at(0) ) {
+ 
+		QFile pList(metaPkgList.at(z).at(6));
+		if ( ! pList.exists() )
+		  return;
+		
+ 	        if ( ! pList.open(QIODevice::ReadOnly | QIODevice::Text))
+                  return;
+
+                while ( !pList.atEnd() )
+     		  packageList << pList.readLine().simplified();
+
+		pList.close();
+	        packageList.sort();
+			
+		dIB = new dialogInfoBox();
+    		dIB->programInit(tr("Package Listing for:") + " " + (*it)->text(0));
+		dIB->setInfoText(packageList.join("\n"));
+                dIB->show();
+	    }
+	  }
+         ++it;
+        }
+}

Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h	2011-08-25 18:36:12 UTC (rev 12304)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h	2011-08-25 20:28:54 UTC (rev 12305)
@@ -14,7 +14,9 @@
 
 #include <pcbsd-utils.h>
 #include "updaterDialog.h"
+#include "dialogInfoBox.h"
 #include "ui_pbsystemtab.h"
+#include "ui_dialogInfoBox.h"
 #include "portsnapprogress.h"
 #include "cvsupprogress.h"
 #include "dialogMetaProgress.h"
@@ -84,6 +86,8 @@
     void slotMetaAddRead();
     void slotMetaDelDone();
     void slotMetaDelRead();
+    void slotMetaRightClick();
+    void slotMetaViewPkgs();
 
 private:
     CVSUpProgress *cvsUpUi;
@@ -148,6 +152,7 @@
     updaterStatus *UpdaterStatusDialog;
     dialogMetaProgress *metaProgressDel;
     dialogMetaProgress *metaProgressAdd;
+    dialogInfoBox *dIB;
     
     QMenu *popup;
     QNetworkAccessManager *sysFetchJob;

Modified: pcbsd/current/src-qt4/pc-sysmanager/pc-sysmanager.pro
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pc-sysmanager.pro	2011-08-25 18:36:12 UTC (rev 12304)
+++ pcbsd/current/src-qt4/pc-sysmanager/pc-sysmanager.pro	2011-08-25 20:28:54 UTC (rev 12305)
@@ -7,9 +7,9 @@
 
 INCLUDEPATH	+= ../libpcbsd/ /usr/local/include
 
-HEADERS	+= cvsupprogress.h dialogMetaProgress.h fastestcvsup.h pbsystemtab.h portsnapprogress.h updaterDialog.h
+HEADERS	+= cvsupprogress.h dialogMetaProgress.h fastestcvsup.h pbsystemtab.h portsnapprogress.h updaterDialog.h dialogInfoBox.h
 
-SOURCES	+= main.cpp cvsupprogress.cpp dialogMetaProgress.cpp fastestcvsup.cpp pbsystemtab.cpp portsnapprogress.cpp \
+SOURCES	+= main.cpp cvsupprogress.cpp dialogMetaProgress.cpp fastestcvsup.cpp pbsystemtab.cpp portsnapprogress.cpp dialogInfoBox.cpp \
 	updaterDialog.cpp
 
 FORMS	= pbsystemtab.ui \
@@ -17,6 +17,7 @@
 	dialogMetaProgress.ui \
 	portsnapprogress.ui \
 	updaterDialog.ui \
+	dialogInfoBox.ui \
 	fastestcvsup.ui
 
 RESOURCES = PBSystem.qrc 



More information about the Commits mailing list