VirtualBox

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

Last change on this file since 100347 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

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