VirtualBox

Ignore:
Timestamp:
May 20, 2014 5:23:54 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: UIVMInfoDialog: Consume .ui file.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r51304 r51310  
    2222
    2323FORMS = \
    24     src/UIVMInfoDialog.ui \
    2524    src/VBoxSnapshotDetailsDlg.ui \
    2625    src/VBoxTakeSnapshotDlg.ui \
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ja.ts

    r51304 r51310  
    1796717967    </message>
    1796817968    <message>
    17969         <location filename="../src/UIVMInfoDialog.ui" line="26"/>
    1797017969        <source>UIVMInfoDialog</source>
    1797117970        <translation>UIVMInfoDialog</translation>
    1797217971    </message>
    1797317972    <message>
    17974         <location filename="../src/UIVMInfoDialog.ui" line="37"/>
    1797517973        <source>Configuration &amp;Details</source>
    1797617974        <translation>設定の詳細(&amp;D)</translation>
    1797717975    </message>
    1797817976    <message>
    17979         <location filename="../src/UIVMInfoDialog.ui" line="72"/>
    1798017977        <source>&amp;Runtime Information</source>
    1798117978        <translation>ランタイム情報(&amp;R)</translation>
  • trunk/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.cpp

    r51309 r51310  
    2626
    2727/* 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"
    2834#include "UIIconPool.h"
    29 #include "UIMachineLogic.h"
    30 #include "UIMachineView.h"
    31 #include "UIMachineWindow.h"
    32 #include "UISession.h"
    3335#include "VBoxGlobal.h"
    34 #include "UIVMInfoDialog.h"
    35 #include "UIConverter.h"
    3636
    3737/* COM includes: */
     
    4848#include "CVRDEServerInfo.h"
    4949
     50/* Other VBox includes: */
    5051#include <iprt/time.h>
    5152
     
    7980    , m_fIsPolished(false)
    8081    , m_iWidth(0), m_iHeight(0), m_fMax(false)
     82    , m_pTabWidget(0)
    8183    , m_session(pMachineWindow->session())
    8284    , m_pTimer(new QTimer(this))
     
    100102void UIVMInfoDialog::retranslateUi()
    101103{
    102     /* Translate uic generated strings: */
    103     Ui::UIVMInfoDialog::retranslateUi(this);
    104 
    105104    sltUpdateDetails();
    106105
     
    109108    AssertReturnVoid(!machine.isNull());
    110109
    111     /* Setup a dialog caption: */
     110    /* Setup dialog title: */
    112111    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"));
    113116
    114117    /* Clear counter names initially: */
     
    270273    switch (pEvent->type())
    271274    {
    272         /* Window state-change event: */
     275        /* Store window state for this VM: */
    273276        case QEvent::WindowStateChange:
    274277        {
    275278            if (m_fIsPolished)
    276279                m_fMax = isMaximized();
    277             else if (m_fMax == isMaximized())
    278                 m_fIsPolished = true;
    279280            break;
    280281        }
     
    309310    if (!m_fIsPolished)
    310311    {
     312        /* Mark as polished: */
     313        m_fIsPolished = true;
     314
    311315        /* Load window size, adjust position and load window state finally: */
    312316        resize(m_iWidth, m_iHeight);
     
    314318        if (m_fMax)
    315319            QTimer::singleShot(0, this, SLOT(showMaximized()));
    316         else
    317             m_fIsPolished = true;
    318320    }
    319321
     
    325327{
    326328    /* Details page update: */
    327     mDetailsText->setText(vboxGlobal().detailsReport(m_session.GetMachine(), false /* with links */));
     329    m_browsers[0]->setText(vboxGlobal().detailsReport(m_session.GetMachine(), false /* with links */));
    328330}
    329331
     
    348350{
    349351    /* Focus the browser on shown page: */
    350     mInfoStack->widget(iIndex)->setFocus();
     352    m_pTabWidget->widget(iIndex)->setFocus();
    351353}
    352354
     
    367369
    368370#ifdef Q_WS_MAC
    369     /* No icon for this window on the mac, cause this would act as 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. */
    370372    setWindowIcon(QIcon());
    371373#else /* !Q_WS_MAC */
    372     /* Apply window icons */
     374    /* Assign window-icon(s: */
    373375    setWindowIcon(UIIconPool::iconSetFull(":/session_info_32px.png", ":/session_info_16px.png"));
    374376#endif /* !Q_WS_MAC */
    375377
    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: */
    399382    connect(m_pMachineWindow->uisession(), SIGNAL(sigMediumChange(const CMediumAttachment&)), this, SLOT(sltUpdateDetails()));
    400383    connect(m_pMachineWindow->uisession(), SIGNAL(sigSharedFolderChange()), this, SLOT(sltUpdateDetails()));
    401384    /* TODO_NEW_CORE: this is ofc not really right in the mm sense. There are more than one screens. */
    402385    connect(m_pMachineWindow->machineView(), SIGNAL(resizeHintDone()), this, SLOT(sltProcessStatistics()));
    403     connect(mInfoStack, SIGNAL(currentChanged(int)), this, SLOT(sltHandlePageChanged(int)));
     386    connect(m_pTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandlePageChanged(int)));
    404387    connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltUpdateDetails()));
    405388    connect(m_pTimer, SIGNAL(timeout()), this, SLOT(sltProcessStatistics()));
    406389
    407     /* Loading language constants: */
     390    /* Retranslate: */
    408391    retranslateUi();
    409392
     
    414397    sltProcessStatistics();
    415398    m_pTimer->start(5000);
    416 
    417     /* Make statistics page the default one: */
    418     mInfoStack->setCurrentIndex(1);
     399}
     400
     401void 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
     419void 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
     437void 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
     468void 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    }
    419481}
    420482
     
    722784
    723785    /* Show full composed page & save/restore scroll-bar position: */
    724     int iScrollBarValue = mStatisticText->verticalScrollBar()->value();
    725     mStatisticText->setText(strTable.arg(strResult));
    726     mStatisticText->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);
    727789}
    728790
  • trunk/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.h

    r51309 r51310  
    3030
    3131/* Forward declarations: */
     32class QITabWidget;
     33class QIDialogButtonBox;
    3234class UIMachineWindow;
    3335class QTimer;
    3436
    3537/** QMainWindow based dialog providing user with VM details and statistics. */
    36 class UIVMInfoDialog : public QIWithRetranslateUI<QMainWindow>, public Ui::UIVMInfoDialog
     38class UIVMInfoDialog : public QIWithRetranslateUI<QMainWindow>
    3739{
    3840    Q_OBJECT;
     
    6264
    6365    /** Common event-handler. */
    64     virtual bool event(QEvent *pEvent);
     66    bool event(QEvent *pEvent);
    6567    /** Resize event-handler. */
    66     virtual void resizeEvent(QResizeEvent *pEvent);
     68    void resizeEvent(QResizeEvent *pEvent);
    6769    /** Show event-handler. */
    68     virtual void showEvent(QShowEvent *pEvent);
     70    void showEvent(QShowEvent *pEvent);
    6971
    7072private slots:
     
    8385    /** General prepare helper. */
    8486    void prepare();
    85     /** Dialog prepare helper. */
     87    /** Prepare helper for dialog itself. */
    8688    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();
    8797    /** Load settings helper. */
    8898    void loadSettings();
     
    90100    /** Save settings helper. */
    91101    void saveSettings();
    92     // /** Dialog cleanup helper. */
    93     // void cleanupThis() {}
    94102    /** General cleanup helper. */
    95103    void cleanup();
     
    130138    /** @} */
    131139
     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
    132152    /** @name VM details/statistics variables.
    133153     * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h

    r39488 r51310  
    9898public:
    9999
    100     QRichTextEdit (QWidget *aParent) : QTextEdit (aParent) {}
     100    QRichTextEdit (QWidget *aParent = 0) : QTextEdit (aParent) {}
    101101
    102102    void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette