diff --git a/.gitignore b/.gitignore index 9dc509bc19..b90059c479 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ CMakeScripts/ cmake_install.cmake build/ Makefile +*.user # Xcode *.xcodeproj 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..0b45a4d717 --- /dev/null +++ b/interface/resources/html/interface-welcome-allsvg.html @@ -0,0 +1,139 @@ + +
+ + + 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 b8a9257826..c0484bf7fa 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; @@ -331,6 +332,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..d5f9b1d881 --- /dev/null +++ b/interface/src/InfoView.cpp @@ -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 +#include "Application.h" + +#include +#include +#include + +#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(); +} diff --git a/interface/src/InfoView.h b/interface/src/InfoView.h new file mode 100644 index 0000000000..009587c1d5 --- /dev/null +++ b/interface/src/InfoView.h @@ -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 + +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__) */ diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index b459b3e623..3ee0d985af 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -24,6 +24,7 @@ #include "PairingHandler.h" #include "Menu.h" #include "Util.h" +#include "InfoView.h" Menu* Menu::_instance = NULL; @@ -52,7 +53,15 @@ Menu::Menu() : Application *appInstance = Application::getInstance(); QMenu* fileMenu = addMenu("File"); - + +#ifdef Q_OS_MAC + (addActionToQMenuAndActionHash(fileMenu, + MenuOption::AboutApp, + 0, + this, + SLOT(aboutApp())))->setMenuRole(QAction::AboutRole); +#endif + (addActionToQMenuAndActionHash(fileMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_Comma, @@ -437,6 +446,13 @@ Menu::Menu() : addDisabledActionAndSeparator(developerMenu, "Voxels"); 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() { @@ -666,6 +682,10 @@ bool Menu::isVoxelModeActionChecked() { return false; } +void Menu::aboutApp() { + InfoView::forcedShow(); +} + void Menu::editPreferences() { Application* applicationInstance = Application::getInstance(); QDialog dialog(applicationInstance->getGLWidget()); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index dbd717a24f..e67ea34e22 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -65,6 +65,7 @@ public slots: void checkForUpdates(); private slots: + void aboutApp(); void editPreferences(); void goToDomain(); void goToLocation(); @@ -116,6 +117,7 @@ private: namespace MenuOption { + const QString AboutApp = "About Interface"; const QString AmbientOcclusion = "Ambient Occlusion"; const QString Avatars = "Avatars"; const QString AvatarAsBalls = "Avatar as Balls";