[PC-BSD Commits] r16584 - pcbsd/current/src-qt4/EasyPBI

svn at pcbsd.org svn at pcbsd.org
Fri Apr 27 06:44:37 PDT 2012


Author: kenmoore
Date: 2012-04-27 13:44:37 +0000 (Fri, 27 Apr 2012)
New Revision: 16584

Modified:
   pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
   pcbsd/current/src-qt4/EasyPBI/mainwindow.h
   pcbsd/current/src-qt4/EasyPBI/mainwindow.ui
   pcbsd/current/src-qt4/EasyPBI/modBuild.cpp
Log:
Add the GUI ability for the user to add detected make options for a PBI



Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp	2012-04-26 10:42:37 UTC (rev 16583)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp	2012-04-27 13:44:37 UTC (rev 16584)
@@ -606,6 +606,11 @@
   ui->listMkPortAfter->clear();
   ui->listMkPortAfter->addItems(mkportafter);
   ui->newMkOpts->setText(ModBuild::readValue("PBI_MAKEOPTS"));
+  ui->listMkOpts->clear();
+  QStringList mkOpts = ModBuild::getPortInfo(PORTS_DIR+"/"+ModBuild::readValue("PBI_MAKEPORT"), "options");
+  for(int i=0; i<mkOpts.length(); i++){
+    ui->listMkOpts->addItem(mkOpts[i]+"=true");
+  }
   if(ModBuild::readValue("PBI_REQUIRESROOT")=="NO"){ui->checkRequiresRoot->setChecked(FALSE); }
   else{ui->checkRequiresRoot->setChecked(TRUE); }
 }
@@ -686,6 +691,16 @@
   ui->listMkPortAfter->removeItem(ui->listMkPortAfter->currentIndex());
 }
 
+void MainWindow::on_pushAddMkOpt_clicked(){
+  QString newOpt = ui->listMkOpts->currentText();
+  if(newOpt.isEmpty()){ return; } //nothing selected
+  QStringList currOpts = ui->newMkOpts->text().split(" ");
+  if(currOpts.contains(newOpt)){ return; } //do nothing if that option is already enabled
+  //Add the new option to the list
+  currOpts << newOpt;
+  ui->newMkOpts->setText(currOpts.join(" "));
+}
+
 void MainWindow::editRefreshResources(){
   //Clear the GUI
   ui->listCurrentResources->clear();

Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.h
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.h	2012-04-26 10:42:37 UTC (rev 16583)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.h	2012-04-27 13:44:37 UTC (rev 16584)
@@ -69,6 +69,7 @@
     void on_pushRemovePortBefore_clicked();
     void on_pushAddPortAfter_clicked();
     void on_pushRemovePortAfter_clicked();
+    void on_pushAddMkOpt_clicked();
     void on_tabWidget_currentChanged(int);
     void on_tabModuleEditor_currentChanged(int);
     void editRefreshResources();

Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.ui
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.ui	2012-04-26 10:42:37 UTC (rev 16583)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.ui	2012-04-27 13:44:37 UTC (rev 16584)
@@ -785,11 +785,11 @@
                </sizepolicy>
               </property>
               <property name="toolTip">
-               <string>Special configuration options for the main program or any additional ports (Example: WITH_GUI=true)</string>
+               <string>Space-seperated configuration options for the main program or any additional ports (Example: WITH_GUI=true)</string>
               </property>
              </widget>
             </item>
-            <item row="10" column="2">
+            <item row="11" column="2">
              <widget class="QCheckBox" name="checkRequiresRoot">
               <property name="toolTip">
                <string>Set the program to require root permissions for installation</string>
@@ -806,7 +806,7 @@
               </property>
              </widget>
             </item>
-            <item row="13" column="2">
+            <item row="14" column="2">
              <spacer name="verticalSpacer_2">
               <property name="orientation">
                <enum>Qt::Vertical</enum>
@@ -819,7 +819,7 @@
               </property>
              </spacer>
             </item>
-            <item row="11" column="0" colspan="3">
+            <item row="12" column="0" colspan="3">
              <widget class="Line" name="line_5">
               <property name="orientation">
                <enum>Qt::Horizontal</enum>
@@ -922,7 +922,7 @@
               </item>
              </layout>
             </item>
-            <item row="12" column="2">
+            <item row="13" column="2">
              <layout class="QHBoxLayout" name="horizontalLayout_12">
               <item>
                <spacer name="horizontalSpacer_2">
@@ -967,6 +967,31 @@
               </item>
              </layout>
             </item>
+            <item row="10" column="2">
+             <layout class="QHBoxLayout" name="horizontalLayout_15">
+              <item>
+               <widget class="QComboBox" name="listMkOpts">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushAddMkOpt">
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="icon">
+                 <iconset resource="EasyPBI.qrc">
+                  <normaloff>:/png/icons/arrow-up.png</normaloff>:/png/icons/arrow-up.png</iconset>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
            </layout>
           </widget>
           <widget class="QWidget" name="tab_2">
@@ -1555,7 +1580,7 @@
      <x>0</x>
      <y>0</y>
      <width>568</width>
-     <height>21</height>
+     <height>20</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">

Modified: pcbsd/current/src-qt4/EasyPBI/modBuild.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/modBuild.cpp	2012-04-26 10:42:37 UTC (rev 16583)
+++ pcbsd/current/src-qt4/EasyPBI/modBuild.cpp	2012-04-27 13:44:37 UTC (rev 16584)
@@ -675,7 +675,7 @@
   //Remove extra "/" at end of the dir path if needed
   if(portDir.endsWith("/")){portDir.chop(1);}
   //Check if it is a valid port directory
-  if( !QFile::exists(portDir+"/Makefile") || !QFile::exists(portDir+"/distinfo") ){
+  if( !QFile::exists(portDir+"/Makefile") || (!QFile::exists(portDir+"/distinfo") && !QFile::exists(portDir+"/pkg-descr")) ){
     qDebug() << "Invalid Port Directory";
     return FALSE;
   }
@@ -752,7 +752,10 @@
         if( line.startsWith("WWW:") ){
           portStruct[2] = line.section(" ",1,1,QString::SectionSkipEmpty);
 	  qDebug() << " - Found website:" << portStruct[2];
-        }
+        }else if(line.startsWith("Author:") ){
+	  portStruct[1] = line.section(" ",1,4,QString::SectionSkipEmpty);
+	  qDebug() << " - Found author:" << portStruct[1];
+	}
       }
       desfile.close();
     }



More information about the Commits mailing list