1 | /* $Id: UINameAndSystemEditor.h 79927 2019-07-23 08:35:25Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UINameAndSystemEditor class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-2019 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 | #ifndef FEQT_INCLUDED_SRC_widgets_UINameAndSystemEditor_h
|
---|
19 | #define FEQT_INCLUDED_SRC_widgets_UINameAndSystemEditor_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QWidget>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "QIWithRetranslateUI.h"
|
---|
29 | #include "UILibraryDefs.h"
|
---|
30 |
|
---|
31 | /* COM includes: */
|
---|
32 | #include "COMEnums.h"
|
---|
33 | #include "CGuestOSType.h"
|
---|
34 |
|
---|
35 | /* Forward declarations: */
|
---|
36 | class QComboBox;
|
---|
37 | class QLabel;
|
---|
38 | class QILineEdit;
|
---|
39 | class QString;
|
---|
40 | class UIFilePathSelector;
|
---|
41 |
|
---|
42 | /** QWidget subclass providing complex editor for basic VM parameters. */
|
---|
43 | class SHARED_LIBRARY_STUFF UINameAndSystemEditor : public QIWithRetranslateUI<QWidget>
|
---|
44 | {
|
---|
45 | Q_OBJECT;
|
---|
46 | Q_PROPERTY(QString name READ name WRITE setName);
|
---|
47 | Q_PROPERTY(CGuestOSType type READ type WRITE setType);
|
---|
48 |
|
---|
49 | /** Simple struct representing CGuestOSType cache. */
|
---|
50 | struct UIGuestOSType
|
---|
51 | {
|
---|
52 | QString typeId;
|
---|
53 | QString typeDescription;
|
---|
54 | bool is64bit;
|
---|
55 | };
|
---|
56 |
|
---|
57 | signals:
|
---|
58 |
|
---|
59 | /** Notifies listeners about VM name change. */
|
---|
60 | void sigNameChanged(const QString &strNewName);
|
---|
61 | void sigPathChanged(const QString &strName);
|
---|
62 |
|
---|
63 | /** Notifies listeners about VM OS type change. */
|
---|
64 | void sigOsTypeChanged();
|
---|
65 |
|
---|
66 | public:
|
---|
67 |
|
---|
68 | /** Constructs VM parameters editor passing @a pParent to the base-class.
|
---|
69 | * @param fChooseName Controls whether we should propose to choose name.
|
---|
70 | * @param fChoosePath Controls whether we should propose to choose path.
|
---|
71 | * @param fChooseType Controls whether we should propose to choose type. */
|
---|
72 | UINameAndSystemEditor(QWidget *pParent,
|
---|
73 | bool fChooseName = true,
|
---|
74 | bool fChoosePath = false,
|
---|
75 | bool fChooseType = true);
|
---|
76 |
|
---|
77 | /** Defines the VM @a strName. */
|
---|
78 | void setName(const QString &strName);
|
---|
79 | /** Returns the VM name. */
|
---|
80 | QString name() const;
|
---|
81 |
|
---|
82 | /** Defines the VM @a strPath. */
|
---|
83 | void setPath(const QString &strPath);
|
---|
84 | /** Returns path string selected by the user. */
|
---|
85 | QString path() const;
|
---|
86 |
|
---|
87 | /** Defines the VM OS @a strTypeId and @a strFamilyId if passed. */
|
---|
88 | void setTypeId(QString strTypeId, QString strFamilyId = QString());
|
---|
89 | /** Returns the VM OS type ID. */
|
---|
90 | QString typeId() const;
|
---|
91 | /** Returns the VM OS family ID. */
|
---|
92 | QString familyId() const;
|
---|
93 |
|
---|
94 | /** Defines the VM OS @a enmType. */
|
---|
95 | void setType(const CGuestOSType &enmType);
|
---|
96 | /** Returns the VM OS type. */
|
---|
97 | CGuestOSType type() const;
|
---|
98 |
|
---|
99 | /** Defines the name-field @a strValidator. */
|
---|
100 | void setNameFieldValidator(const QString &strValidator);
|
---|
101 |
|
---|
102 | protected:
|
---|
103 |
|
---|
104 | /** Handles translation event. */
|
---|
105 | virtual void retranslateUi() /* override */;
|
---|
106 |
|
---|
107 | private slots:
|
---|
108 |
|
---|
109 | /** Handles VM OS family @a iIndex change. */
|
---|
110 | void sltFamilyChanged(int iIndex);
|
---|
111 | /** Handles VM OS type @a iIndex change. */
|
---|
112 | void sltTypeChanged(int iIndex);
|
---|
113 |
|
---|
114 | private:
|
---|
115 |
|
---|
116 | /** @name Prepare cascade.
|
---|
117 | * @{ */
|
---|
118 | /** Prepares all. */
|
---|
119 | void prepare();
|
---|
120 | /** Prepares this. */
|
---|
121 | void prepareThis();
|
---|
122 | /** Prepares widgets. */
|
---|
123 | void prepareWidgets();
|
---|
124 | /** Prepares VM OS family combo. */
|
---|
125 | void prepareFamilyCombo();
|
---|
126 | /** Prepares connections. */
|
---|
127 | void prepareConnections();
|
---|
128 | /** @} */
|
---|
129 |
|
---|
130 | /** Holds the current family ID list. */
|
---|
131 | QStringList m_familyIDs;
|
---|
132 |
|
---|
133 | /** Holds the current type cache. */
|
---|
134 | QMap<QString, QList<UIGuestOSType> > m_types;
|
---|
135 |
|
---|
136 | /** Holds the VM OS type ID. */
|
---|
137 | QString m_strTypeId;
|
---|
138 | /** Holds the VM OS family ID. */
|
---|
139 | QString m_strFamilyId;
|
---|
140 |
|
---|
141 | /** Holds the currently chosen OS type IDs on per-family basis. */
|
---|
142 | QMap<QString, QString> m_currentIds;
|
---|
143 |
|
---|
144 | /** Holds whether we should propose to choose a name. */
|
---|
145 | bool m_fChooseName;
|
---|
146 | /** Holds whether we should propose to choose a path. */
|
---|
147 | bool m_fChoosePath;
|
---|
148 | /** Holds whether we should propose to choose a type. */
|
---|
149 | bool m_fChooseType;
|
---|
150 | /** Holds whether host supports hardware virtualization. */
|
---|
151 | bool m_fSupportsHWVirtEx;
|
---|
152 | /** Holds whether host supports long mode. */
|
---|
153 | bool m_fSupportsLongMode;
|
---|
154 |
|
---|
155 | /** Holds the VM name label instance. */
|
---|
156 | QLabel *m_pNameLabel;
|
---|
157 | /** Holds the VM path label instance. */
|
---|
158 | QLabel *m_pPathLabel;
|
---|
159 | /** Holds the VM OS family label instance. */
|
---|
160 | QLabel *m_pLabelFamily;
|
---|
161 | /** Holds the VM OS type label instance. */
|
---|
162 | QLabel *m_pLabelType;
|
---|
163 | /** Holds the VM OS type icon instance. */
|
---|
164 | QLabel *m_pIconType;
|
---|
165 |
|
---|
166 | /** Holds the VM name editor instance. */
|
---|
167 | QILineEdit *m_pNameLineEdit;
|
---|
168 | /** Holds the VM path editor instance. */
|
---|
169 | UIFilePathSelector *m_pPathSelector;
|
---|
170 | /** Holds the VM OS family combo instance. */
|
---|
171 | QComboBox *m_pComboFamily;
|
---|
172 | /** Holds the VM OS type combo instance. */
|
---|
173 | QComboBox *m_pComboType;
|
---|
174 | };
|
---|
175 |
|
---|
176 | #endif /* !FEQT_INCLUDED_SRC_widgets_UINameAndSystemEditor_h */
|
---|