mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T225, force stylesheet in CForm base class and used by all forms
* Allows to use stylesheet attributes like [readonly] * changing to "readonly" applies correct stylesheet
This commit is contained in:
@@ -190,6 +190,8 @@ namespace BlackGui
|
||||
ui->cb_Rank->setEnabled(!readOnly);
|
||||
ui->drop_DropData->setVisible(!readOnly);
|
||||
ui->combined_TypeSelector->setReadOnly(readOnly);
|
||||
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CAircraftIcaoForm::setSelectOnly()
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace BlackGui
|
||||
ui->editor_AircraftIcao->setReadOnly(readOnly);
|
||||
ui->editor_Distributor->setReadOnly(readOnly);
|
||||
ui->editor_Livery->setReadOnly(readOnly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CAircraftModelForm::setSelectOnly()
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
|
||||
using namespace BlackGui;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
@@ -46,6 +45,7 @@ namespace BlackGui
|
||||
{
|
||||
CGuiUtility::childrenSetEnabled<QPushButton>(this, !readonly);
|
||||
CGuiUtility::checkBoxesReadOnly(this, readonly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CAircraftPartsForm::setSelectOnly()
|
||||
|
||||
@@ -133,6 +133,8 @@ namespace BlackGui
|
||||
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Va, readOnly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Military, readOnly);
|
||||
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CAirlineIcaoForm::setSelectOnly()
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace BlackGui
|
||||
ui->cbp_ComPanelTransponderMode->setDisabled(!readonly);
|
||||
ui->tb_ComPanelCom1Toggle->setEnabled(!readonly);
|
||||
ui->tb_ComPanelCom2Toggle->setEnabled(!readonly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CCockpitComForm::setSelectOnly()
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace BlackGui
|
||||
ui->le_Location->setVisible(!readonly); // does not make sense to show it in ro, no reverse lookup
|
||||
ui->lbl_Location->setVisible(!readonly);
|
||||
|
||||
CGuiUtility::forceStyleSheetUpdate(this);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CCoordinateForm::setSelectOnly()
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
*/
|
||||
|
||||
#include "blackgui/components/dbdistributorselectorcomponent.h"
|
||||
#include "blackgui/dropsite.h"
|
||||
#include "blackgui/editors/distributorform.h"
|
||||
#include "blackgui/editors/validationindicator.h"
|
||||
#include "blackgui/labelandicon.h"
|
||||
#include "blackgui/dropsite.h"
|
||||
#include "blackmisc/compare.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
@@ -107,6 +107,7 @@ namespace BlackGui
|
||||
ui->le_Description->setReadOnly(readOnly);
|
||||
ui->distributor_Selector->setReadOnly(readOnly);
|
||||
ui->drop_DropData->setVisible(!readOnly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CDistributorForm::setSelectOnly()
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
class QWidget;
|
||||
namespace Ui { class CDistributorForm; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "blackgui/editors/form.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QShortcut>
|
||||
@@ -48,6 +49,11 @@ namespace BlackGui
|
||||
this->jsonPasted(data);
|
||||
}
|
||||
|
||||
void CForm::forceStyleSheetUpdate()
|
||||
{
|
||||
CGuiUtility::forceStyleSheetUpdate(this);
|
||||
}
|
||||
|
||||
CFormDbUser::CFormDbUser(QWidget *parent) : CForm(parent)
|
||||
{ }
|
||||
|
||||
|
||||
@@ -59,6 +59,9 @@ namespace BlackGui
|
||||
//! Pasted from clipboard
|
||||
void pasted();
|
||||
|
||||
//! \copydoc BlackGui::CGuiUtility::forceStyleSheetUpdate
|
||||
void forceStyleSheetUpdate();
|
||||
|
||||
bool m_readOnly = false; //!< read only
|
||||
};
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace BlackGui
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_AircraftPartsSend, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_FastPositionReceive, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_FastPositionSend, readonly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
CStatusMessageList CFsdSetupForm::validate(bool nested) const
|
||||
|
||||
@@ -184,6 +184,7 @@ namespace BlackGui
|
||||
ui->drop_DropData->setVisible(!readOnly);
|
||||
ui->tb_Paste->setVisible(!readOnly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Military, readOnly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CLiveryForm::setSelectOnly()
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace BlackGui
|
||||
ui->le_Description->setReadOnly(readOnly);
|
||||
ui->le_ModelKey->setReadOnly(readOnly);
|
||||
ui->le_Name->setReadOnly(readOnly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CModelMappingForm::setSelectOnly()
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace BlackGui
|
||||
{
|
||||
// void
|
||||
Q_UNUSED(readOnly);
|
||||
// this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CModelMappingModifyForm::userChanged()
|
||||
|
||||
@@ -36,11 +36,11 @@ namespace BlackGui
|
||||
ui->comp_SimulatorSelector->setMode(CSimulatorSelector::RadioButtons);
|
||||
ui->comp_SimulatorSelector->setLeftMargin(0);
|
||||
|
||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &COwnModelSetForm::ps_simulatorChanged);
|
||||
connect(ui->rb_DisplayAllDistributors, &QRadioButton::clicked, this, &COwnModelSetForm::ps_changeDistributorDisplay);
|
||||
connect(ui->rb_DisplayPreferencesDistributors, &QRadioButton::clicked, this, &COwnModelSetForm::ps_changeDistributorDisplay);
|
||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &COwnModelSetForm::onSimulatorChanged);
|
||||
connect(ui->rb_DisplayAllDistributors, &QRadioButton::clicked, this, &COwnModelSetForm::changeDistributorDisplay);
|
||||
connect(ui->rb_DisplayPreferencesDistributors, &QRadioButton::clicked, this, &COwnModelSetForm::changeDistributorDisplay);
|
||||
|
||||
this->ps_simulatorChanged(ui->comp_SimulatorSelector->getValue());
|
||||
this->onSimulatorChanged(ui->comp_SimulatorSelector->getValue());
|
||||
}
|
||||
|
||||
COwnModelSetForm::~COwnModelSetForm()
|
||||
@@ -88,19 +88,19 @@ namespace BlackGui
|
||||
return ui->cb_ConsolidateModelSet->isChecked();
|
||||
}
|
||||
|
||||
void COwnModelSetForm::ps_preferencesChanged()
|
||||
void COwnModelSetForm::onPreferencesChanged()
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
void COwnModelSetForm::ps_simulatorChanged(const CSimulatorInfo &simulator)
|
||||
void COwnModelSetForm::onSimulatorChanged(const CSimulatorInfo &simulator)
|
||||
{
|
||||
this->setSimulator(simulator);
|
||||
this->reloadData();
|
||||
emit simulatorChanged(simulator);
|
||||
emit this->simulatorChanged(simulator);
|
||||
}
|
||||
|
||||
void COwnModelSetForm::ps_changeDistributorDisplay()
|
||||
void COwnModelSetForm::changeDistributorDisplay()
|
||||
{
|
||||
if (ui->rb_DisplayAllDistributors->isChecked())
|
||||
{
|
||||
@@ -128,7 +128,7 @@ namespace BlackGui
|
||||
{
|
||||
ui->rb_DisplayAllDistributors->setChecked(true);
|
||||
}
|
||||
this->ps_changeDistributorDisplay();
|
||||
this->changeDistributorDisplay();
|
||||
}
|
||||
|
||||
void COwnModelSetForm::setDistributorView(bool hasPreferences)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace BlackGui
|
||||
explicit COwnModelSetForm(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~COwnModelSetForm();
|
||||
virtual ~COwnModelSetForm();
|
||||
|
||||
//! Reload data
|
||||
void reloadData();
|
||||
@@ -90,17 +90,16 @@ namespace BlackGui
|
||||
//! Simulator changed
|
||||
void simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
//! Changed preferences
|
||||
void ps_preferencesChanged();
|
||||
void onPreferencesChanged();
|
||||
|
||||
//! Simulator changed
|
||||
void ps_simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
void onSimulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Display distributors based on checkboxes
|
||||
void ps_changeDistributorDisplay();
|
||||
void changeDistributorDisplay();
|
||||
|
||||
private:
|
||||
//! Init the options which distributors are displayed
|
||||
void initDistributorDisplay();
|
||||
|
||||
@@ -109,7 +108,7 @@ namespace BlackGui
|
||||
|
||||
QScopedPointer<Ui::COwnModelSetForm> ui;
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator;
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TDistributorListPreferences> m_distributorPreferences { this, &COwnModelSetForm::ps_preferencesChanged };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TDistributorListPreferences> m_distributorPreferences { this, &COwnModelSetForm::onPreferencesChanged };
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -116,6 +116,7 @@ namespace BlackGui
|
||||
ui->lblp_HomeAirport->setVisible(!readonly);
|
||||
ui->lblp_Password->setVisible(!readonly);
|
||||
ui->lblp_RealName->setVisible(!readonly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
CStatusMessageList CPilotForm::validate(bool nested) const
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace BlackGui
|
||||
const CUser user(
|
||||
ui->le_NetworkId->text().trimmed(),
|
||||
ui->le_RealName->text().trimmed().simplified(),
|
||||
"",
|
||||
QStringLiteral(""),
|
||||
ui->le_Password->text().trimmed()
|
||||
);
|
||||
const CFsdSetup setup(ui->form_ServerFsd->getValue());
|
||||
@@ -90,6 +90,7 @@ namespace BlackGui
|
||||
ui->form_ServerFsd->setReadOnly(readOnly);
|
||||
ui->cb_ServerType->setEnabled(!readOnly);
|
||||
ui->cbp_Ecosystem->setEnabled(!readOnly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CServerForm::showPasswordField(bool show)
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace BlackGui
|
||||
void CSituationForm::setReadOnly(bool readonly)
|
||||
{
|
||||
ui->comp_Coordinate->setReadOnly(readonly);
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
void CSituationForm::setSelectOnly()
|
||||
|
||||
Reference in New Issue
Block a user