~ubuntu-branches/ubuntu/trusty/virtualbox/trusty-proposed

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-03-07 16:38:36 UTC
  • mfrom: (1.1.13) (3.1.20 experimental)
  • Revision ID: package-import@ubuntu.com-20130307163836-p93jpbgx39tp3gb4
Tags: 4.2.8-dfsg-0ubuntu1
* New upstream release. (Closes: #691148)
  - Fixes compatibility with kernel 3.8. (Closes: #700823; LP: #1101867)
* Switch to my @debian.org email address.
* Move package to contrib as virtualbox 4.2 needs a non-free compiler to
  build the BIOS.
* Build-depend on libdevmapper-dev.
* Refresh patches.
  - Drop 36-fix-ftbfs-xserver-112.patch, cve-2012-3221.patch,
    CVE-2013-0420.patch 37-kcompat-3.6.patch and 38-kcompat-3.7.patch.
* Drop all virtualbox-ose transitional packages.
* Drop the virtualbox-fuse package as vdfuse fails to build with
  virtualbox 4.2.
* Update install files and VBox.sh.
* Bump required kbuild version to 0.1.9998svn2577.
* Fix path to VBoxCreateUSBNode.sh in virtualbox.postinst. (Closes: #700479)
* Add an init script to virtuabox-guest-x11 which loads the vboxvideo
  kernel module. The X Server 1.13 doesn't load it anymore. (Closes: #686994)
* Update man pages. (Closes: #680053)
* Add 36-python-multiarch.patch from Rico Tzschichholz to fix detection of
  python in multiarch paths using pkg-config.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: UIWizardCloneVDPageBasic3.cpp $ */
 
2
/** @file
 
3
 *
 
4
 * VBox frontends: Qt4 GUI ("VirtualBox"):
 
5
 * UIWizardCloneVDPageBasic3 class implementation
 
6
 */
 
7
 
 
8
/*
 
9
 * Copyright (C) 2006-2012 Oracle Corporation
 
10
 *
 
11
 * This file is part of VirtualBox Open Source Edition (OSE), as
 
12
 * available from http://www.virtualbox.org. This file is free software;
 
13
 * you can redistribute it and/or modify it under the terms of the GNU
 
14
 * General Public License (GPL) as published by the Free Software
 
15
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 
16
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 
17
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 
18
 */
 
19
 
 
20
/* Qt includes: */
 
21
#include <QVBoxLayout>
 
22
#include <QButtonGroup>
 
23
#include <QRadioButton>
 
24
#include <QCheckBox>
 
25
 
 
26
/* GUI includes: */
 
27
#include "UIWizardCloneVDPageBasic3.h"
 
28
#include "UIWizardCloneVD.h"
 
29
#include "QIRichTextLabel.h"
 
30
 
 
31
/* COM includes: */
 
32
#include "CMediumFormat.h"
 
33
 
 
34
UIWizardCloneVDPage3::UIWizardCloneVDPage3()
 
35
{
 
36
}
 
37
 
 
38
qulonglong UIWizardCloneVDPage3::mediumVariant() const
 
39
{
 
40
    /* Initial value: */
 
41
    qulonglong uMediumVariant = (qulonglong)KMediumVariant_Max;
 
42
 
 
43
    /* Exclusive options: */
 
44
    if (m_pDynamicalButton->isChecked())
 
45
        uMediumVariant = (qulonglong)KMediumVariant_Standard;
 
46
    else if (m_pFixedButton->isChecked())
 
47
        uMediumVariant = (qulonglong)KMediumVariant_Fixed;
 
48
 
 
49
    /* Additional options: */
 
50
    if (m_pSplitBox->isChecked())
 
51
        uMediumVariant |= (qulonglong)KMediumVariant_VmdkSplit2G;
 
52
 
 
53
    /* Return options: */
 
54
    return uMediumVariant;
 
55
}
 
56
 
 
57
void UIWizardCloneVDPage3::setMediumVariant(qulonglong uMediumVariant)
 
58
{
 
59
    /* Exclusive options: */
 
60
    if (uMediumVariant & (qulonglong)KMediumVariant_Fixed)
 
61
    {
 
62
        m_pFixedButton->click();
 
63
        m_pFixedButton->setFocus();
 
64
    }
 
65
    else
 
66
    {
 
67
        m_pDynamicalButton->click();
 
68
        m_pDynamicalButton->setFocus();
 
69
    }
 
70
 
 
71
    /* Additional options: */
 
72
    m_pSplitBox->setChecked(uMediumVariant & (qulonglong)KMediumVariant_VmdkSplit2G);
 
73
}
 
74
 
 
75
UIWizardCloneVDPageBasic3::UIWizardCloneVDPageBasic3()
 
76
{
 
77
    /* Create widgets: */
 
78
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
 
79
    {
 
80
        m_pDescriptionLabel = new QIRichTextLabel(this);
 
81
        m_pDynamicLabel = new QIRichTextLabel(this);
 
82
        m_pFixedLabel = new QIRichTextLabel(this);
 
83
        m_pSplitLabel = new QIRichTextLabel(this);
 
84
        QVBoxLayout *pVariantLayout = new QVBoxLayout;
 
85
        {
 
86
            m_pVariantButtonGroup = new QButtonGroup(this);
 
87
            {
 
88
                m_pDynamicalButton = new QRadioButton(this);
 
89
                {
 
90
                    m_pDynamicalButton->click();
 
91
                    m_pDynamicalButton->setFocus();
 
92
                }
 
93
                m_pFixedButton = new QRadioButton(this);
 
94
                m_pVariantButtonGroup->addButton(m_pDynamicalButton, 0);
 
95
                m_pVariantButtonGroup->addButton(m_pFixedButton, 1);
 
96
            }
 
97
            m_pSplitBox = new QCheckBox(this);
 
98
            pVariantLayout->addWidget(m_pDynamicalButton);
 
99
            pVariantLayout->addWidget(m_pFixedButton);
 
100
            pVariantLayout->addWidget(m_pSplitBox);
 
101
        }
 
102
        pMainLayout->addWidget(m_pDescriptionLabel);
 
103
        pMainLayout->addWidget(m_pDynamicLabel);
 
104
        pMainLayout->addWidget(m_pFixedLabel);
 
105
        pMainLayout->addWidget(m_pSplitLabel);
 
106
        pMainLayout->addLayout(pVariantLayout);
 
107
        pMainLayout->addStretch();
 
108
    }
 
109
 
 
110
    /* Setup connections: */
 
111
    connect(m_pVariantButtonGroup, SIGNAL(buttonClicked(QAbstractButton *)), this, SIGNAL(completeChanged()));
 
112
    connect(m_pSplitBox, SIGNAL(stateChanged(int)), this, SIGNAL(completeChanged()));
 
113
 
 
114
    /* Register fields: */
 
115
    registerField("mediumVariant", this, "mediumVariant");
 
116
}
 
117
 
 
118
void UIWizardCloneVDPageBasic3::retranslateUi()
 
119
{
 
120
    /* Translate page: */
 
121
    setTitle(UIWizardCloneVD::tr("Storage on physical hard drive"));
 
122
 
 
123
    /* Translate widgets: */
 
124
    m_pDescriptionLabel->setText(UIWizardCloneVD::tr("Please choose whether the new virtual hard drive file should grow as it is used "
 
125
                                                     "(dynamically allocated) or if it should be created at its maximum size (fixed size)."));
 
126
    m_pDynamicLabel->setText(UIWizardCloneVD::tr("<p>A <b>dynamically allocated</b> hard drive file will only use space "
 
127
                                                 "on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), "
 
128
                                                 "although it will not shrink again automatically when space on it is freed.</p>"));
 
129
    m_pFixedLabel->setText(UIWizardCloneVD::tr("<p>A <b>fixed size</b> hard drive file may take longer to create on some "
 
130
                                               "systems but is often faster to use.</p>"));
 
131
    m_pSplitLabel->setText(UIWizardCloneVD::tr("<p>You can also choose to <b>split</b> the hard drive file into several files "
 
132
                                               "of up to two gigabytes each. This is mainly useful if you wish to store the "
 
133
                                               "virtual machine on removable USB devices or old systems, some of which cannot "
 
134
                                               "handle very large files."));
 
135
    m_pDynamicalButton->setText(UIWizardCloneVD::tr("&Dynamically allocated"));
 
136
    m_pFixedButton->setText(UIWizardCloneVD::tr("&Fixed size"));
 
137
    m_pSplitBox->setText(UIWizardCloneVD::tr("&Split into files of less than 2GB"));
 
138
}
 
139
 
 
140
void UIWizardCloneVDPageBasic3::initializePage()
 
141
{
 
142
    /* Translate page: */
 
143
    retranslateUi();
 
144
 
 
145
    /* Setup visibility: */
 
146
    CMediumFormat mediumFormat = field("mediumFormat").value<CMediumFormat>();
 
147
    ULONG uCapabilities = mediumFormat.GetCapabilities();
 
148
    bool fIsCreateDynamicPossible = uCapabilities & KMediumFormatCapabilities_CreateDynamic;
 
149
    bool fIsCreateFixedPossible = uCapabilities & KMediumFormatCapabilities_CreateFixed;
 
150
    bool fIsCreateSplitPossible = uCapabilities & KMediumFormatCapabilities_CreateSplit2G;
 
151
    m_pDynamicLabel->setHidden(!fIsCreateDynamicPossible);
 
152
    m_pDynamicalButton->setHidden(!fIsCreateDynamicPossible);
 
153
    m_pFixedLabel->setHidden(!fIsCreateFixedPossible);
 
154
    m_pFixedButton->setHidden(!fIsCreateFixedPossible);
 
155
    m_pSplitLabel->setHidden(!fIsCreateSplitPossible);
 
156
    m_pSplitBox->setHidden(!fIsCreateSplitPossible);
 
157
}
 
158
 
 
159
bool UIWizardCloneVDPageBasic3::isComplete() const
 
160
{
 
161
    /* Make sure medium variant is correct: */
 
162
    return mediumVariant() != (qulonglong)KMediumVariant_Max;
 
163
}
 
164