mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
Ref T659, ajusted login component/dialog for poup login
This commit is contained in:
committed by
Mat Sutcliffe
parent
eb4c8eed35
commit
34cdffc9fa
@@ -51,6 +51,7 @@
|
|||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QPair>
|
||||||
|
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -90,6 +91,13 @@ namespace BlackGui
|
|||||||
this->setForceSmall(true);
|
this->setForceSmall(true);
|
||||||
this->showKillButton(false);
|
this->showKillButton(false);
|
||||||
|
|
||||||
|
// auto logoff
|
||||||
|
// we decided to make it difficult for users to disable it
|
||||||
|
if (!CBuildConfig::isLocalDeveloperDebugBuild())
|
||||||
|
{
|
||||||
|
ui->cb_AutoLogoff->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Stored data
|
// Stored data
|
||||||
this->loadRememberedUserData();
|
this->loadRememberedUserData();
|
||||||
|
|
||||||
@@ -109,42 +117,9 @@ namespace BlackGui
|
|||||||
CLoginAdvComponent::~CLoginAdvComponent()
|
CLoginAdvComponent::~CLoginAdvComponent()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void CLoginAdvComponent::mainInfoAreaChanged(const QWidget *currentWidget)
|
void CLoginAdvComponent::setAutoLogoff(bool autoLogoff)
|
||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
ui->cb_AutoLogoff->setChecked(autoLogoff);
|
||||||
if (currentWidget != this && currentWidget != this->parentWidget())
|
|
||||||
{
|
|
||||||
// const bool wasVisible = m_visible;
|
|
||||||
m_visible = false;
|
|
||||||
|
|
||||||
/** T639
|
|
||||||
if (!wasVisible)
|
|
||||||
{
|
|
||||||
// set own values, and send signals
|
|
||||||
this->setOwnModelAndIcaoValues();
|
|
||||||
}
|
|
||||||
**/
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_visible)
|
|
||||||
{
|
|
||||||
// already visible:
|
|
||||||
// re-trigger! treat as same as OK
|
|
||||||
this->toggleNetworkConnection();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_visible = true;
|
|
||||||
ui->comp_OwnAircraft->setOwnModelAndIcaoValues();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// we decided to make it difficult for users to disable it
|
|
||||||
if (!CBuildConfig::isLocalDeveloperDebugBuild())
|
|
||||||
{
|
|
||||||
ui->cb_AutoLogoff->setChecked(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginAdvComponent::loginCancelled()
|
void CLoginAdvComponent::loginCancelled()
|
||||||
@@ -184,6 +159,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sync values with GUI values
|
// sync values with GUI values
|
||||||
|
const COwnAircraftComponent::CGuiAircraftValues values = ui->comp_OwnAircraft->getAircraftValuesFromGui();
|
||||||
this->updateOwnAircraftCallsignAndPilotFromGuiValues();
|
this->updateOwnAircraftCallsignAndPilotFromGuiValues();
|
||||||
ui->comp_OwnAircraft->updateOwnAircaftIcaoValuesFromGuiValues();
|
ui->comp_OwnAircraft->updateOwnAircaftIcaoValuesFromGuiValues();
|
||||||
|
|
||||||
@@ -225,7 +201,7 @@ namespace BlackGui
|
|||||||
sGui->getIContextAudio()->setVoiceSetup(currentServer.getVoiceSetup());
|
sGui->getIContextAudio()->setVoiceSetup(currentServer.getVoiceSetup());
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, mode);
|
msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, values.ownLiverySend, values.useLivery, values.ownAircraftModelStringSend, values.useModelString, mode);
|
||||||
if (msg.isSuccess())
|
if (msg.isSuccess())
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server");
|
Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server");
|
||||||
@@ -351,44 +327,6 @@ namespace BlackGui
|
|||||||
emit this->requestLoginPage();
|
emit this->requestLoginPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
void CLoginAdvComponent::onSimulatorModelChanged(const CAircraftModel &model)
|
|
||||||
{
|
|
||||||
if (!sGui || !sGui->getIContextNetwork() || sApp->isShuttingDown()) { return; }
|
|
||||||
const bool isNetworkConnected = sGui && sGui->getIContextNetwork()->isConnected();
|
|
||||||
if (isNetworkConnected) { return; }
|
|
||||||
|
|
||||||
// update with latest DB data
|
|
||||||
CAircraftModel reverseModel(model);
|
|
||||||
if (sGui->hasWebDataServices())
|
|
||||||
{
|
|
||||||
reverseModel = sGui->getWebDataServices()->getModelForModelString(model.getModelString());
|
|
||||||
if (!reverseModel.isLoadedFromDb()) { reverseModel = model; } // reset if not found
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString modelStr(reverseModel.hasModelString() ? reverseModel.getModelString() : "<unknown>");
|
|
||||||
if (!reverseModel.hasModelString())
|
|
||||||
{
|
|
||||||
CLogMessage(this).validationInfo(u"Invalid lookup for '%1' successful: %2") << modelStr << reverseModel.toQString();
|
|
||||||
CLogMessage(this).validationInfo(u"Hint: Are you using the emulated driver? Set a model if so!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this->setOwnModelAndIcaoValues(reverseModel);
|
|
||||||
|
|
||||||
// open dialog for model mapping
|
|
||||||
if (m_autoPopupWizard && !reverseModel.isLoadedFromDb())
|
|
||||||
{
|
|
||||||
this->mappingWizard();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check state of own aircraft
|
|
||||||
this->updateOwnAircraftCallsignAndPilotFromGuiValues();
|
|
||||||
|
|
||||||
// let others know data changed
|
|
||||||
m_changedLoginDataDigestSignal.inputSignal();
|
|
||||||
}
|
|
||||||
**/
|
|
||||||
|
|
||||||
bool CLoginAdvComponent::updateOwnAircraftCallsignAndPilotFromGuiValues()
|
bool CLoginAdvComponent::updateOwnAircraftCallsignAndPilotFromGuiValues()
|
||||||
{
|
{
|
||||||
if (!this->hasValidContexts()) { return false; }
|
if (!this->hasValidContexts()) { return false; }
|
||||||
|
|||||||
@@ -67,8 +67,11 @@ namespace BlackGui
|
|||||||
//! Automatically popup
|
//! Automatically popup
|
||||||
void setAutoPopupWizad(bool autoPopup);
|
void setAutoPopupWizad(bool autoPopup);
|
||||||
|
|
||||||
|
//! Set auto logoff
|
||||||
|
void setAutoLogoff(bool autoLogoff);
|
||||||
|
|
||||||
//! Main info area changed
|
//! Main info area changed
|
||||||
void mainInfoAreaChanged(const QWidget *currentWidget);
|
// void mainInfoAreaChanged(const QWidget *currentWidget);
|
||||||
|
|
||||||
//! Login requested
|
//! Login requested
|
||||||
void toggleNetworkConnection();
|
void toggleNetworkConnection();
|
||||||
@@ -150,7 +153,6 @@ namespace BlackGui
|
|||||||
|
|
||||||
QScopedPointer<Ui::CLoginAdvComponent> ui;
|
QScopedPointer<Ui::CLoginAdvComponent> ui;
|
||||||
BlackMisc::CDigestSignal m_changedLoginDataDigestSignal { this, &CLoginAdvComponent::loginDataChangedDigest, 1500, 10 };
|
BlackMisc::CDigestSignal m_changedLoginDataDigestSignal { this, &CLoginAdvComponent::loginDataChangedDigest, 1500, 10 };
|
||||||
bool m_visible = false; //!< is this component selected?
|
|
||||||
BlackCore::Data::CNetworkSetup m_networkSetup; //!< servers last used
|
BlackCore::Data::CNetworkSetup m_networkSetup; //!< servers last used
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ namespace BlackGui
|
|||||||
sGui->getIContextAudio()->setVoiceSetup(currentServer.getVoiceSetup());
|
sGui->getIContextAudio()->setVoiceSetup(currentServer.getVoiceSetup());
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, mode);
|
msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, {}, true, {}, true, mode);
|
||||||
if (msg.isSuccess())
|
if (msg.isSuccess())
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server");
|
Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server");
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ namespace BlackGui
|
|||||||
CLoginDialog::~CLoginDialog()
|
CLoginDialog::~CLoginDialog()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void CLoginDialog::setAutoLogoff(bool logoff)
|
||||||
|
{
|
||||||
|
ui->comp_LoginComponent->setAutoLogoff(logoff);
|
||||||
|
}
|
||||||
|
|
||||||
void CLoginDialog::onLoginOrLogoffCancelled()
|
void CLoginDialog::onLoginOrLogoffCancelled()
|
||||||
{
|
{
|
||||||
this->reject();
|
this->reject();
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ namespace BlackGui
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CLoginDialog() override;
|
virtual ~CLoginDialog() override;
|
||||||
|
|
||||||
|
//! Set auto logoff
|
||||||
|
void setAutoLogoff(bool logoff);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Request server settings
|
//! Request server settings
|
||||||
void requestNetworkSettings();
|
void requestNetworkSettings();
|
||||||
|
|||||||
@@ -7,19 +7,19 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>350</width>
|
<width>350</width>
|
||||||
<height>500</height>
|
<height>550</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>350</width>
|
<width>350</width>
|
||||||
<height>500</height>
|
<height>550</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Login dialog</string>
|
<string>Login dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="vl_LoginDialog">
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Components::CLoginAdvComponent" name="comp_LoginComponent">
|
<widget class="BlackGui::Components::CLoginAdvComponent" name="comp_LoginComponent">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
* or distributed except according to the terms contained in the LICENSE file.
|
* or distributed except according to the terms contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "ui_swiftguistd.h"
|
||||||
|
|
||||||
#include "blackgui/components/infobarstatuscomponent.h"
|
#include "blackgui/components/infobarstatuscomponent.h"
|
||||||
#include "blackgui/components/logcomponent.h"
|
#include "blackgui/components/logcomponent.h"
|
||||||
#include "blackgui/components/dbloaddatadialog.h"
|
#include "blackgui/components/dbloaddatadialog.h"
|
||||||
@@ -28,7 +30,7 @@
|
|||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/threadutils.h"
|
#include "blackmisc/threadutils.h"
|
||||||
#include "ui_swiftguistd.h"
|
#include "blackconfig/buildconfig.h"
|
||||||
|
|
||||||
#include "swiftguistd.h"
|
#include "swiftguistd.h"
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@@ -57,9 +59,9 @@ namespace BlackMisc { class CIdentifiable; }
|
|||||||
|
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
using namespace BlackCore::Context;
|
using namespace BlackCore::Context;
|
||||||
using namespace BlackMisc;
|
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
using namespace BlackGui::Components;
|
using namespace BlackGui::Components;
|
||||||
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
@@ -67,6 +69,7 @@ using namespace BlackMisc::Geo;
|
|||||||
using namespace BlackMisc::Audio;
|
using namespace BlackMisc::Audio;
|
||||||
using namespace BlackMisc::Input;
|
using namespace BlackMisc::Input;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
|
using namespace BlackConfig;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
SwiftGuiStd::SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowMode, QWidget *parent) :
|
SwiftGuiStd::SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowMode, QWidget *parent) :
|
||||||
@@ -255,6 +258,10 @@ void SwiftGuiStd::loginRequested()
|
|||||||
{
|
{
|
||||||
if (!m_loginDialog) { m_loginDialog.reset(new CLoginDialog(this)); }
|
if (!m_loginDialog) { m_loginDialog.reset(new CLoginDialog(this)); }
|
||||||
connect(m_loginDialog.data(), &CLoginDialog::requestNetworkSettings, this, &SwiftGuiStd::displayNetworkSettings);
|
connect(m_loginDialog.data(), &CLoginDialog::requestNetworkSettings, this, &SwiftGuiStd::displayNetworkSettings);
|
||||||
|
if (!CBuildConfig::isLocalDeveloperDebugBuild())
|
||||||
|
{
|
||||||
|
m_loginDialog->setAutoLogoff(true);
|
||||||
|
}
|
||||||
m_loginDialog->show();
|
m_loginDialog->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user