mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-14 14:25:50 +00:00
Some more changes
* new tag - $tstime * add summand parameter to float formatter * drop version.h includes since it has been moved to awdebug.h (e.g. to introduce BUILD_FUTURE guards easy in the future)
This commit is contained in:
@ -35,7 +35,8 @@ AWFloatFormatter::AWFloatFormatter(QObject *parent, const QString filename,
|
||||
|
||||
AWFloatFormatter::AWFloatFormatter(QObject *parent, const QChar fillChar,
|
||||
const char format, const double multiplier,
|
||||
const int precision, const int width)
|
||||
const int precision, const double summand,
|
||||
const int width)
|
||||
: AWAbstractFormatter(parent)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
@ -44,6 +45,7 @@ AWFloatFormatter::AWFloatFormatter(QObject *parent, const QChar fillChar,
|
||||
setFormat(format);
|
||||
setMultiplier(multiplier);
|
||||
setPrecision(precision);
|
||||
setSummand(summand);
|
||||
setWidth(width);
|
||||
}
|
||||
|
||||
@ -58,8 +60,8 @@ QString AWFloatFormatter::convert(const QVariant &value) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Convert value" << value;
|
||||
|
||||
return QString("%1").arg(value.toDouble() * m_multiplier, m_width, m_format,
|
||||
m_precision, m_fillChar);
|
||||
return QString("%1").arg(value.toDouble() * m_multiplier + m_summand,
|
||||
m_width, m_format, m_precision, m_fillChar);
|
||||
}
|
||||
|
||||
|
||||
@ -87,6 +89,12 @@ int AWFloatFormatter::precision() const
|
||||
}
|
||||
|
||||
|
||||
double AWFloatFormatter::summand() const
|
||||
{
|
||||
return m_summand;
|
||||
}
|
||||
|
||||
|
||||
int AWFloatFormatter::width() const
|
||||
{
|
||||
return m_width;
|
||||
@ -131,6 +139,14 @@ void AWFloatFormatter::setPrecision(const int _precision)
|
||||
}
|
||||
|
||||
|
||||
void AWFloatFormatter::setSummand(const double _summand)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set summand" << _summand;
|
||||
|
||||
m_summand = _summand;
|
||||
}
|
||||
|
||||
|
||||
void AWFloatFormatter::setWidth(const int _width)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set width" << _width;
|
||||
@ -154,6 +170,7 @@ void AWFloatFormatter::init(const QString filename, const QString section)
|
||||
.toLatin1());
|
||||
setMultiplier(settings.value(QString("Multiplier"), 1.0).toDouble());
|
||||
setPrecision(settings.value(QString("Precision"), -1).toInt());
|
||||
setSummand(settings.value(QString("Summand"), 0.0).toDouble());
|
||||
setWidth(settings.value(QString("Width"), 0).toInt());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
Reference in New Issue
Block a user