| 184 | |
| 185 | |
| 186 | void UBEmbedController::createWidget() |
| 187 | { |
| 188 | int selectedIndex = mTrapFlashUi->flashCombobox->currentIndex(); |
| 189 | |
| 190 | // create widget |
| 191 | QString tempDir = UBFileSystemUtils::createTempDir("EmbedRendering"); |
| 192 | QDir widgetDir(tempDir + "/" + mTrapFlashUi->widgetNameLineEdit->text() + ".wgt"); |
| 193 | |
| 194 | if (widgetDir.exists() && !UBFileSystemUtils::deleteDir(widgetDir.path())) |
| 195 | { |
| 196 | qWarning() << "Cannot delete " << widgetDir.path(); |
| 197 | } |
| 198 | |
| 199 | widgetDir.mkpath(widgetDir.path()); |
| 200 | UBEmbedContent content; |
| 201 | |
| 202 | if (selectedIndex == 0) |
| 203 | { |
| 204 | generateFullPageHtml(mUrl, widgetDir.path(), true); |
| 205 | } |
| 206 | else |
| 207 | { |
| 208 | content = mAvailableContent.at(selectedIndex - 1); |
| 209 | generateHtml(content, widgetDir.path(), true); |
| 210 | } |
| 211 | |
| 212 | generateIcon(widgetDir.path()); |
| 213 | |
| 214 | int heigth = content.height(); |
| 215 | int width = content.width(); |
| 216 | |
| 217 | if (heigth && width) |
| 218 | { |
| 219 | generateConfig(width+20, heigth+20, widgetDir.path()); |
| 220 | } |
| 221 | else |
| 222 | { |
| 223 | generateConfig(800, 600, widgetDir.path()); |
| 224 | } |
| 225 | |
| 226 | importWidgetInLibrary(widgetDir); |
| 227 | |
| 228 | UBFileSystemUtils::deleteDir(tempDir); |
| 229 | |
| 230 | mTrapDialog->hide(); |
| 231 | } |
| 232 | |
| 233 | |
| 234 | void UBEmbedController::importWidgetInLibrary(const QDir& pSourceDir) const |
nothing calls this directly
no test coverage detected