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