mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +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"
|
||||
|
||||
InfoView::InfoView()
|
||||
InfoView::InfoView(bool forced)
|
||||
{
|
||||
_forced = forced;
|
||||
settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
@ -33,11 +34,20 @@ InfoView::InfoView()
|
|||
|
||||
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();
|
||||
|
||||
QString lastVersion = settings->value(SETTINGS_VERSION_KEY).toString();
|
||||
|
@ -50,16 +60,27 @@ void InfoView::loaded(bool ok)
|
|||
if (version != QString::null) {
|
||||
settings->setValue(SETTINGS_VERSION_KEY, version);
|
||||
}
|
||||
|
||||
QDesktopWidget* desktop = Application::getInstance()->desktop();
|
||||
int height = mainFrame->contentsSize().height() > desktop->height() ?
|
||||
desktop->height() * 0.9 :
|
||||
mainFrame->contentsSize().height();
|
||||
|
||||
resize(mainFrame->contentsSize().width(), height);
|
||||
move(desktop->screen()->rect().center() - rect().center());
|
||||
setWindowTitle(title());
|
||||
show();
|
||||
setWindowModality(Qt::WindowModal);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void InfoView::loaded(bool ok)
|
||||
{
|
||||
if (!shouldShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDesktopWidget* desktop = Application::getInstance()->desktop();
|
||||
QWebFrame* mainFrame = page()->mainFrame();
|
||||
|
||||
int height = mainFrame->contentsSize().height() > desktop->height() ?
|
||||
desktop->height() * 0.9 :
|
||||
mainFrame->contentsSize().height();
|
||||
|
||||
resize(mainFrame->contentsSize().width(), height);
|
||||
move(desktop->screen()->rect().center() - rect().center());
|
||||
setWindowTitle(title());
|
||||
show();
|
||||
}
|
||||
|
|
|
@ -16,9 +16,12 @@ class InfoView : public QWebView
|
|||
Q_OBJECT
|
||||
public:
|
||||
static void showFirstTime();
|
||||
static void forcedShow();
|
||||
|
||||
private:
|
||||
InfoView();
|
||||
InfoView(bool forced);
|
||||
bool _forced;
|
||||
bool shouldShow();
|
||||
|
||||
private slots:
|
||||
void loaded(bool ok);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "PairingHandler.h"
|
||||
#include "Menu.h"
|
||||
#include "Util.h"
|
||||
#include "InfoView.h"
|
||||
|
||||
Menu* Menu::_instance = NULL;
|
||||
|
||||
|
@ -52,7 +53,13 @@ Menu::Menu() :
|
|||
Application *appInstance = Application::getInstance();
|
||||
|
||||
QMenu* fileMenu = addMenu("File");
|
||||
|
||||
|
||||
(addActionToQMenuAndActionHash(fileMenu,
|
||||
MenuOption::AboutApp,
|
||||
0,
|
||||
this,
|
||||
SLOT(aboutApp())))->setMenuRole(QAction::AboutRole);
|
||||
|
||||
(addActionToQMenuAndActionHash(fileMenu,
|
||||
MenuOption::Preferences,
|
||||
Qt::CTRL | Qt::Key_Comma,
|
||||
|
@ -663,6 +670,10 @@ bool Menu::isVoxelModeActionChecked() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void Menu::aboutApp() {
|
||||
InfoView::forcedShow();
|
||||
}
|
||||
|
||||
void Menu::editPreferences() {
|
||||
Application* applicationInstance = Application::getInstance();
|
||||
QDialog dialog(applicationInstance->getGLWidget());
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue