VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDVariantPage.cpp

Last change on this file was 103957, checked in by vboxsync, 2 months ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in wizard page class hierarchy.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: UIWizardCloneVDVariantPage.cpp 103957 2024-03-20 13:41:59Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIWizardCloneVDVariantPage 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 "UIWizardCloneVDVariantPage.h"
34#include "UIWizardCloneVD.h"
35#include "QIRichTextLabel.h"
36
37/* COM includes: */
38#include "CMediumFormat.h"
39
40UIWizardCloneVDVariantPage::UIWizardCloneVDVariantPage()
41 : m_pDescriptionLabel(0)
42 , m_pDynamicLabel(0)
43 , m_pFixedLabel(0)
44 , m_pSplitLabel(0)
45 , m_pVariantWidget(0)
46{
47 prepare();
48}
49
50void UIWizardCloneVDVariantPage::prepare()
51{
52 QVBoxLayout *pMainLayout = new QVBoxLayout(this);
53
54 m_pDescriptionLabel = new QIRichTextLabel(this);
55 if (m_pDescriptionLabel)
56 pMainLayout->addWidget(m_pDescriptionLabel);
57
58 m_pDynamicLabel = new QIRichTextLabel(this);
59 if (m_pDynamicLabel)
60 pMainLayout->addWidget(m_pDynamicLabel);
61
62 m_pFixedLabel = new QIRichTextLabel(this);
63 if (m_pFixedLabel)
64 pMainLayout->addWidget(m_pFixedLabel);
65
66 m_pSplitLabel = new QIRichTextLabel(this);
67 if (m_pSplitLabel)
68 pMainLayout->addWidget(m_pSplitLabel);
69
70 m_pVariantWidget = new UIDiskVariantWidget(0);
71 if (m_pVariantWidget)
72 {
73 pMainLayout->addWidget(m_pVariantWidget);
74 connect(m_pVariantWidget, &UIDiskVariantWidget::sigMediumVariantChanged,
75 this, &UIWizardCloneVDVariantPage::sltMediumVariantChanged);
76
77 }
78 sltRetranslateUI();
79}
80
81
82void UIWizardCloneVDVariantPage::sltRetranslateUI()
83{
84 /* Translate page: */
85 setTitle(UIWizardCloneVD::tr("Storage on physical hard disk"));
86
87 /* Translate widgets: */
88 m_pDescriptionLabel->setText(UIWizardCloneVD::tr("Please choose whether the new virtual disk image file should grow as it is used "
89 "(dynamically allocated) or if it should be created at its maximum size (fixed size)."));
90 m_pDynamicLabel->setText(UIWizardCloneVD::tr("<p>A <b>dynamically allocated</b> disk image file will only use space "
91 "on your physical hard disk as it fills up (up to a maximum <b>fixed size</b>), "
92 "although it will not shrink again automatically when space on it is freed.</p>"));
93 m_pFixedLabel->setText(UIWizardCloneVD::tr("<p>A <b>fixed size</b> disk image file may take longer to create on some "
94 "systems but is often faster to use.</p>"));
95 m_pSplitLabel->setText(UIWizardCloneVD::tr("<p>You can also choose to <b>split</b> the disk image file into several files "
96 "of up to two gigabytes each. This is mainly useful if you wish to store the "
97 "virtual machine on removable USB devices or old systems, some of which cannot "
98 "handle very large files."));
99}
100
101void UIWizardCloneVDVariantPage::initializePage()
102{
103 AssertReturnVoid(wizardWindow<UIWizardCloneVD>());
104 /* Translate page: */
105 sltRetranslateUI();
106
107 setWidgetVisibility(wizardWindow<UIWizardCloneVD>()->mediumFormat());
108 if (m_pVariantWidget)
109 wizardWindow<UIWizardCloneVD>()->setMediumVariant(m_pVariantWidget->mediumVariant());
110}
111
112bool UIWizardCloneVDVariantPage::isComplete() const
113{
114 AssertReturn(m_pVariantWidget, false);
115 return m_pVariantWidget->isComplete();
116}
117
118void UIWizardCloneVDVariantPage::setWidgetVisibility(const CMediumFormat &mediumFormat)
119{
120 AssertReturnVoid(m_pVariantWidget);
121
122 m_pVariantWidget->updateMediumVariantWidgetsAfterFormatChange(mediumFormat);
123
124 if (m_pDynamicLabel)
125 m_pDynamicLabel->setHidden(!m_pVariantWidget->isCreateDynamicPossible());
126 if (m_pFixedLabel)
127 m_pFixedLabel->setHidden(!m_pVariantWidget->isCreateFixedPossible());
128 if (m_pSplitLabel)
129 m_pSplitLabel->setHidden(!m_pVariantWidget->isCreateSplitPossible());
130}
131
132void UIWizardCloneVDVariantPage::sltMediumVariantChanged(qulonglong uVariant)
133{
134 if (wizardWindow<UIWizardCloneVD>())
135 wizardWindow<UIWizardCloneVD>()->setMediumVariant(uVariant);
136}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use