mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 03:17:08 +02:00
CR fixes
This commit is contained in:
parent
a2ad70524f
commit
45d926da41
8 changed files with 59 additions and 65 deletions
|
@ -4478,3 +4478,12 @@ void Application::loadScript() {
|
||||||
// restore the main window's active state
|
// restore the main window's active state
|
||||||
_window->activateWindow();
|
_window->activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::toggleLogDialog() {
|
||||||
|
if (! _logDialog) {
|
||||||
|
_logDialog = new LogDialog(_glWidget);
|
||||||
|
_logDialog->show();
|
||||||
|
} else {
|
||||||
|
_logDialog->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QTouchEvent>
|
#include <QTouchEvent>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
#include <NetworkPacket.h>
|
#include <NetworkPacket.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
@ -67,6 +68,7 @@
|
||||||
#include "ui/VoxelStatsDialog.h"
|
#include "ui/VoxelStatsDialog.h"
|
||||||
#include "ui/RearMirrorTools.h"
|
#include "ui/RearMirrorTools.h"
|
||||||
#include "ui/LodToolsDialog.h"
|
#include "ui/LodToolsDialog.h"
|
||||||
|
#include "ui/LogDialog.h"
|
||||||
#include "ParticleTreeRenderer.h"
|
#include "ParticleTreeRenderer.h"
|
||||||
#include "ParticleEditHandle.h"
|
#include "ParticleEditHandle.h"
|
||||||
|
|
||||||
|
@ -222,7 +224,7 @@ public slots:
|
||||||
void decreaseVoxelSize();
|
void decreaseVoxelSize();
|
||||||
void increaseVoxelSize();
|
void increaseVoxelSize();
|
||||||
void loadScript();
|
void loadScript();
|
||||||
|
void toggleLogDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
@ -503,6 +505,8 @@ private:
|
||||||
|
|
||||||
std::vector<VoxelFade> _voxelFades;
|
std::vector<VoxelFade> _voxelFades;
|
||||||
std::vector<Avatar*> _avatarFades;
|
std::vector<Avatar*> _avatarFades;
|
||||||
|
|
||||||
|
QPointer<LogDialog> _logDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__Application__) */
|
#endif /* defined(__interface__Application__) */
|
||||||
|
|
|
@ -90,8 +90,8 @@ void LogDisplay::setCharacterSize(unsigned width, unsigned height) {
|
||||||
|
|
||||||
void LogDisplay::addMessage(const char* ptr) {
|
void LogDisplay::addMessage(const char* ptr) {
|
||||||
|
|
||||||
emit logReceived(ptr);
|
|
||||||
pthread_mutex_lock(& _mutex);
|
pthread_mutex_lock(& _mutex);
|
||||||
|
emit logReceived(ptr);
|
||||||
|
|
||||||
// T-pipe, if requested
|
// T-pipe, if requested
|
||||||
if (_stream != 0l) {
|
if (_stream != 0l) {
|
||||||
|
@ -155,6 +155,18 @@ void LogDisplay::addMessage(const char* ptr) {
|
||||||
pthread_mutex_unlock(& _mutex);
|
pthread_mutex_unlock(& _mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList LogDisplay::getLogData() {
|
||||||
|
// wait for adding new log data whilr iterating over _lines
|
||||||
|
pthread_mutex_lock(& _mutex);
|
||||||
|
QStringList list;
|
||||||
|
int i = 0;
|
||||||
|
while (_lines[i] != *_lastLinePos) {
|
||||||
|
list.append(_lines[i++]);
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(& _mutex);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rendering
|
// Rendering
|
||||||
//
|
//
|
||||||
|
|
|
@ -44,8 +44,7 @@ public:
|
||||||
static unsigned const LINE_BUFFER_SIZE = 256; // number of lines that are buffered
|
static unsigned const LINE_BUFFER_SIZE = 256; // number of lines that are buffered
|
||||||
static unsigned const MAX_MESSAGE_LENGTH = 512; // maximum number of characters for a message
|
static unsigned const MAX_MESSAGE_LENGTH = 512; // maximum number of characters for a message
|
||||||
|
|
||||||
char** getLogData() { return _lines; };
|
QStringList getLogData();
|
||||||
char** getLastLinePos() { return _lastLinePos; }
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void logReceived(QString message);
|
void logReceived(QString message);
|
||||||
|
|
|
@ -69,8 +69,7 @@ Menu::Menu() :
|
||||||
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
|
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
|
||||||
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
||||||
_boundaryLevelAdjust(0),
|
_boundaryLevelAdjust(0),
|
||||||
_maxVoxelPacketsPerSecond(DEFAULT_MAX_VOXEL_PPS),
|
_maxVoxelPacketsPerSecond(DEFAULT_MAX_VOXEL_PPS)
|
||||||
_logDialog(NULL)
|
|
||||||
{
|
{
|
||||||
Application *appInstance = Application::getInstance();
|
Application *appInstance = Application::getInstance();
|
||||||
|
|
||||||
|
@ -266,7 +265,7 @@ Menu::Menu() :
|
||||||
|
|
||||||
addDisabledActionAndSeparator(viewMenu, "Stats");
|
addDisabledActionAndSeparator(viewMenu, "Stats");
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats, Qt::Key_Slash);
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats, Qt::Key_Slash);
|
||||||
addActionToQMenuAndActionHash(viewMenu, MenuOption::Log, Qt::CTRL | Qt::Key_L, this, SLOT(showLogDialog()));
|
addActionToQMenuAndActionHash(viewMenu, MenuOption::Log, Qt::CTRL | Qt::Key_L, appInstance, SLOT(toggleLogDialog()));
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Oscilloscope, 0, true);
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Oscilloscope, 0, true);
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Bandwidth, 0, true);
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Bandwidth, 0, true);
|
||||||
addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0, this, SLOT(bandwidthDetails()));
|
addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0, this, SLOT(bandwidthDetails()));
|
||||||
|
@ -1029,23 +1028,6 @@ void Menu::pasteToVoxel() {
|
||||||
sendFakeEnterEvent();
|
sendFakeEnterEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::showLogDialog() {
|
|
||||||
if (! _logDialog) {
|
|
||||||
_logDialog = new LogDialog(Application::getInstance()->getGLWidget());
|
|
||||||
connect(_logDialog, SIGNAL(closed()), SLOT(logDialogClosed()));
|
|
||||||
_logDialog->show();
|
|
||||||
} else {
|
|
||||||
_logDialog->close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Menu::logDialogClosed() {
|
|
||||||
if (_logDialog) {
|
|
||||||
delete _logDialog;
|
|
||||||
_logDialog = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Menu::bandwidthDetails() {
|
void Menu::bandwidthDetails() {
|
||||||
if (! _bandwidthDialog) {
|
if (! _bandwidthDialog) {
|
||||||
_bandwidthDialog = new BandwidthDialog(Application::getInstance()->getGLWidget(),
|
_bandwidthDialog = new BandwidthDialog(Application::getInstance()->getGLWidget(),
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
|
||||||
#include "ui/LogDialog.h"
|
|
||||||
#include <AbstractMenuInterface.h>
|
#include <AbstractMenuInterface.h>
|
||||||
|
|
||||||
enum FrustumDrawMode {
|
enum FrustumDrawMode {
|
||||||
|
@ -93,7 +92,6 @@ public slots:
|
||||||
void exportSettings();
|
void exportSettings();
|
||||||
void goToUser();
|
void goToUser();
|
||||||
void pasteToVoxel();
|
void pasteToVoxel();
|
||||||
void showLogDialog();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void aboutApp();
|
void aboutApp();
|
||||||
|
@ -109,7 +107,6 @@ private slots:
|
||||||
void chooseVoxelPaintColor();
|
void chooseVoxelPaintColor();
|
||||||
void runTests();
|
void runTests();
|
||||||
void resetSwatchColors();
|
void resetSwatchColors();
|
||||||
void logDialogClosed();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Menu* _instance;
|
static Menu* _instance;
|
||||||
|
@ -149,7 +146,6 @@ private:
|
||||||
int _boundaryLevelAdjust;
|
int _boundaryLevelAdjust;
|
||||||
QAction* _useVoxelShader;
|
QAction* _useVoxelShader;
|
||||||
int _maxVoxelPacketsPerSecond;
|
int _maxVoxelPacketsPerSecond;
|
||||||
LogDialog* _logDialog;
|
|
||||||
QMenu* _activeScriptsMenu;
|
QMenu* _activeScriptsMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,52 +14,50 @@
|
||||||
#include "ui/LogDialog.h"
|
#include "ui/LogDialog.h"
|
||||||
#include "LogDisplay.h"
|
#include "LogDisplay.h"
|
||||||
|
|
||||||
#define INITIAL_WIDTH_RATIO 0.7
|
const int INITIAL_WIDTH = 720;
|
||||||
#define INITIAL_HEIGHT_RATIO 0.6
|
const float INITIAL_HEIGHT_RATIO = 0.6f;
|
||||||
|
|
||||||
int cursorMeta = qRegisterMetaType<QTextCursor>("QTextCursor");
|
int cursorMeta = qRegisterMetaType<QTextCursor>("QTextCursor");
|
||||||
int blockMeta = qRegisterMetaType<QTextBlock>("QTextBlock");
|
int blockMeta = qRegisterMetaType<QTextBlock>("QTextBlock");
|
||||||
|
|
||||||
LogDialog::LogDialog(QWidget* parent) : QDialog(parent, Qt::Dialog) {
|
LogDialog::LogDialog(QWidget* parent) : QDialog(parent, Qt::Dialog) {
|
||||||
|
|
||||||
setWindowTitle("Log");
|
setWindowTitle("Log");
|
||||||
|
|
||||||
_logTextBox = new QPlainTextEdit(this);
|
_logTextBox = new QPlainTextEdit(this);
|
||||||
_logTextBox->setReadOnly(true);
|
_logTextBox->setReadOnly(true);
|
||||||
_logTextBox->show();
|
_logTextBox->show();
|
||||||
|
|
||||||
switchToResourcesParentIfRequired();
|
switchToResourcesParentIfRequired();
|
||||||
QFile styleSheet("resources/styles/log_dialog.qss");
|
QFile styleSheet("resources/styles/log_dialog.qss");
|
||||||
|
|
||||||
if (styleSheet.open(QIODevice::ReadOnly)) {
|
if (styleSheet.open(QIODevice::ReadOnly)) {
|
||||||
setStyleSheet(styleSheet.readAll());
|
setStyleSheet(styleSheet.readAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDesktopWidget* desktop = new QDesktopWidget();
|
QDesktopWidget desktop;
|
||||||
QRect screen = desktop->screenGeometry();
|
QRect screen = desktop.screenGeometry();
|
||||||
resize(720, static_cast<int>(screen.height() * INITIAL_HEIGHT_RATIO));
|
resize(INITIAL_WIDTH, static_cast<int>(screen.height() * INITIAL_HEIGHT_RATIO));
|
||||||
move(screen.center() - rect().center());
|
move(screen.center() - rect().center());
|
||||||
delete desktop;
|
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogDialog::~LogDialog() {
|
LogDialog::~LogDialog() {
|
||||||
deleteLater();
|
deleteLater();
|
||||||
delete _logTextBox;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogDialog::showEvent(QShowEvent *e) {
|
void LogDialog::showEvent(QShowEvent *e) {
|
||||||
_logTextBox->clear();
|
_logTextBox->clear();
|
||||||
pthread_mutex_lock(& _mutex);
|
|
||||||
char** _lines = LogDisplay::instance.getLogData();
|
|
||||||
char** _lastLinePos = LogDisplay::instance.getLastLinePos();
|
|
||||||
|
|
||||||
int i = 0;
|
pthread_mutex_lock(& _mutex);
|
||||||
while (_lines[i] != *_lastLinePos) {
|
QStringList _logData = LogDisplay::instance.getLogData();
|
||||||
appendLogLine(_lines[i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(&LogDisplay::instance, &LogDisplay::logReceived, this, &LogDialog::appendLogLine);
|
connect(&LogDisplay::instance, &LogDisplay::logReceived, this, &LogDialog::appendLogLine);
|
||||||
|
for(int i = 0; i < _logData.size(); ++i) {
|
||||||
|
appendLogLine(_logData[i]);
|
||||||
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(& _mutex);
|
pthread_mutex_unlock(& _mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,15 +67,9 @@ void LogDialog::resizeEvent(QResizeEvent *e) {
|
||||||
|
|
||||||
void LogDialog::appendLogLine(QString logLine) {
|
void LogDialog::appendLogLine(QString logLine) {
|
||||||
if (isVisible()) {
|
if (isVisible()) {
|
||||||
|
pthread_mutex_lock(& _mutex);
|
||||||
_logTextBox->appendPlainText(logLine.simplified());
|
_logTextBox->appendPlainText(logLine.simplified());
|
||||||
|
pthread_mutex_unlock(& _mutex);
|
||||||
_logTextBox->ensureCursorVisible();
|
_logTextBox->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogDialog::reject() {
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogDialog::closeEvent(QCloseEvent* event) {
|
|
||||||
emit closed();
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,16 +19,16 @@ public:
|
||||||
LogDialog(QWidget* parent);
|
LogDialog(QWidget* parent);
|
||||||
~LogDialog();
|
~LogDialog();
|
||||||
|
|
||||||
signals:
|
//signals:
|
||||||
void closed();
|
// void closed();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reject();
|
// void reject();
|
||||||
void appendLogLine(QString logLine);
|
void appendLogLine(QString logLine);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Emits a 'closed' signal when this dialog is closed.
|
// Emits a 'closed' signal when this dialog is closed.
|
||||||
void closeEvent(QCloseEvent* e);
|
// void closeEvent(QCloseEvent* e);
|
||||||
void resizeEvent(QResizeEvent* e);
|
void resizeEvent(QResizeEvent* e);
|
||||||
void showEvent(QShowEvent* e);
|
void showEvent(QShowEvent* e);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue