mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
Ref T639, unify the connect buttons
* toggle connection from button bar directly -> public * use Qt::QueuedConnection * allow to reset values
This commit is contained in:
@@ -91,11 +91,11 @@ namespace BlackGui
|
|||||||
connect(ui->comp_OtherServers, &CServerListSelector::serverChanged, this, &CLoginComponent::onSelectedServerChanged);
|
connect(ui->comp_OtherServers, &CServerListSelector::serverChanged, this, &CLoginComponent::onSelectedServerChanged);
|
||||||
connect(ui->comp_VatsimServers, &CServerListSelector::serverChanged, this, &CLoginComponent::onSelectedServerChanged);
|
connect(ui->comp_VatsimServers, &CServerListSelector::serverChanged, this, &CLoginComponent::onSelectedServerChanged);
|
||||||
connect(ui->pb_RefreshOtherServers, &QToolButton::clicked, this, &CLoginComponent::reloadOtherServersSetup);
|
connect(ui->pb_RefreshOtherServers, &QToolButton::clicked, this, &CLoginComponent::reloadOtherServersSetup);
|
||||||
connect(ui->tw_Network, &QTabWidget::currentChanged, this, &CLoginComponent::onServerTabWidgetChanged);
|
connect(ui->tw_Network, &QTabWidget::currentChanged, this, &CLoginComponent::onServerTabWidgetChanged);
|
||||||
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CLoginComponent::loginCancelled);
|
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CLoginComponent::loginCancelled, Qt::QueuedConnection);
|
||||||
connect(ui->pb_Ok, &QPushButton::clicked, this, &CLoginComponent::toggleNetworkConnection);
|
connect(ui->pb_Ok, &QPushButton::clicked, this, &CLoginComponent::toggleNetworkConnection, Qt::QueuedConnection);
|
||||||
connect(ui->pb_OtherServersGotoSettings, &QPushButton::pressed, this, &CLoginComponent::requestNetworkSettings);
|
connect(ui->pb_OtherServersGotoSettings, &QPushButton::pressed, this, &CLoginComponent::requestNetworkSettings);
|
||||||
connect(ui->pb_MappingWizard, &QToolButton::clicked, this, &CLoginComponent::mappingWizard);
|
connect(ui->pb_MappingWizard, &QToolButton::clicked, this, &CLoginComponent::mappingWizard, Qt::QueuedConnection);
|
||||||
connect(&m_networkSetup, &CNetworkSetup::setupChanged, this, &CLoginComponent::reloadOtherServersSetup, Qt::QueuedConnection);
|
connect(&m_networkSetup, &CNetworkSetup::setupChanged, this, &CLoginComponent::reloadOtherServersSetup, Qt::QueuedConnection);
|
||||||
|
|
||||||
ui->form_FsdDetails->showEnableInfo(true);
|
ui->form_FsdDetails->showEnableInfo(true);
|
||||||
@@ -184,19 +184,20 @@ namespace BlackGui
|
|||||||
m_logoffCountdownTimer.stop(); // in any case stop the timer
|
m_logoffCountdownTimer.stop(); // in any case stop the timer
|
||||||
if (currentWidget != this && currentWidget != this->parentWidget())
|
if (currentWidget != this && currentWidget != this->parentWidget())
|
||||||
{
|
{
|
||||||
const bool wasVisible = m_visible;
|
// const bool wasVisible = m_visible;
|
||||||
m_visible = false;
|
m_visible = false;
|
||||||
m_logoffCountdownTimer.stop();
|
m_logoffCountdownTimer.stop();
|
||||||
|
|
||||||
if (wasVisible)
|
/** T639
|
||||||
|
if (!wasVisible)
|
||||||
{
|
{
|
||||||
// set own values, and send signals
|
// set own values, and send signals
|
||||||
this->setOwnModelAndIcaoValues();
|
this->setOwnModelAndIcaoValues();
|
||||||
}
|
}
|
||||||
|
**/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->setOwnModelAndIcaoValues();
|
|
||||||
if (m_visible)
|
if (m_visible)
|
||||||
{
|
{
|
||||||
// already visible:
|
// already visible:
|
||||||
@@ -206,6 +207,7 @@ namespace BlackGui
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_visible = true;
|
m_visible = true;
|
||||||
|
this->setOwnModelAndIcaoValues();
|
||||||
const bool isConnected = sGui->getIContextNetwork()->isConnected();
|
const bool isConnected = sGui->getIContextNetwork()->isConnected();
|
||||||
this->setUiLoginState(isConnected);
|
this->setUiLoginState(isConnected);
|
||||||
if (isConnected) { this->startLogoffTimerCountdown(); }
|
if (isConnected) { this->startLogoffTimerCountdown(); }
|
||||||
@@ -503,15 +505,18 @@ namespace BlackGui
|
|||||||
m_logoffCountdownTimer.start();
|
m_logoffCountdownTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginComponent::setOwnModelAndIcaoValues()
|
void CLoginComponent::setOwnModelAndIcaoValues(const CAircraftModel &ownModel)
|
||||||
{
|
{
|
||||||
if (!this->hasValidContexts()) { return; }
|
if (!this->hasValidContexts()) { return; }
|
||||||
CAircraftModel model;
|
CAircraftModel model = ownModel;
|
||||||
const bool simulating = sGui->getIContextSimulator() &&
|
const bool simulating = sGui->getIContextSimulator() &&
|
||||||
(sGui->getIContextSimulator()->getSimulatorStatus() & ISimulator::Simulating);
|
(sGui->getIContextSimulator()->getSimulatorStatus() & ISimulator::Simulating);
|
||||||
if (simulating)
|
if (simulating)
|
||||||
{
|
{
|
||||||
model = sGui->getIContextOwnAircraft()->getOwnAircraft().getModel();
|
if (!model.hasModelString())
|
||||||
|
{
|
||||||
|
model = sGui->getIContextOwnAircraft()->getOwnAircraft().getModel();
|
||||||
|
}
|
||||||
const QString modelAndKey(model.getModelStringAndDbKey());
|
const QString modelAndKey(model.getModelStringAndDbKey());
|
||||||
ui->le_SimulatorModel->setText(modelAndKey);
|
ui->le_SimulatorModel->setText(modelAndKey);
|
||||||
ui->le_SimulatorModel->home(false);
|
ui->le_SimulatorModel->home(false);
|
||||||
@@ -524,7 +529,10 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
model = this->getPrefillModel();
|
if (!model.hasModelString())
|
||||||
|
{
|
||||||
|
model = this->getPrefillModel();
|
||||||
|
}
|
||||||
ui->le_SimulatorModel->clear();
|
ui->le_SimulatorModel->clear();
|
||||||
this->highlightModelField();
|
this->highlightModelField();
|
||||||
}
|
}
|
||||||
@@ -698,7 +706,7 @@ namespace BlackGui
|
|||||||
CLogMessage(this).validationInfo(u"Hint: Are you using the emulated driver? Set a model if so!");
|
CLogMessage(this).validationInfo(u"Hint: Are you using the emulated driver? Set a model if so!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->setOwnModelAndIcaoValues();
|
this->setOwnModelAndIcaoValues(reverseModel);
|
||||||
|
|
||||||
// open dialog for model mapping
|
// open dialog for model mapping
|
||||||
if (m_autoPopupWizard && !reverseModel.isLoadedFromDb())
|
if (m_autoPopupWizard && !reverseModel.isLoadedFromDb())
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace BlackGui
|
|||||||
explicit CLoginComponent(QWidget *parent = nullptr);
|
explicit CLoginComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CLoginComponent();
|
virtual ~CLoginComponent() override;
|
||||||
|
|
||||||
//! Automatically popup
|
//! Automatically popup
|
||||||
void setAutoPopupWizad(bool autoPopup);
|
void setAutoPopupWizad(bool autoPopup);
|
||||||
@@ -83,6 +83,9 @@ namespace BlackGui
|
|||||||
//! Set a logoff time
|
//! Set a logoff time
|
||||||
void setLogoffCountdown(int timeoutSeconds = -1);
|
void setLogoffCountdown(int timeoutSeconds = -1);
|
||||||
|
|
||||||
|
//! Login requested
|
||||||
|
void toggleNetworkConnection();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Login
|
//! Login
|
||||||
void loginOrLogoffSuccessful();
|
void loginOrLogoffSuccessful();
|
||||||
@@ -158,9 +161,6 @@ namespace BlackGui
|
|||||||
//! Login cancelled
|
//! Login cancelled
|
||||||
void loginCancelled();
|
void loginCancelled();
|
||||||
|
|
||||||
//! Login requested
|
|
||||||
void toggleNetworkConnection();
|
|
||||||
|
|
||||||
//! VATSIM data file was loaded
|
//! VATSIM data file was loaded
|
||||||
void onWebServiceDataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
void onWebServiceDataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ namespace BlackGui
|
|||||||
void setUiLoginState(bool connected);
|
void setUiLoginState(bool connected);
|
||||||
|
|
||||||
//! Own model and ICAO data for GUI and own aircraft
|
//! Own model and ICAO data for GUI and own aircraft
|
||||||
void setOwnModelAndIcaoValues();
|
void setOwnModelAndIcaoValues(const BlackMisc::Simulation::CAircraftModel &ownModel = {});
|
||||||
|
|
||||||
//! Set OK button string
|
//! Set OK button string
|
||||||
void setOkButtonString(bool connected);
|
void setOkButtonString(bool connected);
|
||||||
|
|||||||
@@ -231,7 +231,8 @@ void SwiftGuiStd::loginRequested()
|
|||||||
if (ui->sw_MainMiddle->currentIndex() == static_cast<int>(MainPageLogin))
|
if (ui->sw_MainMiddle->currentIndex() == static_cast<int>(MainPageLogin))
|
||||||
{
|
{
|
||||||
// already main page, we fake a re-trigger here
|
// already main page, we fake a re-trigger here
|
||||||
emit this->currentMainInfoAreaChanged(ui->sw_MainMiddle->currentWidget());
|
// emit this->currentMainInfoAreaChanged(ui->sw_MainMiddle->currentWidget());
|
||||||
|
ui->comp_Login->toggleNetworkConnection();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ void SwiftGuiStd::initGuiSignals()
|
|||||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
if (!sApp || sApp->isShuttingDown()) { return; }
|
||||||
ui->sw_MainMiddle->setCurrentIndex(MainPageLogin);
|
ui->sw_MainMiddle->setCurrentIndex(MainPageLogin);
|
||||||
});
|
});
|
||||||
connect(this, &SwiftGuiStd::currentMainInfoAreaChanged, ui->comp_Login, &CLoginComponent::mainInfoAreaChanged);
|
connect(this, &SwiftGuiStd::currentMainInfoAreaChanged, ui->comp_Login, &CLoginComponent::mainInfoAreaChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
// text messages
|
// text messages
|
||||||
connect(ui->comp_MainInfoArea->getAtcStationComponent(), &CAtcStationComponent::requestTextMessageWidget, ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::showCorrespondingTab, Qt::QueuedConnection);
|
connect(ui->comp_MainInfoArea->getAtcStationComponent(), &CAtcStationComponent::requestTextMessageWidget, ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::showCorrespondingTab, Qt::QueuedConnection);
|
||||||
|
|||||||
Reference in New Issue
Block a user