mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
Merge pull request #12311 from ElderOrb/FB11511
FB11511 - position of log windows should be persistent between invocations of interface
This commit is contained in:
commit
f7027b52e1
4 changed files with 53 additions and 8 deletions
|
@ -38,7 +38,7 @@ const QString FATAL_TEXT = "[FATAL]";
|
||||||
const QString SUPPRESS_TEXT = "[SUPPRESS]";
|
const QString SUPPRESS_TEXT = "[SUPPRESS]";
|
||||||
const QString UNKNOWN_TEXT = "[UNKNOWN]";
|
const QString UNKNOWN_TEXT = "[UNKNOWN]";
|
||||||
|
|
||||||
LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : BaseLogDialog(parent) {
|
LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : BaseLogDialog(parent), _windowGeometry("logDialogGeometry", QRect()) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
setWindowTitle("Log");
|
setWindowTitle("Log");
|
||||||
|
|
||||||
|
@ -155,6 +155,11 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : BaseLog
|
||||||
_clearFilterButton->show();
|
_clearFilterButton->show();
|
||||||
connect(_clearFilterButton, &QPushButton::clicked, this, &LogDialog::handleClearFilterButton);
|
connect(_clearFilterButton, &QPushButton::clicked, this, &LogDialog::handleClearFilterButton);
|
||||||
handleClearFilterButton();
|
handleClearFilterButton();
|
||||||
|
|
||||||
|
auto windowGeometry = _windowGeometry.get();
|
||||||
|
if (windowGeometry.isValid()) {
|
||||||
|
setGeometry(windowGeometry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogDialog::resizeEvent(QResizeEvent* event) {
|
void LogDialog::resizeEvent(QResizeEvent* event) {
|
||||||
|
@ -173,6 +178,11 @@ void LogDialog::resizeEvent(QResizeEvent* event) {
|
||||||
ELEMENT_HEIGHT);
|
ELEMENT_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LogDialog::closeEvent(QCloseEvent* event) {
|
||||||
|
BaseLogDialog::closeEvent(event);
|
||||||
|
_windowGeometry.set(geometry());
|
||||||
|
}
|
||||||
|
|
||||||
void LogDialog::handleRevealButton() {
|
void LogDialog::handleRevealButton() {
|
||||||
_logger->locateLog();
|
_logger->locateLog();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define hifi_LogDialog_h
|
#define hifi_LogDialog_h
|
||||||
|
|
||||||
#include "BaseLogDialog.h"
|
#include "BaseLogDialog.h"
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
@ -44,6 +45,8 @@ private slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
QString getCurrentLog() override;
|
QString getCurrentLog() override;
|
||||||
void printLogFile();
|
void printLogFile();
|
||||||
|
|
||||||
|
@ -62,6 +65,7 @@ private:
|
||||||
QString _filterSelection;
|
QString _filterSelection;
|
||||||
|
|
||||||
AbstractLoggerInterface* _logger;
|
AbstractLoggerInterface* _logger;
|
||||||
|
Setting::Handle<QRect> _windowGeometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_LogDialog_h
|
#endif // hifi_LogDialog_h
|
||||||
|
|
|
@ -227,7 +227,7 @@ bool QmlWindowClass::isVisible() {
|
||||||
glm::vec2 QmlWindowClass::getPosition() {
|
glm::vec2 QmlWindowClass::getPosition() {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
vec2 result;
|
vec2 result;
|
||||||
BLOCKING_INVOKE_METHOD(this, "getPosition", Q_RETURN_ARG(vec2, result));
|
BLOCKING_INVOKE_METHOD(this, "getPosition", Q_RETURN_ARG(glm::vec2, result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ glm::vec2 QmlWindowClass::getPosition() {
|
||||||
|
|
||||||
void QmlWindowClass::setPosition(const glm::vec2& position) {
|
void QmlWindowClass::setPosition(const glm::vec2& position) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "setPosition", Q_ARG(vec2, position));
|
QMetaObject::invokeMethod(this, "setPosition", Q_ARG(const glm::vec2&, position));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ glm::vec2 toGlm(const QSizeF& size) {
|
||||||
glm::vec2 QmlWindowClass::getSize() {
|
glm::vec2 QmlWindowClass::getSize() {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
vec2 result;
|
vec2 result;
|
||||||
BLOCKING_INVOKE_METHOD(this, "getSize", Q_RETURN_ARG(vec2, result));
|
BLOCKING_INVOKE_METHOD(this, "getSize", Q_RETURN_ARG(glm::vec2, result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ glm::vec2 QmlWindowClass::getSize() {
|
||||||
|
|
||||||
void QmlWindowClass::setSize(const glm::vec2& size) {
|
void QmlWindowClass::setSize(const glm::vec2& size) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "setSize", Q_ARG(vec2, size));
|
QMetaObject::invokeMethod(this, "setSize", Q_ARG(const glm::vec2&, size));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,14 +22,37 @@ if (scripts.length >= 2) {
|
||||||
// Set up the qml ui
|
// Set up the qml ui
|
||||||
var qml = Script.resolvePath('debugWindow.qml');
|
var qml = Script.resolvePath('debugWindow.qml');
|
||||||
|
|
||||||
|
var HMD_DEBUG_WINDOW_GEOMETRY_KEY = 'hmdDebugWindowGeometry';
|
||||||
|
var hmdDebugWindowGeometryValue = Settings.getValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY)
|
||||||
|
|
||||||
|
var windowWidth = 400;
|
||||||
|
var windowHeight = 900;
|
||||||
|
|
||||||
|
var hasPosition = false;
|
||||||
|
var windowX = 0;
|
||||||
|
var windowY = 0;
|
||||||
|
|
||||||
|
if (hmdDebugWindowGeometryValue !== '') {
|
||||||
|
var geometry = JSON.parse(hmdDebugWindowGeometryValue);
|
||||||
|
|
||||||
|
windowWidth = geometry.width
|
||||||
|
windowHeight = geometry.height
|
||||||
|
windowX = geometry.x
|
||||||
|
windowY = geometry.y
|
||||||
|
hasPosition = true;
|
||||||
|
}
|
||||||
|
|
||||||
var window = new OverlayWindow({
|
var window = new OverlayWindow({
|
||||||
title: 'Debug Window',
|
title: 'Debug Window',
|
||||||
source: qml,
|
source: qml,
|
||||||
width: 400, height: 900,
|
width: windowWidth, height: windowHeight,
|
||||||
});
|
});
|
||||||
|
|
||||||
window.setPosition(25, 50);
|
if (hasPosition) {
|
||||||
window.closed.connect(function() { Script.stop(); });
|
window.setPosition(windowX, windowY);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.closed.connect(function () { Script.stop(); });
|
||||||
|
|
||||||
var getFormattedDate = function() {
|
var getFormattedDate = function() {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
|
@ -65,6 +88,14 @@ ScriptDiscoveryService.clearDebugWindow.connect(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
|
var geometry = JSON.stringify({
|
||||||
|
x: window.position.x,
|
||||||
|
y: window.position.y,
|
||||||
|
width: window.size.x,
|
||||||
|
height: window.size.y
|
||||||
|
})
|
||||||
|
|
||||||
|
Settings.setValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY, geometry);
|
||||||
window.close();
|
window.close();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue