VirtualBox

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

Last change on this file since 104158 was 103977, checked in by vboxsync, 9 months ago

Apply RT_OVERRIDE/NS_OVERRIDE where required to shut up clang.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.2 KB
Line 
1/* $Id: UIFileManager.h 103977 2024-03-21 02:04:52Z 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 UIFileManagerPaneContainer;
57class UIFileManagerOperationsPanel;
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 virtual void retranslateUi() RT_OVERRIDE;
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 void sltHandleHidePanel(UIDialogPanel *pPanel);
125 void sltHandleShowPanel(UIDialogPanel *pPanel);
126 void sltCommitDataSignalReceived();
127 void sltFileTableSelectionChanged(bool fHasSelection);
128 void sltCurrentTabChanged(int iIndex);
129 void sltGuestFileTableStateChanged(bool fIsRunning);
130 void sltHandleOptionsUpdated();
131 void sltPanelCurrentTabChanged(int iIndex);
132 void sltPanelContainerHidden();
133
134private:
135
136 void prepareObjects();
137 void prepareConnections();
138 void prepareVerticalToolBar(QHBoxLayout *layout);
139 void prepareToolBar();
140
141 /** Saves list of panels and file manager options to the extra data. */
142 void saveOptions();
143 /** Show the panels that have been visible the last time file manager is closed. */
144 void restorePanelVisibility();
145 /** Loads file manager options. This should be done before widget creation
146 * since some widgets are initilized with these options */
147 void loadOptions();
148 void hidePanel(UIDialogPanel *panel);
149 void showPanel(UIDialogPanel *panel);
150 /** Makes sure escape key is assigned to only a single widget. This is done by checking
151 several things in the following order:
152 - when there are no more panels visible assign it to the parent dialog
153 - grab it from the dialog as soon as a panel becomes visible again
154 - assign it to the most recently "unhidden" panel */
155 void manageEscapeShortCut();
156 void copyToGuest();
157 void copyToHost();
158 template<typename T>
159 QStringList getFsObjInfoStringList(const T &fsObjectInfo) const;
160 void appendLog(const QString &strLog, const QString &strMachineName, FileManagerLogType eLogType);
161 void savePanelVisibility();
162
163 void setMachines(const QVector<QUuid> &machineIDs, const QUuid &lastSelectedMachineId = QUuid());
164 void removeTabs(const QVector<QUuid> &machineIdsToRemove);
165 void addTabs(const QVector<QUuid> &machineIdsToAdd);
166 void setVerticalToolBarActionsEnabled();
167 UIFileManagerGuestTable *currentGuestTable();
168
169 QVBoxLayout *m_pMainLayout;
170 QSplitter *m_pVerticalSplitter;
171 /** Splitter hosting host and guest file system tables. */
172 QSplitter *m_pFileTableSplitter;
173 QIToolBar *m_pToolBar;
174 QIToolBar *m_pVerticalToolBar;
175
176 UIFileManagerHostTable *m_pHostFileTable;
177
178 QITabWidget *m_pGuestTablesContainer;
179 const EmbedTo m_enmEmbedding;
180 QPointer<UIActionPool> m_pActionPool;
181 const bool m_fShowToolbar;
182 QSet<QAction*> m_panelActions;
183 QList<UIDialogPanel*> m_visiblePanelsList;
184 UIFileManagerLogPanel *m_pLogPanel;
185 UIFileManagerOperationsPanel *m_pOperationsPanel;
186 UIFileManagerPaneContainer *m_pPanel;
187 bool m_fCommitDataSignalReceived;
188
189 QVector<QUuid> m_machineIds;
190
191 friend class UIFileManagerDialog;
192};
193
194#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