Ref T111, some fixes in the vicinity of plugin / drivers

* mostly style / doxygen / formatting
* assert/verify
This commit is contained in:
Klaus Basan
2017-07-26 13:53:38 +02:00
committed by Mathew Sutcliffe
parent e72546d282
commit 29e1d54e05
16 changed files with 79 additions and 78 deletions

View File

@@ -2,6 +2,14 @@
<ui version="4.0">
<class>CLogComponent</class>
<widget class="QFrame" name="CLogComponent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>264</width>
<height>339</height>
</rect>
</property>
<property name="windowTitle">
<string>Log component</string>
</property>

View File

@@ -29,7 +29,6 @@ class QPoint;
class QWidget;
namespace Ui { class CNavigatorDialog; }
namespace BlackGui
{
namespace Components

View File

@@ -25,6 +25,7 @@
#include "blackmisc/pq/time.h"
#include "blackmisc/pq/units.h"
#include "blackmisc/statusmessage.h"
#include "blackmisc/verify.h"
#include "ui_settingssimulatorcomponent.h"
#include <QApplication>
@@ -146,7 +147,7 @@ namespace BlackGui
void CSettingsSimulatorComponent::ps_pluginStateChanged(const QString &identifier, bool enabled)
{
Q_ASSERT(sGui->getIContextSimulator());
Q_ASSERT(sGui && sGui->getIContextSimulator());
const CSimulatorPluginInfoList simDrivers(getAvailablePlugins());
const CSimulatorPluginInfo selected = simDrivers.findByIdentifier(identifier);
@@ -156,18 +157,22 @@ namespace BlackGui
return;
}
QStringList e = m_enabledSimulators.getThreadLocal();
QStringList e = m_enabledSimulators.getThreadLocal(); // from setting
if (enabled != e.contains(selected.getIdentifier()))
{
if (enabled)
{
e << selected.getIdentifier();
e << selected.getIdentifier(); // add enabled plugin
}
else
{
e.removeAll(selected.getIdentifier());
}
m_enabledSimulators.set(e);
const CStatusMessage msg = m_enabledSimulators.set(e); // change setting
if (msg.isWarningOrAbove())
{
CLogMessage::preformatted(msg);
}
}
// changing of GUI state will be done via received signal
@@ -234,7 +239,7 @@ namespace BlackGui
void CSettingsSimulatorComponent::ps_onApplyTimeSync()
{
bool timeSync = ui->cb_TimeSync->isChecked();
const bool timeSync = ui->cb_TimeSync->isChecked();
const QString os = ui->le_TimeSyncOffset->text();
CTime ost(0, CTimeUnit::hrmin());
if (!os.isEmpty())
@@ -284,8 +289,12 @@ namespace BlackGui
const CSimulatorPluginInfo selected = simDrivers.findByIdentifier(identifier);
QWidget *aw = qApp->activeWindow();
Q_ASSERT_X(aw, Q_FUNC_INFO, "Missing active window");
CPluginDetailsWindow *w = new CPluginDetailsWindow(aw);
BLACK_VERIFY_X(w, Q_FUNC_INFO, "Missing window");
if (!w) { return; }
w->setAttribute(Qt::WA_DeleteOnClose);
w->setPluginIdentifier(selected.getIdentifier());
w->setPluginName(selected.getName());
@@ -301,12 +310,13 @@ namespace BlackGui
const QString configId = m_plugins->getPluginConfigId(selected.getIdentifier());
IPluginConfig *config = m_plugins->getPluginById<IPluginConfig>(configId);
if (!config)
{
return;
}
BLACK_VERIFY_X(config, Q_FUNC_INFO, "Missing config");
if (!config) { return; }
CPluginConfigWindow *window = config->createConfigWindow(qApp->activeWindow());
BLACK_VERIFY_X(window, Q_FUNC_INFO, "Missing window");
if (!window) { return; }
window->setAttribute(Qt::WA_DeleteOnClose);
window->show();
}

View File

@@ -9,8 +9,8 @@
//! \file
#ifndef BLACKGUI_SETTINGSSIMULATORCOMPONENT_H
#define BLACKGUI_SETTINGSSIMULATORCOMPONENT_H
#ifndef BLACKGUI_COMPONENTS_SETTINGSSIMULATORCOMPONENT_H
#define BLACKGUI_COMPONENTS_SETTINGSSIMULATORCOMPONENT_H
#include "blackcore/application/applicationsettings.h"
#include "blackgui/blackguiexport.h"
@@ -27,7 +27,6 @@ class QWidget;
namespace BlackCore { class CPluginManagerSimulator; }
namespace BlackMisc { namespace Simulation { class CSimulatorPluginInfo; } }
namespace Ui { class CSettingsSimulatorComponent; }
namespace BlackGui
{
namespace Components
@@ -89,4 +88,5 @@ namespace BlackGui
};
}
} // namespace
#endif // guard