[55401] | 1 | /* $Id: UIFDCreationDialog.h 104226 2024-04-08 12:07:43Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[72815] | 3 | * VBox Qt GUI - UIFDCreationDialog class declaration.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2008-2023 Oracle and/or its affiliates.
|
---|
[25177] | 8 | *
|
---|
[96407] | 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
|
---|
[25177] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_medium_UIFDCreationDialog_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_medium_UIFDCreationDialog_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[25177] | 33 |
|
---|
[72815] | 34 | /* Qt includes: */
|
---|
| 35 | #include <QDialog>
|
---|
[74878] | 36 | #include <QUuid>
|
---|
[25177] | 37 |
|
---|
[103338] | 38 | /* COM includes: */
|
---|
[103708] | 39 | #include "CMedium.h"
|
---|
[103338] | 40 | #include "CMediumFormat.h"
|
---|
| 41 |
|
---|
[72815] | 42 | /* Forward declarations: */
|
---|
[72913] | 43 | class QCheckBox;
|
---|
| 44 | class QComboBox;
|
---|
[96828] | 45 | class QIDialogButtonBox;
|
---|
[72869] | 46 | class QLabel;
|
---|
[72815] | 47 | class UIFilePathSelector;
|
---|
[25177] | 48 |
|
---|
[90453] | 49 | /* A QDialog extension to get necessary setting from the user for floppy disk creation. */
|
---|
[104226] | 50 | class SHARED_LIBRARY_STUFF UIFDCreationDialog : public QDialog
|
---|
[72815] | 51 | {
|
---|
| 52 | Q_OBJECT;
|
---|
[25177] | 53 |
|
---|
[72815] | 54 | public:
|
---|
[25177] | 55 |
|
---|
[90453] | 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. */
|
---|
[77263] | 59 | UIFDCreationDialog(QWidget *pParent,
|
---|
| 60 | const QString &strDefaultFolder,
|
---|
| 61 | const QString &strMachineName = QString());
|
---|
[31002] | 62 |
|
---|
[90453] | 63 | /** Return the medium ID. */
|
---|
[74878] | 64 | QUuid mediumID() const;
|
---|
[72869] | 65 |
|
---|
[92588] | 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(),
|
---|
[103338] | 72 | const QString &strMachineName = QString());
|
---|
[92588] | 73 |
|
---|
[90453] | 74 | public slots:
|
---|
| 75 |
|
---|
| 76 | /** Creates the floppy disc image, asynchronously. */
|
---|
[103338] | 77 | virtual void accept() RT_OVERRIDE;
|
---|
[90453] | 78 |
|
---|
[25177] | 79 | private slots:
|
---|
| 80 |
|
---|
[90453] | 81 | /** Handles signal about @a comMedium was created. */
|
---|
| 82 | void sltHandleMediumCreated(const CMedium &comMedium);
|
---|
[91349] | 83 | void sltPathChanged(const QString &strPath);
|
---|
[104226] | 84 | /** Handles translation event. */
|
---|
| 85 | void sltRetranslateUI();
|
---|
[25177] | 86 |
|
---|
| 87 | private:
|
---|
[90453] | 88 |
|
---|
| 89 | /** Floppy disc sizes. */
|
---|
[72869] | 90 | enum FDSize
|
---|
| 91 | {
|
---|
[93161] | 92 | FDSize_2_88M,
|
---|
[72869] | 93 | FDSize_1_44M,
|
---|
| 94 | FDSize_1_2M,
|
---|
| 95 | FDSize_720K,
|
---|
| 96 | FDSize_360K
|
---|
| 97 | };
|
---|
[72913] | 98 |
|
---|
[90453] | 99 | /** Prepares all. */
|
---|
| 100 | void prepare();
|
---|
| 101 |
|
---|
| 102 | /** Returns default file-path. */
|
---|
| 103 | QString getDefaultFilePath() const;
|
---|
[91349] | 104 | /** Returns false if the file is already exists. */
|
---|
| 105 | bool checkFilePath(const QString &strPath) const;
|
---|
[90453] | 106 |
|
---|
[103338] | 107 | /** Returns a list of formats for certain @a enmDeviceType. */
|
---|
| 108 | static QVector<CMediumFormat> getFormatsForDeviceType(KDeviceType enmDeviceType);
|
---|
| 109 |
|
---|
[90453] | 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. */
|
---|
[91350] | 116 | QLabel *m_pPathLabel;
|
---|
[90453] | 117 | /** Holds the file path selector instance. */
|
---|
| 118 | UIFilePathSelector *m_pFilePathSelector;
|
---|
| 119 | /** Holds the size label instance. */
|
---|
[72869] | 120 | QLabel *m_pSizeLabel;
|
---|
[90453] | 121 | /** Holds the size combo instance. */
|
---|
[91350] | 122 | QComboBox *m_pSizeCombo;
|
---|
[90453] | 123 | /** Holds the format check-box instance. */
|
---|
[91350] | 124 | QCheckBox *m_pFormatCheckBox;
|
---|
[90453] | 125 | /** holds the button-box instance. */
|
---|
[96828] | 126 | QIDialogButtonBox *m_pButtonBox;
|
---|
[90453] | 127 |
|
---|
| 128 | /** Holds the created medium ID. */
|
---|
| 129 | QUuid m_uMediumID;
|
---|
[25177] | 130 | };
|
---|
| 131 |
|
---|
[76581] | 132 | #endif /* !FEQT_INCLUDED_SRC_medium_UIFDCreationDialog_h */
|
---|