Ref T441, overlay messages for model set component

This commit is contained in:
Klaus Basan
2018-11-26 06:20:05 +01:00
parent 0002752fa6
commit 4a28b589d8
3 changed files with 30 additions and 3 deletions

View File

@@ -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

View File

@@ -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
}; };

View File

@@ -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());