diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8160d1c8db..e6119a71e7 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -114,7 +114,7 @@ void GLCanvas::wheelEvent(QWheelEvent* event) { Application::getInstance()->wheelEvent(event); } -Application::Application(int& argc, char** argv) : +Application::Application(int& argc, char** argv, timeval &startup_time) : QApplication(argc, argv), _window(new QMainWindow(desktop())), _glWidget(new GLCanvas()), @@ -152,7 +152,7 @@ Application::Application(int& argc, char** argv) : _bytesPerSecond(0), _bytesCount(0) { - gettimeofday(&_applicationStartupTime, NULL); + _applicationStartupTime = startup_time; _window->setWindowTitle("Interface"); printLog("Interface Startup:\n"); @@ -268,6 +268,15 @@ void Application::initializeGL() { QTimer* idleTimer = new QTimer(this); connect(idleTimer, SIGNAL(timeout()), SLOT(idle())); idleTimer->start(0); + + if (_justStarted) { + float startupTime = (usecTimestampNow() - usecTimestamp(&_applicationStartupTime))/1000000.0; + _justStarted = false; + char title[50]; + sprintf(title, "Interface: %4.2f seconds\n", startupTime); + printLog("%s", title); + _window->setWindowTitle(title); + } } void Application::paintGL() { @@ -403,16 +412,6 @@ void Application::paintGL() { _frameCount++; - - // If application has just started, report time from startup to now (first frame display) - if (_justStarted) { - float startupTime = (usecTimestampNow() - usecTimestamp(&_applicationStartupTime))/1000000.0; - _justStarted = false; - char title[50]; - sprintf(title, "Interface: %4.2f seconds\n", startupTime); - printLog("%s", title); - _window->setWindowTitle(title); - } } void Application::resizeGL(int width, int height) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 8c9818eebe..e420426c63 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -46,7 +46,7 @@ class Application : public QApplication { public: static Application* getInstance() { return static_cast(QCoreApplication::instance()); } - Application(int& argc, char** argv); + Application(int& argc, char** argv, timeval &startup_time); void initializeGL(); void paintGL(); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 58bad2db2f..ea915658af 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -1,28 +1,31 @@ -// -// Interface -// -// Allows you to connect to and see/hear the shared 3D space. -// Optionally uses serialUSB connection to get gyro data for head movement. -// Optionally gets UDP stream from transmitter to animate controller/hand. -// -// Usage: The interface client first attempts to contact a domain server to -// discover the appropriate audio, voxel, and avatar servers to contact. -// Right now, the default domain server is "highfidelity.below92.com" -// You can change the domain server to use your own by editing the -// DOMAIN_HOSTNAME or DOMAIN_IP strings in the file AgentList.cpp -// -// -// Welcome Aboard! -// - -#include "Application.h" -#include "Log.h" - -int main(int argc, const char * argv[]) { - - Application app(argc, const_cast(argv)); - printLog( "Created QT Application.\n" ); - int exitCode = app.exec(); - printLog("Normal exit.\n"); - return exitCode; -} +// +// Interface +// +// Allows you to connect to and see/hear the shared 3D space. +// Optionally uses serialUSB connection to get gyro data for head movement. +// Optionally gets UDP stream from transmitter to animate controller/hand. +// +// Usage: The interface client first attempts to contact a domain server to +// discover the appropriate audio, voxel, and avatar servers to contact. +// Right now, the default domain server is "highfidelity.below92.com" +// You can change the domain server to use your own by editing the +// DOMAIN_HOSTNAME or DOMAIN_IP strings in the file AgentList.cpp +// +// +// Welcome Aboard! +// + +#include "Application.h" +#include "Log.h" + +int main(int argc, const char * argv[]) { + + timeval startup_time; + gettimeofday(&startup_time, NULL); + + Application app(argc, const_cast(argv), startup_time); + printLog( "Created QT Application.\n" ); + int exitCode = app.exec(); + printLog("Normal exit.\n"); + return exitCode; +}