[PC-BSD Commits] r20093 - users/ken/EasyPBI2

svn at pcbsd.org svn at pcbsd.org
Wed Oct 31 07:51:19 PDT 2012


Author: kenmoore
Date: 2012-10-31 14:51:19 +0000 (Wed, 31 Oct 2012)
New Revision: 20093

Modified:
   users/ken/EasyPBI2/mainGUI.cpp
   users/ken/EasyPBI2/mainGUI.ui
   users/ken/EasyPBI2/modBuild.cpp
   users/ken/EasyPBI2/modBuild.h
Log:
Fix some bugs in EasyPBI2 with the pbi.conf editor, adn setup the recommended menu category



Modified: users/ken/EasyPBI2/mainGUI.cpp
===================================================================
--- users/ken/EasyPBI2/mainGUI.cpp	2012-10-31 09:18:20 UTC (rev 20092)
+++ users/ken/EasyPBI2/mainGUI.cpp	2012-10-31 14:51:19 UTC (rev 20093)
@@ -18,12 +18,6 @@
 	//Setup the Menu items
 	ui->actionExit->setIcon(Backend::icon(""));
 	//Setup the pushbutton menu lists
-	QStringList cats;
-	cats <<"AudioVideo"<<"Development"<<"Education"<<"Game"<<"Graphics"<<"Network"<<"Office"<<"Settings"<<"System";
-	for(int i=0; i<cats.length(); i++){
-	  menu_validMenuCats.addAction(cats[i]);
-	  menu_validMenuCatsNew.addAction(cats[i]);
-	}
 	menu_elOpts.addAction("binary");
 	menu_elOpts.addAction("linux");
 	menu_elOpts.addAction("keep");
@@ -277,9 +271,11 @@
       ui->list_progicon->addItem(currentModule->readValue("progicon"));
     }
     menu_addOpt.clear();
-    QStringList opts = currentModule->readValue("portoptions").split(" ");
-    for(int i=0; i<opts.length(); i++){
-      menu_addOpt.addAction(opts[i]);
+    QStringList opts = currentModule->readValue("portoptions").split(" ",QString::SkipEmptyParts);
+    if(!opts.isEmpty()){
+      for(int i=0; i<opts.length(); i++){
+        menu_addOpt.addAction(opts[i]);
+      }
     }
   }
   // -----RESOURCES--------
@@ -518,7 +514,9 @@
     if(ui->check_requiresroot->isChecked()){ currentModule->writeValue("requiresroot", "true"); }
     else{ currentModule->writeValue("requiresroot","false"); }
     //Module-dependant settings
+    bool newport = FALSE;
     if( radio_module_port->isChecked() ){ //FreeBSD port module
+	if(currentModule->readValue("makeport") != ui->line_makeport->text()){ newport=TRUE; }
 	currentModule->writeValue("makeport",ui->line_makeport->text());
 	currentModule->writeValue("makeoptions",ui->edit_makeopts->toPlainText());
 	QString tmp;
@@ -542,6 +540,10 @@
     //Display a warning that the file could not be saved
     qDebug() << "Error: pbi.conf could not be written:" << currentModule->path()+"/pbi.conf";
     QMessageBox::warning(this,tr("EasyPBI Error"), tr("The PBI configuration file could not be saved. Please check your file permissions before trying again."));
+  }else if(newport){
+    //Refresh the port information if the main port changed
+    currentModule->readPortInformation(PORTS_DIR+"/"+ui->line_makeport->text());
+    refreshGUI("pbiconf");
   }
 }
 /*------------------------------------------------
@@ -748,7 +750,19 @@
       menu_mimenew.addAction(mimetypes[i]);
     }
   }
-    
+  //Menu categories
+  QString recMenu = currentModule->readValue("portmenucategory");
+  QStringList cats = currentModule->validMenuCategories;
+  menu_validMenuCats.clear(); menu_validMenuCatsNew.clear();
+  for(int i=0; i<cats.length(); i++){
+    if(recMenu==cats[i]){ //Add an icon showing the recommended menu category
+      menu_validMenuCats.addAction(Backend::icon("start"),cats[i]);
+      menu_validMenuCatsNew.addAction(Backend::icon("start"),cats[i]);	
+    }else{
+      menu_validMenuCats.addAction(cats[i]);
+      menu_validMenuCatsNew.addAction(cats[i]);
+    }
+  }
   //Now update read the currently selected file
   slotXdgFileChanged();
 }

Modified: users/ken/EasyPBI2/mainGUI.ui
===================================================================
(Binary files differ)

Modified: users/ken/EasyPBI2/modBuild.cpp
===================================================================
--- users/ken/EasyPBI2/modBuild.cpp	2012-10-31 09:18:20 UTC (rev 20092)
+++ users/ken/EasyPBI2/modBuild.cpp	2012-10-31 14:51:19 UTC (rev 20093)
@@ -20,7 +20,7 @@
     //mimeStruct=[ info, type, patterns] (patterns is a " "-delimited list)
   portStruct << "" << "" << "" << "" << "" << "" << "FALSE";
     //portStruct=[ name, author, website, options, binaries, menu-category, isGraphical ]
-    
+  validMenuCategories <<"AudioVideo"<<"Development"<<"Education"<<"Game"<<"Graphics"<<"Network"<<"Office"<<"Science"<<"Settings"<<"System"<<"Utility";  
 }
 
 ModBuild::~ModBuild(){
@@ -1113,10 +1113,11 @@
   QString mc;
   //qDebug() << portDir << pc;
   //Create the port -> menu category conversions
-  QStringList avcat, devcat, edcat, gamecat, gracat,netcat,offcat,setcat,syscat;
+  QStringList avcat, devcat, edcat, gamecat, gracat,netcat,offcat,setcat,syscat,scicat;
   avcat << "audio"<<"multimedia";
   devcat << "devel" << "lang" << "java";
-  edcat << "astro" << "biology" << "cad" <<"math"<< "science";
+  edcat << "astro" << "cad" <<"math";
+  scicat <<"biology"<<"science";
   gamecat << "games";
   gracat << "graphics";
   netcat << "ftp"<<"irc"<<"mail"<<"net"<<"net-im"<<"net-p2p"<<"net-mgmt"<<"www";
@@ -1128,6 +1129,7 @@
   if( avcat.contains(pc) ){ mc="AudioVideo"; }
   else if( devcat.contains(pc) ){ mc="Development"; }
   else if( edcat.contains(pc) ){ mc="Education"; }
+  else if( scicat.contains(pc) ){ mc ="Science"; }
   else if( gamecat.contains(pc) ){ mc="Game"; }
   else if( gracat.contains(pc) ){ mc="Graphics"; }
   else if( netcat.contains(pc) ){ mc="Network"; }

Modified: users/ken/EasyPBI2/modBuild.h
===================================================================
--- users/ken/EasyPBI2/modBuild.h	2012-10-31 09:18:20 UTC (rev 20092)
+++ users/ken/EasyPBI2/modBuild.h	2012-10-31 14:51:19 UTC (rev 20093)
@@ -27,7 +27,7 @@
   ModBuild(QWidget* parent =0);
   ~ModBuild();
   //Public variables
-  QStringList currentBins, currentMimeTypes, currentIcons;
+  QStringList currentBins, currentMimeTypes, currentIcons, validMenuCategories;
   bool isPortPBI, isLocalPBI;
 
   // --Regular functions--



More information about the Commits mailing list