summaryrefslogtreecommitdiff
path: root/raveos-calamares-module/raveusers
diff options
context:
space:
mode:
Diffstat (limited to 'raveos-calamares-module/raveusers')
-rw-r--r--raveos-calamares-module/raveusers/RaveUsersBackend.cpp18
-rw-r--r--raveos-calamares-module/raveusers/RaveUsersBackend.h5
-rw-r--r--raveos-calamares-module/raveusers/RaveUsersJobs.cpp8
-rw-r--r--raveos-calamares-module/raveusers/RaveUsersViewStep.cpp48
-rw-r--r--raveos-calamares-module/raveusers/RaveUsersViewStep.h1
-rw-r--r--raveos-calamares-module/raveusers/ui/PasswordField.qml34
-rw-r--r--raveos-calamares-module/raveusers/ui/Translations.qml4
-rw-r--r--raveos-calamares-module/raveusers/ui/raveusers.qml126
8 files changed, 171 insertions, 73 deletions
diff --git a/raveos-calamares-module/raveusers/RaveUsersBackend.cpp b/raveos-calamares-module/raveusers/RaveUsersBackend.cpp
index 6f8eea6..538732f 100644
--- a/raveos-calamares-module/raveusers/RaveUsersBackend.cpp
+++ b/raveos-calamares-module/raveusers/RaveUsersBackend.cpp
@@ -75,7 +75,7 @@ RaveUsersBackend::hostnameStatus() const
QString
RaveUsersBackend::passwordStatus() const
{
- if ( m_password.isEmpty() )
+ if ( m_password.isEmpty() || m_passwordSecondary.isEmpty() )
{
return QString();
}
@@ -93,7 +93,7 @@ RaveUsersBackend::rootPasswordStatus() const
{
return QString();
}
- if ( m_rootPassword.isEmpty() )
+ if ( m_rootPassword.isEmpty() || m_rootPasswordSecondary.isEmpty() )
{
return QString();
}
@@ -115,13 +115,13 @@ RaveUsersBackend::isReady() const
{
return false;
}
- if ( m_password.isEmpty() || !passwordStatus().isEmpty() )
+ if ( m_password.isEmpty() || m_password != m_passwordSecondary )
{
return false;
}
if ( m_setRootPassword && !m_reuseRootPassword )
{
- if ( m_rootPassword.isEmpty() || !rootPasswordStatus().isEmpty() )
+ if ( m_rootPassword.isEmpty() || m_rootPassword != m_rootPasswordSecondary )
{
return false;
}
@@ -231,6 +231,16 @@ RaveUsersBackend::setReuseRootPassword( bool b )
}
void
+RaveUsersBackend::setAutoLogin( bool b )
+{
+ if ( b != m_autoLogin )
+ {
+ m_autoLogin = b;
+ emit autoLoginChanged();
+ }
+}
+
+void
RaveUsersBackend::checkReady()
{
const bool ready = isReady();
diff --git a/raveos-calamares-module/raveusers/RaveUsersBackend.h b/raveos-calamares-module/raveusers/RaveUsersBackend.h
index 4e06f47..06a6fad 100644
--- a/raveos-calamares-module/raveusers/RaveUsersBackend.h
+++ b/raveos-calamares-module/raveusers/RaveUsersBackend.h
@@ -17,6 +17,7 @@ class RaveUsersBackend : public QObject
Q_PROPERTY( bool ready READ isReady NOTIFY readyChanged )
Q_PROPERTY( bool reuseRootPassword READ reuseRootPassword NOTIFY reuseRootPasswordChanged )
Q_PROPERTY( bool rootReuseVisible READ rootReuseVisible CONSTANT )
+ Q_PROPERTY( bool autoLogin READ autoLogin NOTIFY autoLoginChanged )
public:
explicit RaveUsersBackend( QObject* parent = nullptr );
@@ -29,6 +30,7 @@ public:
QString rootPasswordStatus() const;
bool isReady() const;
bool reuseRootPassword() const { return m_reuseRootPassword; }
+ bool autoLogin() const { return m_autoLogin; }
bool rootReuseVisible() const { return m_setRootPassword; }
QString userPassword() const { return m_password; }
@@ -48,6 +50,7 @@ public:
Q_INVOKABLE void setRootPasswordText( const QString& s );
Q_INVOKABLE void setRootPasswordSecondaryText( const QString& s );
Q_INVOKABLE void setReuseRootPassword( bool b );
+ Q_INVOKABLE void setAutoLogin( bool b );
void setForbiddenLoginNames( const QStringList& names ) { m_forbiddenLoginNames = names; }
void setForbiddenHostNames( const QStringList& names ) { m_forbiddenHostNames = names; }
@@ -64,6 +67,7 @@ signals:
void statusChanged();
void readyChanged();
void reuseRootPasswordChanged();
+ void autoLoginChanged();
private:
void checkReady();
@@ -76,6 +80,7 @@ private:
QString m_rootPasswordSecondary;
bool m_customHostname = false;
bool m_reuseRootPassword = true;
+ bool m_autoLogin = false;
bool m_setRootPassword = true;
QStringList m_forbiddenLoginNames;
diff --git a/raveos-calamares-module/raveusers/RaveUsersJobs.cpp b/raveos-calamares-module/raveusers/RaveUsersJobs.cpp
index 1923c38..18af3e7 100644
--- a/raveos-calamares-module/raveusers/RaveUsersJobs.cpp
+++ b/raveos-calamares-module/raveusers/RaveUsersJobs.cpp
@@ -38,7 +38,7 @@ RaveUsersCreateUserJob::prettyName() const
QString
RaveUsersCreateUserJob::prettyStatusMessage() const
{
- return tr( "Creating user %1…", "@status" ).arg( m_backend->username() );
+ return tr( "Creating user %1...", "@status" ).arg( m_backend->username() );
}
Calamares::JobResult
@@ -106,7 +106,7 @@ RaveUsersSetPasswordJob::prettyName() const
QString
RaveUsersSetPasswordJob::prettyStatusMessage() const
{
- return tr( "Setting password for user %1…", "@status" ).arg( m_userName );
+ return tr( "Setting password for user %1...", "@status" ).arg( m_userName );
}
static QString
@@ -210,7 +210,7 @@ RaveUsersSetupSudoJob::RaveUsersSetupSudoJob( const QString& group, bool configu
QString
RaveUsersSetupSudoJob::prettyName() const
{
- return tr( "Configuring sudo users…", "@status" );
+ return tr( "Configuring sudo users...", "@status" );
}
Calamares::JobResult
@@ -250,7 +250,7 @@ RaveUsersSetupGroupsJob::RaveUsersSetupGroupsJob( const QStringList& groups )
QString
RaveUsersSetupGroupsJob::prettyName() const
{
- return tr( "Preparing groups…", "@status" );
+ return tr( "Preparing groups...", "@status" );
}
Calamares::JobResult
diff --git a/raveos-calamares-module/raveusers/RaveUsersViewStep.cpp b/raveos-calamares-module/raveusers/RaveUsersViewStep.cpp
index 4014429..fbcd765 100644
--- a/raveos-calamares-module/raveusers/RaveUsersViewStep.cpp
+++ b/raveos-calamares-module/raveusers/RaveUsersViewStep.cpp
@@ -52,6 +52,44 @@ RaveUsersViewStep::prettyName() const
return tr( "User" );
}
+QString
+RaveUsersViewStep::prettyStatus() const
+{
+ if ( !m_backend || m_backend->username().isEmpty() )
+ {
+ return QString();
+ }
+ const QString locale = getLocale();
+ QString userLabel = QStringLiteral( "User" );
+ QString hostLabel = QStringLiteral( "Computer name" );
+ QString autoLabel = QStringLiteral( "Automatic login" );
+ QString yes = QStringLiteral( "yes" );
+ QString no = QStringLiteral( "no" );
+ if ( locale.startsWith( QLatin1String( "hu" ) ) )
+ {
+ userLabel = QStringLiteral( "Felhasználó" );
+ hostLabel = QStringLiteral( "Gép neve" );
+ autoLabel = QStringLiteral( "Automatikus bejelentkezés" );
+ yes = QStringLiteral( "igen" );
+ no = QStringLiteral( "nem" );
+ }
+ else if ( locale.startsWith( QLatin1String( "de" ) ) )
+ {
+ userLabel = QStringLiteral( "Benutzer" );
+ hostLabel = QStringLiteral( "Computername" );
+ autoLabel = QStringLiteral( "Automatische Anmeldung" );
+ yes = QStringLiteral( "ja" );
+ no = QStringLiteral( "nein" );
+ }
+ return QStringLiteral( "%1: <b>%2</b><br/>%3: <b>%4</b><br/>%5: <b>%6</b>" )
+ .arg( userLabel,
+ m_backend->username().toHtmlEscaped(),
+ hostLabel,
+ m_backend->hostname().toHtmlEscaped(),
+ autoLabel,
+ m_backend->autoLogin() ? yes : no );
+}
+
void
RaveUsersViewStep::buildWidget()
{
@@ -62,7 +100,7 @@ RaveUsersViewStep::buildWidget()
m_quickWidget = new QQuickWidget();
m_quickWidget->setResizeMode( QQuickWidget::SizeRootObjectToView );
- m_quickWidget->setClearColor( QColor( 0x40, 0x40, 0x40 ) );
+ m_quickWidget->setClearColor( QColor( 0x1a, 0x1b, 0x1d ) );
QString modulePath = QStringLiteral( "/usr/lib/calamares/modules/raveusers/ui" );
if ( !QDir( modulePath ).exists() )
@@ -189,6 +227,14 @@ RaveUsersViewStep::onLeave()
gs->insert( "password", Calamares::String::obscure( m_backend->userPassword() ) );
gs->insert( "setRootPassword", m_backend->rootReuseVisible() );
gs->insert( "reuseRootPassword", m_backend->reuseRootPassword() );
+ if ( m_backend->autoLogin() )
+ {
+ gs->insert( "autoLoginUser", username );
+ }
+ else
+ {
+ gs->remove( "autoLoginUser" );
+ }
}
void
diff --git a/raveos-calamares-module/raveusers/RaveUsersViewStep.h b/raveos-calamares-module/raveusers/RaveUsersViewStep.h
index 67593ac..ed096cc 100644
--- a/raveos-calamares-module/raveusers/RaveUsersViewStep.h
+++ b/raveos-calamares-module/raveusers/RaveUsersViewStep.h
@@ -21,6 +21,7 @@ public:
~RaveUsersViewStep() override;
QString prettyName() const override;
+ QString prettyStatus() const override;
QWidget* widget() override;
bool isNextEnabled() const override;
diff --git a/raveos-calamares-module/raveusers/ui/PasswordField.qml b/raveos-calamares-module/raveusers/ui/PasswordField.qml
index 0dffb49..7c9955b 100644
--- a/raveos-calamares-module/raveusers/ui/PasswordField.qml
+++ b/raveos-calamares-module/raveusers/ui/PasswordField.qml
@@ -10,24 +10,38 @@ TextField {
leftPadding: 14
rightPadding: 46
echoMode: reveal ? TextInput.Normal : TextInput.Password
- color: "#ffffff"
- placeholderTextColor: "#5b6270"
+ color: "#e8e8e6"
+ placeholderTextColor: "#9a9ca1"
font.pixelSize: 15
background: Rectangle {
- radius: 7
- color: "#303030"
- border.color: field.activeFocus ? "#3d7839" : "#303030"
+ color: "#232427"
+ border.color: field.activeFocus ? "#62a052" : "#44464b"
border.width: field.activeFocus ? 1.5 : 1
}
- Text {
- text: "\uD83D\uDC41"
- font.pixelSize: 16
- color: field.reveal ? "#3d7839" : "#9ca3af"
+ Canvas {
+ width: 20
+ height: 20
anchors.right: parent.right
- anchors.rightMargin: 14
+ anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
+ property bool aktiv: field.reveal
+ onAktivChanged: requestPaint()
+ onPaint: {
+ var c = getContext("2d")
+ c.reset()
+ c.strokeStyle = aktiv ? "#62a052" : "#9a9ca1"
+ c.lineWidth = 1.8
+ c.beginPath()
+ c.moveTo(2, 10)
+ c.quadraticCurveTo(10, 2, 18, 10)
+ c.quadraticCurveTo(10, 18, 2, 10)
+ c.stroke()
+ c.beginPath()
+ c.arc(10, 10, 2.8, 0, 2 * Math.PI)
+ c.stroke()
+ }
}
MouseArea {
diff --git a/raveos-calamares-module/raveusers/ui/Translations.qml b/raveos-calamares-module/raveusers/ui/Translations.qml
index cb267b4..ef2bb67 100644
--- a/raveos-calamares-module/raveusers/ui/Translations.qml
+++ b/raveos-calamares-module/raveusers/ui/Translations.qml
@@ -12,6 +12,7 @@ QtObject {
property string passwordPlaceholder: "Password"
property string passwordConfirmLabel: "Confirm password"
property string reuseRootLabel: "Use the same password for the administrator (root)"
+ property string autoLoginLabel: "Log in automatically without a password"
property string rootPasswordLabel: "Root password"
property string rootPasswordPlaceholder: "Root password"
property string rootPasswordConfirmLabel: "Confirm root password"
@@ -26,6 +27,7 @@ QtObject {
passwordPlaceholder = "Jelszó"
passwordConfirmLabel = "Jelszó megerősítése"
reuseRootLabel = "Ugyanaz a jelszó az adminisztrátorhoz (root)"
+ autoLoginLabel = "Automatikus bejelentkezés jelszó nélkül"
rootPasswordLabel = "Root jelszó"
rootPasswordPlaceholder = "Root jelszó"
rootPasswordConfirmLabel = "Root jelszó megerősítése"
@@ -38,6 +40,7 @@ QtObject {
passwordPlaceholder = "Passwort"
passwordConfirmLabel = "Passwort bestätigen"
reuseRootLabel = "Dasselbe Passwort für den Administrator (root)"
+ autoLoginLabel = "Automatisch ohne Passwort anmelden"
rootPasswordLabel = "Root-Passwort"
rootPasswordPlaceholder = "Root-Passwort"
rootPasswordConfirmLabel = "Root-Passwort bestätigen"
@@ -50,6 +53,7 @@ QtObject {
passwordPlaceholder = "Password"
passwordConfirmLabel = "Confirm password"
reuseRootLabel = "Use the same password for the administrator (root)"
+ autoLoginLabel = "Log in automatically without a password"
rootPasswordLabel = "Root password"
rootPasswordPlaceholder = "Root password"
rootPasswordConfirmLabel = "Confirm root password"
diff --git a/raveos-calamares-module/raveusers/ui/raveusers.qml b/raveos-calamares-module/raveusers/ui/raveusers.qml
index 25e090f..030f3f4 100644
--- a/raveos-calamares-module/raveusers/ui/raveusers.qml
+++ b/raveos-calamares-module/raveusers/ui/raveusers.qml
@@ -5,18 +5,16 @@ import "." as RaveUsersModule
Rectangle {
id: root
- color: "#2B2B2B"
- radius: 14
+ color: "#1a1b1d"
- readonly property color cCardBg: "#20232a"
- readonly property color cCardBorder: "#333947"
- readonly property color cInputBg: "#303030"
- readonly property color cInputBorder: "#303030"
- readonly property color cAccentGreen: "#3d7839"
- readonly property color cTextWhite: "#ffffff"
- readonly property color cTextMuted: "#8b93a3"
- readonly property color cTextFaint: "#5b6270"
- readonly property color cErrorRed: "#ff6b6b"
+ readonly property color cCardBorder: "#34363a"
+ readonly property color cInputBg: "#232427"
+ readonly property color cInputBorder: "#44464b"
+ readonly property color cAccentGreen: "#62a052"
+ readonly property color cTextWhite: "#e8e8e6"
+ readonly property color cTextMuted: "#b7b9bd"
+ readonly property color cTextFaint: "#9a9ca1"
+ readonly property color cErrorRed: "#d9a441"
property bool showUserPassword: false
property bool showRootPassword: false
@@ -29,20 +27,64 @@ Rectangle {
RaveUsersModule.Translations.setLanguage(systemLocale)
}
+ component RegiJelolo: CheckBox {
+ id: jelolo
+
+ indicator: Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+ x: jelolo.leftPadding
+ y: parent.height / 2 - height / 2
+ color: jelolo.checked ? cAccentGreen : cInputBg
+ border.color: jelolo.checked ? cAccentGreen : cInputBorder
+ border.width: 1
+
+ Canvas {
+ anchors.fill: parent
+ visible: jelolo.checked
+ onVisibleChanged: if (visible) requestPaint()
+ onPaint: {
+ var c = getContext("2d")
+ c.reset()
+ c.strokeStyle = "#1a1b1d"
+ c.lineWidth = 2.5
+ c.beginPath()
+ c.moveTo(5, 10)
+ c.lineTo(9, 14)
+ c.lineTo(15, 6)
+ c.stroke()
+ }
+ }
+ }
+
+ contentItem: Text {
+ text: jelolo.text
+ color: cTextWhite
+ font.pixelSize: 14
+ verticalAlignment: Text.AlignVCenter
+ leftPadding: jelolo.indicator.width + 12
+ }
+ }
+
ColumnLayout {
anchors.fill: parent
anchors.margins: 40
spacing: 0
- Item {
+ Flickable {
+ id: gorgeto
Layout.fillWidth: true
Layout.fillHeight: true
+ contentHeight: tartalom.implicitHeight + 20
+ clip: true
+ boundsBehavior: Flickable.StopAtBounds
+ ScrollBar.vertical: ScrollBar {}
ColumnLayout {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: parent.top
- anchors.topMargin: 10
- width: Math.min(parent.width - 40, 540)
+ id: tartalom
+ x: (gorgeto.width - width) / 2
+ y: 10
+ width: Math.min(gorgeto.width - 40, 540)
spacing: 16
Image {
@@ -81,7 +123,7 @@ Rectangle {
Text {
text: RaveUsersModule.Translations.usernameLabel
- color: "#c7ccd6"
+ color: cTextMuted
font.pixelSize: 14
font.weight: Font.Medium
}
@@ -95,10 +137,9 @@ Rectangle {
text: backend.username
placeholderText: "raveuser"
color: cTextWhite
- placeholderTextColor: "#5b6270"
+ placeholderTextColor: cTextFaint
font.pixelSize: 15
background: Rectangle {
- radius: 7
color: cInputBg
border.color: usernameField.activeFocus ? cAccentGreen : cInputBorder
border.width: usernameField.activeFocus ? 1.5 : 1
@@ -120,7 +161,7 @@ Rectangle {
Text {
text: RaveUsersModule.Translations.hostnameLabel
- color: "#c7ccd6"
+ color: cTextMuted
font.pixelSize: 14
font.weight: Font.Medium
}
@@ -134,10 +175,9 @@ Rectangle {
text: backend.hostname
placeholderText: "raveos-pc"
color: cTextWhite
- placeholderTextColor: "#5b6270"
+ placeholderTextColor: cTextFaint
font.pixelSize: 15
background: Rectangle {
- radius: 7
color: cInputBg
border.color: hostnameField.activeFocus ? cAccentGreen : cInputBorder
border.width: hostnameField.activeFocus ? 1.5 : 1
@@ -159,7 +199,7 @@ Rectangle {
Text {
text: RaveUsersModule.Translations.passwordLabel
- color: "#c7ccd6"
+ color: cTextMuted
font.pixelSize: 14
font.weight: Font.Medium
}
@@ -202,41 +242,19 @@ Rectangle {
opacity: 0.6
}
- CheckBox {
- id: reuseRootCheck
+ RegiJelolo {
+ Layout.fillWidth: true
+ text: RaveUsersModule.Translations.autoLoginLabel
+ checked: backend.autoLogin
+ onToggled: backend.setAutoLogin(checked)
+ }
+
+ RegiJelolo {
Layout.fillWidth: true
visible: backend.rootReuseVisible
text: RaveUsersModule.Translations.reuseRootLabel
checked: backend.reuseRootPassword
onToggled: backend.setReuseRootPassword(checked)
-
- indicator: Rectangle {
- implicitWidth: 20
- implicitHeight: 20
- x: reuseRootCheck.leftPadding
- y: parent.height / 2 - height / 2
- radius: 4
- color: reuseRootCheck.checked ? cAccentGreen : cInputBg
- border.color: reuseRootCheck.checked ? cAccentGreen : cInputBorder
- border.width: 1
-
- Text {
- anchors.centerIn: parent
- text: "\u2713"
- font.pixelSize: 14
- font.bold: true
- color: "#0f1713"
- visible: reuseRootCheck.checked
- }
- }
-
- contentItem: Text {
- text: reuseRootCheck.text
- color: "#d7dbe2"
- font.pixelSize: 14
- verticalAlignment: Text.AlignVCenter
- leftPadding: reuseRootCheck.indicator.width + 12
- }
}
ColumnLayout {
@@ -246,7 +264,7 @@ Rectangle {
Text {
text: RaveUsersModule.Translations.rootPasswordLabel
- color: "#c7ccd6"
+ color: cTextMuted
font.pixelSize: 14
font.weight: Font.Medium
Layout.topMargin: 4