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