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

svn at pcbsd.org svn at pcbsd.org
Thu Oct 18 09:07:56 PDT 2012


Author: kenmoore
Date: 2012-10-18 16:07:55 +0000 (Thu, 18 Oct 2012)
New Revision: 19768

Modified:
   users/ken/EasyPBI2/main.cpp
   users/ken/EasyPBI2/mainGUI.cpp
   users/ken/EasyPBI2/mainGUI.h
   users/ken/EasyPBI2/mainGUI.ui
Log:
Commit a bunch of additions to EasyPBI2, including status tips to the pbi.conf tab and fix the layout issue with the resources tab.



Modified: users/ken/EasyPBI2/main.cpp
===================================================================
--- users/ken/EasyPBI2/main.cpp	2012-10-18 15:47:59 UTC (rev 19767)
+++ users/ken/EasyPBI2/main.cpp	2012-10-18 16:07:55 UTC (rev 19768)
@@ -11,7 +11,7 @@
     if( a.isRunning() )
       return !(a.sendMessage("show"));
 
-    /*
+    
     QTranslator translator;
     QLocale mylocale;
     QString langCode = mylocale.name();
@@ -20,13 +20,12 @@
     translator.load( QString("EasyPBI_") + langCode, PREFIX + "/share/pcbsd/i18n/" );
     a.installTranslator( &translator );
     qDebug() << "Locale:" << langCode;
-    */
+    
 
     MainGUI w;
     QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance()) );
     w.show();
 
     int retCode = a.exec();
-    qDebug() << "EasyPBI closing with return code: "<<retCode;
     return retCode;
 }

Modified: users/ken/EasyPBI2/mainGUI.cpp
===================================================================
--- users/ken/EasyPBI2/mainGUI.cpp	2012-10-18 15:47:59 UTC (rev 19767)
+++ users/ken/EasyPBI2/mainGUI.cpp	2012-10-18 16:07:55 UTC (rev 19768)
@@ -33,12 +33,13 @@
 	radio_module_local->setEnabled(FALSE);
 	ui->toolBar->addWidget(radio_module_local);
 	//Setup Module Editor
+	connect(ui->tabWidget, SIGNAL(currentChanged(int)),this,SLOT(slotModTabChanged(int)) ); //setup to refresh each tab once it is selected
 	// -- pbi.conf tab --
 	ui->push_change_progdir->setIcon(Backend::icon("load"));
 	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_addmakeopt->setMenu(&menu_addOpt);
 	ui->push_config_save->setIcon(Backend::icon("save"));
 	// -- resources tab --
 	ui->push_resources_savewrapper->setIcon(Backend::icon("save"));
@@ -55,17 +56,17 @@
 	// -- 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]);
+	menu_binList.addAction("No Binaries Detected");
+	ui->push_el_files->setMenu(&menu_binList);
 	
 	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]);
+	menu_elOpts.addAction("binary");
+	menu_elOpts.addAction("linux");
+	menu_elOpts.addAction("keep");
+	menu_elOpts.addAction("replace");
+	menu_elOpts.addAction("nocrash");
+	ui->push_el_filetype->setMenu(&menu_elOpts);
 	//Setup PBI Builder
 	ui->push_build_stop->setIcon(Backend::icon("close"));
 	ui->push_build_save->setIcon(Backend::icon("save"));
@@ -77,7 +78,7 @@
 
 MainGUI::~MainGUI()
 {
-  qDebug() << "Shutting down EasyPBI";
+  qDebug() << "Shutting down EasyPBI normally";
 }
 
 void MainGUI::slotSingleInstance(){
@@ -337,8 +338,8 @@
 
 void MainGUI::on_actionLoad_Module_triggered(){
   qDebug() << "Load Module triggered";
-  //QString modSel = QFileDialog::getExistingDirectory(this, tr("Select Module"), MODOUT_DIR);
-  QString modSel = MODOUT_DIR+"/agame";
+  QString modSel = QFileDialog::getExistingDirectory(this, tr("Select Module"), MODOUT_DIR);
+  //QString modSel = MODOUT_DIR+"/agame";
   qDebug() << "done with dialog";
   if(modSel.isEmpty()){return;} //action cancelled or closed
   bool ok = currentModule->loadModule(modSel);
@@ -350,22 +351,46 @@
   }
 }
 
+void MainGUI::slotModTabChanged(int newtab){
+  switch(newtab){
+    case 0:
+	    refreshGUI("pbiconf"); break;
+    case 1:
+	    refreshGUI("resources"); break;
+    case 2:
+	    refreshGUI("xdg"); break;
+    case 3:
+	    refreshGUI("scripts"); break;
+    case 4:
+	    refreshGUI("external-links"); break;
+    case 5:
+	    refreshGUI("freenas"); break;
+    default:
+	    refreshGUI("editor"); break; //do all the module editor tabs
+  }	  
+}
+
 void MainGUI::slotResourceChanged(){
   //Get the current file selected
   QString cfile;
   if(ui->listw_resources->currentRow() != -1){ cfile = ui->listw_resources->currentItem()->text(); }
+  
   if(cfile.isEmpty()){ //no item selected
     ui->push_resources_savewrapper->setVisible(FALSE);
     ui->text_resources_script->setVisible(FALSE);
     ui->label_resources_description->setVisible(FALSE);
     ui->label_resources_icon->setVisible(FALSE);
-    return; 
-  }else{
+	  
+  }else{ //item selected
     QString path = line_module->text() + "/resources/";
     if( cfile.endsWith(".png") || cfile.endsWith(".jpg") ){
       //Image file, show full size
-      ui->label_resources_icon->setPixmap(QPixmap(path+cfile));
+      QPixmap img(path+cfile);
+      ui->label_resources_icon->setPixmap(img);
       ui->label_resources_icon->setVisible(TRUE);
+      QString desc = QString::number(img.width()) +" x "+QString::number(img.height())+" "+cfile.section(".",-1).toUpper();
+      ui->label_resources_description->setText(desc);
+      ui->label_resources_description->setVisible(TRUE);
       //hide the other widgets
       ui->push_resources_savewrapper->setVisible(FALSE);
       ui->text_resources_script->setVisible(FALSE);

Modified: users/ken/EasyPBI2/mainGUI.h
===================================================================
--- users/ken/EasyPBI2/mainGUI.h	2012-10-18 15:47:59 UTC (rev 19767)
+++ users/ken/EasyPBI2/mainGUI.h	2012-10-18 16:07:55 UTC (rev 19768)
@@ -36,6 +36,7 @@
     void on_actionExit_triggered();
     void on_actionNew_Module_triggered();
     void on_actionLoad_Module_triggered();
+    void slotModTabChanged(int);
     void slotResourceChanged();
     void slotResourceScriptSaved();
 
@@ -44,7 +45,7 @@
     ModBuild *currentModule;
     QLineEdit *line_module;
     QRadioButton *radio_module_port, *radio_module_local;
-    //QList<QMenu*> menuList;
+    QMenu menu_addOpt, menu_binList, menu_elOpts;
 
     QString PROG_DIR, PORTS_DIR, PBIOUT_DIR, MODOUT_DIR, CACHE_DIR, PROGVERSION, PBISETTINGS_FILE, DEFAULTICON_FILE;
     QString SU_CMD, PBIBUILD_CMD, PBICREATE_CMD, PBI_BUILDING_NOW;

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



More information about the Commits mailing list