VirtualBox

Changeset 102574 in vbox for trunk


Ignore:
Timestamp:
Dec 11, 2023 4:42:29 PM (10 months ago)
Author:
vboxsync
Message:

FE/Qt: Reworking Log Viewer to accept a list of machine IDs, not just one ID.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp

    r101027 r102574  
    5050
    5151UIVMLogViewerDialogFactory::UIVMLogViewerDialogFactory(UIActionPool *pActionPool /* = 0 */,
    52                                                        const QUuid &uMachineId /* = QUuid()*/,
     52                                                       const QList<QUuid> &machineIDs /* = QList<QUuid>() */,
    5353                                                       const QString &strMachineName /* = QString() */)
    5454    : m_pActionPool(pActionPool)
    55     , m_uMachineId(uMachineId)
     55    , m_machineIDs(machineIDs)
    5656    , m_strMachineName(strMachineName)
    5757{
     
    6060void UIVMLogViewerDialogFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget)
    6161{
    62     pDialog = new UIVMLogViewerDialog(pCenterWidget, m_pActionPool, m_uMachineId, m_strMachineName);
     62    pDialog = new UIVMLogViewerDialog(pCenterWidget, m_pActionPool, m_machineIDs, m_strMachineName);
    6363}
    6464
     
    6969
    7070UIVMLogViewerDialog::UIVMLogViewerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool,
    71                                          const QUuid &uMachineId /* = QUuid()*/,
     71                                         const QList<QUuid> &machineIDs /* = QList<QUuid>() */,
    7272                                         const QString &strMachineName /* = QString() */)
    7373    : QIWithRetranslateUI<QIManagerDialog>(pCenterWidget)
    7474    , m_pActionPool(pActionPool)
    75     , m_uMachineId(uMachineId)
     75    , m_machineIDs(machineIDs)
    7676    , m_iGeometrySaveTimerId(-1)
    7777    , m_strMachineName(strMachineName)
     
    8989    if (pLogViewerWidget)
    9090        pLogViewerWidget->setSelectedVMListItems(items);
    91 }
    92 
    93 void UIVMLogViewerDialog::addSelectedVMListItems(const QList<UIVirtualMachineItem*> &items)
    94 {
    95     Q_UNUSED(items);
    96     UIVMLogViewerWidget *pLogViewerWidget = qobject_cast<UIVMLogViewerWidget*>(widget());
    97     if (pLogViewerWidget)
    98         pLogViewerWidget->addSelectedVMListItems(items);
    9991}
    10092
     
    158150{
    159151    /* Create widget: */
    160     UIVMLogViewerWidget *pWidget = new UIVMLogViewerWidget(EmbedTo_Dialog, m_pActionPool, true /* show toolbar */, m_uMachineId, this);
     152    UIVMLogViewerWidget *pWidget = new UIVMLogViewerWidget(EmbedTo_Dialog, m_pActionPool, true /* show toolbar */, m_machineIDs, this);
    161153    if (pWidget)
    162154    {
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.h

    r101027 r102574  
    5252    /** Constructs Log Viewer factory acquiring additional arguments.
    5353      * @param  pActionPool  Brings the action-pool reference.
    54       * @param  uMachineId   Brings the machine id for which VM Log-Viewer is requested. */
    55     UIVMLogViewerDialogFactory(UIActionPool *pActionPool = 0, const QUuid &uMachineId = QUuid(),
     54      * @param  machineIDs   Brings the list of machine IDs. */
     55    UIVMLogViewerDialogFactory(UIActionPool *pActionPool = 0,
     56                               const QList<QUuid> &machineIDs = QList<QUuid>(),
    5657                               const QString &strMachineName = QString());
    5758
     
    6465    /** Holds the action-pool reference. */
    6566    UIActionPool *m_pActionPool;
    66     /** Holds the machine id. */
    67     QUuid      m_uMachineId;
    68     QString    m_strMachineName;
     67    /** Holds the list of machine IDs. */
     68    QList<QUuid>  m_machineIDs;
     69    QString       m_strMachineName;
    6970};
    7071
     
    8081      * @param  pCenterWidget  Brings the widget reference to center according to.
    8182      * @param  pActionPool    Brings the action-pool reference.
    82       * @param  machine id     Brings the machine id. */
     83      * @param  machineIDs     Brings the list of machine IDs. */
    8384    UIVMLogViewerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool,
    84                         const QUuid &uMachineId = QUuid(), const QString &strMachineName = QString());
     85                        const QList<QUuid> &machineIDs = QList<QUuid>(),
     86                        const QString &strMachineName = QString());
    8587    ~UIVMLogViewerDialog();
    8688    void setSelectedVMListItems(const QList<UIVirtualMachineItem*> &items);
    87     void addSelectedVMListItems(const QList<UIVirtualMachineItem*> &items);
    8889
    8990protected:
     
    126127    /** Holds the action-pool reference. */
    127128    UIActionPool *m_pActionPool;
    128     /** Holds the machine id. */
    129     QUuid      m_uMachineId;
    130     int m_iGeometrySaveTimerId;
    131     QString    m_strMachineName;
     129    /** Holds the list of machine IDs. */
     130    QList<QUuid>  m_machineIDs;
     131    int           m_iGeometrySaveTimerId;
     132    QString       m_strMachineName;
    132133};
    133134
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp

    r102573 r102574  
    203203                                         UIActionPool *pActionPool,
    204204                                         bool fShowToolbar /* = true */,
    205                                          const QUuid &uMachineId /* = QUuid() */,
     205                                         const QList<QUuid> &machineIDs /* = QList<QUuid>() */,
    206206                                         QWidget *pParent /* = 0 */)
    207207    : QIWithRetranslateUI<QWidget>(pParent)
     
    224224    /* Prepare VM Log-Viewer: */
    225225    prepare();
    226     if (!uMachineId.isNull())
    227         setMachines(QVector<QUuid>() << uMachineId);
     226    if (!machineIDs.isEmpty())
     227        setMachines(machineIDs);
    228228    connect(&uiCommon(), &UICommon::sigAskToCommitData,
    229229            this, &UIVMLogViewerWidget::sltCommitDataSignalReceived);
     
    263263}
    264264
    265 
    266265void UIVMLogViewerWidget::setSelectedVMListItems(const QList<UIVirtualMachineItem*> &items)
    267266{
    268267    QVector<QUuid> selectedMachines;
    269 
    270     foreach (const UIVirtualMachineItem *item, items)
    271     {
    272         if (!item)
    273             continue;
    274         selectedMachines << item->id();
    275     }
    276     setMachines(selectedMachines);
    277 }
    278 
    279 void UIVMLogViewerWidget::addSelectedVMListItems(const QList<UIVirtualMachineItem*> &items)
    280 {
    281     QVector<QUuid> selectedMachines(m_machines);
    282268
    283269    foreach (const UIVirtualMachineItem *item, items)
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h

    r102573 r102574  
    7878      * @param  pActionPool   Brings the action-pool reference.
    7979      * @param  fShowToolbar  Brings whether we should create/show toolbar.
    80       * @param  uMachineId    Brings the machine id for which VM Log-Viewer is requested. */
     80      * @param  machineIDs    Brings the list of machine IDs. */
    8181    UIVMLogViewerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    82                         bool fShowToolbar = true, const QUuid &uMachineId = QUuid(), QWidget *pParent = 0);
     82                        bool fShowToolbar = true, const QList<QUuid> &machineIDs = QList<QUuid>(), QWidget *pParent = 0);
    8383    ~UIVMLogViewerWidget();
    8484    /** Returns the width of the current log page. return 0 if there is no current log page: */
     
    9494
    9595    void setSelectedVMListItems(const QList<UIVirtualMachineItem*> &items);
    96     void addSelectedVMListItems(const QList<UIVirtualMachineItem*> &items);
    9796    QFont currentFont() const;
    9897
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r102322 r102574  
    22242224    }
    22252225
    2226     QList<UIVirtualMachineItem*> itemsToShowLogs;
     2226    QList<QUuid> machineIDs;
    22272227
    22282228    /* For each selected item: */
     
    22372237        if (!isActionEnabled(UIActionIndexMN_M_Group_S_ShowLogDialog, QList<UIVirtualMachineItem*>() << pItem))
    22382238            continue;
    2239         itemsToShowLogs << pItem;
    2240     }
    2241 
    2242     if (itemsToShowLogs.isEmpty())
     2239        machineIDs << pItem->id();
     2240    }
     2241
     2242    if (machineIDs.isEmpty())
    22432243        return;
    22442244    if (!m_pLogViewerDialog)
    22452245    {
    2246         UIVMLogViewerDialogFactory dialogFactory(actionPool(), QUuid());
     2246        UIVMLogViewerDialogFactory dialogFactory(actionPool(), machineIDs);
    22472247        dialogFactory.prepare(m_pLogViewerDialog, this);
    22482248        if (m_pLogViewerDialog)
     
    22512251    }
    22522252    AssertPtrReturnVoid(m_pLogViewerDialog);
    2253     UIVMLogViewerDialog *pDialog = qobject_cast<UIVMLogViewerDialog*>(m_pLogViewerDialog);
    2254     if (pDialog)
    2255         pDialog->addSelectedVMListItems(itemsToShowLogs);
    22562253    m_pLogViewerDialog->show();
    22572254    m_pLogViewerDialog->setWindowState(m_pLogViewerDialog->windowState() & ~Qt::WindowMinimized);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r102571 r102574  
    17101710    if (!m_pLogViewerDialog)
    17111711    {
    1712         UIVMLogViewerDialogFactory(actionPool(), uiCommon().managedVMUuid(), uimachine()->machineName())
     1712        const QList<QUuid> machineIDs = QList<QUuid>() << uiCommon().managedVMUuid();
     1713        UIVMLogViewerDialogFactory(actionPool(), machineIDs, uimachine()->machineName())
    17131714            .prepare(m_pLogViewerDialog, activeMachineWindow());
    17141715        connect(m_pLogViewerDialog, &QIManagerDialog::sigClose,
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