VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlInterface.h@ 103977

Last change on this file since 103977 was 103803, checked in by vboxsync, 9 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.8 KB
Line 
1/* $Id: UIGuestControlInterface.h 103803 2024-03-12 11:15:18Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIGuestControlInterface class declaration.
4 */
5
6/*
7 * Copyright (C) 2016-2023 Oracle and/or its affiliates.
8 *
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
26 */
27
28#ifndef FEQT_INCLUDED_SRC_guestctrl_UIGuestControlInterface_h
29#define FEQT_INCLUDED_SRC_guestctrl_UIGuestControlInterface_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34
35/* Qt includes: */
36#include <QObject>
37#include <QMap>
38
39/* COM includes: */
40#include "CGuest.h"
41#include "KFsObjType.h"
42
43class UIGuestControlSubCommandBase;
44class CommandData;
45
46/** UIGuestControlInterface parses a command string and issues API calls
47 accordingly to achive guest control related operations */
48class UIGuestControlInterface : public QObject
49{
50
51 Q_OBJECT;
52
53signals:
54
55 void sigOutputString(const QString &strOutput);
56
57public:
58
59 UIGuestControlInterface(QObject *parent, const CGuest &comGeust);
60 ~UIGuestControlInterface();
61
62 /** Receives a command string */
63 void putCommand(const QString &strCommand);
64
65 /** @name Some utility functions
66 * @{ */
67 /** Pass a non-const ref since for some reason CGuest::GetAdditionsStatus
68 is non-const?! */
69 static bool isGuestAdditionsAvailable(const CGuest &guest, const char *pszMinimumVersion);
70 static QString getFsObjTypeString(KFsObjType type);
71 /** @} */
72
73private slots:
74
75private:
76
77 typedef bool (UIGuestControlInterface::*HandleFuncPtr)(int, char**);
78
79 /** findOrCreateSession parses command options and determines if an existing session
80 to be returned or a new one to be created */
81 bool findOrCreateSession(const CommandData &commandData, CGuestSession &outGuestSession);
82 /** Search a valid gurst session among existing ones, assign @p outGuestSession if found and return true */
83 bool findAValidGuestSession(CGuestSession &outGuestSession);
84 bool findSession(const QString& strSessionName, CGuestSession& outSession);
85 bool findSession(ULONG strSessionId, CGuestSession& outSession);
86 bool createSession(const CommandData &commandData, CGuestSession &outSession);
87
88 void prepareSubCommandHandlers();
89 bool startProcess(const CommandData &commandData, CGuestSession &guestSession);
90 bool createDirectory(const CommandData &commandData, CGuestSession &guestSession);
91
92 /** Handles the 'start' process command */
93 bool handleStart(int, char**);
94 /* Handles the 'help' process command */
95 bool handleHelp(int, char**);
96 /** Handles the 'create' session command */
97 bool handleCreateSession(int, char**);
98 /** Handles the 'mkdir' session command to create guest directories */
99 bool handleMkdir(int, char**);
100 bool handleStat(int, char**);
101 /** Handles the list command and lists all the guest sessions and processes. */
102 bool handleList(int, char**);
103 template<typename T>
104 QString getFsObjInfoString(const T &fsObjectInfo) const;
105
106 CGuest m_comGuest;
107 const QString m_strHelp;
108 QString m_strStatus;
109 /** A map of function pointers to handleXXXX functions */
110 QMap<QString, HandleFuncPtr> m_subCommandHandlers;
111};
112
113#endif /* !FEQT_INCLUDED_SRC_guestctrl_UIGuestControlInterface_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