mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
Ref T441, overlay messages for model set component
This commit is contained in:
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
@@ -31,5 +33,17 @@ namespace BlackGui
|
|||||||
if (!m) { return; }
|
if (!m) { return; }
|
||||||
m_mappingComponent = m;
|
m_mappingComponent = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDbMappingComponentAware::showMappingComponentOverlayMessage(const CStatusMessage &message, int timeoutMs)
|
||||||
|
{
|
||||||
|
if (!m_mappingComponent) { return; }
|
||||||
|
m_mappingComponent->showOverlayMessage(message, timeoutMs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDbMappingComponentAware::showMappingComponentOverlayHtmlMessage(const CStatusMessage &message, int timeoutMs)
|
||||||
|
{
|
||||||
|
if (!m_mappingComponent) { return; }
|
||||||
|
m_mappingComponent->showOverlayHTMLMessage(message, timeoutMs);
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#ifndef BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENTAWARE_H
|
#ifndef BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENTAWARE_H
|
||||||
#define BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENTAWARE_H
|
#define BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENTAWARE_H
|
||||||
|
|
||||||
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@@ -38,6 +39,17 @@ namespace BlackGui
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CDbMappingComponentAware() {}
|
virtual ~CDbMappingComponentAware() {}
|
||||||
|
|
||||||
|
//! Copy constructor
|
||||||
|
CDbMappingComponentAware(const CDbMappingComponentAware &) = default;
|
||||||
|
|
||||||
|
//! Copy assignment operator
|
||||||
|
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);
|
||||||
|
//! @}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
CDbMappingComponent *m_mappingComponent = nullptr; //!< reference to component
|
CDbMappingComponent *m_mappingComponent = nullptr; //!< reference to component
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -114,12 +114,12 @@ namespace BlackGui
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unempty set, consolidate
|
|
||||||
CAircraftModelList cleanModelList(models.matchesSimulator(simulator)); // remove those not matching the simulator
|
CAircraftModelList cleanModelList(models.matchesSimulator(simulator)); // remove those not matching the simulator
|
||||||
const int diff = models.size() - cleanModelList.size();
|
const int diff = models.size() - cleanModelList.size();
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
{
|
{
|
||||||
CLogMessage(this).warning("Removed %1 models from set because not matching %2") << diff << simulator.toQString(true);
|
const CStatusMessage m = CStatusMessage(this).warning("Removed %1 models from set, because not matching %2") << diff << simulator.toQString(true);
|
||||||
|
this->showMappingComponentOverlayHtmlMessage(m, 5000);
|
||||||
}
|
}
|
||||||
cleanModelList.resetOrder();
|
cleanModelList.resetOrder();
|
||||||
ui->tvp_OwnModelSet->updateContainerMaybeAsync(cleanModelList);
|
ui->tvp_OwnModelSet->updateContainerMaybeAsync(cleanModelList);
|
||||||
@@ -133,7 +133,8 @@ namespace BlackGui
|
|||||||
const int diff = models.size() - cleanModelList.size();
|
const int diff = models.size() - cleanModelList.size();
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
{
|
{
|
||||||
CLogMessage(this).warning("Removed %1 models from set because not matching %2") << diff << simulator.toQString(true);
|
const CStatusMessage m = CStatusMessage(this).warning("Removed %1 models from set, because not matching %2") << diff << simulator.toQString(true);
|
||||||
|
this->showMappingComponentOverlayHtmlMessage(m, 5000);
|
||||||
}
|
}
|
||||||
if (cleanModelList.isEmpty()) { return 0; }
|
if (cleanModelList.isEmpty()) { return 0; }
|
||||||
CAircraftModelList updatedModels(ui->tvp_OwnModelSet->container());
|
CAircraftModelList updatedModels(ui->tvp_OwnModelSet->container());
|
||||||
|
|||||||
Reference in New Issue
Block a user