VirtualBox

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

Last change on this file since 98103 was 98103, checked in by vboxsync, 21 months ago

Copyright year updates by scm.

  • 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 98103 2023-01-17 14:15:46Z 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 "COMEnums.h"
39#include "CGuest.h"
40
41class UIGuestControlInterface;
[71049]42/** QPlainTextEdit extension to provide a simple terminal like widget. */
[71025]43class UIGuestControlConsole : public QPlainTextEdit
44{
45
46 Q_OBJECT;
47
48
49public:
50
[77822]51 UIGuestControlConsole(const CGuest &comGuest, QWidget* parent = 0);
[71049]52 /* @p strOutput is displayed in the console */
[71025]53 void putOutput(const QString &strOutput);
54
55protected:
56
[93990]57 void keyPressEvent(QKeyEvent *pEvent) RT_OVERRIDE;
58 void mousePressEvent(QMouseEvent *pEvent) RT_OVERRIDE;
59 void mouseDoubleClickEvent(QMouseEvent *pEvent) RT_OVERRIDE;
60 void contextMenuEvent(QContextMenuEvent *pEvent) RT_OVERRIDE;
[71025]61
62private slots:
63
[77822]64 void sltOutputReceived(const QString &strOutput);
[71025]65
66private:
[71049]67
[71025]68 typedef QVector<QString> CommandHistory;
[71145]69 typedef QMap<QString, int> TabDictionary;
70
71 void reset();
72 void startNextLine();
[71025]73 /** Return the text of the curent line */
[71145]74 QString getCommandString();
[71025]75 /** Replaces the content of the last line with m_strPromt + @p stringNewContent */
[71145]76 void replaceLineContent(const QString &stringNewContent);
[71025]77 /** Get next/prev command from history. Return @p originalString if history is empty. */
[71145]78 QString getNextCommandFromHistory(const QString &originalString = QString());
79 QString getPreviousCommandFromHistory(const QString &originalString = QString());
80 void completeByTab();
[77822]81 void commandEntered(const QString &strCommand);
82
[71145]83 /* Return a list of words that start with @p strSearch */
84 QList<QString> matchedWords(const QString &strSearch) const;
[77822]85 CGuest m_comGuest;
[71049]86 const QString m_strGreet;
87 const QString m_strPrompt;
[71145]88 TabDictionary m_tabDictinary;
[71025]89 /* A vector of entered commands */
90 CommandHistory m_tCommandHistory;
91 unsigned m_uCommandHistoryIndex;
[77822]92 UIGuestControlInterface *m_pControlInterface;
[71025]93};
94
[76581]95#endif /* !FEQT_INCLUDED_SRC_guestctrl_UIGuestControlConsole_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette