You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ovdCAboutPluginDialog.cpp 3.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "ovdCAboutPluginDialog.h"
  2. namespace OpenViBE {
  3. namespace Designer {
  4. bool CAboutPluginDialog::run()
  5. {
  6. if (m_pods == nullptr) { m_pods = m_kernelCtx.getPluginManager().getPluginObjectDescCreating(m_pluginClassID); }
  7. if (!m_pods) { return false; }
  8. GtkBuilder* interface = gtk_builder_new(); // glade_xml_new(m_guiFilename.toASCIIString(), "plugin_about", nullptr);
  9. gtk_builder_add_from_file(interface, m_guiFilename.toASCIIString(), nullptr);
  10. gtk_builder_connect_signals(interface, nullptr);
  11. GtkWidget* dialog = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about"));
  12. GtkWidget* type = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_type"));
  13. GtkWidget* name = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_name"));
  14. GtkWidget* authorName = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_author_name"));
  15. GtkWidget* authorCompanyName = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_company_name"));
  16. GtkWidget* category = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_category"));
  17. GtkWidget* version = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_version"));
  18. GtkWidget* addedSoftwareVersion = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_added_software_version"));
  19. GtkWidget* updatedSoftwareVersion = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-entry_update_software_version"));
  20. GtkWidget* shortDesc = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-textview_short_description"));
  21. GtkWidget* detailedDesc = GTK_WIDGET(gtk_builder_get_object(interface, "plugin_about-textview_detailed_description"));
  22. g_object_unref(interface);
  23. if (m_pods->isDerivedFromClass(OV_ClassId_Plugins_AlgorithmDesc)) { gtk_entry_set_text(GTK_ENTRY(type), "Algorithm"); }
  24. else if (m_pods->isDerivedFromClass(OV_ClassId_Plugins_BoxAlgorithmDesc)) { gtk_entry_set_text(GTK_ENTRY(type), "Box algorithm"); }
  25. else if (m_pods->isDerivedFromClass(OV_ClassId_Plugins_ScenarioImporterDesc)) { gtk_entry_set_text(GTK_ENTRY(type), "Scenario importer"); }
  26. else if (m_pods->isDerivedFromClass(OV_ClassId_Plugins_ScenarioExporterDesc)) { gtk_entry_set_text(GTK_ENTRY(type), "Scenario exporter"); }
  27. GtkTextBuffer* shortDescBuffer = gtk_text_buffer_new(nullptr);
  28. GtkTextBuffer* detailedDescBuffer = gtk_text_buffer_new(nullptr);
  29. gtk_text_buffer_set_text(shortDescBuffer, m_pods->getShortDescription(), -1);
  30. gtk_text_buffer_set_text(detailedDescBuffer, m_pods->getDetailedDescription(), -1);
  31. gtk_entry_set_text(GTK_ENTRY(name), m_pods->getName());
  32. gtk_entry_set_text(GTK_ENTRY(authorName), m_pods->getAuthorName());
  33. gtk_entry_set_text(GTK_ENTRY(authorCompanyName), m_pods->getAuthorCompanyName());
  34. gtk_entry_set_text(GTK_ENTRY(category), m_pods->getCategory());
  35. gtk_entry_set_text(GTK_ENTRY(version), m_pods->getVersion());
  36. gtk_entry_set_text(GTK_ENTRY(addedSoftwareVersion), m_pods->getAddedSoftwareVersion());
  37. gtk_entry_set_text(GTK_ENTRY(updatedSoftwareVersion), m_pods->getUpdatedSoftwareVersion());
  38. gtk_text_view_set_buffer(GTK_TEXT_VIEW(shortDesc), shortDescBuffer);
  39. gtk_text_view_set_buffer(GTK_TEXT_VIEW(detailedDesc), detailedDescBuffer);
  40. g_object_unref(shortDescBuffer);
  41. g_object_unref(detailedDescBuffer);
  42. gtk_dialog_run(GTK_DIALOG(dialog));
  43. gtk_widget_destroy(dialog);
  44. return true;
  45. }
  46. } // namespace Designer
  47. } // namespace OpenViBE