mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:28:46 +02:00
#19418 Load a local HTML file in a web view within Interface
This commit is contained in:
parent
8fb3068816
commit
fef70098a3
5 changed files with 228 additions and 0 deletions
|
@ -52,6 +52,7 @@ find_package(Qt5Multimedia REQUIRED)
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
find_package(Qt5OpenGL REQUIRED)
|
find_package(Qt5OpenGL REQUIRED)
|
||||||
find_package(Qt5Svg REQUIRED)
|
find_package(Qt5Svg REQUIRED)
|
||||||
|
find_package(Qt5WebKitWidgets REQUIRED)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(MACOSX_BUNDLE_BUNDLE_NAME Interface)
|
set(MACOSX_BUNDLE_BUNDLE_NAME Interface)
|
||||||
|
|
137
interface/resources/html/interface-welcome-allsvg.html
Normal file
137
interface/resources/html/interface-welcome-allsvg.html
Normal file
File diff suppressed because one or more lines are too long
|
@ -65,6 +65,7 @@
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
#include "renderer/ProgramObject.h"
|
#include "renderer/ProgramObject.h"
|
||||||
#include "ui/TextRenderer.h"
|
#include "ui/TextRenderer.h"
|
||||||
|
#include "InfoView.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -328,6 +329,8 @@ void Application::initializeGL() {
|
||||||
#if defined(Q_OS_MAC) && defined(QT_NO_DEBUG)
|
#if defined(Q_OS_MAC) && defined(QT_NO_DEBUG)
|
||||||
Menu::getInstance()->checkForUpdates();
|
Menu::getInstance()->checkForUpdates();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
InfoView::showFirstTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::paintGL() {
|
void Application::paintGL() {
|
||||||
|
|
60
interface/src/InfoView.cpp
Normal file
60
interface/src/InfoView.cpp
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
//
|
||||||
|
// InfoView
|
||||||
|
// hifi
|
||||||
|
//
|
||||||
|
// Created by Stojce Slavkovski on 9/7/13.
|
||||||
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "InfoView.h"
|
||||||
|
#include <QApplication>
|
||||||
|
#include "Application.h"
|
||||||
|
#include <QWebFrame>
|
||||||
|
#include <QWebElement>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#define VIEW_FIXED_WIDTH 808
|
||||||
|
#define SETTINGS_KEY_VERSION "info-version"
|
||||||
|
|
||||||
|
InfoView::InfoView()
|
||||||
|
{
|
||||||
|
this->settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
|
||||||
|
#else
|
||||||
|
QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QUrl url = QUrl::fromLocalFile(resourcesPath + "/html/interface-welcome-allsvg.html");
|
||||||
|
this->load(url);
|
||||||
|
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoView::showFirstTime()
|
||||||
|
{
|
||||||
|
new InfoView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoView::loaded(bool ok)
|
||||||
|
{
|
||||||
|
QSettings* settings = Application::getInstance()->getSettings();
|
||||||
|
|
||||||
|
QString lastVersion = settings->value(SETTINGS_KEY_VERSION).toString();
|
||||||
|
|
||||||
|
|
||||||
|
QWebFrame* mainFrame = this->page()->mainFrame();
|
||||||
|
QWebElement versionTag = mainFrame->findFirstElement("#version");
|
||||||
|
QString version = versionTag.attribute("value");
|
||||||
|
|
||||||
|
if (lastVersion == QString::null || version == QString::null || lastVersion != version) {
|
||||||
|
if (version != QString::null) {
|
||||||
|
settings->setValue(SETTINGS_KEY_VERSION, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setWindowModality(Qt::WindowModal);
|
||||||
|
this->setFixedSize(VIEW_FIXED_WIDTH, this->height());
|
||||||
|
this->setWindowTitle(this->title());
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
|
}
|
27
interface/src/InfoView.h
Normal file
27
interface/src/InfoView.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
//
|
||||||
|
// InfoView.h
|
||||||
|
// hifi
|
||||||
|
//
|
||||||
|
// Created by Stojce Slavkovski on 9/7/13.
|
||||||
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __hifi__InfoView__
|
||||||
|
#define __hifi__InfoView__
|
||||||
|
|
||||||
|
#include <QWebView>
|
||||||
|
|
||||||
|
class InfoView : public QWebView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static void showFirstTime();
|
||||||
|
|
||||||
|
private:
|
||||||
|
InfoView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void loaded(bool ok);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* defined(__hifi__InfoView__) */
|
Loading…
Reference in a new issue