Make login button work for login page
This commit is contained in:
parent
c7dd602687
commit
dc2f779d4b
1
TODO.md
1
TODO.md
|
@ -1,6 +1,7 @@
|
||||||
- Current focus
|
- Current focus
|
||||||
- Merge login page
|
- Merge login page
|
||||||
- Just import nio?
|
- Just import nio?
|
||||||
|
- TextInput.accepted() for SendBox
|
||||||
|
|
||||||
- Refactoring
|
- Refactoring
|
||||||
- Migrate more JS functions to their own files / Implement in Python instead
|
- Migrate more JS functions to their own files / Implement in Python instead
|
||||||
|
|
|
@ -115,8 +115,7 @@ class Client(QObject):
|
||||||
self.net_sync.http_disconnect()
|
self.net_sync.http_disconnect()
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot()
|
@futurize(pyqt=False)
|
||||||
@futurize()
|
|
||||||
def startSyncing(self) -> None:
|
def startSyncing(self) -> None:
|
||||||
while True:
|
while True:
|
||||||
self._on_sync(self.net_sync.talk(
|
self._on_sync(self.net_sync.talk(
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ClientManager(QObject):
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot(str, str, str)
|
@pyqtSlot(str, str, str)
|
||||||
@pyqtSlot(str, str, str)
|
@pyqtSlot(str, str, str, str)
|
||||||
def new(self, hostname: str, username: str, password: str,
|
def new(self, hostname: str, username: str, password: str,
|
||||||
device_id: str = "") -> None:
|
device_id: str = "") -> None:
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,8 @@ class PyQtFuture(QObject):
|
||||||
_RUNNING: List[Tuple[Executor, Callable, tuple, dict]] = []
|
_RUNNING: List[Tuple[Executor, Callable, tuple, dict]] = []
|
||||||
|
|
||||||
|
|
||||||
def futurize(max_instances: Optional[int] = None) -> Callable:
|
def futurize(max_instances: Optional[int] = None, pyqt: bool = True
|
||||||
|
) -> Callable:
|
||||||
|
|
||||||
def decorator(func: Callable) -> Callable:
|
def decorator(func: Callable) -> Callable:
|
||||||
|
|
||||||
|
@ -89,7 +90,8 @@ def futurize(max_instances: Optional[int] = None) -> Callable:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
_RUNNING.append((self.pool, func, args, kws))
|
_RUNNING.append((self.pool, func, args, kws))
|
||||||
return PyQtFuture(self.pool.submit(run_and_catch_errs), self)
|
future = self.pool.submit(run_and_catch_errs)
|
||||||
|
return PyQtFuture(future, self) if pyqt else future
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ class SignalManager(QObject):
|
||||||
|
|
||||||
|
|
||||||
def onClientAdded(self, client: Client) -> None:
|
def onClientAdded(self, client: Client) -> None:
|
||||||
|
print(client)
|
||||||
self.connectClient(client)
|
self.connectClient(client)
|
||||||
self.backend.models.accounts.append(User(
|
self.backend.models.accounts.append(User(
|
||||||
userId = client.userId,
|
userId = client.userId,
|
||||||
|
|
|
@ -10,6 +10,12 @@ Image {
|
||||||
cache: false
|
cache: false
|
||||||
source: "../../images/login_background.jpg"
|
source: "../../images/login_background.jpg"
|
||||||
|
|
||||||
|
function login() {
|
||||||
|
Backend.clientManager.new(
|
||||||
|
"matrix.org", identifierField.text, passwordField.text
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: Qt.hsla(1, 1, 1, 0.3)
|
color: Qt.hsla(1, 1, 1, 0.3)
|
||||||
|
|
||||||
|
@ -80,11 +86,14 @@ Image {
|
||||||
}
|
}
|
||||||
|
|
||||||
Base.HTextField {
|
Base.HTextField {
|
||||||
|
id: identifierField
|
||||||
placeholderText: qsTr(
|
placeholderText: qsTr(
|
||||||
loginWithEmailButton.checked ? "Email" :
|
loginWithEmailButton.checked ? "Email" :
|
||||||
loginWithPhoneButton.checked ? "Phone" :
|
loginWithPhoneButton.checked ? "Phone" :
|
||||||
"Username"
|
"Username"
|
||||||
)
|
)
|
||||||
|
onAccepted: login()
|
||||||
|
Component.onCompleted: forceActiveFocus()
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.margins: mainColumn.hMargin
|
Layout.margins: mainColumn.hMargin
|
||||||
|
@ -93,7 +102,10 @@ Image {
|
||||||
}
|
}
|
||||||
|
|
||||||
Base.HTextField {
|
Base.HTextField {
|
||||||
|
id: passwordField
|
||||||
placeholderText: qsTr("Password")
|
placeholderText: qsTr("Password")
|
||||||
|
echoMode: TextField.Password
|
||||||
|
onAccepted: login()
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.margins: mainColumn.hMargin
|
Layout.margins: mainColumn.hMargin
|
||||||
|
@ -112,6 +124,10 @@ Image {
|
||||||
text: qsTr("Login")
|
text: qsTr("Login")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: login()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Base.HButton {
|
Base.HButton {
|
||||||
text: qsTr("Forgot?")
|
text: qsTr("Forgot?")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user