mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
Reorder login page
* 2 sections: login/logoff status * select server, then details (not in same tab widget which is misleading) * call readonly on subforms
This commit is contained in:
@@ -147,7 +147,7 @@ namespace BlackGui
|
||||
|
||||
// inital setup, if data already available
|
||||
this->validateAircraftValues();
|
||||
ui->editor_Pilot->validate();
|
||||
ui->form_Pilot->validate();
|
||||
this->onWebServiceDataRead(CEntityFlags::VatsimDataFile, CEntityFlags::ReadFinished, -1);
|
||||
const CServerList otherServers(m_networkSetup.getOtherServersPlusTestServers());
|
||||
ui->comp_OtherServers->setServers(otherServers);
|
||||
@@ -215,16 +215,11 @@ namespace BlackGui
|
||||
void CLoginComponent::toggleNetworkConnection()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
if (ui->tw_Network->currentWidget() != ui->pg_NetworkVatsim && ui->tw_Network->currentWidget() != ui->pg_OtherServers)
|
||||
{
|
||||
this->showOverlayMessage(CStatusMessage(this).validationError("No login possible from this very tab, use VATSIM or other servers"), OverlayMessageMs);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool isConnected = sGui && sGui->getIContextNetwork()->isConnected();
|
||||
const bool vatsimLogin = this->isVatsimNetworkTabSelected();
|
||||
|
||||
ui->editor_Pilot->setVatsimValidation(vatsimLogin);
|
||||
ui->form_Pilot->setVatsimValidation(vatsimLogin);
|
||||
this->setUiLoginState(isConnected);
|
||||
|
||||
CServer currentServer; // used for login
|
||||
@@ -238,7 +233,7 @@ namespace BlackGui
|
||||
return;
|
||||
}
|
||||
|
||||
const CStatusMessageList pilotMsgs = ui->editor_Pilot->validate();
|
||||
const CStatusMessageList pilotMsgs = ui->form_Pilot->validate();
|
||||
if (pilotMsgs.isFailure())
|
||||
{
|
||||
this->showOverlayMessage(CStatusMessage(this).validationWarning("Invalid pilot data, login not possible"), OverlayMessageMs);
|
||||
@@ -353,11 +348,11 @@ namespace BlackGui
|
||||
|
||||
ui->tw_Network->setCurrentWidget(
|
||||
lastServer.getServerType() == CServer::FSDServerVatsim ?
|
||||
ui->pg_NetworkVatsim : ui->pg_OtherServers);
|
||||
ui->tb_NetworkVatsim : ui->tb_OtherServers);
|
||||
}
|
||||
|
||||
const CUser lastUser = lastServer.getUser();
|
||||
ui->editor_Pilot->setUser(lastUser);
|
||||
ui->form_Pilot->setUser(lastUser);
|
||||
if (lastUser.hasCallsign())
|
||||
{
|
||||
ui->le_Callsign->setText(lastUser.getCallsign().asString());
|
||||
@@ -382,7 +377,7 @@ namespace BlackGui
|
||||
server = m_networkSetup.getLastVatsimServer();
|
||||
}
|
||||
else { return; }
|
||||
ui->editor_Pilot->setUser(server.getUser(), true);
|
||||
ui->form_Pilot->setUser(server.getUser(), true);
|
||||
}
|
||||
|
||||
void CLoginComponent::onSelectedServerChanged(const CServer &server)
|
||||
@@ -390,7 +385,7 @@ namespace BlackGui
|
||||
if (!m_updatePilotOnServerChanges) { return; }
|
||||
const bool vatsim = this->isVatsimNetworkTabSelected();
|
||||
const CUser user = vatsim ? this->getCurrentVatsimServer().getUser() : server.getUser();
|
||||
ui->editor_Pilot->setUser(user, true);
|
||||
ui->form_Pilot->setUser(user, true);
|
||||
}
|
||||
|
||||
void CLoginComponent::onServerTabWidgetChanged(int index)
|
||||
@@ -399,15 +394,15 @@ namespace BlackGui
|
||||
if (!m_updatePilotOnServerChanges) { return; }
|
||||
const bool vatsim = this->isVatsimNetworkTabSelected();
|
||||
const CServer server = vatsim ? this->getCurrentVatsimServer() : this->getCurrentOtherServer();
|
||||
ui->editor_Pilot->setUser(server.getUser(), true);
|
||||
ui->form_Pilot->setUser(server.getUser(), true);
|
||||
}
|
||||
|
||||
bool CLoginComponent::hasValidContexts()
|
||||
{
|
||||
if (!sGui || !sGui->supportsContexts()) { return false; }
|
||||
if (sGui->isShuttingDown()) { return false; }
|
||||
if (!sGui->getIContextSimulator()) { return false; }
|
||||
if (!sGui->getIContextNetwork()) { return false; }
|
||||
if (sGui->isShuttingDown()) { return false; }
|
||||
if (!sGui->getIContextSimulator()) { return false; }
|
||||
if (!sGui->getIContextNetwork()) { return false; }
|
||||
if (!sGui->getIContextOwnAircraft()) { return false; }
|
||||
return true;
|
||||
}
|
||||
@@ -425,7 +420,7 @@ namespace BlackGui
|
||||
|
||||
CUser CLoginComponent::getUserFromPilotGuiValues() const
|
||||
{
|
||||
CUser user = ui->editor_Pilot->getUser();
|
||||
CUser user = ui->form_Pilot->getUser();
|
||||
user.setCallsign(this->getCallsignFromGui());
|
||||
return user;
|
||||
}
|
||||
@@ -629,6 +624,7 @@ namespace BlackGui
|
||||
|
||||
void CLoginComponent::mappingWizard()
|
||||
{
|
||||
if (!sGui || !sGui->getIContextOwnAircraft() || sGui->isShuttingDown()) { return; }
|
||||
if (!m_mappingWizard)
|
||||
{
|
||||
m_mappingWizard.reset(new CDbQuickMappingWizard(this));
|
||||
@@ -665,13 +661,8 @@ namespace BlackGui
|
||||
|
||||
void CLoginComponent::setUiLoginState(bool connected)
|
||||
{
|
||||
ui->editor_Pilot->setReadOnly(connected);
|
||||
ui->editor_Pilot->setVisible(!connected);
|
||||
ui->gb_PilotsDetails->setVisible(!connected);
|
||||
ui->frp_LoginMode->setReadOnly(connected);
|
||||
ui->gb_OwnAircraft->setVisible(!connected);
|
||||
ui->tw_Network->setVisible(!connected);
|
||||
ui->fr_LogoffConfirmation->setVisible(connected);
|
||||
ui->fr_LoginDisconnected->setVisible(!connected);
|
||||
ui->fr_LogoffConfirmationConnected->setVisible(connected);
|
||||
|
||||
const QString s = connected ? QStringLiteral("disconnect") : QStringLiteral("connect");
|
||||
ui->pb_Ok->setText(s);
|
||||
@@ -700,7 +691,7 @@ namespace BlackGui
|
||||
|
||||
bool CLoginComponent::isVatsimNetworkTabSelected() const
|
||||
{
|
||||
return (ui->tw_Network->currentWidget() == ui->pg_NetworkVatsim);
|
||||
return (ui->tw_Network->currentWidget() == ui->tb_NetworkVatsim);
|
||||
}
|
||||
|
||||
CAircraftModel CLoginComponent::getPrefillModel() const
|
||||
@@ -724,7 +715,7 @@ namespace BlackGui
|
||||
changedCallsign = true;
|
||||
}
|
||||
CUser pilot = ownAircraft.getPilot();
|
||||
const CUser uiUser = ui->editor_Pilot->getUser();
|
||||
const CUser uiUser = ui->form_Pilot->getUser();
|
||||
pilot.setRealName(uiUser.getRealName());
|
||||
pilot.setHomeBase(uiUser.getHomeBase());
|
||||
pilot.setId(uiUser.getId());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@ namespace BlackGui
|
||||
this->resetToDefaultValues();
|
||||
ui->cb_Override->setChecked(true);
|
||||
ui->le_TextCodec->setCompleter(new QCompleter(textCodecNames(true, true), this));
|
||||
connect(ui->cb_Override, &QCheckBox::toggled, this, &CFsdSetupForm::enabledToggled);
|
||||
connect(ui->cb_Override, &QCheckBox::toggled, this, &CFsdSetupForm::enabledToggled, Qt::QueuedConnection);
|
||||
connect(ui->pb_SetDefaults, &QPushButton::clicked, this, &CFsdSetupForm::resetToDefaultValues);
|
||||
}
|
||||
|
||||
@@ -90,6 +90,11 @@ namespace BlackGui
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_FastPositionSend, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_GndFlagReceive, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_GndFlagSend, readonly);
|
||||
|
||||
if (readonly && ui->cb_Override->isChecked())
|
||||
{
|
||||
ui->cb_Override->setChecked(false);
|
||||
}
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@ namespace BlackGui
|
||||
|
||||
void CServerForm::setReadOnly(bool readOnly)
|
||||
{
|
||||
ui->form_ServerFsd->setReadOnly(readOnly);
|
||||
ui->form_Voice->setReadOnly(readOnly);
|
||||
|
||||
ui->le_NetworkId->setReadOnly(readOnly);
|
||||
ui->le_RealName->setReadOnly(readOnly);
|
||||
ui->le_Name->setReadOnly(readOnly);
|
||||
@@ -92,7 +95,6 @@ namespace BlackGui
|
||||
ui->le_Address->setReadOnly(readOnly);
|
||||
ui->le_Port->setReadOnly(readOnly);
|
||||
ui->le_Password->setReadOnly(readOnly);
|
||||
ui->form_ServerFsd->setReadOnly(readOnly);
|
||||
ui->cb_ServerType->setEnabled(!readOnly);
|
||||
ui->cbp_Ecosystem->setEnabled(!readOnly);
|
||||
this->forceStyleSheetUpdate();
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace BlackGui
|
||||
QIntValidator *v = new QIntValidator(0, 65535, ui->le_VatsimUdpPort);
|
||||
ui->le_VatsimUdpPort->setValidator(v);
|
||||
this->resetToDefaultValues();
|
||||
connect(ui->cb_Override, &QCheckBox::toggled, this, &CVoiceSetupForm::enabledToggled);
|
||||
connect(ui->cb_Override, &QCheckBox::toggled, this, &CVoiceSetupForm::enabledToggled, Qt::QueuedConnection);
|
||||
connect(ui->pb_SetDefaults, &QPushButton::clicked, this, &CVoiceSetupForm::resetToDefaultValues);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,10 @@ namespace BlackGui
|
||||
{
|
||||
ui->pb_SetDefaults->setEnabled(!readonly);
|
||||
ui->le_VatsimUdpPort->setReadOnly(readonly);
|
||||
if (readonly && ui->cb_Override->isChecked())
|
||||
{
|
||||
ui->cb_Override->setChecked(false);
|
||||
}
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user