mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #873, UI improvements
* allow to set inner message frame factor (width/height) * fixed aircrft selector to keep selection
This commit is contained in:
committed by
Mathew Sutcliffe
parent
ec23863d53
commit
3afead9f71
@@ -20,6 +20,7 @@
|
||||
#include <QStringList>
|
||||
#include <QWidget>
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -53,6 +54,11 @@ namespace BlackGui
|
||||
return m_aircraft[index].getCallsign();
|
||||
}
|
||||
|
||||
void CRemoteAircraftSelector::indicatePartsEnabled(bool indicate)
|
||||
{
|
||||
m_showPartsEnabled = indicate;
|
||||
}
|
||||
|
||||
void CRemoteAircraftSelector::showEvent(QShowEvent *event)
|
||||
{
|
||||
// force new combobox when visible
|
||||
@@ -80,11 +86,11 @@ namespace BlackGui
|
||||
void CRemoteAircraftSelector::fillComboBox()
|
||||
{
|
||||
if (!this->isVisible()) { return; } // for performance reasons
|
||||
const CCallsign currentSelection(this->getSelectedCallsign());
|
||||
m_aircraft = sGui->getIContextNetwork()->getAircraftInRange();
|
||||
ui->cb_RemoteAircraftSelector->clear();
|
||||
if (m_aircraft.isEmpty()) { return; }
|
||||
|
||||
CCallsign currentSelection(this->getSelectedCallsign());
|
||||
QStringList items;
|
||||
for (const CSimulatedAircraft &aircraft : m_aircraft)
|
||||
{
|
||||
@@ -92,14 +98,20 @@ namespace BlackGui
|
||||
QString i(aircraft.getCallsign().toQString());
|
||||
if (aircraft.hasAircraftDesignator())
|
||||
{
|
||||
i += " (";
|
||||
i += aircraft.getAircraftIcaoCode().toQString(false);
|
||||
i += ")";
|
||||
i += QLatin1Literal(" (") %
|
||||
aircraft.getAircraftIcaoCode().toQString(false) %
|
||||
QLatin1Literal(")");
|
||||
}
|
||||
if (aircraft.hasValidRealName())
|
||||
{
|
||||
i += " - ";
|
||||
i += aircraft.getPilotRealName();
|
||||
i += QLatin1Literal(" - ") % aircraft.getPilotRealName();
|
||||
}
|
||||
if (m_showPartsEnabled)
|
||||
{
|
||||
if (aircraft.isPartsSynchronized())
|
||||
{
|
||||
i += " [parts]";
|
||||
}
|
||||
}
|
||||
items.append(i);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ class QWidget;
|
||||
|
||||
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
|
||||
namespace Ui { class CRemoteAircraftSelector; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
@@ -40,11 +39,14 @@ namespace BlackGui
|
||||
explicit CRemoteAircraftSelector(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CRemoteAircraftSelector();
|
||||
virtual ~CRemoteAircraftSelector();
|
||||
|
||||
//! Selected callsign
|
||||
BlackMisc::Aviation::CCallsign getSelectedCallsign() const;
|
||||
|
||||
//! Indicate if aircraft parts enabled aircraft
|
||||
void indicatePartsEnabled(bool indicate);
|
||||
|
||||
protected:
|
||||
//! \copydoc QWidget::showEvent
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
@@ -59,6 +61,7 @@ namespace BlackGui
|
||||
private:
|
||||
QScopedPointer<Ui::CRemoteAircraftSelector> ui;
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_aircraft;
|
||||
bool m_showPartsEnabled = false;
|
||||
|
||||
//! Set combobox items
|
||||
void fillComboBox();
|
||||
|
||||
Reference in New Issue
Block a user