Showing the changes to interface/src/ui/Stats.cpp (1 of 35 files). Show all
Unified · Split
| @@ -57,8 +57,8 @@ Stats::Stats(): · 56 unmodified lines | |||
| 57 | _octreeStatsWidth(STATS_OCTREE_MIN_WIDTH), | 57 | _octreeStatsWidth(STATS_OCTREE_MIN_WIDTH), |
| 58 | _lastHorizontalOffset(0) | 58 | _lastHorizontalOffset(0) |
| 59 | { | 59 | { |
| 60 | auto glCanvas = Application::getInstance()->getGLWidget(); | 60 | auto canvasSize = Application::getInstance()->getCanvasSize(); |
| 61 | resetWidth(glCanvas->width(), 0); | 61 | resetWidth(canvasSize.x, 0); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | void Stats::toggleExpanded() { | 64 | void Stats::toggleExpanded() { |
| @@ -68,7 +68,7 @@ void Stats::toggleExpanded() { · 3 unmodified lines | |||
| 68 | // called on mouse click release | 68 | // called on mouse click release |
| 69 | // check for clicks over stats in order to expand or contract them | 69 | // check for clicks over stats in order to expand or contract them |
| 70 | void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) { | 70 | void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) { |
| 71 | auto glCanvas = Application::getInstance()->getGLWidget(); | 71 | auto canvasSize = Application::getInstance()->getCanvasSize(); |
| 72 | 72 | ||
| 73 | if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) { | 73 | if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) { |
| 74 | // not worried about dragging on stats | 74 | // not worried about dragging on stats |
| @@ -115,7 +115,7 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD · 40 unmodified lines | |||
| 115 | // top-right stats click | 115 | // top-right stats click |
| 116 | lines = _expanded ? 11 : 3; | 116 | lines = _expanded ? 11 : 3; |
| 117 | statsHeight = lines * STATS_PELS_PER_LINE + 10; | 117 | statsHeight = lines * STATS_PELS_PER_LINE + 10; |
| 118 | statsWidth = glCanvas->width() - statsX; | 118 | statsWidth = canvasSize.x - statsX; |
| 119 | if (mouseX > statsX && mouseX < statsX + statsWidth && mouseY > statsY && mouseY < statsY + statsHeight) { | 119 | if (mouseX > statsX && mouseX < statsX + statsWidth && mouseY > statsY && mouseY < statsY + statsHeight) { |
| 120 | toggleExpanded(); | 120 | toggleExpanded(); |
| 121 | return; | 121 | return; |
| @@ -123,8 +123,8 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD · 1 unmodified line | |||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | void Stats::resetWidth(int width, int horizontalOffset) { | 125 | void Stats::resetWidth(int width, int horizontalOffset) { |
| 126 | auto glCanvas = Application::getInstance()->getGLWidget(); | 126 | auto canvasSize = Application::getInstance()->getCanvasSize(); |
| 127 | int extraSpace = glCanvas->width() - horizontalOffset -2 | 127 | int extraSpace = canvasSize.x - horizontalOffset - 2 |
| 128 | - STATS_GENERAL_MIN_WIDTH | 128 | - STATS_GENERAL_MIN_WIDTH |
| 129 | - (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0) | 129 | - (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0) |
| 130 | - STATS_GEO_MIN_WIDTH | 130 | - STATS_GEO_MIN_WIDTH |
| @@ -148,7 +148,7 @@ void Stats::resetWidth(int width, int horizontalOffset) { · 17 unmodified lines | |||
| 148 | _pingStatsWidth += (int) extraSpace / panels; | 148 | _pingStatsWidth += (int) extraSpace / panels; |
| 149 | } | 149 | } |
| 150 | _geoStatsWidth += (int) extraSpace / panels; | 150 | _geoStatsWidth += (int) extraSpace / panels; |
| 151 | _octreeStatsWidth += glCanvas->width() - | 151 | _octreeStatsWidth += canvasSize.x - |
| 152 | (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3); | 152 | (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3); |
| 153 | } | 153 | } |
| 154 | } | 154 | } |
| @@ -197,7 +197,7 @@ void Stats::display( · 42 unmodified lines | |||
| 197 | int outKbitsPerSecond, | 197 | int outKbitsPerSecond, |
| 198 | int voxelPacketsToProcess) | 198 | int voxelPacketsToProcess) |
| 199 | { | 199 | { |
| 200 | auto glCanvas = Application::getInstance()->getGLWidget(); | 200 | auto canvasSize = Application::getInstance()->getCanvasSize(); |
| 201 | 201 | ||
| 202 | unsigned int backgroundColor = 0x33333399; | 202 | unsigned int backgroundColor = 0x33333399; |
| 203 | int verticalOffset = 0, lines = 0; | 203 | int verticalOffset = 0, lines = 0; |
| @@ -211,7 +211,7 @@ void Stats::display( · 7 unmodified lines | |||
| 211 | QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>(); | 211 | QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>(); |
| 212 | 212 | ||
| 213 | if (_lastHorizontalOffset != horizontalOffset) { | 213 | if (_lastHorizontalOffset != horizontalOffset) { |
| 214 | resetWidth(glCanvas->width(), horizontalOffset); | 214 | resetWidth(canvasSize.x, horizontalOffset); |
| 215 | _lastHorizontalOffset = horizontalOffset; | 215 | _lastHorizontalOffset = horizontalOffset; |
| 216 | } | 216 | } |
| 217 | 217 | ||
| @@ -461,7 +461,7 @@ void Stats::display( · 243 unmodified lines | |||
| 461 | 461 | ||
| 462 | lines = _expanded ? 10 : 2; | 462 | lines = _expanded ? 10 : 2; |
| 463 | 463 | ||
| 464 | drawBackground(backgroundColor, horizontalOffset, 0, glCanvas->width() - horizontalOffset, | 464 | drawBackground(backgroundColor, horizontalOffset, 0, canvasSize.x - horizontalOffset, |
| 465 | (lines + 1) * STATS_PELS_PER_LINE); | 465 | (lines + 1) * STATS_PELS_PER_LINE); |
| 466 | horizontalOffset += 5; | 466 | horizontalOffset += 5; |
| 467 | 467 | ||