VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlConsole.h

Last change on this file was 103803, checked in by vboxsync, 6 months ago

FE/Qt. bugref:10618. Splitting COMEnums.h file into individual enum header files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
RevLine 
[71025]1/* $Id: UIGuestControlConsole.h 103803 2024-03-12 11:15:18Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIGuestControlConsole class declaration.
4 */
5
6/*
[98103]7 * Copyright (C) 2016-2023 Oracle and/or its affiliates.
[71025]8 *
[96407]9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
[71025]26 */
27
[76581]28#ifndef FEQT_INCLUDED_SRC_guestctrl_UIGuestControlConsole_h
29#define FEQT_INCLUDED_SRC_guestctrl_UIGuestControlConsole_h
[76532]30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
[71025]33
34/* Qt includes: */
35# include <QPlainTextEdit>
36
[77822]37/* COM includes: */
38#include "CGuest.h"
39
40class UIGuestControlInterface;
[71049]41/** QPlainTextEdit extension to provide a simple terminal like widget. */
[71025]42class UIGuestControlConsole : public QPlainTextEdit
43{
44
45 Q_OBJECT;
46
47
48public:
49
[77822]50 UIGuestControlConsole(const CGuest &comGuest, QWidget* parent = 0);
[71049]51 /* @p strOutput is displayed in the console */
[71025]52 void putOutput(const QString &strOutput);
53
54protected:
55
[93990]56 void keyPressEvent(QKeyEvent *pEvent) RT_OVERRIDE;
57 void mousePressEvent(QMouseEvent *pEvent) RT_OVERRIDE;
58 void mouseDoubleClickEvent(QMouseEvent *pEvent) RT_OVERRIDE;
59 void contextMenuEvent(QContextMenuEvent *pEvent) RT_OVERRIDE;
[71025]60
61private slots:
62
[77822]63 void sltOutputReceived(const QString &strOutput);
[71025]64
65private:
[71049]66
[71025]67 typedef QVector<QString> CommandHistory;
[71145]68 typedef QMap<QString, int> TabDictionary;
69
70 void reset();
71 void startNextLine();
[71025]72 /** Return the text of the curent line */
[71145]73 QString getCommandString();
[71025]74 /** Replaces the content of the last line with m_strPromt + @p stringNewContent */
[71145]75 void replaceLineContent(const QString &stringNewContent);
[71025]76 /** Get next/prev command from history. Return @p originalString if history is empty. */
[71145]77 QString getNextCommandFromHistory(const QString &originalString = QString());
78 QString getPreviousCommandFromHistory(const QString &originalString = QString());
79 void completeByTab();
[77822]80 void commandEntered(const QString &strCommand);
81
[71145]82 /* Return a list of words that start with @p strSearch */
83 QList<QString> matchedWords(const QString &strSearch) const;
[77822]84 CGuest m_comGuest;
[71049]85 const QString m_strGreet;
86 const QString m_strPrompt;
[71145]87 TabDictionary m_tabDictinary;
[71025]88 /* A vector of entered commands */
89 CommandHistory m_tCommandHistory;
90 unsigned m_uCommandHistoryIndex;
[77822]91 UIGuestControlInterface *m_pControlInterface;
[71025]92};
93
[76581]94#endif /* !FEQT_INCLUDED_SRC_guestctrl_UIGuestControlConsole_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle
ContactPrivacy/Do Not Sell My InfoTerms of Use