mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T659, improved handling of override checkbox in FSD details/voice
* the checkbox can be always enabled * or disabled in read only mode
This commit is contained in:
committed by
Mat Sutcliffe
parent
4e9bf35cfc
commit
d546ebdcba
@@ -101,9 +101,11 @@ namespace BlackGui
|
||||
|
||||
ui->form_FsdDetails->showEnableInfo(true);
|
||||
ui->form_FsdDetails->setFsdSetupEnabled(false);
|
||||
ui->form_FsdDetails->setAlwaysAllowOverride(true);
|
||||
|
||||
ui->form_Voice->showEnableInfo(true);
|
||||
ui->form_Voice->setVoiceSetupEnabled(false);
|
||||
ui->form_Voice->setAlwaysAllowOverride(true);
|
||||
|
||||
ui->lblp_AircraftCombinedType->setToolTips("ok", "wrong");
|
||||
ui->lblp_AirlineIcao->setToolTips("ok", "wrong");
|
||||
|
||||
@@ -65,6 +65,16 @@ namespace BlackGui
|
||||
ui->cb_3LetterAirlineICAO->setChecked(setup.force3LetterAirlineCodes());
|
||||
}
|
||||
|
||||
void CFsdSetupForm::setAlwaysAllowOverride(bool allow)
|
||||
{
|
||||
m_alwaysAllowOverride = allow;
|
||||
if (allow)
|
||||
{
|
||||
ui->cb_Override->setEnabled(true);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Override, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool CFsdSetupForm::isFsdSetupEnabled() const
|
||||
{
|
||||
return ui->cb_Override->isChecked();
|
||||
@@ -86,12 +96,20 @@ namespace BlackGui
|
||||
ui->le_TextCodec->setReadOnly(readonly);
|
||||
ui->pb_SetDefaults->setEnabled(!readonly);
|
||||
CGuiUtility::checkBoxesReadOnly(this, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Override, false); // always editable
|
||||
if (m_alwaysAllowOverride)
|
||||
{
|
||||
ui->cb_Override->setEnabled(true);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Override, false);
|
||||
}
|
||||
|
||||
/**
|
||||
if (readonly && ui->cb_Override->isChecked())
|
||||
{
|
||||
// this is no value which will be stored
|
||||
ui->cb_Override->setChecked(false);
|
||||
}
|
||||
**/
|
||||
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,9 @@ namespace BlackGui
|
||||
//! Set to GUI
|
||||
void setValue(const BlackMisc::Network::CFsdSetup &setup);
|
||||
|
||||
//! Allow override even in read only mode
|
||||
void setAlwaysAllowOverride(bool allow);
|
||||
|
||||
//! Enabled?
|
||||
bool isFsdSetupEnabled() const;
|
||||
|
||||
@@ -70,7 +73,8 @@ namespace BlackGui
|
||||
void visibleEnableInfo(bool visible);
|
||||
|
||||
QScopedPointer<Ui::CFsdSetupForm> ui;
|
||||
bool m_visibleEnableInfo = true;
|
||||
bool m_visibleEnableInfo = true;
|
||||
bool m_alwaysAllowOverride = false;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -84,6 +84,11 @@ namespace BlackGui
|
||||
return ui->cb_ServerType->currentData().value<CServer::ServerType>();
|
||||
}
|
||||
|
||||
void CServerForm::resetToFirstTab()
|
||||
{
|
||||
ui->tw_ServerForm->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void CServerForm::setReadOnly(bool readOnly)
|
||||
{
|
||||
ui->form_ServerFsd->setReadOnly(readOnly);
|
||||
|
||||
@@ -47,6 +47,9 @@ namespace BlackGui
|
||||
//! Get currently selected server type
|
||||
BlackMisc::Network::CServer::ServerType getServerType() const;
|
||||
|
||||
//! Reset to 1st tab
|
||||
void resetToFirstTab();
|
||||
|
||||
//! \name Form class implementations
|
||||
//! @{
|
||||
virtual void setReadOnly(bool readonly) override;
|
||||
|
||||
@@ -61,6 +61,16 @@ namespace BlackGui
|
||||
ui->cb_Override->setChecked(enabled);
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::setAlwaysAllowOverride(bool allow)
|
||||
{
|
||||
m_alwaysAllowOverride = allow;
|
||||
if (allow)
|
||||
{
|
||||
ui->cb_Override->setEnabled(true);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Override, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::showEnableInfo(bool visible)
|
||||
{
|
||||
m_visibleEnableInfo = visible;
|
||||
@@ -71,10 +81,21 @@ namespace BlackGui
|
||||
{
|
||||
ui->pb_SetDefaults->setEnabled(!readonly);
|
||||
ui->le_VatsimUdpPort->setReadOnly(readonly);
|
||||
CGuiUtility::checkBoxesReadOnly(this, readonly);
|
||||
if (m_alwaysAllowOverride)
|
||||
{
|
||||
ui->cb_Override->setEnabled(true);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Override, false);
|
||||
}
|
||||
|
||||
/**
|
||||
if (readonly && ui->cb_Override->isChecked())
|
||||
{
|
||||
// this is no value which will be stored
|
||||
ui->cb_Override->setChecked(false);
|
||||
}
|
||||
**/
|
||||
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@ namespace BlackGui
|
||||
//! Set enabled / disabled
|
||||
void setVoiceSetupEnabled(bool enabled);
|
||||
|
||||
//! Allow override even in read only mode
|
||||
void setAlwaysAllowOverride(bool allow);
|
||||
|
||||
//! Show the enable info
|
||||
void showEnableInfo(bool visible);
|
||||
|
||||
@@ -69,7 +72,8 @@ namespace BlackGui
|
||||
void visibleEnableInfo(bool visible);
|
||||
|
||||
QScopedPointer<Ui::CVoiceSetupForm> ui;
|
||||
bool m_visibleEnableInfo = true;
|
||||
bool m_alwaysAllowOverride = false;
|
||||
bool m_visibleEnableInfo = true;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user