mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
refs #316 Changed blackmisc and blacksim to use CLogMessage to emit messages.
Also changed functions which always returned CStatusMessageList containing a single CStatusMessage, to return CStatusMessage instead for simplicity.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "setsimulator.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Settings;
|
||||
@@ -149,22 +150,20 @@ namespace BlackSim
|
||||
/*
|
||||
* Value
|
||||
*/
|
||||
BlackMisc::CStatusMessageList CSettingsSimulator::value(const QString &path, const QString &command, const CVariant &value, bool &changedFlag)
|
||||
BlackMisc::CStatusMessage CSettingsSimulator::value(const QString &path, const QString &command, const CVariant &value, bool &changedFlag)
|
||||
{
|
||||
// TODO: This needs to be refactored to a smarter way to delegate commands
|
||||
changedFlag = false;
|
||||
CStatusMessageList msgs;
|
||||
if (path == CSettingsSimulator::ValueSelectedDriver())
|
||||
{
|
||||
if (command == CSettingUtilities::CmdAdd() || command == CSettingUtilities::CmdUpdate())
|
||||
{
|
||||
CSimulatorInfo v = value.value<CSimulatorInfo>();
|
||||
changedFlag = (v != this->m_selectedPlugin);
|
||||
msgs.push_back(CSettingUtilities::valueChangedMessage(changedFlag, "selected driver"));
|
||||
this->m_selectedPlugin = v;
|
||||
return msgs;
|
||||
return CLogMessage().info(CSettingUtilities::updateMessageCategory(), "selected driver%1 changed") << (changedFlag ? "" : " not");
|
||||
}
|
||||
return CSettingUtilities::wrongCommandMessages(command);
|
||||
return CLogMessage().error(CSettingUtilities::validationMessageCategory(), "wrong command: %1") << command;
|
||||
}
|
||||
else if (path == CSettingsSimulator::ValueSyncTime())
|
||||
{
|
||||
@@ -172,11 +171,10 @@ namespace BlackSim
|
||||
{
|
||||
bool v = value.value<bool>();
|
||||
changedFlag = (v != this->m_timeSync);
|
||||
msgs.push_back(CSettingUtilities::valueChangedMessage(changedFlag, "time synchronization"));
|
||||
this->m_timeSync = v;
|
||||
return msgs;
|
||||
return CLogMessage().info(CSettingUtilities::updateMessageCategory(), "time synchronization%1 changed") << (changedFlag ? "" : " not");
|
||||
}
|
||||
return CSettingUtilities::wrongCommandMessages(command);
|
||||
return CLogMessage().error(CSettingUtilities::validationMessageCategory(), "wrong command: %1") << command;
|
||||
}
|
||||
else if (path == CSettingsSimulator::ValueSyncTimeOffset())
|
||||
{
|
||||
@@ -184,15 +182,14 @@ namespace BlackSim
|
||||
{
|
||||
CTime v = value.value<CTime>();
|
||||
changedFlag = (v != this->m_timeSyncOffset);
|
||||
msgs.push_back(CSettingUtilities::valueChangedMessage(changedFlag, "time synchronization offset"));
|
||||
this->m_timeSyncOffset = v;
|
||||
return msgs;
|
||||
return CLogMessage().info(CSettingUtilities::updateMessageCategory(), "time synchronization offset%1 changed") << (changedFlag ? "" : " not");
|
||||
}
|
||||
return CSettingUtilities::wrongCommandMessages(command);
|
||||
return CLogMessage().error(CSettingUtilities::validationMessageCategory(), "wrong command: %1") << command;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CSettingUtilities::wrongPathMessages(path);
|
||||
return CLogMessage().error(CSettingUtilities::validationMessageCategory(), "wrong path: %1") << path;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace BlackSim
|
||||
void initDefaultValues();
|
||||
|
||||
//! \copydoc BlackCore::IContextSettings
|
||||
virtual BlackMisc::CStatusMessageList value(const QString &path, const QString &command, const BlackMisc::CVariant &value, bool &changedFlag);
|
||||
virtual BlackMisc::CStatusMessage value(const QString &path, const QString &command, const BlackMisc::CVariant &value, bool &changedFlag);
|
||||
|
||||
//! \copydoc CValueObject::getValueHash
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
Reference in New Issue
Block a user