27 #include "../../../../common/StringUtils.h"
28 #include "../../../../common/Version.h"
29 #include "../../../../plugin/PluginManager.h"
30 #include "../../../../plugin/PluginInfo.h"
31 #include "../../../../plugin/Provider.h"
32 #include "../../utils/DoubleListWidget.h"
33 #include "../../utils/ParameterTableWidget.h"
37 #include "ui_DoubleListWidgetForm.h"
38 #include "ui_ParameterTableWidgetForm.h"
39 #include "ui_PluginBuilderWizardForm.h"
42 #include <QFileDialog>
43 #include <QMessageBox>
45 #include <QVBoxLayout>
49 m_ui(new Ui::PluginBuilderWizardForm),
55 std::vector<std::string> teModulesNeeded;
56 teModulesNeeded.push_back(
"te.common");
57 teModulesNeeded.push_back(
"te.plugin");
59 std::vector<std::string> teModules;
60 teModules.push_back(
"te.annotationtext");
61 teModules.push_back(
"te.color");
62 teModules.push_back(
"te.dataaccess");
63 teModules.push_back(
"te.datatype");
64 teModules.push_back(
"te.filter_encoding");
65 teModules.push_back(
"te.da.gdal");
66 teModules.push_back(
"te.geometry");
67 teModules.push_back(
"te.gml");
68 teModules.push_back(
"te.maptools");
69 teModules.push_back(
"te.da.memory");
70 teModules.push_back(
"te.qt.af");
71 teModules.push_back(
"te.raster");
72 teModules.push_back(
"te.rasterprocessing");
73 teModules.push_back(
"te.srs");
74 teModules.push_back(
"te.symbology_encoding");
75 teModules.push_back(
"te.xlinks");
76 teModules.push_back(
"te.xml");
80 licenses.push_back(
"Berkeley Database License");
81 licenses.push_back(
"Boost Software License");
82 licenses.push_back(
"BSD Documentation License");
83 licenses.push_back(
"Eclipse Distribution License");
84 licenses.push_back(
"GPL / GNU General Public License");
85 licenses.push_back(
"Intel Open Source License");
86 licenses.push_back(
"LGPL / GNU Lesser General Public License");
87 licenses.push_back(
"License of Python");
88 licenses.push_back(
"MIT license");
89 licenses.push_back(
"Public Domain");
90 licenses.push_back(
"W3C Software Notice and License");
93 QStringList categList;
94 categList.push_back(
"Cellular Space");
95 categList.push_back(
"Data Access");
96 categList.push_back(
"Data Management");
97 categList.push_back(
"Examples");
98 categList.push_back(
"Language Bindings");
99 categList.push_back(
"Location Base Services");
100 categList.push_back(
"Plugin Managememt");
101 categList.push_back(
"Spatial Analysis");
102 categList.push_back(
"Spatial Operations");
103 categList.push_back(
"Web Services");
107 m_ui->m_pluginCategoryComboBox->addItems(categList);
108 m_ui->m_pluginLicenseComboBox->addItems(licenses);
110 setButtonText(QWizard::CustomButton1, tr(
"&Settings"));
127 std::vector<std::string> categories;
134 m_moduleDependencies->getForm()->m_rightItemsLabel->setText(tr(
"Required modules for your plugin"));
162 if(currentPage() == m_ui->m_basicPluginInfoPage)
164 return pluginInfoPageCheck();
166 else if(currentPage() == m_ui->m_licenseAndProviderPage)
168 return providerPageCheck();
170 else if(currentPage() == m_ui->m_pluginTargetLocationPage)
187 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the Include directory of TerraLib"), m_curDir);
189 if(m_curDir.isEmpty() ==
false)
191 m_ui->m_terralibIncludeDirLineEdit->setText(m_curDir);
197 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the Cmake Configure Files directory of TerraLib"), m_curDir);
199 if(m_curDir.isEmpty() ==
false)
201 m_ui->m_terralibCmakeDirLineEdit->setText(m_curDir);
207 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the location to create the source code files"), m_curDir);
209 if(m_curDir.isEmpty() ==
false)
211 m_ui->m_sourceCodeLocationLineEdit->setText(m_curDir);
217 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the location to create the build files"), m_curDir);
219 if(m_curDir.isEmpty() ==
false)
221 m_ui->m_buildLocationLineEdit->setText(m_curDir);
227 if(m_ui->m_pluginNameLineEdit->text().isEmpty())
229 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Name not defined."));
234 std::string name = m_ui->m_pluginNameLineEdit->text().toStdString();
235 m_pluginResources->add(
"SharedLibraryName", name);
238 int pos = name.rfind(
"_");
239 std::string nameSpace = name.substr(pos + 1, name.size() - 1);
242 m_ui->m_cPlusPlusNameSpaceLineEdit->setText(nameSpace.c_str());
243 m_ui->m_cPlusPlusMacroExportLineEdit->setText(macroExport.c_str());
246 if(m_ui->m_pluginVersionLineEdit->text().isEmpty())
248 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Version not defined."));
252 if(m_ui->m_pluginDisplayTextLineEdit->text().isEmpty())
254 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Display Text not defined."));
258 if(m_ui->m_pluginSiteLineEdit->text().isEmpty())
260 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Site not defined."));
264 if(m_ui->m_pluginDescriptionTextEdit->document()->toPlainText().isEmpty())
266 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Description not defined."));
275 if(m_ui->m_pluginLicenseSiteLineEdit->text().isEmpty())
277 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"License Site not defined."));
281 if(m_ui->m_pluginProviderNameLineEdit->text().isEmpty())
283 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Name not defined."));
287 if(m_ui->m_pluginProviderSiteLineEdit->text().isEmpty())
289 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Site not defined."));
293 if(m_ui->m_pluginProviderEmailLineEdit->text().isEmpty())
295 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Email not defined."));
304 if(m_ui->m_terralibIncludeDirLineEdit->text().isEmpty())
306 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"TerraLib Include dir not defined."));
310 if(m_ui->m_terralibCmakeDirLineEdit->text().isEmpty())
312 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"TerraLib Cmake dir not defined."));
316 if(m_ui->m_sourceCodeLocationLineEdit->text().isEmpty())
318 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Source dir not defined."));
322 if(m_ui->m_buildLocationLineEdit->text().isEmpty())
324 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Build dir not defined."));
334 pi.
m_name = m_ui->m_pluginNameLineEdit->text().toStdString();
335 pi.
m_displayName = m_ui->m_pluginDisplayTextLineEdit->text().toStdString();
336 pi.
m_description = m_ui->m_pluginDescriptionTextEdit->document()->toPlainText().toStdString();
337 pi.
m_version = m_ui->m_pluginVersionLineEdit->text().toStdString();
338 pi.
m_release = m_ui->m_pluginReleaseDateTime->text().toStdString();
339 pi.
m_engine = m_ui->m_cPlusPlusLanguageRadioButton->text().toStdString();
342 pi.
m_licenseURL = m_ui->m_pluginLicenseSiteLineEdit->text().toStdString();
343 pi.
m_category = m_ui->m_pluginCategoryComboBox->currentText().toStdString();
344 pi.
m_site = m_ui->m_pluginSiteLineEdit->text().toStdString();
351 std::map<std::string, std::string> pluginResMap = m_pluginResources->getMap();
352 std::map<std::string, std::string>::iterator it = pluginResMap.begin();
354 while(it != pluginResMap.end())
361 std::map<std::string, std::string> pluginParamsMap = m_pluginParameters->getMap();
362 it = pluginParamsMap.begin();
364 while(it != pluginParamsMap.end())
373 p.
m_name = m_ui->m_pluginProviderNameLineEdit->text().toStdString();
374 p.
m_site = m_ui->m_pluginProviderSiteLineEdit->text().toStdString();
375 p.
m_email = m_ui->m_pluginProviderEmailLineEdit->text().toStdString();
378 std::string teIncludeDir = m_ui->m_terralibIncludeDirLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toStdString();
379 std::string teCmakeDir = m_ui->m_terralibCmakeDirLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toStdString();
380 std::string pluginSrcDir = m_ui->m_sourceCodeLocationLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toStdString();
381 std::string pluginBuildDir = m_ui->m_buildLocationLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toStdString();
385 std::string nameSpace =
"";
386 std::string macroExport =
"";
388 if(m_ui->m_cPlusPlusLanguageRadioButton->isChecked())
390 nameSpace = m_ui->m_cPlusPlusNameSpaceLineEdit->text().toStdString();
391 macroExport = m_ui->m_cPlusPlusMacroExportLineEdit->text().toStdString();
408 QMessageBox::information(
this, tr(
"Plugin Builder"), tr(
"Plugin built successfully!"));
A Qt dialog that allows users to create new plugins based on TerraLib framework.
std::string m_name
The plugin name: an internal value used to identify the plugin in the system. Must be a unique value...
std::vector< std::string > m_requiredPlugins
The list of required plugins in order to lunch the plugin.
std::vector< std::string > m_requiredModules
The list of required category of plugins in order to lunch the plugin.
std::string m_site
The provider home page.
This struct can be used to describe a given plugin provider.
std::string m_licenseDescription
A brief description about the plugin license.
std::string m_displayName
The plugin name to be displayed in a graphical interface.
static std::string asString()
std::string Convert2UCase(const std::string &value)
It converts a string to upper case.
std::string m_terralibVersion
The TerraLib version this plugin depends on.
This class is used to create the cmake file for the new plugin builded.
std::string m_engine
The type of plugin execution engine: C++, JAVA.
std::string m_version
The plugin version.
std::string m_site
An URL pointing to the plugin site.
static PluginManager & getInstance()
It returns a reference to the singleton instance.
std::vector< std::string > m_requiredPluginCategories
The list of required category of plugins in order to lunch the plugin.
std::string m_email
The provider contact e-mail.
std::string m_release
The release date of the plugin. This may be used to identify new versions of a given plugin...
std::vector< Resource > m_resources
The list of resources used by plugin.
std::vector< Parameter > m_parameters
Any configuration parameter that can be informed to plugin (map: parameter-name -> parameter-value)...
std::pair< std::string, std::string > Resource
std::string m_description
A brief explanation about the plugin.
std::string m_name
Provider name: may be a person or a company.
This class is used to create the source files for the new plugin builded.
The basic information about a plugin.
std::string m_category
The plugin category.
std::pair< std::string, std::string > Parameter
std::string m_licenseURL
An URL where someone can find more information on the license.