[PC-BSD Commits] r20201 - users/ken/EasyPBI2
svn at pcbsd.org
svn at pcbsd.org
Mon Nov 12 13:35:35 PST 2012
Author: kenmoore
Date: 2012-11-12 21:35:35 +0000 (Mon, 12 Nov 2012)
New Revision: 20201
Modified:
users/ken/EasyPBI2/backend.cpp
users/ken/EasyPBI2/backend.h
users/ken/EasyPBI2/mainGUI.cpp
users/ken/EasyPBI2/mainGUI.h
users/ken/EasyPBI2/modBuild.cpp
users/ken/EasyPBI2/modBuild.h
users/ken/EasyPBI2/newModuleDialog.cpp
users/ken/EasyPBI2/newModuleDialog.h
users/ken/EasyPBI2/newModuleDialog.ui
Log:
Finish a bunch of small work on EasyPBI2. Module packaging is back in, as well as opening freshports and the PC-BSD wiki pages for information. Also finish up the local PBI creation process, so now we can package PBI's from local directories simply.
Modified: users/ken/EasyPBI2/backend.cpp
===================================================================
--- users/ken/EasyPBI2/backend.cpp 2012-11-12 21:24:58 UTC (rev 20200)
+++ users/ken/EasyPBI2/backend.cpp 2012-11-12 21:35:35 UTC (rev 20201)
@@ -1,15 +1,5 @@
#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;
- QDesktopServices::openUrl(QUrl(target_url));
-}
-
QIcon Backend::icon(QString icon){
QString iconPath = ":/trolltech/styles/commonstyle/images/";
icon = icon.toLower();
@@ -34,91 +24,3 @@
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;
- }
-}
-
-QString Backend::findPortsDir(){
- QString ret;
- QStringList portsLocations;
- //Set the locations to search for the ports tree
- portsLocations << "/usr/ports" << QDir::homePath() +"/EasyPBI/ports";
- //Search the locations
- for(int i=0; i<portsLocations.size(); i++){
- if( QDir(portsLocations[i]).exists() ){
- if( QFile::exists(portsLocations[i]+"/COPYRIGHT") ){
- ret=portsLocations[i];
- }
- }
- }
- //now return the findings;
- return ret;
-}
Modified: users/ken/EasyPBI2/backend.h
===================================================================
--- users/ken/EasyPBI2/backend.h 2012-11-12 21:24:58 UTC (rev 20200)
+++ users/ken/EasyPBI2/backend.h 2012-11-12 21:35:35 UTC (rev 20201)
@@ -2,29 +2,19 @@
#define _BACKEND_H
#include <QString>
-#include <QStringList>
-#include <QDir>
#include <QDebug>
#include <QIcon>
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
-#include <QNetworkReply>
-#include <QDesktopServices>
-#include <QUrl>
-#include <QCoreApplication>
+
class Backend{
private:
public:
- static bool portsAvailable();
- static void openPortInfo(QString);
static QIcon icon(QString);
- static void findExternalCommands(QString*,QString*,QString*);
- static QString findPortsDir();
+
};
#endif
Modified: users/ken/EasyPBI2/mainGUI.cpp
===================================================================
--- users/ken/EasyPBI2/mainGUI.cpp 2012-11-12 21:24:58 UTC (rev 20200)
+++ users/ken/EasyPBI2/mainGUI.cpp 2012-11-12 21:35:35 UTC (rev 20201)
@@ -112,7 +112,7 @@
}
void MainGUI::SetupDefaults(){
- qDebug() << "Starting up EasyPBI" << settings->value("version");
+ qDebug() << "Starting up EasyPBI (version "+settings->value("version")+")";
//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") ){
@@ -152,6 +152,7 @@
//Stupid check to make sure that a module is actually loaded
if( currentModule->path().isEmpty() ){
+ ui->actionPackage_Module->setEnabled(FALSE);
if(PBI_BUILDING_NOW.isEmpty() ){ui->toolBox->setEnabled(FALSE); return; }
else{
ui->toolBox->setItemEnabled(0,FALSE);
@@ -159,7 +160,10 @@
ui->toolBox->setCurrentIndex(1);
item="pbibuild";
}
- }else{ ui->toolBox->setEnabled(TRUE); }
+ }else{
+ ui->toolBox->setEnabled(TRUE);
+ ui->actionPackage_Module->setEnabled(TRUE);
+ }
//Figure out the type of module that is loaded
bool isport = radio_module_port->isChecked();
//See if we should refresh everything (default)
@@ -319,19 +323,65 @@
ui->push_addportafter->setEnabled(FALSE);
}
//Check for a 64-bit system to enable the 32-bit build option
- if( settings->check("is64bit") ){ ui->check_build_32->setVisible(TRUE); }
+ if( settings->check("is64bit") && !currentModule->isLocalPBI ){ ui->check_build_32->setVisible(TRUE); }
else{ ui->check_build_32->setVisible(FALSE); ui->check_build_32->setChecked(FALSE); }
+ //Disable tabs that are not used when bulding local PBI's
+ if(currentModule->isLocalPBI){
+ ui->tabWidget->setTabEnabled(5,FALSE);
+ }else{
+ ui->tabWidget->setTabEnabled(5,TRUE);
+ }
+
}
}
/*----------------------------------
MENU OPTIONS
-----------------------------------
*/
+void MainGUI::on_actionGet_Ports_triggered(){
+ qDebug() << "Fetching FreeBSD ports tree not implemented yet";
+}
+
void MainGUI::on_actionExit_triggered(){
qDebug() << "Close EasyPBI requested";
this->close();
}
+void MainGUI::on_actionPackage_Module_triggered(){
+ currentModule->compressModule();
+ QMessageBox::information(this,tr("Success"),tr("A copy of the current module has been successfully packaged within the module directory.") );
+
+}
+
+void MainGUI::on_actionFreeBSD_Ports_triggered(){
+ QString port;
+ if(!line_module->text().isEmpty()){
+ //Get the currently selected port
+ port = currentModule->readValue("makeport");
+ }
+ QString target_url = "http://freshports.org/" + port;
+ QDesktopServices::openUrl(QUrl(target_url));
+
+}
+
+void MainGUI::on_actionPBI_Modules_triggered(){
+ //Open the PC-BSD wiki to the module builders guide
+ QString target_url = "http://wiki.pcbsd.org/index.php/PBI_Module_Builder_Guide";
+ QDesktopServices::openUrl(QUrl(target_url));
+}
+
+void MainGUI::on_actionSummary_triggered(){
+ qDebug() << "Summary not implemented yet";
+}
+
+void MainGUI::on_actionLicense_triggered(){
+ qDebug() << "License not implemented yet";
+}
+
+void MainGUI::on_actionHistory_triggered(){
+ qDebug() << "History not implemented yet";
+}
+
/*----------------------------------
TOOLBAR OPTIONS
-----------------------------------
@@ -1146,13 +1196,10 @@
//check for valid inputs
if( file.isEmpty() || linkto.isEmpty() || opts.isEmpty() ){ return; }
//Add the link
- qDebug() << "Adding the link"<<file<<linkto<<opts.split(",");
currentModule->addExternalLink(file, linkto, opts.split(",") );
//Save the file
- qDebug() << "Saving the file";
currentModule->writeExternalLinks();
//Refresh the UI
- qDebug() << "Refresh the UI";
refreshGUI("external-links");
}
@@ -1251,15 +1298,25 @@
QStringList badFiles = cDir.entryList(filters, QDir::Files | QDir:: NoDotAndDotDot);
for(int i=0; i<badFiles.length(); i++){ cDir.remove(badFiles[i]); }
}
+ if( settings->check("usesignature") && QFile::exists(settings->value("sigfile")) ){ cmd += " --sign " + settings->value("sigfile"); }
- //if(!sigfile.isEmpty()){ cmd += " --sign " + sigfile; }
- qDebug() << "Build PBI command created:"<<cmd;
-
// -- PBI from local directory
}else if(radio_module_local->isChecked() ){
- qDebug() << "Local PBI building is not supported yet";
- return;
+ //get the base command
+ cmd = settings->value("pbi_create");
+ //Setup the ports options if non-standard port location
+ if(settings->value("portsdir") != "/usr/ports"){ cmd += " -d " + settings->value("portsdir"); }
+ //Setup the output directory
+ cmd += " -o "+outdir;
+ //Load the module
+ cmd += " -c "+modDir;
+ //Sign the PBI
+ if( settings->check("usesignature") && QFile::exists(settings->value("sigfile")) ){ cmd += " --sign " + settings->value("sigfile"); }
+ //Now setup the directory to package
+ cmd += " "+ currentModule->readValue("packagedir");
}
+ //Display the command created in hte terminal
+ qDebug() << "Build PBI command created:"<<cmd;
//Receive User verification before beginning build process due to:
// -- long time required, internet connection required, root permissions required
@@ -1274,7 +1331,7 @@
//Add the necessary glue to the command to run the pbi build
cmd.prepend(settings->value("su_cmd")+" \"");
cmd.append("\"");
- qDebug() << "Actual command used:" << cmd;
+ //qDebug() << "Actual command used:" << cmd;
//Setup the displays
ui->push_build_stop->setEnabled(TRUE);
Modified: users/ken/EasyPBI2/mainGUI.h
===================================================================
--- users/ken/EasyPBI2/mainGUI.h 2012-11-12 21:24:58 UTC (rev 20200)
+++ users/ken/EasyPBI2/mainGUI.h 2012-11-12 21:35:35 UTC (rev 20201)
@@ -13,6 +13,7 @@
#include <QRadioButton>
#include <QMenu>
#include <QFileDialog>
+#include <QDesktopServices>
#include "modBuild.h"
#include "backend.h"
@@ -36,9 +37,16 @@
void slotSingleInstance();
void refreshGUI(QString);
//menubar functions
+ void on_actionGet_Ports_triggered();
void on_actionExit_triggered();
void on_actionNew_Module_triggered();
void on_actionLoad_Module_triggered();
+ void on_actionPackage_Module_triggered();
+ void on_actionFreeBSD_Ports_triggered();
+ void on_actionPBI_Modules_triggered();
+ void on_actionSummary_triggered();
+ void on_actionLicense_triggered();
+ void on_actionHistory_triggered();
//editor functions
void slotModTabChanged(int);
//pbi.conf functions
Modified: users/ken/EasyPBI2/modBuild.cpp
===================================================================
--- users/ken/EasyPBI2/modBuild.cpp 2012-11-12 21:24:58 UTC (rev 20200)
+++ users/ken/EasyPBI2/modBuild.cpp 2012-11-12 21:35:35 UTC (rev 20201)
@@ -1,6 +1,6 @@
#include "modBuild.h"
-ModBuild::ModBuild(QWidget* parent) : QWidget(parent){
+ModBuild::ModBuild(){
// --Clear the internal variables--
isPortPBI=FALSE; isLocalPBI=FALSE;
progStruct.clear(); mkStruct.clear(); serverStruct.clear(); portStruct.clear();
Modified: users/ken/EasyPBI2/modBuild.h
===================================================================
--- users/ken/EasyPBI2/modBuild.h 2012-11-12 21:24:58 UTC (rev 20200)
+++ users/ken/EasyPBI2/modBuild.h 2012-11-12 21:35:35 UTC (rev 20201)
@@ -5,12 +5,10 @@
#include <QStringList>
#include <QDir>
#include <QDebug>
-#include <QWidget>
#include <QFile>
#include <QDir>
-class ModBuild : public QWidget{
- Q_OBJECT
+class ModBuild{
private:
//Internal variables
@@ -24,7 +22,7 @@
QString checkYesNo(QString);
public:
- ModBuild(QWidget* parent =0);
+ ModBuild();
~ModBuild();
//Public variables
QStringList currentBins, currentMimeTypes, currentIcons, validMenuCategories;
Modified: users/ken/EasyPBI2/newModuleDialog.cpp
===================================================================
--- users/ken/EasyPBI2/newModuleDialog.cpp 2012-11-12 21:24:58 UTC (rev 20200)
+++ users/ken/EasyPBI2/newModuleDialog.cpp 2012-11-12 21:35:35 UTC (rev 20201)
@@ -11,6 +11,10 @@
ui->setupUi(this); //load the main UI from designer
isAccepted = FALSE;
PORTS_DIR = portsDir;
+ //Setup the dialog icons
+ ui->push_port->setIcon(Backend::icon("load"));
+ ui->push_sources->setIcon(Backend::icon("load"));
+ ui->push_icon->setIcon(Backend::icon("file"));
//Connect up the type changed slot
connect(ui->radio_port, SIGNAL(clicked()), this, SLOT(slotTypeChanged()) );
connect(ui->radio_local, SIGNAL(clicked()), this, SLOT(slotTypeChanged()) );
Modified: users/ken/EasyPBI2/newModuleDialog.h
===================================================================
--- users/ken/EasyPBI2/newModuleDialog.h 2012-11-12 21:24:58 UTC (rev 20200)
+++ users/ken/EasyPBI2/newModuleDialog.h 2012-11-12 21:35:35 UTC (rev 20201)
@@ -7,6 +7,7 @@
#include <QDir>
#include <QMessageBox>
#include "ui_newModuleDialog.h"
+#include "backend.h"
namespace Ui {
Modified: users/ken/EasyPBI2/newModuleDialog.ui
===================================================================
(Binary files differ)
More information about the Commits
mailing list