27 #include "../../../../common/StringUtils.h" 28 #include "../../../../common/Version.h" 29 #include "../../../../core/plugin/PluginManager.h" 30 #include "../../utils/DoubleListWidget.h" 31 #include "../../utils/ParameterTableWidget.h" 35 #include "ui_DoubleListWidgetForm.h" 36 #include "ui_ParameterTableWidgetForm.h" 37 #include "ui_PluginBuilderWizardForm.h" 40 #include <QFileDialog> 41 #include <QMessageBox> 43 #include <QVBoxLayout> 47 m_ui(new
Ui::PluginBuilderWizardForm),
53 std::vector<std::string> teModulesNeeded;
54 teModulesNeeded.push_back(
"te.core");
55 teModulesNeeded.push_back(
"te.common");
56 teModulesNeeded.push_back(
"te.plugin");
58 std::vector<std::string> teModules;
59 teModules.push_back(
"te.annotationtext");
60 teModules.push_back(
"te.color");
61 teModules.push_back(
"te.dataaccess");
62 teModules.push_back(
"te.datatype");
63 teModules.push_back(
"te.filter_encoding");
64 teModules.push_back(
"te.da.gdal");
65 teModules.push_back(
"te.geometry");
66 teModules.push_back(
"te.gml");
67 teModules.push_back(
"te.maptools");
68 teModules.push_back(
"te.da.memory");
69 teModules.push_back(
"te.qt.af");
70 teModules.push_back(
"te.raster");
71 teModules.push_back(
"te.rasterprocessing");
72 teModules.push_back(
"te.srs");
73 teModules.push_back(
"te.symbology_encoding");
74 teModules.push_back(
"te.xlinks");
75 teModules.push_back(
"te.xml");
79 licenses.push_back(
"Berkeley Database License");
80 licenses.push_back(
"Boost Software License");
81 licenses.push_back(
"BSD Documentation License");
82 licenses.push_back(
"Eclipse Distribution License");
83 licenses.push_back(
"GPL / GNU General Public License");
84 licenses.push_back(
"Intel Open Source License");
85 licenses.push_back(
"LGPL / GNU Lesser General Public License");
86 licenses.push_back(
"License of Python");
87 licenses.push_back(
"MIT license");
88 licenses.push_back(
"Public Domain");
89 licenses.push_back(
"W3C Software Notice and License");
92 QStringList categList;
93 categList.push_back(
"Cellular Space");
94 categList.push_back(
"Data Access");
95 categList.push_back(
"Data Management");
96 categList.push_back(
"Examples");
97 categList.push_back(
"Language Bindings");
98 categList.push_back(
"Location Base Services");
99 categList.push_back(
"Plugin Managememt");
100 categList.push_back(
"Spatial Analysis");
101 categList.push_back(
"Spatial Operations");
102 categList.push_back(
"Web Services");
106 m_ui->m_pluginLicenseComboBox->addItems(licenses);
108 setButtonText(QWizard::CustomButton1, tr(
"&Settings"));
122 m_moduleDependencies->getForm()->m_rightItemsLabel->setText(tr(
"Required modules for your plugin"));
148 if(currentPage() ==
m_ui->m_basicPluginInfoPage)
152 else if(currentPage() ==
m_ui->m_licenseAndProviderPage)
156 else if(currentPage() ==
m_ui->m_pluginTargetLocationPage)
173 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the Include directory of TerraLib"),
m_curDir);
183 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the Cmake Configure Files directory of TerraLib"),
m_curDir);
193 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the location to create the source code files"),
m_curDir);
203 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the location to create the build files"),
m_curDir);
213 if(
m_ui->m_pluginNameLineEdit->text().isEmpty())
215 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Name not defined."));
220 std::string name =
m_ui->m_pluginNameLineEdit->text().toUtf8().data();
224 int pos =
static_cast<int>(name.rfind(
"_"));
225 std::string nameSpace = name.substr(pos + 1, name.size() - 1);
228 m_ui->m_cPlusPlusNameSpaceLineEdit->setText(nameSpace.c_str());
229 m_ui->m_cPlusPlusMacroExportLineEdit->setText(macroExport.c_str());
232 if(
m_ui->m_pluginVersionLineEdit->text().isEmpty())
234 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Version not defined."));
238 if(
m_ui->m_pluginDisplayTextLineEdit->text().isEmpty())
240 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Display Text not defined."));
244 if(
m_ui->m_pluginSiteLineEdit->text().isEmpty())
246 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Site not defined."));
250 if(
m_ui->m_pluginDescriptionTextEdit->document()->toPlainText().isEmpty())
252 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Description not defined."));
261 if(
m_ui->m_pluginLicenseSiteLineEdit->text().isEmpty())
263 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"License Site not defined."));
267 if(
m_ui->m_pluginProviderNameLineEdit->text().isEmpty())
269 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Name not defined."));
273 if(
m_ui->m_pluginProviderSiteLineEdit->text().isEmpty())
275 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Site not defined."));
279 if(
m_ui->m_pluginProviderEmailLineEdit->text().isEmpty())
281 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Email not defined."));
290 if(
m_ui->m_terralibIncludeDirLineEdit->text().isEmpty())
292 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"TerraLib Include dir not defined."));
296 if(
m_ui->m_terralibCmakeDirLineEdit->text().isEmpty())
298 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"TerraLib Cmake dir not defined."));
302 if(
m_ui->m_sourceCodeLocationLineEdit->text().isEmpty())
304 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Source dir not defined."));
308 if(
m_ui->m_buildLocationLineEdit->text().isEmpty())
310 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Build dir not defined."));
320 pi.
name =
m_ui->m_pluginNameLineEdit->text().toUtf8().data();
321 pi.
display_name =
m_ui->m_pluginDisplayTextLineEdit->text().toUtf8().data();
322 pi.
description =
m_ui->m_pluginDescriptionTextEdit->document()->toPlainText().toUtf8().data();
323 pi.
version =
m_ui->m_pluginVersionLineEdit->text().toUtf8().data();
324 pi.
release =
m_ui->m_pluginReleaseDateTime->text().toUtf8().data();
325 pi.
engine =
m_ui->m_cPlusPlusLanguageRadioButton->text().toUtf8().data();
328 pi.
license_URL=
m_ui->m_pluginLicenseSiteLineEdit->text().toUtf8().data();
329 pi.
site =
m_ui->m_pluginSiteLineEdit->text().toUtf8().data();
336 std::map<std::string, std::string>::iterator it = pluginResMap.begin();
338 while(it != pluginResMap.end())
346 it = pluginParamsMap.begin();
348 while(it != pluginParamsMap.end())
355 pi.
provider.
name =
m_ui->m_pluginProviderNameLineEdit->text().toUtf8().data();
356 pi.
provider.
site =
m_ui->m_pluginProviderSiteLineEdit->text().toUtf8().data();
360 std::string teIncludeDir =
m_ui->m_terralibIncludeDirLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toUtf8().data();
361 std::string teCmakeDir =
m_ui->m_terralibCmakeDirLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toUtf8().data();
362 std::string pluginSrcDir =
m_ui->m_sourceCodeLocationLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toUtf8().data();
363 std::string pluginBuildDir =
m_ui->m_buildLocationLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toUtf8().data();
367 std::string nameSpace;
368 std::string macroExport;
370 if(
m_ui->m_cPlusPlusLanguageRadioButton->isChecked())
372 nameSpace =
m_ui->m_cPlusPlusNameSpaceLineEdit->text().toUtf8().data();
373 macroExport =
m_ui->m_cPlusPlusMacroExportLineEdit->text().toUtf8().data();
378 cmakeWriter.
createCmakeFile(pluginBuildDir, pluginSrcDir, pi.
name, macroExport, teCmakeDir, pi);
390 QMessageBox::information(
this, tr(
"Plugin Builder"), tr(
"Plugin built successfully!"));
std::string license_description
A brief description about the plugin license.
A Qt dialog that allows users to create new plugins based on TerraLib framework.
std::string email
The provider contact e-mail.
std::string engine
The type of plugin execution engine: C++, JAVA, LUA or any other supported engine.
std::pair< std::string, std::string > Resource
static std::string asString()
HostApplication host_application
Information about the host system. May be used to validate the plugin version.
Basic information about a plugin.
std::string Convert2UCase(const std::string &value)
It converts a string to upper case.
std::vector< Resource > resources
The list of resources used by plugin.
std::string site
The provider home page.
This class is used to create the cmake file for the new plugin builded.
std::string description
A brief explanation about the plugin.
std::string display_name
The plugin name to be displayed in a graphical interface.
std::pair< std::string, std::string > Parameter
std::string name
The plugin name: an internal value used to identify the plugin in the system. Must be a unique value...
std::vector< std::string > getPlugins() const
Return the list of plugins managed by PluginManager.
static PluginManager & instance()
Access the singleton.
std::string name
Provider name: may be a person or a company.
std::vector< std::string > dependencies
The list of required plugins in order to launch the plugin.
std::vector< Parameter > parameters
Any configuration parameter that can be informed to plugin (map: parameter-name -> parameter-value)...
std::string license_URL
An URL where someone can find more information on the license.
std::string release
The release date of the plugin. This may be used to identify new versions of a given plugin...
std::string site
An URL pointing to the plugin site.
std::vector< std::string > linked_libraries
The list of linked libraries.
std::string version
The plugin version.
This class is used to create the source files for the new plugin builded.
Provider provider
Information about the plugin provider.