From 8f0cca3b2a2cb5bd4bdb49f768a2b97f7c12ffe7 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 26 Apr 2019 14:03:12 +0200 Subject: Use Qt5 QObject::connect(), fix caplock message after failed login --- src/loginform.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/loginform.cpp b/src/loginform.cpp index 5faa617..a47767a 100644 --- a/src/loginform.cpp +++ b/src/loginform.cpp @@ -82,11 +82,15 @@ void LoginForm::initialize() cancelLoginTimer.setInterval(10000); cancelLoginTimer.setSingleShot(true); - connect(&cancelLoginTimer, SIGNAL(timeout()), this, SLOT(cancelLogin())); + connect(&cancelLoginTimer, &QTimer::timeout, this, &LoginForm::cancelLogin); hideMessageTimer.setInterval(10000); hideMessageTimer.setSingleShot(true); - connect(&hideMessageTimer, SIGNAL(timeout()), this, SLOT(hideMessage())); + connect(&hideMessageTimer, &QTimer::timeout, this, [this]() { + this->hideMessage(); + this->capsOn = -1; + this->checkCaps(); + }); if (!Global::testMode()) { ui->hostnameLabel->setText(Global::greeter()->hostname()); @@ -97,10 +101,10 @@ void LoginForm::initialize() addLeaveEntry(Global::power()->canShutdown(), "system-shutdown", tr("Shutdown"), "shutdown"); addLeaveEntry(Global::power()->canRestart(), "system-reboot", tr("Restart"), "restart"); - connect(ui->leaveComboBox, SIGNAL(activated(int)), this, SLOT(leaveDropDownActivated(int))); - connect(Global::greeter(), SIGNAL(showPrompt(QString, QLightDM::Greeter::PromptType)), this, SLOT(onPrompt(QString, QLightDM::Greeter::PromptType))); - connect(Global::greeter(), SIGNAL(showMessage(QString, QLightDM::Greeter::MessageType)), this, SLOT(onMessage(QString, QLightDM::Greeter::MessageType))); - connect(Global::greeter(), SIGNAL(authenticationComplete()), this, SLOT(onAuthenticationComplete())); + connect(ui->leaveComboBox, QOverload::of(&QComboBox::activated), this, &LoginForm::leaveDropDownActivated); + connect(Global::greeter(), &QLightDM::Greeter::showPrompt, this, &LoginForm::onPrompt); + connect(Global::greeter(), &QLightDM::Greeter::showMessage, this, &LoginForm::onMessage); + connect(Global::greeter(), &QLightDM::Greeter::authenticationComplete, this, &LoginForm::onAuthenticationComplete); } // Load regexp for name substitution @@ -136,6 +140,7 @@ void LoginForm::startAuthentication() std::cerr << "Logging in as " << username.toStdString() << std::endl; if (Global::testMode()) { + showMessage(QLatin1String("Test mode..."), true); return; } if (Global::greeter()->inAuthentication()) { -- cgit v1.2.3-55-g7522