Changeset 51310 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 20, 2014 5:23:54 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro
r51304 r51310 22 22 23 23 FORMS = \ 24 src/UIVMInfoDialog.ui \25 24 src/VBoxSnapshotDetailsDlg.ui \ 26 25 src/VBoxTakeSnapshotDlg.ui \ -
trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ja.ts
r51304 r51310 17967 17967 </message> 17968 17968 <message> 17969 <location filename="../src/UIVMInfoDialog.ui" line="26"/>17970 17969 <source>UIVMInfoDialog</source> 17971 17970 <translation>UIVMInfoDialog</translation> 17972 17971 </message> 17973 17972 <message> 17974 <location filename="../src/UIVMInfoDialog.ui" line="37"/>17975 17973 <source>Configuration &Details</source> 17976 17974 <translation>設定の詳細(&D)</translation> 17977 17975 </message> 17978 17976 <message> 17979 <location filename="../src/UIVMInfoDialog.ui" line="72"/>17980 17977 <source>&Runtime Information</source> 17981 17978 <translation>ランタイム情報(&R)</translation> -
trunk/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.cpp
r51309 r51310 26 26 27 27 /* GUI includes: */ 28 #include "UIVMInfoDialog.h" 29 #include "UISession.h" 30 #include "UIMachineLogic.h" 31 #include "UIMachineWindow.h" 32 #include "UIMachineView.h" 33 #include "UIConverter.h" 28 34 #include "UIIconPool.h" 29 #include "UIMachineLogic.h"30 #include "UIMachineView.h"31 #include "UIMachineWindow.h"32 #include "UISession.h"33 35 #include "VBoxGlobal.h" 34 #include "UIVMInfoDialog.h"35 #include "UIConverter.h"36 36 37 37 /* COM includes: */ … … 48 48 #include "CVRDEServerInfo.h" 49 49 50 /* Other VBox includes: */ 50 51 #include <iprt/time.h> 51 52 … … 79 80 , m_fIsPolished(false) 80 81 , m_iWidth(0), m_iHeight(0), m_fMax(false) 82 , m_pTabWidget(0) 81 83 , m_session(pMachineWindow->session()) 82 84 , m_pTimer(new QTimer(this)) … … 100 102 void UIVMInfoDialog::retranslateUi() 101 103 { 102 /* Translate uic generated strings: */103 Ui::UIVMInfoDialog::retranslateUi(this);104 105 104 sltUpdateDetails(); 106 105 … … 109 108 AssertReturnVoid(!machine.isNull()); 110 109 111 /* Setup a dialog caption: */110 /* Setup dialog title: */ 112 111 setWindowTitle(tr("%1 - Session Information").arg(machine.GetName())); 112 113 /* Translate tabs: */ 114 m_pTabWidget->setTabText(0, tr("Configuration &Details")); 115 m_pTabWidget->setTabText(1, tr("&Runtime Information")); 113 116 114 117 /* Clear counter names initially: */ … … 270 273 switch (pEvent->type()) 271 274 { 272 /* Window state-change event: */275 /* Store window state for this VM: */ 273 276 case QEvent::WindowStateChange: 274 277 { 275 278 if (m_fIsPolished) 276 279 m_fMax = isMaximized(); 277 else if (m_fMax == isMaximized())278 m_fIsPolished = true;279 280 break; 280 281 } … … 309 310 if (!m_fIsPolished) 310 311 { 312 /* Mark as polished: */ 313 m_fIsPolished = true; 314 311 315 /* Load window size, adjust position and load window state finally: */ 312 316 resize(m_iWidth, m_iHeight); … … 314 318 if (m_fMax) 315 319 QTimer::singleShot(0, this, SLOT(showMaximized())); 316 else317 m_fIsPolished = true;318 320 } 319 321 … … 325 327 { 326 328 /* Details page update: */ 327 m DetailsText->setText(vboxGlobal().detailsReport(m_session.GetMachine(), false /* with links */));329 m_browsers[0]->setText(vboxGlobal().detailsReport(m_session.GetMachine(), false /* with links */)); 328 330 } 329 331 … … 348 350 { 349 351 /* Focus the browser on shown page: */ 350 m InfoStack->widget(iIndex)->setFocus();352 m_pTabWidget->widget(iIndex)->setFocus(); 351 353 } 352 354 … … 367 369 368 370 #ifdef Q_WS_MAC 369 /* No icon for this window on the mac, cause this would actas proxy icon which isn't necessary here. */371 /* No window-icon on Mac OX X, because it acts as proxy icon which isn't necessary here. */ 370 372 setWindowIcon(QIcon()); 371 373 #else /* !Q_WS_MAC */ 372 /* A pply window icons*/374 /* Assign window-icon(s: */ 373 375 setWindowIcon(UIIconPool::iconSetFull(":/session_info_32px.png", ":/session_info_16px.png")); 374 376 #endif /* !Q_WS_MAC */ 375 377 376 /* Apply UI decorations */ 377 Ui::UIVMInfoDialog::setupUi(this); 378 379 /* Setup tab icons: */ 380 mInfoStack->setTabIcon(0, UIIconPool::iconSet(":/session_info_details_16px.png")); 381 mInfoStack->setTabIcon(1, UIIconPool::iconSet(":/session_info_runtime_16px.png")); 382 383 /* Setup focus-proxy for pages: */ 384 mPage1->setFocusProxy(mDetailsText); 385 mPage2->setFocusProxy(mStatisticText); 386 387 /* Setup browsers: */ 388 mDetailsText->viewport()->setAutoFillBackground(false); 389 mStatisticText->viewport()->setAutoFillBackground(false); 390 391 /* Setup margins: */ 392 mDetailsText->setViewportMargins(5, 5, 5, 5); 393 mStatisticText->setViewportMargins(5, 5, 5, 5); 394 395 /* Configure dialog button-box: */ 396 mButtonBox->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape); 397 398 /* Setup handlers: */ 378 /* Prepare central-widget: */ 379 prepareCentralWidget(); 380 381 /* Configure handlers: */ 399 382 connect(m_pMachineWindow->uisession(), SIGNAL(sigMediumChange(const CMediumAttachment&)), this, SLOT(sltUpdateDetails())); 400 383 connect(m_pMachineWindow->uisession(), SIGNAL(sigSharedFolderChange()), this, SLOT(sltUpdateDetails())); 401 384 /* TODO_NEW_CORE: this is ofc not really right in the mm sense. There are more than one screens. */ 402 385 connect(m_pMachineWindow->machineView(), SIGNAL(resizeHintDone()), this, SLOT(sltProcessStatistics())); 403 connect(m InfoStack, SIGNAL(currentChanged(int)), this, SLOT(sltHandlePageChanged(int)));386 connect(m_pTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandlePageChanged(int))); 404 387 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltUpdateDetails())); 405 388 connect(m_pTimer, SIGNAL(timeout()), this, SLOT(sltProcessStatistics())); 406 389 407 /* Loading language constants: */390 /* Retranslate: */ 408 391 retranslateUi(); 409 392 … … 414 397 sltProcessStatistics(); 415 398 m_pTimer->start(5000); 416 417 /* Make statistics page the default one: */ 418 mInfoStack->setCurrentIndex(1); 399 } 400 401 void UIVMInfoDialog::prepareCentralWidget() 402 { 403 /* Create central-widget: */ 404 setCentralWidget(new QWidget); 405 AssertPtrReturnVoid(centralWidget()); 406 { 407 /* Create main-layout: */ 408 new QVBoxLayout(centralWidget()); 409 AssertPtrReturnVoid(centralWidget()->layout()); 410 { 411 /* Create tab-widget: */ 412 prepareTabWidget(); 413 /* Create button-box: */ 414 prepareButtonBox(); 415 } 416 } 417 } 418 419 void UIVMInfoDialog::prepareTabWidget() 420 { 421 /* Create tab-widget: */ 422 m_pTabWidget = new QITabWidget; 423 AssertPtrReturnVoid(m_pTabWidget); 424 { 425 /* Create tabs: */ 426 for (int iTabIndex = 0; iTabIndex < 2; ++iTabIndex) 427 prepareTab(iTabIndex); 428 /* Configure tab-widget: */ 429 m_pTabWidget->setTabIcon(0, UIIconPool::iconSet(":/session_info_details_16px.png")); 430 m_pTabWidget->setTabIcon(1, UIIconPool::iconSet(":/session_info_runtime_16px.png")); 431 m_pTabWidget->setCurrentIndex(1); 432 /* Add tab-widget into main-layout: */ 433 centralWidget()->layout()->addWidget(m_pTabWidget); 434 } 435 } 436 437 void UIVMInfoDialog::prepareTab(int iTabIndex) 438 { 439 /* Create tab: */ 440 m_tabs.insert(iTabIndex, new QWidget); 441 AssertPtrReturnVoid(m_tabs.value(iTabIndex)); 442 { 443 /* Create tab-layout: */ 444 QVBoxLayout *pLayout = new QVBoxLayout(m_tabs.value(iTabIndex)); 445 { 446 /* Configure tab-layout: */ 447 pLayout->setContentsMargins(0, 0, 0, 0); 448 /* Create browser: */ 449 m_browsers.insert(iTabIndex, new QRichTextEdit); 450 AssertPtrReturnVoid(m_browsers.value(iTabIndex)); 451 { 452 /* Configure browser: */ 453 m_browsers[iTabIndex]->setReadOnly(true); 454 m_browsers[iTabIndex]->setFrameShadow(QFrame::Plain); 455 m_browsers[iTabIndex]->setFrameShape(QFrame::NoFrame); 456 m_browsers[iTabIndex]->setViewportMargins(5, 5, 5, 5); 457 m_browsers[iTabIndex]->viewport()->setAutoFillBackground(false); 458 m_tabs[iTabIndex]->setFocusProxy(m_browsers.value(iTabIndex)); 459 /* Add browser into tab-layout: */ 460 pLayout->addWidget(m_browsers.value(iTabIndex)); 461 } 462 } 463 /* Add tab into tab-widget: */ 464 m_pTabWidget->addTab(m_tabs.value(iTabIndex), QString()); 465 } 466 } 467 468 void UIVMInfoDialog::prepareButtonBox() 469 { 470 /* Create button-box: */ 471 m_pButtonBox = new QIDialogButtonBox; 472 AssertPtrReturnVoid(m_pButtonBox); 473 { 474 /* Configure button-box: */ 475 m_pButtonBox->setStandardButtons(QDialogButtonBox::Close); 476 m_pButtonBox->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape); 477 connect(m_pButtonBox, SIGNAL(rejected()), this, SLOT(close())); 478 /* Add button-box into main-layout: */ 479 centralWidget()->layout()->addWidget(m_pButtonBox); 480 } 419 481 } 420 482 … … 722 784 723 785 /* Show full composed page & save/restore scroll-bar position: */ 724 int iScrollBarValue = m StatisticText->verticalScrollBar()->value();725 m StatisticText->setText(strTable.arg(strResult));726 m StatisticText->verticalScrollBar()->setValue(iScrollBarValue);786 int iScrollBarValue = m_browsers[1]->verticalScrollBar()->value(); 787 m_browsers[1]->setText(strTable.arg(strResult)); 788 m_browsers[1]->verticalScrollBar()->setValue(iScrollBarValue); 727 789 } 728 790 -
trunk/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.h
r51309 r51310 30 30 31 31 /* Forward declarations: */ 32 class QITabWidget; 33 class QIDialogButtonBox; 32 34 class UIMachineWindow; 33 35 class QTimer; 34 36 35 37 /** QMainWindow based dialog providing user with VM details and statistics. */ 36 class UIVMInfoDialog : public QIWithRetranslateUI<QMainWindow> , public Ui::UIVMInfoDialog38 class UIVMInfoDialog : public QIWithRetranslateUI<QMainWindow> 37 39 { 38 40 Q_OBJECT; … … 62 64 63 65 /** Common event-handler. */ 64 virtualbool event(QEvent *pEvent);66 bool event(QEvent *pEvent); 65 67 /** Resize event-handler. */ 66 v irtual void resizeEvent(QResizeEvent *pEvent);68 void resizeEvent(QResizeEvent *pEvent); 67 69 /** Show event-handler. */ 68 v irtual void showEvent(QShowEvent *pEvent);70 void showEvent(QShowEvent *pEvent); 69 71 70 72 private slots: … … 83 85 /** General prepare helper. */ 84 86 void prepare(); 85 /** Dialog prepare helper. */87 /** Prepare helper for dialog itself. */ 86 88 void prepareThis(); 89 /** Prepare helper for central-widget. */ 90 void prepareCentralWidget(); 91 /** Prepare helper for tab-widget. */ 92 void prepareTabWidget(); 93 /** Prepare helper for @a iTabIndex. */ 94 void prepareTab(int iTabIndex); 95 /** Prepare helper for button-box. */ 96 void prepareButtonBox(); 87 97 /** Load settings helper. */ 88 98 void loadSettings(); … … 90 100 /** Save settings helper. */ 91 101 void saveSettings(); 92 // /** Dialog cleanup helper. */93 // void cleanupThis() {}94 102 /** General cleanup helper. */ 95 103 void cleanup(); … … 130 138 /** @} */ 131 139 140 /** @name Widget variables. 141 * @{ */ 142 /** Dialog tab-widget. */ 143 QITabWidget *m_pTabWidget; 144 /** Dialog tabs map. */ 145 QMap<int, QWidget*> m_tabs; 146 /** Dialog browsers map. */ 147 QMap<int, QRichTextEdit*> m_browsers; 148 /** Dialog button-box. */ 149 QIDialogButtonBox *m_pButtonBox; 150 /** @} */ 151 132 152 /** @name VM details/statistics variables. 133 153 * @{ */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h
r39488 r51310 98 98 public: 99 99 100 QRichTextEdit (QWidget *aParent ) : QTextEdit (aParent) {}100 QRichTextEdit (QWidget *aParent = 0) : QTextEdit (aParent) {} 101 101 102 102 void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom)
Note:
See TracChangeset
for help on using the changeset viewer.