[PC-BSD Commits] r12313 - pcbsd/current/src-qt4/pc-sysinstaller

svn at pcbsd.org svn at pcbsd.org
Fri Aug 26 06:44:34 PDT 2011


Author: kris
Date: 2011-08-26 06:44:34 -0700 (Fri, 26 Aug 2011)
New Revision: 12313

Added:
   pcbsd/current/src-qt4/pc-sysinstaller/dialogInfoBox.cpp
   pcbsd/current/src-qt4/pc-sysinstaller/dialogInfoBox.h
   pcbsd/current/src-qt4/pc-sysinstaller/dialogInfoBox.ui
Modified:
   pcbsd/current/src-qt4/pc-sysinstaller/backend.cpp
   pcbsd/current/src-qt4/pc-sysinstaller/pc-sysinstaller.pro
   pcbsd/current/src-qt4/pc-sysinstaller/sys-pkgmgmt.cpp
   pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h
Log:

Add right-click functionality to pc-sysinstaller on the meta-pkgs, which lets the user see
which freebsd packages specifically will be installed



Modified: pcbsd/current/src-qt4/pc-sysinstaller/backend.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/backend.cpp	2011-08-26 12:59:40 UTC (rev 12312)
+++ pcbsd/current/src-qt4/pc-sysinstaller/backend.cpp	2011-08-26 13:44:34 UTC (rev 12313)
@@ -409,7 +409,7 @@
 {
   QList<QStringList> metaPkgs;
   found=false;
-  QString tmp, mName, mDesc, mIcon, mParent, mDesktop;
+  QString tmp, mName, mDesc, mIcon, mParent, mDesktop, mPkgFileList;
   QStringList package;
 
   QProcess pcmp;
@@ -428,6 +428,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) {
@@ -444,17 +446,17 @@
 		qDebug() << "Found Package" << mName << mDesc << mIcon << mParent<< mDesktop << "CATEGORY";
 		package << mName << mDesc << mIcon << mParent << mDesktop << "CATEGORY";
 		metaPkgs.append(package);
-		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop="";
+		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop=""; mPkgFileList="";
         }
 
 	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 << "NO";
-		package << mName << mDesc << mIcon << mParent << mDesktop << "NO";
+		qDebug() << "Found Package" << mName << mDesc << mIcon << mParent << mDesktop << "NO" << mPkgFileList;
+		package << mName << mDesc << mIcon << mParent << mDesktop << "NO" << mPkgFileList;
 		metaPkgs.append(package);
 		found = true;
-		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop="";
+		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop=""; mPkgFileList="";
 	}
     }
   }

Modified: pcbsd/current/src-qt4/pc-sysinstaller/pc-sysinstaller.pro
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/pc-sysinstaller.pro	2011-08-26 12:59:40 UTC (rev 12312)
+++ pcbsd/current/src-qt4/pc-sysinstaller/pc-sysinstaller.pro	2011-08-26 13:44:34 UTC (rev 12313)
@@ -14,6 +14,7 @@
     sys-keyboardwidget.cpp \
     sys-pkgmgmt.cpp \
     sys-userwidget.cpp \
+    dialogInfoBox.cpp \
     dialogFileSystem.cpp \
     dialogHelp.cpp \
     dialogSelectNet.cpp \
@@ -21,6 +22,7 @@
     sysinstaller.cpp \
     backend.cpp
 HEADERS += sysinstaller.h \
+    dialogInfoBox.h \
     dialogFileSystem.h \
     dialogHelp.h \
     dialogSelectNet.h \
@@ -97,5 +99,5 @@
 
 INSTALLS += dotrans
 
-FORMS += sysinstaller.ui dialogFileSystem.ui dialogHelp.ui dialogSelectNet.ui dialogZFSMount.ui
+FORMS += sysinstaller.ui dialogFileSystem.ui dialogHelp.ui dialogSelectNet.ui dialogZFSMount.ui dialogInfoBox.ui
 RESOURCES += sysinstaller.qrc

Modified: pcbsd/current/src-qt4/pc-sysinstaller/sys-pkgmgmt.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sys-pkgmgmt.cpp	2011-08-26 12:59:40 UTC (rev 12312)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sys-pkgmgmt.cpp	2011-08-26 13:44:34 UTC (rev 12313)
@@ -83,6 +83,10 @@
     treeWidgetDesktopPackages->setMouseTracking(TRUE);
     connect(treeWidgetDesktopPackages, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotDeskPkgsChanged(QTreeWidgetItem *, int)));
     connect(treeWidgetDesktopPackages, SIGNAL(itemEntered(QTreeWidgetItem *, int)), this, SLOT(slotShowLabelDesc(QTreeWidgetItem *, int)));
+
+    treeWidgetDesktopPackages->setContextMenuPolicy(Qt::CustomContextMenu);
+    connect(treeWidgetDesktopPackages, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotMetaRightClick()) );
+
 }
 
 // Slot to show meta-pkg description on mouseover
@@ -266,3 +270,52 @@
    cfgList << cfgLine;
    return cfgList;
 }
+
+void SysInstaller::slotMetaRightClick()
+{
+        QTreeWidgetItemIterator it(treeWidgetDesktopPackages);
+        while (*it) {
+          for (int z=0; z < listDeskPkgs.count(); ++z) {
+            if ( (*it)->isSelected() && (*it)->text(0) == listDeskPkgs.at(z).at(0) ) {
+              if (listDeskPkgs.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 SysInstaller::slotMetaViewPkgs()
+{
+        QStringList packageList;
+        QTreeWidgetItemIterator it(treeWidgetDesktopPackages);
+        while (*it) {
+          for (int z=0; z < listDeskPkgs.count(); ++z) {
+            if ( (*it)->isSelected() && (*it)->text(0) == listDeskPkgs.at(z).at(0) ) {
+        
+                QFile pList(listDeskPkgs.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-sysinstaller/sysinstaller.h
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h	2011-08-26 12:59:40 UTC (rev 12312)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h	2011-08-26 13:44:34 UTC (rev 12313)
@@ -4,12 +4,14 @@
 #include <QtGui/QWidget>
 #include <QMessageBox>
 #include <QFile>
+#include <QMenu>
 #include <QProcess>
 
 #include "ui_sysinstaller.h"
 #include "dialogFileSystem.h"
 #include "dialogHelp.h"
 #include "dialogSelectNet.h"
+#include "dialogInfoBox.h"
 
 #include "backend.h"
 
@@ -118,6 +120,8 @@
     // Desktop Packages Slot
     void slotDeskPkgsChanged(QTreeWidgetItem *aItem, int aCol);
     void slotShowLabelDesc(QTreeWidgetItem *aItem, int aCol);
+    void slotMetaRightClick();
+    void slotMetaViewPkgs();
 
     // Grab checked / unchecked status of hostname
     void slotHostnameClicked();
@@ -205,6 +209,10 @@
     // Help Stuff
     dialogHelp *pcHelp;
 
+    // Infobox 
+    dialogInfoBox *dIB;
+    QMenu *popup;
+
 };
 
 #endif // SYSINSTALLER_H



More information about the Commits mailing list