\n";
if (mCurrentWebFrame->url().toString().contains("youtube"))
{
QVariant res = mCurrentWebFrame->evaluateJavaScript("window.document.getElementById('embed_code').value");
//force windowsless mode
htmlContentString += res.toString().replace(">", " wmode='opaque'>");
}
else
{
htmlContentString += "
\n";
}
htmlContentString += "
\n";
htmlContentString += "\n";
htmlContentString += "\n";
if (!pGenerateFile)
{
return htmlContentString;
}
else
{
QString fileName = mTrapFlashUi->widgetNameLineEdit->text();
const QString fullHtmlFileName = pDirPath + "/" + fileName + ".html";
QDir dir(pDirPath);
if (!dir.exists())
{
dir.mkpath(dir.path());
}
QFile widgetHtmlFile(fullHtmlFileName);
if (widgetHtmlFile.exists())
{
widgetHtmlFile.remove(widgetHtmlFile.fileName());
}
if (!widgetHtmlFile.open(QIODevice::WriteOnly))
{
qWarning() << "cannot open file " << widgetHtmlFile.fileName();
return "";
}
QTextStream out(&widgetHtmlFile);
out << htmlContentString;
widgetHtmlFile.close();
return widgetHtmlFile.fileName();
}
}
QString UBTrapFlashController::widgetNameForObject(UBWebKitUtils::HtmlObject pObject)
{
int lastSlashIndex = pObject.source.lastIndexOf("/");
QString result = pObject.source.right(pObject.source.length() - lastSlashIndex);
result = UBFileSystemUtils::cleanName(result);
return result;
}