mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Hint for "anonymous" login
* utility function for hyperlink * info about login
This commit is contained in:
committed by
Mat Sutcliffe
parent
731d39d783
commit
dc84c9b334
@@ -7,17 +7,18 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "ui_dblogincomponent.h"
|
||||
#include "blackcore/data/globalsetup.h"
|
||||
#include "blackgui/components/dblogincomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/network/authenticateduser.h"
|
||||
#include "blackmisc/network/url.h"
|
||||
#include "blackmisc/htmlutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "ui_dblogincomponent.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
@@ -46,10 +47,11 @@ namespace BlackGui
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
|
||||
ui->setupUi(this);
|
||||
this->setModeLogin(true);
|
||||
CUrl url(sGui->getGlobalSetup().getDbHomePageUrl());
|
||||
const CUrl url(sGui->getGlobalSetup().getDbHomePageUrl());
|
||||
const QString urlString = asHyperlink(url.getFullUrl());
|
||||
QString html = ui->tbr_InfoAndHints->toHtml();
|
||||
html = html.replace("##swiftDB##", url.getFullUrl(), Qt::CaseInsensitive);
|
||||
html = html.replace("##swiftEnableSSO##", url.getFullUrl(), Qt::CaseInsensitive);
|
||||
html = html.replace("##swiftDB##", urlString, Qt::CaseInsensitive);
|
||||
html = html.replace("##swiftEnableSSO##", urlString, Qt::CaseInsensitive);
|
||||
|
||||
ui->tbr_InfoAndHints->setHtml(html);
|
||||
ui->tbr_InfoAndHints->setOpenExternalLinks(true);
|
||||
@@ -58,7 +60,7 @@ namespace BlackGui
|
||||
ui->comp_DebugSetup->setVisible(devEnv);
|
||||
|
||||
const QString dbUrl = sGui->getGlobalSetup().getDbHomePageUrl().toQString();
|
||||
ui->lbl_DatabaseName->setText("<a href=\"" + dbUrl + "\">" + dbUrl + "</a>");
|
||||
ui->lbl_DatabaseName->setText(asHyperlink(dbUrl));
|
||||
ui->lbl_DatabaseName->setTextFormat(Qt::RichText);
|
||||
ui->lbl_DatabaseName->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
ui->lbl_DatabaseName->setOpenExternalLinks(true);
|
||||
|
||||
@@ -32,7 +32,8 @@ namespace BlackGui
|
||||
* Login to DB
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbLoginComponent :
|
||||
public QFrame, public BlackGui::CLoadIndicatorEnabled
|
||||
public QFrame,
|
||||
public CLoadIndicatorEnabled
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -380,19 +380,20 @@
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="tbr_InfoAndHints">
|
||||
<property name="documentTitle">
|
||||
<string>Login hints</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><title>Login hints</title><style type="text/css">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.1pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:7.875pt;"> </span></p>
|
||||
<ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Arial'; font-size:7.875pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You can go directly to the swift DB: <a href="##swiftDb##"><span style=" text-decoration: underline; color:#0000ff;">##swiftDb##</span></a></li>
|
||||
<li style=" font-family:'Arial'; font-size:7.875pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you want to use VATSIM SSO, you need to enable it once <a href="##swiftEnableSSO##"><span style=" text-decoration: underline; color:#0000ff;">##swiftEnableSSO##</span></a></li></ol></body></html></string>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:8pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You can go directly to the swift DB: ##swiftDb## </li>
|
||||
<li style=" font-size:8pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you want to use VATSIM SSO, you need to enable it once ##swiftEnableSSO## </li>
|
||||
<li style=" font-size:8pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">In case you do not have a password you can try &quot;anonymous&quot;/&quot;anonymous&quot;. No guarantee it will work, but worth a trial. </li></ol></body></html></string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
|
||||
@@ -39,4 +39,11 @@ namespace BlackMisc
|
||||
return u"<p style='white-space:pre'>" % text % u"</p>";
|
||||
}
|
||||
|
||||
QString asHyperlink(const QString &url, const QString &text)
|
||||
{
|
||||
return text.isEmpty() ?
|
||||
u"<a href=\"" % url % u"\">" % url % u"</a>" :
|
||||
u"<a href=\"" % url % u"\">" % text % u"</a>";
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#ifndef BLACKMISC_HTMLUTILS_H
|
||||
#define BLACKMISC_HTMLUTILS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/propertyindexlist.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
//! Free functions in BlackMisc
|
||||
@@ -42,6 +42,9 @@ namespace BlackMisc
|
||||
//! As white space preformatted
|
||||
BLACKMISC_EXPORT QString unwrappedTooltip(const QString &text);
|
||||
|
||||
//! As hyperlink
|
||||
BLACKMISC_EXPORT QString asHyperlink(const QString &url, const QString &text = "");
|
||||
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user