Changeset 89586 in vbox
- Timestamp:
- Jun 9, 2021 4:53:46 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/logviewer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.cpp
r89011 r89586 35 35 *********************************************************************************************************************************/ 36 36 37 UIVMLogTab::UIVMLogTab(QWidget *pParent, const QUuid &uMachineId )37 UIVMLogTab::UIVMLogTab(QWidget *pParent, const QUuid &uMachineId, const QString &strMachineName) 38 38 : QIWithRetranslateUI<QWidget>(pParent) 39 39 , m_uMachineId(uMachineId) 40 , m_strMachineName(strMachineName) 40 41 { 41 42 } … … 43 44 { 44 45 return m_uMachineId; 46 } 47 48 const QString UIVMLogTab::machineName() const 49 { 50 return m_strMachineName; 45 51 } 46 52 … … 49 55 *********************************************************************************************************************************/ 50 56 51 UIVMLogPage::UIVMLogPage(QWidget *pParent, const QUuid &uMachineId )52 : UIVMLogTab(pParent, uMachineId )57 UIVMLogPage::UIVMLogPage(QWidget *pParent, const QUuid &uMachineId, const QString &strMachineName) 58 : UIVMLogTab(pParent, uMachineId, strMachineName) 53 59 , m_pMainLayout(0) 54 60 , m_pTextEdit(0) -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.h
r89011 r89586 49 49 public: 50 50 51 UIVMLogTab(QWidget *pParent, const QUuid &uMachineId );51 UIVMLogTab(QWidget *pParent, const QUuid &uMachineId, const QString &strMachineName); 52 52 const QUuid &machineId() const; 53 const QString machineName() const; 53 54 54 55 private: 55 56 56 57 QUuid m_uMachineId; 58 QString m_strMachineName; 57 59 }; 58 60 … … 70 72 public: 71 73 72 UIVMLogPage(QWidget *pParent, const QUuid &uMachineId );74 UIVMLogPage(QWidget *pParent, const QUuid &uMachineId, const QString &strMachineName); 73 75 ~UIVMLogPage(); 74 76 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r89585 r89586 67 67 public: 68 68 69 UILabelTab(QWidget *pParent, const QUuid &uMachineId )70 : UIVMLogPage(pParent, uMachineId )69 UILabelTab(QWidget *pParent, const QUuid &uMachineId, const QString &strMachineName) 70 : UIVMLogPage(pParent, uMachineId, strMachineName) 71 71 { 72 72 } … … 113 113 :QTabBar(pParent) 114 114 { 115 setContextMenuPolicy(Qt::CustomContextMenu); 115 116 } 116 117 … … 598 599 } 599 600 601 void UIVMLogViewerWidget::sltShowTabBarContextMenu(const QPoint &pos) 602 { 603 if (m_pTabWidget && m_pTabWidget->tabBar()) 604 { 605 QMenu menu; 606 menu.addAction(tr("Close Other Tabs")); 607 menu.exec(m_pTabWidget->tabBar()->mapToGlobal(pos)); 608 } 609 } 610 600 611 void UIVMLogViewerWidget::prepare() 601 612 { … … 668 679 m_pMainLayout->addWidget(m_pTabWidget); 669 680 connect(m_pTabWidget, &QITabWidget::currentChanged, this, &UIVMLogViewerWidget::sltCurrentTabChanged); 681 connect(m_pTabWidget->tabBar(), &QTabBar::customContextMenuRequested, 682 this, &UIVMLogViewerWidget::sltShowTabBarContextMenu); 670 683 } 671 684 … … 904 917 905 918 void UIVMLogViewerWidget::createLogPage(const QString &strFileName, 919 const QString &strMachineName, 906 920 const QUuid &machineId, int iLogFileId, 907 921 const QString &strLogContent, bool noLogsToShow) … … 911 925 912 926 /* Create page-container: */ 913 UIVMLogPage* pLogPage = new UIVMLogPage(this, machineId );927 UIVMLogPage* pLogPage = new UIVMLogPage(this, machineId, strMachineName); 914 928 if (pLogPage) 915 929 { … … 974 988 975 989 if (uiCommon().uiType() == UICommon::UIType_SelectorUI) 976 m_pTabWidget->addTab(new UILabelTab(this, uMachineId ), strMachineName);990 m_pTabWidget->addTab(new UILabelTab(this, uMachineId, strMachineName), strMachineName); 977 991 978 992 bool fNoLogFileForMachine = true; … … 984 998 fNoLogFileForMachine = false; 985 999 createLogPage(comMachine.QueryLogFilename(iLogFileId), 1000 strMachineName, 986 1001 uMachineId, iLogFileId, 987 1002 strLogContent, false); … … 994 1009 "<nobr><b>%2</b></nobr>.</p>") 995 1010 .arg(strMachineName).arg(comMachine.GetLogFolder())); 996 createLogPage(tr("NoLogFile"), uMachineId, -1 /* iLogFileId */, strDummyTabText, true);1011 createLogPage(tr("NoLogFile"), strMachineName, uMachineId, -1 /* iLogFileId */, strDummyTabText, true); 997 1012 } 998 1013 } -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
r89585 r89586 141 141 void sltResetOptionsToDefault(); 142 142 /** @} */ 143 void sltShowTabBarContextMenu(const QPoint &pos); 143 144 144 145 private: … … 175 176 /** Returns the newly created log-page using @a strPage filename. */ 176 177 void createLogPage(const QString &strFileName, 178 const QString &strMachineName, 177 179 const QUuid &machineId, int iLogFileId, 178 180 const QString &strLogContent, bool noLogsToShow);
Note:
See TracChangeset
for help on using the changeset viewer.