1 | /* $Id: UIWizardNewVMPageBasicInstallSetup.h 84961 2020-06-25 18:49:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizardNewVMPageBasicInstallSetup class declaration.
|
---|
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 | #ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicInstallSetup_h
|
---|
19 | #define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicInstallSetup_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QLineEdit>
|
---|
26 | #include <QStringList>
|
---|
27 | #include <QWidget>
|
---|
28 |
|
---|
29 | /* Local includes: */
|
---|
30 | #include "QIWithRetranslateUI.h"
|
---|
31 | #include "UIWizardPage.h"
|
---|
32 |
|
---|
33 | /* Forward declarations: */
|
---|
34 | class QGridLayout;
|
---|
35 | class QLabel;
|
---|
36 | class QSpinBox;
|
---|
37 | class QIRichTextLabel;
|
---|
38 | struct UIUnattendedInstallData;
|
---|
39 |
|
---|
40 | class UIPasswordLineEdit : public QLineEdit
|
---|
41 | {
|
---|
42 | Q_OBJECT;
|
---|
43 |
|
---|
44 | signals:
|
---|
45 |
|
---|
46 | void sigTextVisibilityToggled(bool fTextVisible);
|
---|
47 |
|
---|
48 | public:
|
---|
49 |
|
---|
50 | UIPasswordLineEdit(QWidget *pParent = 0);
|
---|
51 | void toggleTextVisibility(bool fTextVisible);
|
---|
52 |
|
---|
53 | protected:
|
---|
54 |
|
---|
55 | virtual void paintEvent(QPaintEvent *pevent) /* override */;
|
---|
56 |
|
---|
57 | private:
|
---|
58 |
|
---|
59 | void prepare();
|
---|
60 |
|
---|
61 | QToolButton *m_pTextVisibilityButton;
|
---|
62 |
|
---|
63 | private slots:
|
---|
64 |
|
---|
65 | void sltHandleTextVisibilityChange();
|
---|
66 | };
|
---|
67 |
|
---|
68 | class UIUserNamePasswordEditor : public QIWithRetranslateUI<QWidget>
|
---|
69 | {
|
---|
70 |
|
---|
71 | Q_OBJECT;
|
---|
72 |
|
---|
73 | signals:
|
---|
74 |
|
---|
75 | /** this is emitted whenever the content of one of the line edits is changed. */
|
---|
76 | void sigSomeTextChanged();
|
---|
77 |
|
---|
78 | public:
|
---|
79 |
|
---|
80 | UIUserNamePasswordEditor(QWidget *pParent = 0);
|
---|
81 |
|
---|
82 | QString userName() const;
|
---|
83 | void setUserName(const QString &strUserName);
|
---|
84 |
|
---|
85 | QString password() const;
|
---|
86 | void setPassword(const QString &strPassword);
|
---|
87 |
|
---|
88 | /** Returns false if username or password fields are empty, or password fields do not match. */
|
---|
89 | bool isComplete();
|
---|
90 |
|
---|
91 | protected:
|
---|
92 |
|
---|
93 | void retranslateUi();
|
---|
94 |
|
---|
95 | private slots:
|
---|
96 |
|
---|
97 | void sltHandlePasswordVisibility(bool fPasswordVisible);
|
---|
98 |
|
---|
99 | private:
|
---|
100 |
|
---|
101 | void prepare();
|
---|
102 | template <class T>
|
---|
103 | void addLineEdit(int &iRow, QLabel *&pLabel, T *&pLineEdit, QGridLayout *pLayout);
|
---|
104 | /** Changes @p pLineEdit's base color to indicate an error or reverts it to the original color. */
|
---|
105 | void markLineEdit(QLineEdit *pLineEdit, bool fError);
|
---|
106 |
|
---|
107 | QLineEdit *m_pUserNameLineEdit;
|
---|
108 | UIPasswordLineEdit *m_pPasswordLineEdit;
|
---|
109 | UIPasswordLineEdit *m_pPasswordRepeatLineEdit;
|
---|
110 |
|
---|
111 | QLabel *m_pUserNameLabel;
|
---|
112 | QLabel *m_pPasswordLabel;
|
---|
113 | QLabel *m_pPasswordRepeatLabel;
|
---|
114 | QColor m_orginalLineEditBaseColor;
|
---|
115 | };
|
---|
116 |
|
---|
117 | /* 2nd page of the New Virtual Machine wizard (base part): */
|
---|
118 | class UIWizardNewVMPageInstallSetup : public UIWizardPageBase
|
---|
119 | {
|
---|
120 | public:
|
---|
121 |
|
---|
122 | UIWizardNewVMPageInstallSetup();
|
---|
123 |
|
---|
124 | /** @name Property getters
|
---|
125 | * @{ */
|
---|
126 | QString userName() const;
|
---|
127 | QString password() const;
|
---|
128 | QString hostname() const;
|
---|
129 | /** @} */
|
---|
130 |
|
---|
131 | protected:
|
---|
132 |
|
---|
133 | /* Widgets: */
|
---|
134 | UIUserNamePasswordEditor *m_pUserNamePasswordEditor;
|
---|
135 | QLineEdit *m_pHostnameLineEdit;
|
---|
136 | QLabel *m_pHostnameLabel;
|
---|
137 | };
|
---|
138 |
|
---|
139 | class UIWizardNewVMPageBasicInstallSetup : public UIWizardPage, public UIWizardNewVMPageInstallSetup
|
---|
140 | {
|
---|
141 | Q_OBJECT;
|
---|
142 | Q_PROPERTY(QString userName READ userName);
|
---|
143 | Q_PROPERTY(QString password READ password);
|
---|
144 | Q_PROPERTY(QString hostname READ hostname);
|
---|
145 |
|
---|
146 | public:
|
---|
147 |
|
---|
148 | /* Constructor: */
|
---|
149 | UIWizardNewVMPageBasicInstallSetup();
|
---|
150 | void setDefaultUnattendedInstallData(const UIUnattendedInstallData &unattendedInstallData);
|
---|
151 | virtual int nextId() const /* override */;
|
---|
152 |
|
---|
153 | private slots:
|
---|
154 |
|
---|
155 | private:
|
---|
156 |
|
---|
157 | /* Translation stuff: */
|
---|
158 | void retranslateUi();
|
---|
159 |
|
---|
160 | /* Prepare stuff: */
|
---|
161 | void initializePage();
|
---|
162 |
|
---|
163 | /* Validation stuff: */
|
---|
164 | bool isComplete() const;
|
---|
165 |
|
---|
166 | /* Widgets: */
|
---|
167 | QIRichTextLabel *m_pLabel;
|
---|
168 | };
|
---|
169 |
|
---|
170 | #endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicInstallSetup_h */
|
---|