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