mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Ref T709, UI for settings "lights" and "message box margins"
This commit is contained in:
committed by
Mat Sutcliffe
parent
0da1881003
commit
23d29e1f33
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -68,6 +69,17 @@ namespace BlackSimPlugin
|
|||||||
s.setFollowAircraftDistanceM(ui->sb_FollowAircraftDistanceM->value());
|
s.setFollowAircraftDistanceM(ui->sb_FollowAircraftDistanceM->value());
|
||||||
s.setDrawingLabels(ui->cb_DrawLabels->isChecked());
|
s.setDrawingLabels(ui->cb_DrawLabels->isChecked());
|
||||||
s.setNightTextureModeQt(ui->cb_NightTextureMode->currentText());
|
s.setNightTextureModeQt(ui->cb_NightTextureMode->currentText());
|
||||||
|
s.setBundlingTaxiAndLandingLights(ui->cb_BundleTaxiLandingLights->isChecked());
|
||||||
|
|
||||||
|
// left, top, right, bottom, height
|
||||||
|
s.setMessageBoxValues(
|
||||||
|
marginToInt(ui->le_MsgBoxMarginsLeft->text(), 20),
|
||||||
|
marginToInt(ui->le_MsgBoxMarginsTop->text(), 20),
|
||||||
|
marginToInt(ui->le_MsgBoxMarginsRight->text(), 20),
|
||||||
|
marginToInt(ui->le_MsgBoxMarginsBottom->text(), 20),
|
||||||
|
ui->sb_MessageBoxLines->value(),
|
||||||
|
ui->sb_MessageBoxDuration->value()
|
||||||
|
);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +90,7 @@ namespace BlackSimPlugin
|
|||||||
ui->sb_FollowAircraftDistanceM->setValue(settings.getFollowAircraftDistanceM());
|
ui->sb_FollowAircraftDistanceM->setValue(settings.getFollowAircraftDistanceM());
|
||||||
ui->cb_DrawLabels->setChecked(settings.isDrawingLabels());
|
ui->cb_DrawLabels->setChecked(settings.isDrawingLabels());
|
||||||
ui->ds_MaxDrawDistanceNM->setValue(settings.getMaxDrawDistanceNM());
|
ui->ds_MaxDrawDistanceNM->setValue(settings.getMaxDrawDistanceNM());
|
||||||
|
ui->cb_BundleTaxiLandingLights->setChecked(settings.isBundlingTaxiAndLandingLights());
|
||||||
|
|
||||||
const QString s = settings.getNightTextureModeQt().left(1);
|
const QString s = settings.getNightTextureModeQt().left(1);
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
@@ -91,11 +104,31 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector<int> values = settings.getMessageBoxValuesVector();
|
||||||
|
if (values.size() >= 6)
|
||||||
|
{
|
||||||
|
// left, top, right, bottom, height
|
||||||
|
ui->le_MsgBoxMarginsLeft->setText(QString::number(values[0]));
|
||||||
|
ui->le_MsgBoxMarginsTop->setText(QString::number(values[1]));
|
||||||
|
ui->le_MsgBoxMarginsRight->setText(QString::number(values[2]));
|
||||||
|
ui->le_MsgBoxMarginsBottom->setText(QString::number(values[3]));
|
||||||
|
ui->sb_MessageBoxLines->setValue(values[4]);
|
||||||
|
ui->sb_MessageBoxDuration->setValue(values[5]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorXPlaneConfigWindow::onSettingsChanged()
|
void CSimulatorXPlaneConfigWindow::onSettingsChanged()
|
||||||
{
|
{
|
||||||
this->setUiValues(m_xSwiftBusServerSettings.get());
|
this->setUiValues(m_xSwiftBusServerSettings.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CSimulatorXPlaneConfigWindow::marginToInt(const QString &text, int defaultValue)
|
||||||
|
{
|
||||||
|
if (text.isEmpty()) { return defaultValue; }
|
||||||
|
bool ok;
|
||||||
|
const int v = text.toInt(&ok);
|
||||||
|
return ok ? v : defaultValue;
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -37,18 +37,21 @@ namespace BlackSimPlugin
|
|||||||
virtual ~CSimulatorXPlaneConfigWindow() override;
|
virtual ~CSimulatorXPlaneConfigWindow() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Settings have been accepted
|
|
||||||
void onSettingsAccepted();
|
|
||||||
|
|
||||||
//! Settings from UI
|
//! Settings from UI
|
||||||
BlackMisc::Simulation::Settings::CXSwiftBusSettings getSettingsFromUI() const;
|
BlackMisc::Simulation::Settings::CXSwiftBusSettings getSettingsFromUI() const;
|
||||||
|
|
||||||
//! Set settings
|
//! Set settings
|
||||||
void setUiValues(const BlackMisc::Simulation::Settings::CXSwiftBusSettings &settings);
|
void setUiValues(const BlackMisc::Simulation::Settings::CXSwiftBusSettings &settings);
|
||||||
|
|
||||||
|
//! Settings have been accepted
|
||||||
|
void onSettingsAccepted();
|
||||||
|
|
||||||
//! Settings changed
|
//! Settings changed
|
||||||
void onSettingsChanged();
|
void onSettingsChanged();
|
||||||
|
|
||||||
|
//! Margin value to int
|
||||||
|
static int marginToInt(const QString &text, int defaultValue);
|
||||||
|
|
||||||
QScopedPointer<Ui::CSimulatorXPlaneConfigWindow> ui;
|
QScopedPointer<Ui::CSimulatorXPlaneConfigWindow> ui;
|
||||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TXSwiftBusSettings> m_xSwiftBusServerSettings { this, &CSimulatorXPlaneConfigWindow::onSettingsChanged };
|
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TXSwiftBusSettings> m_xSwiftBusServerSettings { this, &CSimulatorXPlaneConfigWindow::onSettingsChanged };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>300</width>
|
<width>300</width>
|
||||||
<height>325</height>
|
<height>450</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>300</width>
|
<width>300</width>
|
||||||
<height>200</height>
|
<height>425</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
@@ -82,28 +82,28 @@
|
|||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="1" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="lbl_MaxAircraft">
|
<widget class="QLabel" name="lbl_MaxAircraft">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Max.aircraft</string>
|
<string>Max.aircraft</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="sb_MaxAircraft">
|
<widget class="QSpinBox" name="sb_MaxAircraft">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>250</number>
|
<number>250</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lbl_MaxDistance">
|
<widget class="QLabel" name="lbl_MaxDistance">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Max.distance</string>
|
<string>Max.distance</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="ds_MaxDrawDistanceNM">
|
<widget class="QDoubleSpinBox" name="ds_MaxDrawDistanceNM">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string>NM</string>
|
<string>NM</string>
|
||||||
@@ -113,28 +113,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="lbl_Labels">
|
|
||||||
<property name="text">
|
|
||||||
<string>Labels</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QCheckBox" name="cb_DrawLabels">
|
|
||||||
<property name="text">
|
|
||||||
<string>draw labels</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_FollowAircraftDistance">
|
<widget class="QLabel" name="lbl_FollowAircraftDistance">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Follow aircraft distance</string>
|
<string>Follow acft. distance</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="sb_FollowAircraftDistanceM">
|
<widget class="QSpinBox" name="sb_FollowAircraftDistanceM">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string>m</string>
|
<string>m</string>
|
||||||
@@ -144,7 +130,177 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_Labels">
|
||||||
|
<property name="text">
|
||||||
|
<string>Labels</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QCheckBox" name="cb_DrawLabels">
|
||||||
|
<property name="text">
|
||||||
|
<string>draw labels</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_BundleLights">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bundle lights</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QCheckBox" name="cb_BundleTaxiLandingLights">
|
||||||
|
<property name="text">
|
||||||
|
<string>bundle taxi and landing lights</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_MessageBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Message box </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
|
<widget class="QWidget" name="wi_MessageBox" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="hl_MessageBox">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="sb_MessageBoxLines">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> lines</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="sb_MessageBoxDuration">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>ms</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>25000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>250</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_MessageBoxMargins">
|
||||||
|
<property name="text">
|
||||||
|
<string>Box margins px.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QWidget" name="wi_Margins" native="true">
|
||||||
|
<layout class="QGridLayout" name="gl_MessageBoxMargins">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="lbl_MarginsLeft">
|
||||||
|
<property name="text">
|
||||||
|
<string>left</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_MsgBoxMarginsBottom">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>bottom</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_MarginsTop">
|
||||||
|
<property name="text">
|
||||||
|
<string>top</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="lbl_MarginsBottom">
|
||||||
|
<property name="text">
|
||||||
|
<string>bottom</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLineEdit" name="le_MsgBoxMarginsTop">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>top</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLineEdit" name="le_MsgBoxMarginsRight">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>right</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLineEdit" name="le_MsgBoxMarginsLeft">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>left</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLabel" name="lbl_MarginsRight">
|
||||||
|
<property name="text">
|
||||||
|
<string>right</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_NightTextureMode">
|
||||||
|
<property name="text">
|
||||||
|
<string>Night texture</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
<widget class="QComboBox" name="cb_NightTextureMode">
|
<widget class="QComboBox" name="cb_NightTextureMode">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -163,16 +319,22 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_NightTextureMode">
|
|
||||||
<property name="text">
|
|
||||||
<string>Night texture</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="vs_Buutons">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
@@ -188,6 +350,14 @@
|
|||||||
<tabstop>ds_MaxDrawDistanceNM</tabstop>
|
<tabstop>ds_MaxDrawDistanceNM</tabstop>
|
||||||
<tabstop>sb_FollowAircraftDistanceM</tabstop>
|
<tabstop>sb_FollowAircraftDistanceM</tabstop>
|
||||||
<tabstop>cb_DrawLabels</tabstop>
|
<tabstop>cb_DrawLabels</tabstop>
|
||||||
|
<tabstop>cb_BundleTaxiLandingLights</tabstop>
|
||||||
|
<tabstop>sb_MessageBoxLines</tabstop>
|
||||||
|
<tabstop>sb_MessageBoxDuration</tabstop>
|
||||||
|
<tabstop>le_MsgBoxMarginsTop</tabstop>
|
||||||
|
<tabstop>le_MsgBoxMarginsBottom</tabstop>
|
||||||
|
<tabstop>le_MsgBoxMarginsLeft</tabstop>
|
||||||
|
<tabstop>le_MsgBoxMarginsRight</tabstop>
|
||||||
|
<tabstop>cb_NightTextureMode</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
Reference in New Issue
Block a user