mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 22:36:39 +02:00
Add tool window
This commit is contained in:
parent
55612cc596
commit
03f155bcd8
6 changed files with 32 additions and 8 deletions
|
@ -370,6 +370,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
// enable mouse tracking; otherwise, we only get drag events
|
// enable mouse tracking; otherwise, we only get drag events
|
||||||
_glWidget->setMouseTracking(true);
|
_glWidget->setMouseTracking(true);
|
||||||
|
|
||||||
|
_toolWindow = new QMainWindow();
|
||||||
|
_toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
|
_toolWindow->setWindowTitle("Tools");
|
||||||
|
|
||||||
// initialization continues in initializeGL when OpenGL context is ready
|
// initialization continues in initializeGL when OpenGL context is ready
|
||||||
|
|
||||||
// Tell our voxel edit sender about our known jurisdictions
|
// Tell our voxel edit sender about our known jurisdictions
|
||||||
|
|
|
@ -244,6 +244,8 @@ public:
|
||||||
void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
|
void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
|
||||||
void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
|
void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
|
||||||
|
|
||||||
|
QMainWindow* getToolWindow() { return _toolWindow ; }
|
||||||
|
|
||||||
GeometryCache* getGeometryCache() { return &_geometryCache; }
|
GeometryCache* getGeometryCache() { return &_geometryCache; }
|
||||||
AnimationCache* getAnimationCache() { return &_animationCache; }
|
AnimationCache* getAnimationCache() { return &_animationCache; }
|
||||||
TextureCache* getTextureCache() { return &_textureCache; }
|
TextureCache* getTextureCache() { return &_textureCache; }
|
||||||
|
@ -457,6 +459,8 @@ private:
|
||||||
MainWindow* _window;
|
MainWindow* _window;
|
||||||
GLCanvas* _glWidget; // our GLCanvas has a couple extra features
|
GLCanvas* _glWidget; // our GLCanvas has a couple extra features
|
||||||
|
|
||||||
|
QMainWindow* _toolWindow;
|
||||||
|
|
||||||
BandwidthMeter _bandwidthMeter;
|
BandwidthMeter _bandwidthMeter;
|
||||||
|
|
||||||
QThread* _nodeThread;
|
QThread* _nodeThread;
|
||||||
|
|
|
@ -247,6 +247,12 @@ Menu::Menu() :
|
||||||
_chatWindow = new ChatWindow(Application::getInstance()->getWindow());
|
_chatWindow = new ChatWindow(Application::getInstance()->getWindow());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
addActionToQMenuAndActionHash(toolsMenu,
|
||||||
|
MenuOption::ToolWindow,
|
||||||
|
Qt::CTRL | Qt::ALT | Qt::Key_T,
|
||||||
|
this,
|
||||||
|
SLOT(toggleToolWindow()));
|
||||||
|
|
||||||
addActionToQMenuAndActionHash(toolsMenu,
|
addActionToQMenuAndActionHash(toolsMenu,
|
||||||
MenuOption::Console,
|
MenuOption::Console,
|
||||||
Qt::CTRL | Qt::ALT | Qt::Key_J,
|
Qt::CTRL | Qt::ALT | Qt::Key_J,
|
||||||
|
@ -1461,6 +1467,11 @@ void Menu::toggleConsole() {
|
||||||
_jsConsole->setVisible(!_jsConsole->isVisible());
|
_jsConsole->setVisible(!_jsConsole->isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Menu::toggleToolWindow() {
|
||||||
|
QMainWindow* toolWindow = Application::getInstance()->getToolWindow();
|
||||||
|
toolWindow->setVisible(!toolWindow->isVisible());
|
||||||
|
}
|
||||||
|
|
||||||
void Menu::audioMuteToggled() {
|
void Menu::audioMuteToggled() {
|
||||||
QAction *muteAction = _actionHash.value(MenuOption::MuteAudio);
|
QAction *muteAction = _actionHash.value(MenuOption::MuteAudio);
|
||||||
if (muteAction) {
|
if (muteAction) {
|
||||||
|
|
|
@ -224,6 +224,7 @@ private slots:
|
||||||
void showScriptEditor();
|
void showScriptEditor();
|
||||||
void showChat();
|
void showChat();
|
||||||
void toggleConsole();
|
void toggleConsole();
|
||||||
|
void toggleToolWindow();
|
||||||
void toggleChat();
|
void toggleChat();
|
||||||
void audioMuteToggled();
|
void audioMuteToggled();
|
||||||
void displayNameLocationResponse(const QString& errorString);
|
void displayNameLocationResponse(const QString& errorString);
|
||||||
|
@ -491,6 +492,7 @@ namespace MenuOption {
|
||||||
const QString StringHair = "String Hair";
|
const QString StringHair = "String Hair";
|
||||||
const QString SuppressShortTimings = "Suppress Timings Less than 10ms";
|
const QString SuppressShortTimings = "Suppress Timings Less than 10ms";
|
||||||
const QString TestPing = "Test Ping";
|
const QString TestPing = "Test Ping";
|
||||||
|
const QString ToolWindow = "Tool Window";
|
||||||
const QString TransmitterDrive = "Transmitter Drive";
|
const QString TransmitterDrive = "Transmitter Drive";
|
||||||
const QString TurnWithHead = "Turn using Head";
|
const QString TurnWithHead = "Turn using Head";
|
||||||
const QString UploadAttachment = "Upload Attachment Model";
|
const QString UploadAttachment = "Upload Attachment Model";
|
||||||
|
|
|
@ -11,9 +11,13 @@
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QDockWidget>
|
||||||
#include <QWebFrame>
|
#include <QWebFrame>
|
||||||
#include <QWebView>
|
#include <QWebView>
|
||||||
|
#include <QListWidget>
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "WindowScriptingInterface.h"
|
#include "WindowScriptingInterface.h"
|
||||||
#include "WebWindowClass.h"
|
#include "WebWindowClass.h"
|
||||||
|
|
||||||
|
@ -31,18 +35,17 @@ void ScriptEventBridge::emitScriptEvent(const QString& data) {
|
||||||
|
|
||||||
WebWindowClass::WebWindowClass(const QString& title, const QString& url, int width, int height)
|
WebWindowClass::WebWindowClass(const QString& title, const QString& url, int width, int height)
|
||||||
: QObject(NULL),
|
: QObject(NULL),
|
||||||
_window(new QWidget(NULL, Qt::Tool)),
|
|
||||||
_eventBridge(new ScriptEventBridge(this)) {
|
_eventBridge(new ScriptEventBridge(this)) {
|
||||||
|
|
||||||
|
QMainWindow* toolWindow = Application::getInstance()->getToolWindow();
|
||||||
|
|
||||||
|
_window = new QDockWidget(title, toolWindow);
|
||||||
QWebView* webView = new QWebView(_window);
|
QWebView* webView = new QWebView(_window);
|
||||||
webView->page()->mainFrame()->addToJavaScriptWindowObject("EventBridge", _eventBridge);
|
webView->page()->mainFrame()->addToJavaScriptWindowObject("EventBridge", _eventBridge);
|
||||||
webView->setUrl(url);
|
webView->setUrl(url);
|
||||||
QVBoxLayout* layout = new QVBoxLayout(_window);
|
_window->setWidget(webView);
|
||||||
_window->setLayout(layout);
|
|
||||||
layout->addWidget(webView);
|
toolWindow->addDockWidget(Qt::RightDockWidgetArea, _window);
|
||||||
layout->setSpacing(0);
|
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
_window->setGeometry(0, 0, width, height);
|
|
||||||
|
|
||||||
connect(this, &WebWindowClass::destroyed, _window, &QWidget::deleteLater);
|
connect(this, &WebWindowClass::destroyed, _window, &QWidget::deleteLater);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public slots:
|
||||||
ScriptEventBridge* getEventBridge() const { return _eventBridge; }
|
ScriptEventBridge* getEventBridge() const { return _eventBridge; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* _window;
|
QDockWidget* _window;
|
||||||
ScriptEventBridge* _eventBridge;
|
ScriptEventBridge* _eventBridge;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue