History

Removing access to the gl widget and display managers

Brad Davis committed 11 years ago

Commit 302aa9d1 parent 539063035 files · +401 −440Browse files

Showing the changes to interface/src/ui/Stats.cpp (1 of 35 files). Show all

Unified · Split

interface/src/ui/Stats.cpp+10−10
@@ -57,8 +57,8 @@ Stats::Stats(): · 56 unmodified lines
5757 _octreeStatsWidth(STATS_OCTREE_MIN_WIDTH),
5858 _lastHorizontalOffset(0)
5959 {
60− auto glCanvas = Application::getInstance()->getGLWidget();
61− resetWidth(glCanvas->width(), 0);
60+ auto canvasSize = Application::getInstance()->getCanvasSize();
61+ resetWidth(canvasSize.x, 0);
6262 }
6363
6464 void Stats::toggleExpanded() {
@@ -68,7 +68,7 @@ void Stats::toggleExpanded() { · 3 unmodified lines
6868 // called on mouse click release
6969 // check for clicks over stats in order to expand or contract them
7070 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();
7272
7373 if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) {
7474 // not worried about dragging on stats
@@ -115,7 +115,7 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD · 40 unmodified lines
115115 // top-right stats click
116116 lines = _expanded ? 11 : 3;
117117 statsHeight = lines * STATS_PELS_PER_LINE + 10;
118− statsWidth = glCanvas->width() - statsX;
118+ statsWidth = canvasSize.x - statsX;
119119 if (mouseX > statsX && mouseX < statsX + statsWidth && mouseY > statsY && mouseY < statsY + statsHeight) {
120120 toggleExpanded();
121121 return;
@@ -123,8 +123,8 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD · 1 unmodified line
123123 }
124124
125125 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
128128 - STATS_GENERAL_MIN_WIDTH
129129 - (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
130130 - STATS_GEO_MIN_WIDTH
@@ -148,7 +148,7 @@ void Stats::resetWidth(int width, int horizontalOffset) { · 17 unmodified lines
148148 _pingStatsWidth += (int) extraSpace / panels;
149149 }
150150 _geoStatsWidth += (int) extraSpace / panels;
151− _octreeStatsWidth += glCanvas->width() -
151+ _octreeStatsWidth += canvasSize.x -
152152 (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
153153 }
154154 }
@@ -197,7 +197,7 @@ void Stats::display( · 42 unmodified lines
197197 int outKbitsPerSecond,
198198 int voxelPacketsToProcess)
199199 {
200− auto glCanvas = Application::getInstance()->getGLWidget();
200+ auto canvasSize = Application::getInstance()->getCanvasSize();
201201
202202 unsigned int backgroundColor = 0x33333399;
203203 int verticalOffset = 0, lines = 0;
@@ -211,7 +211,7 @@ void Stats::display( · 7 unmodified lines
211211 QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
212212
213213 if (_lastHorizontalOffset != horizontalOffset) {
214− resetWidth(glCanvas->width(), horizontalOffset);
214+ resetWidth(canvasSize.x, horizontalOffset);
215215 _lastHorizontalOffset = horizontalOffset;
216216 }
217217
@@ -461,7 +461,7 @@ void Stats::display( · 243 unmodified lines
461461
462462 lines = _expanded ? 10 : 2;
463463
464− drawBackground(backgroundColor, horizontalOffset, 0, glCanvas->width() - horizontalOffset,
464+ drawBackground(backgroundColor, horizontalOffset, 0, canvasSize.x - horizontalOffset,
465465 (lines + 1) * STATS_PELS_PER_LINE);
466466 horizontalOffset += 5;
467467