mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-24 18:19:39 +02:00
About menu
added About menu - OS X version only
This commit is contained in:
parent
114cc065bd
commit
330b1cdaf1
4 changed files with 53 additions and 16 deletions
|
@ -16,8 +16,9 @@
|
||||||
|
|
||||||
#define SETTINGS_VERSION_KEY "info-version"
|
#define SETTINGS_VERSION_KEY "info-version"
|
||||||
|
|
||||||
InfoView::InfoView()
|
InfoView::InfoView(bool forced)
|
||||||
{
|
{
|
||||||
|
_forced = forced;
|
||||||
settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
|
settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
@ -33,11 +34,20 @@ InfoView::InfoView()
|
||||||
|
|
||||||
void InfoView::showFirstTime()
|
void InfoView::showFirstTime()
|
||||||
{
|
{
|
||||||
new InfoView();
|
new InfoView(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoView::loaded(bool ok)
|
void InfoView::forcedShow()
|
||||||
{
|
{
|
||||||
|
new InfoView(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InfoView::shouldShow()
|
||||||
|
{
|
||||||
|
if (_forced) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QSettings* settings = Application::getInstance()->getSettings();
|
QSettings* settings = Application::getInstance()->getSettings();
|
||||||
|
|
||||||
QString lastVersion = settings->value(SETTINGS_VERSION_KEY).toString();
|
QString lastVersion = settings->value(SETTINGS_VERSION_KEY).toString();
|
||||||
|
@ -50,8 +60,21 @@ void InfoView::loaded(bool ok)
|
||||||
if (version != QString::null) {
|
if (version != QString::null) {
|
||||||
settings->setValue(SETTINGS_VERSION_KEY, version);
|
settings->setValue(SETTINGS_VERSION_KEY, version);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoView::loaded(bool ok)
|
||||||
|
{
|
||||||
|
if (!shouldShow()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QDesktopWidget* desktop = Application::getInstance()->desktop();
|
QDesktopWidget* desktop = Application::getInstance()->desktop();
|
||||||
|
QWebFrame* mainFrame = page()->mainFrame();
|
||||||
|
|
||||||
int height = mainFrame->contentsSize().height() > desktop->height() ?
|
int height = mainFrame->contentsSize().height() > desktop->height() ?
|
||||||
desktop->height() * 0.9 :
|
desktop->height() * 0.9 :
|
||||||
mainFrame->contentsSize().height();
|
mainFrame->contentsSize().height();
|
||||||
|
@ -60,6 +83,4 @@ void InfoView::loaded(bool ok)
|
||||||
move(desktop->screen()->rect().center() - rect().center());
|
move(desktop->screen()->rect().center() - rect().center());
|
||||||
setWindowTitle(title());
|
setWindowTitle(title());
|
||||||
show();
|
show();
|
||||||
setWindowModality(Qt::WindowModal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,12 @@ class InfoView : public QWebView
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static void showFirstTime();
|
static void showFirstTime();
|
||||||
|
static void forcedShow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InfoView();
|
InfoView(bool forced);
|
||||||
|
bool _forced;
|
||||||
|
bool shouldShow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void loaded(bool ok);
|
void loaded(bool ok);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -53,6 +54,12 @@ Menu::Menu() :
|
||||||
|
|
||||||
QMenu* fileMenu = addMenu("File");
|
QMenu* fileMenu = addMenu("File");
|
||||||
|
|
||||||
|
(addActionToQMenuAndActionHash(fileMenu,
|
||||||
|
MenuOption::AboutApp,
|
||||||
|
0,
|
||||||
|
this,
|
||||||
|
SLOT(aboutApp())))->setMenuRole(QAction::AboutRole);
|
||||||
|
|
||||||
(addActionToQMenuAndActionHash(fileMenu,
|
(addActionToQMenuAndActionHash(fileMenu,
|
||||||
MenuOption::Preferences,
|
MenuOption::Preferences,
|
||||||
Qt::CTRL | Qt::Key_Comma,
|
Qt::CTRL | Qt::Key_Comma,
|
||||||
|
@ -663,6 +670,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