9 #include <QDialogButtonBox>
11 #include "ui_simulatorxplaneconfigwindow.h"
18 using namespace swift::core::context;
20 using namespace swift::misc::simulation::settings;
21 using namespace swift::misc::simulation::xplane;
23 namespace swift::simplugin::xplane
25 CSimulatorXPlaneConfigWindow::CSimulatorXPlaneConfigWindow(QWidget *parent)
29 ui->comp_SettingsXSwiftBus->setDefaultP2PAddress(
30 m_xSwiftBusServerSettings.
getDefault().getDBusServerAddressQt());
31 CGuiUtility::disableMinMaxCloseButtons(
this);
34 ui->sb_MaxAircraft->setMaximum(defaultSettings.
getMaxPlanes() * 2);
41 connect(ui->bb_OkCancel, &QDialogButtonBox::accepted,
this, &CSimulatorXPlaneConfigWindow::onSettingsAccepted);
42 connect(ui->bb_OkCancel, &QDialogButtonBox::rejected,
this, &CSimulatorXPlaneConfigWindow::close);
47 void CSimulatorXPlaneConfigWindow::onSettingsAccepted()
55 m_xSwiftBusServerSettings.
set(changed);
89 marginToInt(ui->le_MsgBoxMarginsLeft->text(), 20), marginToInt(ui->le_MsgBoxMarginsTop->text(), 20),
90 marginToInt(ui->le_MsgBoxMarginsRight->text(), 20), marginToInt(ui->le_MsgBoxMarginsBottom->text(), 20),
91 ui->sb_MessageBoxLines->value(), ui->sb_MessageBoxDuration->value(), ui->cs_ColorFreq->getColor().packed(),
92 ui->cs_ColorPriv->getColor().packed(), ui->cs_ColorServ->getColor().packed(),
93 ui->cs_ColorStat->getColor().packed(), ui->cs_ColorSup->getColor().packed());
104 ui->cs_LabelColor->setColor(CRgbColor::fromPacked(settings.
getLabelColor()));
113 for (
int i = 0; i < ui->cb_NightTextureMode->count(); i++)
115 if (ui->cb_NightTextureMode->itemText(i).startsWith(s, Qt::CaseInsensitive))
117 ui->cb_NightTextureMode->setCurrentIndex(i);
124 if (values.size() >= 6)
127 ui->le_MsgBoxMarginsLeft->setText(QString::number(values[0]));
128 ui->le_MsgBoxMarginsTop->setText(QString::number(values[1]));
129 ui->le_MsgBoxMarginsRight->setText(QString::number(values[2]));
130 ui->le_MsgBoxMarginsBottom->setText(QString::number(values[3]));
131 ui->sb_MessageBoxLines->setValue(values[4]);
132 ui->sb_MessageBoxDuration->setValue(values[5]);
134 if (values.size() >= 11)
137 ui->cs_ColorFreq->setColor(CRgbColor::fromPacked(values[6]));
138 ui->cs_ColorPriv->setColor(CRgbColor::fromPacked(values[7]));
139 ui->cs_ColorServ->setColor(CRgbColor::fromPacked(values[8]));
140 ui->cs_ColorStat->setColor(CRgbColor::fromPacked(values[9]));
141 ui->cs_ColorSup->setColor(CRgbColor::fromPacked(values[10]));
145 void CSimulatorXPlaneConfigWindow::onSettingsChanged() { this->setUiValues(m_xSwiftBusServerSettings.
get()); }
147 int CSimulatorXPlaneConfigWindow::marginToInt(
const QString &text,
int defaultValue)
149 if (text.isEmpty()) {
return defaultValue; }
151 const int v = text.toInt(&ok);
152 return ok ? v : defaultValue;
bool isShuttingDown() const
Is application shutting down?
const context::IContextSimulator * getIContextSimulator() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isSimulatorSimulating() const
Is available simulator simulating? Returns false if no simulator is available.
Base class for plugin config window.
CStatusMessage set(const T &value, qint64 timestamp=0)
Write a new value. Must be called from the thread in which the owner lives.
const T & getThreadLocal() const
Read the current value.
T get() const
Get a copy of the current value.
auto getDefault() const
Gets the default value.
void setDBusServerAddressQt(const QString &dBusAddress)
Set DBus server.
void setNightTextureModeQt(const QString &nightTexture)
The the night texture mode.
QString getDBusServerAddressQt() const
DBus server.
QString getNightTextureModeQt() const
The the night texture mode.
bool isDrawingLabels() const
Get whether the plugin draws type and callsign labels above aircraft.
void setBundlingTaxiAndLandingLights(bool bundle)
Bundle taxi and landing lights.
std::vector< int > getMessageBoxValuesVector() const
Left, top, right, bottom, lines, duration, color(freq, priv, serv, stat, sup)
int getLabelColor() const
Get the color to draw the callsign labels above aircraft.
bool setMaxPlanes(int planes)
Set the maximum number of aircraft.
double getMaxDrawDistanceNM() const
Set the maximum distance at which to draw aircraft (nautical miles).
void setTerrainProbeEnabled(bool enabled)
Terrain probe to query ground elevation enabled?
void setDrawingLabels(bool drawing)
Set whether the plugin draws type and callsign labels above aircraft.
bool isTerrainProbeEnabled() const
Terrain probe to query ground elevation enabled?
bool isLogRenderPhases() const
Debug messages?
int getFollowAircraftDistanceM() const
Get follow aircraft distance.
void setTcasEnabled(bool tcas)
TCAS functionality?
void setLogRenderPhases(bool log)
Debug messages?
bool isBundlingTaxiAndLandingLights() const
Bundle taxi and landing lights.
bool isTcasEnabled() const
TCAS functionality?
bool setMaxDrawDistanceNM(double nauticalMiles)
Set the maximum distance at which to draw aircraft (nautical miles).
int getMaxPlanes() const
Get the maximum number of aircraft.
void setMessageBoxValues(const std::string &positions)
Left, top, right, bottom, lines, duration, color(freq, priv, serv, stat, sup)
bool setFollowAircraftDistanceM(int meters)
Set follow aircraft distance.
void setLabelColor(int rgb)
Set the color to draw the callsign labels above aircraft.
xswiftbus configuration file writer
void updateInAllXPlaneVersions()
Update xswiftbus.conf in all known X-Plane versions (XP9 - XP11 are supported)
void setTcasEnabled(bool on)
Set TCAS on/off.
void setDebugMode(bool on)
Set debug on/off.
void setDBusAddress(const QString &dBusAddress)
Set new DBus address.
A window that shows all the X-Plane plugin options.
virtual ~CSimulatorXPlaneConfigWindow()
Dtor.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Free functions in swift::misc.