mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 04:35:41 +08:00
refs #933, start MCX from context menu
This commit is contained in:
committed by
Mathew Sutcliffe
parent
45f0cea083
commit
1ccbe5952c
@@ -17,9 +17,11 @@
|
|||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/simulation/aircraftmodelutils.h"
|
#include "blackmisc/simulation/aircraftmodelutils.h"
|
||||||
|
#include "blackmisc/simulation/modelconverterx.h"
|
||||||
|
#include "blackconfig/buildconfig.h"
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
|
||||||
|
using namespace BlackConfig;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
@@ -84,17 +86,28 @@ namespace BlackGui
|
|||||||
if (mv->hasSingleSelectedRow())
|
if (mv->hasSingleSelectedRow())
|
||||||
{
|
{
|
||||||
const CAircraftModel model(mv->selectedObject());
|
const CAircraftModel model(mv->selectedObject());
|
||||||
if (model.hasFileName() || (!model.getIconPath().isEmpty() && this->m_messageFrame))
|
bool added = false;
|
||||||
|
if (model.hasFileName())
|
||||||
{
|
{
|
||||||
menuActions.addMenuSimulator();
|
menuActions.addMenuSimulator();
|
||||||
if (this->m_messageFrame)
|
|
||||||
{
|
|
||||||
if (!model.getIconPath().isEmpty())
|
|
||||||
{
|
|
||||||
this->m_iconAction = menuActions.addAction(this->m_iconAction, CIcons::appAircraft16(), "Display icon", CMenuAction::pathSimulator(), { this, &CShowSimulatorFileMenu::ps_displayIcon });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->m_fileAction = menuActions.addAction(this->m_fileAction, CIcons::text16(), "Open simulator file", CMenuAction::pathSimulator(), { this, &CShowSimulatorFileMenu::ps_showSimulatorFile });
|
this->m_fileAction = menuActions.addAction(this->m_fileAction, CIcons::text16(), "Open simulator file", CMenuAction::pathSimulator(), { this, &CShowSimulatorFileMenu::ps_showSimulatorFile });
|
||||||
|
added = true;
|
||||||
|
if (CModelConverterX::supportsModelConverterX())
|
||||||
|
{
|
||||||
|
this->m_modelConverterX = menuActions.addAction(this->m_modelConverterX, CIcons::appAircraft16(), "ModelConverterX", CMenuAction::pathSimulator(), { this, &CShowSimulatorFileMenu::ps_startModelConverterX });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->m_messageFrame && !model.getIconPath().isEmpty())
|
||||||
|
{
|
||||||
|
added = true;
|
||||||
|
menuActions.addMenuSimulator();
|
||||||
|
this->m_iconAction = menuActions.addAction(this->m_iconAction, CIcons::appAircraft16(), "Display icon", CMenuAction::pathSimulator(), { this, &CShowSimulatorFileMenu::ps_displayIcon });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (added)
|
||||||
|
{
|
||||||
|
menuActions.addSeparator(CMenuAction::pathSimulator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->nestedCustomMenu(menuActions);
|
this->nestedCustomMenu(menuActions);
|
||||||
@@ -127,11 +140,19 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.setCategories(getLogCategories());
|
CLogMessage::preformatted(msg);
|
||||||
CLogMessage::preformatted(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CShowSimulatorFileMenu::ps_startModelConverterX()
|
||||||
|
{
|
||||||
|
if (!CModelConverterX::supportsModelConverterX()) { return; }
|
||||||
|
const CAircraftModelView *mv = modelView();
|
||||||
|
if (!mv->hasSingleSelectedRow()) { return; }
|
||||||
|
const CAircraftModel model(mv->selectedObject());
|
||||||
|
CModelConverterX::startModelConverterX(model, sApp);
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------- with DB data ---------------------------------
|
// --------------------------------- with DB data ---------------------------------
|
||||||
|
|
||||||
CConsolidateWithDbDataMenu::CConsolidateWithDbDataMenu(CAircraftModelView *modelView, QObject *modelsTarget, bool separator) :
|
CConsolidateWithDbDataMenu::CConsolidateWithDbDataMenu(CAircraftModelView *modelView, QObject *modelsTarget, bool separator) :
|
||||||
|
|||||||
@@ -67,13 +67,15 @@ namespace BlackGui
|
|||||||
virtual void customMenu(CMenuActions &menuActions) override;
|
virtual void customMenu(CMenuActions &menuActions) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ps_showSimulatorFile(); //!< simulator file
|
void ps_showSimulatorFile(); //!< simulator file
|
||||||
void ps_displayIcon(); //!< aircraft icon if any
|
void ps_displayIcon(); //!< aircraft icon if any
|
||||||
|
void ps_startModelConverterX(); //!< show in model converter X
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlackGui::COverlayMessagesFrame *m_messageFrame = nullptr;
|
BlackGui::COverlayMessagesFrame *m_messageFrame = nullptr;
|
||||||
QAction *m_fileAction = nullptr;
|
QAction *m_fileAction = nullptr;
|
||||||
QAction *m_iconAction = nullptr;
|
QAction *m_iconAction = nullptr;
|
||||||
|
QAction *m_modelConverterX = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Merge with DB data
|
//! Merge with DB data
|
||||||
|
|||||||
Reference in New Issue
Block a user