diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 009f7d46ec..08ae5816a5 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -52,6 +52,7 @@ find_package(Qt5Multimedia REQUIRED) find_package(Qt5Network REQUIRED) find_package(Qt5OpenGL REQUIRED) find_package(Qt5Svg REQUIRED) +find_package(Qt5WebKitWidgets REQUIRED) if (APPLE) set(MACOSX_BUNDLE_BUNDLE_NAME Interface) diff --git a/interface/resources/html/interface-welcome-allsvg.html b/interface/resources/html/interface-welcome-allsvg.html new file mode 100644 index 0000000000..c61d457bb9 --- /dev/null +++ b/interface/resources/html/interface-welcome-allsvg.html @@ -0,0 +1,137 @@ + + + + Welcome to Interface + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + What you can do with Hifi so far: + + + Move around. + + + Listen and talk. + + + Build something. + + + Connect devices. + + + Look around. + + + Move around with WASD + & fly up or down with E & C + + + Use your best headphones + and microphone for high fidelity + audio. Look for the blue balls + around the universe – walk up + to them (they become people + as you get closer) and talk! + + + Refer to the Tools menu for + available tools. Each tool is a + ‘mode’ that enables actions through + clicking. Press the V key to enter + voxel ‘add mode’ where you’ll be + able to click to add a voxel. + + + Have an Oculus Rift or a + Leap Motion? Gyros in your + headset? An Xbox Kinect? + We have experimental + features for them all. + + + Use two fingers to look + around via the trackpad + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A + + + C + + + D + + + S + + + WE + + + + + + path d="M41.277,11.18 L46.981,19.663 L35.579,19.663 L41.277,11.18" id="Fill-12" fill="#FFFFFF" sketch:type="MSShapeGroup"> + + + + + diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index eefbc69d25..168adbc30c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -65,6 +65,7 @@ #include "devices/OculusManager.h" #include "renderer/ProgramObject.h" #include "ui/TextRenderer.h" +#include "InfoView.h" using namespace std; @@ -328,6 +329,8 @@ void Application::initializeGL() { #if defined(Q_OS_MAC) && defined(QT_NO_DEBUG) Menu::getInstance()->checkForUpdates(); #endif + + InfoView::showFirstTime(); } void Application::paintGL() { diff --git a/interface/src/InfoView.cpp b/interface/src/InfoView.cpp new file mode 100644 index 0000000000..591149c619 --- /dev/null +++ b/interface/src/InfoView.cpp @@ -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 +#include "Application.h" +#include +#include +#include + +#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(); + } +} diff --git a/interface/src/InfoView.h b/interface/src/InfoView.h new file mode 100644 index 0000000000..184793055f --- /dev/null +++ b/interface/src/InfoView.h @@ -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 + +class InfoView : public QWebView +{ + Q_OBJECT +public: + static void showFirstTime(); + +private: + InfoView(); + +private slots: + void loaded(bool ok); +}; + +#endif /* defined(__hifi__InfoView__) */