mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +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:
parent
2220ad6bfe
commit
13f2d560d0
@ -28,7 +28,6 @@
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "awupdatehelper.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
AWActions::AWActions(QObject *parent)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ class AWFloatFormatter : public AWAbstractFormatter
|
||||
Q_PROPERTY(char format READ format WRITE setFormat)
|
||||
Q_PROPERTY(double multiplier READ multiplier WRITE setMultiplier)
|
||||
Q_PROPERTY(int precision READ precision WRITE setPrecision)
|
||||
Q_PROPERTY(double summand READ summand WRITE setSummand)
|
||||
Q_PROPERTY(int width READ width WRITE setWidth)
|
||||
|
||||
public:
|
||||
@ -35,7 +36,8 @@ public:
|
||||
const QString section);
|
||||
explicit 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);
|
||||
virtual ~AWFloatFormatter();
|
||||
QString convert(const QVariant &value) const;
|
||||
// properties
|
||||
@ -43,11 +45,13 @@ public:
|
||||
char format() const;
|
||||
double multiplier() const;
|
||||
int precision() const;
|
||||
double summand() const;
|
||||
int width() const;
|
||||
void setFillChar(const QChar _fillChar);
|
||||
void setFormat(char _format);
|
||||
void setMultiplier(const double _multiplier);
|
||||
void setPrecision(const int _precision);
|
||||
void setSummand(const double _summand);
|
||||
void setWidth(const int _width);
|
||||
|
||||
private:
|
||||
@ -57,6 +61,7 @@ private:
|
||||
char m_format;
|
||||
double m_multiplier;
|
||||
int m_precision;
|
||||
double m_summand;
|
||||
int m_width;
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "awdebug.h"
|
||||
#include "awkeycache.h"
|
||||
#include "awpatternfunctions.h"
|
||||
#include "version.h"
|
||||
// extensions
|
||||
#include "extquotes.h"
|
||||
#include "extscript.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "awkeysaggregator.h"
|
||||
#include "awpatternfunctions.h"
|
||||
#include "graphicalitem.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
AWKeys::AWKeys(QObject *parent)
|
||||
|
@ -139,6 +139,10 @@ QString AWKeysAggregator::formatter(const QVariant &data,
|
||||
case FormatterType::TimeShort:
|
||||
output = loc.toString(data.toDateTime(), QLocale::ShortFormat);
|
||||
break;
|
||||
case FormatterType::Timestamp:
|
||||
output = QString("%1").arg(
|
||||
data.toDateTime().toMSecsSinceEpoch() / 1000.0, 10, 'f', 0);
|
||||
break;
|
||||
case FormatterType::Uptime:
|
||||
case FormatterType::UptimeCustom:
|
||||
output =
|
||||
@ -537,6 +541,9 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
|
||||
// short time
|
||||
m_map.insertMulti(source, QString("shorttime"));
|
||||
m_formatter[QString("shorttime")] = FormatterType::TimeShort;
|
||||
// timestamp
|
||||
m_map.insertMulti(source, QString("tstime"));
|
||||
m_formatter[QString("tstime")] = FormatterType::Timestamp;
|
||||
} else if (source == QString("system/uptime")) {
|
||||
// uptime
|
||||
m_map[source] = QString("uptime");
|
||||
|
@ -61,6 +61,7 @@ class AWKeysAggregator : public QObject
|
||||
TimeISO,
|
||||
TimeLong,
|
||||
TimeShort,
|
||||
Timestamp,
|
||||
Uptime,
|
||||
UptimeCustom
|
||||
};
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <QSettings>
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
AWUpdateHelper::AWUpdateHelper(QObject *parent)
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <QTime>
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "version.h"
|
||||
#include "abstractextitemaggregator.h"
|
||||
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <qreplytimeout/qreplytimeout.h>
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName,
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtScript::ExtScript(QWidget *parent, const QString scriptName,
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName,
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <qreplytimeout/qreplytimeout.h>
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtWeather::ExtWeather(QWidget *parent, const QString weatherName,
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "graphicalitemhelper.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <fontdialog/fontdialog.h>
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
DPAdds::DPAdds(QObject *parent)
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "extsysmonaggregator.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtendedSysMon::ExtendedSysMon(QObject *parent, const QVariantList &args)
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "sources/quotessource.h"
|
||||
#include "sources/upgradesource.h"
|
||||
#include "sources/weathersource.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtSysMonAggregator::ExtSysMonAggregator(QObject *parent,
|
||||
|
@ -40,8 +40,8 @@
|
||||
"dddd,ddd,dd,d,MMMM,MMM,MM,M,yyyy,yy,hh,h,HH,H,mm,m,ss,s,t,ap,a,AP,A"
|
||||
// static keys
|
||||
#define STATIC_KEYS \
|
||||
"time,isotime,shorttime,longtime,ctime,uptime,cuptime,cpucl,cpu,gputemp," \
|
||||
"gpu,memmb,memgb,memfreemb,memfreegb,memtotmb,memtotgb,memusedmb," \
|
||||
"time,isotime,shorttime,longtime,tstime,ctime,uptime,cuptime,cpucl,cpu," \
|
||||
"gputemp,gpu,memmb,memgb,memfreemb,memfreegb,memtotmb,memtotgb,memusedmb," \
|
||||
"memusedgb,mem,swapmb,swapgb,swapfreemb,swapfreegb,swaptotmb,swaptotgb," \
|
||||
"swap,downunits,upunits,downkb,downtotalkb,downtotal,down,uptotalkb," \
|
||||
"uptotal,upkb,up,netdev,ac,bat,album,artist,duration,progress,title," \
|
||||
|
Loading…
Reference in New Issue
Block a user