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

svn at pcbsd.org svn at pcbsd.org
Mon Jun 4 07:55:43 PDT 2012


Author: kenmoore
Date: 2012-06-04 14:55:42 +0000 (Mon, 04 Jun 2012)
New Revision: 17190

Modified:
   pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
   pcbsd/current/src-qt4/EasyPBI/mainwindow.ui
   pcbsd/current/src-qt4/EasyPBI/modBuild.cpp
Log:
Simplify menu item selection in EasyPBI a bit and add external-links auta addition of detected binaries if not a GUI app



Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp	2012-06-04 14:42:21 UTC (rev 17189)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp	2012-06-04 14:55:42 UTC (rev 17190)
@@ -1,13 +1,8 @@
-//#include <sys/stat.h>
-//#include <sys/types.h>
-//#include <dirent.h>
 #include "mainwindow.h"
 #include "ui_mainwindow.h"
 #include "modBuild.h"
 #include <QDebug>
 
-//PBI_Struct *pbi_data = NULL;
-
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::MainWindow)
@@ -205,18 +200,28 @@
       if( ModBuild::writePBIconf(newModulePath) ){
         ModBuild::addResource(newModulePath,ModBuild::readValue("PBI_PROGICON"));
         QStringList binaries, linkOpts;
-        ModBuild::makeExternalLinks(newModulePath,binaries,linkOpts); //should work since pbi.conf was created successfully
-        //Add desktop/menu entries 
+        //Add desktop/menu entries or external-links as necessary
         QStringList  binList = getPortBinaries(ui->port_selected->text());
-        if(ui->gui_app->isChecked() && !binList.isEmpty() ){
+        if(!binList.isEmpty() ){
           for(int i=0; i<binList.length(); i++){
-            QString name;
-            if(i==0){ name = ModBuild::readValue("PBI_PROGNAME"); }
-            else{ name = ModBuild::readValue("PBI_PROGNAME")+"-"+ModBuild::getFilenameFromPath(binList[i]); }
-            ModBuild::makeMenuEntry( newModulePath, binList[i], name, ModBuild::readValue("PBI_PROGICON"), ui->port_category->text() );
-            ModBuild::makeDesktopEntry( newModulePath, binList[i], name, ModBuild::readValue("PBI_PROGICON") );
+            if(ui->gui_app->isChecked()){
+              qDebug() << " - Creating desktop/menu entry for binary:" << binList[i];
+              //Make desktop & menu entry for this binary
+              QString name;
+              if(i==0){ name = ModBuild::readValue("PBI_PROGNAME"); }
+              else{ name = ModBuild::readValue("PBI_PROGNAME")+"-"+ModBuild::getFilenameFromPath(binList[i]); }
+              ModBuild::makeMenuEntry( newModulePath, binList[i], name, ModBuild::readValue("PBI_PROGICON"), ui->port_category->text() );
+              ModBuild::makeDesktopEntry( newModulePath, binList[i], name, ModBuild::readValue("PBI_PROGICON") );
+            }else{
+              qDebug() << " - Adding binary to external-links:" << binList[i];
+              //Add binary to external-links
+              binaries << binList[i];
+              linkOpts << "binary,nocrash";
+            }
           }
         }
+        //Create External-links file
+        ModBuild::makeExternalLinks(newModulePath,binaries,linkOpts);
         success = TRUE;
         // create tarball of module
         //ModBuild::compressModule(newModulePath);
@@ -818,6 +823,10 @@
       QListWidgetItem *item = new QListWidgetItem( QIcon(icon),fileList[i].fileName() );
       ui->listMenuEntries->addItem(item);
   }
+  //Have the first item auto-selected if there are items
+  if(ui->listDesktopEntries->count() >0){ ui->listDesktopEntries->setCurrentRow(0); }
+  if(ui->listMenuEntries->count() >0){ ui->listMenuEntries->setCurrentRow(0); }
+
 }
 
 void MainWindow::on_listEntryPortBins_currentIndexChanged(int index){
@@ -957,6 +966,8 @@
       ui->listCurrentLinks->addItem(entry);
     }
   }
+  //Auto-select the first item (if any)
+  if(ui->listCurrentLinks->count() > 0){ ui->listCurrentLinks->setCurrentRow(0);}
 
 }
 

Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.ui
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.ui	2012-06-04 14:42:21 UTC (rev 17189)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.ui	2012-06-04 14:55:42 UTC (rev 17190)
@@ -28,7 +28,7 @@
        <enum>QTabWidget::Rounded</enum>
       </property>
       <property name="currentIndex">
-       <number>2</number>
+       <number>0</number>
       </property>
       <widget class="QWidget" name="tabModules">
        <attribute name="icon">
@@ -114,16 +114,6 @@
             </property>
            </widget>
           </item>
-          <item row="9" column="3">
-           <widget class="QCheckBox" name="gui_app">
-            <property name="text">
-             <string>GUI App</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
           <item row="1" column="0">
            <widget class="QLabel" name="label_6">
             <property name="text">
@@ -179,6 +169,19 @@
             </property>
            </widget>
           </item>
+          <item row="9" column="2">
+           <widget class="QCheckBox" name="gui_app">
+            <property name="toolTip">
+             <string>Automatically create desktop/menu entries for all detected binaries</string>
+            </property>
+            <property name="text">
+             <string>Create Desktop/Menu Entries</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
          </layout>
         </item>
         <item>

Modified: pcbsd/current/src-qt4/EasyPBI/modBuild.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/modBuild.cpp	2012-06-04 14:42:21 UTC (rev 17189)
+++ pcbsd/current/src-qt4/EasyPBI/modBuild.cpp	2012-06-04 14:55:42 UTC (rev 17190)
@@ -727,7 +727,7 @@
 	    if(tmpL[i].contains("$")){ variableBinFound=TRUE; }
 	  }  
 	}
-      }else if( line.startsWith(".if defined(") || line.startsWith(".if !defined(") ){
+      }else if( line.startsWith(".if defined(") ){
         //Get the variable used (we need WITH_* or WITHOUT_*)
         QString var = line.section("(",1,1).section(")",0,0).simplified();
 	//qDebug() << line << var << var.section("_",1,1);



More information about the Commits mailing list