1 | /* $Id: UIWizardNewVMPageBasic1.cpp 40870 2012-04-11 15:44:29Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
5 | * UIWizardNewVMPageBasic1 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 | /* Global includes: */
|
---|
21 | #include <QVBoxLayout>
|
---|
22 |
|
---|
23 | /* Local includes: */
|
---|
24 | #include "UIWizardNewVMPageBasic1.h"
|
---|
25 | #include "UIWizardNewVM.h"
|
---|
26 | #include "UIIconPool.h"
|
---|
27 | #include "QIRichTextLabel.h"
|
---|
28 |
|
---|
29 | UIWizardNewVMPageBasic1::UIWizardNewVMPageBasic1()
|
---|
30 | {
|
---|
31 | /* Create widgets: */
|
---|
32 | QVBoxLayout *pMainLayout = new QVBoxLayout(this);
|
---|
33 | m_pLabel1 = new QIRichTextLabel(this);
|
---|
34 | /* Register 'message-box warning-icon' image in m_pLabel1 as 'image': */
|
---|
35 | QSize wSize(64, 64);
|
---|
36 | QPixmap wPixmap = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon).pixmap(wSize);
|
---|
37 | if (wPixmap.width() != wSize.width())
|
---|
38 | wPixmap = wPixmap.scaled(wSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
---|
39 | QImage wImage = wPixmap.toImage();
|
---|
40 | m_pLabel1->registerImage(wImage, "image");
|
---|
41 | m_pLabel2 = new QIRichTextLabel(this);
|
---|
42 | pMainLayout->addWidget(m_pLabel1);
|
---|
43 | pMainLayout->addWidget(m_pLabel2);
|
---|
44 | pMainLayout->addStretch();
|
---|
45 | }
|
---|
46 |
|
---|
47 | void UIWizardNewVMPageBasic1::retranslateUi()
|
---|
48 | {
|
---|
49 | /* Translate page: */
|
---|
50 | setTitle(UIWizardNewVM::tr("Welcome to the New Virtual Machine Wizard!"));
|
---|
51 |
|
---|
52 | /* Translate widgets: */
|
---|
53 | m_pLabel1->setText(tableTemplate().arg("<b>STOP!</b> Before continuing, please understand what you are doing. "
|
---|
54 | "Computer system virtualization involves complex concepts, "
|
---|
55 | "which no user interface can hide. Please make sure that you have read "
|
---|
56 | "the first section of the user manual before continuing "
|
---|
57 | "or seeking out online assistance!"));
|
---|
58 | m_pLabel2->setText(UIWizardNewVM::tr("<p>This wizard will guide you through the steps that are necessary "
|
---|
59 | "to create a new virtual machine for VirtualBox.</p><p>%1</p>").arg(standardHelpText()));
|
---|
60 | }
|
---|
61 |
|
---|
62 | void UIWizardNewVMPageBasic1::initializePage()
|
---|
63 | {
|
---|
64 | /* Translate page: */
|
---|
65 | retranslateUi();
|
---|
66 | }
|
---|
67 |
|
---|
68 | /* static */
|
---|
69 | QString UIWizardNewVMPageBasic1::tableTemplate()
|
---|
70 | {
|
---|
71 | /* Prepare table template: */
|
---|
72 | QString strTable("<table cellspacing=0 cellpadding=0>%1</table>");
|
---|
73 | QString strTableRow("<tr>%1</tr>");
|
---|
74 | QString strTableData("<td>%1</td>");
|
---|
75 | QString strTableDataCentered("<td valign=middle>%1</td>");
|
---|
76 | QString strImage("<img src=\"image\"/>");
|
---|
77 | QString strSpacing(" ");
|
---|
78 | QString strTableDataImage(strTableDataCentered.arg(strImage));
|
---|
79 | QString strTableDataSpacing(strTableData.arg(strSpacing));
|
---|
80 | return strTable.arg(strTableRow.arg(strTableDataImage + strTableDataSpacing + strTableData));
|
---|
81 | }
|
---|
82 |
|
---|