VirtualBox

Changeset 98854 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 7, 2023 11:08:32 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156178
Message:

FE/Qt: bugref:10322: A bit of Log-viewer improvements to use CMachine a bit less.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/logviewer
Files:
2 edited

Legend:

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

    r98103 r98854  
    4949#include "QIFileDialog.h"
    5050#include "QITabWidget.h"
     51#include "QIToolBar.h"
     52#include "QIToolButton.h"
    5153#include "UIActionPool.h"
     54#include "UICommon.h"
    5255#include "UIExtraDataManager.h"
    5356#include "UIIconPool.h"
     
    6063#include "UIVMLogViewerSearchPanel.h"
    6164#include "UIVMLogViewerOptionsPanel.h"
    62 #include "QIToolBar.h"
    63 #include "QIToolButton.h"
    64 #include "UICommon.h"
    6565
    6666/* COM includes: */
     67#include "COMEnums.h"
     68#include "CMachine.h"
    6769#include "CSystemProperties.h"
    6870
     
    350352}
    351353
    352 QString UIVMLogViewerWidget::readLogFile(CMachine &comMachine, int iLogFileId)
    353 {
     354QString UIVMLogViewerWidget::readLogFile(const CMachine &comConstMachine, int iLogFileId)
     355{
     356    CMachine comMachine(comConstMachine); // ReadLog is non const
    354357    QString strLogFileContent;
    355358    ULONG uOffset = 0;
     
    358361    {
    359362        QVector<BYTE> data = comMachine.ReadLog(iLogFileId, uOffset, _1M);
     363        /// @todo it's probably worth testing !comMachine.isOk() and show error message, or not :)
    360364        if (data.size() == 0)
    361365            break;
     
    452456        return;
    453457
    454     CMachine comMachine = uiCommon().virtualBox().FindMachine(pLogPage->machineId().toString());
    455     if (comMachine.isNull())
     458    if (pLogPage->machineId().isNull())
    456459        return;
    457460
     
    464467    const QDateTime dtInfo = fileInfo.lastModified();
    465468    const QString strDtString = dtInfo.toString("yyyy-MM-dd-hh-mm-ss");
    466     const QString strDefaultFileName = QString("%1-%2.log").arg(comMachine.GetName()).arg(strDtString);
     469    const QString strDefaultFileName = QString("%1-%2.log").arg(pLogPage->machineName()).arg(strDtString);
    467470    const QString strDefaultFullName = QDir::toNativeSeparators(QDir::home().absolutePath() + "/" + strDefaultFileName);
    468471
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h

    r98844 r98854  
    4242#include "QIWithRetranslateUI.h"
    4343
    44 /* COM includes: */
    45 #include "COMEnums.h"
    46 #include "CMachine.h"
    47 
    4844/* Forward declarations: */
    49 class UITabWidget;
    5045class QVBoxLayout;
     46class QIToolBar;
     47class QIToolButton;
    5148class UIActionPool;
    5249class UIDialogPanel;
    53 class QIToolBar;
    54 class QIToolButton;
    5550class UIMachineListMenu;
     51class UITabWidget;
    5652class UIVirtualMachineItem;
    5753class UIVMLogPage;
     
    5955class UIVMLogViewerBookmarksPanel;
    6056class UIVMLogViewerFilterPanel;
     57class UIVMLogViewerOptionsPanel;
    6158class UIVMLogViewerPanel;
    6259class UIVMLogViewerSearchPanel;
    63 class UIVMLogViewerOptionsPanel;
     60class CMachine;
    6461
    6562/** QWidget extension providing GUI for VirtualBox LogViewer. It
     
    213210    void setMachines(const QVector<QUuid> &machineIDs);
    214211    /** Returns the content of the ith log file of @comMachine or possibly an empty string */
    215     QString readLogFile(CMachine &comMachine, int iLogFileId);
     212    QString readLogFile(const CMachine &comConstMachine, int iLogFileId);
    216213    /** If the current tab is a label tab then switch to the next tab and return true. Returns false otherwise. */
    217214    bool labelTabHandler();
Note: See TracChangeset for help on using the changeset viewer.

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