1 | /* $Id: UIWizardCloneVDFormatPage.cpp 104069 2024-03-26 18:02:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizardCloneVDFormatPage 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 "UIWizardCloneVDFormatPage.h"
|
---|
33 | #include "UIWizardCloneVD.h"
|
---|
34 | #include "UIWizardDiskEditors.h"
|
---|
35 | #include "QIRichTextLabel.h"
|
---|
36 |
|
---|
37 | /* COM includes: */
|
---|
38 | #include "CSystemProperties.h"
|
---|
39 |
|
---|
40 | UIWizardCloneVDFormatPage::UIWizardCloneVDFormatPage(KDeviceType enmDeviceType)
|
---|
41 | : m_pLabel(0)
|
---|
42 | , m_pFormatGroupBox(0)
|
---|
43 | {
|
---|
44 | prepare(enmDeviceType);
|
---|
45 | }
|
---|
46 |
|
---|
47 | void UIWizardCloneVDFormatPage::prepare(KDeviceType enmDeviceType)
|
---|
48 | {
|
---|
49 | QVBoxLayout *pMainLayout = new QVBoxLayout(this);
|
---|
50 | m_pLabel = new QIRichTextLabel(this);
|
---|
51 | if (m_pLabel)
|
---|
52 | pMainLayout->addWidget(m_pLabel);
|
---|
53 | m_pFormatGroupBox = new UIDiskFormatsGroupBox(false /* expert mode */, enmDeviceType, 0);
|
---|
54 | if (m_pFormatGroupBox)
|
---|
55 | {
|
---|
56 | pMainLayout->addWidget(m_pFormatGroupBox);
|
---|
57 | connect(m_pFormatGroupBox, &UIDiskFormatsGroupBox::sigMediumFormatChanged,
|
---|
58 | this, &UIWizardCloneVDFormatPage::sltMediumFormatChanged);
|
---|
59 | }
|
---|
60 | pMainLayout->addStretch();
|
---|
61 | sltRetranslateUI();
|
---|
62 | }
|
---|
63 |
|
---|
64 | void UIWizardCloneVDFormatPage::sltRetranslateUI()
|
---|
65 | {
|
---|
66 | /* Translate page: */
|
---|
67 | setTitle(UIWizardCloneVD::tr("Virtual hard disk file type"));
|
---|
68 |
|
---|
69 | /* Translate widgets: */
|
---|
70 | m_pLabel->setText(UIWizardCloneVD::tr("Please choose the type of file that you would like to use "
|
---|
71 | "for the destination virtual disk image. If you do not need to use it "
|
---|
72 | "with other virtualization software you can leave this setting unchanged."));
|
---|
73 | }
|
---|
74 |
|
---|
75 | void UIWizardCloneVDFormatPage::initializePage()
|
---|
76 | {
|
---|
77 | AssertReturnVoid(wizardWindow<UIWizardCloneVD>());
|
---|
78 | /* Translate page: */
|
---|
79 | sltRetranslateUI();
|
---|
80 | if (!m_userModifiedParameters.contains("MediumFormat"))
|
---|
81 | {
|
---|
82 | if (m_pFormatGroupBox)
|
---|
83 | wizardWindow<UIWizardCloneVD>()->setMediumFormat(m_pFormatGroupBox->mediumFormat());
|
---|
84 | }
|
---|
85 | }
|
---|
86 |
|
---|
87 | bool UIWizardCloneVDFormatPage::isComplete() const
|
---|
88 | {
|
---|
89 | if (m_pFormatGroupBox)
|
---|
90 | {
|
---|
91 | if (m_pFormatGroupBox->mediumFormat().isNull())
|
---|
92 | return false;
|
---|
93 | }
|
---|
94 | return true;
|
---|
95 | }
|
---|
96 |
|
---|
97 | void UIWizardCloneVDFormatPage::sltMediumFormatChanged()
|
---|
98 | {
|
---|
99 | AssertReturnVoid(wizardWindow<UIWizardCloneVD>());
|
---|
100 | if (m_pFormatGroupBox)
|
---|
101 | wizardWindow<UIWizardCloneVD>()->setMediumFormat(m_pFormatGroupBox->mediumFormat());
|
---|
102 | m_userModifiedParameters << "MediumFormat";
|
---|
103 | emit completeChanged();
|
---|
104 | }
|
---|