[PC-BSD Commits] r15971 - pcbsd/current/src-qt4/libpcbsd

svn at pcbsd.org svn at pcbsd.org
Thu Mar 22 23:04:42 PDT 2012


Author: kris
Date: 2012-03-23 06:04:42 +0000 (Fri, 23 Mar 2012)
New Revision: 15971

Modified:
   pcbsd/current/src-qt4/libpcbsd/metaWidget.cpp
   pcbsd/current/src-qt4/libpcbsd/pcbsd-utils.h
Log:

Add stop() function to metaWidget, if we want to stop it processing and
move onto something else



Modified: pcbsd/current/src-qt4/libpcbsd/metaWidget.cpp
===================================================================
--- pcbsd/current/src-qt4/libpcbsd/metaWidget.cpp	2012-03-23 00:29:57 UTC (rev 15970)
+++ pcbsd/current/src-qt4/libpcbsd/metaWidget.cpp	2012-03-23 06:04:42 UTC (rev 15971)
@@ -24,6 +24,7 @@
 ///////////////////////////////////////////////////////////////////////////
 void metaWidget::init(QString chroot)
 {
+  stopped = false;
   qDebug() << "Starting metaWidget...";
   treeMetaPkgs = new QTreeWidget();
   if ( chroot.isEmpty() ) {
@@ -175,6 +176,10 @@
   {
 	QApplication::processEvents();
 
+        // If we've requested to stop this widget, we can safely quit here
+        if ( stopped )
+	  return;
+
         tmp = tmpMetaPkgList.at(i);
 
 	if ( tmp.indexOf("Meta Package: ") == 0) {
@@ -693,3 +698,13 @@
         return line.simplified();
 }
 
+
+void metaWidget::stop()
+{
+   if ( getMetaProc->state() != QProcess::NotRunning ) {
+      getMetaProc->kill();
+      getMetaProc->waitForFinished(2000);
+   }
+   stopped=true;
+   setHidden(true);
+}

Modified: pcbsd/current/src-qt4/libpcbsd/pcbsd-utils.h
===================================================================
--- pcbsd/current/src-qt4/libpcbsd/pcbsd-utils.h	2012-03-23 00:29:57 UTC (rev 15970)
+++ pcbsd/current/src-qt4/libpcbsd/pcbsd-utils.h	2012-03-23 06:04:42 UTC (rev 15971)
@@ -116,6 +116,7 @@
         }
 
      void init(QString chroot);
+     void stop();
 
 public slots:
 
@@ -151,6 +152,7 @@
    QString Arch;
    QString chrootArg1;
    QString chrootArg2;
+   bool stopped;
 
    QMenu *popup;
    metaProgressDialog *metaProgressDel;



More information about the Commits mailing list