preferencesAboutTextFull
Ivan Ilin 13 years ago
parent ff90ddf3d7
commit 2a30387e8f
  1. 47
      resources/etc/freezedWidgetWrapper.html
  2. 13
      src/board/UBBoardController.cpp
  3. 25
      src/domain/UBW3CWidget.cpp
  4. 2
      src/domain/UBW3CWidget.h

@ -0,0 +1,47 @@
<html>
<head>
<title>ololo</title>
<style>
html,body{
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
div{
text-align: center;
border: 5px #ccc outset;
}
</style>
<script type="text/javascript">
window.onload = function(){
var div = document.getElementById("freezed");
div.style.width = getDocWidth() - 10;
div.style.height = getDocHeight()/2 - 10;
div.style.paddingTop = getDocHeight()/2
function getDocHeight() {
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
}
function getDocWidth() {
var D = document;
return Math.max(
Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
Math.max(D.body.clientWidth, D.documentElement.clientWidth)
);
}
}
</script>
</head>
<body>
<div id="freezed">Widget freezed.</div>
</body>
</html>

@ -365,7 +365,7 @@ void UBBoardController::connectToolbar()
void UBBoardController::startScript()
{
freezeW3CWidgets(false);
freezeW3CWidgets(true);
}
void UBBoardController::stopScript()
@ -2162,14 +2162,13 @@ void UBBoardController::freezeW3CWidget(QGraphicsItem *item, bool freeze)
{
if(item->type() == UBGraphicsW3CWidgetItem::Type)
{
QString scriptString;
if (freeze)
scriptString = "setfreezed(true);";
else
scriptString = "setfreezed(false);";
UBGraphicsW3CWidgetItem* item_casted = dynamic_cast<UBGraphicsW3CWidgetItem*>(item);
if (0 == item_casted)
return;
item_casted->widgetWebView()->page()->mainFrame()->evaluateJavaScript(scriptString);
if (freeze) {
item_casted->widgetWebView()->page()->mainFrame()->setContent(UBW3CWidget::freezedWidgetPage().toAscii());
} else
item_casted->widgetWebView()->loadMainHtml();
}
}

@ -29,6 +29,8 @@
#include "core/memcheck.h"
const QString freezedWidgetDefaultContentFilePath = "./etc/freezedWidgetWrapper.html";
bool UBW3CWidget::sTemplateLoaded = false;
QMap<QString, QString> UBW3CWidget::sNPAPIWrapperTemplates;
QString UBW3CWidget::sNPAPIWrappperConfigTemplate;
@ -416,6 +418,29 @@ QString UBW3CWidget::createHtmlWrapperInDir(const QString& html, const QDir& pDi
}
QString UBW3CWidget::freezedWidgetPage()
{
static QString defaultcontent;
if (defaultcontent.isNull()) {
QFile wrapperFile(freezedWidgetDefaultContentFilePath);
if (!wrapperFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "can't open wrapper file " + freezedWidgetDefaultContentFilePath;
defaultcontent = "";
} else {
QByteArray arr = wrapperFile.readAll();
if (!arr.isEmpty()) {
defaultcontent = QString(arr);
} else {
qDebug() << "content of " + freezedWidgetDefaultContentFilePath + "is empty";
defaultcontent = "";
}
}
}
return defaultcontent;
}
void UBW3CWidget::loadNPAPIWrappersTemplates()
{
if (!sTemplateLoaded)

@ -48,6 +48,8 @@ class UBW3CWidget : public UBAbstractWidget
static QString createHtmlWrapperInDir(const QString& html, const QDir& pDir,
const QSize& sizeHint, const QString& pName);
static QString freezedWidgetPage();
static bool hasNPAPIWrapper(const QString& pMimeType);
class PreferenceValue

Loading…
Cancel
Save