[PC-BSD Commits] r15838 - pcbsd-projects/EasyPBI

svn at pcbsd.org svn at pcbsd.org
Mon Mar 19 09:53:52 PDT 2012


Author: kenmoore
Date: 2012-03-19 16:53:52 +0000 (Mon, 19 Mar 2012)
New Revision: 15838

Modified:
   pcbsd-projects/EasyPBI/mainwindow.cpp
Log:
Fix a couple display bugs with the external-links and desktop/menu editors in EasyPBI



Modified: pcbsd-projects/EasyPBI/mainwindow.cpp
===================================================================
--- pcbsd-projects/EasyPBI/mainwindow.cpp	2012-03-19 16:01:22 UTC (rev 15837)
+++ pcbsd-projects/EasyPBI/mainwindow.cpp	2012-03-19 16:53:52 UTC (rev 15838)
@@ -247,19 +247,14 @@
         QStringList binaries, linkOpts;
         ModBuild::makeExternalLinks(newModulePath,binaries,linkOpts); //should work since pbi.conf was created successfully
         //Add desktop/menu entries 
-        if(ui->gui_app->isChecked() && Get_Main_Exe_Smart(pbi_data)){
-          QString mainexe = ModBuild::getFilenameFromPath(pbi_data->main_exe);
-          ModBuild::makeMenuEntry( newModulePath, mainexe, ModBuild::readValue("PBI_PROGNAME"),ModBuild::readValue("PBI_PROGICON"), ui->port_category->text() );
-          ModBuild::makeDesktopEntry( newModulePath, mainexe, ModBuild::readValue("PBI_PROGNAME"),ModBuild::readValue("PBI_PROGICON") );
-
-          Get_More_Exe(pbi_data);
-          current_exe = pbi_data->more_exe;
-          while(current_exe){
-            QString binary = current_exe->path;
-            QString name = ModBuild::readValue("PBI_PROGNAME")+ModBuild::getFilenameFromPath(binary);
-            ModBuild::makeMenuEntry( newModulePath, binary, name, ModBuild::readValue("PBI_PROGICON"), ui->port_category->text() );
-            ModBuild::makeDesktopEntry( newModulePath, binary, name, ModBuild::readValue("PBI_PROGICON") );
-            current_exe = (BIN_FILE *) current_exe->next;
+        QStringList  binList = getPortBinaries(ui->port_selected->text());
+        if(ui->gui_app->isChecked() && !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") );
           }
         }
         success = TRUE;
@@ -824,7 +819,8 @@
     Get_More_Exe(new_pbi_data);
     current_exe = new_pbi_data->more_exe;
     while(current_exe){
-      bins << current_exe->path;
+      QString newEXE = "bin/"+QString(current_exe->path);
+      if(!bins.contains(newEXE)){ bins << newEXE; }
       current_exe = (BIN_FILE *) current_exe->next;
     }
   }
@@ -837,7 +833,7 @@
   updateEntryLists();
   //Update the detected binaries
   ui->listEntryPortBins->clear();
-  ui->listEntryPortBins->addItem(tr("Set Manually:"));
+  ui->listEntryPortBins->addItem(tr("Custom Binary"));
   ui->listEntryPortBins->setCurrentIndex(0);
   QStringList bins = getPortBinaries(ModBuild::readValue("PBI_MAKEPORT"));
   for(int i=0; i<bins.length(); i++){
@@ -984,7 +980,7 @@
   refreshCurrentLinks();
   //Get the binaries available and populate list
   ui->listLinkBins->clear();
-  ui->listLinkBins->addItem(tr("Set Manually:"));
+  ui->listLinkBins->addItem(tr("Custom Binary"));
   ui->listLinkBins->setCurrentIndex(0);
   QStringList bins = getPortBinaries(ModBuild::readValue("PBI_MAKEPORT"));
   for(int i=0; i<bins.length(); i++){
@@ -1011,8 +1007,10 @@
   ui->listCurrentLinks->clear();
   //Make sure each line is displayed in the format [(bin) : (types)]
   for(int i=0; i<bins.length(); i++){
-    QString entry = bins[i] + "  :  " + types[i];
-    ui->listCurrentLinks->addItem(entry);
+    if(!bins[i].isEmpty() && !types[i].isEmpty()){
+      QString entry = bins[i] + "  :  " + types[i];
+      ui->listCurrentLinks->addItem(entry);
+    }
   }
 
 }
@@ -1067,11 +1065,19 @@
     QMessageBox::warning(this,tr("Duplicate Link Type"),tr("This link type has already been added. Please select a different one."));
     return;
   }
-  //add it to the line
-  QString newTypes;
-  if(currentTypes.isEmpty()){ newTypes = type; }
-  else{ newTypes = currentTypes+","+type; }
-  ui->lineLinkType->setText(newTypes);
+  //Change/Add the type to the current list
+  if(currentTypes.split(",").contains("keep") && type=="replace"){
+    currentTypes.replace("keep",type);
+  }else if(currentTypes.split(",").contains("replace") && type=="keep"){
+    currentTypes.replace("replace",type);
+  }else{
+    //add it to the end
+    if(currentTypes.isEmpty()){ currentTypes = type; }
+    else{ currentTypes.append(","+type); }
+
+  }
+  //Display the types (with changes)
+  ui->lineLinkType->setText(currentTypes);
 }
 
 void MainWindow::on_pushRemoveLink_clicked(){



More information about the Commits mailing list