Changeset 80771 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 13, 2019 10:25:13 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp
r80766 r80771 161 161 const QStringList &textList() const; 162 162 163 bool withPieChart() const; 164 void setWithPieChart(bool fWithPieChart); 163 bool isPieChartAllowed() const; 164 void setIsPieChartAllowed(bool fWithPieChart); 165 166 bool drawPieChart() const; 167 void setDrawPieChart(bool fDrawPieChart); 165 168 166 169 bool useGradientLineColor() const; … … 184 187 void sltCreateContextMenu(const QPoint &point); 185 188 void sltResetMetric(); 189 void sltSetDrawPieChart(bool fDrawPieChart); 186 190 187 191 private: … … 217 221 int m_iPieChartRadius; 218 222 int m_iPieChartSpacing; 219 bool m_fWithPieChart; 223 /** For some chart it is not possible to have a pie chart, Then We dont present the 224 * option to show it to user. see m_fIsPieChartAllowed. */ 225 bool m_fIsPieChartAllowed; 226 /** m_fDrawPieChart is considered only if m_fIsPieChartAllowed is true. */ 227 bool m_fDrawPieChart; 220 228 bool m_fUseGradientLineColor; 221 229 QColor m_dataSeriesColor[DATA_SERIES_SIZE]; … … 223 231 QString m_strGAWarning; 224 232 QString m_strResetActionLabel; 233 QString m_strPieChartToggleActionLabel; 225 234 }; 226 235 … … 524 533 , m_size(QSize(50, 50)) 525 534 , m_iOverlayAlpha(80) 526 , m_fWithPieChart(false) 535 , m_fIsPieChartAllowed(false) 536 , m_fDrawPieChart(true) 527 537 , m_fUseGradientLineColor(false) 528 538 { … … 557 567 } 558 568 559 bool UIChart::withPieChart() const 560 { 561 return m_fWithPieChart; 562 } 563 564 void UIChart::setWithPieChart(bool fWithPieChart) 565 { 566 if (m_fWithPieChart == fWithPieChart) 567 return; 568 m_fWithPieChart = fWithPieChart; 569 bool UIChart::isPieChartAllowed() const 570 { 571 return m_fIsPieChartAllowed; 572 } 573 574 void UIChart::setIsPieChartAllowed(bool fWithPieChart) 575 { 576 if (m_fIsPieChartAllowed == fWithPieChart) 577 return; 578 m_fIsPieChartAllowed = fWithPieChart; 579 update(); 580 } 581 582 bool UIChart::drawPieChart() const 583 { 584 return m_fDrawPieChart; 585 } 586 587 void UIChart::setDrawPieChart(bool fDrawChart) 588 { 589 if (m_fDrawPieChart == fDrawChart) 590 return; 591 m_fDrawPieChart = fDrawChart; 569 592 update(); 570 593 } … … 625 648 m_strGAWarning = QApplication::translate("UIVMInformationDialog", "No guest additions! This metric requires guest additions to work properly."); 626 649 m_strResetActionLabel = QApplication::translate("UIVMInformationDialog", "Reset"); 650 m_strPieChartToggleActionLabel = QApplication::translate("UIVMInformationDialog", "Show Pie Chart"); 627 651 } 628 652 … … 668 692 painter.setPen(mainAxisColor); 669 693 drawXAxisLabels(painter, iXSubAxisCount); 670 671 694 672 695 /* Draw a half-transparent rectangle over the whole widget to indicate the it is disabled: */ … … 731 754 } 732 755 733 if (m_f WithPieChart)756 if (m_fIsPieChartAllowed && m_fDrawPieChart) 734 757 drawCombinedPieCharts(painter, iMaximum); 735 758 } … … 853 876 QPainterPath arc; 854 877 QPointF center(rectangle.center()); 855 856 // arc.moveTo(center);857 // arc.arcTo(rectangle, 90/*startAngle*/,858 // -1 * 360 /*sweepLength*/);859 860 878 arc.addEllipse(rectangle); 861 879 return arc; … … 938 956 QAction *pResetAction = menu.addAction(m_strResetActionLabel); 939 957 connect(pResetAction, &QAction::triggered, this, &UIChart::sltResetMetric); 958 if (m_fIsPieChartAllowed) 959 { 960 QAction *pPieChartToggle = menu.addAction(m_strPieChartToggleActionLabel); 961 pPieChartToggle->setCheckable(true); 962 pPieChartToggle->setChecked(m_fDrawPieChart); 963 connect(pPieChartToggle, &QAction::toggled, this, &UIChart::sltSetDrawPieChart); 964 } 940 965 menu.exec(mapToGlobal(point)); 941 966 } … … 945 970 if (m_pMetric) 946 971 m_pMetric->reset(); 972 } 973 974 void UIChart::sltSetDrawPieChart(bool fDrawPieChart) 975 { 976 setDrawPieChart(fDrawPieChart); 947 977 } 948 978 … … 1257 1287 /* Configure charts: */ 1258 1288 if (m_charts.contains(m_strCPUMetricName) && m_charts[m_strCPUMetricName]) 1259 m_charts[m_strCPUMetricName]->set WithPieChart(true);1289 m_charts[m_strCPUMetricName]->setIsPieChartAllowed(true); 1260 1290 1261 1291 m_pRuntimeInfoWidget = new UIRuntimeInfoWidget(0, m_machine, m_console);
Note:
See TracChangeset
for help on using the changeset viewer.