mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 17:16:00 -05:00
Store truncated representation of doubles when used as variables
This commit is contained in:
committed by
WarmUpTill
parent
c3f207f93c
commit
b2fc560701
@@ -7,6 +7,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
#include <QStandardPaths>
|
||||
#include <sstream>
|
||||
|
||||
namespace advss {
|
||||
|
||||
@@ -77,6 +78,13 @@ bool CompareIgnoringLineEnding(QString &s1, QString &s2)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ToString(double value)
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << value;
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
std::string GetDataFilePath(const std::string &file)
|
||||
{
|
||||
std::string root_path = obs_get_module_data_path(obs_current_module());
|
||||
|
||||
@@ -21,6 +21,7 @@ bool ReplaceAll(std::string &str, const std::string &from,
|
||||
EXPORT std::optional<std::string> GetJsonField(const std::string &json,
|
||||
const std::string &id);
|
||||
EXPORT bool CompareIgnoringLineEnding(QString &s1, QString &s2);
|
||||
std::string ToString(double value);
|
||||
|
||||
EXPORT std::string GetDataFilePath(const std::string &file);
|
||||
QString GetDefaultSettingsSaveLocation();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "variable.hpp"
|
||||
#include "math-helpers.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QGridLayout>
|
||||
|
||||
@@ -78,7 +79,7 @@ void Variable::SetValue(const std::string &val)
|
||||
|
||||
void Variable::SetValue(double value)
|
||||
{
|
||||
_value = std::to_string(value);
|
||||
_value = ToString(value);
|
||||
_lastUsed = std::chrono::high_resolution_clock::now();
|
||||
lastVariableChange = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user