mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 05:55:33 +08:00
[UI] As discussed in FSC channel, display "save" message
* save was only shown ("overlay") if a mapping component is available
* make sure an message is also show in component is used in dialog
* change utility functions and display in "table view" without mapping component
https://discordapp.com/channels/539048679160676382/594962359441948682/643529608070692925
This commit is contained in:
committed by
Mat Sutcliffe
parent
087410039c
commit
3b0001d113
@@ -33,16 +33,16 @@ namespace BlackGui
|
||||
m_mappingComponent = m;
|
||||
}
|
||||
|
||||
void CDbMappingComponentAware::showMappingComponentOverlayMessage(const CStatusMessage &message, int timeoutMs)
|
||||
bool CDbMappingComponentAware::showMappingComponentOverlayMessage(const CStatusMessage &message, int timeoutMs)
|
||||
{
|
||||
if (!m_mappingComponent) { return; }
|
||||
m_mappingComponent->showOverlayMessage(message, timeoutMs);
|
||||
if (!m_mappingComponent) { return false; }
|
||||
return m_mappingComponent->showOverlayMessage(message, timeoutMs);
|
||||
}
|
||||
|
||||
void CDbMappingComponentAware::showMappingComponentOverlayHtmlMessage(const CStatusMessage &message, int timeoutMs)
|
||||
bool CDbMappingComponentAware::showMappingComponentOverlayHtmlMessage(const CStatusMessage &message, int timeoutMs)
|
||||
{
|
||||
if (!m_mappingComponent) { return; }
|
||||
m_mappingComponent->showOverlayHTMLMessage(message, timeoutMs);
|
||||
if (!m_mappingComponent) { return false; }
|
||||
return m_mappingComponent->showOverlayHTMLMessage(message, timeoutMs);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace BlackGui
|
||||
CDbMappingComponentAware &operator =(const CDbMappingComponentAware &) = default;
|
||||
|
||||
//! Overlay messages @{
|
||||
void showMappingComponentOverlayMessage(const BlackMisc::CStatusMessage &message, int timeoutMs = -1);
|
||||
void showMappingComponentOverlayHtmlMessage(const BlackMisc::CStatusMessage &message, int timeoutMs = -1);
|
||||
bool showMappingComponentOverlayMessage(const BlackMisc::CStatusMessage &message, int timeoutMs = -1);
|
||||
bool showMappingComponentOverlayHtmlMessage(const BlackMisc::CStatusMessage &message, int timeoutMs = -1);
|
||||
//! @}
|
||||
|
||||
private :
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/components/dbmappingcomponent.h"
|
||||
#include "blackgui/components/dbownmodelsetcomponent.h"
|
||||
#include "blackgui/components/dbownmodelsetformdialog.h"
|
||||
@@ -19,6 +18,8 @@
|
||||
#include "blackgui/views/aircraftmodelview.h"
|
||||
#include "blackgui/views/viewbase.h"
|
||||
#include "blackgui/views/aircraftmodelstatisticsdialog.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackmisc/simulation/aircraftmodelutils.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
@@ -238,15 +239,24 @@ namespace BlackGui
|
||||
if (!ownModelSet.isEmpty())
|
||||
{
|
||||
const CSimulatorInfo sim = this->getSelectedSimulator();
|
||||
const CStatusMessage m = this->setCachedModels(ownModelSet, sim);
|
||||
const CStatusMessage m = this->setCachedModels(ownModelSet, sim);
|
||||
CLogMessage::preformatted(m);
|
||||
if (m.isSuccess())
|
||||
{
|
||||
this->showMappingComponentOverlayHtmlMessage(QStringLiteral("Save model set for '%1'").arg(sim.toQString(true)), 5000);
|
||||
const QString msg = QStringLiteral("Saved model set for '%1'").arg(sim.toQString(true));
|
||||
|
||||
// display either as overlay of componet or view
|
||||
if (!this->showMappingComponentOverlayHtmlMessage(msg, 5000))
|
||||
{
|
||||
ui->tvp_OwnModelSet->showOverlayHTMLMessage(msg, 5000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->showMappingComponentOverlayMessage(m);
|
||||
if (!this->showMappingComponentOverlayMessage(m))
|
||||
{
|
||||
ui->tvp_OwnModelSet->showOverlayMessage(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -493,6 +503,11 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
bool CDbOwnModelSetComponent::runsInDialog()
|
||||
{
|
||||
return CGuiUtility::findParentDialog(this, 5);
|
||||
}
|
||||
|
||||
void CDbOwnModelSetComponent::CLoadModelSetMenu::customMenu(CMenuActions &menuActions)
|
||||
{
|
||||
// for the moment I use all sims, I could restrict to CSimulatorInfo::getLocallyInstalledSimulators();
|
||||
|
||||
@@ -179,6 +179,9 @@ namespace BlackGui
|
||||
//! Update distributor order
|
||||
void updateDistributorOrder(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Is that component running in a dialog
|
||||
bool runsInDialog();
|
||||
|
||||
QScopedPointer<Ui::CDbOwnModelSetComponent> ui;
|
||||
QScopedPointer<CDbOwnModelSetFormDialog> m_modelSetFormDialog;
|
||||
QScopedPointer<CFirstModelSetDialog> m_firstModelSetDialog;
|
||||
|
||||
Reference in New Issue
Block a user