VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.h@ 84917

Last change on this file since 84917 was 84917, checked in by vboxsync, 5 years ago

FE/Qt: bugref:9515. Adding necessary validity checks for user name/password fields.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
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: */
33class QGridLayout;
34class QLabel;
35class QSpinBox;
36class QIRichTextLabel;
37struct UIUnattendedInstallData;
38
39class UIPasswordLineEdit : public QLineEdit
40{
41 Q_OBJECT;
42
43signals:
44
45 void sigTextVisibilityToggled(bool fTextVisible);
46
47public:
48
49 UIPasswordLineEdit(QWidget *pParent = 0);
50 void toggleTextVisibility(bool fTextVisible);
51
52protected:
53
54 virtual void paintEvent(QPaintEvent *pevent) /* override */;
55
56private:
57
58 void prepare();
59
60 QToolButton *m_pTextVisibilityButton;
61
62private slots:
63
64 void sltHandleTextVisibilityChange();
65};
66
67class UIUserNamePasswordEditor : public QIWithRetranslateUI<QWidget>
68{
69
70 Q_OBJECT;
71
72signals:
73
74 /** this is emitted whenever the content of one of the line edits is changed. */
75 void sigSomeTextChanged();
76
77public:
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
90protected:
91
92 void retranslateUi();
93
94private:
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
108private slots:
109
110 void sltHandlePasswordVisibility(bool fPasswordVisible);
111};
112
113/* 2nd page of the New Virtual Machine wizard (base part): */
114class UIWizardNewVMPageInstallSetup : public UIWizardPageBase
115{
116public:
117
118 UIWizardNewVMPageInstallSetup();
119
120 QString userName() const;
121 QString password() const;
122
123protected:
124
125 /* Widgets: */
126 UIUserNamePasswordEditor *m_pUserNamePasswordEditor;
127};
128
129/* 2nd page of the New Virtual Machine wizard (basic extension): */
130class UIWizardNewVMPageBasicInstallSetup : public UIWizardPage, public UIWizardNewVMPageInstallSetup
131{
132 Q_OBJECT;
133 Q_PROPERTY(QString userName READ userName);
134 Q_PROPERTY(QString password READ password);
135
136public:
137
138 /* Constructor: */
139 UIWizardNewVMPageBasicInstallSetup();
140 void setDefaultUnattendedInstallData(const UIUnattendedInstallData &unattendedInstallData);
141
142private slots:
143
144private:
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 */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette