diff --git a/src/blackmisc/rgbcolor.cpp b/src/blackmisc/rgbcolor.cpp index b42b28420..5c9186c76 100644 --- a/src/blackmisc/rgbcolor.cpp +++ b/src/blackmisc/rgbcolor.cpp @@ -132,6 +132,17 @@ namespace BlackMisc return withHash ? u'#' % h : h; } + int CRgbColor::packed() const + { + if (!isValid()) { return 0; } + return static_cast(toQColor().rgb() & qRgba(255, 255, 255, 0)); + } + + CRgbColor CRgbColor::fromPacked(int rgb) + { + return { qRed(rgb), qGreen(rgb), qBlue(rgb) }; + } + void CRgbColor::setByString(const QString &color, bool isName) { if (color.isEmpty()) { return; } diff --git a/src/blackmisc/rgbcolor.h b/src/blackmisc/rgbcolor.h index 1935a7af4..0931e74e1 100644 --- a/src/blackmisc/rgbcolor.h +++ b/src/blackmisc/rgbcolor.h @@ -86,6 +86,12 @@ namespace BlackMisc //! Hex value QString hex(bool withHash = false) const; + //! Value packed in 24 bit integer + int packed() const; + + //! Construct from packed 24 bit integer value + static CRgbColor fromPacked(int rgb); + //! Hex or color name void setByString(const QString &color, bool isName = false); diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp index 0a3436538..acda51b19 100644 --- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp +++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp @@ -82,6 +82,7 @@ namespace BlackSimPlugin s.setMaxPlanes(ui->sb_MaxAircraft->value()); s.setFollowAircraftDistanceM(ui->sb_FollowAircraftDistanceM->value()); s.setDrawingLabels(ui->cb_DrawLabels->isChecked()); + s.setLabelColor(ui->cs_LabelColor->getColor().packed()); s.setNightTextureModeQt(ui->cb_NightTextureMode->currentText()); s.setBundlingTaxiAndLandingLights(ui->cb_BundleTaxiLandingLights->isChecked()); s.setTcasEnabled(ui->cb_TcasEnabled->isChecked()); @@ -95,7 +96,12 @@ namespace BlackSimPlugin marginToInt(ui->le_MsgBoxMarginsRight->text(), 20), marginToInt(ui->le_MsgBoxMarginsBottom->text(), 20), ui->sb_MessageBoxLines->value(), - ui->sb_MessageBoxDuration->value() + ui->sb_MessageBoxDuration->value(), + ui->cs_ColorFreq->getColor().packed(), + ui->cs_ColorPriv->getColor().packed(), + ui->cs_ColorServ->getColor().packed(), + ui->cs_ColorStat->getColor().packed(), + ui->cs_ColorSup->getColor().packed() ); return s; } @@ -107,6 +113,7 @@ namespace BlackSimPlugin ui->sb_FollowAircraftDistanceM->setValue(settings.getFollowAircraftDistanceM()); ui->ds_MaxDrawDistanceNM->setValue(settings.getMaxDrawDistanceNM()); ui->cb_DrawLabels->setChecked(settings.isDrawingLabels()); + ui->cs_LabelColor->setColor(CRgbColor::fromPacked(settings.getLabelColor())); ui->cb_BundleTaxiLandingLights->setChecked(settings.isBundlingTaxiAndLandingLights()); ui->cb_TcasEnabled->setChecked(settings.isTcasEnabled()); ui->cb_TerrainProbeEnabled->setChecked(settings.isTerrainProbeEnabled()); @@ -128,7 +135,7 @@ namespace BlackSimPlugin const std::vector values = settings.getMessageBoxValuesVector(); if (values.size() >= 6) { - // left, top, right, bottom, height + // left, top, right, bottom, height, duration ui->le_MsgBoxMarginsLeft->setText(QString::number(values[0])); ui->le_MsgBoxMarginsTop->setText(QString::number(values[1])); ui->le_MsgBoxMarginsRight->setText(QString::number(values[2])); @@ -136,6 +143,15 @@ namespace BlackSimPlugin ui->sb_MessageBoxLines->setValue(values[4]); ui->sb_MessageBoxDuration->setValue(values[5]); } + if (values.size() >= 11) + { + // freq, priv, serv, stat, sup + ui->cs_ColorFreq->setColor(CRgbColor::fromPacked(values[6])); + ui->cs_ColorPriv->setColor(CRgbColor::fromPacked(values[7])); + ui->cs_ColorServ->setColor(CRgbColor::fromPacked(values[8])); + ui->cs_ColorStat->setColor(CRgbColor::fromPacked(values[9])); + ui->cs_ColorSup->setColor(CRgbColor::fromPacked(values[10])); + } } void CSimulatorXPlaneConfigWindow::onSettingsChanged() diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui index 48cca9590..f7871ac5e 100644 --- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui +++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui @@ -135,55 +135,65 @@ + + + Label color + + + + + + + Bundle lights - + bundle taxi and landing lights - + TCAS - + show traffic on TCAS - + Logging - + log.render phases - + Message box - + @@ -214,14 +224,14 @@ - + Box disappears after - + ms @@ -237,14 +247,14 @@ - + Box margins px. - + @@ -318,14 +328,79 @@ - + + + + Message colors + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + Freq + + + + + + + Priv + + + + + + + Serv + + + + + + + Sup + + + + + + + Sup + + + + + + + Night texture - + @@ -344,14 +419,14 @@ - + Terrain probe - + probe to determine ground elevation @@ -393,12 +468,18 @@
blackgui/components/dbusserveraddressselector.h
1 + + BlackGui::Components::CColorSelector + QFrame +
blackgui/components/colorselector.h
+
sb_MaxAircraft ds_MaxDrawDistanceNM sb_FollowAircraftDistanceM cb_DrawLabels + cs_LabelColor cb_BundleTaxiLandingLights cb_TcasEnabled cb_LogRenderPhases @@ -407,6 +488,11 @@ le_MsgBoxMarginsBottom le_MsgBoxMarginsLeft le_MsgBoxMarginsRight + cs_ColorFreq + cs_ColorPriv + cs_ColorServ + cs_ColorStat + cs_ColorSup cb_NightTextureMode