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

svn at pcbsd.org svn at pcbsd.org
Fri Oct 8 23:37:46 PDT 2010


Author: kris
Date: 2010-10-08 23:37:46 -0700 (Fri, 08 Oct 2010)
New Revision: 7758

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

Started adding support for meta-pkg management to System Manager, only displays for now, still
needs functionality for add / removal



Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp	2010-10-09 06:18:20 UTC (rev 7757)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp	2010-10-09 06:37:46 UTC (rev 7758)
@@ -63,6 +63,9 @@
 
     initSystemUpdates();
 
+    // Display the meta-pkgs
+    populateMetaPkgs();
+
 }
 
 
@@ -683,3 +686,102 @@
 {
    tabWidget->setCurrentIndex(tab);
 }
+
+
+// Display found meta-pkg data
+void PBSystemTab::populateMetaPkgs()
+{
+  metaPkgList = getPackageData();
+
+  // First look for "parent" apps
+  for (int z=0; z < metaPkgList.count(); ++z)
+    if ( metaPkgList.at(z).at(3).isEmpty() ) {
+
+	// Skip the "base-system" package, since we are installing it anyway
+	if (metaPkgList.at(z).at(0) == "base-system" )
+		continue;
+
+	QTreeWidgetItem *deskItem = new QTreeWidgetItem(treeMetaPkgs, \
+							 QStringList() << metaPkgList.at(z).at(0) );
+	deskItem->setIcon(0, QIcon(metaPkgList.at(z).at(2)));
+	deskItem->setToolTip(0, metaPkgList.at(z).at(1));
+	deskItem->setCheckState(0, Qt::Unchecked);
+
+	if ( metaPkgList.at(z).at(0) == "kde4" )
+		deskItem->setCheckState(0, Qt::Checked);
+    }
+
+  // First look for "parent" apps
+  for (int z=0; z < metaPkgList.count(); ++z)
+    if ( ! metaPkgList.at(z).at(3).isEmpty() ) {
+	QTreeWidgetItem *deskItem = new QTreeWidgetItem(QStringList() << metaPkgList.at(z).at(0) );
+	deskItem->setIcon(0, QIcon(metaPkgList.at(z).at(2)));
+	deskItem->setToolTip(0, metaPkgList.at(z).at(1));
+
+	if ( metaPkgList.at(z).at(3) == "kde4" )
+		deskItem->setCheckState(0, Qt::Checked);
+	else
+		deskItem->setCheckState(0, Qt::Unchecked);
+
+	// Now locate the parent app
+        QTreeWidgetItemIterator it(treeMetaPkgs);
+        while (*it) {
+         if ((*it)->text(0) == metaPkgList.at(z).at(3)) {
+             (*it)->addChild(deskItem);
+	     break;
+	 }
+         ++it;
+        }
+    }
+
+    //connect(treeMetaPkgs, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotDeskPkgsChanged(QTreeWidgetItem *, int)));
+
+}
+
+// Function which checks for our GUI package schema data
+QList<QStringList> PBSystemTab::getPackageData()
+{
+  QList<QStringList> metaPkgs;
+  QString tmp, mName, mDesc, mIcon, mParent, mDesktop;
+  QStringList package;
+
+  QProcess pcmp;
+  qDebug() << "Searching for meta-pkgs...";
+  pcmp.start(QString("pc-metapkgmanager"), QStringList() << "list");
+  if (pcmp.waitForFinished()) {
+    while (pcmp.canReadLine()) {
+        tmp = pcmp.readLine().simplified();
+	if ( tmp.indexOf("Meta Package: ") == 0) {
+		mName = tmp.replace("Meta Package: ", "");
+		continue;
+	}
+	if ( tmp.indexOf("Description: ") == 0) {
+		mDesc = tmp.replace("Description: ", "");
+		continue;
+	}
+	if ( tmp.indexOf("Icon: ") == 0) {
+		mIcon = tmp.replace("Icon: ", "");
+		continue;
+	}
+	if ( tmp.indexOf("Parent: ") == 0) {
+		mParent = tmp.replace("Parent: ", "");
+		continue;
+	}
+	if ( tmp.indexOf("Desktop: ") == 0) {
+		mDesktop = tmp.replace("Desktop: ", "");
+		continue;
+	}
+	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;
+		package << mName << mDesc << mIcon << mParent << mDesktop;
+		metaPkgs.append(package);
+		mName=""; mDesc=""; mIcon=""; mParent=""; mDesktop="";
+	}
+    }
+  }
+
+  return metaPkgs;
+}
+

Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h	2010-10-09 06:18:20 UTC (rev 7757)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h	2010-10-09 06:37:46 UTC (rev 7758)
@@ -137,6 +137,11 @@
     void initSystemUpdates();
     void loadPatchData(QString patchFile, int patchNum);
 
+    // Meta pkg stuff
+    void populateMetaPkgs();
+    QList<QStringList> getPackageData();
+    QList<QStringList> metaPkgList;
+
     updaterStatus *UpdaterStatusDialog;
     
     QMenu *popup;

Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui	2010-10-09 06:18:20 UTC (rev 7757)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui	2010-10-09 06:37:46 UTC (rev 7758)
@@ -717,6 +717,27 @@
       <attribute name="title">
        <string>System Packages</string>
       </attribute>
+      <layout class="QGridLayout" name="gridLayout_11">
+       <item row="0" column="0">
+        <widget class="QTreeWidget" name="treeMetaPkgs">
+         <column>
+          <property name="text">
+           <string>Available Meta Packages</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_2">
+         <property name="text">
+          <string>Above you may select the base meta packages you wish to have installed on this system. Adding new packages will require your original installation medium, or a properly configured mirror server.</string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
      </widget>
      <widget class="QWidget" name="TabPage">
       <attribute name="title">



More information about the Commits mailing list