Changeset 89585 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 9, 2021 4:03:51 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp
r89049 r89585 74 74 if (pWidget) 75 75 pWidget->setDialogBeingClosed(true); 76 } 77 78 void UIVMLogViewerDialog::setSelectedVMListItems(const QList<UIVirtualMachineItem*> &items) 79 { 80 Q_UNUSED(items); 81 UIVMLogViewerWidget *pLogViewerWidget = qobject_cast<UIVMLogViewerWidget*>(widget()); 82 if (pLogViewerWidget) 83 pLogViewerWidget->setSelectedVMListItems(items); 84 } 85 86 void UIVMLogViewerDialog::addSelectedVMListItems(const QList<UIVirtualMachineItem*> &items) 87 { 88 Q_UNUSED(items); 89 UIVMLogViewerWidget *pLogViewerWidget = qobject_cast<UIVMLogViewerWidget*>(widget()); 90 if (pLogViewerWidget) 91 pLogViewerWidget->addSelectedVMListItems(items); 76 92 } 77 93 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.h
r89049 r89585 40 40 class UIActionPool; 41 41 class UIVMLogViewerDialog; 42 class UIVirtualMachineItem; 42 43 class CMachine; 43 44 … … 79 80 UIVMLogViewerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool, const CMachine &comMachine); 80 81 ~UIVMLogViewerDialog(); 82 void setSelectedVMListItems(const QList<UIVirtualMachineItem*> &items); 83 void addSelectedVMListItems(const QList<UIVirtualMachineItem*> &items); 81 84 82 85 protected: -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r89315 r89585 222 222 } 223 223 224 void UIVMLogViewerWidget::addSelectedVMListItems(const QList<UIVirtualMachineItem*> &items) 225 { 226 QVector<QUuid> selectedMachines(m_machines); 227 228 foreach (const UIVirtualMachineItem *item, items) 229 { 230 if (!item) 231 continue; 232 selectedMachines << item->id(); 233 } 234 setMachines(selectedMachines); 235 } 236 224 237 void UIVMLogViewerWidget::setMachines(const QVector<QUuid> &machineIDs) 225 238 { … … 960 973 QString strMachineName = comMachine.GetName(); 961 974 962 if ( m_enmEmbedding == EmbedTo_Stack)975 if (uiCommon().uiType() == UICommon::UIType_SelectorUI) 963 976 m_pTabWidget->addTab(new UILabelTab(this, uMachineId), strMachineName); 964 977 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
r89105 r89585 88 88 89 89 void setSelectedVMListItems(const QList<UIVirtualMachineItem*> &items); 90 void addSelectedVMListItems(const QList<UIVirtualMachineItem*> &items); 90 91 QFont currentFont() const; 91 92 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r89515 r89585 467 467 , m_fFirstMediumEnumerationHandled(false) 468 468 , m_pActionPool(0) 469 , m_pLogViewerDialog(0) 470 , m_pWidget(0) 469 471 , m_iGeometrySaveTimerId(-1) 470 472 { … … 2001 2003 } 2002 2004 2005 QList<UIVirtualMachineItem*> itemsToShowLogs; 2006 2003 2007 /* For each selected item: */ 2004 2008 foreach (UIVirtualMachineItem *pItem, items) … … 2012 2016 if (!isActionEnabled(UIActionIndexMN_M_Group_S_ShowLogDialog, QList<UIVirtualMachineItem*>() << pItem)) 2013 2017 continue; 2014 2015 QIManagerDialog *pLogViewerDialog = 0; 2016 /* Create and Show VM Log Viewer: */ 2017 if (!m_logViewers[pItemLocal->machine().GetHardwareUUID().toString()]) 2018 { 2019 UIVMLogViewerDialogFactory dialogFactory(actionPool(), pItemLocal->machine()); 2020 dialogFactory.prepare(pLogViewerDialog, this); 2021 if (pLogViewerDialog) 2022 { 2023 m_logViewers[pItemLocal->machine().GetHardwareUUID().toString()] = pLogViewerDialog; 2024 connect(pLogViewerDialog, &QIManagerDialog::sigClose, 2025 this, &UIVirtualBoxManager::sltCloseLogViewerWindow); 2026 } 2027 } 2028 else 2029 { 2030 pLogViewerDialog = m_logViewers[pItemLocal->machine().GetHardwareUUID().toString()]; 2031 } 2032 if (pLogViewerDialog) 2033 { 2034 /* Show instance: */ 2035 pLogViewerDialog->show(); 2036 pLogViewerDialog->setWindowState(pLogViewerDialog->windowState() & ~Qt::WindowMinimized); 2037 pLogViewerDialog->activateWindow(); 2038 } 2039 } 2018 itemsToShowLogs << pItem; 2019 } 2020 2021 if (itemsToShowLogs.isEmpty()) 2022 return; 2023 if (!m_pLogViewerDialog) 2024 { 2025 UIVMLogViewerDialogFactory dialogFactory(actionPool(), CMachine()); 2026 dialogFactory.prepare(m_pLogViewerDialog, this); 2027 if (m_pLogViewerDialog) 2028 connect(m_pLogViewerDialog, &QIManagerDialog::sigClose, 2029 this, &UIVirtualBoxManager::sltCloseLogViewerWindow); 2030 } 2031 AssertPtrReturnVoid(m_pLogViewerDialog); 2032 UIVMLogViewerDialog *pDialog = qobject_cast<UIVMLogViewerDialog*>(m_pLogViewerDialog); 2033 if (pDialog) 2034 pDialog->addSelectedVMListItems(itemsToShowLogs); 2035 m_pLogViewerDialog->show(); 2036 m_pLogViewerDialog->setWindowState(m_pLogViewerDialog->windowState() & ~Qt::WindowMinimized); 2037 m_pLogViewerDialog->activateWindow(); 2040 2038 } 2041 2039 2042 2040 void UIVirtualBoxManager::sltCloseLogViewerWindow() 2043 2041 { 2044 /* If there is a proper sender: */ 2045 if (qobject_cast<QIManagerDialog*>(sender())) 2046 { 2047 /* Search for the sender of the signal within the m_logViewers map: */ 2048 QMap<QString, QIManagerDialog*>::iterator sendersIterator = m_logViewers.begin(); 2049 while (sendersIterator != m_logViewers.end() && sendersIterator.value() != sender()) 2050 ++sendersIterator; 2051 /* Do nothing if we cannot find it with the map: */ 2052 if (sendersIterator == m_logViewers.end()) 2053 return; 2054 2055 /* Check whether we have found the proper dialog: */ 2056 QIManagerDialog *pDialog = qobject_cast<QIManagerDialog*>(sendersIterator.value()); 2057 if (!pDialog) 2058 return; 2059 2060 /* First remove this log-viewer dialog from the map. 2061 * This should be done before closing the dialog which will incur 2062 * a second call to this function and result in double delete!!! */ 2063 m_logViewers.erase(sendersIterator); 2064 UIVMLogViewerDialogFactory().cleanup(pDialog); 2065 } 2066 /* Otherwise: */ 2067 else 2068 { 2069 /* Just wipe out everything: */ 2070 foreach (const QString &strKey, m_logViewers.keys()) 2071 { 2072 /* First remove each log-viewer dialog from the map. 2073 * This should be done before closing the dialog which will incur 2074 * a second call to this function and result in double delete!!! */ 2075 QIManagerDialog *pDialog = m_logViewers.value(strKey); 2076 m_logViewers.remove(strKey); 2077 UIVMLogViewerDialogFactory().cleanup(pDialog); 2078 } 2079 } 2080 } 2081 2042 if (!m_pLogViewerDialog) 2043 return; 2044 2045 QIManagerDialog* pDialog = m_pLogViewerDialog; 2046 m_pLogViewerDialog = 0; 2047 pDialog->close(); 2048 UIVMLogViewerDialogFactory().cleanup(pDialog); 2049 } 2082 2050 2083 2051 void UIVirtualBoxManager::sltPerformRefreshMachine() -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r89515 r89585 44 44 typedef QIWithRestorableGeometry<QMainWindow> QMainWindowWithRestorableGeometry; 45 45 typedef QIWithRetranslateUI<QMainWindowWithRestorableGeometry> QMainWindowWithRestorableGeometryAndRetranslateUi; 46 typedef QMap<QString, QIManagerDialog*> VMLogViewerMap;47 46 48 47 /** Singleton QMainWindow extension used as VirtualBox Manager instance. */ … … 453 452 QMap<UIToolType, QIManagerDialog*> m_managers; 454 453 455 /** Holds a map of (machineUUID, UIVMLogViewerDialog). */456 VMLogViewerMap m_logViewers;454 /** Holds the instance of UIVMLogViewerDialog. */ 455 QIManagerDialog *m_pLogViewerDialog; 457 456 458 457 /** Holds the central-widget instance. */
Note:
See TracChangeset
for help on using the changeset viewer.