Changeset 102575 in vbox
- Timestamp:
- Dec 11, 2023 4:48:25 PM (14 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
r102268 r102575 1275 1275 }; 1276 1276 1277 /** Simple action extension, used as 'Show Machine Logs' action class. */1278 class UIActionSimpleManagerCommonShowMachineLogs : public UIActionSimple1279 {1280 Q_OBJECT;1281 1282 public:1283 1284 /** Constructs action passing @a pParent to the base-class. */1285 UIActionSimpleManagerCommonShowMachineLogs(UIActionPool *pParent)1286 : UIActionSimple(pParent,1287 ":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png",1288 ":/vm_show_logs_disabled_32px.png", ":/vm_show_logs_disabled_16px.png")1289 {1290 retranslateUi();1291 }1292 1293 protected:1294 1295 /** Returns shortcut extra-data ID. */1296 virtual QString shortcutExtraDataID() const RT_OVERRIDE1297 {1298 return QString("LogViewer");1299 }1300 1301 /** Returns default shortcut. */1302 virtual QKeySequence defaultShortcut(UIActionPoolType) const RT_OVERRIDE1303 {1304 return QKeySequence("Ctrl+L");1305 }1306 1307 /** Handles translation event. */1308 virtual void retranslateUi() RT_OVERRIDE1309 {1310 setName(QApplication::translate("UIActionPool", "Show &Log..."));1311 setStatusTip(QApplication::translate("UIActionPool", "Show log files of selected virtual machines"));1312 }1313 };1314 1315 1277 /** Simple action extension, used as 'Perform Refresh' action class. */ 1316 1278 class UIActionSimpleManagerCommonPerformRefresh : public UIActionSimple … … 1905 1867 { 1906 1868 return QString("ToolsMachineLogViewer"); 1869 } 1870 1871 /** Returns default shortcut. */ 1872 virtual QKeySequence defaultShortcut(UIActionPoolType) const RT_OVERRIDE 1873 { 1874 return QKeySequence("Ctrl+L"); 1907 1875 } 1908 1876 … … 3662 3630 m_pool[UIActionIndexMN_M_Group_M_Tools_T_FileManager] = new UIActionToggleManagerToolsMachineShowFileManager(this); 3663 3631 m_pool[UIActionIndexMN_M_Group_S_Discard] = new UIActionSimpleManagerCommonPerformDiscard(this); 3664 m_pool[UIActionIndexMN_M_Group_S_ShowLogDialog] = new UIActionSimpleManagerCommonShowMachineLogs(this);3665 m_pool[UIActionIndexMN_M_Group_S_ShowLogDialog] = new UIActionSimpleManagerCommonShowMachineLogs(this);3666 3632 m_pool[UIActionIndexMN_M_Group_S_Refresh] = new UIActionSimpleManagerCommonPerformRefresh(this); 3667 3633 m_pool[UIActionIndexMN_M_Group_S_ShowInFileManager] = new UIActionSimpleManagerCommonShowInFileManager(this); … … 3709 3675 m_pool[UIActionIndexMN_M_Machine_M_Tools_T_FileManager] = new UIActionToggleManagerToolsMachineShowFileManager(this); 3710 3676 m_pool[UIActionIndexMN_M_Machine_S_Discard] = new UIActionSimpleManagerCommonPerformDiscard(this); 3711 m_pool[UIActionIndexMN_M_Machine_S_ShowLogDialog] = new UIActionSimpleManagerCommonShowMachineLogs(this);3712 3677 m_pool[UIActionIndexMN_M_Machine_S_Refresh] = new UIActionSimpleManagerCommonPerformRefresh(this); 3713 3678 m_pool[UIActionIndexMN_M_Machine_S_ShowInFileManager] = new UIActionSimpleManagerCommonShowInFileManager(this); … … 3965 3930 // << action(UIActionIndexMN_M_Group_S_Detach) 3966 3931 << action(UIActionIndexMN_M_Group_S_Discard) 3967 << action(UIActionIndexMN_M_Group_S_ShowLogDialog)3968 3932 << action(UIActionIndexMN_M_Group_S_Refresh) 3969 3933 << action(UIActionIndexMN_M_Group_S_ShowInFileManager) … … 4001 3965 // << action(UIActionIndexMN_M_Machine_S_Detach) 4002 3966 << action(UIActionIndexMN_M_Machine_S_Discard) 4003 << action(UIActionIndexMN_M_Machine_S_ShowLogDialog)4004 3967 << action(UIActionIndexMN_M_Machine_S_Refresh) 4005 3968 << action(UIActionIndexMN_M_Machine_S_ShowInFileManager) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h
r102265 r102575 96 96 UIActionIndexMN_M_Group_M_Tools_T_FileManager, 97 97 UIActionIndexMN_M_Group_S_Discard, 98 UIActionIndexMN_M_Group_S_ShowLogDialog,99 98 UIActionIndexMN_M_Group_S_Refresh, 100 99 UIActionIndexMN_M_Group_S_ShowInFileManager, … … 142 141 UIActionIndexMN_M_Machine_M_Tools_T_FileManager, 143 142 UIActionIndexMN_M_Machine_S_Discard, 144 UIActionIndexMN_M_Machine_S_ShowLogDialog,145 143 UIActionIndexMN_M_Machine_S_Refresh, 146 144 UIActionIndexMN_M_Machine_S_ShowInFileManager, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r102574 r102575 588 588 , m_fFirstMediumEnumerationHandled(false) 589 589 , m_pActionPool(0) 590 , m_pLogViewerDialog(0)591 590 , m_pWidget(0) 592 591 , m_iGeometrySaveTimerId(-1) … … 950 949 updateActionsVisibility(); 951 950 updateActionsAppearance(); 952 953 /* Make sure separate dialog closed when corresponding tool opened: */954 switch (m_pWidget->toolsTypeMachine())955 {956 case UIToolType_Logs:957 sltCloseLogViewerWindow();958 break;959 default:960 break;961 }962 951 } 963 952 … … 1033 1022 case UIToolType_Cloud: UICloudProfileManagerFactory(m_pActionPool).prepare(m_managers[enmType], this); break; 1034 1023 case UIToolType_CloudConsole: UICloudConsoleManagerFactory(m_pActionPool).prepare(m_managers[enmType], this); break; 1024 case UIToolType_Logs: 1025 { 1026 /* Compose a list of selected machine IDs: */ 1027 QList<QUuid> machineIDs; 1028 /* For each selected item: */ 1029 foreach (UIVirtualMachineItem *pItem, currentItems()) 1030 { 1031 /* Make sure current item is local one: */ 1032 UIVirtualMachineItemLocal *pItemLocal = pItem->toLocal(); 1033 if (!pItemLocal) 1034 continue; 1035 /* Append machine ID: */ 1036 machineIDs << pItemLocal->id(); 1037 } 1038 UIVMLogViewerDialogFactory(m_pActionPool, machineIDs).prepare(m_managers[enmType], this); 1039 break; 1040 } 1035 1041 default: break; 1036 1042 } … … 1073 1079 case UIToolType_Cloud: UICloudProfileManagerFactory().cleanup(m_managers[enmType]); break; 1074 1080 case UIToolType_CloudConsole: UICloudConsoleManagerFactory().cleanup(m_managers[enmType]); break; 1081 case UIToolType_Logs: UIVMLogViewerDialogFactory().cleanup(m_managers[enmType]); break; 1075 1082 default: break; 1076 1083 } … … 2211 2218 } 2212 2219 2213 void UIVirtualBoxManager::sltOpenLogViewerWindow()2214 {2215 /* Get selected items: */2216 QList<UIVirtualMachineItem*> items = currentItems();2217 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));2218 2219 /* First check if instance of widget opened the embedded way: */2220 if (m_pWidget->isMachineToolOpened(UIToolType_Logs))2221 {2222 m_pWidget->setToolsTypeMachine(UIToolType_Details);2223 m_pWidget->closeMachineTool(UIToolType_Logs);2224 }2225 2226 QList<QUuid> machineIDs;2227 2228 /* For each selected item: */2229 foreach (UIVirtualMachineItem *pItem, items)2230 {2231 /* Make sure current item is local one: */2232 UIVirtualMachineItemLocal *pItemLocal = pItem->toLocal();2233 if (!pItemLocal)2234 continue;2235 2236 /* Check if log could be show for the current item: */2237 if (!isActionEnabled(UIActionIndexMN_M_Group_S_ShowLogDialog, QList<UIVirtualMachineItem*>() << pItem))2238 continue;2239 machineIDs << pItem->id();2240 }2241 2242 if (machineIDs.isEmpty())2243 return;2244 if (!m_pLogViewerDialog)2245 {2246 UIVMLogViewerDialogFactory dialogFactory(actionPool(), machineIDs);2247 dialogFactory.prepare(m_pLogViewerDialog, this);2248 if (m_pLogViewerDialog)2249 connect(m_pLogViewerDialog, &QIManagerDialog::sigClose,2250 this, &UIVirtualBoxManager::sltCloseLogViewerWindow);2251 }2252 AssertPtrReturnVoid(m_pLogViewerDialog);2253 m_pLogViewerDialog->show();2254 m_pLogViewerDialog->setWindowState(m_pLogViewerDialog->windowState() & ~Qt::WindowMinimized);2255 m_pLogViewerDialog->activateWindow();2256 }2257 2258 void UIVirtualBoxManager::sltCloseLogViewerWindow()2259 {2260 if (!m_pLogViewerDialog)2261 return;2262 2263 QIManagerDialog* pDialog = m_pLogViewerDialog;2264 m_pLogViewerDialog = 0;2265 pDialog->close();2266 UIVMLogViewerDialogFactory().cleanup(pDialog);2267 }2268 2269 2220 void UIVirtualBoxManager::sltPerformRefreshMachine() 2270 2221 { … … 2568 2519 connect(actionPool()->action(UIActionIndexMN_M_Group_S_Discard), &UIAction::triggered, 2569 2520 this, &UIVirtualBoxManager::sltPerformDiscardMachineState); 2570 connect(actionPool()->action(UIActionIndexMN_M_Group_S_ShowLogDialog), &UIAction::triggered,2571 this, &UIVirtualBoxManager::sltOpenLogViewerWindow);2572 2521 connect(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh), &UIAction::triggered, 2573 2522 this, &UIVirtualBoxManager::sltPerformRefreshMachine); … … 2612 2561 connect(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard), &UIAction::triggered, 2613 2562 this, &UIVirtualBoxManager::sltPerformDiscardMachineState); 2614 connect(actionPool()->action(UIActionIndexMN_M_Machine_S_ShowLogDialog), &UIAction::triggered,2615 this, &UIVirtualBoxManager::sltOpenLogViewerWindow);2616 2563 connect(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh), &UIAction::triggered, 2617 2564 this, &UIVirtualBoxManager::sltPerformRefreshMachine); … … 3140 3087 pMenu->addSeparator(); 3141 3088 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard)); 3142 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_ShowLogDialog));3143 3089 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh)); 3144 3090 pMenu->addSeparator(); … … 3206 3152 pMenu->addSeparator(); 3207 3153 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)); 3208 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_ShowLogDialog));3209 3154 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh)); 3210 3155 pMenu->addSeparator(); … … 3499 3444 actionPool()->action(UIActionIndexMN_M_Group_S_Detach)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_Detach, items)); 3500 3445 actionPool()->action(UIActionIndexMN_M_Group_S_Discard)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_Discard, items)); 3501 actionPool()->action(UIActionIndexMN_M_Group_S_ShowLogDialog)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_ShowLogDialog, items));3502 3446 actionPool()->action(UIActionIndexMN_M_Group_S_Refresh)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_Refresh, items)); 3503 3447 actionPool()->action(UIActionIndexMN_M_Group_S_ShowInFileManager)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_ShowInFileManager, items)); … … 3519 3463 actionPool()->action(UIActionIndexMN_M_Machine_S_Detach)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_Detach, items)); 3520 3464 actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_Discard, items)); 3521 actionPool()->action(UIActionIndexMN_M_Machine_S_ShowLogDialog)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_ShowLogDialog, items));3522 3465 actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_Refresh, items)); 3523 3466 actionPool()->action(UIActionIndexMN_M_Machine_S_ShowInFileManager)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_ShowInFileManager, items)); … … 3769 3712 m_pWidget->isCurrentStateItemSelected()); 3770 3713 } 3771 case UIActionIndexMN_M_Group_S_ShowLogDialog:3772 case UIActionIndexMN_M_Machine_S_ShowLogDialog:3773 {3774 return isItemsLocal(items) &&3775 isAtLeastOneItemAccessible(items);3776 }3777 3714 case UIActionIndexMN_M_Group_T_Pause: 3778 3715 case UIActionIndexMN_M_Machine_T_Pause: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r102139 r102575 319 319 /** Handles call to show machine tool corresponding to passed @a pAction. */ 320 320 void sltPerformShowMachineTool(QAction *pAction); 321 322 /** Handles call to open machine Log Viewer window. */323 void sltOpenLogViewerWindow();324 /** Handles call to close machine Log Viewer window. */325 void sltCloseLogViewerWindow();326 321 327 322 /** Handles call to refresh machine. */ … … 526 521 QMap<WizardType, UINativeWizard*> m_wizards; 527 522 528 /** Holds the instance of UIVMLogViewerDialog. */529 QIManagerDialog *m_pLogViewerDialog;530 531 523 /** Holds the central-widget instance. */ 532 524 UIVirtualBoxManagerWidget *m_pWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r102111 r102575 1487 1487 pMenuGroup->addSeparator(); 1488 1488 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard)); 1489 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_ShowLogDialog));1490 1489 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh)); 1491 1490 pMenuGroup->addSeparator(); … … 1515 1514 pMenuMachine->addSeparator(); 1516 1515 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)); 1517 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_ShowLogDialog));1518 1516 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh)); 1519 1517 pMenuMachine->addSeparator();
Note:
See TracChangeset
for help on using the changeset viewer.