mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:28:03 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into 19561
Conflicts: interface/src/Application.cpp
This commit is contained in:
commit
7125b6ab8e
18 changed files with 574 additions and 285 deletions
|
@ -4,22 +4,22 @@
|
||||||
<context>
|
<context>
|
||||||
<name>Application</name>
|
<name>Application</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Application.cpp" line="1380"/>
|
<location filename="src/Application.cpp" line="1481"/>
|
||||||
<source>Export Voxels</source>
|
<source>Export Voxels</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Application.cpp" line="1381"/>
|
<location filename="src/Application.cpp" line="1482"/>
|
||||||
<source>Sparse Voxel Octree Files (*.svo)</source>
|
<source>Sparse Voxel Octree Files (*.svo)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Application.cpp" line="3608"/>
|
<location filename="src/Application.cpp" line="3465"/>
|
||||||
<source>Open Script</source>
|
<source>Open Script</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Application.cpp" line="3609"/>
|
<location filename="src/Application.cpp" line="3466"/>
|
||||||
<source>JavaScript Files (*.js)</source>
|
<source>JavaScript Files (*.js)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -113,18 +113,18 @@
|
||||||
<context>
|
<context>
|
||||||
<name>Menu</name>
|
<name>Menu</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Menu.cpp" line="460"/>
|
<location filename="src/Menu.cpp" line="554"/>
|
||||||
<source>Open .ini config file</source>
|
<source>Open .ini config file</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Menu.cpp" line="462"/>
|
<location filename="src/Menu.cpp" line="556"/>
|
||||||
<location filename="src/Menu.cpp" line="474"/>
|
<location filename="src/Menu.cpp" line="568"/>
|
||||||
<source>Text files (*.ini)</source>
|
<source>Text files (*.ini)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Menu.cpp" line="472"/>
|
<location filename="src/Menu.cpp" line="566"/>
|
||||||
<source>Save .ini config file</source>
|
<source>Save .ini config file</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -271,4 +271,57 @@
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>RunningScriptsWidget</name>
|
||||||
|
<message>
|
||||||
|
<location filename="ui/runningScriptsWidget.ui" line="14"/>
|
||||||
|
<location filename="../build/interface/ui_runningScriptsWidget.h" line="140"/>
|
||||||
|
<source>Form</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="ui/runningScriptsWidget.ui" line="39"/>
|
||||||
|
<location filename="../build/interface/ui_runningScriptsWidget.h" line="141"/>
|
||||||
|
<source><html><head/><body><p><span style=" font-size:18pt;">Running Scripts</span></p></body></html></source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="ui/runningScriptsWidget.ui" line="63"/>
|
||||||
|
<location filename="../build/interface/ui_runningScriptsWidget.h" line="142"/>
|
||||||
|
<source><html><head/><body><p><span style=" font-weight:600;">Currently running</span></p></body></html></source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="ui/runningScriptsWidget.ui" line="89"/>
|
||||||
|
<location filename="../build/interface/ui_runningScriptsWidget.h" line="143"/>
|
||||||
|
<source>Reload all</source>
|
||||||
|
<oldsource>Reload All</oldsource>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="ui/runningScriptsWidget.ui" line="116"/>
|
||||||
|
<location filename="../build/interface/ui_runningScriptsWidget.h" line="144"/>
|
||||||
|
<source>Stop all</source>
|
||||||
|
<oldsource>Stop All</oldsource>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="ui/runningScriptsWidget.ui" line="137"/>
|
||||||
|
<location filename="../build/interface/ui_runningScriptsWidget.h" line="145"/>
|
||||||
|
<source><html><head/><body><p><span style=" font-weight:600;">Recently loaded</span></p></body></html></source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="ui/runningScriptsWidget.ui" line="154"/>
|
||||||
|
<location filename="../build/interface/ui_runningScriptsWidget.h" line="146"/>
|
||||||
|
<source>(click a script or use the 1-9 keys to load and run it)</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="ui/runningScriptsWidget.ui" line="202"/>
|
||||||
|
<location filename="../build/interface/ui_runningScriptsWidget.h" line="148"/>
|
||||||
|
<source>There are no scripts currently running.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|
7
interface/resources/images/plus-white.svg
Normal file
7
interface/resources/images/plus-white.svg
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Your_Icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="23 23 54 54" enable-background="new 23 23 54 54" xml:space="preserve">
|
||||||
|
<polygon fill="#FFFFFF" points="77,41 59,41 59,23 41,23 41,41 23,41 23,59 41,59 41,77 59,77 59,59 77,59 "/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 565 B |
|
@ -30,7 +30,6 @@
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
@ -132,7 +131,7 @@ QString& Application::resourcesPath() {
|
||||||
|
|
||||||
Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
QApplication(argc, argv),
|
QApplication(argc, argv),
|
||||||
_window(new QMainWindow(desktop())),
|
_window(new MainWindow(desktop())),
|
||||||
_glWidget(new GLCanvas()),
|
_glWidget(new GLCanvas()),
|
||||||
_nodeThread(new QThread(this)),
|
_nodeThread(new QThread(this)),
|
||||||
_datagramProcessor(),
|
_datagramProcessor(),
|
||||||
|
@ -164,7 +163,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_packetsPerSecond(0),
|
_packetsPerSecond(0),
|
||||||
_bytesPerSecond(0),
|
_bytesPerSecond(0),
|
||||||
_previousScriptLocation(),
|
_previousScriptLocation(),
|
||||||
_logger(new FileLogger(this))
|
_logger(new FileLogger(this)),
|
||||||
|
_runningScriptsWidget(new RunningScriptsWidget(_window)),
|
||||||
|
_runningScriptsWidgetWasVisible(false)
|
||||||
{
|
{
|
||||||
// init GnuTLS for DTLS with domain-servers
|
// init GnuTLS for DTLS with domain-servers
|
||||||
DTLSClientSession::globalInit();
|
DTLSClientSession::globalInit();
|
||||||
|
@ -334,7 +335,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
|
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
|
||||||
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
|
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
|
||||||
|
|
||||||
_window->addDockWidget(Qt::NoDockWidgetArea, _runningScriptsWidget = new RunningScriptsWidget());
|
|
||||||
_runningScriptsWidget->setRunningScripts(getRunningScripts());
|
_runningScriptsWidget->setRunningScripts(getRunningScripts());
|
||||||
connect(_runningScriptsWidget, &RunningScriptsWidget::stopScriptName, this, &Application::stopScript);
|
connect(_runningScriptsWidget, &RunningScriptsWidget::stopScriptName, this, &Application::stopScript);
|
||||||
|
|
||||||
|
@ -355,6 +355,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
QMutexLocker locker(&_settingsMutex);
|
QMutexLocker locker(&_settingsMutex);
|
||||||
_previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString();
|
_previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(_window, &MainWindow::windowGeometryChanged,
|
||||||
|
_runningScriptsWidget, &RunningScriptsWidget::setBoundary);
|
||||||
|
|
||||||
|
//When -url in command line, teleport to location
|
||||||
|
urlGoTo(argc, constArgv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
@ -2631,7 +2637,6 @@ void Application::displayOverlay() {
|
||||||
if (audioLevel > AUDIO_METER_SCALE_WIDTH) {
|
if (audioLevel > AUDIO_METER_SCALE_WIDTH) {
|
||||||
audioLevel = AUDIO_METER_SCALE_WIDTH;
|
audioLevel = AUDIO_METER_SCALE_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME));
|
bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME));
|
||||||
|
|
||||||
if ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)) {
|
if ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)) {
|
||||||
|
@ -3326,31 +3331,23 @@ void Application::reloadAllScripts() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::toggleRunningScriptsWidget()
|
void Application::manageRunningScriptsWidgetVisibility(bool shown) {
|
||||||
{
|
if (_runningScriptsWidgetWasVisible && shown) {
|
||||||
if (!_runningScriptsWidget->toggleViewAction()->isChecked()) {
|
_runningScriptsWidget->show();
|
||||||
_runningScriptsWidget->move(_window->geometry().topLeft().x(), _window->geometry().topLeft().y());
|
} else if (_runningScriptsWidgetWasVisible && !shown) {
|
||||||
_runningScriptsWidget->resize(0, _window->height());
|
_runningScriptsWidget->hide();
|
||||||
_runningScriptsWidget->toggleViewAction()->trigger();
|
}
|
||||||
_runningScriptsWidget->grabKeyboard();
|
}
|
||||||
|
|
||||||
QPropertyAnimation* slideAnimation = new QPropertyAnimation(_runningScriptsWidget, "geometry", _runningScriptsWidget);
|
void Application::toggleRunningScriptsWidget() {
|
||||||
slideAnimation->setStartValue(_runningScriptsWidget->geometry());
|
if (_runningScriptsWidgetWasVisible) {
|
||||||
slideAnimation->setEndValue(QRect(_window->geometry().topLeft().x(), _window->geometry().topLeft().y(),
|
_runningScriptsWidget->hide();
|
||||||
310, _runningScriptsWidget->height()));
|
_runningScriptsWidgetWasVisible = false;
|
||||||
slideAnimation->setDuration(250);
|
|
||||||
slideAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
|
||||||
} else {
|
} else {
|
||||||
_runningScriptsWidget->releaseKeyboard();
|
_runningScriptsWidget->setBoundary(QRect(_window->geometry().topLeft(),
|
||||||
|
_window->size()));
|
||||||
QPropertyAnimation* slideAnimation = new QPropertyAnimation(_runningScriptsWidget, "geometry", _runningScriptsWidget);
|
_runningScriptsWidget->show();
|
||||||
slideAnimation->setStartValue(_runningScriptsWidget->geometry());
|
_runningScriptsWidgetWasVisible = true;
|
||||||
slideAnimation->setEndValue(QRect(_window->geometry().topLeft().x(), _window->geometry().topLeft().y(),
|
|
||||||
0, _runningScriptsWidget->height()));
|
|
||||||
slideAnimation->setDuration(250);
|
|
||||||
slideAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
|
||||||
|
|
||||||
QTimer::singleShot(260, _runningScriptsWidget->toggleViewAction(), SLOT(trigger()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QHash>
|
||||||
#include <QTouchEvent>
|
#include <QTouchEvent>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
#include <ViewFrustum.h>
|
#include <ViewFrustum.h>
|
||||||
#include <VoxelEditPacketSender.h>
|
#include <VoxelEditPacketSender.h>
|
||||||
|
|
||||||
|
#include "MainWindow.h"
|
||||||
#include "Audio.h"
|
#include "Audio.h"
|
||||||
#include "AudioReflector.h"
|
#include "AudioReflector.h"
|
||||||
#include "BuckyBalls.h"
|
#include "BuckyBalls.h"
|
||||||
|
@ -85,7 +87,6 @@ class QAction;
|
||||||
class QActionGroup;
|
class QActionGroup;
|
||||||
class QGLWidget;
|
class QGLWidget;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QMainWindow;
|
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
@ -138,6 +139,7 @@ public:
|
||||||
void keyReleaseEvent(QKeyEvent* event);
|
void keyReleaseEvent(QKeyEvent* event);
|
||||||
|
|
||||||
void focusOutEvent(QFocusEvent* event);
|
void focusOutEvent(QFocusEvent* event);
|
||||||
|
void focusInEvent(QFocusEvent* event);
|
||||||
|
|
||||||
void mouseMoveEvent(QMouseEvent* event);
|
void mouseMoveEvent(QMouseEvent* event);
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
|
@ -194,10 +196,10 @@ public:
|
||||||
/// if you need to access the application settings, use lockSettings()/unlockSettings()
|
/// if you need to access the application settings, use lockSettings()/unlockSettings()
|
||||||
QSettings* lockSettings() { _settingsMutex.lock(); return _settings; }
|
QSettings* lockSettings() { _settingsMutex.lock(); return _settings; }
|
||||||
void unlockSettings() { _settingsMutex.unlock(); }
|
void unlockSettings() { _settingsMutex.unlock(); }
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
QMainWindow* getWindow() { return _window; }
|
MainWindow* getWindow() { return _window; }
|
||||||
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
||||||
void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
|
void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
|
||||||
void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
|
void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
|
||||||
|
@ -314,6 +316,8 @@ private slots:
|
||||||
|
|
||||||
void parseVersionXml();
|
void parseVersionXml();
|
||||||
|
|
||||||
|
void manageRunningScriptsWidgetVisibility(bool shown);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resetCamerasOnResizeGL(Camera& camera, int width, int height);
|
void resetCamerasOnResizeGL(Camera& camera, int width, int height);
|
||||||
void updateProjectionMatrix();
|
void updateProjectionMatrix();
|
||||||
|
@ -374,7 +378,7 @@ private:
|
||||||
|
|
||||||
void displayRearMirrorTools();
|
void displayRearMirrorTools();
|
||||||
|
|
||||||
QMainWindow* _window;
|
MainWindow* _window;
|
||||||
GLCanvas* _glWidget; // our GLCanvas has a couple extra features
|
GLCanvas* _glWidget; // our GLCanvas has a couple extra features
|
||||||
|
|
||||||
BandwidthMeter _bandwidthMeter;
|
BandwidthMeter _bandwidthMeter;
|
||||||
|
@ -388,7 +392,7 @@ private:
|
||||||
int _numChangedSettings;
|
int _numChangedSettings;
|
||||||
|
|
||||||
QUndoStack _undoStack;
|
QUndoStack _undoStack;
|
||||||
|
|
||||||
glm::vec3 _gravity;
|
glm::vec3 _gravity;
|
||||||
|
|
||||||
// Frame Rate Measurement
|
// Frame Rate Measurement
|
||||||
|
@ -433,7 +437,7 @@ private:
|
||||||
Faceplus _faceplus;
|
Faceplus _faceplus;
|
||||||
Faceshift _faceshift;
|
Faceshift _faceshift;
|
||||||
Visage _visage;
|
Visage _visage;
|
||||||
|
|
||||||
SixenseManager _sixenseManager;
|
SixenseManager _sixenseManager;
|
||||||
|
|
||||||
Camera _myCamera; // My view onto the world
|
Camera _myCamera; // My view onto the world
|
||||||
|
@ -521,9 +525,11 @@ private:
|
||||||
TouchEvent _lastTouchEvent;
|
TouchEvent _lastTouchEvent;
|
||||||
|
|
||||||
Overlays _overlays;
|
Overlays _overlays;
|
||||||
|
|
||||||
AudioReflector _audioReflector;
|
AudioReflector _audioReflector;
|
||||||
RunningScriptsWidget* _runningScriptsWidget;
|
RunningScriptsWidget* _runningScriptsWidget;
|
||||||
QHash<QString, ScriptEngine*> _scriptEnginesHash;
|
QHash<QString, ScriptEngine*> _scriptEnginesHash;
|
||||||
|
bool _runningScriptsWidgetWasVisible;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Application_h
|
#endif // hifi_Application_h
|
||||||
|
|
|
@ -24,8 +24,8 @@ GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::NoDepthBuffer)),
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLCanvas::isThrottleRendering() const {
|
bool GLCanvas::isThrottleRendering() const {
|
||||||
return _throttleRendering || Application::getInstance()->getWindow()->isMinimized();
|
return _throttleRendering || Application::getInstance()->getWindow()->isMinimized();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas::initializeGL() {
|
void GLCanvas::initializeGL() {
|
||||||
|
@ -34,7 +34,7 @@ void GLCanvas::initializeGL() {
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
connect(Application::getInstance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(activeChanged(Qt::ApplicationState)));
|
connect(Application::getInstance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(activeChanged(Qt::ApplicationState)));
|
||||||
connect(&_frameTimer, SIGNAL(timeout()), this, SLOT(throttleRender()));
|
connect(&_frameTimer, SIGNAL(timeout()), this, SLOT(throttleRender()));
|
||||||
|
|
||||||
// Note, we *DO NOT* want Qt to automatically swap buffers for us. This results in the "ringing" bug mentioned in WL#19514 when we're throttling the framerate.
|
// Note, we *DO NOT* want Qt to automatically swap buffers for us. This results in the "ringing" bug mentioned in WL#19514 when we're throttling the framerate.
|
||||||
setAutoBufferSwap(false);
|
setAutoBufferSwap(false);
|
||||||
}
|
}
|
||||||
|
@ -81,14 +81,14 @@ void GLCanvas::activeChanged(Qt::ApplicationState state) {
|
||||||
_frameTimer.stop();
|
_frameTimer.stop();
|
||||||
_throttleRendering = false;
|
_throttleRendering = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::ApplicationSuspended:
|
case Qt::ApplicationSuspended:
|
||||||
case Qt::ApplicationHidden:
|
case Qt::ApplicationHidden:
|
||||||
// If we're hidden or are about to suspend, don't render anything.
|
// If we're hidden or are about to suspend, don't render anything.
|
||||||
_throttleRendering = false;
|
_throttleRendering = false;
|
||||||
_frameTimer.stop();
|
_frameTimer.stop();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Otherwise, throttle.
|
// Otherwise, throttle.
|
||||||
if (!_throttleRendering) {
|
if (!_throttleRendering) {
|
||||||
|
|
|
@ -22,31 +22,31 @@ public:
|
||||||
GLCanvas();
|
GLCanvas();
|
||||||
bool isThrottleRendering() const;
|
bool isThrottleRendering() const;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
QTimer _frameTimer;
|
QTimer _frameTimer;
|
||||||
bool _throttleRendering;
|
bool _throttleRendering;
|
||||||
int _idleRenderInterval;
|
int _idleRenderInterval;
|
||||||
|
|
||||||
virtual void initializeGL();
|
virtual void initializeGL();
|
||||||
virtual void paintGL();
|
virtual void paintGL();
|
||||||
virtual void resizeGL(int width, int height);
|
virtual void resizeGL(int width, int height);
|
||||||
|
|
||||||
virtual void keyPressEvent(QKeyEvent* event);
|
virtual void keyPressEvent(QKeyEvent* event);
|
||||||
virtual void keyReleaseEvent(QKeyEvent* event);
|
virtual void keyReleaseEvent(QKeyEvent* event);
|
||||||
|
|
||||||
virtual void focusOutEvent(QFocusEvent* event);
|
virtual void focusOutEvent(QFocusEvent* event);
|
||||||
|
|
||||||
virtual void mouseMoveEvent(QMouseEvent* event);
|
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||||
virtual void mousePressEvent(QMouseEvent* event);
|
virtual void mousePressEvent(QMouseEvent* event);
|
||||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||||
|
|
||||||
virtual bool event(QEvent* event);
|
virtual bool event(QEvent* event);
|
||||||
|
|
||||||
virtual void wheelEvent(QWheelEvent* event);
|
virtual void wheelEvent(QWheelEvent* event);
|
||||||
|
|
||||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||||
virtual void dropEvent(QDropEvent* event);
|
virtual void dropEvent(QDropEvent* event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void activeChanged(Qt::ApplicationState state);
|
void activeChanged(Qt::ApplicationState state);
|
||||||
void throttleRender();
|
void throttleRender();
|
||||||
|
|
67
interface/src/MainWindow.cpp
Normal file
67
interface/src/MainWindow.cpp
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
//
|
||||||
|
// MainWindow.cpp
|
||||||
|
// interface
|
||||||
|
//
|
||||||
|
// Created by Mohammed Nafees on 04/06/2014.
|
||||||
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QMoveEvent>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
#include <QShowEvent>
|
||||||
|
#include <QHideEvent>
|
||||||
|
#include <QWindowStateChangeEvent>
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget* parent) :
|
||||||
|
QMainWindow(parent) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::moveEvent(QMoveEvent* event) {
|
||||||
|
emit windowGeometryChanged(QRect(event->pos(), size()));
|
||||||
|
QMainWindow::moveEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::resizeEvent(QResizeEvent* event) {
|
||||||
|
emit windowGeometryChanged(QRect(QPoint(x(), y()), event->size()));
|
||||||
|
QMainWindow::resizeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::showEvent(QShowEvent* event) {
|
||||||
|
if (event->spontaneous()) {
|
||||||
|
emit windowShown(true);
|
||||||
|
}
|
||||||
|
QMainWindow::showEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::hideEvent(QHideEvent* event) {
|
||||||
|
if (event->spontaneous()) {
|
||||||
|
emit windowShown(false);
|
||||||
|
}
|
||||||
|
QMainWindow::hideEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::changeEvent(QEvent* event) {
|
||||||
|
if (event->type() == QEvent::WindowStateChange) {
|
||||||
|
QWindowStateChangeEvent* stateChangeEvent = static_cast<QWindowStateChangeEvent*>(event);
|
||||||
|
if ((stateChangeEvent->oldState() == Qt::WindowNoState ||
|
||||||
|
stateChangeEvent->oldState() == Qt::WindowMaximized) &&
|
||||||
|
windowState() == Qt::WindowMinimized) {
|
||||||
|
emit windowShown(false);
|
||||||
|
} else {
|
||||||
|
emit windowShown(true);
|
||||||
|
}
|
||||||
|
} else if (event->type() == QEvent::ActivationChange) {
|
||||||
|
if (isActiveWindow()) {
|
||||||
|
emit windowShown(true);
|
||||||
|
} else {
|
||||||
|
emit windowShown(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QMainWindow::changeEvent(event);
|
||||||
|
}
|
35
interface/src/MainWindow.h
Normal file
35
interface/src/MainWindow.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// MainWindow.h
|
||||||
|
// interface
|
||||||
|
//
|
||||||
|
// Created by Mohammed Nafees on 04/06/2014.
|
||||||
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __hifi__MainWindow__
|
||||||
|
#define __hifi__MainWindow__
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit MainWindow(QWidget* parent = NULL);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void windowGeometryChanged(QRect geometry);
|
||||||
|
void windowShown(bool shown);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void moveEvent(QMoveEvent* event);
|
||||||
|
virtual void resizeEvent(QResizeEvent* event);
|
||||||
|
virtual void showEvent(QShowEvent* event);
|
||||||
|
virtual void hideEvent(QHideEvent* event);
|
||||||
|
virtual void changeEvent(QEvent* event);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* defined(__hifi__MainWindow__) */
|
|
@ -170,12 +170,12 @@ Menu::Menu() :
|
||||||
|
|
||||||
|
|
||||||
QMenu* editMenu = addMenu("Edit");
|
QMenu* editMenu = addMenu("Edit");
|
||||||
|
|
||||||
QUndoStack* undoStack = Application::getInstance()->getUndoStack();
|
QUndoStack* undoStack = Application::getInstance()->getUndoStack();
|
||||||
QAction* undoAction = undoStack->createUndoAction(editMenu);
|
QAction* undoAction = undoStack->createUndoAction(editMenu);
|
||||||
undoAction->setShortcut(Qt::CTRL | Qt::Key_Z);
|
undoAction->setShortcut(Qt::CTRL | Qt::Key_Z);
|
||||||
addActionToQMenuAndActionHash(editMenu, undoAction);
|
addActionToQMenuAndActionHash(editMenu, undoAction);
|
||||||
|
|
||||||
QAction* redoAction = undoStack->createRedoAction(editMenu);
|
QAction* redoAction = undoStack->createRedoAction(editMenu);
|
||||||
redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
|
redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
|
||||||
addActionToQMenuAndActionHash(editMenu, redoAction);
|
addActionToQMenuAndActionHash(editMenu, redoAction);
|
||||||
|
@ -321,7 +321,7 @@ Menu::Menu() :
|
||||||
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::Visage, 0, true,
|
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::Visage, 0, true,
|
||||||
appInstance->getVisage(), SLOT(updateEnabled()));
|
appInstance->getVisage(), SLOT(updateEnabled()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::GlowWhenSpeaking, 0, true);
|
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::GlowWhenSpeaking, 0, true);
|
||||||
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::ChatCircling, 0, false);
|
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::ChatCircling, 0, false);
|
||||||
|
|
||||||
|
@ -724,31 +724,31 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
QAction::MenuRole role,
|
QAction::MenuRole role,
|
||||||
int menuItemLocation) {
|
int menuItemLocation) {
|
||||||
QAction* actionBefore = NULL;
|
QAction* actionBefore = NULL;
|
||||||
|
|
||||||
if (menuItemLocation >= 0 && destinationMenu->actions().size() > menuItemLocation) {
|
if (menuItemLocation >= 0 && destinationMenu->actions().size() > menuItemLocation) {
|
||||||
actionBefore = destinationMenu->actions()[menuItemLocation];
|
actionBefore = destinationMenu->actions()[menuItemLocation];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!actionName.isEmpty()) {
|
if (!actionName.isEmpty()) {
|
||||||
action->setText(actionName);
|
action->setText(actionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shortcut != 0) {
|
if (shortcut != 0) {
|
||||||
action->setShortcut(shortcut);
|
action->setShortcut(shortcut);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role != QAction::NoRole) {
|
if (role != QAction::NoRole) {
|
||||||
action->setMenuRole(role);
|
action->setMenuRole(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!actionBefore) {
|
if (!actionBefore) {
|
||||||
destinationMenu->addAction(action);
|
destinationMenu->addAction(action);
|
||||||
} else {
|
} else {
|
||||||
destinationMenu->insertAction(actionBefore, action);
|
destinationMenu->insertAction(actionBefore, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
_actionHash.insert(action->text(), action);
|
_actionHash.insert(action->text(), action);
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,7 +814,6 @@ void sendFakeEnterEvent() {
|
||||||
QCoreApplication::sendEvent(glWidget, &enterEvent);
|
QCoreApplication::sendEvent(glWidget, &enterEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int QLINE_MINIMUM_WIDTH = 400;
|
|
||||||
const float DIALOG_RATIO_OF_WINDOW = 0.30f;
|
const float DIALOG_RATIO_OF_WINDOW = 0.30f;
|
||||||
|
|
||||||
void Menu::loginForCurrentDomain() {
|
void Menu::loginForCurrentDomain() {
|
||||||
|
@ -920,7 +919,7 @@ void Menu::goTo() {
|
||||||
QString orientation = urlParts.count() > 2 ? urlParts[2] : QString();
|
QString orientation = urlParts.count() > 2 ? urlParts[2] : QString();
|
||||||
|
|
||||||
goToDomain(domain);
|
goToDomain(domain);
|
||||||
|
|
||||||
// goto either @user, #place, or x-xx,y-yy,z-zz
|
// goto either @user, #place, or x-xx,y-yy,z-zz
|
||||||
// style co-ordinate.
|
// style co-ordinate.
|
||||||
goTo(destination);
|
goTo(destination);
|
||||||
|
@ -1246,7 +1245,7 @@ void Menu::autoAdjustLOD(float currentFPS) {
|
||||||
_avatarLODDistanceMultiplier - DISTANCE_DECREASE_RATE);
|
_avatarLODDistanceMultiplier - DISTANCE_DECREASE_RATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
quint64 elapsed = now - _lastAdjust;
|
quint64 elapsed = now - _lastAdjust;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
const float ADJUST_LOD_DOWN_FPS = 40.0;
|
const float ADJUST_LOD_DOWN_FPS = 40.0;
|
||||||
const float ADJUST_LOD_UP_FPS = 55.0;
|
const float ADJUST_LOD_UP_FPS = 55.0;
|
||||||
const float DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS = 30.0f;
|
const float DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS = 30.0f;
|
||||||
|
|
||||||
const quint64 ADJUST_LOD_DOWN_DELAY = 1000 * 1000 * 5;
|
const quint64 ADJUST_LOD_DOWN_DELAY = 1000 * 1000 * 5;
|
||||||
const quint64 ADJUST_LOD_UP_DELAY = ADJUST_LOD_DOWN_DELAY * 2;
|
const quint64 ADJUST_LOD_UP_DELAY = ADJUST_LOD_DOWN_DELAY * 2;
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
|
|
||||||
void triggerOption(const QString& menuOption);
|
void triggerOption(const QString& menuOption);
|
||||||
QAction* getActionForOption(const QString& menuOption);
|
QAction* getActionForOption(const QString& menuOption);
|
||||||
|
|
||||||
float getAudioJitterBufferSamples() const { return _audioJitterBufferSamples; }
|
float getAudioJitterBufferSamples() const { return _audioJitterBufferSamples; }
|
||||||
void setAudioJitterBufferSamples(float audioJitterBufferSamples) { _audioJitterBufferSamples = audioJitterBufferSamples; }
|
void setAudioJitterBufferSamples(float audioJitterBufferSamples) { _audioJitterBufferSamples = audioJitterBufferSamples; }
|
||||||
float getFieldOfView() const { return _fieldOfView; }
|
float getFieldOfView() const { return _fieldOfView; }
|
||||||
|
@ -133,7 +133,7 @@ public:
|
||||||
const QKeySequence& shortcut = 0,
|
const QKeySequence& shortcut = 0,
|
||||||
QAction::MenuRole role = QAction::NoRole,
|
QAction::MenuRole role = QAction::NoRole,
|
||||||
int menuItemLocation = UNSPECIFIED_POSITION);
|
int menuItemLocation = UNSPECIFIED_POSITION);
|
||||||
|
|
||||||
void removeAction(QMenu* menu, const QString& actionName);
|
void removeAction(QMenu* menu, const QString& actionName);
|
||||||
|
|
||||||
bool static goToDestination(QString destination);
|
bool static goToDestination(QString destination);
|
||||||
|
@ -276,8 +276,8 @@ namespace MenuOption {
|
||||||
const QString AudioSpatialProcessingWithDiffusions = "With Diffusions";
|
const QString AudioSpatialProcessingWithDiffusions = "With Diffusions";
|
||||||
const QString AudioSpatialProcessingDontDistanceAttenuate = "Don't calculate distance attenuation";
|
const QString AudioSpatialProcessingDontDistanceAttenuate = "Don't calculate distance attenuation";
|
||||||
const QString AudioSpatialProcessingAlternateDistanceAttenuate = "Alternate distance attenuation";
|
const QString AudioSpatialProcessingAlternateDistanceAttenuate = "Alternate distance attenuation";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const QString Avatars = "Avatars";
|
const QString Avatars = "Avatars";
|
||||||
const QString Bandwidth = "Bandwidth Display";
|
const QString Bandwidth = "Bandwidth Display";
|
||||||
|
|
|
@ -16,6 +16,7 @@ const int RESIZE_HANDLE_WIDTH = 7;
|
||||||
|
|
||||||
FramelessDialog::FramelessDialog(QWidget *parent, Qt::WindowFlags flags, Position position) :
|
FramelessDialog::FramelessDialog(QWidget *parent, Qt::WindowFlags flags, Position position) :
|
||||||
QDialog(parent, flags | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint),
|
QDialog(parent, flags | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint),
|
||||||
|
_allowResize(true),
|
||||||
_isResizing(false),
|
_isResizing(false),
|
||||||
_resizeInitialWidth(0),
|
_resizeInitialWidth(0),
|
||||||
_selfHidden(false),
|
_selfHidden(false),
|
||||||
|
@ -114,7 +115,7 @@ void FramelessDialog::resizeAndPosition(bool resizeParent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramelessDialog::mousePressEvent(QMouseEvent* mouseEvent) {
|
void FramelessDialog::mousePressEvent(QMouseEvent* mouseEvent) {
|
||||||
if (mouseEvent->button() == Qt::LeftButton) {
|
if (_allowResize && mouseEvent->button() == Qt::LeftButton) {
|
||||||
if (_position == POSITION_LEFT || _position == POSITION_RIGHT) {
|
if (_position == POSITION_LEFT || _position == POSITION_RIGHT) {
|
||||||
bool hitLeft = (_position == POSITION_LEFT) && (abs(mouseEvent->pos().x() - size().width()) < RESIZE_HANDLE_WIDTH);
|
bool hitLeft = (_position == POSITION_LEFT) && (abs(mouseEvent->pos().x() - size().width()) < RESIZE_HANDLE_WIDTH);
|
||||||
bool hitRight = (_position == POSITION_RIGHT) && (mouseEvent->pos().x() < RESIZE_HANDLE_WIDTH);
|
bool hitRight = (_position == POSITION_RIGHT) && (mouseEvent->pos().x() < RESIZE_HANDLE_WIDTH);
|
||||||
|
|
|
@ -23,8 +23,10 @@ public:
|
||||||
|
|
||||||
FramelessDialog(QWidget* parent, Qt::WindowFlags flags = 0, Position position = POSITION_LEFT);
|
FramelessDialog(QWidget* parent, Qt::WindowFlags flags = 0, Position position = POSITION_LEFT);
|
||||||
void setStyleSheetFile(const QString& fileName);
|
void setStyleSheetFile(const QString& fileName);
|
||||||
void setHideOnBlur(bool hideOnBlur) { _hideOnBlur = hideOnBlur; };
|
void setAllowResize(bool allowResize) { _allowResize = allowResize; }
|
||||||
bool getHideOnBlur() { return _hideOnBlur; };
|
bool getAllowResize() { return _allowResize; }
|
||||||
|
void setHideOnBlur(bool hideOnBlur) { _hideOnBlur = hideOnBlur; }
|
||||||
|
bool getHideOnBlur() { return _hideOnBlur; }
|
||||||
void resizeAndPosition(bool resizeParent = true);
|
void resizeAndPosition(bool resizeParent = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -36,6 +38,7 @@ protected:
|
||||||
bool eventFilter(QObject* sender, QEvent* event);
|
bool eventFilter(QObject* sender, QEvent* event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool _allowResize;
|
||||||
bool _isResizing;
|
bool _isResizing;
|
||||||
int _resizeInitialWidth;
|
int _resizeInitialWidth;
|
||||||
bool _selfHidden; ///< true when the dialog itself because of a window event (deactivation or minimization)
|
bool _selfHidden; ///< true when the dialog itself because of a window event (deactivation or minimization)
|
||||||
|
|
|
@ -12,39 +12,35 @@
|
||||||
#include "ui_runningScriptsWidget.h"
|
#include "ui_runningScriptsWidget.h"
|
||||||
#include "RunningScriptsWidget.h"
|
#include "RunningScriptsWidget.h"
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QPainter>
|
||||||
#include <QTableWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
RunningScriptsWidget::RunningScriptsWidget(QDockWidget *parent) :
|
RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) :
|
||||||
QDockWidget(parent),
|
FramelessDialog(parent, 0, POSITION_LEFT),
|
||||||
ui(new Ui::RunningScriptsWidget)
|
ui(new Ui::RunningScriptsWidget) {
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
// remove the title bar (see the Qt docs on setTitleBarWidget)
|
setAllowResize(false);
|
||||||
setTitleBarWidget(new QWidget());
|
|
||||||
|
|
||||||
ui->runningScriptsTableWidget->setColumnCount(2);
|
ui->hideWidgetButton->setIcon(QIcon(Application::resourcesPath() + "images/close.svg"));
|
||||||
ui->runningScriptsTableWidget->verticalHeader()->setVisible(false);
|
ui->reloadAllButton->setIcon(QIcon(Application::resourcesPath() + "images/reload.svg"));
|
||||||
ui->runningScriptsTableWidget->horizontalHeader()->setVisible(false);
|
ui->stopAllButton->setIcon(QIcon(Application::resourcesPath() + "images/stop.svg"));
|
||||||
ui->runningScriptsTableWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
ui->loadScriptButton->setIcon(QIcon(Application::resourcesPath() + "images/plus-white.svg"));
|
||||||
ui->runningScriptsTableWidget->setShowGrid(false);
|
|
||||||
ui->runningScriptsTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
ui->runningScriptsTableWidget->setColumnWidth(0, 235);
|
|
||||||
ui->runningScriptsTableWidget->setColumnWidth(1, 25);
|
|
||||||
connect(ui->runningScriptsTableWidget, &QTableWidget::cellClicked, this, &RunningScriptsWidget::stopScript);
|
|
||||||
|
|
||||||
ui->recentlyLoadedScriptsTableWidget->setColumnCount(2);
|
_runningScriptsTable = new ScriptsTableWidget(ui->runningScriptsTableWidget);
|
||||||
ui->recentlyLoadedScriptsTableWidget->verticalHeader()->setVisible(false);
|
_runningScriptsTable->setColumnCount(2);
|
||||||
ui->recentlyLoadedScriptsTableWidget->horizontalHeader()->setVisible(false);
|
_runningScriptsTable->setColumnWidth(0, 245);
|
||||||
ui->recentlyLoadedScriptsTableWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
_runningScriptsTable->setColumnWidth(1, 22);
|
||||||
ui->recentlyLoadedScriptsTableWidget->setShowGrid(false);
|
connect(_runningScriptsTable, &QTableWidget::cellClicked, this, &RunningScriptsWidget::stopScript);
|
||||||
ui->recentlyLoadedScriptsTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
ui->recentlyLoadedScriptsTableWidget->setColumnWidth(0, 25);
|
_recentlyLoadedScriptsTable = new ScriptsTableWidget(ui->recentlyLoadedScriptsTableWidget);
|
||||||
ui->recentlyLoadedScriptsTableWidget->setColumnWidth(1, 235);
|
_recentlyLoadedScriptsTable->setColumnCount(1);
|
||||||
connect(ui->recentlyLoadedScriptsTableWidget, &QTableWidget::cellClicked,
|
_recentlyLoadedScriptsTable->setColumnWidth(0, 265);
|
||||||
|
connect(_recentlyLoadedScriptsTable, &QTableWidget::cellClicked,
|
||||||
this, &RunningScriptsWidget::loadScript);
|
this, &RunningScriptsWidget::loadScript);
|
||||||
|
|
||||||
connect(ui->hideWidgetButton, &QPushButton::clicked,
|
connect(ui->hideWidgetButton, &QPushButton::clicked,
|
||||||
|
@ -53,118 +49,126 @@ RunningScriptsWidget::RunningScriptsWidget(QDockWidget *parent) :
|
||||||
Application::getInstance(), &Application::reloadAllScripts);
|
Application::getInstance(), &Application::reloadAllScripts);
|
||||||
connect(ui->stopAllButton, &QPushButton::clicked,
|
connect(ui->stopAllButton, &QPushButton::clicked,
|
||||||
this, &RunningScriptsWidget::allScriptsStopped);
|
this, &RunningScriptsWidget::allScriptsStopped);
|
||||||
|
connect(ui->loadScriptButton, &QPushButton::clicked,
|
||||||
|
Application::getInstance(), &Application::loadDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunningScriptsWidget::~RunningScriptsWidget()
|
RunningScriptsWidget::~RunningScriptsWidget() {
|
||||||
{
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunningScriptsWidget::setRunningScripts(const QStringList& list)
|
void RunningScriptsWidget::setBoundary(const QRect& rect) {
|
||||||
{
|
_boundary = rect;
|
||||||
ui->runningScriptsTableWidget->setRowCount(list.size());
|
}
|
||||||
|
|
||||||
|
void RunningScriptsWidget::setRunningScripts(const QStringList& list) {
|
||||||
|
_runningScriptsTable->setRowCount(list.size());
|
||||||
|
|
||||||
ui->noRunningScriptsLabel->setVisible(list.isEmpty());
|
ui->noRunningScriptsLabel->setVisible(list.isEmpty());
|
||||||
ui->currentlyRunningLabel->setVisible(!list.isEmpty());
|
ui->currentlyRunningLabel->setVisible(!list.isEmpty());
|
||||||
ui->line1->setVisible(!list.isEmpty());
|
|
||||||
ui->runningScriptsTableWidget->setVisible(!list.isEmpty());
|
ui->runningScriptsTableWidget->setVisible(!list.isEmpty());
|
||||||
ui->reloadAllButton->setVisible(!list.isEmpty());
|
ui->reloadAllButton->setVisible(!list.isEmpty());
|
||||||
ui->stopAllButton->setVisible(!list.isEmpty());
|
ui->stopAllButton->setVisible(!list.isEmpty());
|
||||||
|
|
||||||
|
const int CLOSE_ICON_HEIGHT = 12;
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
QTableWidgetItem *scriptName = new QTableWidgetItem;
|
QTableWidgetItem *scriptName = new QTableWidgetItem;
|
||||||
scriptName->setText(list.at(i));
|
scriptName->setText(QFileInfo(list.at(i)).fileName());
|
||||||
scriptName->setToolTip(list.at(i));
|
scriptName->setToolTip(list.at(i));
|
||||||
scriptName->setTextAlignment(Qt::AlignCenter);
|
scriptName->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
QTableWidgetItem *closeIcon = new QTableWidgetItem;
|
QTableWidgetItem *closeIcon = new QTableWidgetItem;
|
||||||
closeIcon->setIcon(QIcon(Application::resourcesPath() + "/images/kill-script.svg"));
|
closeIcon->setIcon(QIcon(QPixmap(Application::resourcesPath() + "images/kill-script.svg").scaledToHeight(CLOSE_ICON_HEIGHT)));
|
||||||
|
|
||||||
ui->runningScriptsTableWidget->setItem(i, 0, scriptName);
|
_runningScriptsTable->setItem(i, 0, scriptName);
|
||||||
ui->runningScriptsTableWidget->setItem(i, 1, closeIcon);
|
_runningScriptsTable->setItem(i, 1, closeIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int RUNNING_SCRIPTS_TABLE_LEFT_MARGIN = 12;
|
||||||
|
const int RECENTLY_LOADED_TOP_MARGIN = 61;
|
||||||
|
const int RECENTLY_LOADED_LABEL_TOP_MARGIN = 19;
|
||||||
|
|
||||||
|
int y = ui->runningScriptsTableWidget->y() + RUNNING_SCRIPTS_TABLE_LEFT_MARGIN;
|
||||||
|
for (int i = 0; i < _runningScriptsTable->rowCount(); ++i) {
|
||||||
|
y += _runningScriptsTable->rowHeight(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->runningScriptsTableWidget->resize(ui->runningScriptsTableWidget->width(), y - RUNNING_SCRIPTS_TABLE_LEFT_MARGIN);
|
||||||
|
_runningScriptsTable->resize(_runningScriptsTable->width(), y - RUNNING_SCRIPTS_TABLE_LEFT_MARGIN);
|
||||||
|
ui->reloadAllButton->move(ui->reloadAllButton->x(), y);
|
||||||
|
ui->stopAllButton->move(ui->stopAllButton->x(), y);
|
||||||
|
ui->recentlyLoadedLabel->move(ui->recentlyLoadedLabel->x(),
|
||||||
|
ui->stopAllButton->y() + ui->stopAllButton->height() + RECENTLY_LOADED_TOP_MARGIN);
|
||||||
|
ui->recentlyLoadedScriptsTableWidget->move(ui->recentlyLoadedScriptsTableWidget->x(),
|
||||||
|
ui->recentlyLoadedLabel->y() + RECENTLY_LOADED_LABEL_TOP_MARGIN);
|
||||||
|
|
||||||
|
|
||||||
createRecentlyLoadedScriptsTable();
|
createRecentlyLoadedScriptsTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunningScriptsWidget::keyPressEvent(QKeyEvent *e)
|
void RunningScriptsWidget::keyPressEvent(QKeyEvent* event)
|
||||||
{
|
{
|
||||||
switch(e->key()) {
|
int loadScriptNumber = -1;
|
||||||
|
switch(event->key()) {
|
||||||
case Qt::Key_Escape:
|
case Qt::Key_Escape:
|
||||||
Application::getInstance()->toggleRunningScriptsWidget();
|
Application::getInstance()->toggleRunningScriptsWidget();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_1:
|
case Qt::Key_1:
|
||||||
if (_recentlyLoadedScripts.size() > 0) {
|
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(0));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qt::Key_2:
|
case Qt::Key_2:
|
||||||
if (_recentlyLoadedScripts.size() > 0 && _recentlyLoadedScripts.size() >= 2) {
|
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(1));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qt::Key_3:
|
case Qt::Key_3:
|
||||||
if (_recentlyLoadedScripts.size() > 0 && _recentlyLoadedScripts.size() >= 3) {
|
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(2));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qt::Key_4:
|
case Qt::Key_4:
|
||||||
if (_recentlyLoadedScripts.size() > 0 && _recentlyLoadedScripts.size() >= 4) {
|
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(3));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Qt::Key_5:
|
case Qt::Key_5:
|
||||||
if (_recentlyLoadedScripts.size() > 0 && _recentlyLoadedScripts.size() >= 5) {
|
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(4));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qt::Key_6:
|
case Qt::Key_6:
|
||||||
if (_recentlyLoadedScripts.size() > 0 && _recentlyLoadedScripts.size() >= 6) {
|
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(5));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qt::Key_7:
|
case Qt::Key_7:
|
||||||
if (_recentlyLoadedScripts.size() > 0 && _recentlyLoadedScripts.size() >= 7) {
|
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(6));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Qt::Key_8:
|
case Qt::Key_8:
|
||||||
if (_recentlyLoadedScripts.size() > 0 && _recentlyLoadedScripts.size() >= 8) {
|
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(7));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qt::Key_9:
|
case Qt::Key_9:
|
||||||
if (_recentlyLoadedScripts.size() > 0 && _recentlyLoadedScripts.size() >= 9) {
|
loadScriptNumber = event->key() - Qt::Key_1;
|
||||||
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(8));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (loadScriptNumber >= 0) {
|
||||||
|
if (_recentlyLoadedScripts.size() > loadScriptNumber) {
|
||||||
|
Application::getInstance()->loadScript(_recentlyLoadedScripts.at(loadScriptNumber));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FramelessDialog::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunningScriptsWidget::stopScript(int row, int column)
|
void RunningScriptsWidget::paintEvent(QPaintEvent* event) {
|
||||||
{
|
QPainter painter(this);
|
||||||
|
painter.setPen(QColor::fromRgb(225, 225, 225)); // #e1e1e1
|
||||||
|
|
||||||
|
if (ui->currentlyRunningLabel->isVisible()) {
|
||||||
|
// line below the 'Currently Running' label
|
||||||
|
painter.drawLine(36, ui->currentlyRunningLabel->y() + ui->currentlyRunningLabel->height(),
|
||||||
|
300, ui->currentlyRunningLabel->y() + ui->currentlyRunningLabel->height());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui->recentlyLoadedLabel->isVisible()) {
|
||||||
|
// line below the 'Recently loaded' label
|
||||||
|
painter.drawLine(36, ui->recentlyLoadedLabel->y() + ui->recentlyLoadedLabel->height(),
|
||||||
|
300, ui->recentlyLoadedLabel->y() + ui->recentlyLoadedLabel->height());
|
||||||
|
}
|
||||||
|
|
||||||
|
painter.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunningScriptsWidget::stopScript(int row, int column) {
|
||||||
if (column == 1) { // make sure the user has clicked on the close icon
|
if (column == 1) { // make sure the user has clicked on the close icon
|
||||||
_lastStoppedScript = ui->runningScriptsTableWidget->item(row, 0)->text();
|
_lastStoppedScript = _runningScriptsTable->item(row, 0)->toolTip();
|
||||||
emit stopScriptName(ui->runningScriptsTableWidget->item(row, 0)->text());
|
emit stopScriptName(_runningScriptsTable->item(row, 0)->toolTip());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunningScriptsWidget::loadScript(int row, int column)
|
void RunningScriptsWidget::loadScript(int row, int column) {
|
||||||
{
|
Application::getInstance()->loadScript(_recentlyLoadedScriptsTable->item(row, column)->toolTip());
|
||||||
Application::getInstance()->loadScript(ui->recentlyLoadedScriptsTableWidget->item(row, column)->text());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunningScriptsWidget::allScriptsStopped()
|
void RunningScriptsWidget::allScriptsStopped() {
|
||||||
{
|
|
||||||
QStringList list = Application::getInstance()->getRunningScripts();
|
QStringList list = Application::getInstance()->getRunningScripts();
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
_recentlyLoadedScripts.prepend(list.at(i));
|
_recentlyLoadedScripts.prepend(list.at(i));
|
||||||
|
@ -173,8 +177,7 @@ void RunningScriptsWidget::allScriptsStopped()
|
||||||
Application::getInstance()->stopAllScripts();
|
Application::getInstance()->stopAllScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunningScriptsWidget::createRecentlyLoadedScriptsTable()
|
void RunningScriptsWidget::createRecentlyLoadedScriptsTable() {
|
||||||
{
|
|
||||||
if (!_recentlyLoadedScripts.contains(_lastStoppedScript) && !_lastStoppedScript.isEmpty()) {
|
if (!_recentlyLoadedScripts.contains(_lastStoppedScript) && !_lastStoppedScript.isEmpty()) {
|
||||||
_recentlyLoadedScripts.prepend(_lastStoppedScript);
|
_recentlyLoadedScripts.prepend(_lastStoppedScript);
|
||||||
_lastStoppedScript = "";
|
_lastStoppedScript = "";
|
||||||
|
@ -187,21 +190,28 @@ void RunningScriptsWidget::createRecentlyLoadedScriptsTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->recentlyLoadedLabel->setVisible(!_recentlyLoadedScripts.isEmpty());
|
ui->recentlyLoadedLabel->setVisible(!_recentlyLoadedScripts.isEmpty());
|
||||||
ui->line2->setVisible(!_recentlyLoadedScripts.isEmpty());
|
|
||||||
ui->recentlyLoadedScriptsTableWidget->setVisible(!_recentlyLoadedScripts.isEmpty());
|
ui->recentlyLoadedScriptsTableWidget->setVisible(!_recentlyLoadedScripts.isEmpty());
|
||||||
ui->recentlyLoadedInstruction->setVisible(!_recentlyLoadedScripts.isEmpty());
|
ui->recentlyLoadedInstruction->setVisible(!_recentlyLoadedScripts.isEmpty());
|
||||||
|
|
||||||
int limit = _recentlyLoadedScripts.size() > 9 ? 9 : _recentlyLoadedScripts.size();
|
int limit = _recentlyLoadedScripts.size() > 9 ? 9 : _recentlyLoadedScripts.size();
|
||||||
ui->recentlyLoadedScriptsTableWidget->setRowCount(limit);
|
_recentlyLoadedScriptsTable->setRowCount(limit);
|
||||||
for (int i = 0; i < limit; ++i) {
|
for (int i = 0; i < limit; i++) {
|
||||||
QTableWidgetItem *scriptName = new QTableWidgetItem;
|
QTableWidgetItem *scriptName = new QTableWidgetItem;
|
||||||
scriptName->setText(_recentlyLoadedScripts.at(i));
|
scriptName->setText(QString::number(i + 1) + ". " + QFileInfo(_recentlyLoadedScripts.at(i)).fileName());
|
||||||
scriptName->setToolTip(_recentlyLoadedScripts.at(i));
|
scriptName->setToolTip(_recentlyLoadedScripts.at(i));
|
||||||
scriptName->setTextAlignment(Qt::AlignCenter);
|
scriptName->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
QTableWidgetItem *number = new QTableWidgetItem;
|
|
||||||
number->setText(QString::number(i+1) + ".");
|
|
||||||
|
|
||||||
ui->recentlyLoadedScriptsTableWidget->setItem(i, 0, number);
|
_recentlyLoadedScriptsTable->setItem(i, 0, scriptName);
|
||||||
ui->recentlyLoadedScriptsTableWidget->setItem(i, 1, scriptName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int y = ui->recentlyLoadedScriptsTableWidget->y() + 15;
|
||||||
|
for (int i = 0; i < _recentlyLoadedScriptsTable->rowCount(); ++i) {
|
||||||
|
y += _recentlyLoadedScriptsTable->rowHeight(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->recentlyLoadedInstruction->setGeometry(36, y,
|
||||||
|
ui->recentlyLoadedInstruction->width(),
|
||||||
|
ui->recentlyLoadedInstruction->height());
|
||||||
|
|
||||||
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,18 +12,18 @@
|
||||||
#ifndef hifi_RunningScriptsWidget_h
|
#ifndef hifi_RunningScriptsWidget_h
|
||||||
#define hifi_RunningScriptsWidget_h
|
#define hifi_RunningScriptsWidget_h
|
||||||
|
|
||||||
// Qt
|
#include "FramelessDialog.h"
|
||||||
#include <QDockWidget>
|
#include "ScriptsTableWidget.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class RunningScriptsWidget;
|
class RunningScriptsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class RunningScriptsWidget : public QDockWidget
|
class RunningScriptsWidget : public FramelessDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit RunningScriptsWidget(QDockWidget *parent = 0);
|
explicit RunningScriptsWidget(QWidget* parent = NULL);
|
||||||
~RunningScriptsWidget();
|
~RunningScriptsWidget();
|
||||||
|
|
||||||
void setRunningScripts(const QStringList& list);
|
void setRunningScripts(const QStringList& list);
|
||||||
|
@ -32,7 +32,11 @@ signals:
|
||||||
void stopScriptName(const QString& name);
|
void stopScriptName(const QString& name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *e);
|
virtual void keyPressEvent(QKeyEvent* event);
|
||||||
|
virtual void paintEvent(QPaintEvent* event);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setBoundary(const QRect& rect);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void stopScript(int row, int column);
|
void stopScript(int row, int column);
|
||||||
|
@ -40,9 +44,12 @@ private slots:
|
||||||
void allScriptsStopped();
|
void allScriptsStopped();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::RunningScriptsWidget *ui;
|
Ui::RunningScriptsWidget* ui;
|
||||||
|
ScriptsTableWidget* _runningScriptsTable;
|
||||||
|
ScriptsTableWidget* _recentlyLoadedScriptsTable;
|
||||||
QStringList _recentlyLoadedScripts;
|
QStringList _recentlyLoadedScripts;
|
||||||
QString _lastStoppedScript;
|
QString _lastStoppedScript;
|
||||||
|
QRect _boundary;
|
||||||
|
|
||||||
void createRecentlyLoadedScriptsTable();
|
void createRecentlyLoadedScriptsTable();
|
||||||
};
|
};
|
||||||
|
|
49
interface/src/ui/ScriptsTableWidget.cpp
Normal file
49
interface/src/ui/ScriptsTableWidget.cpp
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
//
|
||||||
|
// ScriptsTableWidget.cpp
|
||||||
|
// interface
|
||||||
|
//
|
||||||
|
// Created by Mohammed Nafees on 04/03/2014.
|
||||||
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
|
#include "ScriptsTableWidget.h"
|
||||||
|
|
||||||
|
ScriptsTableWidget::ScriptsTableWidget(QWidget* parent) :
|
||||||
|
QTableWidget(parent) {
|
||||||
|
verticalHeader()->setVisible(false);
|
||||||
|
horizontalHeader()->setVisible(false);
|
||||||
|
setShowGrid(false);
|
||||||
|
setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
|
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
setStyleSheet("QTableWidget { background: transparent; color: #333333; } QToolTip { color: #000000; background: #f9f6e4; padding: 2px; }");
|
||||||
|
setToolTipDuration(200);
|
||||||
|
setWordWrap(true);
|
||||||
|
setGeometry(0, 0, parent->width(), parent->height());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptsTableWidget::paintEvent(QPaintEvent* event) {
|
||||||
|
QPainter painter(viewport());
|
||||||
|
painter.setPen(QColor::fromRgb(225, 225, 225)); // #e1e1e1
|
||||||
|
|
||||||
|
int y = 0;
|
||||||
|
for (int i = 0; i < rowCount(); i++) {
|
||||||
|
painter.drawLine(5, rowHeight(i) + y, width(), rowHeight(i) + y);
|
||||||
|
y += rowHeight(i);
|
||||||
|
}
|
||||||
|
painter.end();
|
||||||
|
|
||||||
|
QTableWidget::paintEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptsTableWidget::keyPressEvent(QKeyEvent* event) {
|
||||||
|
// Ignore keys so they will propagate correctly
|
||||||
|
event->ignore();
|
||||||
|
}
|
28
interface/src/ui/ScriptsTableWidget.h
Normal file
28
interface/src/ui/ScriptsTableWidget.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// ScriptsTableWidget.h
|
||||||
|
// interface
|
||||||
|
//
|
||||||
|
// Created by Mohammed Nafees on 04/03/2014.
|
||||||
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi__ScriptsTableWidget_h
|
||||||
|
#define hifi__ScriptsTableWidget_h
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTableWidget>
|
||||||
|
|
||||||
|
class ScriptsTableWidget : public QTableWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ScriptsTableWidget(QWidget* parent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void paintEvent(QPaintEvent* event);
|
||||||
|
virtual void keyPressEvent(QKeyEvent* event);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi__ScriptsTableWidget_h
|
|
@ -6,44 +6,58 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>310</width>
|
<width>323</width>
|
||||||
<height>651</height>
|
<height>894</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background: #f7f7f7;
|
<string notr="true">* {
|
||||||
font-family: Helvetica, Arial, "DejaVu Sans"; </string>
|
font-family: Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
QWidget {
|
||||||
|
background: #f7f7f7;
|
||||||
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QLabel" name="widgetTitle">
|
<widget class="QLabel" name="widgetTitle">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>37</x>
|
||||||
<y>10</y>
|
<y>29</y>
|
||||||
<width>221</width>
|
<width>251</width>
|
||||||
<height>31</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">color: #0e7077;</string>
|
<string notr="true">color: #0e7077;
|
||||||
|
font-size: 20pt;
|
||||||
|
background: transparent;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-size:18pt;">Running Scripts</span></p></body></html></string>
|
<string><html><head/><body><p><span style=" font-size:18pt;">Running Scripts</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="indent">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="currentlyRunningLabel">
|
<widget class="QLabel" name="currentlyRunningLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>36</x>
|
||||||
<y>40</y>
|
<y>110</y>
|
||||||
<width>301</width>
|
<width>270</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">color: #0e7077;</string>
|
<string notr="true">color: #0e7077;
|
||||||
|
font: bold 14pt;
|
||||||
|
background: transparent;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600;">Currently running</span></p></body></html></string>
|
<string><html><head/><body><p><span style=" font-weight:600;">Currently running</span></p></body></html></string>
|
||||||
|
@ -52,22 +66,27 @@ font-family: Helvetica, Arial, "DejaVu Sans"; </string>
|
||||||
<widget class="QPushButton" name="reloadAllButton">
|
<widget class="QPushButton" name="reloadAllButton">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>40</x>
|
<x>36</x>
|
||||||
<y>230</y>
|
<y>270</y>
|
||||||
<width>111</width>
|
<width>111</width>
|
||||||
<height>31</height>
|
<height>35</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background: #0e7077;
|
<string notr="true">background: #0e7077;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 6px;</string>
|
border-radius: 4px;
|
||||||
|
font: bold 14pt;
|
||||||
|
padding-top: 3px;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Reload All</string>
|
<string>Reload all</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
|
@ -78,9 +97,9 @@ border-radius: 6px;</string>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>160</x>
|
<x>160</x>
|
||||||
<y>230</y>
|
<y>270</y>
|
||||||
<width>101</width>
|
<width>93</width>
|
||||||
<height>31</height>
|
<height>35</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
|
@ -89,10 +108,12 @@ border-radius: 6px;</string>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background: #0e7077;
|
<string notr="true">background: #0e7077;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 6px;</string>
|
border-radius: 4px;
|
||||||
|
font: bold 14pt;
|
||||||
|
padding-top: 3px;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Stop All</string>
|
<string>Stop all</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
|
@ -102,46 +123,32 @@ border-radius: 6px;</string>
|
||||||
<widget class="QLabel" name="recentlyLoadedLabel">
|
<widget class="QLabel" name="recentlyLoadedLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>36</x>
|
||||||
<y>280</y>
|
<y>320</y>
|
||||||
<width>301</width>
|
<width>265</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">color: #0e7077;</string>
|
<string notr="true">color: #0e7077;
|
||||||
|
font: bold 14pt;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600;">Recently loaded</span></p></body></html></string>
|
<string><html><head/><body><p><span style=" font-weight:600;">Recently loaded</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="Line" name="line2">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>300</y>
|
|
||||||
<width>271</width>
|
|
||||||
<height>8</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="recentlyLoadedInstruction">
|
<widget class="QLabel" name="recentlyLoadedInstruction">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>36</x>
|
||||||
<y>590</y>
|
<y>630</y>
|
||||||
<width>271</width>
|
<width>211</width>
|
||||||
<height>41</height>
|
<height>41</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">color: #95a5a6;</string>
|
<string notr="true">color: #95a5a6;
|
||||||
|
font-size: 14pt;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>(click a script or use the 1-9 keys to load and run it)</string>
|
<string>(click a script or use the 1-9 keys to load and run it)</string>
|
||||||
|
@ -153,10 +160,10 @@ border-radius: 6px;</string>
|
||||||
<widget class="QPushButton" name="hideWidgetButton">
|
<widget class="QPushButton" name="hideWidgetButton">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>270</x>
|
<x>285</x>
|
||||||
<y>10</y>
|
<y>29</y>
|
||||||
<width>31</width>
|
<width>16</width>
|
||||||
<height>31</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
|
@ -165,81 +172,101 @@ border-radius: 6px;</string>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>../resources/images/close.svg</normaloff>../resources/images/close.svg</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>16</width>
|
||||||
<height>20</height>
|
<height>16</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QTableWidget" name="runningScriptsTableWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>70</y>
|
|
||||||
<width>271</width>
|
|
||||||
<height>141</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background: transparent;</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="Line" name="line1">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>60</y>
|
|
||||||
<width>271</width>
|
|
||||||
<height>8</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QTableWidget" name="recentlyLoadedScriptsTableWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>310</y>
|
|
||||||
<width>271</width>
|
|
||||||
<height>281</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background: transparent;</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="noRunningScriptsLabel">
|
<widget class="QLabel" name="noRunningScriptsLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>36</x>
|
||||||
<y>40</y>
|
<y>110</y>
|
||||||
<width>271</width>
|
<width>271</width>
|
||||||
<height>51</height>
|
<height>51</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">font: 14px;</string>
|
<string notr="true">font: 14pt;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>There are no scripts currently running.</string>
|
<string>There are no scripts currently running.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="recentlyLoadedScriptsTableWidget" native="true">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>340</y>
|
||||||
|
<width>272</width>
|
||||||
|
<height>280</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background: transparent;
|
||||||
|
font-size: 14pt;</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="runningScriptsTableWidget" native="true">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>128</y>
|
||||||
|
<width>272</width>
|
||||||
|
<height>161</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background: transparent;
|
||||||
|
font-size: 14pt;</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="loadScriptButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>36</x>
|
||||||
|
<y>70</y>
|
||||||
|
<width>111</width>
|
||||||
|
<height>35</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background: #0e7077;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 4px;
|
||||||
|
font: bold 14pt;
|
||||||
|
padding-top: 3px;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Load script</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../resources/images/plus.svg</normaloff>../resources/images/plus.svg</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<zorder>widgetTitle</zorder>
|
||||||
|
<zorder>currentlyRunningLabel</zorder>
|
||||||
|
<zorder>recentlyLoadedLabel</zorder>
|
||||||
|
<zorder>recentlyLoadedInstruction</zorder>
|
||||||
|
<zorder>hideWidgetButton</zorder>
|
||||||
|
<zorder>recentlyLoadedScriptsTableWidget</zorder>
|
||||||
|
<zorder>runningScriptsTableWidget</zorder>
|
||||||
|
<zorder>noRunningScriptsLabel</zorder>
|
||||||
|
<zorder>reloadAllButton</zorder>
|
||||||
|
<zorder>stopAllButton</zorder>
|
||||||
|
<zorder>loadScriptButton</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -166,7 +166,7 @@ void ScriptEngine::setAvatarData(AvatarData* avatarData, const QString& objectNa
|
||||||
void ScriptEngine::setAvatarHashMap(AvatarHashMap* avatarHashMap, const QString& objectName) {
|
void ScriptEngine::setAvatarHashMap(AvatarHashMap* avatarHashMap, const QString& objectName) {
|
||||||
// remove the old Avatar property, if it exists
|
// remove the old Avatar property, if it exists
|
||||||
_engine.globalObject().setProperty(objectName, QScriptValue());
|
_engine.globalObject().setProperty(objectName, QScriptValue());
|
||||||
|
|
||||||
// give the script engine the new avatar hash map
|
// give the script engine the new avatar hash map
|
||||||
registerGlobalObject(objectName, avatarHashMap);
|
registerGlobalObject(objectName, avatarHashMap);
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ void ScriptEngine::init() {
|
||||||
registerGlobalObject("Vec3", &_vec3Library);
|
registerGlobalObject("Vec3", &_vec3Library);
|
||||||
registerGlobalObject("Uuid", &_uuidLibrary);
|
registerGlobalObject("Uuid", &_uuidLibrary);
|
||||||
registerGlobalObject("AnimationCache", &_animationCache);
|
registerGlobalObject("AnimationCache", &_animationCache);
|
||||||
|
|
||||||
registerGlobalObject("Voxels", &_voxelsScriptingInterface);
|
registerGlobalObject("Voxels", &_voxelsScriptingInterface);
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
|
|
Loading…
Reference in a new issue