summaryrefslogtreecommitdiff
path: root/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.h
blob: aaa0b2607e846728f08664522f2dcf40f116246f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* $Id$ */
/** @file
 * VBox Qt GUI - UIWizardCloneVMPageBasic1 class declaration.
 */

/*
 * Copyright (C) 2011-2020 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef FEQT_INCLUDED_SRC_wizards_clonevm_UIWizardCloneVMPageBasic1_h
#define FEQT_INCLUDED_SRC_wizards_clonevm_UIWizardCloneVMPageBasic1_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif

/* Local includes: */
#include "UIWizardPage.h"

/* Forward declarations: */
class QILineEdit;
class QCheckBox;
class QComboBox;
class QGridLayout;
class QLabel;
class QIRichTextLabel;
class UIFilePathSelector;

/** MAC address policies. */
enum MACAddressClonePolicy
{
    MACAddressClonePolicy_KeepAllMACs,
    MACAddressClonePolicy_KeepNATMACs,
    MACAddressClonePolicy_StripAllMACs,
    MACAddressClonePolicy_MAX
};
Q_DECLARE_METATYPE(MACAddressClonePolicy);

/* 1st page of the Clone Virtual Machine wizard (base part): */
class UIWizardCloneVMPage1 : public UIWizardPageBase
{
protected:

    UIWizardCloneVMPage1(const QString &strOriginalName, const QString &strDefaultPath, const QString &strGroup);

    QString cloneName() const;
    void    setCloneName(const QString &strName);

    QString clonePath() const;
    void     setClonePath(const QString &strName);

    QString cloneFilePath() const;
    void setCloneFilePath(const QString &path);

    /** calls CVirtualBox::ComposeMachineFilename(...) and sets related member variables */
    void composeCloneFilePath();
    /** Populates MAC address policies. */
    void populateMACAddressClonePolicies();

    /** Updates MAC address policy combo tool-tips. */
    void updateMACAddressClonePolicyComboToolTip();
    /** Returns MAC address clone policy. */
    MACAddressClonePolicy macAddressClonePolicy() const;
    /** Defines @a enmMACAddressClonePolicy. */
    void setMACAddressClonePolicy(MACAddressClonePolicy enmMACAddressClonePolicy);

    bool keepDiskNames() const;
    void setKeepDiskNames(bool fKeepDiskNames);

    bool keepHWUUIDs() const;
    void setKeepHWUUIDs(bool bKeepHWUUIDs);

    QString      m_strOriginalName;
    QString      m_strDefaultPath;
    QString      m_strGroup;
    /** Full, non-native path of the clone machines setting file. Generated by CVirtualBox::ComposeMachineFilename(...) */
    QString      m_strCloneFilePath;
    /** The full path of the folder where clone machine's settings file is located.
     * Generated from the m_strCloneFilePath by removing base file name */
    QString      m_strCloneFolder;
    QILineEdit  *m_pNameLineEdit;
    UIFilePathSelector *m_pPathSelector;
    QLabel      *m_pNameLabel;
    QLabel      *m_pPathLabel;
    QLabel      *m_pMACComboBoxLabel;
    QComboBox   *m_pMACComboBox;
    QCheckBox   *m_pKeepDiskNamesCheckBox;
    QCheckBox   *m_pKeepHWUUIDsCheckBox;
};

/* 1st page of the Clone Virtual Machine wizard (basic extension): */
class UIWizardCloneVMPageBasic1 : public UIWizardPage, public UIWizardCloneVMPage1
{
    Q_OBJECT;
    Q_PROPERTY(QString cloneName READ cloneName WRITE setCloneName);
    Q_PROPERTY(QString cloneFilePath READ cloneFilePath WRITE setCloneFilePath);
    Q_PROPERTY(MACAddressClonePolicy macAddressClonePolicy READ macAddressClonePolicy WRITE setMACAddressClonePolicy);
    Q_PROPERTY(bool keepDiskNames READ keepDiskNames WRITE setKeepDiskNames);
    Q_PROPERTY(bool keepHWUUIDs READ keepHWUUIDs WRITE setKeepHWUUIDs);


public:

    UIWizardCloneVMPageBasic1(const QString &strOriginalName, const QString &strDefaultPath, const QString &strGroup);

private slots:

    void sltNameChanged();
    void sltPathChanged();
    /** Handles change in MAC address policy combo-box. */
    void sltHandleMACAddressClonePolicyComboChange();

private:

    void retranslateUi();
    void initializePage();

    /* Validation stuff: */
    bool isComplete() const;

    QIRichTextLabel *m_pMainLabel;
    QGridLayout     *m_pContainerLayout;
    QLabel          *m_pAdditionalOptionsLabel;
};

#endif /* !FEQT_INCLUDED_SRC_wizards_clonevm_UIWizardCloneVMPageBasic1_h */