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