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

svn at pcbsd.org svn at pcbsd.org
Thu Mar 15 15:34:18 PDT 2012


Author: kenmoore
Date: 2012-03-15 22:34:18 +0000 (Thu, 15 Mar 2012)
New Revision: 15826

Modified:
   pcbsd-projects/EasyPBI/mainwindow.cpp
   pcbsd-projects/EasyPBI/mainwindow.h
   pcbsd-projects/EasyPBI/mainwindow.ui
   pcbsd-projects/EasyPBI/modBuild.cpp
Log:
Update EasyPBI with desktop/menu editing capability, and most of the external-links editing as well



Modified: pcbsd-projects/EasyPBI/mainwindow.cpp
===================================================================
--- pcbsd-projects/EasyPBI/mainwindow.cpp	2012-03-15 21:03:13 UTC (rev 15825)
+++ pcbsd-projects/EasyPBI/mainwindow.cpp	2012-03-15 22:34:18 UTC (rev 15826)
@@ -25,7 +25,7 @@
     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
+    //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()) );
@@ -59,6 +59,7 @@
 
   //Check for EasyPBI directory structure and create it if it is not there
   if( !QDir(PROG_DIR).exists() ){
+    qDebug() << "Creating the EasyPBI directory in current user's home folder";
     QDir dir;
     dir.root();
     if( !dir.mkdir(PROG_DIR) ){ //Create the program directory
@@ -227,7 +228,6 @@
     home_dir = getenv("HOME");
     chdir(home_dir);
     chdir("EasyPBI/Modules"); //Already exists (checked before now)
-    //mkdir("Modules", 0777);   
 
     // Build Module
     bool success = FALSE;
@@ -258,7 +258,7 @@
         }
         success = TRUE;
         // create tarball of module
-        ModBuild::compressModule(newModulePath);
+        //ModBuild::compressModule(newModulePath);
       } // pbi.conf success
     } //noModulePath check
     QString result;
@@ -576,8 +576,14 @@
 }
 
 void MainWindow::on_tabModuleEditor_currentChanged(int index){
-  if(index == 1){ //Resources Tab
+  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){
+    editRefreshLinks();
   }
 }
 
@@ -596,8 +602,12 @@
   ui->label_module_selected->setText(module_path);
   ui->pushOpenPortInfo->setEnabled(TRUE);
   ui->pushPackageModule->setEnabled(TRUE);
+  ui->tabModuleEditor->setEnabled(TRUE);
+  //Refresh all the tabs
   editRefreshPbiConf();
-  ui->tabModuleEditor->setEnabled(TRUE);
+  editRefreshResources();
+  editRefreshEntries();
+  editRefreshLinks();
 }
 
 
@@ -741,3 +751,337 @@
     }
   }
 }
+
+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;
+  
+  //Run Jesse's pbi.cpp code to find the binaries for a given port
+  // -- create the new data structure
+  PBI_Struct *new_pbi_data;
+  char *argv[] = {"-9", "-s", ""};
+  new_pbi_data = Init_Data();
+  if (! new_pbi_data){
+    QMessageBox::about(this, tr("Error"), tr("Could not set up memory for this module."));
+    return bins;
+  }
+  // get the name, arguments
+  QString portpath = PORTS_DIR+"/"+port;
+  argv[2] = strdup(qPrintable(portpath));
+  Get_Options(new_pbi_data, 3, argv);
+  // confirm port exists
+  bool status = Port_Exists(new_pbi_data);
+  if (! status){
+      qDebug() << "Find Binaries Error: port does not exist:"<<port;
+      Clean_Up(new_pbi_data, TRUE);
+      return bins;
+  }
+  new_pbi_data->console_app = FALSE;
+    Get_Name(new_pbi_data);
+    //Get_Category(new_pbi_data);
+
+  // -- scan for executables and save them in the list
+  BIN_FILE *current_exe;
+  if(Get_Main_Exe_Smart(new_pbi_data) ){
+    bins << new_pbi_data->main_exe;
+    Get_More_Exe(new_pbi_data);
+    current_exe = new_pbi_data->more_exe;
+    while(current_exe){
+      bins << current_exe->path;
+      current_exe = (BIN_FILE *) current_exe->next;
+    }
+  }
+
+  return bins;
+}
+
+void MainWindow::editRefreshEntries(){
+  //Update the Desktop/menu entries editor
+  updateEntryLists();
+  //Update the detected binaries
+  ui->listEntryPortBins->clear();
+  ui->listEntryPortBins->addItem(tr("Set Manually:"));
+  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++){
+      ui->listDesktopEntries->addItem(fileList[i].fileName()); //show icon here at a later date
+  }
+  //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++){
+      ui->listMenuEntries->addItem(fileList[i].fileName()); //show icon here at a later date
+  }
+}
+
+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();
+  //Get the binaries available and populate list
+  ui->listLinkBins->clear();
+  ui->listLinkBins->addItem(tr("Set Manually:"));
+  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(){
+  //Read external-links file
+
+  //display info in GUI
+  ui->listCurrentLinks->clear();
+  //Make sure each line is displayed in the format [(bin) : (types)]
+
+}
+
+void MainWindow::on_pushRefreshLinkList_clicked(){
+  refreshCurrentLinks();
+}
+
+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 Binary"),tr("There is no executable 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 Link type 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;
+  }
+  //add it to the line
+  QString newTypes;
+  if(currentTypes.isEmpty()){ newTypes = type; }
+  else{ newTypes = currentTypes+","+type; }
+  ui->lineLinkType->setText(newTypes);
+}
+
+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
+  editRefreshLinks();
+}
+
+void MainWindow::on_listLinkBins_currentIndexChanged(int index){
+  if(index == 0){ ui->lineLinkBin->setVisible(TRUE); }
+  else{ ui->lineLinkBin->setVisible(FALSE); }
+}
\ No newline at end of file

Modified: pcbsd-projects/EasyPBI/mainwindow.h
===================================================================
--- pcbsd-projects/EasyPBI/mainwindow.h	2012-03-15 21:03:13 UTC (rev 15825)
+++ pcbsd-projects/EasyPBI/mainwindow.h	2012-03-15 22:34:18 UTC (rev 15826)
@@ -72,11 +72,29 @@
     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();
+    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);
 
 private:
     Ui::MainWindow *ui;
     void SetupDefaults();
     void loadPBISettings();
+    QStringList getPortBinaries(QString);
     QString PROG_DIR, PORTS_DIR, PORT_SELECTED, PBIOUT_DIR, MODOUT_DIR, PROGVERSION, PBISETTINGS_FILE;
     QProcess *p;
     PBI_Struct *pbi_data;

Modified: pcbsd-projects/EasyPBI/mainwindow.ui
===================================================================
--- pcbsd-projects/EasyPBI/mainwindow.ui	2012-03-15 21:03:13 UTC (rev 15825)
+++ pcbsd-projects/EasyPBI/mainwindow.ui	2012-03-15 22:34:18 UTC (rev 15826)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>543</width>
-    <height>405</height>
+    <height>436</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -514,7 +514,7 @@
         <item>
          <widget class="QTabWidget" name="tabModuleEditor">
           <property name="currentIndex">
-           <number>1</number>
+           <number>0</number>
           </property>
           <widget class="QWidget" name="tab">
            <attribute name="title">
@@ -524,7 +524,7 @@
             <property name="sizeConstraint">
              <enum>QLayout::SetDefaultConstraint</enum>
             </property>
-            <item row="0" column="2" colspan="2">
+            <item row="0" column="2">
              <widget class="QLineEdit" name="newProgName">
               <property name="sizePolicy">
                <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -625,7 +625,7 @@
               </property>
              </widget>
             </item>
-            <item row="1" column="2" colspan="2">
+            <item row="1" column="2">
              <widget class="QLineEdit" name="newProgWeb">
               <property name="sizePolicy">
                <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -635,7 +635,7 @@
               </property>
              </widget>
             </item>
-            <item row="2" column="2" colspan="2">
+            <item row="2" column="2">
              <widget class="QLineEdit" name="newProgAuth">
               <property name="sizePolicy">
                <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -645,13 +645,6 @@
               </property>
              </widget>
             </item>
-            <item row="12" column="2">
-             <widget class="QPushButton" name="pushSavePbiConf">
-              <property name="text">
-               <string>Save </string>
-              </property>
-             </widget>
-            </item>
             <item row="5" column="1">
              <widget class="QComboBox" name="listMkPortBefore">
               <property name="sizePolicy">
@@ -665,7 +658,7 @@
             <item row="8" column="1">
              <widget class="QComboBox" name="listMkPortAfter"/>
             </item>
-            <item row="9" column="2" colspan="2">
+            <item row="9" column="2">
              <widget class="QLineEdit" name="newMkOpts">
               <property name="sizePolicy">
                <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -675,57 +668,16 @@
               </property>
              </widget>
             </item>
-            <item row="8" column="3">
-             <widget class="QPushButton" name="pushRemovePortAfter">
-              <property name="text">
-               <string>Remove Port</string>
-              </property>
-             </widget>
-            </item>
-            <item row="10" column="2" colspan="2">
+            <item row="10" column="2">
              <widget class="QCheckBox" name="checkRequiresRoot">
               <property name="text">
                <string>Require Root Permissions</string>
               </property>
              </widget>
             </item>
-            <item row="5" column="2">
-             <widget class="QPushButton" name="pushAddPortBefore">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="text">
-               <string>Add Port</string>
-              </property>
-             </widget>
-            </item>
-            <item row="5" column="3">
-             <widget class="QPushButton" name="pushRemovePortBefore">
-              <property name="text">
-               <string>Remove Port</string>
-              </property>
-             </widget>
-            </item>
-            <item row="8" column="2">
-             <widget class="QPushButton" name="pushAddPortAfter">
-              <property name="text">
-               <string>Add Port</string>
-              </property>
-             </widget>
-            </item>
-            <item row="3" column="2" colspan="2">
+            <item row="3" column="2">
              <widget class="QComboBox" name="listNewProgIcon"/>
             </item>
-            <item row="12" column="3">
-             <widget class="QPushButton" name="pushClearChanges">
-              <property name="text">
-               <string>Reset</string>
-              </property>
-             </widget>
-            </item>
             <item row="13" column="2">
              <spacer name="verticalSpacer_2">
               <property name="orientation">
@@ -739,13 +691,73 @@
               </property>
              </spacer>
             </item>
-            <item row="11" column="2" colspan="2">
+            <item row="11" column="2">
              <widget class="Line" name="line_5">
               <property name="orientation">
                <enum>Qt::Horizontal</enum>
               </property>
              </widget>
             </item>
+            <item row="5" column="2">
+             <layout class="QHBoxLayout" name="horizontalLayout_10">
+              <item>
+               <widget class="QPushButton" name="pushAddPortBefore">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="text">
+                 <string>Add Port</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushRemovePortBefore">
+                <property name="text">
+                 <string>Remove Port</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+            <item row="8" column="2">
+             <layout class="QHBoxLayout" name="horizontalLayout_11">
+              <item>
+               <widget class="QPushButton" name="pushAddPortAfter">
+                <property name="text">
+                 <string>Add Port</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushRemovePortAfter">
+                <property name="text">
+                 <string>Remove Port</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+            <item row="12" column="2">
+             <layout class="QHBoxLayout" name="horizontalLayout_12">
+              <item>
+               <widget class="QPushButton" name="pushSavePbiConf">
+                <property name="text">
+                 <string>Save </string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushClearChanges">
+                <property name="text">
+                 <string>Reset</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
            </layout>
           </widget>
           <widget class="QWidget" name="tab_2">
@@ -800,11 +812,344 @@
            <attribute name="title">
             <string>Desktop/Menu Entries</string>
            </attribute>
+           <layout class="QVBoxLayout" name="verticalLayout_7">
+            <item>
+             <layout class="QGridLayout" name="gridLayout_6">
+              <item row="1" column="0">
+               <widget class="QListWidget" name="listDesktopEntries"/>
+              </item>
+              <item row="1" column="1">
+               <widget class="QListWidget" name="listMenuEntries"/>
+              </item>
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_10">
+                <property name="font">
+                 <font>
+                  <weight>75</weight>
+                  <bold>true</bold>
+                 </font>
+                </property>
+                <property name="text">
+                 <string>Current Desktop Entries</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QLabel" name="label_11">
+                <property name="font">
+                 <font>
+                  <weight>75</weight>
+                  <bold>true</bold>
+                 </font>
+                </property>
+                <property name="text">
+                 <string>Current Menu Entries</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <layout class="QHBoxLayout" name="horizontalLayout_6">
+                <item>
+                 <spacer name="horizontalSpacer_6">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushRemoveDesktopEntry">
+                  <property name="text">
+                   <string>Remove Desktop Entry</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_7">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
+              </item>
+              <item row="2" column="1">
+               <layout class="QHBoxLayout" name="horizontalLayout_7">
+                <item>
+                 <spacer name="horizontalSpacer_8">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushRemoveMenuEntry">
+                  <property name="text">
+                   <string>Remove Menu Entry</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_9">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </item>
+            <item>
+             <widget class="Line" name="line_4">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <layout class="QGridLayout" name="gridLayout_7">
+              <item row="2" column="2">
+               <widget class="QPushButton" name="pushAddDesktopEntry">
+                <property name="text">
+                 <string>Add Desktop Entry</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QLineEdit" name="lineEntryName"/>
+              </item>
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_13">
+                <property name="text">
+                 <string>Executable</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QLabel" name="label_20">
+                <property name="text">
+                 <string>Entry Label</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="2">
+               <widget class="QLabel" name="label_21">
+                <property name="text">
+                 <string>Icon</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="2">
+               <widget class="QComboBox" name="listEntryIcons"/>
+              </item>
+              <item row="1" column="3">
+               <widget class="QComboBox" name="listMenuCategories"/>
+              </item>
+              <item row="0" column="3">
+               <widget class="QLabel" name="label_22">
+                <property name="text">
+                 <string>Menu Category</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="3">
+               <widget class="QPushButton" name="pushAddMenuEntry">
+                <property name="text">
+                 <string>Add Menu Entry</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLineEdit" name="lineAlternateBin"/>
+              </item>
+              <item row="1" column="0">
+               <widget class="QComboBox" name="listEntryPortBins"/>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
           <widget class="QWidget" name="tab_4">
            <attribute name="title">
             <string>External-Links</string>
            </attribute>
+           <layout class="QHBoxLayout" name="horizontalLayout_8">
+            <item>
+             <layout class="QVBoxLayout" name="verticalLayout_8">
+              <item>
+               <widget class="QLabel" name="label_23">
+                <property name="font">
+                 <font>
+                  <weight>75</weight>
+                  <bold>true</bold>
+                 </font>
+                </property>
+                <property name="text">
+                 <string>Current Links</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QListWidget" name="listCurrentLinks"/>
+              </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_5">
+                <item>
+                 <widget class="QPushButton" name="pushRemoveLink">
+                  <property name="text">
+                   <string>Remove Link</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushRefreshLinkList">
+                  <property name="text">
+                   <string>Refresh List</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </item>
+            <item>
+             <widget class="Line" name="line_7">
+              <property name="orientation">
+               <enum>Qt::Vertical</enum>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <layout class="QGridLayout" name="gridLayout_8">
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_24">
+                <property name="text">
+                 <string>Binary</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="0" colspan="3">
+               <widget class="Line" name="line_6">
+                <property name="orientation">
+                 <enum>Qt::Horizontal</enum>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="1">
+               <widget class="QPushButton" name="pushClearLinkChanges">
+                <property name="text">
+                 <string>Clear Changes</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="0">
+               <widget class="QPushButton" name="pushAddLink">
+                <property name="text">
+                 <string>Add Link</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLineEdit" name="lineLinkBin"/>
+              </item>
+              <item row="0" column="1">
+               <widget class="QLabel" name="label_25">
+                <property name="text">
+                 <string>Link Type</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QComboBox" name="listLinkBins"/>
+              </item>
+              <item row="3" column="1">
+               <layout class="QHBoxLayout" name="horizontalLayout_9">
+                <item>
+                 <widget class="QComboBox" name="listLinkTypesAvailable"/>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushAddLinkType">
+                  <property name="text">
+                   <string>Add</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+              <item row="7" column="1">
+               <spacer name="verticalSpacer_3">
+                <property name="orientation">
+                 <enum>Qt::Vertical</enum>
+                </property>
+                <property name="sizeHint" stdset="0">
+                 <size>
+                  <width>20</width>
+                  <height>40</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+              <item row="2" column="1">
+               <widget class="QLineEdit" name="lineLinkType">
+                <property name="readOnly">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
           </widget>
          </widget>
         </item>

Modified: pcbsd-projects/EasyPBI/modBuild.cpp
===================================================================
--- pcbsd-projects/EasyPBI/modBuild.cpp	2012-03-15 21:03:13 UTC (rev 15825)
+++ pcbsd-projects/EasyPBI/modBuild.cpp	2012-03-15 22:34:18 UTC (rev 15826)
@@ -6,6 +6,7 @@
   3) Make pbi.conf: writePBIconf()
   4) Make desktop/menu entries: makeDesktopEntry(), makeMenuEntry()
   5) Make external-links file: makeExternalLinks()
+  6) Add resources (icons, etc): addResource()
 */
 QStringList progStruct, mkStruct, serverStruct;
 
@@ -219,7 +220,7 @@
     qDebug() << "Error: Invalid menu category -- menu entry not created";
     return FALSE;
   }
-
+  binary = getFilenameFromPath(binary);
   //Create the filename
   QString fileName = modDir + "/xdg-menu/"+binary+".desktop";
   //Create the contents for a menu entry
@@ -257,7 +258,7 @@
   }
   if(name.isEmpty()){ name = progStruct[0]; }
   if(icon.isEmpty()){ icon = progStruct[3]; }
-
+  binary = getFilenameFromPath(binary);
   //Create the filename
   QString fileName = modDir + "/xdg-desktop/"+binary+".desktop";
   //Create the contents for a menu entry



More information about the Commits mailing list