Add device name field in login dialog.
This commit is contained in:
@@ -44,12 +44,22 @@ Dialog {
|
|||||||
placeholderText: "Password"
|
placeholderText: "Password"
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
|
|
||||||
|
onAccepted: deviceNameField.forceActiveFocus()
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoTextField {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
id: deviceNameField
|
||||||
|
|
||||||
|
placeholderText: "Device Name"
|
||||||
|
|
||||||
onAccepted: root.accept()
|
onAccepted: root.accept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function doLogin() {
|
function doLogin() {
|
||||||
spectralController.loginWithCredentials(serverField.text, usernameField.text, passwordField.text)
|
spectralController.loginWithCredentials(serverField.text, usernameField.text, passwordField.text, deviceNameField.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: destroy()
|
onClosed: destroy()
|
||||||
|
|||||||
@@ -64,12 +64,14 @@ inline QString accessTokenFileName(const AccountSettings& account) {
|
|||||||
|
|
||||||
void Controller::loginWithCredentials(QString serverAddr,
|
void Controller::loginWithCredentials(QString serverAddr,
|
||||||
QString user,
|
QString user,
|
||||||
QString pass) {
|
QString pass,
|
||||||
|
QString deviceName) {
|
||||||
if (!user.isEmpty() && !pass.isEmpty()) {
|
if (!user.isEmpty() && !pass.isEmpty()) {
|
||||||
QString deviceName = "Spectral " + QSysInfo::machineHostName() + " " +
|
if (deviceName.isEmpty()) {
|
||||||
QSysInfo::productType() + " " +
|
deviceName = "Spectral " + QSysInfo::machineHostName() + " " +
|
||||||
QSysInfo::productVersion() + " " +
|
QSysInfo::productType() + " " + QSysInfo::productVersion() +
|
||||||
QSysInfo::currentCpuArchitecture();
|
" " + QSysInfo::currentCpuArchitecture();
|
||||||
|
}
|
||||||
|
|
||||||
QUrl serverUrl(serverAddr);
|
QUrl serverUrl(serverAddr);
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ class Controller : public QObject {
|
|||||||
explicit Controller(QObject* parent = nullptr);
|
explicit Controller(QObject* parent = nullptr);
|
||||||
~Controller();
|
~Controller();
|
||||||
|
|
||||||
// All the Q_INVOKABLEs.
|
Q_INVOKABLE void loginWithCredentials(QString, QString, QString, QString);
|
||||||
Q_INVOKABLE void loginWithCredentials(QString, QString, QString);
|
|
||||||
|
|
||||||
QVector<Connection*> connections() { return m_connections; }
|
QVector<Connection*> connections() { return m_connections; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user