mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Ref T182, show image as overlay (and not as label, which is too small)
This commit is contained in:
@@ -57,7 +57,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CMappingComponent::CMappingComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
COverlayMessagesFrame(parent),
|
||||
CIdentifiable(this),
|
||||
ui(new Ui::CMappingComponent)
|
||||
{
|
||||
@@ -90,10 +90,10 @@ namespace BlackGui
|
||||
|
||||
m_currentMappingsViewDelegate = new CCheckBoxDelegate(":/diagona/icons/diagona/icons/tick.png", ":/diagona/icons/diagona/icons/cross.png", this);
|
||||
ui->tvp_RenderedAircraft->setItemDelegateForColumn(0, m_currentMappingsViewDelegate);
|
||||
this->showKillButton(false);
|
||||
|
||||
// Aircraft previews
|
||||
connect(ui->cb_AircraftIconDisplayed, &QCheckBox::stateChanged, this, &CMappingComponent::ps_onModelPreviewChanged);
|
||||
ui->lbl_AircraftIconDisplayed->setText("[icon]");
|
||||
|
||||
// model string completer
|
||||
ui->completer_ModelStrings->setSourceVisible(CAircraftModelStringCompleter::OwnModels, false);
|
||||
@@ -170,7 +170,7 @@ namespace BlackGui
|
||||
ui->tw_ListViews->tabBar()->setTabText(cm, c);
|
||||
}
|
||||
|
||||
void CMappingComponent::ps_onChangedSimulatedAircraftInView(const BlackMisc::CVariant &object, const BlackMisc::CPropertyIndex &index)
|
||||
void CMappingComponent::ps_onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index)
|
||||
{
|
||||
const CSimulatedAircraft sa = object.to<CSimulatedAircraft>(); // changed in GUI
|
||||
const CSimulatedAircraft saFromBackend = sGui->getIContextNetwork()->getAircraftInRangeForCallsign(sa.getCallsign());
|
||||
@@ -203,23 +203,15 @@ namespace BlackGui
|
||||
|
||||
if (ui->cb_AircraftIconDisplayed->isChecked())
|
||||
{
|
||||
const int MaxHeight = 125;
|
||||
ui->lbl_AircraftIconDisplayed->setText("");
|
||||
ui->lbl_AircraftIconDisplayed->setToolTip(model.getDescription());
|
||||
const QString modelString(model.getModelString());
|
||||
const CPixmap pm = sGui->getIContextSimulator()->iconForModel(modelString);
|
||||
if (pm.isNull())
|
||||
{
|
||||
ui->lbl_AircraftIconDisplayed->setPixmap(CIcons::crossWhite16());
|
||||
this->closeOverlay();
|
||||
}
|
||||
else
|
||||
{
|
||||
QPixmap qpm = pm.pixmap();
|
||||
if (qpm.height() > MaxHeight && !qpm.isNull())
|
||||
{
|
||||
qpm = qpm.scaledToWidth(MaxHeight, Qt::SmoothTransformation);
|
||||
}
|
||||
ui->lbl_AircraftIconDisplayed->setPixmap(qpm);
|
||||
this->showOverlayImage(pm);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -327,18 +319,8 @@ namespace BlackGui
|
||||
|
||||
void CMappingComponent::ps_onModelPreviewChanged(int state)
|
||||
{
|
||||
static const QPixmap empty;
|
||||
Qt::CheckState s = static_cast<Qt::CheckState>(state);
|
||||
if (s == Qt::Unchecked)
|
||||
{
|
||||
ui->lbl_AircraftIconDisplayed->setPixmap(empty);
|
||||
ui->lbl_AircraftIconDisplayed->setText("Icon disabled");
|
||||
}
|
||||
else if (s == Qt::Checked)
|
||||
{
|
||||
ui->lbl_AircraftIconDisplayed->setPixmap(empty);
|
||||
ui->lbl_AircraftIconDisplayed->setText("Icon will go here");
|
||||
}
|
||||
Q_UNUSED(state);
|
||||
this->closeOverlay();
|
||||
}
|
||||
|
||||
void CMappingComponent::ps_onModelsUpdateRequested()
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "blackcore/network.h"
|
||||
#include "blackcore/tokenbucket.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/settings/viewupdatesettings.h"
|
||||
@@ -47,7 +48,7 @@ namespace BlackGui
|
||||
{
|
||||
//! Mappings, models etc.
|
||||
class BLACKGUI_EXPORT CMappingComponent :
|
||||
public QFrame,
|
||||
public COverlayMessagesFrame,
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public BlackMisc::CIdentifiable
|
||||
{
|
||||
|
||||
@@ -222,13 +222,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QLabel" name="lbl_AircraftIconDisplayed">
|
||||
<property name="text">
|
||||
<string>icon will go here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_AircraftIcon">
|
||||
<property name="text">
|
||||
@@ -236,17 +229,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="pb_LoadModels">
|
||||
<property name="toolTip">
|
||||
<string>load models</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>load</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pb_ResetAircraft">
|
||||
<property name="toolTip">
|
||||
<string>reset model by callsign</string>
|
||||
@@ -256,7 +239,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="3">
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pb_SaveAircraft">
|
||||
<property name="toolTip">
|
||||
<string>save selected model</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="BlackGui::Components::CAircraftModelStringCompleter" name="completer_ModelStrings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="le_Callsign">
|
||||
<property name="maxLength">
|
||||
<number>15</number>
|
||||
@@ -269,23 +272,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QPushButton" name="pb_SaveAircraft">
|
||||
<item row="0" column="2" alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pb_LoadModels">
|
||||
<property name="toolTip">
|
||||
<string>save selected model</string>
|
||||
<string>load models</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="6">
|
||||
<widget class="BlackGui::Components::CAircraftModelStringCompleter" name="completer_ModelStrings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<string>load</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -296,16 +289,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CAircraftModelView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/aircraftmodelview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CSimulatedAircraftView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/simulatedaircraftview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CAircraftModelView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/aircraftmodelview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CModelMatcherLogComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
|
||||
Reference in New Issue
Block a user