refs #873, updated internals component

* can trigger request of parts
* opening logs
* update parts in UI from aircraft
This commit is contained in:
Klaus Basan
2017-02-01 02:52:27 +01:00
committed by Mathew Sutcliffe
parent d4b2238dc6
commit 273427d3d9
5 changed files with 321 additions and 102 deletions

View File

@@ -151,6 +151,26 @@ namespace BlackMisc
return worker;
}
QStringList IInterpolator::getLatestLogFiles()
{
QStringList files({ "", ""});
const QString logDir = CDirectoryUtils::getLogDirectory();
QDir logs(logDir);
if (!logs.exists()) { return files; }
logs.setNameFilters(QStringList() << "*interpolation.html" << "*parts.html");
const QStringList interpolations = logs.entryList(QStringList({"*interpolation.html"}), QDir::NoFilter, QDir::Time);
if (!interpolations.isEmpty())
{
files[0] = CFileUtils::appendFilePaths(logDir, interpolations.first());
}
const QStringList parts = logs.entryList(QStringList({"*parts.html"}), QDir::NoFilter, QDir::Time);
if (!parts.isEmpty())
{
files[1] = CFileUtils::appendFilePaths(logDir, parts.first());
}
return files;
}
CStatusMessageList IInterpolator::writeLogFile(const QList<InterpolationLog> &interpolation, const QList<PartsLog> &parts)
{
if (parts.isEmpty() && interpolation.isEmpty()) { return CStatusMessage(static_cast<IInterpolator *>(nullptr)).warning("No data for log"); }

View File

@@ -124,6 +124,7 @@ namespace BlackMisc
void setInterpolatorSetup(const CInterpolationAndRenderingSetup &setup);
//! Write a log in background
//! \threadsafe
BlackMisc::CWorker *writeLogInBackground();
//! Clear log file
@@ -134,18 +135,19 @@ namespace BlackMisc
//! \remark public for FS9 to get setup in Fs9Client
CInterpolationAndRenderingSetup getInterpolatorSetup() const;
/*!
* Takes input between 0 and 1 and returns output between 0 and 1 smoothed with an S-shaped curve.
*
* Useful for making interpolation seem smoother, efficiently as it just uses simple arithmetic.
* \see https://en.wikipedia.org/wiki/Smoothstep
* \see http://sol.gfxile.net/interpolation/
*/
//! Takes input between 0 and 1 and returns output between 0 and 1 smoothed with an S-shaped curve.
//!
//! Useful for making interpolation seem smoother, efficiently as it just uses simple arithmetic.
//! \see https://en.wikipedia.org/wiki/Smoothstep
//! \see http://sol.gfxile.net/interpolation/
static double smootherStep(double x)
{
return x * x * x * (x * (x * 6.0 - 15.0) + 10.0);
}
//! Latest log files: 0 Interpolation 1 Parts
static QStringList getLatestLogFiles();
protected:
//! Log for interpolation
struct InterpolationLog