implement \r to default json of ExtScripts

some refactoring
bump ApiVer of ExtQuotes
update changelog
This commit is contained in:
arcan1s 2015-05-31 02:57:43 +03:00
parent f534a6854a
commit f96b3fcb07
13 changed files with 25 additions and 27 deletions

View File

@ -1,8 +1,10 @@
+ implement fitlers support to ExtScripts (ApiVer = 3) (#53) + implement fitlers support to ExtScripts (ApiVer = 3) (#53)
+ implement ability to wrap `\n` as new lines (#53) + implement ability to wrap `\n` as new lines (#53)
+ implement key sorting in comboboxes + implement key sorting in comboboxes
+ implement (perc)(bid|ask|price)chg tag support + implement (perc)(bid|ask|price)chg tag support (ApiVer = 2)
+ implement timeouts to quotes (#54)
- fix bug with invalid html parsing - fix bug with invalid html parsing
* move from XML to JSON in ExtQuotes (ApiVer = 2)
* more pretty configuration UI * more pretty configuration UI
* some part of refactoring * some part of refactoring

View File

@ -369,6 +369,7 @@ bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
if (sourceName == QString("update")) return true; if (sourceName == QString("update")) return true;
// checking // checking
if (toolTip == nullptr) return false;
if (!checkKeys(data)) return false; if (!checkKeys(data)) return false;
if (keys.isEmpty()) return false; if (keys.isEmpty()) return false;
@ -403,9 +404,8 @@ bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
values[QString("ac")] = params[QString("acOffline")].toString(); values[QString("ac")] = params[QString("acOffline")].toString();
} else { } else {
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0); values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0);
if (toolTip != nullptr) toolTip->setData(QString("batTooltip"), toolTip->setData(QString("batTooltip"), data[data.keys()[i]].toFloat(),
data[data.keys()[i]].toFloat(), data[QString("ac")].toBool());
data[QString("ac")].toBool());
} }
} }
} else if (sourceName == QString("cpu/system/TotalLoad")) { } else if (sourceName == QString("cpu/system/TotalLoad")) {
@ -415,8 +415,7 @@ bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
AWActions::sendNotification(QString("event"), i18n("High CPU load"), enablePopup); AWActions::sendNotification(QString("event"), i18n("High CPU load"), enablePopup);
// value // value
values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
if (toolTip != nullptr) toolTip->setData(QString("cpuTooltip"), toolTip->setData(QString("cpuTooltip"), data[QString("value")].toFloat());
data[QString("value")].toFloat());
} else if (sourceName.contains(cpuRegExp)) { } else if (sourceName.contains(cpuRegExp)) {
// cpus // cpus
QString number = sourceName; QString number = sourceName;
@ -425,8 +424,7 @@ bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
} else if (sourceName == QString("cpu/system/AverageClock")) { } else if (sourceName == QString("cpu/system/AverageClock")) {
// cpucl // cpucl
values[QString("cpucl")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); values[QString("cpucl")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
if (toolTip != nullptr) toolTip->setData(QString("cpuclTooltip"), toolTip->setData(QString("cpuclTooltip"), data[QString("value")].toFloat());
data[QString("value")].toFloat());
} else if (sourceName.contains(cpuclRegExp)) { } else if (sourceName.contains(cpuclRegExp)) {
// cpucls // cpucls
QString number = sourceName; QString number = sourceName;
@ -545,8 +543,7 @@ bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
AWActions::sendNotification(QString("event"), i18n("High memory usage"), enablePopup); AWActions::sendNotification(QString("event"), i18n("High memory usage"), enablePopup);
// value // value
values[QString("mem")] = QString("%1").arg(value, 5, 'f', 1); values[QString("mem")] = QString("%1").arg(value, 5, 'f', 1);
if (toolTip != nullptr) toolTip->setData(QString("memTooltip"), toolTip->setData(QString("memTooltip"), values[QString("mem")].toFloat());
values[QString("mem")].toFloat());
} else if (sourceName == QString("netdev")) { } else if (sourceName == QString("netdev")) {
// network device // network device
// notification // notification
@ -568,8 +565,7 @@ bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
} }
if (device == values[QString("netdev")]) { if (device == values[QString("netdev")]) {
values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
if (toolTip != nullptr) toolTip->setData(QString("downTooltip"), toolTip->setData(QString("downTooltip"), data[QString("value")].toFloat());
data[QString("value")].toFloat());
} }
} else if (sourceName.contains(netTransRegExp)) { } else if (sourceName.contains(netTransRegExp)) {
// upload speed // upload speed
@ -583,8 +579,7 @@ bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
} }
if (device == values[QString("netdev")]) { if (device == values[QString("netdev")]) {
values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
if (toolTip != nullptr) toolTip->setData(QString("upTooltip"), toolTip->setData(QString("upTooltip"), data[QString("value")].toFloat());
data[QString("value")].toFloat());
} }
} else if (sourceName == QString("pkg")) { } else if (sourceName == QString("pkg")) {
// package manager // package manager
@ -626,8 +621,7 @@ bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
AWActions::sendNotification(QString("event"), i18n("Swap is used"), enablePopup); AWActions::sendNotification(QString("event"), i18n("Swap is used"), enablePopup);
// value // value
values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1); values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1);
if (toolTip != nullptr) toolTip->setData(QString("swapTooltip"), toolTip->setData(QString("swapTooltip"), values[QString("swap")].toFloat());
values[QString("swap")].toFloat());
} else if (sourceName.contains(tempRegExp)) { } else if (sourceName.contains(tempRegExp)) {
// temperature devices // temperature devices
if (data[QString("units")].toString() == QString("rpm")) { if (data[QString("units")].toString() == QString("rpm")) {

View File

@ -36,7 +36,7 @@ public:
QTimer::singleShot(timeout, this, SLOT(timeout())); QTimer::singleShot(timeout, this, SLOT(timeout()));
} }
private slots: public slots:
void timeout() void timeout()
{ {
QNetworkReply *reply = static_cast<QNetworkReply *>(parent()); QNetworkReply *reply = static_cast<QNetworkReply *>(parent());

View File

@ -4,6 +4,6 @@ Name=AAPL.NASDAQ
Comment=Apple Inc Comment=Apple Inc
X-AW-Ticker="AAPL" X-AW-Ticker="AAPL"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=0 X-AW-Number=0

View File

@ -4,6 +4,6 @@ Name=EUR/RUB
Comment=EUR/RUB Comment=EUR/RUB
X-AW-Ticker="EURRUB=X" X-AW-Ticker="EURRUB=X"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=1 X-AW-Number=1

View File

@ -4,6 +4,6 @@ Name=EUR/USD
Comment=EUR/USD Comment=EUR/USD
X-AW-Ticker="EURUSD=X" X-AW-Ticker="EURUSD=X"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=2 X-AW-Number=2

View File

@ -4,6 +4,6 @@ Name=GOOG.NASDAQ
Comment=Google Inc Comment=Google Inc
X-AW-Ticker="GOOG" X-AW-Ticker="GOOG"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=3 X-AW-Number=3

View File

@ -4,6 +4,6 @@ Name=MSFT.NASDAQ
Comment=Microsoft Corp Comment=Microsoft Corp
X-AW-Ticker="MSFT" X-AW-Ticker="MSFT"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=4 X-AW-Number=4

View File

@ -4,6 +4,6 @@ Name=RTS
Comment=RTS Index Comment=RTS Index
X-AW-Ticker="RTS.RS" X-AW-Ticker="RTS.RS"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=5 X-AW-Number=5

View File

@ -4,6 +4,6 @@ Name=S&P
Comment=S&P 500 Index Comment=S&P 500 Index
X-AW-Ticker="^GSPC" X-AW-Ticker="^GSPC"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=6 X-AW-Number=6

View File

@ -4,6 +4,6 @@ Name=USD/RUB
Comment=USD/RUB Comment=USD/RUB
X-AW-Ticker="USDRUB=X" X-AW-Ticker="USDRUB=X"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=8 X-AW-Number=8

View File

@ -4,6 +4,6 @@ Name=VIX
Comment=Volatility S&P 500 Comment=Volatility S&P 500
X-AW-Ticker="^VIX" X-AW-Ticker="^VIX"
X-AW-Active=false X-AW-Active=false
X-AW-ApiVersion=1 X-AW-ApiVersion=2
X-AW-Interval=60 X-AW-Interval=60
X-AW-Number=7 X-AW-Number=7

View File

@ -20,7 +20,9 @@
}, },
"newline": { "newline": {
"\n": "<br>", "\n": "<br>",
"\t": "&#09;" "\n\r": "<br>",
"\t": "&#09;",
"\v": "&#11;"
}, },
"space": { "space": {
" ": "&nbsp;" " ": "&nbsp;"