Added sound notification for login failure and custom font for the login

gui
This commit is contained in:
2024-12-03 19:29:10 +01:00
parent 7157176b5b
commit 6e91637792
20 changed files with 34141 additions and 28 deletions

1
.gitignore vendored
View File

@@ -227,3 +227,4 @@ cython_debug/
.directory .directory
rc_*.py

View File

@@ -6,31 +6,72 @@ import QtQuick.Layouts
Item Item
{ {
anchors.fill: parent anchors.fill: parent
ColumnLayout ColumnLayout
{ {
anchors.fill: parent anchors.fill: parent
FontLoader
{
id: helloStranger
source: "qrc:/fonts/HelloStranger.otf"
}
FontLoader
{
id: damarWulan
source: "qrc:/fonts/Damarwulan.ttf"
}
FontLoader
{
id: hussarPrint
source: "qrc:/fonts/HussarPrintA.otf"
}
FontLoader
{
id: reginaldScript
source: "qrc:/fonts/ReginaldScript.ttf"
}
Item Item
{ {
height: 150 height: 65
} }
Label Label
{ {
text: qsTr ("Login") text: qsTr ("Login")
font.pixelSize: 49 font.family: helloStranger.font.family
font.weight: helloStranger.font.weight
font.styleName: helloStranger.font.styleName
font.pixelSize: 89
font.bold: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
Item
{
height: 25
}
RowLayout RowLayout
{ {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
spacing: 15 spacing: 15
Label Label
{ {
text: qsTr ("Benutzername") text: qsTr ("Benutzername")
minimumPixelSize: 20 minimumPixelSize: 20
Layout.preferredWidth: 150 Layout.preferredWidth: 150
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.family: damarWulan.font.family
font.weight: damarWulan.font.weight
font.styleName: damarWulan.font.styleName
font.pixelSize: 21
} }
TextField TextField
@@ -38,6 +79,7 @@ Item
id: benutzerName id: benutzerName
placeholderText: qsTr ("Benutzernamen eingeben") placeholderText: qsTr ("Benutzernamen eingeben")
implicitWidth: 300 implicitWidth: 300
font: hussarPrint.font
} }
} }
@@ -45,12 +87,16 @@ Item
{ {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
spacing: 15 spacing: 15
Label Label
{ {
minimumPixelSize: 20 minimumPixelSize: 20
Layout.preferredWidth: 150 Layout.preferredWidth: 150
text: qsTr ("Passwort") text: qsTr ("Passwort")
font.family: damarWulan.font.family
font.weight: damarWulan.font.weight
font.styleName: damarWulan.font.styleName
font.pixelSize: 21
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
} }
@@ -59,17 +105,21 @@ Item
id: passwort id: passwort
placeholderText: qsTr ("Passwort eingeben") placeholderText: qsTr ("Passwort eingeben")
implicitWidth: 300 implicitWidth: 300
font: hussarPrint.font
echoMode: TextInput.Password echoMode: TextInput.Password
} }
} }
RowLayout RowLayout
{ {
Layout.preferredWidth: 465 Layout.preferredWidth: 465
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Button Button
{ {
text: qsTr ("Feierabend für heute!") text: qsTr ("Feierabend für heute!")
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
font: reginaldScript.font
onClicked: onClicked:
{ {
if (benutzerName.text.trim() && passwort.text.trim()) if (benutzerName.text.trim() && passwort.text.trim())
@@ -84,10 +134,12 @@ Item
} }
} }
Component.onCompleted: Component.onCompleted:
{ {
loggedin_user.loginOkay.connect(loggedin) loggedin_user.loginOkay.connect(loggedin)
} }
function loggedin() function loggedin()
{ {
appLoader.source = "Dashboard.qml" appLoader.source = "Dashboard.qml"

BIN
fonts/BeautifulPeople.ttf Normal file

Binary file not shown.

BIN
fonts/Damarwulan.ttf Normal file

Binary file not shown.

BIN
fonts/HelloStranger.otf Normal file

Binary file not shown.

BIN
fonts/HussarPrintA.otf Normal file

Binary file not shown.

Binary file not shown.

BIN
fonts/ReginaldScript.ttf Normal file

Binary file not shown.

View File

@@ -1,10 +1,9 @@
from .DbManager import DbManager from .DbManager import DbManager
from ..PyqcrmFlags import PyqcrmFlags from ..PyqcrmFlags import PyqcrmFlags
from ..Vermasseln import Vermasseln from ..Vermasseln import Vermasseln
import mariadb from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
from .UserDAO import UserDAO from .UserDAO import UserDAO
from PySide6.QtCore import Slot, QObject, Signal from PySide6.QtCore import Slot, QObject, Signal, QUrl
class UserManager(QObject): class UserManager(QObject):
@@ -53,11 +52,18 @@ class UserManager(QObject):
user = UserDAO().getUser(username) user = UserDAO().getUser(username)
if user: if user:
self.__checkPassword(password, user[2]) self.__checkPassword(password, user[2])
else:
player = QMediaPlayer(self)
audioOutput = QAudioOutput(self)
player.setAudioOutput(audioOutput)
player.setSource(QUrl("qrc:/sounds/fail2c.ogg"))
audioOutput.setVolume(150)
player.play()
def __checkPassword(self, password, hash_password): def __checkPassword(self, password, hash_password):
pwList = hash_password.split("$") pw_list = hash_password.split("$")
hash_Pw = Vermasseln.userPasswordHash(password, pwList[0]) hash_pw = Vermasseln.userPasswordHash(password, pw_list[0])
if hash_password == hash_Pw: if hash_password == hash_pw:
self.loginOkay.emit() self.loginOkay.emit()

View File

@@ -7,5 +7,15 @@
<file>images/filter.svg</file> <file>images/filter.svg</file>
<file>images/menu.svg</file> <file>images/menu.svg</file>
<file>images/search.svg</file> <file>images/search.svg</file>
<file>sounds/error.ogg</file>
<file>sounds/fail2c.ogg</file>
<file>sounds/puzzerr.ogg</file>
<file>sounds/sysnotify.ogg</file>
<file>sounds/wrong.ogg</file>
<file>fonts/Damarwulan.ttf</file>
<file>fonts/HelloStranger.otf</file>
<file>fonts/HussarPrintA.otf</file>
<file>fonts/LittleBirdsRegular.ttf</file>
<file>fonts/ReginaldScript.ttf</file>
</qresource> </qresource>
</RCC> </RCC>

34080
rc_pyqcrm.py

File diff suppressed because it is too large Load Diff

BIN
sounds/error.aac Normal file

Binary file not shown.

BIN
sounds/error.ac3 Normal file

Binary file not shown.

BIN
sounds/error.mp3 Normal file

Binary file not shown.

BIN
sounds/error.ogg Normal file

Binary file not shown.

BIN
sounds/error.wav Normal file

Binary file not shown.

BIN
sounds/fail2c.ogg Normal file

Binary file not shown.

BIN
sounds/puzzerr.ogg Normal file

Binary file not shown.

BIN
sounds/sysnotify.ogg Normal file

Binary file not shown.

BIN
sounds/wrong.ogg Normal file

Binary file not shown.