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

svn at pcbsd.org svn at pcbsd.org
Sat Oct 27 17:20:54 PDT 2012


Author: kenmoore
Date: 2012-10-28 00:20:54 +0000 (Sun, 28 Oct 2012)
New Revision: 19989

Modified:
   users/ken/EasyPBI2/mainGUI.cpp
   users/ken/EasyPBI2/mainGUI.h
Log:
Do a bunch of work on getting the XDG-tab working for EasyPBI2, still needs a fair amount of work.



Modified: users/ken/EasyPBI2/mainGUI.cpp
===================================================================
--- users/ken/EasyPBI2/mainGUI.cpp	2012-10-27 18:35:28 UTC (rev 19988)
+++ users/ken/EasyPBI2/mainGUI.cpp	2012-10-28 00:20:54 UTC (rev 19989)
@@ -46,7 +46,12 @@
 	connect(ui->listw_resources, SIGNAL(itemSelectionChanged()), this, SLOT(slotResourceChanged()) );
 	connect(ui->push_resources_savewrapper, SIGNAL(clicked()), this, SLOT(slotResourceScriptSaved()) );
 	// -- XDG entries tab --
+	connect(ui->radio_xdg_desktop,SIGNAL(clicked()),this,SLOT(slotXdgTypeChanged()) );
+	connect(ui->radio_xdg_menu,SIGNAL(clicked()),this,SLOT(slotXdgTypeChanged()) );
+	connect(ui->radio_xdg_mime,SIGNAL(clicked()),this,SLOT(slotXdgTypeChanged()) );
+	connect(ui->list_xdg_files,SIGNAL(itemSelectionChanged()), this, SLOT(slotXdgFileChanged()) );
 	ui->push_xdg_refresh->setIcon(Backend::icon("refresh"));
+	connect(ui->push_xdg_refresh, SIGNAL(clicked()), this, SLOT(slotXdgTypeChanged()) );
 	ui->push_xdg_savechanges->setIcon(Backend::icon("save"));
 	ui->push_xdg_addmime->setIcon(Backend::icon("left"));
 	ui->push_xdg_addmimenew->setIcon(Backend::icon("left"));
@@ -101,6 +106,7 @@
   PBISETTINGS_FILE= PROG_DIR + "/.savedPBISettings.conf";
   DEFAULTICON_FILE= PROG_DIR + "/defaulticon.png";
   PORTS_DIR = "";
+  VALID_MENU_CATS << "AudioVideo" << "Development" << "Education" << "Game" << "Graphics" << "Network" << "Office" << "Settings" << "System";
   
   //Check for EasyPBI directory structure and create it if it is not there
   if( !QDir(PROG_DIR).exists() ){
@@ -267,69 +273,7 @@
     slotResourceChanged();
   }
   if( doall || doeditor || (item == "xdg")){
-    bool isDesktop = ui->radio_xdg_desktop->isChecked();
-    bool isMenu = ui->radio_xdg_menu->isChecked();
-    if(isDesktop){
-	//xdg-desktop entry
-	//Current file
-	ui->label_xdg_name->setVisible(TRUE); ui->line_xdg_name->setVisible(TRUE);
-	ui->label_xdg_exec->setVisible(TRUE); ui->line_xdg_exec->setVisible(TRUE);
-	ui->label_xdg_icon->setVisible(TRUE); ui->list_xdg_icon->setVisible(TRUE);
-	ui->label_xdg_menu->setVisible(FALSE); ui->list_xdg_menu->setVisible(FALSE);
-	ui->check_xdg_nodisplay->setVisible(TRUE);
-	ui->check_xdg_terminal->setVisible(TRUE);
-	ui->push_xdg_addmime->setVisible(TRUE);
-	ui->label_xdg_mimepatterns->setVisible(FALSE); ui->line_xdg_mimepatterns->setVisible(FALSE);
-	//New file
-	ui->label_xdg_namenew->setVisible(TRUE); ui->line_xdg_namenew->setVisible(TRUE);
-	ui->label_xdg_execnew->setVisible(TRUE); ui->line_xdg_execnew->setVisible(TRUE);
-	ui->label_xdg_iconnew->setVisible(TRUE); ui->list_xdg_iconnew->setVisible(TRUE);
-	ui->label_xdg_menunew->setVisible(FALSE); ui->list_xdg_menunew->setVisible(FALSE);
-	ui->check_xdg_nodisplaynew->setVisible(TRUE);
-	ui->check_xdg_terminalnew->setVisible(TRUE);
-	ui->push_xdg_addmimenew->setVisible(TRUE);
-	ui->label_xdg_mimepatternsnew->setVisible(FALSE); ui->line_xdg_mimepatternsnew->setVisible(FALSE);
-    }else if(isMenu){
-	//xdg-menu entry
-	//Current file
-	ui->label_xdg_name->setVisible(TRUE); ui->line_xdg_name->setVisible(TRUE);
-	ui->label_xdg_exec->setVisible(TRUE); ui->line_xdg_exec->setVisible(TRUE);
-	ui->label_xdg_icon->setVisible(TRUE); ui->list_xdg_icon->setVisible(TRUE);
-	ui->label_xdg_menu->setVisible(TRUE); ui->list_xdg_menu->setVisible(TRUE);
-	ui->check_xdg_nodisplay->setVisible(TRUE);
-	ui->check_xdg_terminal->setVisible(TRUE);
-	ui->push_xdg_addmime->setVisible(TRUE);
-	ui->label_xdg_mimepatterns->setVisible(FALSE); ui->line_xdg_mimepatterns->setVisible(FALSE);
-	//New file
-	ui->label_xdg_namenew->setVisible(TRUE); ui->line_xdg_namenew->setVisible(TRUE);
-	ui->label_xdg_execnew->setVisible(TRUE); ui->line_xdg_execnew->setVisible(TRUE);
-	ui->label_xdg_iconnew->setVisible(TRUE); ui->list_xdg_iconnew->setVisible(TRUE);
-	ui->label_xdg_menunew->setVisible(TRUE); ui->list_xdg_menunew->setVisible(TRUE);
-	ui->check_xdg_nodisplaynew->setVisible(TRUE);
-	ui->check_xdg_terminalnew->setVisible(TRUE);
-	ui->push_xdg_addmimenew->setVisible(TRUE);
-	ui->label_xdg_mimepatternsnew->setVisible(FALSE); ui->line_xdg_mimepatternsnew->setVisible(FALSE);
-    }else{
-	//xdg-mime entry
-	//Current file
-	ui->label_xdg_name->setVisible(FALSE); ui->line_xdg_name->setVisible(FALSE);
-	ui->label_xdg_exec->setVisible(FALSE); ui->line_xdg_exec->setVisible(FALSE);
-	ui->label_xdg_icon->setVisible(FALSE); ui->list_xdg_icon->setVisible(FALSE);
-	ui->label_xdg_menu->setVisible(FALSE); ui->list_xdg_menu->setVisible(FALSE);
-	ui->check_xdg_nodisplay->setVisible(FALSE);
-	ui->check_xdg_terminal->setVisible(FALSE);
-	ui->push_xdg_addmime->setVisible(FALSE);
-	ui->label_xdg_mimepatterns->setVisible(TRUE); ui->line_xdg_mimepatterns->setVisible(TRUE);
-	//New file
-	ui->label_xdg_namenew->setVisible(FALSE); ui->line_xdg_namenew->setVisible(FALSE);
-	ui->label_xdg_execnew->setVisible(FALSE); ui->line_xdg_execnew->setVisible(FALSE);
-	ui->label_xdg_iconnew->setVisible(FALSE); ui->list_xdg_iconnew->setVisible(FALSE);
-	ui->label_xdg_menunew->setVisible(FALSE); ui->list_xdg_menunew->setVisible(FALSE);
-	ui->check_xdg_nodisplaynew->setVisible(FALSE);
-	ui->check_xdg_terminalnew->setVisible(FALSE);
-	ui->push_xdg_addmimenew->setVisible(FALSE);
-	ui->label_xdg_mimepatternsnew->setVisible(TRUE); ui->line_xdg_mimepatternsnew->setVisible(TRUE);
-    }
+    slotXdgTypeChanged();
   }
   if( doall || doeditor || (item == "scripts")){
     //nothing to make visible/invisible here
@@ -662,3 +606,149 @@
   //overwrite the resource with the new contents
   ModBuild::createFile(filePath,contents);
 }
+/*------------------------------------------------
+   XDG EDITOR OPTIONS
+  -------------------------------------------------
+*/
+void MainGUI::slotXdgTypeChanged(){
+  //Refresh the icon/menu items
+  ui->list_xdg_icon->clear();
+  ui->list_xdg_icon->addItems(currentModule->currentIcons);
+  ui->list_xdg_menu->clear();
+  ui->list_xdg_menu->addItems(VALID_MENU_CATS);
+  //Update the file list appropriately
+  if(ui->radio_xdg_desktop->isChecked()){
+    //update the files available
+    ui->list_xdg_files->clear();
+    ui->list_xdg_files->addItems(currentModule->filesAvailable("xdg-desktop"));
+    //Set the visibility
+        //Current file
+	ui->label_xdg_name->setVisible(TRUE); ui->line_xdg_name->setVisible(TRUE);
+	ui->label_xdg_exec->setVisible(TRUE); ui->line_xdg_exec->setVisible(TRUE);
+	ui->label_xdg_icon->setVisible(TRUE); ui->list_xdg_icon->setVisible(TRUE);
+	ui->label_xdg_menu->setVisible(FALSE); ui->list_xdg_menu->setVisible(FALSE);
+	ui->check_xdg_nodisplay->setVisible(TRUE);
+	ui->check_xdg_terminal->setVisible(TRUE);
+	ui->push_xdg_addmime->setVisible(TRUE);
+	ui->label_xdg_mimepatterns->setVisible(FALSE); ui->line_xdg_mimepatterns->setVisible(FALSE);
+	//New file
+	ui->label_xdg_namenew->setVisible(TRUE); ui->line_xdg_namenew->setVisible(TRUE);
+	ui->label_xdg_execnew->setVisible(TRUE); ui->line_xdg_execnew->setVisible(TRUE);
+	ui->label_xdg_iconnew->setVisible(TRUE); ui->list_xdg_iconnew->setVisible(TRUE);
+	ui->label_xdg_menunew->setVisible(FALSE); ui->list_xdg_menunew->setVisible(FALSE);
+	ui->check_xdg_nodisplaynew->setVisible(TRUE);
+	ui->check_xdg_terminalnew->setVisible(TRUE);
+	ui->push_xdg_addmimenew->setVisible(TRUE);
+	ui->label_xdg_mimepatternsnew->setVisible(FALSE); ui->line_xdg_mimepatternsnew->setVisible(FALSE);
+  }else if(ui->radio_xdg_menu->isChecked()){
+    //update the files available
+    ui->list_xdg_files->clear();
+    ui->list_xdg_files->addItems(currentModule->filesAvailable("xdg-menu"));	  
+    //Set the visibility
+	//Current file
+	ui->label_xdg_name->setVisible(TRUE); ui->line_xdg_name->setVisible(TRUE);
+	ui->label_xdg_exec->setVisible(TRUE); ui->line_xdg_exec->setVisible(TRUE);
+	ui->label_xdg_icon->setVisible(TRUE); ui->list_xdg_icon->setVisible(TRUE);
+	ui->label_xdg_menu->setVisible(TRUE); ui->list_xdg_menu->setVisible(TRUE);
+	ui->check_xdg_nodisplay->setVisible(TRUE);
+	ui->check_xdg_terminal->setVisible(TRUE);
+	ui->push_xdg_addmime->setVisible(TRUE);
+	ui->label_xdg_mimepatterns->setVisible(FALSE); ui->line_xdg_mimepatterns->setVisible(FALSE);
+	//New file
+	ui->label_xdg_namenew->setVisible(TRUE); ui->line_xdg_namenew->setVisible(TRUE);
+	ui->label_xdg_execnew->setVisible(TRUE); ui->line_xdg_execnew->setVisible(TRUE);
+	ui->label_xdg_iconnew->setVisible(TRUE); ui->list_xdg_iconnew->setVisible(TRUE);
+	ui->label_xdg_menunew->setVisible(TRUE); ui->list_xdg_menunew->setVisible(TRUE);
+	ui->check_xdg_nodisplaynew->setVisible(TRUE);
+	ui->check_xdg_terminalnew->setVisible(TRUE);
+	ui->push_xdg_addmimenew->setVisible(TRUE);
+	ui->label_xdg_mimepatternsnew->setVisible(FALSE); ui->line_xdg_mimepatternsnew->setVisible(FALSE);
+
+  }else if(ui->radio_xdg_mime->isChecked()){
+    //update the files available
+    ui->list_xdg_files->clear();
+    ui->list_xdg_files->addItems(currentModule->filesAvailable("xdg-mime"));	
+    //Set the visibility
+	//Current file
+	ui->label_xdg_name->setVisible(FALSE); ui->line_xdg_name->setVisible(FALSE);
+	ui->label_xdg_exec->setVisible(FALSE); ui->line_xdg_exec->setVisible(FALSE);
+	ui->label_xdg_icon->setVisible(FALSE); ui->list_xdg_icon->setVisible(FALSE);
+	ui->label_xdg_menu->setVisible(FALSE); ui->list_xdg_menu->setVisible(FALSE);
+	ui->check_xdg_nodisplay->setVisible(FALSE);
+	ui->check_xdg_terminal->setVisible(FALSE);
+	ui->push_xdg_addmime->setVisible(FALSE);
+	ui->label_xdg_mimepatterns->setVisible(TRUE); ui->line_xdg_mimepatterns->setVisible(TRUE);
+	//New file
+	ui->label_xdg_namenew->setVisible(FALSE); ui->line_xdg_namenew->setVisible(FALSE);
+	ui->label_xdg_execnew->setVisible(FALSE); ui->line_xdg_execnew->setVisible(FALSE);
+	ui->label_xdg_iconnew->setVisible(FALSE); ui->list_xdg_iconnew->setVisible(FALSE);
+	ui->label_xdg_menunew->setVisible(FALSE); ui->list_xdg_menunew->setVisible(FALSE);
+	ui->check_xdg_nodisplaynew->setVisible(FALSE);
+	ui->check_xdg_terminalnew->setVisible(FALSE);
+	ui->push_xdg_addmimenew->setVisible(FALSE);
+	ui->label_xdg_mimepatternsnew->setVisible(TRUE); ui->line_xdg_mimepatternsnew->setVisible(TRUE);
+	  
+  }
+  //Now update read the currently selected file
+  slotXdgFileChanged();
+}
+
+void MainGUI::slotXdgFileChanged(){
+  qDebug() <<"XDG file changed";	
+  if(ui->list_xdg_files->currentRow() == -1){ return; }
+  //Get the selected file
+  QString file = ui->list_xdg_files->currentItem()->text();
+  if(file.isEmpty()){
+    //Clear the UI lines
+    ui->line_xdg_name->clear();
+    ui->line_xdg_exec->clear();
+    ui->list_xdg_icon->clear();
+    ui->list_xdg_menu->clear();
+    ui->line_xdg_mimetype->clear();
+    ui->line_xdg_mimepatterns->clear();
+    //Now return
+    return; 
+  }
+  //Now setup the UI as appropriate
+  if(ui->radio_xdg_desktop->isChecked()){
+    //Load the file
+    currentModule->loadDesktop(file);
+    //update the file info on the GUI
+    ui->line_xdg_name->setText( currentModule->readValue("desktopname") );
+    ui->line_xdg_exec->setText( currentModule->readValue("desktopexec") ); 
+    ui->line_xdg_mimetype->setText( currentModule->readValue("desktopmimetype") );
+    //comboboxes
+    QString text = currentModule->readValue("desktopicon");
+    int index = ui->list_xdg_icon->findText( text );
+    if(index == -1){ 
+      ui->list_xdg_icon->addItem(text);
+      index = ui->list_xdg_icon->findText( text ); //reset the index value
+    }
+    ui->list_xdg_icon->setCurrentIndex( index );	  
+	
+  }else if(ui->radio_xdg_menu->isChecked()){
+    //Load the file
+    currentModule->loadMenu(file);
+    //update the file info on the GUI
+    ui->line_xdg_name->setText( currentModule->readValue("menuname") );
+    ui->line_xdg_exec->setText( currentModule->readValue("menuexec") ); 
+    ui->line_xdg_mimetype->setText( currentModule->readValue("menumimetype") );
+    //comboboxes
+    QString text = currentModule->readValue("menuicon");
+    int index = ui->list_xdg_icon->findText( text );
+    if(index == -1){ 
+      ui->list_xdg_icon->addItem(text);
+      index = ui->list_xdg_icon->findText( text ); //reset the index value
+    }
+    ui->list_xdg_icon->setCurrentIndex( index );
+    index = ui->list_xdg_menu->findText(currentModule->readValue("menucategories") );
+    if(index == -1){ index = 0; }
+    ui->list_xdg_menu->setCurrentIndex(index);
+    
+  }else if(ui->radio_xdg_mime->isChecked()){
+	  
+  }else{
+	  
+  }
+}
+

Modified: users/ken/EasyPBI2/mainGUI.h
===================================================================
--- users/ken/EasyPBI2/mainGUI.h	2012-10-27 18:35:28 UTC (rev 19988)
+++ users/ken/EasyPBI2/mainGUI.h	2012-10-28 00:20:54 UTC (rev 19989)
@@ -54,6 +54,9 @@
     void on_push_resources_remove_clicked();
     void on_push_resources_mkwrapper_clicked();
     void slotResourceScriptSaved();
+    //XDG functions
+    void slotXdgTypeChanged();
+    void slotXdgFileChanged();
 
 private:
     Ui::MainGUI *ui;
@@ -64,6 +67,7 @@
 
     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;
+    QStringList VALID_MENU_CATS;
     bool PBI_BUILD_TERMINATED;
     QProcess *p;
 



More information about the Commits mailing list