VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp@ 90356

Last change on this file since 90356 was 90356, checked in by vboxsync, 4 years ago

FE/Qt: bugref:9996. started refactoring new disk wizard. it is totally broken now.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: UIWizardNewVD.cpp 90356 2021-07-27 14:06:35Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIWizardNewVD class implementation.
4 */
5
6/*
7 * Copyright (C) 2006-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/* Qt includes: */
19#include <QVariant>
20#include <QPushButton>
21
22/* GUI includes: */
23#include "UICommon.h"
24#include "UIMedium.h"
25#include "UIMessageCenter.h"
26#include "UINotificationCenter.h"
27#include "UIWizardNewVD.h"
28#include "UIWizardNewVDPageFileType.h"
29#include "UIWizardNewVDPageVariant.h"
30#include "UIWizardNewVDPageSizeLocation.h"
31#include "UIWizardNewVDPageExpert.h"
32
33/* COM includes: */
34#include "CMediumFormat.h"
35
36
37UIWizardNewVD::UIWizardNewVD(QWidget *pParent,
38 const QString &strDefaultName,
39 const QString &strDefaultPath,
40 qulonglong uDefaultSize,
41 WizardMode mode)
42 : UINativeWizard(pParent, WizardType_NewVD, mode)
43 , m_strDefaultName(strDefaultName)
44 , m_strDefaultPath(strDefaultPath)
45 , m_uDefaultSize(uDefaultSize)
46{
47#ifndef VBOX_WS_MAC
48 /* Assign watermark: */
49 setPixmapName(":/wizard_new_harddisk.png");
50#else /* VBOX_WS_MAC */
51 /* Assign background image: */
52 setPixmapName(":/wizard_new_harddisk_bg.png");
53#endif /* VBOX_WS_MAC */
54}
55
56void UIWizardNewVD::populatePages()
57{
58 switch (mode())
59 {
60 case WizardMode_Basic:
61 case WizardMode_Expert:
62 {
63 addPage(new UIWizardNewVDPageFileType);
64 addPage(new UIWizardNewVDPageVariant);
65 break;
66 }
67
68 // {
69 // //addPage(new UIWizardNewVMPageExpert);
70 // break;
71 // }
72 default:
73 {
74 AssertMsgFailed(("Invalid mode: %d", mode()));
75 break;
76 }
77 }
78}
79
80bool UIWizardNewVD::createVirtualDisk()
81{
82 /* Gather attributes: */
83 // const CMediumFormat comMediumFormat = field("mediumFormat").value<CMediumFormat>();
84 // const qulonglong uVariant = field("mediumVariant").toULongLong();
85 // const QString strMediumPath = field("mediumPath").toString();
86 // const qulonglong uSize = field("mediumSize").toULongLong();
87 // /* Check attributes: */
88 // AssertReturn(!strMediumPath.isNull(), false);
89 // AssertReturn(uSize > 0, false);
90
91 // /* Get VBox object: */
92 // CVirtualBox comVBox = uiCommon().virtualBox();
93
94 // /* Create new virtual disk image: */
95 // CMedium comVirtualDisk = comVBox.CreateMedium(comMediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, KDeviceType_HardDisk);
96 // if (!comVBox.isOk())
97 // {
98 // msgCenter().cannotCreateMediumStorage(comVBox, strMediumPath, this);
99 // return false;
100 // }
101
102 // /* Compose medium-variant: */
103 // QVector<KMediumVariant> variants(sizeof(qulonglong) * 8);
104 // for (int i = 0; i < variants.size(); ++i)
105 // {
106 // qulonglong temp = uVariant;
107 // temp &= Q_UINT64_C(1) << i;
108 // variants[i] = (KMediumVariant)temp;
109 // }
110
111 // /* Copy medium: */
112 // UINotificationProgressMediumCreate *pNotification = new UINotificationProgressMediumCreate(comVirtualDisk,
113 // uSize,
114 // variants);
115 // connect(pNotification, &UINotificationProgressMediumCreate::sigMediumCreated,
116 // &uiCommon(), &UICommon::sltHandleMediumCreated);
117 // notificationCenter().append(pNotification);
118
119 /* Positive: */
120 return true;
121}
122
123void UIWizardNewVD::retranslateUi()
124{
125 UINativeWizard::retranslateUi();
126 setWindowTitle(tr("Create Virtual Hard Disk"));
127}
128
129void UIWizardNewVD::prepare()
130{
131 // /* Create corresponding pages: */
132 // switch (mode())
133 // {
134 // case WizardMode_Basic:
135 // {
136 // setPage(Page1, new UIWizardNewVDPageFileType);
137 // setPage(Page2, new UIWizardNewVDPageVariant);
138 // setPage(Page3, new UIWizardNewVDPageSizeLocation(m_strDefaultName, m_strDefaultPath, m_uDefaultSize));
139 // break;
140 // }
141 // case WizardMode_Expert:
142 // {
143 // setPage(PageExpert, new UIWizardNewVDPageExpert(m_strDefaultName, m_strDefaultPath, m_uDefaultSize));
144 // break;
145 // }
146 // default:
147 // {
148 // AssertMsgFailed(("Invalid mode: %d", mode()));
149 // break;
150 // }
151 // }
152
153}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette