diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2695b298cc..34f29d2164 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -8107,7 +8107,8 @@ void Application::toggleLogDialog() { return; } if (! _logDialog) { - _logDialog = new LogDialog(nullptr, getLogger()); + bool shouldSetParent = _keepLogWindowOnTop.get(); + _logDialog = new LogDialog(shouldSetParent ? qApp->getWindow() : nullptr, getLogger()); } if (_logDialog->isVisible()) { @@ -8117,6 +8118,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() { if (! _entityScriptServerLogDialog) { _entityScriptServerLogDialog = new EntityScriptServerLogDialog(nullptr); diff --git a/interface/src/Application.h b/interface/src/Application.h index 05d6135a93..576283f5a3 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -217,6 +217,7 @@ public: void setDesktopTabletScale(float desktopTabletScale); bool getDesktopTabletBecomesToolbarSetting() { return _desktopTabletBecomesToolbarSetting.get(); } + bool getLogWindowOnTopSetting() { return _keepLogWindowOnTop.get(); } void setDesktopTabletBecomesToolbarSetting(bool value); bool getHmdTabletBecomesToolbarSetting() { return _hmdTabletBecomesToolbarSetting.get(); } void setHmdTabletBecomesToolbarSetting(bool value); @@ -365,6 +366,7 @@ public slots: Q_INVOKABLE void loadDialog(); Q_INVOKABLE void loadScriptURLDialog() const; void toggleLogDialog(); + void recreateLogWindow(int); void toggleEntityScriptServerLogDialog(); Q_INVOKABLE void showAssetServerWidget(QString filePath = ""); Q_INVOKABLE void loadAddAvatarBookmarkDialog() const; @@ -654,6 +656,7 @@ private: Setting::Handle _constrainToolbarPosition; Setting::Handle _preferredCursor; Setting::Handle _miniTabletEnabledSetting; + Setting::Handle _keepLogWindowOnTop { "keepLogWindowOnTop", false }; float _scaleMirror; float _mirrorYawOffset; diff --git a/interface/src/ui/BaseLogDialog.cpp b/interface/src/ui/BaseLogDialog.cpp index e27b622262..e648dc222a 100644 --- a/interface/src/ui/BaseLogDialog.cpp +++ b/interface/src/ui/BaseLogDialog.cpp @@ -20,9 +20,9 @@ #include const int TOP_BAR_HEIGHT = 124; -const int INITIAL_WIDTH = 720; +const int INITIAL_WIDTH = 800; 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_WIDTH = 20; const int SEARCH_TOGGLE_BUTTON_WIDTH = 50; diff --git a/interface/src/ui/LogDialog.cpp b/interface/src/ui/LogDialog.cpp index 26a5a24de8..f89df985ed 100644 --- a/interface/src/ui/LogDialog.cpp +++ b/interface/src/ui/LogDialog.cpp @@ -19,6 +19,9 @@ #include +#include "Application.h" +#include "MainWindow.h" + const int REVEAL_BUTTON_WIDTH = 122; const int ALL_LOGS_BUTTON_WIDTH = 90; const int MARGIN_LEFT = 25; @@ -148,6 +151,12 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : BaseLog _messageCount->setObjectName("messageCount"); _messageCount->show(); + _keepOnTopBox = new QCheckBox(" Keep window on top", this); + bool isOnTop = qApp-> getLogWindowOnTopSetting(); + _keepOnTopBox->setCheckState(isOnTop ? Qt::Checked : Qt::Unchecked); + connect(_keepOnTopBox, &QCheckBox::stateChanged, qApp, &Application::recreateLogWindow); + _keepOnTopBox->show(); + _extraDebuggingBox = new QCheckBox("Extra debugging", this); if (_logger->extraDebugging()) { _extraDebuggingBox->setCheckState(Qt::Checked); @@ -183,6 +192,11 @@ void LogDialog::resizeEvent(QResizeEvent* event) { THIRD_ROW, COMBOBOX_WIDTH, 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, THIRD_ROW, COMBOBOX_WIDTH, diff --git a/interface/src/ui/LogDialog.h b/interface/src/ui/LogDialog.h index eb92d4b381..139ccb2240 100644 --- a/interface/src/ui/LogDialog.h +++ b/interface/src/ui/LogDialog.h @@ -55,6 +55,7 @@ protected: private: QCheckBox* _extraDebuggingBox; + QCheckBox* _keepOnTopBox; QPushButton* _revealLogButton; QPushButton* _allLogsButton; QCheckBox* _debugPrintBox;