Ref T659, login dialog and connected signal/slots with main GUI

This commit is contained in:
Klaus Basan
2019-07-19 03:10:08 +02:00
committed by Mat Sutcliffe
parent 7e4e4f0d37
commit 83e8597b14
6 changed files with 47 additions and 8 deletions

View File

@@ -19,10 +19,29 @@ namespace BlackGui
{
ui->setupUi(this);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(ui->comp_LoginComponent, &CLoginAdvComponent::loginOrLogoffSuccessful, this, &CLoginDialog::onLoginOrLogoffSuccessful);
connect(ui->comp_LoginComponent, &CLoginAdvComponent::loginOrLogoffCancelled, this, &CLoginDialog::onLoginOrLogoffCancelled);
connect(ui->comp_LoginComponent, &CLoginAdvComponent::requestNetworkSettings, this, &CLoginDialog::onRequestNetworkSettings);
}
CLoginDialog::~CLoginDialog()
{ }
void CLoginDialog::onLoginOrLogoffCancelled()
{
this->reject();
}
void CLoginDialog::onLoginOrLogoffSuccessful()
{
this->accept();
}
void CLoginDialog::onRequestNetworkSettings()
{
emit this->requestNetworkSettings();
this->close();
}
} // ns
}// ns

View File

@@ -33,7 +33,15 @@ namespace BlackGui
//! Destructor
virtual ~CLoginDialog() override;
signals:
//! Request server settings
void requestNetworkSettings();
private:
void onLoginOrLogoffCancelled();
void onLoginOrLogoffSuccessful();
void onRequestNetworkSettings();
QScopedPointer<Ui::CLoginDialog> ui;
};

View File

@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
<width>350</width>
<height>500</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>500</height>
</size>
</property>
<property name="windowTitle">
<string>Login dialog</string>
</property>

View File

@@ -254,6 +254,7 @@ void SwiftGuiStd::loginRequested()
if (!connected && shift)
{
if (!m_loginDialog) { m_loginDialog.reset(new CLoginDialog(this)); }
connect(m_loginDialog.data(), &CLoginDialog::requestNetworkSettings, this, &SwiftGuiStd::displayNetworkSettings);
m_loginDialog->show();
}
else
@@ -520,6 +521,13 @@ void SwiftGuiStd::displayLog()
ui->comp_MainInfoArea->displayLog();
}
void SwiftGuiStd::displayNetworkSettings()
{
if (!sApp || sApp->isShuttingDown()) { return; }
this->setMainPageInfoArea(CMainInfoAreaComponent::InfoAreaSettings);
ui->comp_MainInfoArea->getSettingsComponent()->setTab(CSettingsComponent::SettingTabServers);
}
void SwiftGuiStd::onPttChanged(bool enabled)
{
if (!sGui || !sGui->getIContextAudio()) { return; }

View File

@@ -185,6 +185,9 @@ private:
//! Display log
void displayLog();
//! Display network settings
void displayNetworkSettings();
//! Display a reconnect dialog
void displayDBusReconnectDialog();

View File

@@ -237,12 +237,7 @@ void SwiftGuiStd::initGuiSignals()
connect(ui->comp_Login, &CLoginComponent::loginOrLogoffSuccessful, this, &SwiftGuiStd::setMainPageToInfoArea);
connect(ui->comp_Login, &CLoginComponent::loginOrLogoffSuccessful, ui->comp_MainInfoArea->getFlightPlanComponent(), &CFlightPlanComponent::loginDataSet);
connect(ui->comp_Login, &CLoginComponent::loginDataChangedDigest, ui->comp_MainInfoArea->getFlightPlanComponent(), &CFlightPlanComponent::loginDataSet);
connect(ui->comp_Login, &CLoginComponent::requestNetworkSettings, [ this ]()
{
if (!sApp || sApp->isShuttingDown()) { return; }
this->setMainPageInfoArea(CMainInfoAreaComponent::InfoAreaSettings);
ui->comp_MainInfoArea->getSettingsComponent()->setTab(CSettingsComponent::SettingTabServers);
});
connect(ui->comp_Login, &CLoginComponent::requestNetworkSettings, this, &SwiftGuiStd::displayNetworkSettings);
connect(ui->comp_Login, &CLoginComponent::requestLoginPage, [ this ]()
{
if (!sApp || sApp->isShuttingDown()) { return; }