29 #include "../../utils/DoubleListWidget.h"
30 #include "../../utils/ParameterTableWidget.h"
33 #include "../../../../plugin/PluginManager.h"
34 #include "../../../../plugin/PluginInfo.h"
35 #include "../../../../plugin/Provider.h"
36 #include "ui_PluginBuilderWizardForm.h"
37 #include "ui_DoubleListWidgetForm.h"
38 #include "ui_ParameterTableWidgetForm.h"
39 #include "../../../../common/StringUtils.h"
40 #include "../../../../common/Version.h"
43 #include <QtGui/QVBoxLayout>
44 #include <QtGui/QFileDialog>
45 #include <QtGui/QMessageBox>
46 #include <QtCore/QRegExp>
50 m_ui(new Ui::PluginBuilderWizardForm),
56 std::vector<std::string> teModulesNeeded;
57 teModulesNeeded.push_back(
"te.common");
58 teModulesNeeded.push_back(
"te.plugin");
60 std::vector<std::string> teModules;
61 teModules.push_back(
"te.annotationtext");
62 teModules.push_back(
"te.color");
63 teModules.push_back(
"te.dataaccess");
64 teModules.push_back(
"te.datatype");
65 teModules.push_back(
"te.filter_encoding");
66 teModules.push_back(
"te.da.gdal");
67 teModules.push_back(
"te.geometry");
68 teModules.push_back(
"te.gml");
69 teModules.push_back(
"te.maptools");
70 teModules.push_back(
"te.da.memory");
71 teModules.push_back(
"te.qt.af");
72 teModules.push_back(
"te.raster");
73 teModules.push_back(
"te.rasterprocessing");
74 teModules.push_back(
"te.srs");
75 teModules.push_back(
"te.symbology_encoding");
76 teModules.push_back(
"te.xlinks");
77 teModules.push_back(
"te.xml");
81 licenses.push_back(
"Berkeley Database License");
82 licenses.push_back(
"Boost Software License");
83 licenses.push_back(
"BSD Documentation License");
84 licenses.push_back(
"Eclipse Distribution License");
85 licenses.push_back(
"GPL / GNU General Public License");
86 licenses.push_back(
"Intel Open Source License");
87 licenses.push_back(
"LGPL / GNU Lesser General Public License");
88 licenses.push_back(
"License of Python");
89 licenses.push_back(
"MIT license");
90 licenses.push_back(
"Public Domain");
91 licenses.push_back(
"W3C Software Notice and License");
94 QStringList categList;
95 categList.push_back(
"Cellular Space");
96 categList.push_back(
"Data Access");
97 categList.push_back(
"Data Management");
98 categList.push_back(
"Examples");
99 categList.push_back(
"Language Bindings");
100 categList.push_back(
"Location Base Services");
101 categList.push_back(
"Plugin Managememt");
102 categList.push_back(
"Spatial Analysis");
103 categList.push_back(
"Spatial Operations");
104 categList.push_back(
"Web Services");
108 m_ui->m_pluginCategoryComboBox->addItems(categList);
109 m_ui->m_pluginLicenseComboBox->addItems(licenses);
111 setButtonText(QWizard::CustomButton1, tr(
"&Settings"));
119 std::vector<std::string> plugins;
129 std::vector<std::string> categories;
136 m_moduleDependencies->getForm()->m_rightItemsLabel->setText(tr(
"Required modules for your plugin"));
164 if(currentPage() == m_ui->m_basicPluginInfoPage)
166 return pluginInfoPageCheck();
168 else if(currentPage() == m_ui->m_licenseAndProviderPage)
170 return providerPageCheck();
172 else if(currentPage() == m_ui->m_pluginTargetLocationPage)
189 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the Include directory of TerraLib"), m_curDir);
191 if(m_curDir.isEmpty() ==
false)
193 m_ui->m_terralibIncludeDirLineEdit->setText(m_curDir);
199 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the Cmake Configure Files directory of TerraLib"), m_curDir);
201 if(m_curDir.isEmpty() ==
false)
203 m_ui->m_terralibCmakeDirLineEdit->setText(m_curDir);
209 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the location to create the source code files"), m_curDir);
211 if(m_curDir.isEmpty() ==
false)
213 m_ui->m_sourceCodeLocationLineEdit->setText(m_curDir);
219 m_curDir = QFileDialog::getExistingDirectory(
this, tr(
"Select the location to create the build files"), m_curDir);
221 if(m_curDir.isEmpty() ==
false)
223 m_ui->m_buildLocationLineEdit->setText(m_curDir);
229 if(m_ui->m_pluginNameLineEdit->text().isEmpty())
231 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Name not defined."));
236 std::string name = m_ui->m_pluginNameLineEdit->text().toStdString();
237 m_pluginResources->add(
"SharedLibraryName", name);
240 int pos = name.rfind(
"_");
241 std::string nameSpace = name.substr(pos + 1, name.size() - 1);
244 m_ui->m_cPlusPlusNameSpaceLineEdit->setText(nameSpace.c_str());
245 m_ui->m_cPlusPlusMacroExportLineEdit->setText(macroExport.c_str());
248 if(m_ui->m_pluginVersionLineEdit->text().isEmpty())
250 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Version not defined."));
254 if(m_ui->m_pluginDisplayTextLineEdit->text().isEmpty())
256 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Display Text not defined."));
260 if(m_ui->m_pluginSiteLineEdit->text().isEmpty())
262 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Site not defined."));
266 if(m_ui->m_pluginDescriptionTextEdit->document()->toPlainText().isEmpty())
268 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Description not defined."));
277 if(m_ui->m_pluginLicenseSiteLineEdit->text().isEmpty())
279 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"License Site not defined."));
283 if(m_ui->m_pluginProviderNameLineEdit->text().isEmpty())
285 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Name not defined."));
289 if(m_ui->m_pluginProviderSiteLineEdit->text().isEmpty())
291 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Site not defined."));
295 if(m_ui->m_pluginProviderEmailLineEdit->text().isEmpty())
297 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Provider Email not defined."));
306 if(m_ui->m_terralibIncludeDirLineEdit->text().isEmpty())
308 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"TerraLib Include dir not defined."));
312 if(m_ui->m_terralibCmakeDirLineEdit->text().isEmpty())
314 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"TerraLib Cmake dir not defined."));
318 if(m_ui->m_sourceCodeLocationLineEdit->text().isEmpty())
320 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Source dir not defined."));
324 if(m_ui->m_buildLocationLineEdit->text().isEmpty())
326 QMessageBox::warning(
this, tr(
"Plugin Builder"), tr(
"Plugin Build dir not defined."));
336 pi.
m_name = m_ui->m_pluginNameLineEdit->text().toStdString();
337 pi.
m_displayName = m_ui->m_pluginDisplayTextLineEdit->text().toStdString();
338 pi.
m_description = m_ui->m_pluginDescriptionTextEdit->document()->toPlainText().toStdString();
339 pi.
m_version = m_ui->m_pluginVersionLineEdit->text().toStdString();
340 pi.
m_release = m_ui->m_pluginReleaseDateTime->text().toStdString();
341 pi.
m_engine = m_ui->m_cPlusPlusLanguageRadioButton->text().toStdString();
344 pi.
m_licenseURL = m_ui->m_pluginLicenseSiteLineEdit->text().toStdString();
345 pi.
m_category = m_ui->m_pluginCategoryComboBox->currentText().toStdString();
346 pi.
m_site = m_ui->m_pluginSiteLineEdit->text().toStdString();
347 pi.
m_folder = m_ui->m_buildLocationLineEdit->text().toStdString();
353 std::map<std::string, std::string> pluginResMap = m_pluginResources->getMap();
354 std::map<std::string, std::string>::iterator it = pluginResMap.begin();
356 while(it != pluginResMap.end())
363 std::map<std::string, std::string> pluginParamsMap = m_pluginParameters->getMap();
364 it = pluginParamsMap.begin();
366 while(it != pluginParamsMap.end())
375 p.
m_name = m_ui->m_pluginProviderNameLineEdit->text().toStdString();
376 p.
m_site = m_ui->m_pluginProviderSiteLineEdit->text().toStdString();
377 p.
m_email = m_ui->m_pluginProviderEmailLineEdit->text().toStdString();
380 std::string teIncludeDir = m_ui->m_terralibIncludeDirLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toStdString();
381 std::string teCmakeDir = m_ui->m_terralibCmakeDirLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toStdString();
382 std::string pluginSrcDir = m_ui->m_sourceCodeLocationLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toStdString();
383 std::string pluginBuildDir = m_ui->m_buildLocationLineEdit->text().replace(QRegExp(
"\\\\"),
"/").toStdString();
387 std::string nameSpace =
"";
388 std::string macroExport =
"";
390 if(m_ui->m_cPlusPlusLanguageRadioButton->isChecked())
392 nameSpace = m_ui->m_cPlusPlusNameSpaceLineEdit->text().toStdString();
393 macroExport = m_ui->m_cPlusPlusMacroExportLineEdit->text().toStdString();
410 QMessageBox::information(
this, tr(
"Plugin Builder"), tr(
"Plugin built successfully!"));
std::pair< std::string, std::string > Resource
The basic information about a plugin.
This class is used to create the cmake file for the new plugin builded.
std::string m_site
The provider home page.
std::vector< Resource > m_resources
The list of resources used by plugin.
std::vector< std::string > m_requiredPlugins
The list of required plugins in order to lunch the plugin.
std::string m_name
Provider name: may be a person or a company.
virtual bool validateCurrentPage()
void createCmakeFile(const std::string &buildPath, const std::string &sourcePath, const std::string &projName, const std::string exportMacro, const std::string &cmakePath, const te::plugin::PluginInfo &pi)
std::vector< Parameter > m_parameters
Any configuration parameter that can be informed to plugin (map: parameter-name -> parameter-value)...
void createCppFile(const std::string &sourcePath, const std::string &nameSpace, const std::string projName)
std::auto_ptr< DoubleListWidget > m_categoryDependencies
void createPluginInfoFile(const std::string &buildPath, const te::plugin::PluginInfo &pi, const te::plugin::Provider &p)
std::string Convert2UCase(const std::string &value)
It converts a string to upper case.
This struct can be used to describe a given plugin provider.
std::vector< std::string > m_requiredPluginCategories
The list of required category of plugins in order to lunch the plugin.
std::pair< std::string, std::string > Parameter
std::auto_ptr< ParameterTableWidget > m_pluginResources
std::string m_licenseDescription
A brief description about the plugin license.
void onTeIncludeDirButtonClicked()
This class is used to create the source files for the new plugin builded.
std::auto_ptr< DoubleListWidget > m_moduleDependencies
std::string m_licenseURL
An URL where someone can find more information on the license.
A Qt dialog that allows users to create new plugins based on TerraLib framework.
std::string m_description
A brief explanation about the plugin.
std::string m_site
An URL pointing to the plugin site.
void createHeaderFile(const std::string &sourcePath, const std::string &nameSpace)
std::string m_version
The plugin version.
std::auto_ptr< DoubleListWidget > m_pluginDependencies
static std::string asString()
void onPluginBuildDirButtonClicked()
bool pluginInfoPageCheck()
void createConfigFile(const std::string &sourcePath, const std::string &nameSpace, const std::string exportMacro, const std::string projName)
std::string m_terralibVersion
The TerraLib version this plugin depends on.
void onTeCmakeDirButtonClicked()
std::auto_ptr< ParameterTableWidget > m_pluginParameters
std::string m_engine
The type of plugin execution engine: C++, JAVA.
std::string m_release
The release date of the plugin. This may be used to identify new versions of a given plugin...
static PluginManager & getInstance()
It returns a reference to the singleton instance.
std::string m_email
The provider contact e-mail.
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_requiredModules
The list of required category of plugins in order to lunch the plugin.
std::auto_ptr< Ui::PluginBuilderWizardForm > m_ui
std::string m_folder
The plugin folder (where the plugin is installed).
This class is used to create the cmake file for the new plugin builded.
PluginBuilderWizard(QWidget *parent)
void onPluginSrcDirButtonClicked()
std::string m_category
The plugin category.
std::string m_displayName
The plugin name to be displayed in a graphical interface.