VirtualBox

Changeset 77584 in vbox


Ignore:
Timestamp:
Mar 6, 2019 3:28:19 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Moving the guest control session tree widget to session information dialog and getting rid of CLI.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r77457 r77584  
    274274if  "$(KBUILD_TYPE)" != "release" || defined(VBOX_GUI_WITH_EXTRADATA_MANAGER_UI)
    275275 VBoxGlobal_DEFS        += VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
    276 endif
    277 if  "$(KBUILD_TYPE)" != "release" || defined(VBOX_GUI_WITH_GUEST_CONTROL_UI)
    278  VBoxGlobal_DEFS        += VBOX_GUI_WITH_GUEST_CONTROL_UI
    279276endif
    280277ifndef VBOX_WITHOUT_LESS_VIRTUALBOX_INCLUDING
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp

    r76606 r77584  
    274274};
    275275
    276 /** Simple action extension, used as 'Show Guest Process Control Dialog' action class. */
    277 class UIActionSimpleRuntimeShowGuestProcessControlDialog : public UIActionSimple
    278 {
    279     Q_OBJECT;
    280 
    281 public:
    282 
    283     /** Constructs action passing @a pParent to the base-class. */
    284     UIActionSimpleRuntimeShowGuestProcessControlDialog(UIActionPool *pParent)
    285         : UIActionSimple(pParent, ":/session_info_16px.png", ":/session_info_disabled_16px.png", true)
    286     {}
    287 
    288 protected:
    289 
    290     /** Returns action extra-data ID. */
    291     virtual int extraDataID() const /* override */
    292     {
    293         return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_GuestProcessControlDialog;
    294     }
    295     /** Returns action extra-data key. */
    296     virtual QString extraDataKey() const /* override */
    297     {
    298         return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_GuestProcessControlDialog);
    299     }
    300     /** Returns whether action is allowed. */
    301     virtual bool isAllowed() const /* override */
    302     {
    303         return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_GuestProcessControlDialog);
    304     }
    305 
    306     /** Returns shortcut extra-data ID. */
    307     virtual QString shortcutExtraDataID() const /* override */
    308     {
    309         return QString("GuestProcessControlDialog");
    310     }
    311 
    312     /** Returns default shortcut. */
    313     virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
    314     {
    315         return QKeySequence();
    316     }
    317 
    318     /** Handles translation event. */
    319     virtual void retranslateUi() /* override */
    320     {
    321         setName(QApplication::translate("UIActionPool", "Guest Process Control..."));
    322         setStatusTip(QApplication::translate("UIActionPool", "Display the virtual machine guest process control window"));
    323     }
    324 };
    325 
    326 
    327276/** Toggle action extension, used as 'Pause' action class. */
    328277class UIActionToggleRuntimePause : public UIActionToggle
     
    33183267    m_pool[UIActionIndexRT_M_Machine_S_ShowInformation] = new UIActionSimpleRuntimeShowInformationDialog(this);
    33193268    m_pool[UIActionIndexRT_M_Machine_S_ShowFileManager] = new UIActionSimpleRuntimeShowFileManagerDialog(this);
    3320     m_pool[UIActionIndexRT_M_Machine_S_ShowGuestProcessControl] = new UIActionSimpleRuntimeShowGuestProcessControlDialog(this);
    33213269    m_pool[UIActionIndexRT_M_Machine_T_Pause] = new UIActionToggleRuntimePause(this);
    33223270    m_pool[UIActionIndexRT_M_Machine_S_Reset] = new UIActionSimpleRuntimePerformReset(this);
     
    36273575    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowInformation)) || fSeparator;
    36283576    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowFileManager)) || fSeparator;
    3629 #ifdef VBOX_GUI_WITH_GUEST_CONTROL_UI
    3630     fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowGuestProcessControl)) || fSeparator;
    3631 #endif
     3577
    36323578    /* Separator: */
    36333579    if (fSeparator)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.h

    r76581 r77584  
    4747    UIActionIndexRT_M_Machine_S_ShowInformation,
    4848    UIActionIndexRT_M_Machine_S_ShowFileManager,
    49     UIActionIndexRT_M_Machine_S_ShowGuestProcessControl,
    5049    UIActionIndexRT_M_Machine_T_Pause,
    5150    UIActionIndexRT_M_Machine_S_Reset,
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlTreeItem.cpp

    r76606 r77584  
    219219
    220220    qRegisterMetaType<CGuestProcess>();
     221    qRegisterMetaType<CGuestSessionStateChangedEvent>();
    221222    connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestSessionStatedChanged,
    222223            this, &UIGuestSessionTreeItem::sltGuestSessionUpdated);
     
    308309    if (!m_comGuestSession.isOk())
    309310        return;
    310     setText(0, QString("Session Id: %1").arg(m_comGuestSession.GetId()));
    311     setText(1, QString("Session Name: %1").arg(m_comGuestSession.GetName()));
    312     setText(2, QString("Session Status: %1").arg(sessionStatusString(m_comGuestSession.GetStatus())));
     311    setText(0, QString("%1").arg(m_comGuestSession.GetId()));
     312    setText(1, QString("%1").arg(m_comGuestSession.GetName()));
     313    setText(2, QString("%1").arg(sessionStatusString(m_comGuestSession.GetStatus())));
    313314}
    314315
     
    393394    return m_comGuestProcess;
    394395}
    395 
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlDialog.cpp

    r76606 r77584  
    8383{
    8484    /* Create widget: */
    85     UIGuestProcessControlWidget *pWidget = new UIGuestProcessControlWidget(EmbedTo_Dialog, m_pActionPool, m_comGuest, this);
     85    UIGuestProcessControlWidget *pWidget = new UIGuestProcessControlWidget(EmbedTo_Dialog, m_comGuest, this);
    8686
    8787    if (pWidget)
     
    9393        //setWidgetToolbar(pWidget->toolbar());
    9494#endif
    95         // connect(pWidget, &UIGuestControlWidget::sigSetCloseButtonShortCut,
    96         //         this, &UIGuestControlWidget::sltSetCloseButtonShortCut);
    97 
    9895        /* Add into layout: */
    9996        centralWidget()->layout()->addWidget(pWidget);
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.cpp

    r77528 r77584  
    2424/* GUI includes: */
    2525#include "QITreeWidget.h"
    26 #include "UIActionPool.h"
    2726#include "UIExtraDataManager.h"
    2827#include "UIGuestControlConsole.h"
     
    3130#include "UIGuestProcessControlWidget.h"
    3231#include "UIToolBar.h"
     32#include "UIIconPool.h"
    3333#include "UIVMInformationDialog.h"
    3434#include "VBoxGlobal.h"
     
    103103        QAction *pExpandAllAction = menu->addAction(tr("Expand All"));
    104104        if (pExpandAllAction)
     105        {
     106            pExpandAllAction->setIcon(UIIconPool::iconSet(":/expand_all_16px.png"));
    105107            connect(pExpandAllAction, &QAction::triggered,
    106108                    this, &UIGuestControlTreeWidget::sltExpandAll);
     109        }
     110
    107111        QAction *pCollapseAllAction = menu->addAction(tr("Collapse All"));
    108112        if (pCollapseAllAction)
     113        {
     114            pCollapseAllAction->setIcon(UIIconPool::iconSet(":/collapse_all_16px.png"));
    109115            connect(pCollapseAllAction, &QAction::triggered,
    110116                    this, &UIGuestControlTreeWidget::sltCollapseAll);
    111 
     117        }
    112118        menu->exec(pEvent->globalPos());
    113119
     
    160166};
    161167
    162 UIGuestProcessControlWidget::UIGuestProcessControlWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    163                                                          const CGuest &comGuest, QWidget *pParent, bool fShowToolbar /* = false */)
     168UIGuestProcessControlWidget::UIGuestProcessControlWidget(EmbedTo enmEmbedding, const CGuest &comGuest,
     169                                                         QWidget *pParent, bool fShowToolbar /* = false */)
    164170    :QIWithRetranslateUI<QWidget>(pParent)
    165171    , m_comGuest(comGuest)
     
    170176    , m_pControlInterface(0)
    171177    , m_enmEmbedding(enmEmbedding)
    172     , m_pActionPool(pActionPool)
    173178    , m_pToolBar(0)
    174179    , m_pQtListener(0)
    175180    , m_fShowToolbar(fShowToolbar)
     181    , m_fDeleteAfterSessionUnregister(false)
    176182{
    177183    prepareListener();
     
    181187    initGuestSessionTree();
    182188    loadSettings();
     189    retranslateUi();
    183190}
    184191
     
    190197void UIGuestProcessControlWidget::retranslateUi()
    191198{
     199    if (m_pTreeWidget)
     200    {
     201        QStringList labels;
     202        labels << tr("Session ID") << tr("Session Name") << tr("Session Status");
     203        m_pTreeWidget->setHeaderLabels(labels);
     204    }
    192205}
    193206
     
    221234        m_pSplitter->addWidget(m_pTreeWidget);
    222235        m_pTreeWidget->setColumnCount(3);
    223         QStringList labels;
    224         labels << "" << "" << "";
    225 
    226         m_pTreeWidget->setHeaderLabels(labels);
    227     }
     236    }
     237
     238    /* Disable the CLI for now (and maybe forever): */
     239#ifdef WITH_GUEST_CONTROL_CLI
    228240    m_pConsole = new UIGuestControlConsole;
     241#endif
     242
    229243    if (m_pConsole)
    230244    {
     
    254268    connect(m_pControlInterface, &UIGuestControlInterface::sigOutputString,
    255269            this, &UIGuestProcessControlWidget::sltConsoleOutputReceived);
    256     connect(m_pConsole, &UIGuestControlConsole::commandEntered,
    257             this, &UIGuestProcessControlWidget::sltConsoleCommandEntered);
     270    if (m_pConsole)
     271        connect(m_pConsole, &UIGuestControlConsole::commandEntered,
     272                this, &UIGuestProcessControlWidget::sltConsoleCommandEntered);
    258273
    259274    if (m_pTreeWidget)
     
    451466    UIGuestSessionTreeItem *selectedItem = NULL;
    452467
    453 
    454468    for (int i = 0; i < m_pTreeWidget->topLevelItemCount(); ++i)
    455469    {
     
    463477        }
    464478    }
    465     delete selectedItem;
     479    if (m_fDeleteAfterSessionUnregister)
     480        delete selectedItem;
    466481}
    467482
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.h

    r76581 r77584  
    3939class QVBoxLayout;
    4040class QSplitter;
    41 class UIActionPool;
    4241class UIGuestControlConsole;
    4342class UIGuestControlInterface;
     
    5453public:
    5554
    56     UIGuestProcessControlWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    57                                 const CGuest &comGuest, QWidget *pParent, bool fShowToolbar = false);
     55    UIGuestProcessControlWidget(EmbedTo enmEmbedding, const CGuest &comGuest, QWidget *pParent, bool fShowToolbar = false);
    5856    ~UIGuestProcessControlWidget();
    5957
     
    9593    UIGuestControlInterface  *m_pControlInterface;
    9694    const EmbedTo             m_enmEmbedding;
    97     UIActionPool             *m_pActionPool;
    9895    UIToolBar                *m_pToolBar;
    9996
     
    103100    CEventListener m_comEventListener;
    104101    const bool     m_fShowToolbar;
     102    /** When true we delete the corresponding tree item as soon as the guest session is unregistered. */
     103    bool           m_fDeleteAfterSessionUnregister;
    105104};
    106105
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r76606 r77584  
    11001100    connect(actionPool()->action(UIActionIndexRT_M_Machine_S_ShowFileManager), SIGNAL(triggered()),
    11011101            this, SLOT(sltShowFileManagerDialog()));
    1102     connect(actionPool()->action(UIActionIndexRT_M_Machine_S_ShowGuestProcessControl), SIGNAL(triggered()),
    1103             this, SLOT(sltShowGuestProcessControlDialog()));
    11041102    connect(actionPool()->action(UIActionIndexRT_M_Machine_T_Pause), SIGNAL(toggled(bool)),
    11051103            this, SLOT(sltPause(bool)));
     
    18081806}
    18091807
    1810 void UIMachineLogic::sltShowGuestProcessControlDialog()
    1811 {
    1812     if (machine().isNull() || !activeMachineWindow())
    1813         return;
    1814 
    1815     /* Create a logviewer only if we don't have one already */
    1816     if (m_pProcessControlDialog)
    1817         return;
    1818 
    1819     QIManagerDialog *pProcessControlDialog;
    1820     UIGuestProcessControlDialogFactory dialogFactory(actionPool(), console().GetGuest(), machine().GetName());
    1821     dialogFactory.prepare(pProcessControlDialog, activeMachineWindow());
    1822     if (pProcessControlDialog)
    1823     {
    1824         m_pProcessControlDialog = pProcessControlDialog;
    1825 
    1826         /* Show instance: */
    1827         pProcessControlDialog->show();
    1828         pProcessControlDialog->setWindowState(pProcessControlDialog->windowState() & ~Qt::WindowMinimized);
    1829         pProcessControlDialog->activateWindow();
    1830         connect(pProcessControlDialog, &QIManagerDialog::sigClose,
    1831                 this, &UIMachineLogic::sltCloseGuestProcessControlDialog);
    1832     }
    1833 }
    1834 
    1835 void UIMachineLogic::sltCloseGuestProcessControlDialog()
    1836 {
    1837     QIManagerDialog* pDialog = qobject_cast<QIManagerDialog*>(sender());
    1838     if (m_pProcessControlDialog != pDialog || !pDialog)
    1839         return;
    1840 
    1841     /* Set the m_pLogViewerDialog to NULL before closing the dialog. or we will have redundant deletes*/
    1842     m_pProcessControlDialog = 0;
    1843     pDialog->close();
    1844     UIGuestProcessControlDialogFactory().cleanup(pDialog);
    1845 }
    1846 
    18471808void UIMachineLogic::sltReset()
    18481809{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r76581 r77584  
    279279    void sltShowFileManagerDialog();
    280280    void sltCloseFileManagerDialog();
    281     void sltShowGuestProcessControlDialog();
    282     void sltCloseGuestProcessControlDialog();
    283281    void sltReset();
    284282    void sltPause(bool fOn);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp

    r77535 r77584  
    3636#include "UIInformationConfiguration.h"
    3737#include "UIInformationRuntime.h"
     38#include "UIGuestProcessControlWidget.h"
    3839#include "UIMachine.h"
    3940
     
    110111    m_pTabWidget->setTabText(0, tr("Configuration &Details"));
    111112    m_pTabWidget->setTabText(1, tr("&Runtime Information"));
     113    m_pTabWidget->setTabText(2, tr("Guest Control &Session Information"));
    112114}
    113115
     
    237239            m_pTabWidget->addTab(m_tabs.value(1), QString());
    238240        }
     241
     242        UIGuestProcessControlWidget *pGuestProcessControlWidget =
     243            new UIGuestProcessControlWidget(EmbedTo_Dialog, m_pMachineWindow->console().GetGuest(), this, false /* fShowToolbar */);
     244
     245        if (pGuestProcessControlWidget)
     246        {
     247            m_tabs.insert(2, pGuestProcessControlWidget);
     248            m_pTabWidget->addTab(m_tabs.value(2), QString());
     249        }
     250
    239251        /* Set Runtime Information tab as default: */
    240252        m_pTabWidget->setCurrentIndex(1);
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