[users] Refactor constants
This commit is contained in:
parent
9cd1ef93bd
commit
8232ca626c
@ -45,6 +45,12 @@
|
||||
#include <QRegExp>
|
||||
#include <QRegExpValidator>
|
||||
|
||||
static const QRegExp USERNAME_RX( "^[a-z_][a-z0-9_-]*[$]?$" );
|
||||
static const QRegExp HOSTNAME_RX( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" );
|
||||
static constexpr const int USERNAME_MAX_LENGTH = 31;
|
||||
static constexpr const int HOSTNAME_MIN_LENGTH = 2;
|
||||
static constexpr const int HOSTNAME_MAX_LENGTH = 63;
|
||||
|
||||
/** Add an error message and pixmap to a label. */
|
||||
static inline void
|
||||
labelError( QLabel* pix, QLabel* label, const QString& message )
|
||||
@ -299,8 +305,7 @@ void
|
||||
UsersPage::validateUsernameText( const QString& textRef )
|
||||
{
|
||||
QString text( textRef );
|
||||
QRegExp rx( USERNAME_RX );
|
||||
QRegExpValidator val( rx );
|
||||
QRegExpValidator val( USERNAME_RX );
|
||||
int pos = -1;
|
||||
|
||||
if ( text.isEmpty() )
|
||||
@ -344,8 +349,7 @@ void
|
||||
UsersPage::validateHostnameText( const QString& textRef )
|
||||
{
|
||||
QString text = textRef;
|
||||
QRegExp rx( HOSTNAME_RX );
|
||||
QRegExpValidator val( rx );
|
||||
QRegExpValidator val( HOSTNAME_RX );
|
||||
int pos = -1;
|
||||
|
||||
if ( text.isEmpty() )
|
||||
|
@ -79,12 +79,6 @@ private:
|
||||
|
||||
PasswordCheckList m_passwordChecks;
|
||||
|
||||
const QRegExp USERNAME_RX = QRegExp( "^[a-z_][a-z0-9_-]*[$]?$" );
|
||||
const QRegExp HOSTNAME_RX = QRegExp( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" );
|
||||
const int USERNAME_MAX_LENGTH = 31;
|
||||
const int HOSTNAME_MIN_LENGTH = 2;
|
||||
const int HOSTNAME_MAX_LENGTH = 63;
|
||||
|
||||
bool m_readyFullName;
|
||||
bool m_readyUsername;
|
||||
bool m_customUsername;
|
||||
|
Loading…
Reference in New Issue
Block a user