1 | /* $Id: UIWizardNewVDFileTypePage.cpp 104069 2024-03-26 18:02:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizardNewVDFileTypePage class implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-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 | /* Qt includes: */
|
---|
29 | #include <QVBoxLayout>
|
---|
30 |
|
---|
31 | /* GUI includes: */
|
---|
32 | #include "UIWizardDiskEditors.h"
|
---|
33 | #include "UIWizardNewVDFileTypePage.h"
|
---|
34 | #include "UIWizardNewVD.h"
|
---|
35 | #include "QIRichTextLabel.h"
|
---|
36 |
|
---|
37 | UIWizardNewVDFileTypePage::UIWizardNewVDFileTypePage()
|
---|
38 | : m_pLabel(0)
|
---|
39 | , m_pFormatButtonGroup(0)
|
---|
40 | {
|
---|
41 | prepare();
|
---|
42 | }
|
---|
43 |
|
---|
44 | void UIWizardNewVDFileTypePage::prepare()
|
---|
45 | {
|
---|
46 | QVBoxLayout *pMainLayout = new QVBoxLayout(this);
|
---|
47 | m_pLabel = new QIRichTextLabel(this);
|
---|
48 | pMainLayout->addWidget(m_pLabel);
|
---|
49 | m_pFormatButtonGroup = new UIDiskFormatsGroupBox(false, KDeviceType_HardDisk, 0);
|
---|
50 | pMainLayout->addWidget(m_pFormatButtonGroup, false);
|
---|
51 |
|
---|
52 | pMainLayout->addStretch();
|
---|
53 | connect(m_pFormatButtonGroup, &UIDiskFormatsGroupBox::sigMediumFormatChanged,
|
---|
54 | this, &UIWizardNewVDFileTypePage::sltMediumFormatChanged);
|
---|
55 | sltRetranslateUI();
|
---|
56 | }
|
---|
57 |
|
---|
58 | void UIWizardNewVDFileTypePage::sltMediumFormatChanged()
|
---|
59 | {
|
---|
60 | AssertReturnVoid(m_pFormatButtonGroup);
|
---|
61 | wizardWindow<UIWizardNewVD>()->setMediumFormat(m_pFormatButtonGroup->mediumFormat());
|
---|
62 | emit completeChanged();
|
---|
63 | }
|
---|
64 |
|
---|
65 | void UIWizardNewVDFileTypePage::sltRetranslateUI()
|
---|
66 | {
|
---|
67 | setTitle(UIWizardNewVD::tr("Virtual hard disk file type"));
|
---|
68 | m_pLabel->setText(UIWizardNewVD::tr("Please choose the type of file that you would like to use "
|
---|
69 | "for the new virtual hard disk. If you do not need to use it "
|
---|
70 | "with other virtualization software you can leave this setting unchanged."));
|
---|
71 | }
|
---|
72 |
|
---|
73 | void UIWizardNewVDFileTypePage::initializePage()
|
---|
74 | {
|
---|
75 | AssertReturnVoid(wizardWindow<UIWizardNewVD>());
|
---|
76 | sltRetranslateUI();
|
---|
77 | if (m_pFormatButtonGroup)
|
---|
78 | wizardWindow<UIWizardNewVD>()->setMediumFormat(m_pFormatButtonGroup->mediumFormat());
|
---|
79 | }
|
---|
80 |
|
---|
81 | bool UIWizardNewVDFileTypePage::isComplete() const
|
---|
82 | {
|
---|
83 | UIWizardNewVD *pWizard = wizardWindow<UIWizardNewVD>();
|
---|
84 | if (pWizard && !pWizard->mediumFormat().isNull())
|
---|
85 | return true;
|
---|
86 | return false;
|
---|
87 | }
|
---|