1 | /* $Id: UIFDCreationDialog.h 103803 2024-03-12 11:15:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIFDCreationDialog class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-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_medium_UIFDCreationDialog_h
|
---|
29 | #define FEQT_INCLUDED_SRC_medium_UIFDCreationDialog_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QDialog>
|
---|
36 | #include <QUuid>
|
---|
37 |
|
---|
38 | /* GUI Includes */
|
---|
39 | #include "QIWithRetranslateUI.h"
|
---|
40 |
|
---|
41 | /* COM includes: */
|
---|
42 | #include "CMedium.h"
|
---|
43 | #include "CMediumFormat.h"
|
---|
44 |
|
---|
45 | /* Forward declarations: */
|
---|
46 | class QCheckBox;
|
---|
47 | class QComboBox;
|
---|
48 | class QIDialogButtonBox;
|
---|
49 | class QLabel;
|
---|
50 | class UIFilePathSelector;
|
---|
51 |
|
---|
52 | /* A QDialog extension to get necessary setting from the user for floppy disk creation. */
|
---|
53 | class SHARED_LIBRARY_STUFF UIFDCreationDialog : public QIWithRetranslateUI<QDialog>
|
---|
54 | {
|
---|
55 | Q_OBJECT;
|
---|
56 |
|
---|
57 | public:
|
---|
58 |
|
---|
59 | /** Constructs the floppy disc creation dialog passing @a pParent to the base-class.
|
---|
60 | * @param strDefaultFolder Brings the default folder.
|
---|
61 | * @param strMachineName Brings the machine name. */
|
---|
62 | UIFDCreationDialog(QWidget *pParent,
|
---|
63 | const QString &strDefaultFolder,
|
---|
64 | const QString &strMachineName = QString());
|
---|
65 |
|
---|
66 | /** Return the medium ID. */
|
---|
67 | QUuid mediumID() const;
|
---|
68 |
|
---|
69 | /** Creates and shows a dialog thru which user can create a new floppy disk a VISO using the file-open dialog.
|
---|
70 | * @param parent Passes the parent of the dialog,
|
---|
71 | * @param strDefaultFolder Passes the default folder,
|
---|
72 | * @param strMachineName Passes the name of the machine,
|
---|
73 | * returns the UUID of the newly created medium if successful, a null QUuid otherwise.*/
|
---|
74 | static QUuid createFloppyDisk(QWidget *pParent, const QString &strDefaultFolder = QString(),
|
---|
75 | const QString &strMachineName = QString());
|
---|
76 |
|
---|
77 | public slots:
|
---|
78 |
|
---|
79 | /** Creates the floppy disc image, asynchronously. */
|
---|
80 | virtual void accept() RT_OVERRIDE;
|
---|
81 |
|
---|
82 | protected:
|
---|
83 |
|
---|
84 | /** Handles translation event. */
|
---|
85 | virtual void retranslateUi() RT_OVERRIDE;
|
---|
86 |
|
---|
87 | private slots:
|
---|
88 |
|
---|
89 | /** Handles signal about @a comMedium was created. */
|
---|
90 | void sltHandleMediumCreated(const CMedium &comMedium);
|
---|
91 | void sltPathChanged(const QString &strPath);
|
---|
92 |
|
---|
93 | private:
|
---|
94 |
|
---|
95 | /** Floppy disc sizes. */
|
---|
96 | enum FDSize
|
---|
97 | {
|
---|
98 | FDSize_2_88M,
|
---|
99 | FDSize_1_44M,
|
---|
100 | FDSize_1_2M,
|
---|
101 | FDSize_720K,
|
---|
102 | FDSize_360K
|
---|
103 | };
|
---|
104 |
|
---|
105 | /** Prepares all. */
|
---|
106 | void prepare();
|
---|
107 |
|
---|
108 | /** Returns default file-path. */
|
---|
109 | QString getDefaultFilePath() const;
|
---|
110 | /** Returns false if the file is already exists. */
|
---|
111 | bool checkFilePath(const QString &strPath) const;
|
---|
112 |
|
---|
113 | /** Returns a list of formats for certain @a enmDeviceType. */
|
---|
114 | static QVector<CMediumFormat> getFormatsForDeviceType(KDeviceType enmDeviceType);
|
---|
115 |
|
---|
116 | /** Holds the default folder. */
|
---|
117 | QString m_strDefaultFolder;
|
---|
118 | /** Holds the machine name. */
|
---|
119 | QString m_strMachineName;
|
---|
120 |
|
---|
121 | /** Holds the path label instance. */
|
---|
122 | QLabel *m_pPathLabel;
|
---|
123 | /** Holds the file path selector instance. */
|
---|
124 | UIFilePathSelector *m_pFilePathSelector;
|
---|
125 | /** Holds the size label instance. */
|
---|
126 | QLabel *m_pSizeLabel;
|
---|
127 | /** Holds the size combo instance. */
|
---|
128 | QComboBox *m_pSizeCombo;
|
---|
129 | /** Holds the format check-box instance. */
|
---|
130 | QCheckBox *m_pFormatCheckBox;
|
---|
131 | /** holds the button-box instance. */
|
---|
132 | QIDialogButtonBox *m_pButtonBox;
|
---|
133 |
|
---|
134 | /** Holds the created medium ID. */
|
---|
135 | QUuid m_uMediumID;
|
---|
136 | };
|
---|
137 |
|
---|
138 | #endif /* !FEQT_INCLUDED_SRC_medium_UIFDCreationDialog_h */
|
---|