VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIUserNamePasswordEditor.h@ 103551

Last change on this file since 103551 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/* $Id: UIUserNamePasswordEditor.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIUserNamePasswordEditor class declaration.
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_wizards_editors_UIUserNamePasswordEditor_h
29#define FEQT_INCLUDED_SRC_wizards_editors_UIUserNamePasswordEditor_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QIcon>
36#include <QLineEdit>
37#include <QWidget>
38
39/* Local includes: */
40#include "QIWithRetranslateUI.h"
41
42/* Forward declarations: */
43class QGridLayout;
44class QLabel;
45class QILineEdit;
46class QIToolButton;
47class UIMarkableLineEdit;
48class UIPasswordLineEdit;
49
50class SHARED_LIBRARY_STUFF UIPasswordLineEdit : public QLineEdit
51{
52 Q_OBJECT;
53
54signals:
55
56 void sigTextVisibilityToggled(bool fTextVisible);
57
58public:
59
60 UIPasswordLineEdit(QWidget *pParent = 0);
61 void toggleTextVisibility(bool fTextVisible);
62 void mark(bool fError, const QString &strErrorToolTip);
63
64protected:
65
66 virtual void resizeEvent(QResizeEvent *pEvent) RT_OVERRIDE;
67
68private slots:
69
70 void sltHandleTextVisibilityChange();
71
72private:
73
74 void prepare();
75 void adjustTextVisibilityButtonGeometry();
76
77 QIToolButton *m_pTextVisibilityButton;
78 QIcon m_markIcon;
79 QLabel *m_pErrorIconLabel;
80 QString m_strErrorToolTip;
81 /** When true the line edit is marked with some icon to indicate some error. */
82 bool m_fMarkForError;
83};
84
85class SHARED_LIBRARY_STUFF UIUserNamePasswordEditor : public QIWithRetranslateUI<QWidget>
86{
87
88 Q_OBJECT;
89
90signals:
91
92 void sigUserNameChanged(const QString &strUserName);
93 void sigPasswordChanged(const QString &strPassword);
94
95public:
96
97 UIUserNamePasswordEditor(QWidget *pParent = 0);
98
99 QString userName() const;
100 void setUserName(const QString &strUserName);
101
102 QString password() const;
103 void setPassword(const QString &strPassword);
104
105 /** Returns false if username or password fields are empty, or password fields do not match. */
106 bool isComplete();
107
108 /** When fEnabled true place holder texts for the line edits are shown. */
109 void setPlaceholderTextEnabled(bool fEnabled);
110 void setLabelsVisible(bool fVisible);
111
112protected:
113
114 void retranslateUi();
115
116private slots:
117
118 void sltHandlePasswordVisibility(bool fPasswordVisible);
119 void sltUserNameChanged();
120 void sltPasswordChanged();
121
122private:
123
124 void prepare();
125 template <class T>
126 void addLineEdit(int &iRow, QLabel *&pLabel, T *&pLineEdit, QGridLayout *pLayout);
127
128 bool isUserNameComplete();
129 bool isPasswordComplete();
130
131 UIMarkableLineEdit *m_pUserNameLineEdit;
132 UIPasswordLineEdit *m_pPasswordLineEdit;
133 UIPasswordLineEdit *m_pPasswordRepeatLineEdit;
134
135 QLabel *m_pUserNameLabel;
136 QLabel *m_pPasswordLabel;
137 QLabel *m_pPasswordRepeatLabel;
138
139 bool m_fShowPlaceholderText;
140 bool m_fLabelsVisible;
141
142 QString m_strPasswordError;
143};
144
145#endif /* !FEQT_INCLUDED_SRC_wizards_editors_UIUserNamePasswordEditor_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