Changeset 77822 in vbox for trunk/src/VBox
- Timestamp:
- Mar 21, 2019 8:23:11 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r76606 r77822 807 807 switch (runtimeMenuDebuggerActionType) 808 808 { 809 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics: strResult = "Statistics"; break; 810 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine: strResult = "CommandLine"; break; 811 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging: strResult = "Logging"; break; 812 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog: strResult = "LogDialog"; break; 813 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All: strResult = "All"; break; 809 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics: strResult = "Statistics"; break; 810 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine: strResult = "CommandLine"; break; 811 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging: strResult = "Logging"; break; 812 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog: strResult = "LogDialog"; break; 813 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_GuestControlConsole: strResult = "GuestControlConsole"; break; 814 case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All: strResult = "All"; break; 814 815 default: 815 816 { … … 827 828 * to search through the keys using 'case-insensitive' rule: */ 828 829 QStringList keys; QList<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType> values; 829 keys << "Statistics"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics; 830 keys << "CommandLine"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine; 831 keys << "Logging"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging; 832 keys << "LogDialog"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog; 833 keys << "All"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All; 830 keys << "Statistics"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics; 831 keys << "CommandLine"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine; 832 keys << "Logging"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging; 833 keys << "LogDialog"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog; 834 keys << "GuestControlConsole"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_GuestControlConsole; 835 keys << "All"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All; 834 836 /* Invalid type for unknown words: */ 835 837 if (!keys.contains(strRuntimeMenuDebuggerActionType, Qt::CaseInsensitive)) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r77377 r77822 606 606 enum RuntimeMenuDebuggerActionType 607 607 { 608 RuntimeMenuDebuggerActionType_Invalid = 0, 609 RuntimeMenuDebuggerActionType_Statistics = RT_BIT(0), 610 RuntimeMenuDebuggerActionType_CommandLine = RT_BIT(1), 611 RuntimeMenuDebuggerActionType_Logging = RT_BIT(2), 612 RuntimeMenuDebuggerActionType_LogDialog = RT_BIT(3), 613 RuntimeMenuDebuggerActionType_All = 0xFFFF 608 RuntimeMenuDebuggerActionType_Invalid = 0, 609 RuntimeMenuDebuggerActionType_Statistics = RT_BIT(0), 610 RuntimeMenuDebuggerActionType_CommandLine = RT_BIT(1), 611 RuntimeMenuDebuggerActionType_Logging = RT_BIT(2), 612 RuntimeMenuDebuggerActionType_LogDialog = RT_BIT(3), 613 RuntimeMenuDebuggerActionType_GuestControlConsole = RT_BIT(4), 614 RuntimeMenuDebuggerActionType_All = 0xFFFF 614 615 }; 615 616 #endif /* VBOX_WITH_DEBUGGER_GUI */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp
r77584 r77822 2899 2899 { 2900 2900 setName(QApplication::translate("UIActionPool", "Show &Log...", "debug action")); 2901 } 2902 }; 2903 2904 /** Simple action extension, used as 'Guest Control Terminal' action class. */ 2905 class UIActionSimpleRuntimeGuestControlConsole : public UIActionSimple 2906 { 2907 Q_OBJECT; 2908 2909 public: 2910 2911 /** Constructs action passing @a pParent to the base-class. */ 2912 UIActionSimpleRuntimeGuestControlConsole(UIActionPool *pParent) 2913 : UIActionSimple(pParent, true) 2914 {} 2915 2916 protected: 2917 2918 /** Returns action extra-data ID. */ 2919 virtual int extraDataID() const /* override */ 2920 { 2921 return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_GuestControlConsole; 2922 } 2923 /** Returns action extra-data key. */ 2924 virtual QString extraDataKey() const /* override */ 2925 { 2926 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_GuestControlConsole); 2927 } 2928 /** Returns whether action is allowed. */ 2929 virtual bool isAllowed() const /* override */ 2930 { 2931 return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_GuestControlConsole); 2932 } 2933 2934 /** Returns shortcut extra-data ID. */ 2935 virtual QString shortcutExtraDataID() const /* override */ 2936 { 2937 return QString("GuestControlConsole"); 2938 } 2939 2940 /** Handles translation event. */ 2941 virtual void retranslateUi() /* override */ 2942 { 2943 setName(QApplication::translate("UIActionPool", "Guest Control Terminal...", "debug action")); 2901 2944 } 2902 2945 }; … … 3342 3385 m_pool[UIActionIndexRT_M_Debug_T_Logging] = new UIActionToggleRuntimeLogging(this); 3343 3386 m_pool[UIActionIndexRT_M_Debug_S_ShowLogDialog] = new UIActionSimpleRuntimeShowLogs(this); 3387 m_pool[UIActionIndexRT_M_Debug_S_GuestControlConsole] = new UIActionSimpleRuntimeGuestControlConsole(this); 3344 3388 #endif /* VBOX_WITH_DEBUGGER_GUI */ 3345 3389 … … 4254 4298 /* 'Log Dialog' action: */ 4255 4299 addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowLogDialog)); 4300 /* 'Guest Control Terminal' action: */ 4301 addAction(pMenu, action(UIActionIndexRT_M_Debug_S_GuestControlConsole)); 4256 4302 4257 4303 /* Mark menu as valid: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.h
r77584 r77822 122 122 UIActionIndexRT_M_Debug_T_Logging, 123 123 UIActionIndexRT_M_Debug_S_ShowLogDialog, 124 UIActionIndexRT_M_Debug_S_GuestControlConsole, 124 125 #endif 125 126 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlConsole.cpp
r76606 r77822 23 23 /* GUI includes: */ 24 24 #include "UIGuestControlConsole.h" 25 26 27 UIGuestControlConsole::UIGuestControlConsole( QWidget* parent /* = 0 */)25 #include "UIGuestControlInterface.h" 26 27 UIGuestControlConsole::UIGuestControlConsole(const CGuest &comGuest, QWidget* parent /* = 0 */) 28 28 :QPlainTextEdit(parent) 29 , m_comGuest(comGuest) 29 30 , m_strGreet("Welcome to 'Guest Control Console'. Type 'help' for help\n") 30 31 , m_strPrompt("$>") 31 32 , m_uCommandHistoryIndex(0) 32 { 33 , m_pControlInterface(0) 34 { 35 m_pControlInterface = new UIGuestControlInterface(this, m_comGuest); 36 37 connect(m_pControlInterface, &UIGuestControlInterface::sigOutputString, 38 this, &UIGuestControlConsole::sltOutputReceived); 39 33 40 /* Configure this: */ 34 41 setUndoRedoEnabled(false); … … 48 55 } 49 56 57 void UIGuestControlConsole::commandEntered(const QString &strCommand) 58 { 59 if (m_pControlInterface) 60 m_pControlInterface->putCommand(strCommand); 61 } 62 63 void UIGuestControlConsole::sltOutputReceived(const QString &strOutput) 64 { 65 putOutput(strOutput); 66 } 67 50 68 void UIGuestControlConsole::reset() 51 69 { … … 124 142 if (!strCommand.isEmpty()) 125 143 { 126 emitcommandEntered(strCommand);144 commandEntered(strCommand); 127 145 if (!m_tCommandHistory.contains(strCommand)) 128 146 m_tCommandHistory.push_back(strCommand); … … 297 315 return list; 298 316 } 299 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlConsole.h
r76581 r77822 25 25 # include <QPlainTextEdit> 26 26 27 /* COM includes: */ 28 #include "COMEnums.h" 29 #include "CGuest.h" 30 31 class UIGuestControlInterface; 27 32 /** QPlainTextEdit extension to provide a simple terminal like widget. */ 28 33 class UIGuestControlConsole : public QPlainTextEdit … … 31 36 Q_OBJECT; 32 37 33 signals:34 /* This is emitted when return key is pressed */35 void commandEntered(QString command);36 38 37 39 public: 38 40 39 UIGuestControlConsole( QWidget* parent = 0);41 UIGuestControlConsole(const CGuest &comGuest, QWidget* parent = 0); 40 42 /* @p strOutput is displayed in the console */ 41 43 void putOutput(const QString &strOutput); … … 50 52 private slots: 51 53 54 void sltOutputReceived(const QString &strOutput); 52 55 53 56 private: … … 66 69 QString getPreviousCommandFromHistory(const QString &originalString = QString()); 67 70 void completeByTab(); 71 void commandEntered(const QString &strCommand); 72 68 73 /* Return a list of words that start with @p strSearch */ 69 74 QList<QString> matchedWords(const QString &strSearch) const; 75 CGuest m_comGuest; 70 76 const QString m_strGreet; 71 77 const QString m_strPrompt; … … 74 80 CommandHistory m_tCommandHistory; 75 81 unsigned m_uCommandHistoryIndex; 82 UIGuestControlInterface *m_pControlInterface; 76 83 }; 77 84 78 85 #endif /* !FEQT_INCLUDED_SRC_guestctrl_UIGuestControlConsole_h */ 79 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlInterface.cpp
r76606 r77822 168 168 , m_comGuest(comGuest) 169 169 , m_strHelp("[common-options] [--username <name>] [--domain <domain>]\n" 170 " 170 " [--passwordfile <file> | --password <password>]\n" 171 171 "start [common-options]\n" 172 172 " [--exe <path to executable>] [--timeout <msec>]\n" … … 179 179 " [-P|--parents] [<guest directory>\n" 180 180 " [--sessionid <id> | [sessionname <name>]]\n" 181 " [stat|ls [common-options]\n"181 "stat|ls [common-options]\n" 182 182 " [--sessionid <id> | [sessionname <name>]]\n" 183 183 ) … … 540 540 if (!isGuestAdditionsAvailable(m_comGuest)) 541 541 { 542 emit sigOutputString("No guest addtions detected. Guest control needs guest additions");542 emit sigOutputString("No guest addtions detected. Guest control requires guest additions"); 543 543 return; 544 544 } … … 676 676 return strObjectInfo; 677 677 } 678 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlInterface.h
r76581 r77822 61 61 /** @} */ 62 62 63 64 63 private slots: 65 64 … … 93 92 QString getFsObjInfoString(const T &fsObjectInfo) const; 94 93 95 96 94 CGuest m_comGuest; 97 95 const QString m_strHelp; … … 102 100 103 101 #endif /* !FEQT_INCLUDED_SRC_guestctrl_UIGuestControlInterface_h */ 104 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlDialog.cpp
r77647 r77822 24 24 #include "UIExtraDataManager.h" 25 25 #include "UIIconPool.h" 26 #include "UIGuestControlConsole.h" 26 27 #include "UIGuestProcessControlDialog.h" 27 #include "UIGuestProcessControlWidget.h"28 28 #include "VBoxGlobal.h" 29 29 #ifdef VBOX_WS_MAC … … 71 71 setWindowTitle(tr("%1 - Guest Control").arg(m_strMachineName)); 72 72 /* Translate buttons: */ 73 button(ButtonType_Close)->setText( UIGuestProcessControlWidget::tr("Close"));73 button(ButtonType_Close)->setText(tr("Close")); 74 74 } 75 75 … … 83 83 { 84 84 /* Create widget: */ 85 UIGuest ProcessControlWidget *pWidget = new UIGuestProcessControlWidget(EmbedTo_Dialog, m_comGuest, this, m_strMachineName);85 UIGuestControlConsole *pConsole = new UIGuestControlConsole(m_comGuest); 86 86 87 if (p Widget)87 if (pConsole) 88 88 { 89 89 /* Configure widget: */ 90 setWidget(p Widget);90 setWidget(pConsole); 91 91 //setWidgetMenu(pWidget->menu()); 92 92 #ifdef VBOX_WS_MAC … … 94 94 #endif 95 95 /* Add into layout: */ 96 centralWidget()->layout()->addWidget(p Widget);96 centralWidget()->layout()->addWidget(pConsole); 97 97 } 98 98 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.cpp
r77784 r77822 298 298 , m_pSplitter(0) 299 299 , m_pTreeWidget(0) 300 , m_pConsole(0)301 , m_pControlInterface(0)302 300 , m_enmEmbedding(enmEmbedding) 303 301 , m_pToolBar(0) … … 333 331 void UIGuestProcessControlWidget::prepareObjects() 334 332 { 335 m_pControlInterface = new UIGuestControlInterface(this, m_comGuest);336 337 333 /* Create layout: */ 338 334 m_pMainLayout = new QVBoxLayout(this); … … 361 357 } 362 358 363 /* Disable the CLI for now (and maybe forever): */364 #ifdef WITH_GUEST_CONTROL_CLI365 m_pConsole = new UIGuestControlConsole;366 #endif367 368 if (m_pConsole)369 {370 m_pSplitter->addWidget(m_pConsole);371 setFocusProxy(m_pConsole);372 }373 374 359 m_pSplitter->setStretchFactor(0, 2); 375 360 m_pSplitter->setStretchFactor(1, 1); … … 391 376 { 392 377 qRegisterMetaType<QVector<int> >(); 393 connect(m_pControlInterface, &UIGuestControlInterface::sigOutputString,394 this, &UIGuestProcessControlWidget::sltConsoleOutputReceived);395 if (m_pConsole)396 connect(m_pConsole, &UIGuestControlConsole::commandEntered,397 this, &UIGuestProcessControlWidget::sltConsoleCommandEntered);398 378 399 379 if (m_pTreeWidget) … … 417 397 { 418 398 updateTreeWidget(); 419 }420 421 void UIGuestProcessControlWidget::sltConsoleCommandEntered(const QString &strCommand)422 {423 if (m_pControlInterface)424 {425 m_pControlInterface->putCommand(strCommand);426 }427 }428 429 void UIGuestProcessControlWidget::sltConsoleOutputReceived(const QString &strOutput)430 {431 if (m_pConsole)432 {433 m_pConsole->putOutput(strOutput);434 }435 399 } 436 400 … … 588 552 connect(sessionTreeItem, &UIGuestSessionTreeItem::sigGuessSessionUpdated, 589 553 this, &UIGuestProcessControlWidget::sltTreeItemUpdated); 590 connect(sessionTreeItem, &UIGuestSessionTreeItem::sigGuestSessionErrorText,591 this, &UIGuestProcessControlWidget::sltGuestControlErrorText);592 }593 594 void UIGuestProcessControlWidget::sltGuestControlErrorText(QString strError)595 {596 if (m_pConsole)597 {598 m_pConsole->putOutput(strError);599 }600 554 } 601 555 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.h
r77647 r77822 66 66 67 67 void sltGuestSessionsUpdated(); 68 void sltConsoleCommandEntered(const QString &strCommand);69 void sltConsoleOutputReceived(const QString &strOutput);70 68 void sltGuestSessionRegistered(CGuestSession guestSession); 71 69 void sltGuestSessionUnregistered(CGuestSession guestSession); 72 void sltGuestControlErrorText(QString strError);73 70 void sltTreeItemUpdated(); 74 71 void sltCloseSessionOrProcess(); … … 92 89 QSplitter *m_pSplitter; 93 90 UIGuestControlTreeWidget *m_pTreeWidget; 94 UIGuestControlConsole *m_pConsole;95 UIGuestControlInterface *m_pControlInterface;96 91 const EmbedTo m_enmEmbedding; 97 92 UIToolBar *m_pToolBar; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r77584 r77822 1180 1180 connect(actionPool()->action(UIActionIndexRT_M_Debug_S_ShowLogDialog), SIGNAL(triggered()), 1181 1181 this, SLOT(sltShowLogDialog())); 1182 connect(actionPool()->action(UIActionIndexRT_M_Debug_S_GuestControlConsole), SIGNAL(triggered()), 1183 this, SLOT(sltShowGuestControlConsoleDialog())); 1182 1184 #endif /* VBOX_WITH_DEBUGGER_GUI */ 1183 1185 … … 2482 2484 } 2483 2485 2486 void UIMachineLogic::sltShowGuestControlConsoleDialog() 2487 { 2488 if (machine().isNull() || !activeMachineWindow()) 2489 return; 2490 2491 /* Create a logviewer only if we don't have one already */ 2492 if (m_pProcessControlDialog) 2493 return; 2494 2495 QIManagerDialog *pProcessControlDialog; 2496 UIGuestProcessControlDialogFactory dialogFactory(actionPool(), console().GetGuest(), machine().GetName()); 2497 dialogFactory.prepare(pProcessControlDialog, activeMachineWindow()); 2498 if (pProcessControlDialog) 2499 { 2500 m_pProcessControlDialog = pProcessControlDialog; 2501 2502 /* Show instance: */ 2503 pProcessControlDialog->show(); 2504 pProcessControlDialog->setWindowState(pProcessControlDialog->windowState() & ~Qt::WindowMinimized); 2505 pProcessControlDialog->activateWindow(); 2506 connect(pProcessControlDialog, &QIManagerDialog::sigClose, 2507 this, &UIMachineLogic::sltCloseGuestControlConsoleDialog); 2508 } 2509 } 2510 2511 void UIMachineLogic::sltCloseGuestControlConsoleDialog() 2512 { 2513 QIManagerDialog* pDialog = qobject_cast<QIManagerDialog*>(sender()); 2514 if (m_pProcessControlDialog != pDialog || !pDialog) 2515 return; 2516 2517 /* Set the m_pLogViewerDialog to NULL before closing the dialog. or we will have redundant deletes*/ 2518 m_pProcessControlDialog = 0; 2519 pDialog->close(); 2520 UIGuestProcessControlDialogFactory().cleanup(pDialog); 2521 } 2484 2522 #endif /* VBOX_WITH_DEBUGGER_GUI */ 2485 2523 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r77584 r77822 320 320 /** Handles close signal from the log viewer dialog. */ 321 321 void sltCloseLogViewerWindow(); 322 void sltShowGuestControlConsoleDialog(); 323 void sltCloseGuestControlConsoleDialog(); 322 324 #endif /* VBOX_WITH_DEBUGGER_GUI */ 323 325
Note:
See TracChangeset
for help on using the changeset viewer.