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