|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
|
|
#include <QDomDocument> |
|
|
|
|
|
|
|
|
|
|
|
#include "UBFeaturesWidget.h" |
|
|
|
#include "UBFeaturesWidget.h" |
|
|
|
#include "domain/UBAbstractWidget.h" |
|
|
|
#include "domain/UBAbstractWidget.h" |
|
|
|
#include "gui/UBThumbnailWidget.h" |
|
|
|
#include "gui/UBThumbnailWidget.h" |
|
|
@ -6,6 +8,7 @@ |
|
|
|
#include "core/UBApplication.h" |
|
|
|
#include "core/UBApplication.h" |
|
|
|
#include "core/UBDownloadManager.h" |
|
|
|
#include "core/UBDownloadManager.h" |
|
|
|
#include "globals/UBGlobals.h" |
|
|
|
#include "globals/UBGlobals.h" |
|
|
|
|
|
|
|
#include "board/UBBoardController.h" |
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) |
|
|
|
UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -82,6 +85,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
pathScene = new QGraphicsScene(this); |
|
|
|
pathScene = new QGraphicsScene(this); |
|
|
|
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
|
|
|
|
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
|
|
|
|
featureProperties = new UBFeatureProperties(this); |
|
|
|
featureProperties = new UBFeatureProperties(this); |
|
|
|
|
|
|
|
webView = new UBFeaturesWebView(this); |
|
|
|
|
|
|
|
|
|
|
|
//layout->addWidget( pathViewer );
|
|
|
|
//layout->addWidget( pathViewer );
|
|
|
|
//pathViewer->show();
|
|
|
|
//pathViewer->show();
|
|
|
@ -91,6 +95,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
|
|
|
|
|
|
|
|
stackedWidget->addWidget( featuresListView ); |
|
|
|
stackedWidget->addWidget( featuresListView ); |
|
|
|
stackedWidget->addWidget( featureProperties ); |
|
|
|
stackedWidget->addWidget( featureProperties ); |
|
|
|
|
|
|
|
stackedWidget->addWidget( webView ); |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
|
currentStackedWidget = ID_LISTVIEW; |
|
|
|
currentStackedWidget = ID_LISTVIEW; |
|
|
|
|
|
|
|
|
|
|
@ -183,6 +188,11 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) |
|
|
|
mActionBar->setCurrentState( IN_FOLDER ); |
|
|
|
mActionBar->setCurrentState( IN_FOLDER ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if ( feature.getType() == FEATURE_SEARCH ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
webView->showElement( feature ); |
|
|
|
|
|
|
|
switchToWebView(); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
featureProperties->showElement( feature ); |
|
|
|
featureProperties->showElement( feature ); |
|
|
@ -307,6 +317,11 @@ void UBFeaturesWidget::switchToProperties() |
|
|
|
currentStackedWidget = ID_PROPERTIES; |
|
|
|
currentStackedWidget = ID_PROPERTIES; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::switchToWebView() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
stackedWidget->setCurrentIndex(ID_WEBVIEW); |
|
|
|
|
|
|
|
currentStackedWidget = ID_WEBVIEW; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
@ -375,6 +390,96 @@ void UBFeaturesListView::dropEvent( QDropEvent *event ) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent) |
|
|
|
|
|
|
|
, mpView(NULL) |
|
|
|
|
|
|
|
, mpWebSettings(NULL) |
|
|
|
|
|
|
|
, mpLayout(NULL) |
|
|
|
|
|
|
|
, mpSankoreAPI(NULL) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET_STYLE_SHEET(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpLayout = new QVBoxLayout(); |
|
|
|
|
|
|
|
setLayout(mpLayout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpView = new QWebView(this); |
|
|
|
|
|
|
|
mpView->setObjectName("SearchEngineView"); |
|
|
|
|
|
|
|
mpSankoreAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene()); |
|
|
|
|
|
|
|
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpWebSettings = QWebSettings::globalSettings(); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); |
|
|
|
|
|
|
|
mpWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpLayout->addWidget(mpView); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(mpView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWebView::~UBFeaturesWebView() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(NULL != mpSankoreAPI){ |
|
|
|
|
|
|
|
delete mpSankoreAPI; |
|
|
|
|
|
|
|
mpSankoreAPI = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(NULL != mpView){ |
|
|
|
|
|
|
|
delete mpView; |
|
|
|
|
|
|
|
mpView = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(NULL != mpLayout){ |
|
|
|
|
|
|
|
delete mpLayout; |
|
|
|
|
|
|
|
mpLayout = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWebView::showElement(const UBFeature &elem) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QString qsWidgetName; |
|
|
|
|
|
|
|
QString path = elem.getFullPath(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString qsConfigPath = QString("%0/config.xml").arg(path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(QFile::exists(qsConfigPath)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QFile f(qsConfigPath); |
|
|
|
|
|
|
|
if(f.open(QIODevice::ReadOnly)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QDomDocument domDoc; |
|
|
|
|
|
|
|
domDoc.setContent(QString(f.readAll())); |
|
|
|
|
|
|
|
QDomElement root = domDoc.documentElement(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QDomNode node = root.firstChild(); |
|
|
|
|
|
|
|
while(!node.isNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(node.toElement().tagName() == "content") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QDomAttr srcAttr = node.toElement().attributeNode("src"); |
|
|
|
|
|
|
|
qsWidgetName = srcAttr.value(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
node = node.nextSibling(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
f.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpView->load(QUrl::fromLocalFile(QString("%0/%1").arg(path).arg(qsWidgetName)));
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWebView::onLoadFinished(bool ok) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(ok && NULL != mpSankoreAPI){ |
|
|
|
|
|
|
|
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : QWidget(parent) |
|
|
|
UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : QWidget(parent) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpButtonLayout(NULL) |
|
|
|
, mpButtonLayout(NULL) |
|
|
|