[PC-BSD Commits] r19579 - in users/ken/EasyPBI2: . icons

svn at pcbsd.org svn at pcbsd.org
Tue Oct 2 13:07:17 PDT 2012


Author: kenmoore
Date: 2012-10-02 20:07:17 +0000 (Tue, 02 Oct 2012)
New Revision: 19579

Added:
   users/ken/EasyPBI2/icons/EasyPBIicon.png
   users/ken/EasyPBI2/icons/defaulticon.png
   users/ken/EasyPBI2/icons/freebsd.png
   users/ken/EasyPBI2/icons/pcbsd.png
Removed:
   users/ken/EasyPBI2/icons/add.png
   users/ken/EasyPBI2/icons/arrow-down.png
   users/ken/EasyPBI2/icons/arrow-up.png
   users/ken/EasyPBI2/icons/configure.png
   users/ken/EasyPBI2/icons/questionmark.png
   users/ken/EasyPBI2/icons/refresh.png
   users/ken/EasyPBI2/icons/remove.png
   users/ken/EasyPBI2/icons/save.png
Modified:
   users/ken/EasyPBI2/EasyPBI.pro
   users/ken/EasyPBI2/EasyPBI.qrc
   users/ken/EasyPBI2/Makefile
   users/ken/EasyPBI2/backend.cpp
   users/ken/EasyPBI2/backend.h
   users/ken/EasyPBI2/main.cpp
   users/ken/EasyPBI2/mainGUI.cpp
   users/ken/EasyPBI2/mainGUI.h
   users/ken/EasyPBI2/mainGUI.ui
   users/ken/EasyPBI2/modBuild.cpp
   users/ken/EasyPBI2/modBuild.h
Log:
Checkpoint for EasyPBI2, it can now build and run, with the GUI mostly setup. Now I just need to finish moving a lot of the old backend functions into the new backend and modbuild classes then attaching them to the GUI.



Modified: users/ken/EasyPBI2/EasyPBI.pro
===================================================================
--- users/ken/EasyPBI2/EasyPBI.pro	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/EasyPBI.pro	2012-10-02 20:07:17 UTC (rev 19579)
@@ -13,13 +13,15 @@
 
 
 SOURCES += main.cpp\
-        mainwindow.cpp \
-        modBuild.cpp
+        mainGUI.cpp \
+        modBuild.cpp \
+	backend.cpp
 
-HEADERS  += mainwindow.h \
-            modBuild.h
+HEADERS  += mainGUI.h \
+            modBuild.h \
+	    backend.cpp
 
-FORMS    += mainwindow.ui
+FORMS    += mainGUI.ui
 
 RESOURCES+= EasyPBI.qrc
 

Modified: users/ken/EasyPBI2/EasyPBI.qrc
===================================================================
--- users/ken/EasyPBI2/EasyPBI.qrc	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/EasyPBI.qrc	2012-10-02 20:07:17 UTC (rev 19579)
@@ -1,14 +1,9 @@
 <RCC>
   <qresource prefix="png">
-    <file>icons/questionmark.png</file>
-    <file>icons/save.png</file>
-    <file>icons/refresh.png</file>
-    <file>icons/add.png</file>
-    <file>icons/arrow-down.png</file>
-    <file>icons/arrow-up.png</file>
-    <file>icons/configure.png</file>
-    <file>icons/remove.png</file>
-    <file>EasyPBIicon.png</file>
-    <file>defaulticon.png</file>
+    <file>icons/config.png</file>
+    <file>icons/pcbsd.png</file>
+    <file>icons/freebsd.png</file>
+    <file>icons/defaulticon.png</file>
+    <file>icons/EasyPBIicon.png</file>
   </qresource>
 </RCC>

Modified: users/ken/EasyPBI2/Makefile
===================================================================
--- users/ken/EasyPBI2/Makefile	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/Makefile	2012-10-02 20:07:17 UTC (rev 19579)
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building: EasyPBI
-# Generated by qmake (2.01a) (Qt 4.8.2) on: Fri Sep 7 13:54:14 2012
+# Generated by qmake (2.01a) (Qt 4.8.2) on: Tue Oct 2 14:58:32 2012
 # Project:  EasyPBI.pro
 # Template: app
 # Command: /usr/local/bin/qmake-qt4 -o Makefile EasyPBI.pro
@@ -44,13 +44,17 @@
 ####### Files
 
 SOURCES       = main.cpp \
-		mainwindow.cpp \
-		modBuild.cpp moc_mainwindow.cpp \
+		mainGUI.cpp \
+		modBuild.cpp \
+		backend.cpp moc_mainGUI.cpp \
+		moc_modBuild.cpp \
 		qrc_EasyPBI.cpp
 OBJECTS       = main.o \
-		mainwindow.o \
+		mainGUI.o \
 		modBuild.o \
-		moc_mainwindow.o \
+		backend.o \
+		moc_mainGUI.o \
+		moc_modBuild.o \
 		qrc_EasyPBI.o
 DIST          = /usr/local/share/qt4/mkspecs/common/unix.conf \
 		/usr/local/share/qt4/mkspecs/common/gcc-base.conf \
@@ -105,7 +109,7 @@
 
 all: Makefile $(TARGET)
 
-$(TARGET): ui_mainwindow.h $(OBJECTS)  
+$(TARGET): ui_mainGUI.h $(OBJECTS)  
 	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
 
 Makefile: EasyPBI.pro  /usr/local/share/qt4/mkspecs/freebsd-g++/qmake.conf /usr/local/share/qt4/mkspecs/common/unix.conf \
@@ -168,7 +172,7 @@
 
 dist: 
 	@$(CHK_DIR_EXISTS) .tmp/EasyPBI1.0.0 || $(MKDIR) .tmp/EasyPBI1.0.0 
-	$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents mainwindow.h modBuild.h .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents EasyPBI.qrc .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp modBuild.cpp .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents i18n/EasyPBI_af.ts i18n/EasyPBI_ar.ts i18n/EasyPBI_az.ts i18n/EasyPBI_bg.ts i18n/EasyPBI_bn.ts i18n/EasyPBI_bs.ts i18n/EasyPBI_ca.ts i18n/EasyPBI_cs.ts i18n/EasyPBI_cy.ts i18n/EasyPBI_da.ts i18n/EasyPBI_de.ts i18n/EasyPBI_el.ts i18n/EasyPBI_en_GB.ts i18n/EasyPBI_en_ZA.ts i18n/EasyPBI_es.ts i18n/EasyPBI_et.ts i18n/EasyPBI_eu.ts i18n/EasyPBI_fa.ts i18n/EasyPBI_fi.ts i18n/EasyPBI_fr.ts i18n/EasyPBI_fr_CA.ts i18n/EasyPBI_gl.ts i18n/EasyPBI_he.ts i18n/EasyPBI_hi.ts i18n/EasyPBI_hr.ts i18n/EasyPBI_hu.ts i18n/EasyPBI_id.ts i18n/EasyPBI_is.ts i18n/EasyPBI_it.ts i18n/EasyPBI_ja.ts i18n/EasyPBI_ka.ts i18n/EasyPBI_ko.ts i18n/EasyPBI_lt.!
 ts i18n/EasyPBI_lv.ts i18n/EasyPBI_mk.ts i18n/EasyPBI_mn.ts i18n/EasyPBI_ms.ts i18n/EasyPBI_mt.ts i18n/EasyPBI_nb.ts i18n/EasyPBI_nl.ts i18n/EasyPBI_pa.ts i18n/EasyPBI_pl.ts i18n/EasyPBI_pt.ts i18n/EasyPBI_pt_BR.ts i18n/EasyPBI_ro.ts i18n/EasyPBI_ru.ts i18n/EasyPBI_sk.ts i18n/EasyPBI_sl.ts i18n/EasyPBI_sr.ts i18n/EasyPBI_sv.ts i18n/EasyPBI_sw.ts i18n/EasyPBI_ta.ts i18n/EasyPBI_tg.ts i18n/EasyPBI_th.ts i18n/EasyPBI_tr.ts i18n/EasyPBI_uk.ts i18n/EasyPBI_uz.ts i18n/EasyPBI_vi.ts i18n/EasyPBI_zh_CN.ts i18n/EasyPBI_zh_HK.ts i18n/EasyPBI_zh_TW.ts i18n/EasyPBI_zu.ts .tmp/EasyPBI1.0.0/ && (cd `dirname .tmp/EasyPBI1.0.0` && $(TAR) EasyPBI1.0.0.tar EasyPBI1.0.0 && $(COMPRESS) EasyPBI1.0.0.tar) && $(MOVE) `dirname .tmp/EasyPBI1.0.0`/EasyPBI1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/EasyPBI1.0.0
+	$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents mainGUI.h modBuild.h backend.cpp .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents EasyPBI.qrc .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents main.cpp mainGUI.cpp modBuild.cpp backend.cpp .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents mainGUI.ui .tmp/EasyPBI1.0.0/ && $(COPY_FILE) --parents i18n/EasyPBI_af.ts i18n/EasyPBI_ar.ts i18n/EasyPBI_az.ts i18n/EasyPBI_bg.ts i18n/EasyPBI_bn.ts i18n/EasyPBI_bs.ts i18n/EasyPBI_ca.ts i18n/EasyPBI_cs.ts i18n/EasyPBI_cy.ts i18n/EasyPBI_da.ts i18n/EasyPBI_de.ts i18n/EasyPBI_el.ts i18n/EasyPBI_en_GB.ts i18n/EasyPBI_en_ZA.ts i18n/EasyPBI_es.ts i18n/EasyPBI_et.ts i18n/EasyPBI_eu.ts i18n/EasyPBI_fa.ts i18n/EasyPBI_fi.ts i18n/EasyPBI_fr.ts i18n/EasyPBI_fr_CA.ts i18n/EasyPBI_gl.ts i18n/EasyPBI_he.ts i18n/EasyPBI_hi.ts i18n/EasyPBI_hr.ts i18n/EasyPBI_hu.ts i18n/EasyPBI_id.ts i18n/EasyPBI_is.ts i18n/EasyPBI_it.ts i18n/EasyPBI_ja.ts i18n/EasyPBI_ka.ts i18n/EasyPBI_ko.ts i!
 18n/EasyPBI_lt.ts i18n/EasyPBI_lv.ts i18n/EasyPBI_mk.ts i18n/EasyPBI_mn.ts i18n/EasyPBI_ms.ts i18n/EasyPBI_mt.ts i18n/EasyPBI_nb.ts i18n/EasyPBI_nl.ts i18n/EasyPBI_pa.ts i18n/EasyPBI_pl.ts i18n/EasyPBI_pt.ts i18n/EasyPBI_pt_BR.ts i18n/EasyPBI_ro.ts i18n/EasyPBI_ru.ts i18n/EasyPBI_sk.ts i18n/EasyPBI_sl.ts i18n/EasyPBI_sr.ts i18n/EasyPBI_sv.ts i18n/EasyPBI_sw.ts i18n/EasyPBI_ta.ts i18n/EasyPBI_tg.ts i18n/EasyPBI_th.ts i18n/EasyPBI_tr.ts i18n/EasyPBI_uk.ts i18n/EasyPBI_uz.ts i18n/EasyPBI_vi.ts i18n/EasyPBI_zh_CN.ts i18n/EasyPBI_zh_HK.ts i18n/EasyPBI_zh_TW.ts i18n/EasyPBI_zu.ts .tmp/EasyPBI1.0.0/ && (cd `dirname .tmp/EasyPBI1.0.0` && $(TAR) EasyPBI1.0.0.tar EasyPBI1.0.0 && $(COMPRESS) EasyPBI1.0.0.tar) && $(MOVE) `dirname .tmp/EasyPBI1.0.0`/EasyPBI1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/EasyPBI1.0.0
 
 
 clean:compiler_clean 
@@ -189,26 +193,24 @@
 
 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
 
-compiler_moc_header_make_all: moc_mainwindow.cpp
+compiler_moc_header_make_all: moc_mainGUI.cpp moc_modBuild.cpp
 compiler_moc_header_clean:
-	-$(DEL_FILE) moc_mainwindow.cpp
-moc_mainwindow.cpp: mainwindow.h
-	/usr/local/bin/moc-qt4 $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
+	-$(DEL_FILE) moc_mainGUI.cpp moc_modBuild.cpp
+moc_mainGUI.cpp: mainGUI.h
+	/usr/local/bin/moc-qt4 $(DEFINES) $(INCPATH) mainGUI.h -o moc_mainGUI.cpp
 
+moc_modBuild.cpp: modBuild.h
+	/usr/local/bin/moc-qt4 $(DEFINES) $(INCPATH) modBuild.h -o moc_modBuild.cpp
+
 compiler_rcc_make_all: qrc_EasyPBI.cpp
 compiler_rcc_clean:
 	-$(DEL_FILE) qrc_EasyPBI.cpp
 qrc_EasyPBI.cpp: EasyPBI.qrc \
-		defaulticon.png \
-		EasyPBIicon.png \
-		icons/arrow-down.png \
-		icons/add.png \
-		icons/arrow-up.png \
-		icons/configure.png \
-		icons/save.png \
-		icons/questionmark.png \
-		icons/remove.png \
-		icons/refresh.png
+		icons/freebsd.png \
+		icons/pcbsd.png \
+		icons/defaulticon.png \
+		icons/EasyPBIicon.png \
+		icons/config.png
 	/usr/local/bin/rcc -name EasyPBI EasyPBI.qrc -o qrc_EasyPBI.cpp
 
 compiler_image_collection_make_all: qmake_image_collection.cpp
@@ -216,11 +218,11 @@
 	-$(DEL_FILE) qmake_image_collection.cpp
 compiler_moc_source_make_all:
 compiler_moc_source_clean:
-compiler_uic_make_all: ui_mainwindow.h
+compiler_uic_make_all: ui_mainGUI.h
 compiler_uic_clean:
-	-$(DEL_FILE) ui_mainwindow.h
-ui_mainwindow.h: mainwindow.ui
-	/usr/local/bin/uic-qt4 mainwindow.ui -o ui_mainwindow.h
+	-$(DEL_FILE) ui_mainGUI.h
+ui_mainGUI.h: mainGUI.ui
+	/usr/local/bin/uic-qt4 mainGUI.ui -o ui_mainGUI.h
 
 compiler_yacc_decl_make_all:
 compiler_yacc_decl_clean:
@@ -232,20 +234,27 @@
 
 ####### Compile
 
-main.o: main.cpp mainwindow.h
+main.o: main.cpp mainGUI.h
 	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
 
-mainwindow.o: mainwindow.cpp mainwindow.h \
-		ui_mainwindow.h \
-		modBuild.h
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
+mainGUI.o: mainGUI.cpp mainGUI.h \
+		ui_mainGUI.h \
+		modBuild.h \
+		backend.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainGUI.o mainGUI.cpp
 
 modBuild.o: modBuild.cpp modBuild.h
 	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o modBuild.o modBuild.cpp
 
-moc_mainwindow.o: moc_mainwindow.cpp 
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
+backend.o: backend.cpp backend.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o backend.o backend.cpp
 
+moc_mainGUI.o: moc_mainGUI.cpp 
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainGUI.o moc_mainGUI.cpp
+
+moc_modBuild.o: moc_modBuild.cpp 
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_modBuild.o moc_modBuild.cpp
+
 qrc_EasyPBI.o: qrc_EasyPBI.cpp 
 	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_EasyPBI.o qrc_EasyPBI.cpp
 

Modified: users/ken/EasyPBI2/backend.cpp
===================================================================
--- users/ken/EasyPBI2/backend.cpp	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/backend.cpp	2012-10-02 20:07:17 UTC (rev 19579)
@@ -1,12 +1,12 @@
 #include "backend.h"
 
 bool Backend::portsAvailable(){
-	
+  return TRUE;
 }
 
 void Backend::openPortInfo(QString port){
   //Open up the freshports.org page for the selected port
-   QString target_url = "http://freshports.org/" + PORT_SELECTED;
+   QString target_url = "http://freshports.org/" + port;
    QDesktopServices::openUrl(QUrl(target_url));
 }
 
@@ -28,7 +28,80 @@
   else if(icon=="file"){ iconPath.append("file-32.png"); }
   else if(icon=="trash"){ iconPath.append("trash-32.png"); }
   else if(icon=="clear"){ iconPath.append("standardbutton-clear-128.png"); }
-  else{ iconpath.clear(); }
+  else if(icon=="start"){ iconPath.append("media-play-32.png"); }
+  else if(icon=="stop"){ iconPath.append("media-stop-32.png"); }
+  else{ iconPath.clear(); }
 	
-  return QIcon(iconpath);
-}
\ No newline at end of file
+  return QIcon(iconPath);
+}
+
+void Backend::findExternalCommands(QString* suCommand, QString* pbi_makeport, QString* pbi_create){
+ // Should be called like: Backend::findExternalCommands(su&, mkport&, create&);
+ //   (su, mkport, create) are QString outputs, not inputs
+  suCommand->clear();
+  pbi_makeport->clear();
+  pbi_create->clear();	
+  bool sufound = FALSE;
+  bool pbifound1 = FALSE;
+  bool pbifound2 = FALSE;
+  //Setup the commands to look for (lists in order of preference)
+  QStringList suCMD;
+  suCMD << "pc-su" << "qsu" << "gksu" << "kdesu"; //graphical "switch user" utilities
+  QString pbiCMD1 = "pbi_makeport";  //command to create a PBI from ports
+  QString pbiCMD2 = "pbi_create"; //command to create a PBI from local sources
+  
+  //Get the current application path
+  QString cpath = QCoreApplication::applicationDirPath();
+  if(cpath.endsWith("/.sbin")){ cpath.chop(6); } //Fix for PBI installation of EasyPBI
+  qDebug() << "Application Path:" << cpath;
+  //Set the search paths
+  QStringList paths;
+  paths <<"/usr/local/bin/"<<"/usr/local/sbin/"<<"/usr/bin/"<<"/usr/sbin/"<<cpath+"/bin/"<<cpath+"/sbin/";
+
+  //Perform the Search
+  for(int i=0; i<paths.length(); i++){
+    //PBI build commands
+    if(!pbifound1){
+      if(QFile::exists(paths[i]+pbiCMD1)){
+        pbifound1 = TRUE;
+        pbi_makeport->append(paths[i]+pbiCMD1);
+      }
+    }
+    if(!pbifound2){
+      if(QFile::exists(paths[i]+pbiCMD2)){
+        pbifound2 = TRUE;
+        pbi_create->append(paths[i]+pbiCMD2);
+      }
+    }
+    //SU utility
+    if(!sufound){
+      for(int j=0; j<suCMD.length(); j++){
+        if(QFile::exists(paths[i]+suCMD[j])){
+      	  sufound = TRUE;
+      	  suCommand->append(paths[i]+suCMD[j]);  
+      	  break;
+      	}
+      }    	    
+    }
+  }
+  //Report the results
+  if(!suCommand->isEmpty()){
+    qDebug() << "Graphical switch user utility found at:"<<suCommand->simplified();  
+  }else{
+    qDebug() << "No graphical switch user utility found!";
+    qDebug() << " - Utilities searched for:" << suCMD;
+    qDebug() << " - Paths searched:" << paths;
+  }
+  if(!pbi_makeport->isEmpty()){
+    qDebug() << "pbi_makeport found at:"<<pbi_makeport->simplified();  
+  }else{
+    qDebug() << "pbi_makeport utility could not be found!";
+    qDebug() << " - Paths searched:" << paths;
+  }
+  if(!pbi_create->isEmpty()){
+    qDebug() << "pbi_create found at:"<<pbi_create->simplified();  
+  }else{
+    qDebug() << "pbi_create utility could not be found!";
+    qDebug() << " - Paths searched:" << paths;
+  }
+}

Modified: users/ken/EasyPBI2/backend.h
===================================================================
--- users/ken/EasyPBI2/backend.h	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/backend.h	2012-10-02 20:07:17 UTC (rev 19579)
@@ -6,6 +6,12 @@
 #include <QDir>
 #include <QDebug>
 #include <QIcon>
+#include <QNetworkAccessManager>
+#include <QNetworkRequest>
+#include <QNetworkReply>
+#include <QDesktopServices>
+#include <QUrl>
+#include <QCoreApplication>
 
 class Backend{
 
@@ -16,6 +22,7 @@
   static bool portsAvailable();
   static void openPortInfo(QString);
   static QIcon icon(QString);
+  static void findExternalCommands(QString*,QString*,QString*);
 
 };
 

Index: users/ken/EasyPBI2/icons/EasyPBIicon.png
===================================================================
--- users/ken/EasyPBI2/icons/EasyPBIicon.png	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/icons/EasyPBIicon.png	2012-10-02 20:07:17 UTC (rev 19579)

Property changes on: users/ken/EasyPBI2/icons/EasyPBIicon.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
Index: users/ken/EasyPBI2/icons/defaulticon.png
===================================================================
--- users/ken/EasyPBI2/icons/defaulticon.png	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/icons/defaulticon.png	2012-10-02 20:07:17 UTC (rev 19579)

Property changes on: users/ken/EasyPBI2/icons/defaulticon.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
Index: users/ken/EasyPBI2/icons/freebsd.png
===================================================================
--- users/ken/EasyPBI2/icons/freebsd.png	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/icons/freebsd.png	2012-10-02 20:07:17 UTC (rev 19579)

Property changes on: users/ken/EasyPBI2/icons/freebsd.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
Index: users/ken/EasyPBI2/icons/pcbsd.png
===================================================================
--- users/ken/EasyPBI2/icons/pcbsd.png	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/icons/pcbsd.png	2012-10-02 20:07:17 UTC (rev 19579)

Property changes on: users/ken/EasyPBI2/icons/pcbsd.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
Modified: users/ken/EasyPBI2/main.cpp
===================================================================
--- users/ken/EasyPBI2/main.cpp	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/main.cpp	2012-10-02 20:07:17 UTC (rev 19579)
@@ -2,7 +2,7 @@
 #include <qtsingleapplication.h>
 #include <QtGui/QApplication>
 #include <QDebug>
-#include "mainwindow.h"
+#include "mainGUI.h"
 #define PREFIX QString("/usr/local")
 
 int main(int argc, char ** argv)
@@ -21,7 +21,7 @@
     qDebug() << "Locale:" << langCode;
 
 
-    MainWindow w;
+    MainGUI w;
     QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance()) );
     w.show();
 

Modified: users/ken/EasyPBI2/mainGUI.cpp
===================================================================
--- users/ken/EasyPBI2/mainGUI.cpp	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/mainGUI.cpp	2012-10-02 20:07:17 UTC (rev 19579)
@@ -1,55 +1,85 @@
 #include "mainGUI.h"
 #include "ui_mainGUI.h"
 #include "modBuild.h"
+#include "backend.h"
 #include <QDebug>
 
-MainWindow::MainWindow(QWidget *parent) :
+MainGUI::MainGUI(QWidget *parent) :
     QMainWindow(parent),
-    ui(new Ui::MainWindow)
+    ui(new Ui::MainGUI)
 {
-      //Setup Initial state of GUI objects and connect signal/slots
-      ui->setupUi(this);
-      ui->progressBar->setVisible(FALSE);
-      ui->pushKillBuild->setEnabled(FALSE);
-      ui->gui_app->setEnabled(FALSE);
-      ui->create_button->setEnabled(FALSE);
-      ui->pushBuildPBI->setEnabled(FALSE);
-      ui->pushFindIcon->setEnabled(FALSE);
-      ui->pushSaveLog->setEnabled(FALSE);
-      ui->pushOpenPortInfo->setEnabled(FALSE);
-      ui->pushPackageModule->setEnabled(FALSE);
-      ui->tabModuleEditor->setEnabled(FALSE);
-      ui->tabWidget->setCurrentIndex(0); //default to the Modules Tab
-      //ui->tabModuleEditor->setCurrentIndex(0); //default to the pbi.conf editor
-      connect(ui->pushResetModule,SIGNAL(clicked()),this,SLOT(Reset_Form()) );
-      connect(ui->pushClearChanges,SIGNAL(clicked()),this,SLOT(editRefreshPbiConf()) );
-      connect(ui->pushSavePbiConf,SIGNAL(clicked()),this,SLOT(editSavePbiConf()) );
-      connect(ui->pushRefreshResources,SIGNAL(clicked()),this,SLOT(editRefreshResources()) );
+	// NOTE: "plus"/"minus" icons are set in QtDesigner using the current theme
+	//	since none are available in the Qt Embedded resources
+	
+       //Setup Initial state of GUI objects and connect signal/slots
+       ui->setupUi(this);  //load the mainGUI.ui file
+	//Setup the Menu items
+	ui->actionClose_EasyPBI->setIcon(Backend::icon(""));
+	//Setup Toolbar
+	ui->actionNew_Module->setIcon(Backend::icon("new"));
+	ui->actionLoad_Module->setIcon(Backend::icon("load"));
+	line_module = new QLineEdit(this);
+	line_module->setPlaceholderText(tr("No Module Loaded"));
+	line_module->setReadOnly(TRUE);
+	ui->toolBar->addWidget(line_module);
+	ui->toolBar->addSeparator();
+	radio_module_port = new QRadioButton(tr("FreeBSD Port"),this);
+	radio_module_port->setEnabled(FALSE);
+	ui->toolBar->addWidget(radio_module_port);
+	radio_module_local = new QRadioButton(tr("Local Sources"),this);
+	radio_module_local->setEnabled(FALSE);
+	ui->toolBar->addWidget(radio_module_local);
+	//Setup Module Editor
+	// -- pbi.conf tab --
+	ui->push_change_makeport->setIcon(Backend::icon("file"));
+	ui->push_addmakeopt->setIcon(Backend::icon("left"));
+	menuList[0] = new QMenu();
+	ui->push_addmakeopt->setMenu(menuList[0]);
+	ui->push_config_save->setIcon(Backend::icon("save"));
+	// -- resources tab --
+	ui->push_resources_savewrapper->setIcon(Backend::icon("save"));
+	// -- XDG entries tab --
+	ui->push_xdg_refresh->setIcon(Backend::icon("refresh"));
+	ui->push_xdg_savechanges->setIcon(Backend::icon("save"));
+	// -- Scripts tab --
+	ui->push_scripts_save->setIcon(Backend::icon("save"));
+	ui->list_scripts_file->addItems(QStringList() << "Installation Scripts" << "pre-portmake.sh" << "post-portmake.sh" << "pre-install.sh" << "post-install.sh" << "pre-remove.sh" );
+	// -- External links tab --
+	ui->push_el_files->setIcon(Backend::icon("left"));
+	menuList[1] = new QMenu();
+	menuList[1]->addAction("No Binaries Detected");
+	ui->push_el_files->setMenu(menuList[1]);
+	
+	ui->push_el_filetype->setIcon(Backend::icon("left"));
+	menuList[2] = new QMenu();
+	menuList[2]->addAction("binary");
+	menuList[2]->addAction("linux");
+	menuList[2]->addAction("keep");
+	menuList[2]->addAction("replace");
+	menuList[2]->addAction("nocrash");
+	ui->push_el_filetype->setMenu(menuList[2]);
+	//Setup PBI Builder
+	ui->push_build_start->setIcon(Backend::icon("start"));
+	ui->push_build_stop->setIcon(Backend::icon("stop"));
+	ui->push_build_save->setIcon(Backend::icon("save"));
+	
       SetupDefaults();
       //Deactivate the PBI Build tab if the proper external utilities not found
-      if(SU_CMD.isEmpty() || PBIBUILD_CMD.isEmpty()){
-        ui->tabWidget->setTabEnabled(1,FALSE);
-        QMessageBox::warning(this,tr("Incomplete Installation"),tr("EasyPBI could not find the external utilities necessary to build PBI's.")+"\n"+tr("Please ensure that the pbi manager tools and a graphical switch user utility (qsu, gksu, kdesu) are installed properly to enable this feature of EasyPBI."));
-      }
+      qDebug() << "At end of setup";
 }
 
-MainWindow::~MainWindow()
+MainGUI::~MainGUI()
 {
   
 }
 
-void MainWindow::slotSingleInstance(){
+void MainGUI::slotSingleInstance(){
   this->showNormal();
   this->activateWindow();
   this->raise();
 }
 
-void MainWindow::on_actionExit_triggered()
-{
-    close();
-}
-
-void MainWindow::SetupDefaults(){
+void MainGUI::SetupDefaults(){
     //Make sure that the program is not being started with root permissions
     QString id = QProcessEnvironment::systemEnvironment().toStringList().filter("HOME=").join(" ").simplified();
     if( id.contains("root") ){
@@ -57,7 +87,7 @@
       exit(0);
     }
 
-  PROGVERSION = "1.3.1";
+  PROGVERSION = "2.0";
   PROG_DIR = QDir::homePath() + "/EasyPBI";
   PBIOUT_DIR= PROG_DIR + "/PBI";
   MODOUT_DIR= PROG_DIR + "/Modules";  
@@ -105,14 +135,12 @@
       return;
     }
   }  
-  //Check for the ports Directory and Set the internal variable 'PORTS_DIR'
-  Check_For_Ports(true);
 
   //Check for the defaulticons.png file
   if( !QFile(DEFAULTICON_FILE).exists() ){
     //file does not exist, copy the included resource to the file
     qDebug() << "Copying the default icon to the EasyPBI directory";
-    QFile::copy(":/png/defaulticon.png",DEFAULTICON_FILE);
+    QFile::copy(":/png/icons/defaulticon.png",DEFAULTICON_FILE);
     
     QFile::setPermissions(DEFAULTICON_FILE,QFile::ReadGroup | QFile::WriteGroup | QFile::ReadOwner | QFile::WriteOwner | QFile::ReadOther | QFile::WriteOther);
   }
@@ -120,1065 +148,14 @@
   //Load the defaults for the PBI build settings
   if( QFile(PBISETTINGS_FILE).exists() ){
     qDebug() << "PBI Settings file detected at:"<< PBISETTINGS_FILE;
-    loadPBISettings();
+    //loadPBISettings();
   }else{
-    ui->linePBIOutDir->setText(PBIOUT_DIR);
+    //ui->linePBIOutDir->setText(PBIOUT_DIR);
   }
   
   //Scan for the external utilities needed to build PBI's
-  findExternalCommands();
+  Backend::findExternalCommands(&SU_CMD, &PBIBUILD_CMD, &PBICREATE_CMD);
   //Set a couple more internal flags
   PBI_BUILDING_NOW.clear();
   PBI_BUILD_TERMINATED=FALSE;
 }
-
-void MainWindow::Reset_Form()
-{
-    ui->port_name->setText("");
-    ui->port_category->setText("");
-    ui->author->setText("");
-    ui->icon_path->setText("");
-    ui->gui_app->setChecked(true);
-    ui->website->setText("");
-    ui->status_bar->setText(tr("Please push 'New Module' to get started."));
-    ui->port_selected->setText("");
-    //Reset GUI buttons
-    ui->gui_app->setEnabled(FALSE);
-    ui->create_button->setEnabled(FALSE);
-    ui->pushFindIcon->setEnabled(FALSE);
-}
-
-void MainWindow::on_pushFindIcon_clicked()
-{
-    QString icon_name;
-    icon_name = QFileDialog::getOpenFileName(this, tr("Select Icon"), QDir::homePath(), tr("Image Files (*.png)"));
-    if( !icon_name.isEmpty() ){
-      ui->icon_path->setText(icon_name);
-    }
-}
-
-void MainWindow::on_actionAbout_EasyPBI_triggered()
-{
-    QMessageBox::about(this, tr("About EasyPBI"), tr("EasyPBI")+" "+PROGVERSION+"\n"+tr("Create PBI's quickly and easily.")+"\nhttp://makeapbi.sourceforge.net\n"+tr("Written by Jesse Smith and Ken Moore"));
-}
-
-void MainWindow::on_actionAppCafe_Integration_triggered(){
-  QString instructions = tr("Steps to integrate your PBI modules with the official PC-BSD Repository")+":\n\n  1) "+tr("Ensure the module works by building and testing the PBI with EasyPBI, making adjustments to the module as needed.")+"\n  2) "+tr("Check that the module does not already exist in the PC-BSD repository at")+": http://trac.pcbsd.org/browser/pbi/modules\n  3) "+tr("E-mail the packaged module file to")+": pbi-dev at lists.pcbsd.org\n\n"+tr("To place the module into an alternate PBI repository, please contact the maintainer of that repository for instructions.");
-  QMessageBox::about(this, tr("EasyPBI: AppCafe Integration"), instructions);
-}
-
-void MainWindow::on_pushNewModule_clicked()
-{
-    // check to see if the ports tree exists
-    if (!Check_For_Ports(true)){return;}
-
-    // get new port to work on
-    QString module_path = QFileDialog::getExistingDirectory(this, tr("Select Port"), PORTS_DIR);
-    if(module_path.isEmpty()){return;} //action cancelled or closed
-    PORT_SELECTED = module_path.section("ports/",1,1);
-
-    //get the port information
-    QString port_name = ModBuild::getPortInfo(module_path,"portname").join("");
-    if(port_name.isEmpty() ){
-      //Invalid port directory Selected
-      QMessageBox::warning(this, tr("Error: Invalid Port"), tr("Invalid Port. Please select a valid port directory.\nExample: /usr/ports/archivers/unzip is a valid port directory."));
-      return;
-    }
-    QString author_name = ModBuild::getPortInfo(module_path,"maintainer").join("");
-    QString website = ModBuild::getPortInfo(module_path,"website").join("");
-    QString menu_cat = ModBuild::getPortInfo(module_path,"menucategory").join("");
-    
-    // Display the detected info
-    ui->author->setText(author_name);
-    ui->port_category->setText(menu_cat);
-    ui->port_selected->setText(PORT_SELECTED);
-    ui->icon_path->setText(DEFAULTICON_FILE);
-
-    ui->port_name->setText(port_name);
-    ui->website->setText(website);
-    ui->status_bar->setText(tr("Please fill out the above fields and click \"Create Module\"."));
-    //Enable the GUI Buttons
-    ui->gui_app->setEnabled(TRUE);
-    ui->create_button->setEnabled(TRUE);
-    ui->pushFindIcon->setEnabled(TRUE);
-    bool isgraphical = ( "TRUE" == ModBuild::getPortInfo(module_path,"hasGUI").join("") ); //Is_GUI(pbi_data);
-    if (isgraphical){ ui->gui_app->setChecked(true); }
-    else{ ui->gui_app->setChecked(false); }
-}
-
-void MainWindow::on_create_button_clicked()
-{
-    //Check if this module already exists
-    QDir dir(MODOUT_DIR);
-    QString modDir = ui->port_selected->text().section("/",-1);
-    if(dir.exists(modDir)){
-      QMessageBox verify;
-      verify.setText(tr("A module for this port already exists."));
-      verify.setInformativeText(tr("Do you wish to replace the current module?"));
-      verify.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
-      verify.setDefaultButton(QMessageBox::Yes);
-      int ret = verify.exec();
-      if(ret != QMessageBox::Yes){return;}
-    }
-
-    // Build Module
-    bool success = FALSE;
-    ModBuild::makeStructs(ui->port_name->text(),ui->website->text(),ui->author->text(), \
-                          ui->icon_path->text(),ui->port_selected->text(),"","","","",FALSE,"",FALSE);
-    QString newModulePath = ModBuild::makeModuleDir( MODOUT_DIR,ModBuild::getFilenameFromPath(ui->port_selected->text()) );
-    if(!newModulePath.isEmpty()){
-      qDebug() << "Module Directory:" << newModulePath;
-      if( ModBuild::writePBIconf(newModulePath) ){
-        ModBuild::addResource(newModulePath,ModBuild::readValue("PBI_PROGICON"));
-        QStringList binaries, linkOpts;
-        //Add desktop/menu entries or external-links as necessary
-        QStringList  binList = getPortBinaries(ui->port_selected->text());
-        if(!binList.isEmpty() ){
-          for(int i=0; i<binList.length(); i++){
-            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);
-      } // pbi.conf success
-    } //noModulePath check
-    QString result;
-    if(success){ 
-      result = tr("Done. Your module is located in the EasyPBI folder.")+"\n"+tr("Please view the 'AppCafe Integration' page for further instructions"); 
-      qDebug() << "Finished building Module";
-    }
-    else{ 
-      result = tr("There was an error creating the module. There may be a permission error creating new directories in your home directory.");
-      qDebug() << "Error building module: see log above";
-    }
-    ui->status_bar->setText(result);
-}
-
-void MainWindow::on_port_info_button_clicked()
-{
-   //Check if a port is selected
-   if(ui->port_selected->text().isEmpty()){
-     QMessageBox::warning(this, tr("Error: Port Information"), tr("Please select a port first"));
-     return;
-   }
-   //Open up the freshports.org page for the selected port
-   QString target_url = "http://freshports.org/" + PORT_SELECTED;
-   QDesktopServices::openUrl(QUrl(target_url));
-}
-
-
-int MainWindow::Check_For_Ports(bool show_warning)
-{
-    QStringList portsLocations;
-    //Set the locations to search for the ports tree
-    portsLocations << "/usr/ports" << PROG_DIR +"/ports";
-    //Search the locations
-    for(int i=0; i<portsLocations.size(); i++){
-      if( QDir(portsLocations[i]).exists() ){
-        if( QFile::exists(portsLocations[i]+"/COPYRIGHT") ){
-	  PORTS_DIR=portsLocations[i];
-	  return TRUE;
-	}
-      }
-    }
-    //No ports tree detected - Display warning
-    if (show_warning)
-        QMessageBox::warning(this, tr("Ports Not Installed"),tr("The FreeBSD ports tree is not installed for this system or user.")+"\n"+tr("Please Install the ports tree as root to make it available for all users, or push 'File'->'Get Ports' to retrieve the ports tree for this user ONLY"));
-    return FALSE;
-}
-
-void MainWindow::on_actionGet_Ports_triggered()
-{
-    //Check to see if the ports are already installed
-    if(Check_For_Ports(false)){
-      if(PORTS_DIR=="/usr/ports"){
-	QMessageBox::warning(this, tr("Ports Installed"),tr("The FreeBSD ports tree is already available on this system")+"\n"+tr("To update: run \"portsnap fetch extract\" as root"));
-	return;
-      }else{
-	QMessageBox verify;
-	verify.setText(tr("The FreeBSD ports tree is already available for this user"));
-	verify.setInformativeText(tr("Do you wish to update the user ports tree? (requires re-download)"));
-	verify.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
-	verify.setDefaultButton(QMessageBox::Yes);
-	int ret = verify.exec();
-	if(ret != QMessageBox::Yes){return;}
-      }
-    }
-
-    //Begin creating the network variables
-    QNetworkReply *currentDL;
-    QNetworkAccessManager *manager = new QNetworkAccessManager(this);
-    //Start the download
-    connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFinished(QNetworkReply*)) );
-    currentDL = manager->get(QNetworkRequest(QUrl("ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz")));
-    //Update the status
-    ui->tabWidget->setCurrentIndex(0);
-    ui->status_bar->setText(tr("Downloading the FreeBSD ports tree: Please Wait."));
-    
-    //Make the Progress Bar visible and start updating
-    ui->progressBar->setValue(0);
-    ui->progressBar->setVisible(TRUE);
-    connect(currentDL, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateProgress(qint64,qint64)) );
-}
-
-void MainWindow::downloadFinished(QNetworkReply *reply){
-  //Disable the progress bar
-  ui->progressBar->setVisible(FALSE);
-  //See if the Download was successful
-  qDebug() << "Ports download completion code:" << reply->error();
-  if( reply->error() != QNetworkReply::NoError){
-    QMessageBox::warning(this, tr("Download Failed"),tr("Downloading the FreeBSD ports tree failed. Please check your internet connection and try again."));
-    return;
-  }
-  //Download Succesful, save it to file
-  QFile file(PROG_DIR+"/ports.tar.gz");
-  if( !file.open(QIODevice::WriteOnly)){   //if file could not be opened
-    QMessageBox::warning(this, tr("Saving Failed"),tr("Saving the FreeBSD ports tree file failed. Please try again."));
-    reply->deleteLater();
-    return;
-  }
-  file.write(reply->readAll());
-  file.close();
-  //Saving the file successful, delete the downloaded data from memory
-  reply->deleteLater();
-  ui->status_bar->setText(tr("Download finished. Extracting the ports tree into the EasyPBI directory."));
-  QTimer::singleShot(10,this, SLOT(extractPT()) );
-  return;
-}
-
-void MainWindow::extractPT(){
-  //See if the directory already exists, and remove it if it does
-  if(QDir(PROG_DIR+"/ports").exists()){
-    QString tmp = "cd "+PROG_DIR+"; rm -rf ports/";
-    system(tmp.toLatin1());
-  }
-  //Unpack the file
-  QString cmd = "cd " + PROG_DIR + "; tar xvf ports.tar.gz";
-  system(cmd.toLatin1());
-  
-  //Delete the file
-  QFile file(PROG_DIR+"/ports.tar.gz");  
-  file.remove();
-  //Let the user know that the ports tree was successfully added
-  ui->status_bar->setText(tr("The FreeBSD ports tree has been successfully added to the EasyPBI directory."));
-  return;
-}
-
-void MainWindow::updateProgress(qint64 bytesReceived, qint64 bytesTotal){
-  //Determine the percentage
-  int percent = 0;
-  if(bytesTotal != 0){
-    percent = (bytesReceived*100)/bytesTotal;
-  }
-  //Update the progress bar
-  ui->progressBar->setValue(percent);
-  ui->progressBar->update();
-}
-
-// -------- BUILD PBI'S -----------
-
-void MainWindow::on_pushChangeOutDir_clicked(){
-  QString outDir_path; 
-  outDir_path = QFileDialog::getExistingDirectory(this,tr("Select PBI Output Directory"),PROG_DIR+"/PBI");
-  if(outDir_path.isEmpty()){return;} //action cancelled or closed
-  PBIOUT_DIR = outDir_path;
-  ui->linePBIOutDir->setText(outDir_path);
-}
-
-void MainWindow::on_pushChangeSigFile_clicked(){
-  QString outDir_path;
-  outDir_path = QFileDialog::getOpenFileName(this, tr("Select Digital Signature File"), PROG_DIR,tr("Signature Files")+" (*)");
-  if(outDir_path.isEmpty()){return;} //action cancelled or closed
-  PBIOUT_DIR = outDir_path;
-  ui->linePBIDigSigFile->setText(outDir_path);
-}
-
-void MainWindow::on_pushSavePBISettings_clicked(){
-  QFile *file = new QFile(PBISETTINGS_FILE);
-  //Open the File
-  file->open(QIODevice::WriteOnly);
-  QTextStream out(file);
-  //Save the default lines
-  out << "PBI default build settings: ---DELETE FILE TO RESET DEFAULTS, DO NOT MODIFY--\n";
-  out << PROGVERSION+"\n";
-  out << ui->linePBIOutDir->text() + "\n";
-  out << ui->linePBIDigSigFile->text() + "\n";
-  if(ui->checkTMPFS->isChecked()){out << 1;}
-  else{out << 0;}
-  out << "\n";
-  if(ui->checkUseCache->isChecked()){out << 1;}
-  else{out << 0;}
-  
-  file->close();
-  //Inform the user that the save is complete
-  QMessageBox::information(this, tr("Settings Saved"),tr("PBI build settings successfully saved as the user defaults."));
-}
-
-void MainWindow::loadPBISettings(){
-  qDebug() << "Loading Previously Saved PBI Settings";
-  QFile *file = new QFile(PBISETTINGS_FILE);
-  //Open the File
-  file->open(QIODevice::ReadOnly);
-  QTextStream in(file);
-  //Load the lines into the GUI
-  in.readLine(); //skip the label line
-  QString ver = in.readLine(); //version of the program when it saved the settings
-  ui->linePBIOutDir->setText(in.readLine()); //output directory
-  ui->linePBIDigSigFile->setText(in.readLine()); //Digital Signature File
-  QString line = in.readLine(); //TMPFS checked
-  int chked = line.toInt();
-  if(chked==1){ui->checkTMPFS->setChecked(TRUE);}
-  else{ui->checkTMPFS->setChecked(FALSE);}
-  line = in.readLine(); //CACHE checked
-  chked = line.toInt();
-  if(chked==1){ui->checkUseCache->setChecked(TRUE);}
-  else{ui->checkUseCache->setChecked(FALSE);}
-
-  file->close();
-}
-
-void MainWindow::on_pushSelectModule_clicked(){
-  QString outDir_path;
-  outDir_path = QFileDialog::getExistingDirectory(this, tr("Select Module to Build"), PROG_DIR+"/Modules");
-  if(outDir_path.isEmpty()){return;} //action cancelled or closed
-  ui->linePBIModuleSelected->setText(outDir_path);
-  ui->pushBuildPBI->setEnabled(TRUE);
-}
-
-void MainWindow::on_pushBuildPBI_clicked(){
-
-  //Check for the Port tree
-  if(!Check_For_Ports(true)){return;}
-  
-  //Check GUI to make sure settings are set before running
-  bool gostatus = TRUE;
-  QString outdir = ui->linePBIOutDir->text();
-  if (outdir.isEmpty() ){gostatus=FALSE;}
-  QString sigfile = ui->linePBIDigSigFile->text(); //this one can be empty
-  QString modDir = ui->linePBIModuleSelected->text();
-  if(modDir.isEmpty()){gostatus=FALSE;}
-  if(!gostatus){
-    QMessageBox::warning(this,tr("Error"),tr("Invalid PBI Settings"));
-    return;
-  }
-  
-  //Setup the pbi_makeport command from GUI settings
-  QString cmd = PBIBUILD_CMD;
-  cmd += " -c " + modDir;
-  if(PORTS_DIR != "/usr/ports"){ cmd += " -d " + PORTS_DIR; }
-  cmd += " -o " + outdir;
-  cmd += " --delbuild";
-  if( ui->checkTMPFS->isChecked() ){ cmd += " --tmpfs"; }
-  if( ui->checkUseCache->isChecked() ){ cmd += " --pkgdir " + CACHE_DIR; }
-  if(!sigfile.isEmpty()){ cmd += " --sign " + sigfile; }
-  qDebug() << "Build PBI command created:"<<cmd;
-
-  //Receive User verification before beginning build process due to:
-  //  -- long time required, internet connection required, root permissions required
-  QMessageBox verify;
-  verify.setText(tr("Are you sure you wish to start the PBI build?"));
-  verify.setInformativeText(tr("This requires an active internet connection and root permissions. The time required to build a PBI varies depending upon system specifications and ports to be compiled."));
-  verify.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
-  verify.setDefaultButton(QMessageBox::Yes);
-  int ret = verify.exec();
-  if(ret != QMessageBox::Yes){return;}
-
-  //Add the necessary glue to the command to run the pbi build
-  cmd.prepend(SU_CMD+" \"");
-  cmd.append("\"");
-  qDebug() << "Actual command used:" << cmd;
-  
-  //Setup the displays
-  ui->pushKillBuild->setEnabled(TRUE);
-  ui->pushSaveLog->setEnabled(FALSE);
-  ui->pushBuildPBI->setEnabled(FALSE); //disable the button so they do not start more than 1 build at a time
-  ui->buildOutputArea->clear(); //clear the display in case this is not the first run
-  
-  //Setup Process connections
-  p = new QProcess(this);
-  p->setProcessChannelMode(QProcess::MergedChannels);
-  p->setProcessEnvironment( QProcessEnvironment::systemEnvironment() );
-  connect(p,SIGNAL(readyReadStandardOutput()),this,SLOT(updatePBIBuild()) );
-  connect(ui->pushKillBuild,SIGNAL(clicked()),this,SLOT(killPBIBuild()) );
-  connect(p,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(PBIbuildFinished(int,QProcess::ExitStatus)) );
-  connect(p,SIGNAL(error(QProcess::ProcessError)),this,SLOT(buildError(QProcess::ProcessError)) );
-  
-  //Setup the flag for the finishing checks
-  ModBuild::loadPBIconf(modDir);
-  PBI_BUILDING_NOW=outdir+":::"+ModBuild::readValue("PBI_PROGNAME");
-  //Start the Process
-  qDebug() << "Starting the PBI build process...";
-  p->start(cmd);  
-
-}
-
-void MainWindow::updatePBIBuild(){
-  QString tmp = p->readAllStandardOutput();
-  if( tmp.startsWith("\n") ){tmp.remove(0,0);} //remove newline at the beginning (too much whitespace in log)
-  if( tmp.endsWith("\n") ){tmp.chop(1);} //remove newline at the end (already accounted for by appending)
-  if(!tmp.isEmpty()){ ui->buildOutputArea->append( tmp ); }
-  //qDebug() << "Update output: " << tmp;
-}
-
-void MainWindow::PBIbuildFinished(int exitCode,QProcess::ExitStatus exitStatus){
-  //Check to see if the PBI process finished successfully
-  qDebug() << "PBI build process Finished" << exitStatus << exitCode;
-  //Check that the new PBI exists
-  QDir outdir( PBI_BUILDING_NOW.section(":::",0,0) );
-  QString pbiname= PBI_BUILDING_NOW.section(":::",1,1).toLower().remove(" ");
-  QFileInfoList fL = outdir.entryInfoList( QStringList() << pbiname+"*.pbi" ,QDir::Files | QDir::NoSymLinks);
-  bool success = FALSE;
-  for(int i=0; i<fL.length(); i++){
-  	  qint64 msdiff = QDateTime::currentMSecsSinceEpoch() - fL[i].created().toMSecsSinceEpoch();
-  	  if(msdiff < 60000){ success = true; break; } //if less than a minute since creation of file - success
-  }
-  
-  if(exitCode == 0 && success){
-      QMessageBox::information(this,tr("PBI Build Success"),tr("The PBI finished building successfully"));
-  }else if(exitCode == 0 && PBI_BUILD_TERMINATED){
-      //The user killed the process - No Message
-  }else{
-    QMessageBox::warning(this,tr("PBI Build Failure"),tr("The PBI failed to build.")+"\n"+tr("Please check the build log to find the cause of the failure and adjust the module accordingly"));
-  }
-  ui->pushBuildPBI->setEnabled(TRUE);
-  ui->pushSaveLog->setEnabled(TRUE);
-  ui->pushKillBuild->setEnabled(FALSE);
-  p->close();
-  PBI_BUILDING_NOW.clear();
-  PBI_BUILD_TERMINATED=FALSE;
-}
-
-void MainWindow::killPBIBuild(){
-  if( p->state()==QProcess::Running ){
-    //qDebug() << "Process PID:" << p->pid(); 
-    PBI_BUILD_TERMINATED=TRUE;    
-    p->terminate();
-    ui -> buildOutputArea->append("---PBI Build Terminated---");
-  }
-}
-
-void MainWindow::buildError(QProcess::ProcessError error){
-  qDebug() << "QProcess PBI Build error#" << error;
-}
-
-void MainWindow::on_pushSaveLog_clicked(){
-  //Have user select a filename/location to save the log
-  QString filename = QFileDialog::getSaveFileName(this,tr("Save Log"),PROG_DIR+"/build.log",tr("Log Files")+" (*.log *.txt)");
-  if(filename.isEmpty()){return;} //User cancelled the process
-  //Open the file (as new)
-  QFile *file = new QFile(filename);
-  file->open(QIODevice::WriteOnly);
-  //Save the log into the file
-  file->write(ui->buildOutputArea->toPlainText().toUtf8());
-  file->close();
-}
-// ----------- EDIT PBI MODULES --------------
-void MainWindow::on_tabWidget_currentChanged(int index){
-  if(index ==2){ //if moving to the Module Editor Tab
-    //make sure there is not a mismatch between the selected module on this tab and the data saved in the module builder backend
-    ui->tabModuleEditor->setEnabled(FALSE); 
-    ui->pushOpenPortInfo->setEnabled(FALSE);
-    ui->pushPackageModule->setEnabled(FALSE);
-    ui->label_module_selected->setText(tr("No Module Selected"));
-  }
-}
-
-void MainWindow::on_tabModuleEditor_currentChanged(int index){
-  if(index == 0){ //pbi.conf editor
-    editRefreshPbiConf();
-  }else if(index == 1){ //Resources Tab
-    editRefreshResources();
-  }else if(index == 2){ //Desktop/menu entries tab
-    editRefreshEntries();
-  }else if(index ==3){  //External links tab
-    editRefreshLinks();
-  }
-}
-
-void MainWindow::on_pushSelectModuleEdit_clicked(){
-  //Get the desired module
-  QString module_path;
-  module_path = QFileDialog::getExistingDirectory(this, tr("Select Module to Edit"), PROG_DIR+"/Modules");
-  if(module_path.isEmpty()){return;} //action cancelled or closed
-  //Update Backend structures
-  if( !ModBuild::loadPBIconf(module_path) ){
-    //Invalid Module Directory (no pbi.conf inside)
-    QMessageBox::warning(this,tr("Invalid PBI Module"),tr("You have selected an invalid PBI module, please make a different choice."));
-    return;
-  }
-  //Enable buttons and GUI display
-  ui->label_module_selected->setText(module_path);
-  ui->pushOpenPortInfo->setEnabled(TRUE);
-  ui->pushPackageModule->setEnabled(TRUE);
-  ui->tabModuleEditor->setEnabled(TRUE);
-  //Refresh all the tabs
-  editRefreshPbiConf();
-  editRefreshResources();
-  editRefreshEntries();
-  editRefreshLinks();
-}
-
-
-void MainWindow::on_pushOpenPortInfo_clicked(){
-   //Get the currently selected port within the module
-   QString currentmakeport = ModBuild::readValue("PBI_MAKEPORT");
-   //Open up the freshports.org page for the selected port
-   QString target_url = "http://freshports.org/" + currentmakeport;
-   QDesktopServices::openUrl(QUrl(target_url));
-}
-
-void MainWindow::on_pushPackageModule_clicked(){
-   //Get the current Module Directory
-   QString modDir = ui->label_module_selected->text();
-   //Call the function to compress the module directory
-   ModBuild::compressModule(modDir);
-   //Display location of the newly packaged module
-   QMessageBox::information(this,tr("Module Packaged"),tr("A copy of your module has been compressed as (module-name).tar.gz within the same directory as your PBI module."));
-}
-
-void MainWindow::editRefreshPbiConf(){
-  //Display the current PBI info in the backend
-  ui->newProgName->setText(ModBuild::readValue("PBI_PROGNAME"));
-  ui->newProgWeb->setText(ModBuild::readValue("PBI_PROGWEB"));
-  ui->newProgAuth->setText(ModBuild::readValue("PBI_PROGAUTHOR"));
-  ui->listNewProgIcon->clear();
-  QString progicon = ModBuild::getFilenameFromPath(ModBuild::readValue("PBI_PROGICON"));
-  QString progiconpath = ui->label_module_selected->text() +"/resources/"+progicon;
-  if(!(QFile::exists(progiconpath) && progiconpath.endsWith(".png")) ){ progiconpath=""; } //Make sure that icon file exists
-  ui->listNewProgIcon->addItem(QIcon(progiconpath),progicon);
-  ui->listNewProgIcon->setCurrentIndex(0);
-  //Get all the .png files in the resources directory and add them to the list
-  QDir dir(ui->label_module_selected->text()+"/resources");
-  QFileInfoList iconlist = dir.entryInfoList(QStringList("*.png"));
-  for(int i=0;i<iconlist.length(); i++){
-    if(iconlist[i].fileName() != progicon){ui->listNewProgIcon->addItem(QIcon(iconlist[i].absoluteFilePath()),iconlist[i].fileName()); }
-  }
-  QStringList mkportbefore = ModBuild::readValue("PBI_MKPORTBEFORE").split(" ",QString::SkipEmptyParts);
-  ui->listMkPortBefore->clear();
-  ui->listMkPortBefore->addItems(mkportbefore);
-  QStringList mkportafter = ModBuild::readValue("PBI_MKPORTAFTER").split(" ",QString::SkipEmptyParts);
-  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); }
-}
-
-void MainWindow::editSavePbiConf(){
-  //Save any changes into the backend structure
-  qDebug() << "Saving new pbi.conf information";
-  // -- edit boxes --
-  ModBuild::writeValue("PBI_PROGNAME",ui->newProgName->text());
-  ModBuild::writeValue("PBI_PROGWEB",ui->newProgWeb->text());
-  ModBuild::writeValue("PBI_PROGAUTHOR",ui->newProgAuth->text());
-  ModBuild::writeValue("PBI_MAKEOPTS",ui->newMkOpts->text());
-  // -- list boxes --
-  ModBuild::writeValue("PBI_PROGICON",ui->listNewProgIcon->currentText() );
-
-  QString mkportbefore;
-  for(int i=0; i<ui->listMkPortBefore->count(); i++){
-    mkportbefore.append(" "+ui->listMkPortBefore->itemText(i) );
-  }
-  ModBuild::writeValue("PBI_MKPORTBEFORE",mkportbefore);
-
-  QString mkportafter;
-  for(int i=0; i<ui->listMkPortAfter->count(); i++){
-    mkportafter.append(" "+ui->listMkPortAfter->itemText(i) );
-  }
-  ModBuild::writeValue("PBI_MKPORTAFTER",mkportafter);
-
-  // -- root permissions --
-  QString requiresroot = "NO";
-  if(ui->checkRequiresRoot->isChecked()){requiresroot="YES";}
-  ModBuild::writeValue("PBI_REQUIRESROOT",requiresroot);
-
-  //Write the new pbi.conf with the changes
-  QString modDir = ui->label_module_selected->text();
-  if( !ModBuild::writePBIconf(modDir) ){
-    //Error writing the new pbi.conf
-    QMessageBox::warning(this,tr("Write Error"),tr("The pbi.conf file in your module could not be overwritten, check the directory permissions and try again."));
-    //Return to the original backend values (re-read pbi.conf)
-    ModBuild::loadPBIconf(ui->label_module_selected->text());
-    //Do NOT clear the new configuration on the GUI!! (User will lose desired changes)
-    return;
-  }
-  //Update the GUI with the new configuration
-  editRefreshPbiConf();
-}
-
-void MainWindow::on_pushAddPortBefore_clicked(){
-  // check to see if the ports tree exists
-  if (!Check_For_Ports(true)){return;}
-
-  // get new port to add
-  QString newport = QFileDialog::getExistingDirectory(this, tr("Select Port"), PORTS_DIR);
-  if(newport.isEmpty()){return;} //action cancelled or closed
-
-  //Add the new port to the list
-  ui->listMkPortBefore->addItem(newport.section("ports/",1,1) );
-}
-
-void MainWindow::on_pushRemovePortBefore_clicked(){
-  //Remove the selected port from the list
-  ui->listMkPortBefore->removeItem(ui->listMkPortBefore->currentIndex());
-}
-
-void MainWindow::on_pushAddPortAfter_clicked(){
-  // check to see if the ports tree exists
-  if (!Check_For_Ports(true)){return;}
-
-  // get new port to add
-  QString newport = QFileDialog::getExistingDirectory(this, tr("Select Port"), PORTS_DIR);
-  if(newport.isEmpty()){return;} //action cancelled or closed
-
-  //Add the new port to the list
-  ui->listMkPortAfter->addItem(newport.section("ports/",1,1) );
-}
-
-void MainWindow::on_pushRemovePortAfter_clicked(){
-  //Remove the selected port from the list
-  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();
-  //Scan the resources directory for all the files inside
-  QDir dir(ui->label_module_selected->text()+"/resources");
-  QFileInfoList fileList = dir.entryInfoList();
-  //Display the files in the GUI
-  for(int i=0; i<fileList.length(); i++){
-    if( fileList[i].fileName().startsWith(".") ){
-      //do nothing for "." and ".." entries (and hidden files/folders)
-    }else if( fileList[i].isDir() ){
-      ui->listCurrentResources->addItem(fileList[i].fileName()); //Add a directory icon here later
-    }else if(fileList[i].fileName().endsWith(".png")){
-      QListWidgetItem *item = new QListWidgetItem( QIcon(fileList[i].absoluteFilePath()), fileList[i].fileName() );
-      ui->listCurrentResources->addItem(item);
-    }else{
-      ui->listCurrentResources->addItem(fileList[i].fileName());
-    }
-  }
-}
-
-void MainWindow::on_pushAddResource_clicked(){
-  //Prompt for the desired file
-  QString resourcepath;
-  resourcepath = QFileDialog::getOpenFileName(this, tr("Select Resource File"), QDir::homePath());
-  if( resourcepath.isEmpty() ){
-    return; //action cancelled
-  }
-  //Add the file to the module
-  if(!ModBuild::addResource(ui->label_module_selected->text(),resourcepath) ){
-    //Error adding the file
-    QMessageBox::warning(this,tr("Write Error"),tr("The resource could not be copied into your module. Please check the file permissions and try again."));
-    return;
-  }
-  //Update the GUI
-  editRefreshResources();
-}
-
-void MainWindow::on_pushRemoveResource_clicked(){
-  //Get the selected filename
-  QString filename = ui->listCurrentResources->currentItem()->text();
-  if(filename.isEmpty()){return;} //nothing selected
-  //Remove the file from the directory
-  QString path = ui->label_module_selected->text() +"/resources/"+filename;
-  if(!QFile::remove(path) ){
-    QMessageBox::warning(this,tr("Remove Error"),tr("The resource could not be removed from your module. Please check the file permissions and try again."));
-    return;
-  }
-  //Refresh the GUI
-  editRefreshResources();
-}
-
-QStringList MainWindow::getPortBinaries(QString port){
-  //port: category/portname (example: www/firefox)
-  QStringList bins;
-  bins = ModBuild::getPortInfo(PORTS_DIR+"/"+port, "binaries");
- 
-  return bins;
-}
-
-void MainWindow::editRefreshEntries(){
-  //Update the Desktop/menu entries editor
-  updateEntryLists();
-  //Update the detected binaries
-  ui->listEntryPortBins->clear();
-  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++){
-    ui->listEntryPortBins->addItem(bins[i]);
-  }
-  //Clear the manual binary box and set it visible
-  ui->lineAlternateBin->clear();
-  ui->lineAlternateBin->setVisible(TRUE);
-  //Get all the .png files in the resources directory and add them to the list
-  QDir dir(ui->label_module_selected->text()+"/resources");
-  QFileInfoList iconlist = dir.entryInfoList(QStringList("*.png"));
-  ui->listEntryIcons->clear();
-  for(int i=0;i<iconlist.length(); i++){
-    ui->listEntryIcons->addItem(QIcon(iconlist[i].absoluteFilePath()),iconlist[i].fileName());
-  }
-  //Add the valid Menu categories to the list
-  ui->listMenuCategories->clear();
-  QStringList menuCats;
-  menuCats <<"AudioVideo"<<"Development"<<"Education"<<"Game"<<"Graphics"<<"Network"<<"Office"<<"Settings"<<"System"<<"Utility";
-  ui->listMenuCategories->addItems(menuCats);
-  //Clear the Entry label box
-  ui->lineEntryName->clear();
-}
-
-void MainWindow::updateEntryLists(){
-  //Update the two lists that show what desktop/menu entries are in the module
-  ui->listDesktopEntries->clear();
-  ui->listMenuEntries->clear();
-  //Scan the xdg-desktop directory for all the files inside
-  QDir dir(ui->label_module_selected->text()+"/xdg-desktop");
-  QFileInfoList fileList = dir.entryInfoList(QStringList("*.desktop"));
-  for(int i=0; i<fileList.length(); i++){ 
-      QString icon = ui->label_module_selected->text()+"/resources/"+ModBuild::getDesktopEntryValue(fileList[i].absoluteFilePath(),"icon",TRUE);
-      if(!(QFile::exists(icon) && icon.endsWith(".png")) ){ icon=""; } //Make sure that icon file exists
-      QListWidgetItem *item = new QListWidgetItem( QIcon(icon),fileList[i].fileName() );
-      ui->listDesktopEntries->addItem(item);
-  }
-  //Scan the xdg-menu directory for all the files inside
-  dir.cd(ui->label_module_selected->text()+"/xdg-menu");
-  fileList.clear();
-  fileList = dir.entryInfoList(QStringList("*.desktop"));
-  for(int i=0; i<fileList.length(); i++){
-      QString icon = ui->label_module_selected->text()+"/resources/"+ModBuild::getMenuEntryValue(fileList[i].absoluteFilePath(),"icon",TRUE);
-      if(!(QFile::exists(icon) && icon.endsWith(".png")) ){ icon=""; } //Make sure that icon file exists
-      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){
-  if(index == 0){ ui->lineAlternateBin->setVisible(TRUE); }
-  else{ ui->lineAlternateBin->setVisible(FALSE); }
-}
-
-void MainWindow::on_pushRemoveDesktopEntry_clicked(){
-  if(ui->listDesktopEntries->currentRow() != -1){ //make sure an item is selected
-    QString filename = ui->listDesktopEntries->currentItem()->text();
-    //Remove the file from the directory
-    QString path = ui->label_module_selected->text() +"/xdg-desktop/"+filename;
-    if(!QFile::remove(path) ){
-      QMessageBox::warning(this,tr("Remove Error"),tr("The desktop entry could not be removed from your module. Please check the file permissions and try again."));
-      return;
-    }
-    //Refresh the GUI
-    updateEntryLists();
-  }
-}
-
-void MainWindow::on_pushRemoveMenuEntry_clicked(){
-  if(ui->listMenuEntries->currentRow() != -1){ //make sure an item is selected
-    QString filename = ui->listMenuEntries->currentItem()->text();
-    //Remove the file from the directory
-    QString path = ui->label_module_selected->text() +"/xdg-menu/"+filename;
-    if(!QFile::remove(path) ){
-      QMessageBox::warning(this,tr("Remove Error"),tr("The menu entry could not be removed from your module. Please check the file permissions and try again."));
-      return;
-    }
-    //Refresh the GUI
-    updateEntryLists();
-  }
-}
-
-void MainWindow::on_pushAddDesktopEntry_clicked(){
-  //Get the user inputs
-  QString modDir = ui->label_module_selected->text();
-  QString bin;
-  if(ui->listEntryPortBins->currentIndex()==0){ bin = ui->lineAlternateBin->text(); }
-  else{ bin = ui->listEntryPortBins->currentText(); }
-  if(bin.isEmpty()){
-    QMessageBox::warning(this,tr("No Binary"),tr("There is no executable selected, please choose one and try again."));
-    return;
-  }
-  QString name = ui->lineEntryName->text();
-  if(name.isEmpty()){
-    QMessageBox::warning(this,tr("No Label"),tr("There is no label for the entry, please choose one and try again."));
-    return;
-  }
-  QString icon = ui->listEntryIcons->currentText();
-  if(icon.isEmpty()){
-    QMessageBox::warning(this,tr("No Icon"),tr("There is no icon for the entry, please add a .png file to the module resources to make it available."));
-    return;
-  }
-
-  //Create the desktop entry
-  if( !ModBuild::makeDesktopEntry(modDir,bin,name,icon) ){
-    QMessageBox::warning(this,tr("Add Error"),tr("The desktop entry could not be created. Please check the directory permissions and try again."));
-    return;
-  }
-  //Refresh the GUI
-  updateEntryLists();
-}
-
-void MainWindow::on_pushAddMenuEntry_clicked(){
-  //Get the user inputs
-  QString modDir = ui->label_module_selected->text();
-  QString bin;
-  if(ui->listEntryPortBins->currentIndex()==0){ bin = ui->lineAlternateBin->text(); }
-  else{ bin = ui->listEntryPortBins->currentText(); }
-  if(bin.isEmpty()){
-    QMessageBox::warning(this,tr("No Binary"),tr("There is no executable selected, please choose one and try again."));
-    return;
-  }
-  QString name = ui->lineEntryName->text();
-  if(name.isEmpty()){
-    QMessageBox::warning(this,tr("No Label"),tr("There is no label for the entry, please choose one and try again."));
-    return;
-  }
-  QString icon = ui->listEntryIcons->currentText();
-  if(icon.isEmpty()){
-    QMessageBox::warning(this,tr("No Icon"),tr("There is no icon for the entry, please add a .png file to the module resources to make it available."));
-    return;
-  }
-  QString category = ui->listMenuCategories->currentText(); //will always be something here
-
-  //Create the menu entry
-  if( !ModBuild::makeMenuEntry(modDir,bin,name,icon,category) ){
-    QMessageBox::warning(this,tr("Add Error"),tr("The menu entry could not be created. Please check the directory permissions and try again."));
-    return;
-  }
-  //Refresh the GUI
-  updateEntryLists();
-}
-
-void MainWindow::editRefreshLinks(){
-  //Update the current links in the file
-  refreshCurrentLinks(TRUE);
-  //Get the binaries available and populate list
-  ui->listLinkBins->clear();
-  ui->listLinkBins->addItem(tr("Custom File"));
-  ui->listLinkBins->setCurrentIndex(0);
-  QStringList bins = getPortBinaries(ModBuild::readValue("PBI_MAKEPORT"));
-  for(int i=0; i<bins.length(); i++){
-    ui->listLinkBins->addItem(bins[i]);
-  }
-  //Clear the manual binary box and set it visible
-  ui->lineLinkBin->clear();
-  ui->lineLinkBin->setVisible(TRUE);
-  //Clear the current Link types
-  ui->lineLinkType->clear();
-  //Display the available link types
-  QStringList types;
-  types <<"binary"<<"linux"<<"keep"<<"replace"<<"nocrash";
-  ui->listLinkTypesAvailable->clear();
-  ui->listLinkTypesAvailable->addItems(types);
-}
-
-void MainWindow::refreshCurrentLinks(bool forceRead){
-  //Read external-links file
-  QString filePath = ui->label_module_selected->text() + "/external-links";
-  //If there is no external-links file, make an empty one
-  if(!QFile::exists(filePath)){
-    qDebug() << "No external-links file detected: Adding one to the module...";
-    ModBuild::makeExternalLinks(ui->label_module_selected->text(), QStringList(""), QStringList("") );
-  }
-  QStringList bins = ModBuild::getExternalLinksValues(filePath,"Target",forceRead);
-  QStringList types = ModBuild::getExternalLinksValues(filePath,"Action");
-  //display info in GUI
-  ui->listCurrentLinks->clear();
-  //Make sure each line is displayed in the format [(bin) : (types)]
-  for(int i=0; i<bins.length(); i++){
-    //qDebug() << bins << types;
-    if(!bins[i].isEmpty() && !types[i].isEmpty()){
-      QString entry = bins[i] + "  :  " + types[i];
-      ui->listCurrentLinks->addItem(entry);
-    }
-  }
-  //Auto-select the first item (if any)
-  if(ui->listCurrentLinks->count() > 0){ ui->listCurrentLinks->setCurrentRow(0);}
-
-}
-
-void MainWindow::on_pushRefreshLinkList_clicked(){
-  refreshCurrentLinks(TRUE);
-}
-
-void MainWindow::on_pushClearLinkChanges_clicked(){
-  editRefreshLinks();
-}
-
-void MainWindow::on_pushAddLink_clicked(){
-  //Get the user inputs
-  QString bin;
-  if(ui->listLinkBins->currentIndex() == 0){bin = ui->lineLinkBin->text(); }
-  else{ bin = ui->listLinkBins->currentText(); }
-  if(bin.isEmpty()){
-    QMessageBox::warning(this,tr("No File"),tr("There is no file selected, please choose one and try again."));
-    return;
-  }
-  QString type = ui->lineLinkType->text();
-  if(type.isEmpty()){
-    QMessageBox::warning(this,tr("No Link Type"),tr("There is no action selected, please add one and try again."));
-    return;
-  }
-
-  //Read the current links from the list
-  QStringList binlist, typelist;
-  for(int i=0; i < ui->listCurrentLinks->count(); i++){
-    QString line = ui->listCurrentLinks->item(i)->text();
-    binlist << line.section(":",0,0,QString::SectionSkipEmpty).simplified();
-    typelist << line.section(":",1,1,QString::SectionSkipEmpty).simplified();
-  }
-  //Add the desired link to the file
-  binlist << bin;
-  typelist << type;
-  if(!ModBuild::makeExternalLinks(ui->label_module_selected->text(),binlist,typelist)){
-    QMessageBox::warning(this,tr("Write Error"),tr("Error writing the external-links file. Please check the permissions on your module and try again."));
-    return;
-  }
-  //Refresh the GUI
-  editRefreshLinks();
-}
-
-void MainWindow::on_pushAddLinkType_clicked(){
-  //get the selected link type
-  QString type = ui->listLinkTypesAvailable->currentText();
-  QString currentTypes = ui->lineLinkType->text();
-  //make sure that type is not already added
-  if(currentTypes.split(",").contains(type)){
-    QMessageBox::warning(this,tr("Duplicate Link Type"),tr("This link type has already been added. Please select a different one."));
-    return;
-  }
-  //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(){
-  //Get the selected line
-  int index = ui->listCurrentLinks->currentRow();
-  if(index == -1){ return; } //nothing selected - do nothing
-  //Read the current links from the list, skipping the line to remove
-  QStringList binlist, typelist;
-  for(int i=0; i<ui->listCurrentLinks->count(); i++){
-    if(i != index){
-      QString line = ui->listCurrentLinks->item(i)->text();
-      binlist << line.section(":",0,0,QString::SectionSkipEmpty).simplified();
-      typelist << line.section(":",1,1,QString::SectionSkipEmpty).simplified();
-    }
-  }
-  //re-write the external-links file
-  if(!ModBuild::makeExternalLinks(ui->label_module_selected->text(),binlist,typelist)){
-    QMessageBox::warning(this,tr("Write Error"),tr("Error writing the external-links file. Please check the permissions on your module and try again."));
-    return;
-  }
-
-  //Refresh the GUI
-  refreshCurrentLinks(TRUE);
-}
-
-void MainWindow::on_listLinkBins_currentIndexChanged(int index){
-  if(index == 0){ ui->lineLinkBin->setVisible(TRUE); }
-  else{ ui->lineLinkBin->setVisible(FALSE); }
-}
-
-//*********************************************************
-//  Scanning utilities to find the appropriate file paths to external programs
-//*********************************************************
-
-void MainWindow::findExternalCommands(){
-  SU_CMD.clear();
-  PBIBUILD_CMD.clear();
-  bool sufound = FALSE;
-  bool pbifound = FALSE;
-  //Setup the commands to look for (lists in order of preference)
-  QStringList suCMD;
-  suCMD << "pc-su" << "qsu" << "gksu" << "kdesu"; //graphical "switch user" utility
-  QString pbiCMD = "pbi_makeport";  //command to create a PBI
-  
-  //Get the current application path
-  QString cpath = QCoreApplication::applicationDirPath();
-  if(cpath.endsWith("/.sbin")){ cpath.chop(6); } //Fix for PBI installation of EasyPBI
-  qDebug() << "Application Path:" << cpath;
-  //Set the search paths
-  QStringList paths;
-  paths <<"/usr/local/bin/"<<"/usr/local/sbin/"<<"/usr/bin/"<<"/usr/sbin/"<<cpath+"/bin/"<<cpath+"/sbin/";
-
-  //Perform the Search
-  for(int i=0; i<paths.length(); i++){
-    //PBI build commands
-    if(!pbifound){
-      if(QFile::exists(paths[i]+pbiCMD)){
-        pbifound = TRUE;
-        PBIBUILD_CMD = paths[i]+pbiCMD;
-      }
-    }
-    //SU utility
-    if(!sufound){
-      for(int j=0; j<suCMD.length(); j++){
-        if(QFile::exists(paths[i]+suCMD[j])){
-      	  sufound = TRUE;
-      	  SU_CMD = paths[i]+suCMD[j];
-      	  break;
-      	}
-      }    	    
-    }
-  }
-  //Report the results
-  if(!SU_CMD.isEmpty()){
-    qDebug() << "Graphical switch user utility found at:"<<SU_CMD;  
-  }else{
-    qDebug() << "No graphical switch user utility found!";
-    qDebug() << " - Utilities searched for:" << suCMD;
-    qDebug() << " - Paths searched:" << paths;
-  }
-  if(!PBIBUILD_CMD.isEmpty()){
-    qDebug() << "pbi_makeport found at:"<<PBIBUILD_CMD;  
-  }else{
-    qDebug() << "pbi_makeport utility could not be found!";
-    qDebug() << " - Paths searched:" << paths;
-  }
-}

Modified: users/ken/EasyPBI2/mainGUI.h
===================================================================
--- users/ken/EasyPBI2/mainGUI.h	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/mainGUI.h	2012-10-02 20:07:17 UTC (rev 19579)
@@ -5,16 +5,13 @@
 #include <QFileDialog>
 #include <QInputDialog>
 #include <QMessageBox>
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
-#include <QNetworkReply>
-#include <QDesktopServices>
 #include <QString>
-#include <QUrl>
 #include <QDir>
 #include <QProcess>
 #include <QTimer>
 #include <QDateTime>
+#include <QRadioButton>
+#include <QMenu>
 
 #ifndef TRUE
 #define TRUE 1
@@ -37,71 +34,23 @@
 
 
 private slots:
-    void Reset_Form();  
-    void on_actionExit_triggered();
-    void on_pushFindIcon_clicked();
-    void on_actionAbout_EasyPBI_triggered();
-    void on_actionAppCafe_Integration_triggered();
-    void on_pushNewModule_clicked();
-    void on_create_button_clicked();
-    void on_port_info_button_clicked();
-    int Check_For_Ports(bool show_warning);
-    void on_actionGet_Ports_triggered();
-    void downloadFinished(QNetworkReply *reply);
-    void extractPT();
-    void updateProgress(qint64,qint64);
-    void on_pushSavePBISettings_clicked();
-    void on_pushChangeOutDir_clicked();
-    void on_pushChangeSigFile_clicked();
-    void on_pushSelectModule_clicked();
-    void on_pushBuildPBI_clicked();
-    void PBIbuildFinished(int,QProcess::ExitStatus);
-    void updatePBIBuild();
-    void killPBIBuild();
-    void buildError(QProcess::ProcessError);
-    void on_pushSaveLog_clicked();
-    void on_pushSelectModuleEdit_clicked();
-    void on_pushOpenPortInfo_clicked();
-    void on_pushPackageModule_clicked();
-    void editRefreshPbiConf();
-    void editSavePbiConf();
-    void on_pushAddPortBefore_clicked();
-    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();
-    void on_pushAddResource_clicked();
-    void on_pushRemoveResource_clicked();
-    void editRefreshEntries();
-    void updateEntryLists();
-    void on_listEntryPortBins_currentIndexChanged(int index);
-    void on_pushRemoveDesktopEntry_clicked();
-    void on_pushRemoveMenuEntry_clicked();
-    void on_pushAddDesktopEntry_clicked();
-    void on_pushAddMenuEntry_clicked();
-    void editRefreshLinks();
-    void refreshCurrentLinks(bool);
-    void on_pushRefreshLinkList_clicked();
-    void on_pushClearLinkChanges_clicked();
-    void on_pushAddLink_clicked();
-    void on_pushAddLinkType_clicked();
-    void on_pushRemoveLink_clicked();
-    void on_listLinkBins_currentIndexChanged(int);
     void slotSingleInstance();
 
 private:
     Ui::MainGUI *ui;
-    void SetupDefaults();
-    void loadPBISettings();
-    void findExternalCommands();
-    QStringList getPortBinaries(QString);
+    QLineEdit *line_module;
+    QRadioButton *radio_module_port, *radio_module_local;
+    QList<QMenu*> menuList;
+    //QMenu *menu_el_options;//, *menu_el_bins;
+    //QMenu *menu_pbi_opts;
     QString PROG_DIR, PORTS_DIR, PORT_SELECTED, PBIOUT_DIR, MODOUT_DIR, CACHE_DIR, PROGVERSION, PBISETTINGS_FILE, DEFAULTICON_FILE;
-    QString SU_CMD, PBIBUILD_CMD, PBI_BUILDING_NOW;
+    QString SU_CMD, PBIBUILD_CMD, PBICREATE_CMD, PBI_BUILDING_NOW;
     bool PBI_BUILD_TERMINATED;
     QProcess *p;
+
+    void SetupDefaults();
+
+
 };
 
 #endif // MAINWINDOW_H

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

Modified: users/ken/EasyPBI2/modBuild.cpp
===================================================================
--- users/ken/EasyPBI2/modBuild.cpp	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/modBuild.cpp	2012-10-02 20:07:17 UTC (rev 19579)
@@ -8,9 +8,11 @@
   5) Make external-links file: makeExternalLinks()
   6) Add resources (icons, etc): addResource()
 */
-QStringList progStruct, mkStruct, serverStruct, menuStruct, desktopStruct, linksStruct, portStruct;
-QString saveMenuFile, saveDesktopFile, saveExternalLinksFile, savePortDir;
 
+ModBuild::ModBuild(QWidget* parent) : QWidget(parent){
+	
+}
+
 bool ModBuild::goodStructs(){
   if( progStruct.isEmpty() || mkStruct.isEmpty() || serverStruct.isEmpty() ){
     return FALSE;

Modified: users/ken/EasyPBI2/modBuild.h
===================================================================
--- users/ken/EasyPBI2/modBuild.h	2012-10-02 16:25:05 UTC (rev 19578)
+++ users/ken/EasyPBI2/modBuild.h	2012-10-02 20:07:17 UTC (rev 19579)
@@ -5,34 +5,40 @@
 #include <QStringList>
 #include <QDir>
 #include <QDebug>
+#include <QWidget>
 
-class ModBuild{
-
+class ModBuild : public QWidget{
+	Q_OBJECT
+	
 private:
-  static bool goodStructs();
-  static bool isGoodPort(QString, bool);
-  static QString assignPortMenuCategory(QString);
-  static int readMakeFile(QString);
-  static bool emptyDirectory(QString);
+  QStringList progStruct, mkStruct, serverStruct, menuStruct, desktopStruct, linksStruct, portStruct;
+  QString saveMenuFile, saveDesktopFile, saveExternalLinksFile, savePortDir;
 
+  bool goodStructs();
+  bool isGoodPort(QString, bool);
+  QString assignPortMenuCategory(QString);
+  int readMakeFile(QString);
+  bool emptyDirectory(QString);
+
 public:
-  static void makeStructs(QString,QString,QString,QString,QString,QString,QString,QString,QString,bool,QString,bool);
-  static bool loadPBIconf(QString);
-  static QString makeModuleDir(QString,QString);
-  static bool writePBIconf(QString);
-  static bool makeMenuEntry(QString,QString,QString,QString,QString);
-  static bool makeDesktopEntry(QString,QString,QString,QString);
-  static bool makeExternalLinks(QString,QStringList,QStringList);
-  static bool createFile(QString,QStringList);
-  static QString readValue(QString);
-  static bool writeValue(QString,QString);
-  static bool addResource(QString,QString);
-  static void compressModule(QString);
-  static QString getFilenameFromPath(QString);
-  static QString getMenuEntryValue(QString, QString, bool forceRead = FALSE);
-  static QString getDesktopEntryValue(QString, QString, bool forceRead = FALSE);
-  static QStringList getExternalLinksValues(QString, QString, bool forceRead = FALSE);
-  static QStringList getPortInfo(QString, QString, bool forceRead = FALSE);
+  ModBuild(QWidget* parent =0);
+  void makeStructs(QString,QString,QString,QString,QString,QString,QString,QString,QString,bool,QString,bool);
+  bool loadPBIconf(QString);
+  QString makeModuleDir(QString,QString);
+  bool writePBIconf(QString);
+  bool makeMenuEntry(QString,QString,QString,QString,QString);
+  bool makeDesktopEntry(QString,QString,QString,QString);
+  bool makeExternalLinks(QString,QStringList,QStringList);
+  bool createFile(QString,QStringList);
+  QString readValue(QString);
+  bool writeValue(QString,QString);
+  bool addResource(QString,QString);
+  void compressModule(QString);
+  QString getFilenameFromPath(QString);
+  QString getMenuEntryValue(QString, QString, bool forceRead = FALSE);
+  QString getDesktopEntryValue(QString, QString, bool forceRead = FALSE);
+  QStringList getExternalLinksValues(QString, QString, bool forceRead = FALSE);
+  QStringList getPortInfo(QString, QString, bool forceRead = FALSE);
   
 
 };



More information about the Commits mailing list