Changeset 46810 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 26, 2013 5:35:03 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86750
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc
r46777 r46810 255 255 <file alias="shared_clipboard_16px.png">images/shared_clipboard_16px.png</file> 256 256 <file alias="shared_clipboard_disabled_16px.png">images/shared_clipboard_disabled_16px.png</file> 257 <file alias="movie_reel_16px.png">images/movie_reel_16px.png</file> 257 258 </qresource> 258 259 </RCC> -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r46708 r46810 20 20 /* Qt includes: */ 21 21 #include <QTimer> 22 #include <QPainter> 22 23 23 24 /* GUI includes: */ … … 26 27 #include "UIMachineDefs.h" 27 28 #include "UIConverter.h" 29 #include "UIAnimationFramework.h" 28 30 29 31 /* COM includes: */ … … 491 493 { 492 494 Q_OBJECT; 495 Q_PROPERTY(double rotationAngleStart READ rotationAngleStart); 496 Q_PROPERTY(double rotationAngleFinal READ rotationAngleFinal); 497 Q_PROPERTY(double rotationAngle READ rotationAngle WRITE setRotationAngle); 493 498 494 499 public: … … 498 503 { 499 504 UIIndicatorStateVideoCapture_Disabled = 0, 500 UIIndicatorStateVideoCapture_Enabled = 1, 501 UIIndicatorStateVideoCapture_Writing = 2 505 UIIndicatorStateVideoCapture_Enabled = 1 502 506 }; 503 507 … … 505 509 UIIndicatorVideoCapture(CSession &session) 506 510 : m_session(session) 507 , m_pUpdateTimer(new QTimer(this)) 511 , m_pAnimation(0) 512 , m_dRotationAngle(0) 508 513 { 509 514 /* Assign state icons: */ 510 setStateIcon(UIIndicatorStateVideoCapture_Disabled, QPixmap(":/ video_capture_disabled_16px.png"));511 setStateIcon(UIIndicatorStateVideoCapture_Enabled, QPixmap(":/video_capture_16px.png"));512 setStateIcon(UIIndicatorStateVideoCapture_Writing, QPixmap(":/video_capture_write_16px.png")); 513 514 /* Connect timer to update active state: */515 connect(m_pUpdateTimer, SIGNAL(timeout()), SLOT(sltUpdateState()));516 m_pUpdateTimer->start(500);515 setStateIcon(UIIndicatorStateVideoCapture_Disabled, QPixmap(":/movie_reel_16px.png")); 516 setStateIcon(UIIndicatorStateVideoCapture_Enabled, QPixmap(":/movie_reel_16px.png")); 517 518 /* Prepare *enabled* state animation: */ 519 m_pAnimation = UIAnimationLoop::installAnimationLoop(this, "rotationAngle", 520 "rotationAngleStart", "rotationAngleFinal", 521 1000); 517 522 518 523 /* Translate finally: */ … … 540 545 } 541 546 case UIIndicatorStateVideoCapture_Enabled: 542 case UIIndicatorStateVideoCapture_Writing:543 547 { 544 548 strToolTip += QApplication::translate("UIIndicatorsPool", "<nobr><b>Video capture file:</b> %1</nobr>") … … 552 556 } 553 557 554 protected slots: 555 556 /* Handler: Update stuff: */ 557 void sltUpdateState() 558 { 559 /* Toggle state from 'Enabled' to 'Writing': */ 558 public slots: 559 560 /* Handler: State stuff: */ 561 void setState(int iState) 562 { 563 /* Update animation state: */ 564 switch (iState) 565 { 566 case UIIndicatorStateVideoCapture_Disabled: 567 m_pAnimation->stop(); 568 m_dRotationAngle = 0; 569 break; 570 case UIIndicatorStateVideoCapture_Enabled: 571 m_pAnimation->start(); 572 break; 573 default: 574 break; 575 } 576 577 /* Call to base-class: */ 578 QIStateIndicator::setState(iState); 579 } 580 581 protected: 582 583 /* Handler: Translate stuff: */ 584 void retranslateUi() 585 { 586 updateAppearance(); 587 } 588 589 /* Handler: Paint stuff: */ 590 void paintEvent(QPaintEvent*) 591 { 592 /* Create new painter: */ 593 QPainter painter(this); 594 /* Configure painter for *enabled* state: */ 560 595 if (state() == UIIndicatorStateVideoCapture_Enabled) 561 setState(UIIndicatorStateVideoCapture_Writing); 562 /* Toggle state from 'Writing' to 'Enabled': */ 563 else if (state() == UIIndicatorStateVideoCapture_Writing) 564 setState(UIIndicatorStateVideoCapture_Enabled); 565 } 566 567 protected: 568 569 /* Handler: Translate stuff: */ 570 void retranslateUi() 571 { 572 updateAppearance(); 573 } 596 { 597 /* Shift rotation origin according pixmap center: */ 598 painter.translate(height() / 2, height() / 2); 599 /* Rotate painter: */ 600 painter.rotate(rotationAngle()); 601 /* Unshift rotation origin according pixmap center: */ 602 painter.translate(- height() / 2, - height() / 2); 603 } 604 /* Draw contents: */ 605 drawContents(&painter); 606 } 607 608 /* Properties: Rotation stuff: */ 609 double rotationAngleStart() const { return 0; } 610 double rotationAngleFinal() const { return 360; } 611 double rotationAngle() const { return m_dRotationAngle; } 612 void setRotationAngle(double dRotationAngle) { m_dRotationAngle = dRotationAngle; update(); } 574 613 575 614 /* For compatibility reason we do it here, 576 615 * later this should be moved to QIStateIndicator. */ 577 616 CSession &m_session; 578 QTimer *m_pUpdateTimer; 617 UIAnimationLoop *m_pAnimation; 618 double m_dRotationAngle; 579 619 }; 580 620
Note:
See TracChangeset
for help on using the changeset viewer.