History

replace LogDisplay with File logger

- added abstract logger interface

Stojce Slavkovski committed 12 years ago

Commit ee1eb251 parent 3d44ab913 files · +150 −59Browse files

Showing the changes to interface/src/Application.cpp (1 of 13 files). Show all

Unified · Split

interface/src/Application.cpp+7−10
@@ -88,7 +88,7 @@ const float MIRROR_REARVIEW_BODY_DISTANCE = 1.f; · 87 unmodified lines
88 88
89void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {89void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
90 fprintf(stdout, "%s", message.toLocal8Bit().constData());90 fprintf(stdout, "%s", message.toLocal8Bit().constData());
91 LogDisplay::instance.addMessage(message.toLocal8Bit().constData());91 Application::getInstance()->getLogger()->addMessage(message.toLocal8Bit().constData());
92}92}
93 93
94Application::Application(int& argc, char** argv, timeval &startup_time) :94Application::Application(int& argc, char** argv, timeval &startup_time) :
@@ -149,6 +149,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 54 unmodified lines
149 QFontDatabase::addApplicationFont("resources/styles/Inconsolata.otf");149 QFontDatabase::addApplicationFont("resources/styles/Inconsolata.otf");
150 _window->setWindowTitle("Interface");150 _window->setWindowTitle("Interface");
151 151
152 _logger = new FileLogger();
153
152 qInstallMessageHandler(messageHandler);154 qInstallMessageHandler(messageHandler);
153 155
154 // call Menu getInstance static method to set up the menu156 // call Menu getInstance static method to set up the menu
@@ -1346,7 +1348,7 @@ void Application::idle() { · 1191 unmodified lines
1346 // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing 1348 // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing
1347 // details if we're in ExtraDebugging mode. However, the ::update() and it's subcomponents will show their timing 1349 // details if we're in ExtraDebugging mode. However, the ::update() and it's subcomponents will show their timing
1348 // details normally.1350 // details normally.
1349 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging);1351 bool showWarnings = getLogger()->extraDebugging();
1350 PerformanceWarning warn(showWarnings, "Application::idle()");1352 PerformanceWarning warn(showWarnings, "Application::idle()");
1351 1353
1352 timeval check;1354 timeval check;
@@ -2665,7 +2667,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 1312 unmodified lines
2665 return;2667 return;
2666 }2668 }
2667 2669
2668 bool wantExtraDebugging = Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging);2670 bool wantExtraDebugging = getLogger()->extraDebugging();
2669 2671
2670 // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.2672 // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
2671 _voxelQuery.setWantLowResMoving(!Menu::getInstance()->isOptionChecked(MenuOption::DisableLowRes));2673 _voxelQuery.setWantLowResMoving(!Menu::getInstance()->isOptionChecked(MenuOption::DisableLowRes));
@@ -3349,11 +3351,6 @@ void Application::displayOverlay() { · 677 unmodified lines
3349 if (Menu::getInstance()->isOptionChecked(MenuOption::CoverageMap)) {3351 if (Menu::getInstance()->isOptionChecked(MenuOption::CoverageMap)) {
3350 renderCoverageMap();3352 renderCoverageMap();
3351 }3353 }
3352
3353
3354 if (Menu::getInstance()->isOptionChecked(MenuOption::Log)) {
3355 LogDisplay::instance.render(_glWidget->width(), _glWidget->height());
3356 }
3357 3354
3358 // Show chat entry field3355 // Show chat entry field
3359 if (_chatEntryOn) {3356 if (_chatEntryOn) {
@@ -4356,7 +4353,7 @@ void* Application::networkReceive(void* args) { · 996 unmodified lines
4356 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), 4353 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
4357 "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()");4354 "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()");
4358 4355
4359 bool wantExtraDebugging = Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging);4356 bool wantExtraDebugging = app->getLogger()->extraDebugging();
4360 if (wantExtraDebugging && app->_incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) {4357 if (wantExtraDebugging && app->_incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) {
4361 int numBytesPacketHeader = numBytesForPacketHeader(app->_incomingPacket);4358 int numBytesPacketHeader = numBytesForPacketHeader(app->_incomingPacket);
4362 unsigned char* dataAt = app->_incomingPacket + numBytesPacketHeader;4359 unsigned char* dataAt = app->_incomingPacket + numBytesPacketHeader;
@@ -4481,7 +4478,7 @@ void Application::loadScript() { · 118 unmodified lines
4481 4478
4482void Application::toggleLogDialog() {4479void Application::toggleLogDialog() {
4483 if (! _logDialog) {4480 if (! _logDialog) {
4484 _logDialog = new LogDialog(_glWidget);4481 _logDialog = new LogDialog(_glWidget, getLogger());
4485 _logDialog->show();4482 _logDialog->show();
4486 } else {4483 } else {
4487 _logDialog->close();4484 _logDialog->close();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t