refs #911, load indicator for login component

This commit is contained in:
Klaus Basan
2017-03-22 18:31:55 +01:00
committed by Mathew Sutcliffe
parent 24af0f044f
commit a5946e1727
3 changed files with 16 additions and 3 deletions

View File

@@ -40,6 +40,7 @@ namespace BlackGui
{
CDbLoginComponent::CDbLoginComponent(QWidget *parent) :
QFrame(parent),
CLoadIndicatorEnabled(this),
ui(new Ui::CDbLoginComponent)
{
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
@@ -55,7 +56,12 @@ namespace BlackGui
const bool devEnv = sGui->isRunningInDeveloperEnvironment();
ui->comp_DebugSetup->setVisible(devEnv);
ui->lbl_DatabaseName->setText(sGui->getGlobalSetup().getDbHomePageUrl().toQString());
const QString dbUrl = sGui->getGlobalSetup().getDbHomePageUrl().toQString();
ui->lbl_DatabaseName->setText("<a href=\"" + dbUrl + "\">" + dbUrl + "</a>");
ui->lbl_DatabaseName->setTextFormat(Qt::RichText);
ui->lbl_DatabaseName->setTextInteractionFlags(Qt::TextBrowserInteraction);
ui->lbl_DatabaseName->setOpenExternalLinks(true);
connect(ui->pb_Login, &QPushButton::clicked, this, &CDbLoginComponent::ps_onLoginClicked);
connect(ui->pb_Logoff, &QPushButton::clicked, this, &CDbLoginComponent::ps_onLogoffClicked);
@@ -104,6 +110,7 @@ namespace BlackGui
{
CLogMessage::preformatted(msgs);
}
this->showLoading(5000);
}
void CDbLoginComponent::ps_onLogoffClicked()
@@ -114,6 +121,7 @@ namespace BlackGui
void CDbLoginComponent::ps_authenticationFinished(const CAuthenticatedUser &user, const CStatusMessageList &statusMsgs)
{
this->hideLoading();
this->setUserInfo(user);
if (statusMsgs.hasWarningOrErrorMessages())
{

View File

@@ -15,6 +15,7 @@
#include "blackcore/db/databaseauthentication.h"
#include "blackcore/data/globalsetup.h"
#include "blackgui/blackguiexport.h"
#include "blackgui/loadindicator.h"
#include "blackmisc/statusmessagelist.h"
#include <QFrame>
@@ -30,7 +31,8 @@ namespace BlackGui
/**
* Login to DB
*/
class BLACKGUI_EXPORT CDbLoginComponent : public QFrame
class BLACKGUI_EXPORT CDbLoginComponent :
public QFrame, public BlackGui::CLoadIndicatorEnabled
{
Q_OBJECT
@@ -39,7 +41,7 @@ namespace BlackGui
explicit CDbLoginComponent(QWidget *parent = nullptr);
//! Destructor
~CDbLoginComponent();
virtual ~CDbLoginComponent();
//! DB user
BlackMisc::Network::CAuthenticatedUser getDbUser() const;

View File

@@ -210,6 +210,9 @@
<property name="text">
<string>Database URL will go here</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>