Ref T659, display mode in overview and allow to properly close the dialog

This commit is contained in:
Klaus Basan
2019-08-06 20:11:53 +02:00
committed by Mat Sutcliffe
parent daf927223a
commit 04812581ea
4 changed files with 57 additions and 16 deletions

View File

@@ -30,6 +30,9 @@ namespace BlackGui
connect(ui->comp_LoginComponent, &CLoginAdvComponent::loginOrLogoffCancelled, this, &CLoginDialog::onLoginOrLogoffCancelled); connect(ui->comp_LoginComponent, &CLoginAdvComponent::loginOrLogoffCancelled, this, &CLoginDialog::onLoginOrLogoffCancelled);
connect(ui->comp_LoginComponent, &CLoginAdvComponent::requestNetworkSettings, this, &CLoginDialog::onRequestNetworkSettings); connect(ui->comp_LoginComponent, &CLoginAdvComponent::requestNetworkSettings, this, &CLoginDialog::onRequestNetworkSettings);
connect(ui->comp_LoginOverviewComponent, &CLoginOverviewComponent::closeOverview, this, &CLoginDialog::close);
connect(ui->comp_LoginOverviewComponent, &CLoginOverviewComponent::loginOrLogoffSuccessful, this, &CLoginDialog::onLoginOrLogoffCancelled);
if (sGui && sGui->getIContextNetwork()) if (sGui && sGui->getIContextNetwork())
{ {
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CLoginDialog::onNetworkStatusChanged, Qt::QueuedConnection); connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CLoginDialog::onNetworkStatusChanged, Qt::QueuedConnection);
@@ -61,6 +64,10 @@ namespace BlackGui
{ {
ui->comp_LoginOverviewComponent->showCurrentValues(); ui->comp_LoginOverviewComponent->showCurrentValues();
} }
else
{
ui->comp_LoginComponent->resetState();
}
} }
ui->comp_LoginComponent->setVisible(!connected); ui->comp_LoginComponent->setVisible(!connected);

View File

@@ -80,8 +80,8 @@ namespace BlackGui
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CLoginOverviewComponent::loginCancelled, Qt::QueuedConnection); connect(ui->pb_Cancel, &QPushButton::clicked, this, &CLoginOverviewComponent::cancel, Qt::QueuedConnection);
connect(ui->pb_Ok, &QPushButton::clicked, this, &CLoginOverviewComponent::toggleNetworkConnection, Qt::QueuedConnection); connect(ui->pb_Disconnect, &QPushButton::clicked, this, &CLoginOverviewComponent::toggleNetworkConnection, Qt::QueuedConnection);
// overlay // overlay
this->setOverlaySizeFactors(0.8, 0.5); this->setOverlaySizeFactors(0.8, 0.5);
@@ -113,10 +113,10 @@ namespace BlackGui
ui->cb_AutoLogoff->setChecked(autoLogoff); ui->cb_AutoLogoff->setChecked(autoLogoff);
} }
void CLoginOverviewComponent::loginCancelled() void CLoginOverviewComponent::cancel()
{ {
this->closeOverlay(); this->closeOverlay();
emit this->loginOrLogoffCancelled(); emit this->closeOverview();
} }
void CLoginOverviewComponent::toggleNetworkConnection() void CLoginOverviewComponent::toggleNetworkConnection()
@@ -149,7 +149,7 @@ namespace BlackGui
} }
else else
{ {
emit this->loginOrLogoffCancelled(); emit this->cancel();
} }
} }
@@ -158,7 +158,9 @@ namespace BlackGui
if (!this->hasValidContexts()) { return; } if (!this->hasValidContexts()) { return; }
const CServer server = sGui->getIContextNetwork()->getConnectedServer(); const CServer server = sGui->getIContextNetwork()->getConnectedServer();
ui->form_Server->setServer(server); ui->form_Server->setServer(server);
ui->form_Server->resetToFirstTab();
ui->form_Pilot->setUser(server.getUser()); ui->form_Pilot->setUser(server.getUser());
ui->le_LoginMode->setText(sGui->getIContextNetwork()->getLoginModeAsString());
ui->comp_NetworkAircraft->showValues(); ui->comp_NetworkAircraft->showValues();
} }

View File

@@ -76,16 +76,13 @@ namespace BlackGui
void loginOrLogoffSuccessful(); void loginOrLogoffSuccessful();
//! Cancelled //! Cancelled
void loginOrLogoffCancelled(); void closeOverview();
//! Relevant login data changed (digest version)
void loginDataChangedDigest();
private: private:
// -------------- others ----------------- // -------------- others -----------------
//! Login cancelled //! Login cancelled
void loginCancelled(); void cancel();
//! Auto-logoff detection //! Auto-logoff detection
void autoLogoffDetection(); void autoLogoffDetection();
@@ -106,7 +103,6 @@ namespace BlackGui
static constexpr int LogoffIntervalSeconds = 20; //!< time before logoff static constexpr int LogoffIntervalSeconds = 20; //!< time before logoff
QScopedPointer<Ui::CLoginOverviewComponent> ui; QScopedPointer<Ui::CLoginOverviewComponent> ui;
BlackMisc::CDigestSignal m_changedLoginDataDigestSignal { this, &CLoginOverviewComponent::loginDataChangedDigest, 1500, 10 };
BlackCore::Data::CNetworkSetup m_networkSetup; //!< servers last used BlackCore::Data::CNetworkSetup m_networkSetup; //!< servers last used
}; };
} // namespace } // namespace

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>295</width> <width>295</width>
<height>264</height> <height>316</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -60,6 +60,41 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="gb_LoginMode">
<property name="title">
<string>Login mode</string>
</property>
<layout class="QFormLayout" name="fl_LoginMode">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lbl_LoginMode">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_LoginMode">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="gb_MatchingLog"> <widget class="QGroupBox" name="gb_MatchingLog">
<property name="title"> <property name="title">
@@ -217,9 +252,9 @@
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QPushButton" name="pb_Ok"> <widget class="QPushButton" name="pb_Disconnect">
<property name="text"> <property name="text">
<string>ok</string> <string>disconnect</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -265,9 +300,10 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>form_Pilot</tabstop> <tabstop>le_LoginMode</tabstop>
<tabstop>gb_OwnAircraft</tabstop>
<tabstop>cb_AutoLogoff</tabstop> <tabstop>cb_AutoLogoff</tabstop>
<tabstop>pb_Ok</tabstop> <tabstop>pb_Disconnect</tabstop>
<tabstop>pb_Cancel</tabstop> <tabstop>pb_Cancel</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>