preferencesAboutTextFull
Ivan Ilin 13 years ago
parent ff90ddf3d7
commit 2a30387e8f
  1. 47
      resources/etc/freezedWidgetWrapper.html
  2. 27
      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() void UBBoardController::startScript()
{ {
freezeW3CWidgets(false); freezeW3CWidgets(true);
} }
void UBBoardController::stopScript() void UBBoardController::stopScript()
@ -2160,16 +2160,15 @@ void UBBoardController::freezeW3CWidgets(bool freeze)
void UBBoardController::freezeW3CWidget(QGraphicsItem *item, bool freeze) void UBBoardController::freezeW3CWidget(QGraphicsItem *item, bool freeze)
{ {
if(item->type() == UBGraphicsW3CWidgetItem::Type) if(item->type() == UBGraphicsW3CWidgetItem::Type)
{ {
QString scriptString; UBGraphicsW3CWidgetItem* item_casted = dynamic_cast<UBGraphicsW3CWidgetItem*>(item);
if (freeze) if (0 == item_casted)
scriptString = "setfreezed(true);"; return;
else
scriptString = "setfreezed(false);"; if (freeze) {
UBGraphicsW3CWidgetItem* item_casted = dynamic_cast<UBGraphicsW3CWidgetItem*>(item); item_casted->widgetWebView()->page()->mainFrame()->setContent(UBW3CWidget::freezedWidgetPage().toAscii());
if (0 == item_casted) } else
return; item_casted->widgetWebView()->loadMainHtml();
item_casted->widgetWebView()->page()->mainFrame()->evaluateJavaScript(scriptString); }
} }
}

@ -29,6 +29,8 @@
#include "core/memcheck.h" #include "core/memcheck.h"
const QString freezedWidgetDefaultContentFilePath = "./etc/freezedWidgetWrapper.html";
bool UBW3CWidget::sTemplateLoaded = false; bool UBW3CWidget::sTemplateLoaded = false;
QMap<QString, QString> UBW3CWidget::sNPAPIWrapperTemplates; QMap<QString, QString> UBW3CWidget::sNPAPIWrapperTemplates;
QString UBW3CWidget::sNPAPIWrappperConfigTemplate; 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() void UBW3CWidget::loadNPAPIWrappersTemplates()
{ {
if (!sTemplateLoaded) if (!sTemplateLoaded)

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

Loading…
Cancel
Save