35 this->m_config = config;
36 page->setTitle(
"Application Properties");
37 page->setFinalPage(
true);
39 nameLbl =
new QLabel(
"Name: ");
40 nameLbl->setWordWrap(
true);
42 nameEdit =
new QLineEdit();
43 nameEdit->setPlaceholderText(
"ApplicationName");
45 descrLbl =
new QLabel(
"Description: ");
46 descrLbl->setWordWrap(
true);
48 descrEdit =
new QLineEdit();
49 descrEdit->setPlaceholderText(
"Description");
51 versionLbl =
new QLabel(
"Version: ");
52 versionLbl->setWordWrap(
true);
53 versionEdit =
new QLineEdit();
54 versionEdit->setPlaceholderText(
"1.0");
56 authLbl =
new QLabel(
"Authors: ");
57 authLbl->setWordWrap(
true);
59 authEdit =
new QLineEdit();
61 fileLbl =
new QLabel(
"File: ");
62 fileLbl->setWordWrap(
true);
64 fileEdit =
new QLineEdit();
65 fileEdit->setReadOnly(
true);
68 folderLbl =
new QLabel(
"Folder: ");
69 folderLbl->setWordWrap(
true);
71 folderCombo =
new QComboBox();
72 folderCombo->setEditable(
false);
73 folderCombo->setDisabled(saveAs);
77 browseBtn =
new QPushButton(
"...");
78 browseBtn->setDisabled(saveAs);
83 auto* layout =
new QGridLayout;
84 layout->addWidget(nameLbl,0,0);
85 layout->addWidget(nameEdit,0,1);
87 layout->addWidget(descrLbl,1,0);
88 layout->addWidget(descrEdit,1,1);
90 layout->addWidget(versionLbl,2,0);
91 layout->addWidget(versionEdit,2,1);
93 layout->addWidget(authLbl,3,0);
94 layout->addWidget(authEdit,3,1);
96 layout->addWidget(fileLbl,4,0);
97 layout->addWidget(fileEdit,4,1);
99 layout->addWidget(folderLbl,5,0);
100 layout->addWidget(folderCombo,5,1);
101 layout->addWidget(browseBtn,5,2);
103 page->setLayout(layout);
105 page->registerField(
"fileName*",fileEdit);
111 if(m_config->
check(
"apppath")){
113 std::string appPaths(m_config->
find(
"apppath").
asString());
118 std::string::size_type pos=appPaths.find(
';');
119 strPath=appPaths.substr(0, pos);
122 strPath = basepath + strPath;
125 if ((strPath.rfind(directorySeparator) == std::string::npos) || (strPath.rfind(directorySeparator) != strPath.size() - 1)) {
126 strPath = strPath + std::string(directorySeparator);
128 folderCombo->addItem(QString(
"%1").arg(strPath.c_str()));
130 if (pos == std::string::npos) {
133 appPaths=appPaths.substr(pos+1);
135 while (appPaths!=
"");
137 if (m_config->
check(
"yarpdatahome")){
138 std::string appPaths(m_config->
find(
"apppath").
asString());
139 std::string homePath=m_config->
find(
"yarpdatahome").
asString();
141 homePath += std::string(directorySeparator) + std::string(
"applications");
143 if (appPaths.find(homePath) == std::string::npos) {
144 folderCombo->addItem(QString(
"%1").arg(homePath.c_str()));
148 if(folderCombo->count() <= 0){
149 folderCombo->addItem(QDir::homePath());
153 connect(browseBtn,
SIGNAL(clicked()),
this,SLOT(onBrowse()));
154 connect(nameEdit,
SIGNAL(textChanged(QString)),
this,SLOT(onNameChanged(QString)));
155 connect(folderCombo,
SIGNAL(activated(
int)),
this, SLOT(onSwitchCall()));
236 if (nameEdit->text().isEmpty()){
237 name = nameEdit->placeholderText();
239 name = nameEdit->text();
241 if (descrEdit->text().isEmpty()){
246 if (versionEdit->text().isEmpty()){
247 version = versionEdit->placeholderText();
254 QMessageBox::StandardButton reply;
255 reply = QMessageBox::question(
this,
"Quit",
"The file chosen already exists, do you want to overwrite it?", QMessageBox::Yes|QMessageBox::No);
256 if (reply == QMessageBox::No)