VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h@ 104586

Last change on this file since 104586 was 104297, checked in by vboxsync, 7 months ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in the guest control related GUI classes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1/* $Id: UIFileManager.h 104297 2024-04-11 13:20:43Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIFileManager 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_UIFileManager_h
29#define FEQT_INCLUDED_SRC_guestctrl_UIFileManager_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QPointer>
36#include <QWidget>
37#include <QString>
38#include <QUuid>
39
40/* GUI includes: */
41#include "QIManagerDialog.h"
42#include "UIGuestControlDefs.h"
43
44
45/* Forward declarations: */
46class CMachine;
47class CProgress;
48class QHBoxLayout;
49class QSplitter;
50class QTextEdit;
51class QVBoxLayout;
52class UIActionPool;
53class UIDialogPanel;
54class UIFileManagerLogPanel;
55class UIFileManagerPaneContainer;
56class UIFileManagerOperationsPanel;
57class UIFileManagerGuestTable;
58class UIFileManagerHostTable;
59class UIVirtualMachineItem;
60class QITabWidget;
61class QIToolBar;
62
63/** A Utility class to manage file manager options. */
64class UIFileManagerOptions
65{
66
67public:
68
69 static UIFileManagerOptions* instance();
70 static void create();
71 static void destroy();
72
73 bool fListDirectoriesOnTop;
74 bool fAskDeleteConfirmation;
75 bool fShowHumanReadableSizes;
76 bool fShowHiddenObjects;
77
78private:
79
80 UIFileManagerOptions();
81 ~UIFileManagerOptions();
82
83 static UIFileManagerOptions *m_pInstance;
84};
85
86/** A QWidget extension. it includes a QWidget extension for initiating a guest session
87 * one host and one guest file table views, a log viewer
88 * and some other file manager related widgets. */
89class SHARED_LIBRARY_STUFF UIFileManager : public QWidget
90{
91 Q_OBJECT;
92
93signals:
94
95 void sigSetCloseButtonShortCut(QKeySequence);
96
97public:
98
99 UIFileManager(EmbedTo enmEmbedding, UIActionPool *pActionPool,
100 const CMachine &comMachine, QWidget *pParent, bool fShowToolbar);
101 ~UIFileManager();
102 QMenu *menu() const;
103
104#ifdef VBOX_WS_MAC
105 /** Returns the toolbar. */
106 QIToolBar *toolbar() const { return m_pToolBar; }
107#endif
108
109 void setSelectedVMListItems(const QList<UIVirtualMachineItem*> &items);
110
111private slots:
112
113 void sltReceieveLogOutput(QString strOutput, const QString &strMachineName, FileManagerLogType eLogType);
114 void sltCopyGuestToHost();
115 void sltCopyHostToGuest();
116 void sltPanelActionToggled(bool fChecked);
117 void sltReceieveNewFileOperation(const CProgress &comProgress, const QString &strTableName);
118 void sltFileOperationComplete(QUuid progressId);
119 void sltHandleHidePanel(UIDialogPanel *pPanel);
120 void sltHandleShowPanel(UIDialogPanel *pPanel);
121 void sltCommitDataSignalReceived();
122 void sltFileTableSelectionChanged(bool fHasSelection);
123 void sltCurrentTabChanged(int iIndex);
124 void sltGuestFileTableStateChanged(bool fIsRunning);
125 void sltHandleOptionsUpdated();
126 void sltPanelCurrentTabChanged(int iIndex);
127 void sltPanelContainerHidden();
128
129private:
130
131 void prepareObjects();
132 void prepareConnections();
133 void prepareVerticalToolBar(QHBoxLayout *layout);
134 void prepareToolBar();
135
136 /** Saves list of panels and file manager options to the extra data. */
137 void saveOptions();
138 /** Show the panels that have been visible the last time file manager is closed. */
139 void restorePanelVisibility();
140 /** Loads file manager options. This should be done before widget creation
141 * since some widgets are initilized with these options */
142 void loadOptions();
143 void hidePanel(UIDialogPanel *panel);
144 void showPanel(UIDialogPanel *panel);
145 /** Makes sure escape key is assigned to only a single widget. This is done by checking
146 several things in the following order:
147 - when there are no more panels visible assign it to the parent dialog
148 - grab it from the dialog as soon as a panel becomes visible again
149 - assign it to the most recently "unhidden" panel */
150 void manageEscapeShortCut();
151 void copyToGuest();
152 void copyToHost();
153 template<typename T>
154 QStringList getFsObjInfoStringList(const T &fsObjectInfo) const;
155 void appendLog(const QString &strLog, const QString &strMachineName, FileManagerLogType eLogType);
156 void savePanelVisibility();
157
158 void setMachines(const QVector<QUuid> &machineIDs, const QUuid &lastSelectedMachineId = QUuid());
159 void removeTabs(const QVector<QUuid> &machineIdsToRemove);
160 void addTabs(const QVector<QUuid> &machineIdsToAdd);
161 void setVerticalToolBarActionsEnabled();
162 UIFileManagerGuestTable *currentGuestTable();
163
164 QVBoxLayout *m_pMainLayout;
165 QSplitter *m_pVerticalSplitter;
166 /** Splitter hosting host and guest file system tables. */
167 QSplitter *m_pFileTableSplitter;
168 QIToolBar *m_pToolBar;
169 QIToolBar *m_pVerticalToolBar;
170
171 UIFileManagerHostTable *m_pHostFileTable;
172
173 QITabWidget *m_pGuestTablesContainer;
174 const EmbedTo m_enmEmbedding;
175 QPointer<UIActionPool> m_pActionPool;
176 const bool m_fShowToolbar;
177 QSet<QAction*> m_panelActions;
178 QList<UIDialogPanel*> m_visiblePanelsList;
179 UIFileManagerLogPanel *m_pLogPanel;
180 UIFileManagerOperationsPanel *m_pOperationsPanel;
181 UIFileManagerPaneContainer *m_pPanel;
182 bool m_fCommitDataSignalReceived;
183
184 QVector<QUuid> m_machineIds;
185
186 friend class UIFileManagerDialog;
187};
188
189#endif /* !FEQT_INCLUDED_SRC_guestctrl_UIFileManager_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