MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / createWidget

Method createWidget

src/web/UBEmbedController.cpp:186–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184
185
186void 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
234void UBEmbedController::importWidgetInLibrary(const QDir& pSourceDir) const

Callers

nothing calls this directly

Calls 5

currentIndexMethod · 0.45
pathMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45
hideMethod · 0.45

Tested by

no test coverage detected