mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 13:22:53 +02:00
commit
2d545c8adb
8 changed files with 275 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,6 +5,7 @@ CMakeScripts/
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
build/
|
build/
|
||||||
Makefile
|
Makefile
|
||||||
|
*.user
|
||||||
|
|
||||||
# Xcode
|
# Xcode
|
||||||
*.xcodeproj
|
*.xcodeproj
|
||||||
|
|
|
@ -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)
|
||||||
|
|
139
interface/resources/html/interface-welcome-allsvg.html
Normal file
139
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;
|
||||||
|
|
||||||
|
@ -331,6 +332,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() {
|
||||||
|
|
79
interface/src/InfoView.cpp
Normal file
79
interface/src/InfoView.cpp
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
//
|
||||||
|
// 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 <QtWebKitWidgets/QWebFrame>
|
||||||
|
#include <QtWebKit/QWebElement>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
|
#define SETTINGS_VERSION_KEY "info-version"
|
||||||
|
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
||||||
|
|
||||||
|
InfoView::InfoView(bool forced) {
|
||||||
|
_forced = forced;
|
||||||
|
settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
|
||||||
|
|
||||||
|
switchToResourcesParentIfRequired();
|
||||||
|
QString absPath = QFileInfo("resources/html/interface-welcome-allsvg.html").absoluteFilePath();
|
||||||
|
QUrl url = QUrl::fromLocalFile(absPath);
|
||||||
|
|
||||||
|
load(url);
|
||||||
|
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoView::showFirstTime() {
|
||||||
|
new InfoView(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoView::forcedShow() {
|
||||||
|
new InfoView(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InfoView::shouldShow() {
|
||||||
|
if (_forced) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSettings* settings = Application::getInstance()->getSettings();
|
||||||
|
|
||||||
|
QString lastVersion = settings->value(SETTINGS_VERSION_KEY).toString();
|
||||||
|
|
||||||
|
QWebFrame* mainFrame = 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_VERSION_KEY, version);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoView::loaded(bool ok) {
|
||||||
|
if (!ok || !shouldShow()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDesktopWidget* desktop = Application::getInstance()->desktop();
|
||||||
|
QWebFrame* mainFrame = page()->mainFrame();
|
||||||
|
|
||||||
|
int height = mainFrame->contentsSize().height() > desktop->height() ?
|
||||||
|
desktop->height() * MAX_DIALOG_HEIGHT_RATIO :
|
||||||
|
mainFrame->contentsSize().height();
|
||||||
|
|
||||||
|
resize(mainFrame->contentsSize().width(), height);
|
||||||
|
move(desktop->screen()->rect().center() - rect().center());
|
||||||
|
setWindowTitle(title());
|
||||||
|
show();
|
||||||
|
}
|
29
interface/src/InfoView.h
Normal file
29
interface/src/InfoView.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
//
|
||||||
|
// 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 <QtWebKitWidgets/QWebView>
|
||||||
|
|
||||||
|
class InfoView : public QWebView {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static void showFirstTime();
|
||||||
|
static void forcedShow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
InfoView(bool forced);
|
||||||
|
bool _forced;
|
||||||
|
bool shouldShow();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void loaded(bool ok);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* defined(__hifi__InfoView__) */
|
|
@ -24,6 +24,7 @@
|
||||||
#include "PairingHandler.h"
|
#include "PairingHandler.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
#include "InfoView.h"
|
||||||
|
|
||||||
Menu* Menu::_instance = NULL;
|
Menu* Menu::_instance = NULL;
|
||||||
|
|
||||||
|
@ -52,7 +53,15 @@ Menu::Menu() :
|
||||||
Application *appInstance = Application::getInstance();
|
Application *appInstance = Application::getInstance();
|
||||||
|
|
||||||
QMenu* fileMenu = addMenu("File");
|
QMenu* fileMenu = addMenu("File");
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
(addActionToQMenuAndActionHash(fileMenu,
|
||||||
|
MenuOption::AboutApp,
|
||||||
|
0,
|
||||||
|
this,
|
||||||
|
SLOT(aboutApp())))->setMenuRole(QAction::AboutRole);
|
||||||
|
#endif
|
||||||
|
|
||||||
(addActionToQMenuAndActionHash(fileMenu,
|
(addActionToQMenuAndActionHash(fileMenu,
|
||||||
MenuOption::Preferences,
|
MenuOption::Preferences,
|
||||||
Qt::CTRL | Qt::Key_Comma,
|
Qt::CTRL | Qt::Key_Comma,
|
||||||
|
@ -437,6 +446,13 @@ Menu::Menu() :
|
||||||
|
|
||||||
addDisabledActionAndSeparator(developerMenu, "Voxels");
|
addDisabledActionAndSeparator(developerMenu, "Voxels");
|
||||||
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DestructiveAddVoxel);
|
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DestructiveAddVoxel);
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
QMenu* helpMenu = addMenu("Help");
|
||||||
|
QAction* helpAction = helpMenu->addAction(MenuOption::AboutApp);
|
||||||
|
connect(helpAction, SIGNAL(triggered()), this, SLOT(aboutApp()));
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu::~Menu() {
|
Menu::~Menu() {
|
||||||
|
@ -666,6 +682,10 @@ bool Menu::isVoxelModeActionChecked() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Menu::aboutApp() {
|
||||||
|
InfoView::forcedShow();
|
||||||
|
}
|
||||||
|
|
||||||
void Menu::editPreferences() {
|
void Menu::editPreferences() {
|
||||||
Application* applicationInstance = Application::getInstance();
|
Application* applicationInstance = Application::getInstance();
|
||||||
QDialog dialog(applicationInstance->getGLWidget());
|
QDialog dialog(applicationInstance->getGLWidget());
|
||||||
|
|
|
@ -65,6 +65,7 @@ public slots:
|
||||||
void checkForUpdates();
|
void checkForUpdates();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void aboutApp();
|
||||||
void editPreferences();
|
void editPreferences();
|
||||||
void goToDomain();
|
void goToDomain();
|
||||||
void goToLocation();
|
void goToLocation();
|
||||||
|
@ -116,6 +117,7 @@ private:
|
||||||
|
|
||||||
namespace MenuOption {
|
namespace MenuOption {
|
||||||
|
|
||||||
|
const QString AboutApp = "About Interface";
|
||||||
const QString AmbientOcclusion = "Ambient Occlusion";
|
const QString AmbientOcclusion = "Ambient Occlusion";
|
||||||
const QString Avatars = "Avatars";
|
const QString Avatars = "Avatars";
|
||||||
const QString AvatarAsBalls = "Avatar as Balls";
|
const QString AvatarAsBalls = "Avatar as Balls";
|
||||||
|
|
Loading…
Reference in a new issue