Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 29, 2013
@kmoore134 kmoore134 Change how we do download parsing to use shell built-ins,
fixes an issue running aria2c in a chroot environment where "ps" may not be available
6f2048f
@kmoore134 kmoore134 Add maintainer / weburl to fields we pull out of repo db a43929d
@kmoore134 kmoore134 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
287e037
Showing with 239 additions and 41 deletions.
  1. +83 −4 src-qt4/pc-pkgmanager/mainWin.cpp
  2. +3 −0 src-qt4/pc-pkgmanager/mainWin.h
  3. +147 −32 src-qt4/pc-pkgmanager/mainWin.ui
  4. +6 −5 src-sh/libsh/functions.sh
View
87 src-qt4/pc-pkgmanager/mainWin.cpp
@@ -441,6 +441,7 @@ Code for package stuff
void mainWin::initMetaWidget()
{
qDebug() << "Starting metaWidget...";
+ groupInfo->setVisible(false);
// Running in basic mode
if ( stackedPkgView->currentIndex() == 0 )
@@ -460,8 +461,10 @@ void mainWin::populateNGPkgs()
tmpPkgList.clear();
new QTreeWidgetItem(treeNGPkgs, QStringList() << tr("Loading... Please wait...") );
- if ( ! pkgList.isEmpty() )
+ if ( ! pkgList.isEmpty() ) {
disconnect(treeNGPkgs, SIGNAL(itemChanged(QTreeWidgetItem *, int)), 0, 0);
+ disconnect(treeNGPkgs, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), 0, 0);
+ }
pkgList.clear();
selPkgList.clear();
@@ -472,9 +475,9 @@ void mainWin::populateNGPkgs()
connect( getNGProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotGetNGInstalledPkgs()) );
getNGProc->setProcessChannelMode(QProcess::MergedChannels);
if ( wDir.isEmpty() )
- getNGProc->start(QString("pkg"), QStringList() << "rquery" << "-a" << "%o:::%n-%v:::%c:::%sh");
+ getNGProc->start(QString("pkg"), QStringList() << "rquery" << "-a" << "%o:::%n-%v:::%c:::%sh:::%m:::%w");
else
- getNGProc->start(QString("chroot"), QStringList() << wDir << "pkg" << "rquery" << "-a" << "%o:::%n-%v:::%c:::%sh");
+ getNGProc->start(QString("chroot"), QStringList() << wDir << "pkg" << "rquery" << "-a" << "%o:::%n-%v:::%c:::%sh:::%m:::%w");
}
@@ -542,6 +545,80 @@ void mainWin::slotFinishLoadingNGPkgs()
pushPkgApply->setEnabled(false);
connect(treeNGPkgs, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotEnableApply()));
+ connect(treeNGPkgs, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(slotNGItemChanged()));
+}
+
+void mainWin::slotNGItemChanged()
+{
+ if ( ! treeNGPkgs->currentItem() ) {
+ groupInfo->setVisible(false);
+ return;
+ }
+ QString desc, size, maint, weburl;
+
+ QTreeWidgetItem *cItem = treeNGPkgs->currentItem();
+ QString pName = cItem->text(0).section("(", 1, 1).section(")", 0, 0);
+ if ( pName.isEmpty() ) {
+ groupInfo->setVisible(false);
+ return;
+ }
+ qDebug() << "Checking: " + pName;
+
+ QRegExp rx("*:::" + pName + ":::*");
+ rx.setPatternSyntax(QRegExp::Wildcard);
+ int pAt = tmpPkgList.indexOf(rx);
+ if (pAt == -1 ) {
+ qDebug() << "Unable to find package: " + pName;
+ groupInfo->setVisible(false);
+ return;
+ }
+
+ desc = tmpPkgList.at(pAt).section(":::", 2,2);
+ size = tmpPkgList.at(pAt).section(":::", 3,3);
+ maint = tmpPkgList.at(pAt).section(":::", 4,4);
+ weburl = tmpPkgList.at(pAt).section(":::", 5,5);
+ labelPkgNameVer->setText(pName);
+ labelSize->setText(size);
+ labelWeb->setText(weburl);
+ textDesc->setText(desc);
+ textOptions->clear();
+
+ QCoreApplication::processEvents();
+
+ // Display the depends
+ QString depTxt;
+ QRegExp rxd( pName + ":::*");
+ rxd.setPatternSyntax(QRegExp::Wildcard);
+ QStringList aDeps = pkgDepList.filter(rxd);
+ for ( int r=0; r < aDeps.size(); ++r) {
+ QString dName = aDeps.at(r).section(":::", 1, 1);
+ // Is this package installed?
+ if ( pkgList.indexOf(dName) != -1 )
+ depTxt+= dName + " (Installed)\n";
+ else
+ depTxt+= dName + "\n";
+ }
+
+ textDeps->setText(depTxt);
+
+ groupInfo->setVisible(true);
+
+ getNGInfo = new QProcess();
+ qDebug() << "Getting Info for " + pName;
+ connect( getNGInfo, SIGNAL(readyReadStandardOutput()), this, SLOT(slotNGReadInfo()) );
+ getNGInfo->setProcessChannelMode(QProcess::MergedChannels);
+ if ( wDir.isEmpty() )
+ getNGInfo->start(QString("pkg"), QStringList() << "rquery" << "%Ok=%Ov" << pName );
+ else
+ getNGInfo->start(QString("chroot"), QStringList() << wDir << "pkg" << "rquery" << "%Ok=%Ov" << pName);
+}
+
+void mainWin::slotNGReadInfo()
+{
+ while (getNGInfo->canReadLine())
+ textOptions->append(getNGInfo->readLine().simplified() );
+
+ textOptions->moveCursor(QTextCursor::Start);
}
void mainWin::slotEnableApply()
@@ -551,7 +628,7 @@ void mainWin::slotEnableApply()
void mainWin::addNGItems()
{
- QString curCat, cat, name, pkgname, desc, size;
+ QString curCat, cat, name, pkgname, desc, size, maint, weburl;
// We like to add alphabetically
tmpPkgList.sort();
@@ -566,6 +643,8 @@ void mainWin::addNGItems()
pkgname = tmpPkgList.at(i).section(":::", 1,1);
desc = tmpPkgList.at(i).section(":::", 2,2);
size = tmpPkgList.at(i).section(":::", 3,3);
+ maint = tmpPkgList.at(i).section(":::", 4,4);
+ weburl = tmpPkgList.at(i).section(":::", 5,5);
// Check if we need to add a top-level category
if ( cat != curCat )
View
3 src-qt4/pc-pkgmanager/mainWin.h
@@ -68,6 +68,8 @@ private slots:
void slotGetNGInstalledPkgs();
void slotEnableApply();
void slotStartNGChanges();
+ void slotNGItemChanged();
+ void slotNGReadInfo();
private:
// Generic pkg process handlers
@@ -131,6 +133,7 @@ private slots:
QStringList pkgRemoveList;
QStringList pkgAddList;
QProcess *getNGProc;
+ QProcess *getNGInfo;
dialogConfirm *askUserConfirm;
View
179 src-qt4/pc-pkgmanager/mainWin.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>757</width>
- <height>502</height>
+ <width>802</width>
+ <height>586</height>
</rect>
</property>
<property name="windowTitle">
@@ -37,41 +37,14 @@
<property name="title">
<string>System Packages</string>
</property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="1" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="spacer2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>223</width>
- <height>21</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="pushPkgApply">
- <property name="text">
- <string>&amp;Apply</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
+ <layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QStackedWidget" name="stackedPkgView">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageBasic">
- <layout class="QGridLayout" name="gridLayout_6">
+ <layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<widget class="QTreeWidget" name="treeMetaPkgs">
<attribute name="headerVisible">
@@ -90,15 +63,157 @@
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QTreeWidget" name="treeNGPkgs">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="groupInfo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Package Information</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_6">
+ <item row="0" column="1" rowspan="3">
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tabDesc">
+ <attribute name="title">
+ <string>Description</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QTextBrowser" name="textDesc"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tabOpts">
+ <attribute name="title">
+ <string>Options</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_12">
+ <item row="0" column="0">
+ <widget class="QTextBrowser" name="textOptions"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Dependances</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_13">
+ <item row="0" column="0">
+ <widget class="QTextBrowser" name="textDeps"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelPkgNameVer">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>My Package 1.0</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelSize">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>10 MB</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>118</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QLabel" name="labelWeb">
+ <property name="text">
+ <string>http://www.pcbsd.org</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="spacer2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>223</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushPkgApply">
+ <property name="text">
+ <string>&amp;Apply</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>
@@ -290,7 +405,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
- <width>757</width>
+ <width>802</width>
<height>22</height>
</rect>
</property>
View
11 src-sh/libsh/functions.sh
@@ -193,7 +193,7 @@ get_file_from_mirrors()
if [ -z "$_fSize" ] ; then _fSize=0; fi
( aria2c -o ${aFile} -d ${aDir} -k 5M ${aStat} --check-certificate=false --file-allocation=none ${mirrorList} >/dev/null 2>/dev/null ; echo "$?" > ${_eFile} ) &
- FETCH_PID=`ps -auwwwx | grep -v grep | grep "aria2c -o ${aFile}" | awk '{print $2}'`
+ FETCH_PID=$!
while :
do
if [ -e "${_lf}" ] ; then
@@ -206,10 +206,11 @@ get_file_from_mirrors()
fi
# Make sure download isn't finished
- ps -p $FETCH_PID >/dev/null 2>/dev/null
- if [ "$?" != "0" ] ; then break ; fi
- sleep 2
- _time=`expr $_time + 2`
+ jobs -l >/tmp/.jobProcess.$$
+ cat /tmp/.jobProcess.$$ | awk '{print $3}' | grep -q ${FETCH_PID}
+ if [ "$?" != "0" ] ; then rm /tmp/.jobProcess.$$ ; break ; fi
+ sleep 1
+ _time=`expr $_time + 1`
done
_err="`cat ${_eFile}`"

No commit comments for this range

Something went wrong with that request. Please try again.