Changeset 85192 in vbox
- Timestamp:
- Jul 10, 2020 3:05:54 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139164
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
r85151 r85192 1378 1378 setStatusTip(QApplication::translate("UIActionPool", "Delete console connection to disconnect ssh/vnc clients")); 1379 1379 } 1380 }; 1381 1382 /** Simple action extension, used as 'Copy Command' action class. */ 1383 class UIActionSimpleSelectorConsolePerformCopyCommand : public UIActionSimple 1384 { 1385 Q_OBJECT; 1386 1387 public: 1388 1389 /** Constructs action passing @a pParent to the base-class. */ 1390 UIActionSimpleSelectorConsolePerformCopyCommand(UIActionPool *pParent, bool fSerial) 1391 : UIActionSimple(pParent, ":/file_manager_copy_16px.png", ":/file_manager_copy_16px.png") /// @todo replace with proper icon 1392 , m_fSerial(fSerial) 1393 {} 1394 1395 protected: 1396 1397 /** Returns shortcut extra-data ID. */ 1398 virtual QString shortcutExtraDataID() const /* override */ 1399 { 1400 return m_fSerial 1401 ? QString("CopyConsoleCommandSerial") 1402 : QString("CopyConsoleCommandVNC"); 1403 } 1404 1405 /** Handles translation event. */ 1406 virtual void retranslateUi() /* override */ 1407 { 1408 if (m_fSerial) 1409 { 1410 setName(QApplication::translate("UIActionPool", "&Copy Command (serial)")); 1411 setStatusTip(QApplication::translate("UIActionPool", "Copy console command for serial connection")); 1412 } 1413 else 1414 { 1415 setName(QApplication::translate("UIActionPool", "&Copy Command (VNC)")); 1416 setStatusTip(QApplication::translate("UIActionPool", "Copy console command for VNC connection")); 1417 } 1418 } 1419 1420 private: 1421 1422 /** Holds whether this command is of serial type. */ 1423 bool m_fSerial; 1380 1424 }; 1381 1425 … … 3063 3107 m_pool[UIActionIndexST_M_Machine_M_Console_S_CreateConnection] = new UIActionSimpleSelectorConsolePerformCreateConnection(this); 3064 3108 m_pool[UIActionIndexST_M_Machine_M_Console_S_DeleteConnection] = new UIActionSimpleSelectorConsolePerformDeleteConnection(this); 3109 m_pool[UIActionIndexST_M_Machine_M_Console_S_CopyCommandSerial] = new UIActionSimpleSelectorConsolePerformCopyCommand(this, true); 3110 m_pool[UIActionIndexST_M_Machine_M_Console_S_CopyCommandVNC] = new UIActionSimpleSelectorConsolePerformCopyCommand(this, false); 3065 3111 m_pool[UIActionIndexST_M_Machine_M_Close] = new UIActionMenuSelectorClose(this); 3066 3112 m_pool[UIActionIndexST_M_Machine_M_Close_S_Detach] = new UIActionSimpleSelectorClosePerformDetach(this); … … 3826 3872 << action(UIActionIndexST_M_Machine_M_Console_S_CreateConnection) 3827 3873 << action(UIActionIndexST_M_Machine_M_Console_S_DeleteConnection) 3874 << action(UIActionIndexST_M_Machine_M_Console_S_CopyCommandSerial) 3875 << action(UIActionIndexST_M_Machine_M_Console_S_CopyCommandVNC) 3828 3876 // << action(UIActionIndexST_M_Machine_M_Close_S_Detach) 3829 3877 << action(UIActionIndexST_M_Machine_M_Close_S_SaveState) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h
r85111 r85192 109 109 UIActionIndexST_M_Machine_M_Console_S_CreateConnection, 110 110 UIActionIndexST_M_Machine_M_Console_S_DeleteConnection, 111 UIActionIndexST_M_Machine_M_Console_S_CopyCommandSerial, 112 UIActionIndexST_M_Machine_M_Console_S_CopyCommandVNC, 111 113 UIActionIndexST_M_Machine_M_Close, 112 114 UIActionIndexST_M_Machine_M_Close_S_Detach, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r85191 r85192 1195 1195 } 1196 1196 1197 void UIVirtualBoxManager::sltPerformCopyCommandSerial() 1198 { 1199 /* Get current item: */ 1200 UIVirtualMachineItem *pItem = currentItem(); 1201 AssertMsgReturnVoid(pItem, ("Current item should be selected!\n")); 1202 UIVirtualMachineItemCloud *pCloudItem = pItem->toCloud(); 1203 AssertPtrReturnVoid(pCloudItem); 1204 1205 /* Acquire cloud machine: */ 1206 CCloudMachine comMachine = pCloudItem->machine(); 1207 1208 /* Put copied serial command to clipboard: */ 1209 QClipboard *pClipboard = QGuiApplication::clipboard(); 1210 AssertPtrReturnVoid(pClipboard); 1211 pClipboard->setText(comMachine.GetSerialConsoleCommand()); 1212 } 1213 1214 void UIVirtualBoxManager::sltPerformCopyCommandVNC() 1215 { 1216 /* Get current item: */ 1217 UIVirtualMachineItem *pItem = currentItem(); 1218 AssertMsgReturnVoid(pItem, ("Current item should be selected!\n")); 1219 UIVirtualMachineItemCloud *pCloudItem = pItem->toCloud(); 1220 AssertPtrReturnVoid(pCloudItem); 1221 1222 /* Acquire cloud machine: */ 1223 CCloudMachine comMachine = pCloudItem->machine(); 1224 1225 /* Put copied VNC command to clipboard: */ 1226 QClipboard *pClipboard = QGuiApplication::clipboard(); 1227 AssertPtrReturnVoid(pClipboard); 1228 pClipboard->setText(comMachine.GetVNCConsoleCommand()); 1229 } 1230 1197 1231 void UIVirtualBoxManager::sltPerformDiscardMachineState() 1198 1232 { … … 2044 2078 connect(actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_DeleteConnection), &UIAction::triggered, 2045 2079 this, &UIVirtualBoxManager::sltPerformDeleteConsoleConnectionForMachine); 2080 connect(actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_CopyCommandSerial), &UIAction::triggered, 2081 this, &UIVirtualBoxManager::sltPerformCopyCommandSerial); 2082 connect(actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_CopyCommandVNC), &UIAction::triggered, 2083 this, &UIVirtualBoxManager::sltPerformCopyCommandVNC); 2046 2084 2047 2085 /* 'Group/Close' menu connections: */ … … 2504 2542 this, &UIVirtualBoxManager::sltCopyConsoleConnectionFingerprint); 2505 2543 pAction->setProperty("fingerprint", strFingerprint); 2544 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_CopyCommandSerial)); 2545 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_CopyCommandVNC)); 2506 2546 } 2507 2547 } … … 2636 2676 actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_CreateConnection)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Console_S_CreateConnection, items)); 2637 2677 actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_DeleteConnection)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Console_S_DeleteConnection, items)); 2678 actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_CopyCommandSerial)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Console_S_CopyCommandSerial, items)); 2679 actionPool()->action(UIActionIndexST_M_Machine_M_Console_S_CopyCommandVNC)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Console_S_CopyCommandVNC, items)); 2638 2680 2639 2681 /* Enable/disable group-close actions: */ … … 2906 2948 case UIActionIndexST_M_Machine_M_Console_S_CreateConnection: 2907 2949 case UIActionIndexST_M_Machine_M_Console_S_DeleteConnection: 2950 case UIActionIndexST_M_Machine_M_Console_S_CopyCommandSerial: 2951 case UIActionIndexST_M_Machine_M_Console_S_CopyCommandVNC: 2908 2952 { 2909 2953 return isAtLeastOneItemStarted(items); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r85191 r85192 248 248 /** Handles call to copy console connection key fingerprint. */ 249 249 void sltCopyConsoleConnectionFingerprint(); 250 /** Handles call to copy serial console command. */ 251 void sltPerformCopyCommandSerial(); 252 /** Handles call to copy VNC console command. */ 253 void sltPerformCopyCommandVNC(); 250 254 251 255 /** Handles call to discard machine state. */
Note:
See TracChangeset
for help on using the changeset viewer.