mirror of
https://github.com/overte-org/overte.git
synced 2025-06-19 01:01:10 +02:00
Merge pull request #14774 from danteruiz/window-ontop
case 20705: Allow log window to stay on top
This commit is contained in:
commit
15aa574afd
5 changed files with 67 additions and 2 deletions
|
@ -8246,7 +8246,18 @@ void Application::toggleLogDialog() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (! _logDialog) {
|
if (! _logDialog) {
|
||||||
|
|
||||||
|
bool keepOnTop =_keepLogWindowOnTop.get();
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
_logDialog = new LogDialog(keepOnTop ? qApp->getWindow() : nullptr, getLogger());
|
||||||
|
#else
|
||||||
_logDialog = new LogDialog(nullptr, getLogger());
|
_logDialog = new LogDialog(nullptr, getLogger());
|
||||||
|
|
||||||
|
if (keepOnTop) {
|
||||||
|
Qt::WindowFlags flags = _logDialog->windowFlags() | Qt::Tool;
|
||||||
|
_logDialog->setWindowFlags(flags);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_logDialog->isVisible()) {
|
if (_logDialog->isVisible()) {
|
||||||
|
@ -8256,6 +8267,19 @@ void Application::toggleLogDialog() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::recreateLogWindow(int keepOnTop) {
|
||||||
|
_keepLogWindowOnTop.set(keepOnTop != 0);
|
||||||
|
if (_logDialog) {
|
||||||
|
bool toggle = _logDialog->isVisible();
|
||||||
|
_logDialog->close();
|
||||||
|
_logDialog = nullptr;
|
||||||
|
|
||||||
|
if (toggle) {
|
||||||
|
toggleLogDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Application::toggleEntityScriptServerLogDialog() {
|
void Application::toggleEntityScriptServerLogDialog() {
|
||||||
if (! _entityScriptServerLogDialog) {
|
if (! _entityScriptServerLogDialog) {
|
||||||
_entityScriptServerLogDialog = new EntityScriptServerLogDialog(nullptr);
|
_entityScriptServerLogDialog = new EntityScriptServerLogDialog(nullptr);
|
||||||
|
|
|
@ -217,6 +217,8 @@ public:
|
||||||
void setDesktopTabletScale(float desktopTabletScale);
|
void setDesktopTabletScale(float desktopTabletScale);
|
||||||
|
|
||||||
bool getDesktopTabletBecomesToolbarSetting() { return _desktopTabletBecomesToolbarSetting.get(); }
|
bool getDesktopTabletBecomesToolbarSetting() { return _desktopTabletBecomesToolbarSetting.get(); }
|
||||||
|
bool getLogWindowOnTopSetting() { return _keepLogWindowOnTop.get(); }
|
||||||
|
void setLogWindowOnTopSetting(bool keepOnTop) { _keepLogWindowOnTop.set(keepOnTop); }
|
||||||
void setDesktopTabletBecomesToolbarSetting(bool value);
|
void setDesktopTabletBecomesToolbarSetting(bool value);
|
||||||
bool getHmdTabletBecomesToolbarSetting() { return _hmdTabletBecomesToolbarSetting.get(); }
|
bool getHmdTabletBecomesToolbarSetting() { return _hmdTabletBecomesToolbarSetting.get(); }
|
||||||
void setHmdTabletBecomesToolbarSetting(bool value);
|
void setHmdTabletBecomesToolbarSetting(bool value);
|
||||||
|
@ -365,6 +367,7 @@ public slots:
|
||||||
Q_INVOKABLE void loadDialog();
|
Q_INVOKABLE void loadDialog();
|
||||||
Q_INVOKABLE void loadScriptURLDialog() const;
|
Q_INVOKABLE void loadScriptURLDialog() const;
|
||||||
void toggleLogDialog();
|
void toggleLogDialog();
|
||||||
|
void recreateLogWindow(int);
|
||||||
void toggleEntityScriptServerLogDialog();
|
void toggleEntityScriptServerLogDialog();
|
||||||
Q_INVOKABLE void showAssetServerWidget(QString filePath = "");
|
Q_INVOKABLE void showAssetServerWidget(QString filePath = "");
|
||||||
Q_INVOKABLE void loadAddAvatarBookmarkDialog() const;
|
Q_INVOKABLE void loadAddAvatarBookmarkDialog() const;
|
||||||
|
@ -656,6 +659,7 @@ private:
|
||||||
Setting::Handle<bool> _constrainToolbarPosition;
|
Setting::Handle<bool> _constrainToolbarPosition;
|
||||||
Setting::Handle<QString> _preferredCursor;
|
Setting::Handle<QString> _preferredCursor;
|
||||||
Setting::Handle<bool> _miniTabletEnabledSetting;
|
Setting::Handle<bool> _miniTabletEnabledSetting;
|
||||||
|
Setting::Handle<bool> _keepLogWindowOnTop { "keepLogWindowOnTop", false };
|
||||||
|
|
||||||
float _scaleMirror;
|
float _scaleMirror;
|
||||||
float _mirrorYawOffset;
|
float _mirrorYawOffset;
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
|
|
||||||
const int TOP_BAR_HEIGHT = 124;
|
const int TOP_BAR_HEIGHT = 124;
|
||||||
const int INITIAL_WIDTH = 720;
|
const int INITIAL_WIDTH = 800;
|
||||||
const int INITIAL_HEIGHT = 480;
|
const int INITIAL_HEIGHT = 480;
|
||||||
const int MINIMAL_WIDTH = 700;
|
const int MINIMAL_WIDTH = 780;
|
||||||
const int SEARCH_BUTTON_LEFT = 25;
|
const int SEARCH_BUTTON_LEFT = 25;
|
||||||
const int SEARCH_BUTTON_WIDTH = 20;
|
const int SEARCH_BUTTON_WIDTH = 20;
|
||||||
const int SEARCH_TOGGLE_BUTTON_WIDTH = 50;
|
const int SEARCH_TOGGLE_BUTTON_WIDTH = 50;
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
|
|
||||||
#include <shared/AbstractLoggerInterface.h>
|
#include <shared/AbstractLoggerInterface.h>
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
const int REVEAL_BUTTON_WIDTH = 122;
|
const int REVEAL_BUTTON_WIDTH = 122;
|
||||||
const int ALL_LOGS_BUTTON_WIDTH = 90;
|
const int ALL_LOGS_BUTTON_WIDTH = 90;
|
||||||
const int MARGIN_LEFT = 25;
|
const int MARGIN_LEFT = 25;
|
||||||
|
@ -148,6 +151,16 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : BaseLog
|
||||||
_messageCount->setObjectName("messageCount");
|
_messageCount->setObjectName("messageCount");
|
||||||
_messageCount->show();
|
_messageCount->show();
|
||||||
|
|
||||||
|
_keepOnTopBox = new QCheckBox(" Keep window on top", this);
|
||||||
|
bool isOnTop = qApp-> getLogWindowOnTopSetting();
|
||||||
|
_keepOnTopBox->setCheckState(isOnTop ? Qt::Checked : Qt::Unchecked);
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
connect(_keepOnTopBox, &QCheckBox::stateChanged, qApp, &Application::recreateLogWindow);
|
||||||
|
#else
|
||||||
|
connect(_keepOnTopBox, &QCheckBox::stateChanged, this, &LogDialog::handleKeepWindowOnTop);
|
||||||
|
#endif
|
||||||
|
_keepOnTopBox->show();
|
||||||
|
|
||||||
_extraDebuggingBox = new QCheckBox("Extra debugging", this);
|
_extraDebuggingBox = new QCheckBox("Extra debugging", this);
|
||||||
if (_logger->extraDebugging()) {
|
if (_logger->extraDebugging()) {
|
||||||
_extraDebuggingBox->setCheckState(Qt::Checked);
|
_extraDebuggingBox->setCheckState(Qt::Checked);
|
||||||
|
@ -183,6 +196,11 @@ void LogDialog::resizeEvent(QResizeEvent* event) {
|
||||||
THIRD_ROW,
|
THIRD_ROW,
|
||||||
COMBOBOX_WIDTH,
|
COMBOBOX_WIDTH,
|
||||||
ELEMENT_HEIGHT);
|
ELEMENT_HEIGHT);
|
||||||
|
|
||||||
|
_keepOnTopBox->setGeometry(width() - ELEMENT_MARGIN - COMBOBOX_WIDTH - ELEMENT_MARGIN - ALL_LOGS_BUTTON_WIDTH - ELEMENT_MARGIN - COMBOBOX_WIDTH - ELEMENT_MARGIN,
|
||||||
|
THIRD_ROW,
|
||||||
|
COMBOBOX_WIDTH,
|
||||||
|
ELEMENT_HEIGHT);
|
||||||
_messageCount->setGeometry(_leftPad,
|
_messageCount->setGeometry(_leftPad,
|
||||||
THIRD_ROW,
|
THIRD_ROW,
|
||||||
COMBOBOX_WIDTH,
|
COMBOBOX_WIDTH,
|
||||||
|
@ -234,6 +252,23 @@ void LogDialog::handleInfoPrintBox(int state) {
|
||||||
printLogFile();
|
printLogFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LogDialog::handleKeepWindowOnTop(int state) {
|
||||||
|
bool keepOnTop = (state != 0);
|
||||||
|
|
||||||
|
Qt::WindowFlags flags = windowFlags();
|
||||||
|
|
||||||
|
if (keepOnTop) {
|
||||||
|
flags |= Qt::Tool;
|
||||||
|
} else {
|
||||||
|
flags &= ~Qt::Tool;
|
||||||
|
}
|
||||||
|
|
||||||
|
setWindowFlags(flags);
|
||||||
|
qApp->setLogWindowOnTopSetting(keepOnTop);
|
||||||
|
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
void LogDialog::handleCriticalPrintBox(int state) {
|
void LogDialog::handleCriticalPrintBox(int state) {
|
||||||
_logger->setCriticalPrint(state != 0);
|
_logger->setCriticalPrint(state != 0);
|
||||||
printLogFile();
|
printLogFile();
|
||||||
|
|
|
@ -34,6 +34,7 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void handleRevealButton();
|
void handleRevealButton();
|
||||||
void handleExtraDebuggingCheckbox(int);
|
void handleExtraDebuggingCheckbox(int);
|
||||||
|
void handleKeepWindowOnTop(int);
|
||||||
void handleDebugPrintBox(int);
|
void handleDebugPrintBox(int);
|
||||||
void handleInfoPrintBox(int);
|
void handleInfoPrintBox(int);
|
||||||
void handleCriticalPrintBox(int);
|
void handleCriticalPrintBox(int);
|
||||||
|
@ -55,6 +56,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox* _extraDebuggingBox;
|
QCheckBox* _extraDebuggingBox;
|
||||||
|
QCheckBox* _keepOnTopBox;
|
||||||
QPushButton* _revealLogButton;
|
QPushButton* _revealLogButton;
|
||||||
QPushButton* _allLogsButton;
|
QPushButton* _allLogsButton;
|
||||||
QCheckBox* _debugPrintBox;
|
QCheckBox* _debugPrintBox;
|
||||||
|
|
Loading…
Reference in a new issue