Changeset 98973 in vbox
- Timestamp:
- Mar 15, 2023 9:44:14 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 156322
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp ¶
r98966 r98973 184 184 } 185 185 186 private slots: 187 188 /** Refreshes the tooltip if the device config changes at runtime (hotplugging, USB storage). */ 189 void sltStorageDeviceChange() 190 { 191 updateAppearance(); 192 } 193 194 private: 186 protected: 195 187 196 188 /** Update routine. */ 197 v oid updateAppearance()189 virtual void updateAppearance() RT_OVERRIDE 198 190 { 199 191 /* Acquire data: */ … … 213 205 /* Update indicator state: */ 214 206 setState(fAttachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null); 207 } 208 209 private slots: 210 211 /** Refreshes the tooltip if the device config changes at runtime (hotplugging, USB storage). */ 212 void sltStorageDeviceChange() 213 { 214 updateAppearance(); 215 215 } 216 216 }; … … 237 237 } 238 238 239 pr ivate:239 protected: 240 240 241 241 /** Update routine. */ 242 v oid updateAppearance()242 virtual void updateAppearance() RT_OVERRIDE 243 243 { 244 244 QString strFullData; … … 282 282 } 283 283 284 pr ivate:284 protected: 285 285 286 286 /** Update routine. */ 287 v oid updateAppearance()287 virtual void updateAppearance() RT_OVERRIDE 288 288 { 289 289 QString strFullData; … … 336 336 } 337 337 338 pr ivate:338 protected: 339 339 340 340 /** Update routine. */ 341 v oid updateAppearance()341 virtual void updateAppearance() RT_OVERRIDE 342 342 { 343 343 QString strFullData; … … 392 392 { 393 393 /* Configure auto-update timer: */ 394 connect(m_pTimerAutoUpdate, &QTimer::timeout, this, &UIIndicatorNetwork::sltUpdateNetworkIPs); 394 connect(m_pTimerAutoUpdate, &QTimer::timeout, 395 this, &UIIndicatorNetwork::sltUpdateNetworkIPs); 395 396 /* Start timer immediately if machine is running: */ 396 397 sltHandleMachineStateChange(); … … 398 399 /* Translate finally: */ 399 400 retranslateUi(); 401 } 402 403 protected: 404 405 /** Update routine. */ 406 virtual void updateAppearance() RT_OVERRIDE 407 { 408 QString strFullData; 409 bool fAdaptersPresent = false; 410 bool fCablesDisconnected = true; 411 m_pMachine->acquireNetworkStatusInfo(strFullData, fAdaptersPresent, fCablesDisconnected); 412 413 /* Show/hide indicator if there are no attachments 414 * and parent is visible already: */ 415 if ( parentWidget() 416 && parentWidget()->isVisible()) 417 setVisible(fAdaptersPresent); 418 419 /* Update tool-tip: */ 420 if (!strFullData.isEmpty()) 421 setToolTip(s_strTable.arg(strFullData)); 422 /* Update indicator state: */ 423 setState(fAdaptersPresent && !fCablesDisconnected ? KDeviceActivity_Idle : KDeviceActivity_Null); 400 424 } 401 425 … … 423 447 private: 424 448 425 /** Update routine. */426 void updateAppearance()427 {428 QString strFullData;429 bool fAdaptersPresent = false;430 bool fCablesDisconnected = true;431 m_pMachine->acquireNetworkStatusInfo(strFullData, fAdaptersPresent, fCablesDisconnected);432 433 /* Show/hide indicator if there are no attachments434 * and parent is visible already: */435 if ( parentWidget()436 && parentWidget()->isVisible())437 setVisible(fAdaptersPresent);438 439 /* Update tool-tip: */440 if (!strFullData.isEmpty())441 setToolTip(s_strTable.arg(strFullData));442 /* Update indicator state: */443 setState(fAdaptersPresent && !fCablesDisconnected ? KDeviceActivity_Idle : KDeviceActivity_Null);444 }445 446 449 /** Holds the auto-update timer instance. */ 447 450 QTimer *m_pTimerAutoUpdate; … … 469 472 } 470 473 471 pr ivate:474 protected: 472 475 473 476 /** Update routine. */ 474 v oid updateAppearance()477 virtual void updateAppearance() RT_OVERRIDE 475 478 { 476 479 QString strFullData; … … 513 516 } 514 517 515 pr ivate:518 protected: 516 519 517 520 /** Update routine. */ 518 v oid updateAppearance()521 virtual void updateAppearance() RT_OVERRIDE 519 522 { 520 523 QString strFullData; … … 550 553 } 551 554 552 pr ivate:555 protected: 553 556 554 557 /** Update routine. */ 555 v oid updateAppearance()558 virtual void updateAppearance() RT_OVERRIDE 556 559 { 557 560 QString strFullData; … … 602 605 /* Translate finally: */ 603 606 retranslateUi(); 607 } 608 609 protected: 610 611 /** Handles paint @a pEvent. */ 612 virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE 613 { 614 /* Call to base-class: */ 615 UISessionStateStatusBarIndicator::paintEvent(pEvent); 616 617 /* Create new painter: */ 618 QPainter painter(this); 619 /* Configure painter for *enabled* state: */ 620 if (state() == UIIndicatorStateRecording_Enabled) 621 { 622 /* Configure painter for smooth animation: */ 623 painter.setRenderHint(QPainter::Antialiasing); 624 painter.setRenderHint(QPainter::SmoothPixmapTransform); 625 /* Shift rotation origin according pixmap center: */ 626 painter.translate(height() / 2, height() / 2); 627 /* Rotate painter: */ 628 painter.rotate(rotationAngle()); 629 /* Unshift rotation origin according pixmap center: */ 630 painter.translate(- height() / 2, - height() / 2); 631 } 632 /* Draw contents: */ 633 drawContents(&painter); 634 } 635 636 /** Update routine. */ 637 virtual void updateAppearance() RT_OVERRIDE 638 { 639 QString strFullData; 640 bool fRecordingEnabled = false; 641 bool fMachinePaused = false; 642 m_pMachine->acquireRecordingStatusInfo(strFullData, fRecordingEnabled, fMachinePaused); 643 644 /* Update tool-tip: */ 645 if (!strFullData.isEmpty()) 646 setToolTip(s_strTable.arg(strFullData)); 647 /* Set initial indicator state: */ 648 if (!fRecordingEnabled) 649 setState(UIIndicatorStateRecording_Disabled); 650 else if (!fMachinePaused) 651 setState(UIIndicatorStateRecording_Enabled); 652 else 653 setState(UIIndicatorStateRecording_Paused); 604 654 } 605 655 … … 631 681 private: 632 682 633 /** Paint-event handler. */634 void paintEvent(QPaintEvent*)635 {636 /* Create new painter: */637 QPainter painter(this);638 /* Configure painter for *enabled* state: */639 if (state() == UIIndicatorStateRecording_Enabled)640 {641 /* Configure painter for smooth animation: */642 painter.setRenderHint(QPainter::Antialiasing);643 painter.setRenderHint(QPainter::SmoothPixmapTransform);644 /* Shift rotation origin according pixmap center: */645 painter.translate(height() / 2, height() / 2);646 /* Rotate painter: */647 painter.rotate(rotationAngle());648 /* Unshift rotation origin according pixmap center: */649 painter.translate(- height() / 2, - height() / 2);650 }651 /* Draw contents: */652 drawContents(&painter);653 }654 655 /** Update routine. */656 void updateAppearance()657 {658 QString strFullData;659 bool fRecordingEnabled = false;660 bool fMachinePaused = false;661 m_pMachine->acquireRecordingStatusInfo(strFullData, fRecordingEnabled, fMachinePaused);662 663 /* Update tool-tip: */664 if (!strFullData.isEmpty())665 setToolTip(s_strTable.arg(strFullData));666 /* Set initial indicator state: */667 if (!fRecordingEnabled)668 setState(UIIndicatorStateRecording_Disabled);669 else if (!fMachinePaused)670 setState(UIIndicatorStateRecording_Enabled);671 else672 setState(UIIndicatorStateRecording_Paused);673 }674 675 683 /** Returns rotation start angle. */ 676 684 double rotationAngleStart() const { return 0; } … … 715 723 if (m_pTimerAutoUpdate) 716 724 { 717 connect(m_pTimerAutoUpdate, &QTimer::timeout, this, &UIIndicatorFeatures::sltHandleTimeout); 725 connect(m_pTimerAutoUpdate, &QTimer::timeout, 726 this, &UIIndicatorFeatures::sltHandleTimeout); 718 727 /* Start the timer immediately if the machine is running: */ 719 728 sltHandleMachineStateChange(); … … 728 737 virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE 729 738 { 739 /* Call to base-class: */ 730 740 UISessionStateStatusBarIndicator::paintEvent(pEvent); 741 742 /* Create new painter: */ 731 743 QPainter painter(this); 732 733 744 /* Draw a thin bar on th right hand side of the icon indication CPU load: */ 734 745 QLinearGradient gradient(0, 0, 0, height()); … … 736 747 gradient.setColorAt(0.5, Qt::yellow); 737 748 gradient.setColorAt(0.0, Qt::red); 738 739 749 painter.setPen(Qt::NoPen); 740 750 painter.setBrush(gradient); … … 751 761 } 752 762 763 /** Update routine. */ 764 virtual void updateAppearance() RT_OVERRIDE 765 { 766 QString strFullData; 767 KVMExecutionEngine enmEngine = KVMExecutionEngine_NotSet; 768 m_pMachine->acquireFeaturesStatusInfo(strFullData, enmEngine); 769 770 /* Update tool-tip: */ 771 if (!strFullData.isEmpty()) 772 setToolTip(s_strTable.arg(strFullData)); 773 /* Update indicator state: */ 774 setState(enmEngine); 775 } 776 753 777 private slots: 754 778 … … 774 798 775 799 private: 776 777 /** Update routine. */778 void updateAppearance()779 {780 QString strFullData;781 KVMExecutionEngine enmEngine = KVMExecutionEngine_NotSet;782 m_pMachine->acquireFeaturesStatusInfo(strFullData, enmEngine);783 784 /* Update tool-tip: */785 if (!strFullData.isEmpty())786 setToolTip(s_strTable.arg(strFullData));787 /* Update indicator state: */788 setState(enmEngine);789 }790 800 791 801 /** Holds the auto-update timer instance. */ … … 822 832 } 823 833 824 private slots: 825 826 /** Handles state change. */ 827 void setState(int iState) 828 { 829 if ((iState & UIMouseStateType_MouseAbsoluteDisabled) && 830 (iState & UIMouseStateType_MouseAbsolute) && 831 !(iState & UIMouseStateType_MouseCaptured)) 832 { 833 QIStateStatusBarIndicator::setState(4); 834 } 835 else 836 { 837 QIStateStatusBarIndicator::setState(iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured)); 838 } 839 } 840 841 private: 834 protected: 842 835 843 836 /** Update routine. */ 844 v oid updateAppearance()837 virtual void updateAppearance() RT_OVERRIDE 845 838 { 846 839 const QString strToolTip = QApplication::translate("UIIndicatorsPool", … … 871 864 setToolTip(strToolTip.arg(strFullData)); 872 865 } 866 867 private slots: 868 869 /** Handles state change. */ 870 void setState(int iState) 871 { 872 if ((iState & UIMouseStateType_MouseAbsoluteDisabled) && 873 (iState & UIMouseStateType_MouseAbsolute) && 874 !(iState & UIMouseStateType_MouseCaptured)) 875 { 876 QIStateStatusBarIndicator::setState(4); 877 } 878 else 879 { 880 QIStateStatusBarIndicator::setState(iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured)); 881 } 882 } 873 883 }; 874 884 … … 901 911 } 902 912 903 pr ivate:913 protected: 904 914 905 915 /** Update routine. */ 906 v oid updateAppearance()916 virtual void updateAppearance() RT_OVERRIDE 907 917 { 908 918 const QString strToolTip = QApplication::translate("UIIndicatorsPool",
Note:
See TracChangeset
for help on using the changeset viewer.