Merge branch 'master' of https://github.com/highfidelity/hifi into animenu

This commit is contained in:
Andrzej Kapolka 2014-05-21 11:03:55 -07:00
commit 20a931178d
5 changed files with 68 additions and 67 deletions

View file

@ -20,12 +20,12 @@ class AbstractLoggerInterface : public QObject {
Q_OBJECT Q_OBJECT
public: public:
AbstractLoggerInterface(QObject* parent = NULL) : QObject(parent) {}; AbstractLoggerInterface(QObject* parent = NULL) : QObject(parent) {}
inline bool extraDebugging() { return _extraDebugging; }; inline bool extraDebugging() { return _extraDebugging; }
inline void setExtraDebugging(bool debugging) { _extraDebugging = debugging; }; inline void setExtraDebugging(bool debugging) { _extraDebugging = debugging; }
virtual void addMessage(QString) = 0; virtual void addMessage(QString) = 0;
virtual QStringList getLogData() = 0; virtual QString getLogData() = 0;
virtual void locateLog() = 0; virtual void locateLog() = 0;
signals: signals:

View file

@ -173,7 +173,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
_previousScriptLocation(), _previousScriptLocation(),
_runningScriptsWidget(new RunningScriptsWidget(_window)), _runningScriptsWidget(new RunningScriptsWidget(_window)),
_runningScriptsWidgetWasVisible(false) _runningScriptsWidgetWasVisible(false)
{ {
// read the ApplicationInfo.ini file for Name/Version/Domain information // read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
@ -235,10 +235,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
connect(&nodeList->getDomainHandler(), SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&))); connect(&nodeList->getDomainHandler(), SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
connect(&nodeList->getDomainHandler(), SIGNAL(connectedToDomain(const QString&)), SLOT(connectedToDomain(const QString&))); connect(&nodeList->getDomainHandler(), SIGNAL(connectedToDomain(const QString&)), SLOT(connectedToDomain(const QString&)));
// update our location every 5 seconds in the data-server, assuming that we are authenticated with one // update our location every 5 seconds in the data-server, assuming that we are authenticated with one
const float DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5.0f * 1000.0f; const float DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5.0f * 1000.0f;
QTimer* locationUpdateTimer = new QTimer(this); QTimer* locationUpdateTimer = new QTimer(this);
connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer); connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer);
locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS); locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
@ -334,7 +334,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
// when -url in command line, teleport to location // when -url in command line, teleport to location
urlGoTo(argc, constArgv); urlGoTo(argc, constArgv);
// For now we're going to set the PPS for outbound packets to be super high, this is // For now we're going to set the PPS for outbound packets to be super high, this is
// probably not the right long term solution. But for now, we're going to do this to // probably not the right long term solution. But for now, we're going to do this to
// allow you to move a particle around in your hand // allow you to move a particle around in your hand
@ -361,23 +361,23 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
// clear the scripts, and set out script to our default scripts // clear the scripts, and set out script to our default scripts
clearScriptsBeforeRunning(); clearScriptsBeforeRunning();
loadScript("http://public.highfidelity.io/scripts/defaultScripts.js"); loadScript("http://public.highfidelity.io/scripts/defaultScripts.js");
QMutexLocker locker(&_settingsMutex); QMutexLocker locker(&_settingsMutex);
_settings->setValue("firstRun",QVariant(false)); _settings->setValue("firstRun",QVariant(false));
} else { } else {
// do this as late as possible so that all required subsystems are inialized // do this as late as possible so that all required subsystems are inialized
loadScripts(); loadScripts();
QMutexLocker locker(&_settingsMutex); QMutexLocker locker(&_settingsMutex);
_previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString(); _previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString();
} }
connect(_window, &MainWindow::windowGeometryChanged, connect(_window, &MainWindow::windowGeometryChanged,
_runningScriptsWidget, &RunningScriptsWidget::setBoundary); _runningScriptsWidget, &RunningScriptsWidget::setBoundary);
//When -url in command line, teleport to location //When -url in command line, teleport to location
urlGoTo(argc, constArgv); urlGoTo(argc, constArgv);
// call the OAuthWebviewHandler static getter so that its instance lives in our thread // call the OAuthWebviewHandler static getter so that its instance lives in our thread
OAuthWebViewHandler::getInstance(); OAuthWebViewHandler::getInstance();
// make sure the High Fidelity root CA is in our list of trusted certs // make sure the High Fidelity root CA is in our list of trusted certs
@ -390,11 +390,11 @@ Application::~Application() {
// make sure we don't call the idle timer any more // make sure we don't call the idle timer any more
delete idleTimer; delete idleTimer;
_sharedVoxelSystem.changeTree(new VoxelTree); _sharedVoxelSystem.changeTree(new VoxelTree);
saveSettings(); saveSettings();
delete _voxelImporter; delete _voxelImporter;
// let the avatar mixer know we're out // let the avatar mixer know we're out
@ -433,7 +433,7 @@ Application::~Application() {
void Application::saveSettings() { void Application::saveSettings() {
Menu::getInstance()->saveSettings(); Menu::getInstance()->saveSettings();
_rearMirrorTools->saveSettings(_settings); _rearMirrorTools->saveSettings(_settings);
if (_voxelImporter) { if (_voxelImporter) {
_voxelImporter->saveSettings(_settings); _voxelImporter->saveSettings(_settings);
} }
@ -515,7 +515,7 @@ void Application::initializeGL() {
_voxelHideShowThread.initialize(_enableProcessVoxelsThread); _voxelHideShowThread.initialize(_enableProcessVoxelsThread);
_particleEditSender.initialize(_enableProcessVoxelsThread); _particleEditSender.initialize(_enableProcessVoxelsThread);
_modelEditSender.initialize(_enableProcessVoxelsThread); _modelEditSender.initialize(_enableProcessVoxelsThread);
if (_enableProcessVoxelsThread) { if (_enableProcessVoxelsThread) {
qDebug("Voxel parsing thread created."); qDebug("Voxel parsing thread created.");
} }
@ -579,7 +579,7 @@ void Application::paintGL() {
_myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale() * _scaleMirror); _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale() * _scaleMirror);
_myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0)); _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0));
_myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
// if the head would intersect the near clip plane, we must push the camera out // if the head would intersect the near clip plane, we must push the camera out
glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) * glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) *
(eyePosition - _myCamera.getTargetPosition()); (eyePosition - _myCamera.getTargetPosition());
@ -588,7 +588,7 @@ void Application::paintGL() {
pushback = relativePosition.z + pushbackRadius - _myCamera.getDistance(); pushback = relativePosition.z + pushbackRadius - _myCamera.getDistance();
pushbackFocalLength = _myCamera.getDistance(); pushbackFocalLength = _myCamera.getDistance();
} }
// handle pushback, if any // handle pushback, if any
if (pushbackFocalLength > 0.0f) { if (pushbackFocalLength > 0.0f) {
const float PUSHBACK_DECAY = 0.5f; const float PUSHBACK_DECAY = 0.5f;
@ -1273,7 +1273,7 @@ void Application::dropEvent(QDropEvent *event) {
void Application::sendPingPackets() { void Application::sendPingPackets() {
QByteArray pingPacket = NodeList::getInstance()->constructPingPacket(); QByteArray pingPacket = NodeList::getInstance()->constructPingPacket();
controlledBroadcastToNodes(pingPacket, NodeSet() controlledBroadcastToNodes(pingPacket, NodeSet()
<< NodeType::VoxelServer << NodeType::ParticleServer << NodeType::ModelServer << NodeType::VoxelServer << NodeType::ParticleServer << NodeType::ModelServer
<< NodeType::AudioMixer << NodeType::AvatarMixer << NodeType::AudioMixer << NodeType::AvatarMixer
<< NodeType::MetavoxelServer); << NodeType::MetavoxelServer);
@ -1284,7 +1284,7 @@ void Application::timer() {
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) { if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
sendPingPackets(); sendPingPackets();
} }
float diffTime = (float)_timerStart.nsecsElapsed() / 1000000000.0f; float diffTime = (float)_timerStart.nsecsElapsed() / 1000000000.0f;
_fps = (float)_frameCount / diffTime; _fps = (float)_frameCount / diffTime;
@ -1688,7 +1688,7 @@ void Application::init() {
connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
// set up our audio reflector // set up our audio reflector
_audioReflector.setMyAvatar(getAvatar()); _audioReflector.setMyAvatar(getAvatar());
_audioReflector.setVoxels(_voxels.getTree()); _audioReflector.setVoxels(_voxels.getTree());
@ -1697,7 +1697,7 @@ void Application::init() {
connect(getAudio(), &Audio::processInboundAudio, &_audioReflector, &AudioReflector::processInboundAudio,Qt::DirectConnection); connect(getAudio(), &Audio::processInboundAudio, &_audioReflector, &AudioReflector::processInboundAudio,Qt::DirectConnection);
connect(getAudio(), &Audio::processLocalAudio, &_audioReflector, &AudioReflector::processLocalAudio,Qt::DirectConnection); connect(getAudio(), &Audio::processLocalAudio, &_audioReflector, &AudioReflector::processLocalAudio,Qt::DirectConnection);
connect(getAudio(), &Audio::preProcessOriginalInboundAudio, &_audioReflector, connect(getAudio(), &Audio::preProcessOriginalInboundAudio, &_audioReflector,
&AudioReflector::preProcessOriginalInboundAudio,Qt::DirectConnection); &AudioReflector::preProcessOriginalInboundAudio,Qt::DirectConnection);
// save settings when avatar changes // save settings when avatar changes
@ -1812,7 +1812,7 @@ void Application::updateMyAvatarLookAtPosition() {
PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()");
FaceTracker* tracker = getActiveFaceTracker(); FaceTracker* tracker = getActiveFaceTracker();
bool isLookingAtSomeone = false; bool isLookingAtSomeone = false;
glm::vec3 lookAtSpot; glm::vec3 lookAtSpot;
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
@ -1847,7 +1847,7 @@ void Application::updateMyAvatarLookAtPosition() {
glm::distance(_mouseRayOrigin, _myAvatar->getHead()->calculateAverageEyePosition())); glm::distance(_mouseRayOrigin, _myAvatar->getHead()->calculateAverageEyePosition()));
lookAtSpot = _mouseRayOrigin + _mouseRayDirection * qMax(minEyeDistance, distance); lookAtSpot = _mouseRayOrigin + _mouseRayDirection * qMax(minEyeDistance, distance);
*/ */
} }
// //
// Deflect the eyes a bit to match the detected Gaze from 3D camera if active // Deflect the eyes a bit to match the detected Gaze from 3D camera if active
@ -1867,7 +1867,7 @@ void Application::updateMyAvatarLookAtPosition() {
eyePitch * pitchSign * deflection, eyeYaw * deflection, 0.0f))) * eyePitch * pitchSign * deflection, eyeYaw * deflection, 0.0f))) *
glm::inverse(_myCamera.getRotation()) * (lookAtSpot - origin); glm::inverse(_myCamera.getRotation()) * (lookAtSpot - origin);
} }
_myAvatar->getHead()->setLookAtPosition(lookAtSpot); _myAvatar->getHead()->setLookAtPosition(lookAtSpot);
} }
@ -1919,7 +1919,7 @@ void Application::updateCamera(float deltaTime) {
PerformanceWarning warn(showWarnings, "Application::updateCamera()"); PerformanceWarning warn(showWarnings, "Application::updateCamera()");
if (!OculusManager::isConnected() && !TV3DManager::isConnected() && if (!OculusManager::isConnected() && !TV3DManager::isConnected() &&
Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) { Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {
FaceTracker* tracker = getActiveFaceTracker(); FaceTracker* tracker = getActiveFaceTracker();
if (tracker) { if (tracker) {
const float EYE_OFFSET_SCALE = 0.025f; const float EYE_OFFSET_SCALE = 0.025f;
@ -2475,7 +2475,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
// disable specular lighting for ground and voxels // disable specular lighting for ground and voxels
glMaterialfv(GL_FRONT, GL_SPECULAR, NO_SPECULAR_COLOR); glMaterialfv(GL_FRONT, GL_SPECULAR, NO_SPECULAR_COLOR);
// draw the audio reflector overlay // draw the audio reflector overlay
_audioReflector.render(); _audioReflector.render();
@ -2643,7 +2643,7 @@ void Application::displayOverlay() {
const float LOG2_LOUDNESS_FLOOR = 11.f; const float LOG2_LOUDNESS_FLOOR = 11.f;
float audioLevel = 0.f; float audioLevel = 0.f;
float loudness = _audio.getLastInputLoudness() + 1.f; float loudness = _audio.getLastInputLoudness() + 1.f;
_trailingAudioLoudness = AUDIO_METER_AVERAGING * _trailingAudioLoudness + (1.f - AUDIO_METER_AVERAGING) * loudness; _trailingAudioLoudness = AUDIO_METER_AVERAGING * _trailingAudioLoudness + (1.f - AUDIO_METER_AVERAGING) * loudness;
float log2loudness = log(_trailingAudioLoudness) / LOG2; float log2loudness = log(_trailingAudioLoudness) / LOG2;
@ -2656,7 +2656,7 @@ void Application::displayOverlay() {
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)) {
const float MAX_MAGNITUDE = 0.7f; const float MAX_MAGNITUDE = 0.7f;
float magnitude = MAX_MAGNITUDE * (1 - _audio.getTimeSinceLastClip() / CLIPPING_INDICATOR_TIME); float magnitude = MAX_MAGNITUDE * (1 - _audio.getTimeSinceLastClip() / CLIPPING_INDICATOR_TIME);
@ -2762,7 +2762,7 @@ void Application::displayOverlay() {
// give external parties a change to hook in // give external parties a change to hook in
emit renderingOverlay(); emit renderingOverlay();
_overlays.render2D(); _overlays.render2D();
glPopMatrix(); glPopMatrix();
@ -2838,7 +2838,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) {
// save absolute translations // save absolute translations
glm::vec3 absoluteSkeletonTranslation = _myAvatar->getSkeletonModel().getTranslation(); glm::vec3 absoluteSkeletonTranslation = _myAvatar->getSkeletonModel().getTranslation();
glm::vec3 absoluteFaceTranslation = _myAvatar->getHead()->getFaceModel().getTranslation(); glm::vec3 absoluteFaceTranslation = _myAvatar->getHead()->getFaceModel().getTranslation();
// get the eye positions relative to the neck and use them to set the face translation // get the eye positions relative to the neck and use them to set the face translation
glm::vec3 leftEyePosition, rightEyePosition; glm::vec3 leftEyePosition, rightEyePosition;
_myAvatar->getHead()->getFaceModel().setTranslation(glm::vec3()); _myAvatar->getHead()->getFaceModel().setTranslation(glm::vec3());
@ -3104,7 +3104,7 @@ void Application::uploadModel(ModelType modelType) {
thread->connect(uploader, SIGNAL(destroyed()), SLOT(quit())); thread->connect(uploader, SIGNAL(destroyed()), SLOT(quit()));
thread->connect(thread, SIGNAL(finished()), SLOT(deleteLater())); thread->connect(thread, SIGNAL(finished()), SLOT(deleteLater()));
uploader->connect(thread, SIGNAL(started()), SLOT(send())); uploader->connect(thread, SIGNAL(started()), SLOT(send()));
thread->start(); thread->start();
} }
@ -3121,28 +3121,28 @@ void Application::updateWindowTitle(){
} }
void Application::updateLocationInServer() { void Application::updateLocationInServer() {
AccountManager& accountManager = AccountManager::getInstance(); AccountManager& accountManager = AccountManager::getInstance();
if (accountManager.isLoggedIn()) { if (accountManager.isLoggedIn()) {
static QJsonObject lastLocationObject; static QJsonObject lastLocationObject;
// construct a QJsonObject given the user's current address information // construct a QJsonObject given the user's current address information
QJsonObject updatedLocationObject; QJsonObject updatedLocationObject;
QJsonObject addressObject; QJsonObject addressObject;
addressObject.insert("position", QString(createByteArray(_myAvatar->getPosition()))); addressObject.insert("position", QString(createByteArray(_myAvatar->getPosition())));
addressObject.insert("orientation", QString(createByteArray(glm::degrees(safeEulerAngles(_myAvatar->getOrientation()))))); addressObject.insert("orientation", QString(createByteArray(glm::degrees(safeEulerAngles(_myAvatar->getOrientation())))));
addressObject.insert("domain", NodeList::getInstance()->getDomainHandler().getHostname()); addressObject.insert("domain", NodeList::getInstance()->getDomainHandler().getHostname());
updatedLocationObject.insert("address", addressObject); updatedLocationObject.insert("address", addressObject);
if (updatedLocationObject != lastLocationObject) { if (updatedLocationObject != lastLocationObject) {
accountManager.authenticatedRequest("/api/v1/users/address", QNetworkAccessManager::PutOperation, accountManager.authenticatedRequest("/api/v1/users/address", QNetworkAccessManager::PutOperation,
JSONCallbackParameters(), QJsonDocument(updatedLocationObject).toJson()); JSONCallbackParameters(), QJsonDocument(updatedLocationObject).toJson());
lastLocationObject = updatedLocationObject; lastLocationObject = updatedLocationObject;
} }
} }
@ -3167,7 +3167,7 @@ void Application::domainChanged(const QString& domainHostname) {
// reset the voxels renderer // reset the voxels renderer
_voxels.killLocalVoxels(); _voxels.killLocalVoxels();
// reset the auth URL for OAuth web view handler // reset the auth URL for OAuth web view handler
OAuthWebViewHandler::getInstance().clearLastAuthorizationURL(); OAuthWebViewHandler::getInstance().clearLastAuthorizationURL();
} }
@ -3388,7 +3388,7 @@ void Application::loadScripts() {
loadScript(string); loadScript(string);
} }
} }
QMutexLocker locker(&_settingsMutex); QMutexLocker locker(&_settingsMutex);
_settings->endArray(); _settings->endArray();
} }
@ -3614,9 +3614,12 @@ void Application::loadScriptURLDialog() {
void Application::toggleLogDialog() { void Application::toggleLogDialog() {
if (! _logDialog) { if (! _logDialog) {
_logDialog = new LogDialog(_glWidget, getLogger()); _logDialog = new LogDialog(_glWidget, getLogger());
_logDialog->show(); }
if (_logDialog->isVisible()) {
_logDialog->hide();
} else { } else {
_logDialog->close(); _logDialog->show();
} }
} }
@ -3650,7 +3653,7 @@ void Application::parseVersionXml() {
QObject* sender = QObject::sender(); QObject* sender = QObject::sender();
QXmlStreamReader xml(qobject_cast<QNetworkReply*>(sender)); QXmlStreamReader xml(qobject_cast<QNetworkReply*>(sender));
while (!xml.atEnd() && !xml.hasError()) { while (!xml.atEnd() && !xml.hasError()) {
if (xml.tokenType() == QXmlStreamReader::StartElement && xml.name() == operatingSystem) { if (xml.tokenType() == QXmlStreamReader::StartElement && xml.name() == operatingSystem) {
while (!(xml.tokenType() == QXmlStreamReader::EndElement && xml.name() == operatingSystem)) { while (!(xml.tokenType() == QXmlStreamReader::EndElement && xml.name() == operatingSystem)) {
@ -3667,7 +3670,7 @@ void Application::parseVersionXml() {
} }
xml.readNext(); xml.readNext();
} }
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) { if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl); new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl);
} }
@ -3719,24 +3722,24 @@ void Application::urlGoTo(int argc, const char * constArgv[]) {
} else if (urlParts.count() > 1) { } else if (urlParts.count() > 1) {
// if url has 2 or more parts, the first one is domain name // if url has 2 or more parts, the first one is domain name
QString domain = urlParts[0]; QString domain = urlParts[0];
// second part is either a destination coordinate or // second part is either a destination coordinate or
// a place name // a place name
QString destination = urlParts[1]; QString destination = urlParts[1];
// any third part is an avatar orientation. // any third part is an avatar orientation.
QString orientation = urlParts.count() > 2 ? urlParts[2] : QString(); QString orientation = urlParts.count() > 2 ? urlParts[2] : QString();
Menu::goToDomain(domain); Menu::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.
Menu::goTo(destination); Menu::goTo(destination);
if (!orientation.isEmpty()) { if (!orientation.isEmpty()) {
// location orientation // location orientation
Menu::goToOrientation(orientation); Menu::goToOrientation(orientation);
} }
} }
} }
} }

View file

@ -23,7 +23,7 @@ const QString LOGS_DIRECTORY = "Logs";
FileLogger::FileLogger(QObject* parent) : FileLogger::FileLogger(QObject* parent) :
AbstractLoggerInterface(parent), AbstractLoggerInterface(parent),
_logData(NULL) _logData("")
{ {
setExtraDebugging(false); setExtraDebugging(false);
@ -36,7 +36,7 @@ FileLogger::FileLogger(QObject* parent) :
void FileLogger::addMessage(QString message) { void FileLogger::addMessage(QString message) {
QMutexLocker locker(&_mutex); QMutexLocker locker(&_mutex);
emit logReceived(message); emit logReceived(message);
_logData.append(message); _logData += message;
QFile file(_fileName); QFile file(_fileName);
if (file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) { if (file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {

View file

@ -22,11 +22,11 @@ public:
FileLogger(QObject* parent = NULL); FileLogger(QObject* parent = NULL);
virtual void addMessage(QString); virtual void addMessage(QString);
virtual QStringList getLogData() { return _logData; }; virtual QString getLogData() { return _logData; }
virtual void locateLog(); virtual void locateLog();
private: private:
QStringList _logData; QString _logData;
QString _fileName; QString _fileName;
QMutex _mutex; QMutex _mutex;

View file

@ -57,6 +57,8 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : QDialog
resize(INITIAL_WIDTH, 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());
setMinimumWidth(MINIMAL_WIDTH); setMinimumWidth(MINIMAL_WIDTH);
connect(_logger, SIGNAL(logReceived(QString)), this, SLOT(appendLogLine(QString)), Qt::QueuedConnection);
} }
LogDialog::~LogDialog() { LogDialog::~LogDialog() {
@ -105,7 +107,6 @@ void LogDialog::initControls() {
} }
void LogDialog::showEvent(QShowEvent*) { void LogDialog::showEvent(QShowEvent*) {
connect(_logger, SIGNAL(logReceived(QString)), this, SLOT(appendLogLine(QString)), Qt::QueuedConnection);
showLogData(); showLogData();
} }
@ -122,7 +123,6 @@ void LogDialog::appendLogLine(QString logLine) {
if (logLine.contains(_searchTerm, Qt::CaseInsensitive)) { if (logLine.contains(_searchTerm, Qt::CaseInsensitive)) {
_logTextBox->appendPlainText(logLine.simplified()); _logTextBox->appendPlainText(logLine.simplified());
} }
_logTextBox->ensureCursorVisible();
} }
} }
@ -146,10 +146,8 @@ void LogDialog::handleSearchTextChanged(const QString searchText) {
void LogDialog::showLogData() { void LogDialog::showLogData() {
_logTextBox->clear(); _logTextBox->clear();
QStringList _logData = _logger->getLogData(); _logTextBox->insertPlainText(_logger->getLogData());
for (int i = 0; i < _logData.size(); ++i) { _logTextBox->ensureCursorVisible();
appendLogLine(_logData[i]);
}
} }
KeywordHighlighter::KeywordHighlighter(QTextDocument *parent) : QSyntaxHighlighter(parent), keywordFormat() { KeywordHighlighter::KeywordHighlighter(QTextDocument *parent) : QSyntaxHighlighter(parent), keywordFormat() {