mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
initial support of weather
This commit is contained in:
parent
a065e96bc3
commit
b699095f38
@ -1,10 +1,12 @@
|
|||||||
Ver.2.3.4:
|
Ver.2.3.4:
|
||||||
|
+ add support of weather items
|
||||||
+ add support of load average (la1, la5, la15 tags)
|
+ add support of load average (la1, la5, la15 tags)
|
||||||
+ add "drop key cache" button
|
+ add "drop key cache" button
|
||||||
- fix bug with invalid network data calculation
|
- fix bug with invalid network data calculation
|
||||||
* improve work with data updating (#57)
|
* improve work with data updating (#57)
|
||||||
* move plugin part back to private
|
* move plugin part back to private
|
||||||
* cast plugin as type, not signleton (#57)
|
* cast plugin as type, not signleton (#57)
|
||||||
|
* change logic in data building inside DataEngine
|
||||||
|
|
||||||
Ver.2.3.3:
|
Ver.2.3.3:
|
||||||
* change text rendering from Qt to native
|
* change text rendering from Qt to native
|
||||||
|
@ -8,7 +8,7 @@ ProjectRootRelative=./
|
|||||||
|
|
||||||
[CMake][CMake Build Directory 0]
|
[CMake][CMake Build Directory 0]
|
||||||
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
||||||
Build Type=Debug
|
Build Type=Release
|
||||||
CMake Binary=file:///usr/bin/cmake
|
CMake Binary=file:///usr/bin/cmake
|
||||||
Environment Profile=
|
Environment Profile=
|
||||||
Extra Arguments=
|
Extra Arguments=
|
||||||
|
18
sources/3rdparty/qreplytimeout/qreplytimeout.cpp
vendored
Normal file
18
sources/3rdparty/qreplytimeout/qreplytimeout.cpp
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "qreplytimeout.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
|
QReplyTimeout::QReplyTimeout(QNetworkReply *reply, const int timeout)
|
||||||
|
: QObject(reply)
|
||||||
|
{
|
||||||
|
QTimer::singleShot(timeout, this, SLOT(timeout()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QReplyTimeout::timeout()
|
||||||
|
{
|
||||||
|
QNetworkReply *reply = static_cast<QNetworkReply *>(parent());
|
||||||
|
if (reply->isRunning())
|
||||||
|
reply->close();
|
||||||
|
}
|
17
sources/3rdparty/qreplytimeout/qreplytimeout.h
vendored
Normal file
17
sources/3rdparty/qreplytimeout/qreplytimeout.h
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// from here http://codereview.stackexchange.com/questions/30031/qnetworkreply-network-reply-timeout-helper
|
||||||
|
// no license provided
|
||||||
|
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
|
class QReplyTimeout : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit QReplyTimeout(QNetworkReply *reply, const int timeout);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void timeout();
|
||||||
|
};
|
@ -261,9 +261,6 @@ Item {
|
|||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width * 2 / 5
|
width: parent.width * 2 / 5
|
||||||
// horizontalAlignment: Text.AlignRight
|
|
||||||
// verticalAlignment: Text.AlignVCenter
|
|
||||||
// text: i18n("Font")
|
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: selectFont
|
id: selectFont
|
||||||
|
@ -275,6 +275,23 @@ Item {
|
|||||||
onClicked: awKeys.editItem("extupgrade")
|
onClicked: awKeys.editItem("extupgrade")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Weather")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Edit weather")
|
||||||
|
onClicked: awKeys.editItem("extweather")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
@ -91,8 +91,6 @@ Item {
|
|||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
// FIXME: ugly workaround to make some sources working
|
|
||||||
// systemmonitorDE.interval = plasmoid.configuration.interval
|
|
||||||
|
|
||||||
awKeys.setDataBySource(sourceName, data, settings)
|
awKeys.setDataBySource(sourceName, data, settings)
|
||||||
}
|
}
|
||||||
@ -112,8 +110,6 @@ Item {
|
|||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
// FIXME: ugly workaround to make some sources working
|
|
||||||
// extsysmonDE.interval = plasmoid.configuration.interval
|
|
||||||
|
|
||||||
awKeys.setDataBySource(sourceName, data, settings)
|
awKeys.setDataBySource(sourceName, data, settings)
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,11 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
|
|
||||||
# task source is required by extscripts
|
# task source is required by extscripts
|
||||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
||||||
|
${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.cpp
|
||||||
../../extsysmon/extquotes.cpp
|
../../extsysmon/extquotes.cpp
|
||||||
../../extsysmon/extscript.cpp
|
../../extsysmon/extscript.cpp
|
||||||
../../extsysmon/extupgrade.cpp)
|
../../extsysmon/extupgrade.cpp
|
||||||
|
../../extsysmon/extweather.cpp)
|
||||||
file (GLOB SUBPROJECT_UI *.ui)
|
file (GLOB SUBPROJECT_UI *.ui)
|
||||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||||
set (SUBPROJECT_DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
set (SUBPROJECT_DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "extquotes.h"
|
#include "extquotes.h"
|
||||||
#include "extscript.h"
|
#include "extscript.h"
|
||||||
#include "extupgrade.h"
|
#include "extupgrade.h"
|
||||||
|
#include "extweather.h"
|
||||||
#include "graphicalitem.h"
|
#include "graphicalitem.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
@ -81,6 +82,7 @@ AWKeys::~AWKeys()
|
|||||||
graphicalItems.clear();
|
graphicalItems.clear();
|
||||||
extScripts.clear();
|
extScripts.clear();
|
||||||
extUpgrade.clear();
|
extUpgrade.clear();
|
||||||
|
extWeather.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -102,6 +104,7 @@ void AWKeys::initKeys(const QString currentPattern)
|
|||||||
extQuotes = getExtQuotes();
|
extQuotes = getExtQuotes();
|
||||||
extScripts = getExtScripts();
|
extScripts = getExtScripts();
|
||||||
extUpgrade = getExtUpgrade();
|
extUpgrade = getExtUpgrade();
|
||||||
|
extWeather = getExtWeather();
|
||||||
graphicalItems = getGraphicalItems();
|
graphicalItems = getGraphicalItems();
|
||||||
// update network and hdd list
|
// update network and hdd list
|
||||||
addKeyToCache(QString("Hdd"));
|
addKeyToCache(QString("Hdd"));
|
||||||
@ -305,6 +308,15 @@ QStringList AWKeys::dictKeys(const bool sorted)
|
|||||||
allKeys.append(QString("la15"));
|
allKeys.append(QString("la15"));
|
||||||
allKeys.append(QString("la5"));
|
allKeys.append(QString("la5"));
|
||||||
allKeys.append(QString("la1"));
|
allKeys.append(QString("la1"));
|
||||||
|
// weather
|
||||||
|
for (int i=extWeather.count()-1; i>=0; i--) {
|
||||||
|
allKeys.append(extWeather[i]->tag(QString("weatherId")));
|
||||||
|
allKeys.append(extWeather[i]->tag(QString("weather")));
|
||||||
|
allKeys.append(extWeather[i]->tag(QString("humidity")));
|
||||||
|
allKeys.append(extWeather[i]->tag(QString("pressure")));
|
||||||
|
allKeys.append(extWeather[i]->tag(QString("temperature")));
|
||||||
|
allKeys.append(extWeather[i]->tag(QString("timestamp")));
|
||||||
|
}
|
||||||
// bars
|
// bars
|
||||||
QStringList graphicalItemsKeys;
|
QStringList graphicalItemsKeys;
|
||||||
for (int i=0; i<graphicalItems.count(); i++)
|
for (int i=0; i<graphicalItems.count(); i++)
|
||||||
@ -488,7 +500,7 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
|||||||
for (int i=0; i<data.keys().count(); i++)
|
for (int i=0; i<data.keys().count(); i++)
|
||||||
for (int j=0; j<hddDevices.count(); j++)
|
for (int j=0; j<hddDevices.count(); j++)
|
||||||
if (hddDevices[j] == data.keys()[i]) {
|
if (hddDevices[j] == data.keys()[i]) {
|
||||||
values[QString("hddtemp") + QString::number(j)] = QString("%1").arg(
|
values[QString("hddtemp%1").arg(j)] = QString("%1").arg(
|
||||||
temperature(data[data.keys()[i]].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
temperature(data[data.keys()[i]].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -650,6 +662,20 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
|||||||
values[QString("cuptime")].replace(QString("$h"), QString("%1").arg(hours));
|
values[QString("cuptime")].replace(QString("$h"), QString("%1").arg(hours));
|
||||||
values[QString("cuptime")].replace(QString("$mm"), QString("%1").arg(minutes, 2, 10, QChar('0')));
|
values[QString("cuptime")].replace(QString("$mm"), QString("%1").arg(minutes, 2, 10, QChar('0')));
|
||||||
values[QString("cuptime")].replace(QString("$m"), QString("%1").arg(minutes));
|
values[QString("cuptime")].replace(QString("$m"), QString("%1").arg(minutes));
|
||||||
|
} else if (sourceName == QString("weather")) {
|
||||||
|
for (int i=0; i<data.keys().count(); i++) {
|
||||||
|
if (data.keys()[i].startsWith(QString("weatherId")))
|
||||||
|
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toInt());
|
||||||
|
else if (data.keys()[i].startsWith(QString("weather")))
|
||||||
|
values[data.keys()[i]] = data[data.keys()[i]].toString();
|
||||||
|
else if (data.keys()[i].startsWith(QString("humidity")))
|
||||||
|
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toInt(), 3);
|
||||||
|
else if (data.keys()[i].startsWith(QString("pressure")))
|
||||||
|
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 0, 'f', 1);
|
||||||
|
else if (data.keys()[i].startsWith(QString("temperature")))
|
||||||
|
values[data.keys()[i]] = QString("%1").arg(
|
||||||
|
temperature(data[data.keys()[i]].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName << "not found";
|
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName << "not found";
|
||||||
emit(dropSourceFromDataengine(sourceName));
|
emit(dropSourceFromDataengine(sourceName));
|
||||||
@ -662,7 +688,7 @@ void AWKeys::graphicalValueByKey()
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
QString tag = QInputDialog::getItem(0, i18n("Select tag"), i18n("Tag"),
|
QString tag = QInputDialog::getItem(nullptr, i18n("Select tag"), i18n("Tag"),
|
||||||
dictKeys(true), 0, false, &ok);
|
dictKeys(true), 0, false, &ok);
|
||||||
|
|
||||||
if ((!ok) || (tag.isEmpty())) return;
|
if ((!ok) || (tag.isEmpty())) return;
|
||||||
@ -769,6 +795,19 @@ void AWKeys::editItem(const QString type)
|
|||||||
item->setToolTip(tooltip.join(QChar('\n')));
|
item->setToolTip(tooltip.join(QChar('\n')));
|
||||||
widgetDialog->addItem(item);
|
widgetDialog->addItem(item);
|
||||||
}
|
}
|
||||||
|
} else if (type == QString("extweather")) {
|
||||||
|
requestedItem = RequestedExtWeather;
|
||||||
|
for (int i=0; i<extWeather.count(); i++) {
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(extWeather[i]->fileName());
|
||||||
|
QStringList tooltip;
|
||||||
|
tooltip.append(i18n("Name: %1", extWeather[i]->name()));
|
||||||
|
tooltip.append(i18n("Comment: %1", extWeather[i]->comment()));
|
||||||
|
tooltip.append(i18n("City: %1", extWeather[i]->city()));
|
||||||
|
tooltip.append(i18n("Country: %1", extWeather[i]->country()));
|
||||||
|
tooltip.append(i18n("Time: %1", extWeather[i]->ts()));
|
||||||
|
item->setToolTip(tooltip.join(QChar('\n')));
|
||||||
|
widgetDialog->addItem(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = dialog->exec();
|
int ret = dialog->exec();
|
||||||
@ -861,6 +900,9 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
|||||||
case RequestedExtUpgrade:
|
case RequestedExtUpgrade:
|
||||||
copyUpgrade(current);
|
copyUpgrade(current);
|
||||||
break;
|
break;
|
||||||
|
case RequestedExtWeather:
|
||||||
|
copyWeather(current);
|
||||||
|
break;
|
||||||
case RequestedGraphicalItem:
|
case RequestedGraphicalItem:
|
||||||
copyBar(current);
|
copyBar(current);
|
||||||
break;
|
break;
|
||||||
@ -879,6 +921,9 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
|||||||
case RequestedExtUpgrade:
|
case RequestedExtUpgrade:
|
||||||
copyUpgrade(QString(""));
|
copyUpgrade(QString(""));
|
||||||
break;
|
break;
|
||||||
|
case RequestedExtWeather:
|
||||||
|
copyWeather(QString(""));
|
||||||
|
break;
|
||||||
case RequestedGraphicalItem:
|
case RequestedGraphicalItem:
|
||||||
copyBar(QString(""));
|
copyBar(QString(""));
|
||||||
break;
|
break;
|
||||||
@ -923,6 +968,17 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case RequestedExtWeather:
|
||||||
|
for (int i=0; i<extWeather.count(); i++) {
|
||||||
|
if (extWeather[i]->fileName() != current) continue;
|
||||||
|
if (extWeather[i]->tryDelete()) {
|
||||||
|
widgetDialog->takeItem(widgetDialog->row(item));
|
||||||
|
extWeather.clear();
|
||||||
|
extWeather = getExtWeather();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case RequestedGraphicalItem:
|
case RequestedGraphicalItem:
|
||||||
for (int i=0; i<graphicalItems.count(); i++) {
|
for (int i=0; i<graphicalItems.count(); i++) {
|
||||||
if (graphicalItems[i]->fileName() != current) continue;
|
if (graphicalItems[i]->fileName() != current) continue;
|
||||||
@ -963,6 +1019,13 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case RequestedExtWeather:
|
||||||
|
for (int i=0; i<extWeather.count(); i++) {
|
||||||
|
if (extWeather[i]->fileName() != current) continue;
|
||||||
|
extWeather[i]->showConfiguration();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case RequestedGraphicalItem:
|
case RequestedGraphicalItem:
|
||||||
for (int i=0; i<graphicalItems.count(); i++) {
|
for (int i=0; i<graphicalItems.count(); i++) {
|
||||||
if (graphicalItems[i]->fileName() != current) continue;
|
if (graphicalItems[i]->fileName() != current) continue;
|
||||||
@ -993,7 +1056,7 @@ void AWKeys::copyBar(const QString original)
|
|||||||
QString("awesomewidgets/desktops"),
|
QString("awesomewidgets/desktops"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
QString name = QInputDialog::getText(nullptr, i18n("Enter file name"),
|
||||||
i18n("File name"), QLineEdit::Normal,
|
i18n("File name"), QLineEdit::Normal,
|
||||||
QString(""), &ok);
|
QString(""), &ok);
|
||||||
if ((!ok) || (name.isEmpty())) return;
|
if ((!ok) || (name.isEmpty())) return;
|
||||||
@ -1014,7 +1077,7 @@ void AWKeys::copyBar(const QString original)
|
|||||||
originalItem = i;
|
originalItem = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GraphicalItem *item = new GraphicalItem(0, name, dirs, debug);
|
GraphicalItem *item = new GraphicalItem(nullptr, name, dirs, debug);
|
||||||
item->setApiVersion(AWGIAPI);
|
item->setApiVersion(AWGIAPI);
|
||||||
item->setName(QString("bar%1").arg(number));
|
item->setName(QString("bar%1").arg(number));
|
||||||
if (originalItem != -1) {
|
if (originalItem != -1) {
|
||||||
@ -1058,7 +1121,7 @@ void AWKeys::copyQuotes(const QString original)
|
|||||||
QString("awesomewidgets/quotes"),
|
QString("awesomewidgets/quotes"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
QString name = QInputDialog::getText(nullptr, i18n("Enter file name"),
|
||||||
i18n("File name"), QLineEdit::Normal,
|
i18n("File name"), QLineEdit::Normal,
|
||||||
QString(""), &ok);
|
QString(""), &ok);
|
||||||
if ((!ok) || (name.isEmpty())) return;
|
if ((!ok) || (name.isEmpty())) return;
|
||||||
@ -1072,7 +1135,7 @@ void AWKeys::copyQuotes(const QString original)
|
|||||||
originalItem = i;
|
originalItem = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ExtQuotes *quotes = new ExtQuotes(0, name, dirs, debug);
|
ExtQuotes *quotes = new ExtQuotes(nullptr, name, dirs, debug);
|
||||||
quotes->setApiVersion(AWEQAPI);
|
quotes->setApiVersion(AWEQAPI);
|
||||||
quotes->setNumber(number);
|
quotes->setNumber(number);
|
||||||
if (originalItem != -1) {
|
if (originalItem != -1) {
|
||||||
@ -1115,7 +1178,7 @@ void AWKeys::copyScript(const QString original)
|
|||||||
QString("awesomewidgets/scripts"),
|
QString("awesomewidgets/scripts"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
QString name = QInputDialog::getText(nullptr, i18n("Enter file name"),
|
||||||
i18n("File name"), QLineEdit::Normal,
|
i18n("File name"), QLineEdit::Normal,
|
||||||
QString(""), &ok);
|
QString(""), &ok);
|
||||||
if ((!ok) || (name.isEmpty())) return;
|
if ((!ok) || (name.isEmpty())) return;
|
||||||
@ -1129,7 +1192,7 @@ void AWKeys::copyScript(const QString original)
|
|||||||
originalItem = i;
|
originalItem = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ExtScript *script = new ExtScript(0, name, dirs, debug);
|
ExtScript *script = new ExtScript(nullptr, name, dirs, debug);
|
||||||
script->setApiVersion(AWESAPI);
|
script->setApiVersion(AWESAPI);
|
||||||
script->setNumber(number);
|
script->setNumber(number);
|
||||||
if (originalItem != -1) {
|
if (originalItem != -1) {
|
||||||
@ -1174,7 +1237,7 @@ void AWKeys::copyUpgrade(const QString original)
|
|||||||
QString("awesomewidgets/upgrade"),
|
QString("awesomewidgets/upgrade"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
QString name = QInputDialog::getText(nullptr, i18n("Enter file name"),
|
||||||
i18n("File name"), QLineEdit::Normal,
|
i18n("File name"), QLineEdit::Normal,
|
||||||
QString(""), &ok);
|
QString(""), &ok);
|
||||||
if ((!ok) || (name.isEmpty())) return;
|
if ((!ok) || (name.isEmpty())) return;
|
||||||
@ -1188,7 +1251,7 @@ void AWKeys::copyUpgrade(const QString original)
|
|||||||
originalItem = i;
|
originalItem = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ExtUpgrade *upgrade = new ExtUpgrade(0, name, dirs, debug);
|
ExtUpgrade *upgrade = new ExtUpgrade(nullptr, name, dirs, debug);
|
||||||
upgrade->setApiVersion(AWEUAPI);
|
upgrade->setApiVersion(AWEUAPI);
|
||||||
upgrade->setNumber(number);
|
upgrade->setNumber(number);
|
||||||
if (originalItem != -1) {
|
if (originalItem != -1) {
|
||||||
@ -1216,6 +1279,66 @@ void AWKeys::copyUpgrade(const QString original)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWKeys::copyWeather(const QString original)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QList<int> tagList;
|
||||||
|
for (int i=0; i<extWeather.count(); i++)
|
||||||
|
tagList.append(extWeather[i]->number());
|
||||||
|
int number = 0;
|
||||||
|
while (tagList.contains(number))
|
||||||
|
number++;
|
||||||
|
|
||||||
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
|
QString("awesomewidgets/weather"),
|
||||||
|
QStandardPaths::LocateDirectory);
|
||||||
|
bool ok;
|
||||||
|
QString name = QInputDialog::getText(nullptr, i18n("Enter file name"),
|
||||||
|
i18n("File name"), QLineEdit::Normal,
|
||||||
|
QString(""), &ok);
|
||||||
|
if ((!ok) || (name.isEmpty())) return;
|
||||||
|
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
||||||
|
|
||||||
|
int originalItem = -1;
|
||||||
|
for (int i=0; i<extWeather.count(); i++) {
|
||||||
|
if ((extWeather[i]->fileName() != original) ||
|
||||||
|
(extWeather[i]->fileName() != name))
|
||||||
|
continue;
|
||||||
|
originalItem = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ExtWeather *weather = new ExtWeather(nullptr, name, dirs, debug);
|
||||||
|
weather->setApiVersion(AWEUAPI);
|
||||||
|
weather->setNumber(number);
|
||||||
|
if (originalItem != -1) {
|
||||||
|
weather->setActive(extWeather[originalItem]->isActive());
|
||||||
|
weather->setComment(extWeather[originalItem]->comment());
|
||||||
|
weather->setName(extWeather[originalItem]->name());
|
||||||
|
weather->setInterval(extWeather[originalItem]->interval());
|
||||||
|
weather->setCity(extWeather[originalItem]->city());
|
||||||
|
weather->setCountry(extWeather[originalItem]->country());
|
||||||
|
weather->setTs(extWeather[originalItem]->ts());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (weather->showConfiguration() == 1) {
|
||||||
|
extWeather.clear();
|
||||||
|
extWeather = getExtWeather();
|
||||||
|
QListWidgetItem *widgetItem = new QListWidgetItem(weather->fileName());
|
||||||
|
QStringList tooltip;
|
||||||
|
tooltip.append(i18n("Name: %1", weather->name()));
|
||||||
|
tooltip.append(i18n("Comment: %1", weather->comment()));
|
||||||
|
tooltip.append(i18n("City: %1", weather->city()));
|
||||||
|
tooltip.append(i18n("Country: %1", weather->country()));
|
||||||
|
tooltip.append(i18n("Time: %1", weather->ts()));
|
||||||
|
widgetItem->setToolTip(tooltip.join(QChar('\n')));
|
||||||
|
widgetDialog->addItem(widgetItem);
|
||||||
|
widgetDialog->sortItems();
|
||||||
|
}
|
||||||
|
delete weather;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWKeys::addKeyToCache(const QString type, const QString key)
|
void AWKeys::addKeyToCache(const QString type, const QString key)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -1388,7 +1511,7 @@ QList<ExtQuotes *> AWKeys::getExtQuotes()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
names.append(files[j]);
|
names.append(files[j]);
|
||||||
externalQuotes.append(new ExtQuotes(0, files[j], dirs, debug));
|
externalQuotes.append(new ExtQuotes(nullptr, files[j], dirs, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1419,7 +1542,7 @@ QList<ExtScript *> AWKeys::getExtScripts()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
names.append(files[j]);
|
names.append(files[j]);
|
||||||
externalScripts.append(new ExtScript(0, files[j], dirs, debug));
|
externalScripts.append(new ExtScript(nullptr, files[j], dirs, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1450,7 +1573,7 @@ QList<ExtUpgrade *> AWKeys::getExtUpgrade()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
names.append(files[j]);
|
names.append(files[j]);
|
||||||
externalUpgrade.append(new ExtUpgrade(0, files[j], dirs, debug));
|
externalUpgrade.append(new ExtUpgrade(nullptr, files[j], dirs, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1458,6 +1581,37 @@ QList<ExtUpgrade *> AWKeys::getExtUpgrade()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<ExtWeather *> AWKeys::getExtWeather()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QList<ExtWeather *> externalWeather;
|
||||||
|
// create directory at $HOME
|
||||||
|
QString localDir = QString("%1/awesomewidgets/weather")
|
||||||
|
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||||
|
QDir localDirectory;
|
||||||
|
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
|
QString("awesomewidgets/weather"),
|
||||||
|
QStandardPaths::LocateDirectory);
|
||||||
|
QStringList names;
|
||||||
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
|
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
||||||
|
for (int j=0; j<files.count(); j++) {
|
||||||
|
if (!files[j].endsWith(QString(".desktop"))) continue;
|
||||||
|
if (names.contains(files[j])) continue;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
|
names.append(files[j]);
|
||||||
|
externalWeather.append(new ExtWeather(nullptr, files[j], dirs, debug));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return externalWeather;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<GraphicalItem *> AWKeys::getGraphicalItems()
|
QList<GraphicalItem *> AWKeys::getGraphicalItems()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -1481,7 +1635,7 @@ QList<GraphicalItem *> AWKeys::getGraphicalItems()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
names.append(files[j]);
|
names.append(files[j]);
|
||||||
items.append(new GraphicalItem(0, files[j], dirs, debug));
|
items.append(new GraphicalItem(nullptr, files[j], dirs, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ class AWToolTip;
|
|||||||
class ExtQuotes;
|
class ExtQuotes;
|
||||||
class ExtScript;
|
class ExtScript;
|
||||||
class ExtUpgrade;
|
class ExtUpgrade;
|
||||||
|
class ExtWeather;
|
||||||
class GraphicalItem;
|
class GraphicalItem;
|
||||||
|
|
||||||
class AWKeys : public QObject
|
class AWKeys : public QObject
|
||||||
@ -44,7 +45,8 @@ class AWKeys : public QObject
|
|||||||
RequestedGraphicalItem,
|
RequestedGraphicalItem,
|
||||||
RequestedExtQuotes,
|
RequestedExtQuotes,
|
||||||
RequestedExtScript,
|
RequestedExtScript,
|
||||||
RequestedExtUpgrade
|
RequestedExtUpgrade,
|
||||||
|
RequestedExtWeather
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -86,6 +88,7 @@ private slots:
|
|||||||
void copyQuotes(const QString original);
|
void copyQuotes(const QString original);
|
||||||
void copyScript(const QString original);
|
void copyScript(const QString original);
|
||||||
void copyUpgrade(const QString original);
|
void copyUpgrade(const QString original);
|
||||||
|
void copyWeather(const QString original);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// methods
|
// methods
|
||||||
@ -102,6 +105,7 @@ private:
|
|||||||
QList<ExtQuotes *> getExtQuotes();
|
QList<ExtQuotes *> getExtQuotes();
|
||||||
QList<ExtScript *> getExtScripts();
|
QList<ExtScript *> getExtScripts();
|
||||||
QList<ExtUpgrade *> getExtUpgrade();
|
QList<ExtUpgrade *> getExtUpgrade();
|
||||||
|
QList<ExtWeather *> getExtWeather();
|
||||||
QList<GraphicalItem *> getGraphicalItems();
|
QList<GraphicalItem *> getGraphicalItems();
|
||||||
GraphicalItem *getItemByTag(const QString tag);
|
GraphicalItem *getItemByTag(const QString tag);
|
||||||
QStringList getTimeKeys();
|
QStringList getTimeKeys();
|
||||||
@ -122,6 +126,7 @@ private:
|
|||||||
QList<ExtQuotes *> extQuotes;
|
QList<ExtQuotes *> extQuotes;
|
||||||
QList<ExtScript *> extScripts;
|
QList<ExtScript *> extScripts;
|
||||||
QList<ExtUpgrade *> extUpgrade;
|
QList<ExtUpgrade *> extUpgrade;
|
||||||
|
QList<ExtWeather *> extWeather;
|
||||||
QString pattern;
|
QString pattern;
|
||||||
QStringList foundBars, foundKeys, keys;
|
QStringList foundBars, foundKeys, keys;
|
||||||
QMap<QString, QString> values;
|
QMap<QString, QString> values;
|
||||||
|
@ -29,13 +29,15 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
|
|
||||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||||
|
${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.cpp)
|
||||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||||
file (GLOB SUBPROJECT_UI *.ui)
|
file (GLOB SUBPROJECT_UI *.ui)
|
||||||
file (GLOB SUBPROJECT_CONF *.conf)
|
file (GLOB SUBPROJECT_CONF *.conf)
|
||||||
set (SUBPROJECT_QUOTES ${CMAKE_CURRENT_SOURCE_DIR}/quotes)
|
set (SUBPROJECT_QUOTES ${CMAKE_CURRENT_SOURCE_DIR}/quotes)
|
||||||
set (SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
set (SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
||||||
set (SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
|
set (SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
|
||||||
|
set (SUBPROJECT_WEATHER ${CMAKE_CURRENT_SOURCE_DIR}/weather)
|
||||||
|
|
||||||
# prepare
|
# prepare
|
||||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
@ -55,3 +57,4 @@ install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
|||||||
install (DIRECTORY ${SUBPROJECT_QUOTES} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
install (DIRECTORY ${SUBPROJECT_QUOTES} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
|
install (DIRECTORY ${SUBPROJECT_WEATHER} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
|
@ -28,11 +28,13 @@
|
|||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
|
#include <qreplytimeout/qreplytimeout.h>
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName, const QStringList directories, const bool debugCmd)
|
ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName,
|
||||||
|
const QStringList directories, const bool debugCmd)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
m_fileName(quotesName),
|
m_fileName(quotesName),
|
||||||
m_dirs(directories),
|
m_dirs(directories),
|
||||||
@ -326,6 +328,7 @@ void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
|||||||
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
|
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
|
||||||
|
|
||||||
|
isRunning = false;
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
@ -355,8 +358,6 @@ void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
|||||||
values[QString("pricechg")] = values[QString("price")] == 0 ? 0.0 : value - values[QString("price")];
|
values[QString("pricechg")] = values[QString("price")] == 0 ? 0.0 : value - values[QString("price")];
|
||||||
values[QString("percpricechg")] = 100 * values[QString("pricechg")] / values[QString("price")];
|
values[QString("percpricechg")] = 100 * values[QString("pricechg")] / values[QString("price")];
|
||||||
values[QString("price")] = value;
|
values[QString("price")] = value;
|
||||||
|
|
||||||
isRunning = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,24 +26,6 @@
|
|||||||
#define YAHOO_URL "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol=\"$TICKER\"&env=store://datatables.org/alltableswithkeys&format=json"
|
#define YAHOO_URL "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol=\"$TICKER\"&env=store://datatables.org/alltableswithkeys&format=json"
|
||||||
|
|
||||||
|
|
||||||
class QReplyTimeout : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
QReplyTimeout(QNetworkReply *reply, const int timeout) : QObject(reply)
|
|
||||||
{
|
|
||||||
QTimer::singleShot(timeout, this, SLOT(timeout()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void timeout()
|
|
||||||
{
|
|
||||||
QNetworkReply *reply = static_cast<QNetworkReply *>(parent());
|
|
||||||
if (reply->isRunning()) reply->close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ExtQuotes;
|
class ExtQuotes;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
ExtScript::ExtScript(QWidget *parent, const QString scriptName, const QStringList directories, const bool debugCmd)
|
ExtScript::ExtScript(QWidget *parent, const QString scriptName,
|
||||||
|
const QStringList directories, const bool debugCmd)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
m_fileName(scriptName),
|
m_fileName(scriptName),
|
||||||
m_dirs(directories),
|
m_dirs(directories),
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "extquotes.h"
|
#include "extquotes.h"
|
||||||
#include "extscript.h"
|
#include "extscript.h"
|
||||||
#include "extupgrade.h"
|
#include "extupgrade.h"
|
||||||
|
#include "extweather.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList &args)
|
|||||||
initQuotes();
|
initQuotes();
|
||||||
initScripts();
|
initScripts();
|
||||||
initUpgrade();
|
initUpgrade();
|
||||||
|
initWeather();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,6 +71,7 @@ ExtendedSysMon::~ExtendedSysMon()
|
|||||||
externalQuotes.clear();
|
externalQuotes.clear();
|
||||||
externalScripts.clear();
|
externalScripts.clear();
|
||||||
externalUpgrade.clear();
|
externalUpgrade.clear();
|
||||||
|
externalWeather.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +151,7 @@ void ExtendedSysMon::initQuotes()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
names.append(files[j]);
|
names.append(files[j]);
|
||||||
externalQuotes.append(new ExtQuotes(0, files[j], dirs, debug));
|
externalQuotes.append(new ExtQuotes(nullptr, files[j], dirs, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +180,7 @@ void ExtendedSysMon::initScripts()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
names.append(files[j]);
|
names.append(files[j]);
|
||||||
externalScripts.append(new ExtScript(0, files[j], dirs, debug));
|
externalScripts.append(new ExtScript(nullptr, files[j], dirs, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,7 +209,36 @@ void ExtendedSysMon::initUpgrade()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
names.append(files[j]);
|
names.append(files[j]);
|
||||||
externalUpgrade.append(new ExtUpgrade(0, files[j], dirs, debug));
|
externalUpgrade.append(new ExtUpgrade(nullptr, files[j], dirs, debug));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtendedSysMon::initWeather()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
// create directory at $HOME and create dirs list
|
||||||
|
QString localDir = QString("%1/awesomewidgets/weather")
|
||||||
|
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||||
|
QDir localDirectory;
|
||||||
|
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
|
QString("awesomewidgets/weather"),
|
||||||
|
QStandardPaths::LocateDirectory);
|
||||||
|
|
||||||
|
QStringList names;
|
||||||
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
|
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
||||||
|
for (int j=0; j<files.count(); j++) {
|
||||||
|
if (!files[j].endsWith(QString(".desktop"))) continue;
|
||||||
|
if (names.contains(files[j])) continue;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
|
names.append(files[j]);
|
||||||
|
externalWeather.append(new ExtWeather(nullptr, files[j], dirs, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,6 +261,7 @@ QStringList ExtendedSysMon::sources() const
|
|||||||
source.append(QString("ps"));
|
source.append(QString("ps"));
|
||||||
source.append(QString("quotes"));
|
source.append(QString("quotes"));
|
||||||
source.append(QString("update"));
|
source.append(QString("update"));
|
||||||
|
source.append(QString("weather"));
|
||||||
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Sources" << source;
|
if (debug) qDebug() << PDEBUG << ":" << "Sources" << source;
|
||||||
return source;
|
return source;
|
||||||
@ -668,8 +701,10 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
for (int i=0; i<battery.keys().count(); i++)
|
for (int i=0; i<battery.keys().count(); i++)
|
||||||
setData(source, battery.keys()[i], battery[battery.keys()[i]]);
|
setData(source, battery.keys()[i], battery[battery.keys()[i]]);
|
||||||
} else if (source == QString("custom")) {
|
} else if (source == QString("custom")) {
|
||||||
for (int i=0; i<externalScripts.count(); i++)
|
for (int i=0; i<externalScripts.count(); i++) {
|
||||||
|
if (!externalScripts[i]->isActive()) continue;
|
||||||
setData(source, externalScripts[i]->tag(), externalScripts[i]->run());
|
setData(source, externalScripts[i]->tag(), externalScripts[i]->run());
|
||||||
|
}
|
||||||
} else if (source == QString("desktop")) {
|
} else if (source == QString("desktop")) {
|
||||||
QVariantMap desktop = getCurrentDesktop();
|
QVariantMap desktop = getCurrentDesktop();
|
||||||
for (int i=0; i<desktop.keys().count(); i++)
|
for (int i=0; i<desktop.keys().count(); i++)
|
||||||
@ -690,8 +725,10 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
} else if (source == QString("netdev")) {
|
} else if (source == QString("netdev")) {
|
||||||
setData(source, QString("value"), getNetworkDevice());
|
setData(source, QString("value"), getNetworkDevice());
|
||||||
} else if (source == QString("pkg")) {
|
} else if (source == QString("pkg")) {
|
||||||
for (int i=0; i<externalUpgrade.count(); i++)
|
for (int i=0; i<externalUpgrade.count(); i++) {
|
||||||
|
if (!externalUpgrade[i]->isActive()) continue;
|
||||||
setData(source, externalUpgrade[i]->tag(), externalUpgrade[i]->run());
|
setData(source, externalUpgrade[i]->tag(), externalUpgrade[i]->run());
|
||||||
|
}
|
||||||
} else if (source == QString("player")) {
|
} else if (source == QString("player")) {
|
||||||
QVariantMap player = getPlayerInfo(configuration[QString("PLAYER")],
|
QVariantMap player = getPlayerInfo(configuration[QString("PLAYER")],
|
||||||
configuration[QString("MPDADDRESS")],
|
configuration[QString("MPDADDRESS")],
|
||||||
@ -705,19 +742,20 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
setData(source, ps.keys()[i], ps[ps.keys()[i]]);
|
setData(source, ps.keys()[i], ps[ps.keys()[i]]);
|
||||||
} else if (source == QString("quotes")) {
|
} else if (source == QString("quotes")) {
|
||||||
for (int i=0; i<externalQuotes.count(); i++) {
|
for (int i=0; i<externalQuotes.count(); i++) {
|
||||||
|
if (!externalQuotes[i]->isActive()) continue;
|
||||||
QMap<QString, float> data = externalQuotes[i]->run();
|
QMap<QString, float> data = externalQuotes[i]->run();
|
||||||
setData(source, externalQuotes[i]->tag(QString("ask")), data[QString("ask")]);
|
for (int j=0; j<data.keys().count(); j++)
|
||||||
setData(source, externalQuotes[i]->tag(QString("askchg")), data[QString("askchg")]);
|
setData(source, externalQuotes[i]->tag(data.keys()[j]), data[data.keys()[j]]);
|
||||||
setData(source, externalQuotes[i]->tag(QString("percaskchg")), data[QString("percaskchg")]);
|
|
||||||
setData(source, externalQuotes[i]->tag(QString("bid")), data[QString("bid")]);
|
|
||||||
setData(source, externalQuotes[i]->tag(QString("bidchg")), data[QString("bidchg")]);
|
|
||||||
setData(source, externalQuotes[i]->tag(QString("percbidchg")), data[QString("percbidchg")]);
|
|
||||||
setData(source, externalQuotes[i]->tag(QString("price")), data[QString("price")]);
|
|
||||||
setData(source, externalQuotes[i]->tag(QString("pricechg")), data[QString("pricechg")]);
|
|
||||||
setData(source, externalQuotes[i]->tag(QString("percpricechg")), data[QString("percpricechg")]);
|
|
||||||
}
|
}
|
||||||
} else if (source == QString("update")) {
|
} else if (source == QString("update")) {
|
||||||
setData(source, QString("value"), true);
|
setData(source, QString("value"), true);
|
||||||
|
} else if (source == QString("weather")) {
|
||||||
|
for (int i=0; i<externalWeather.count(); i++) {
|
||||||
|
if (!externalWeather[i]->isActive()) continue;
|
||||||
|
QVariantMap data = externalWeather[i]->run();
|
||||||
|
for (int j=0; j<data.keys().count(); j++)
|
||||||
|
setData(source, externalWeather[i]->tag(data.keys()[j]), data[data.keys()[j]]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
class ExtQuotes;
|
class ExtQuotes;
|
||||||
class ExtScript;
|
class ExtScript;
|
||||||
class ExtUpgrade;
|
class ExtUpgrade;
|
||||||
|
class ExtWeather;
|
||||||
|
|
||||||
class ExtendedSysMon : public Plasma::DataEngine
|
class ExtendedSysMon : public Plasma::DataEngine
|
||||||
{
|
{
|
||||||
@ -59,6 +60,7 @@ private:
|
|||||||
QList<ExtQuotes *> externalQuotes;
|
QList<ExtQuotes *> externalQuotes;
|
||||||
QList<ExtScript *> externalScripts;
|
QList<ExtScript *> externalScripts;
|
||||||
QList<ExtUpgrade *> externalUpgrade;
|
QList<ExtUpgrade *> externalUpgrade;
|
||||||
|
QList<ExtWeather *> externalWeather;
|
||||||
bool debug;
|
bool debug;
|
||||||
// reread configuration
|
// reread configuration
|
||||||
QStringList allHddDevices;
|
QStringList allHddDevices;
|
||||||
@ -68,6 +70,7 @@ private:
|
|||||||
void initQuotes();
|
void initQuotes();
|
||||||
void initScripts();
|
void initScripts();
|
||||||
void initUpgrade();
|
void initUpgrade();
|
||||||
|
void initWeather();
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
QMap<QString, QString> updateConfiguration(QMap<QString, QString> rawConfig);
|
QMap<QString, QString> updateConfiguration(QMap<QString, QString> rawConfig);
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName, const QStringList directories, const bool debugCmd)
|
ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName,
|
||||||
|
const QStringList directories, const bool debugCmd)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
m_fileName(upgradeName),
|
m_fileName(upgradeName),
|
||||||
m_dirs(directories),
|
m_dirs(directories),
|
||||||
|
539
sources/extsysmon/extweather.cpp
Normal file
539
sources/extsysmon/extweather.cpp
Normal file
@ -0,0 +1,539 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "extweather.h"
|
||||||
|
#include "ui_extweather.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
#include <qreplytimeout/qreplytimeout.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
ExtWeather::ExtWeather(QWidget *parent, const QString weatherName,
|
||||||
|
const QStringList directories, const bool debugCmd)
|
||||||
|
: QDialog(parent),
|
||||||
|
m_fileName(weatherName),
|
||||||
|
m_dirs(directories),
|
||||||
|
debug(debugCmd),
|
||||||
|
ui(new Ui::ExtWeather)
|
||||||
|
{
|
||||||
|
m_name = m_fileName;
|
||||||
|
readConfiguration();
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
values[QString("weatherId")] = 0;
|
||||||
|
values[QString("weather")] = QString("");
|
||||||
|
values[QString("humidity")] = 0;
|
||||||
|
values[QString("pressure")] = 0.0;
|
||||||
|
values[QString("temperature")] = 0.0;
|
||||||
|
|
||||||
|
manager = new QNetworkAccessManager(this);
|
||||||
|
connect(manager, SIGNAL(finished(QNetworkReply *)),
|
||||||
|
this, SLOT(weatherReplyReceived(QNetworkReply*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ExtWeather::~ExtWeather()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
disconnect(manager, SIGNAL(finished(QNetworkReply *)),
|
||||||
|
this, SLOT(weatherReplyReceived(QNetworkReply *)));
|
||||||
|
|
||||||
|
delete manager;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtWeather::weatherFromInt(const int _id)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "ID" << _id;
|
||||||
|
// refer to http://openweathermap.org/weather-conditions
|
||||||
|
|
||||||
|
QString weather;
|
||||||
|
switch (_id) {
|
||||||
|
case 800:
|
||||||
|
// 01d
|
||||||
|
weather = QString("\u2600");
|
||||||
|
break;
|
||||||
|
case 801:
|
||||||
|
// 02d
|
||||||
|
weather = QString("\u26C5");
|
||||||
|
break;
|
||||||
|
case 802:
|
||||||
|
case 803:
|
||||||
|
// 03d
|
||||||
|
weather = QString("\u2601");
|
||||||
|
break;
|
||||||
|
case 804:
|
||||||
|
// 04d
|
||||||
|
weather = QString("\u2601");
|
||||||
|
break;
|
||||||
|
case 300:
|
||||||
|
case 301:
|
||||||
|
case 302:
|
||||||
|
case 310:
|
||||||
|
case 311:
|
||||||
|
case 312:
|
||||||
|
case 313:
|
||||||
|
case 314:
|
||||||
|
case 321:
|
||||||
|
case 520:
|
||||||
|
case 521:
|
||||||
|
case 522:
|
||||||
|
case 531:
|
||||||
|
// 09d
|
||||||
|
weather = QString("\u2602");
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
case 501:
|
||||||
|
case 502:
|
||||||
|
case 503:
|
||||||
|
case 504:
|
||||||
|
// 10d
|
||||||
|
weather = QString("\u2614");
|
||||||
|
break;
|
||||||
|
case 200:
|
||||||
|
case 201:
|
||||||
|
case 202:
|
||||||
|
case 210:
|
||||||
|
case 211:
|
||||||
|
case 212:
|
||||||
|
case 221:
|
||||||
|
case 230:
|
||||||
|
case 231:
|
||||||
|
case 232:
|
||||||
|
// 11d
|
||||||
|
weather = QString("\u2608");
|
||||||
|
break;
|
||||||
|
case 511:
|
||||||
|
case 600:
|
||||||
|
case 601:
|
||||||
|
case 602:
|
||||||
|
case 611:
|
||||||
|
case 612:
|
||||||
|
case 615:
|
||||||
|
case 616:
|
||||||
|
case 620:
|
||||||
|
case 621:
|
||||||
|
case 622:
|
||||||
|
// 13d
|
||||||
|
weather = QString("\u2603");
|
||||||
|
// weather = QString("\u26C4");
|
||||||
|
break;
|
||||||
|
case 701:
|
||||||
|
case 711:
|
||||||
|
case 721:
|
||||||
|
case 731:
|
||||||
|
case 741:
|
||||||
|
case 751:
|
||||||
|
case 761:
|
||||||
|
case 762:
|
||||||
|
case 771:
|
||||||
|
case 781:
|
||||||
|
// 50d
|
||||||
|
weather = QString("\u26C5");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// extreme other conditions
|
||||||
|
weather = QString("\u2604");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return weather;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtWeather::apiVersion()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtWeather::comment()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtWeather::fileName()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtWeather::interval()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtWeather::isActive()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtWeather::name()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtWeather::number()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtWeather::tag(const QString _type)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Tag type" << _type;
|
||||||
|
|
||||||
|
return QString("%1%2").arg(_type).arg(m_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtWeather::city()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_city;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtWeather::country()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_country;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtWeather::ts()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setApiVersion(const int _apiVersion)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||||
|
|
||||||
|
m_apiVersion = _apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setActive(const bool _state)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "State" << _state;
|
||||||
|
|
||||||
|
m_active = _state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setComment(const QString _comment)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||||
|
|
||||||
|
m_comment = _comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setInterval(const int _interval)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
|
||||||
|
|
||||||
|
m_interval = _interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setName(const QString _name)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||||
|
|
||||||
|
m_name = _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setNumber(int _number)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
|
||||||
|
if (_number == -1) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
|
||||||
|
qsrand(QTime::currentTime().msec());
|
||||||
|
_number = qrand() % 1000;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_number = _number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setCity(const QString _city)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "City" << _city;
|
||||||
|
|
||||||
|
m_city = _city;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setCountry(const QString _country)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Country" << _country;
|
||||||
|
|
||||||
|
m_country = _country;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::setTs(const int _ts)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Timestamp" << _ts;
|
||||||
|
|
||||||
|
m_ts = _ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::readConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||||
|
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||||
|
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
setName(settings.value(QString("Name"), m_name).toString());
|
||||||
|
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||||
|
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
|
||||||
|
setCity(settings.value(QString("X-AW-City"), m_city).toString());
|
||||||
|
setCountry(settings.value(QString("X-AW-Country"), m_country).toString());
|
||||||
|
setTs(settings.value(QString("X-AW-TS"), m_ts).toInt());
|
||||||
|
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
||||||
|
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||||
|
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update for current API
|
||||||
|
if ((m_apiVersion > 0) && (m_apiVersion < AWEWAPI)) {
|
||||||
|
setApiVersion(AWEWAPI);
|
||||||
|
writeConfiguration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariantMap ExtWeather::run()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if ((!m_active) || (isRunning)) return values;
|
||||||
|
|
||||||
|
if (times == 1) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Send request";
|
||||||
|
isRunning = true;
|
||||||
|
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url(m_ts != 0))));
|
||||||
|
new QReplyTimeout(reply, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// update value
|
||||||
|
if (times >= m_interval) times = 0;
|
||||||
|
times++;
|
||||||
|
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtWeather::showConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
ui->lineEdit_name->setText(m_name);
|
||||||
|
ui->lineEdit_comment->setText(m_comment);
|
||||||
|
ui->label_numberValue->setText(QString("%1").arg(m_number));
|
||||||
|
ui->lineEdit_city->setText(m_city);
|
||||||
|
ui->lineEdit_country->setText(m_country);
|
||||||
|
ui->spinBox_timestamp->setValue(m_ts);
|
||||||
|
ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked);
|
||||||
|
ui->spinBox_interval->setValue(m_interval);
|
||||||
|
|
||||||
|
int ret = exec();
|
||||||
|
if (ret != 1) return ret;
|
||||||
|
setName(ui->lineEdit_name->text());
|
||||||
|
setComment(ui->lineEdit_comment->text());
|
||||||
|
setNumber(ui->label_numberValue->text().toInt());
|
||||||
|
setApiVersion(AWEWAPI);
|
||||||
|
setCity(ui->lineEdit_city->text());
|
||||||
|
setCountry(ui->lineEdit_country->text());
|
||||||
|
setTs(ui->spinBox_timestamp->value());
|
||||||
|
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||||
|
setInterval(ui->spinBox_interval->value());
|
||||||
|
|
||||||
|
writeConfiguration();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtWeather::tryDelete()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||||
|
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||||
|
|
||||||
|
// check if exists
|
||||||
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
|
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::writeConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||||
|
settings.setValue(QString("Name"), m_name);
|
||||||
|
settings.setValue(QString("Comment"), m_comment);
|
||||||
|
settings.setValue(QString("X-AW-City"), m_city);
|
||||||
|
settings.setValue(QString("X-AW-Country"), m_country);
|
||||||
|
settings.setValue(QString("X-AW-TS"), m_ts);
|
||||||
|
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||||
|
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
||||||
|
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||||
|
settings.setValue(QString("X-AW-Number"), m_number);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
|
||||||
|
|
||||||
|
isRunning = false;
|
||||||
|
QJsonParseError error;
|
||||||
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
|
||||||
|
reply->deleteLater();
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Json parse error" << error.errorString();
|
||||||
|
if ((reply->error() != QNetworkReply::NoError) ||
|
||||||
|
(error.error != QJsonParseError::NoError)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert to map
|
||||||
|
QVariantMap json = jsonDoc.toVariant().toMap();
|
||||||
|
if (json[QString("cod")].toInt() != 200) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Invalid return code";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap data;
|
||||||
|
if (m_ts == 0)
|
||||||
|
data = parseSingleJson(json);
|
||||||
|
else {
|
||||||
|
QVariantList list = json[QString("list")].toList();
|
||||||
|
data = parseSingleJson(list.count() <= m_ts ? list[m_ts-1].toMap() : list.last().toMap());
|
||||||
|
}
|
||||||
|
for (int i=0; i<data.keys().count(); i++)
|
||||||
|
values[data.keys()[i]] = data[data.keys()[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariantMap ExtWeather::parseSingleJson(const QVariantMap json)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QVariantMap output;
|
||||||
|
|
||||||
|
// weather status
|
||||||
|
QVariantList weather = json[QString("weather")].toList();
|
||||||
|
if (weather.count() > 0) {
|
||||||
|
int _id = weather[0].toMap()[QString("id")].toInt();
|
||||||
|
output[QString("weatherId")] = _id;
|
||||||
|
output[QString("weather")] = weatherFromInt(_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// main data
|
||||||
|
QVariantMap mainWeather = json[QString("main")].toMap();
|
||||||
|
if (weather.count() > 0) {
|
||||||
|
output[QString("humidity")] = mainWeather[QString("humidity")].toFloat();
|
||||||
|
output[QString("pressure")] = mainWeather[QString("pressure")].toFloat();
|
||||||
|
output[QString("temperature")] = mainWeather[QString("temp")].toFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtWeather::url(const bool isForecast)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << "Is forecast" << isForecast;
|
||||||
|
|
||||||
|
QString apiUrl = isForecast ? QString(OWM_FORECAST_URL) : QString(OWM_URL);
|
||||||
|
apiUrl.replace(QString("$CITY"), m_city);
|
||||||
|
apiUrl.replace(QString("$COUNTRY"), m_country);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "API url" << apiUrl;
|
||||||
|
|
||||||
|
return apiUrl;
|
||||||
|
}
|
109
sources/extsysmon/extweather.h
Normal file
109
sources/extsysmon/extweather.h
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef EXTWEATHER_H
|
||||||
|
#define EXTWEATHER_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
|
||||||
|
#define OWM_URL "http://api.openweathermap.org/data/2.5/weather?q=$CITY,$COUNTRY&units=metric"
|
||||||
|
#define OWM_FORECAST_URL "http://api.openweathermap.org/data/2.5/forecast?q=$CITY,$COUNTRY&units=metric"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ExtWeather;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExtWeather : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
||||||
|
Q_PROPERTY(QString name READ name WRITE setName)
|
||||||
|
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
||||||
|
Q_PROPERTY(int interval READ interval WRITE setInterval)
|
||||||
|
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
||||||
|
Q_PROPERTY(int number READ number WRITE setNumber)
|
||||||
|
Q_PROPERTY(QString city READ city WRITE setCity)
|
||||||
|
Q_PROPERTY(QString country READ country WRITE setCountry)
|
||||||
|
Q_PROPERTY(int ts READ ts WRITE setTs)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ExtWeather(QWidget *parent = nullptr, const QString weatherName = QString(),
|
||||||
|
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||||
|
~ExtWeather();
|
||||||
|
QString weatherFromInt(const int _id);
|
||||||
|
// get methods
|
||||||
|
int apiVersion();
|
||||||
|
QString comment();
|
||||||
|
QString fileName();
|
||||||
|
int interval();
|
||||||
|
bool isActive();
|
||||||
|
QString name();
|
||||||
|
int number();
|
||||||
|
QString tag(const QString _type = QString("temperature"));
|
||||||
|
QString city();
|
||||||
|
QString country();
|
||||||
|
int ts();
|
||||||
|
// set methods
|
||||||
|
void setApiVersion(const int _apiVersion = 0);
|
||||||
|
void setActive(const bool _state = true);
|
||||||
|
void setComment(const QString _comment = QString("empty"));
|
||||||
|
void setInterval(const int _interval = 0);
|
||||||
|
void setName(const QString _name = QString("none"));
|
||||||
|
void setNumber(int _number = -1);
|
||||||
|
void setCity(const QString _city = QString("New York"));
|
||||||
|
void setCountry(const QString _country = QString("us"));
|
||||||
|
void setTs(const int _ts = 0);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void readConfiguration();
|
||||||
|
QVariantMap run();
|
||||||
|
int showConfiguration();
|
||||||
|
bool tryDelete();
|
||||||
|
void writeConfiguration();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void weatherReplyReceived(QNetworkReply *reply);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_fileName;
|
||||||
|
QStringList m_dirs;
|
||||||
|
bool debug;
|
||||||
|
QNetworkAccessManager *manager;
|
||||||
|
bool isRunning = false;
|
||||||
|
Ui::ExtWeather *ui;
|
||||||
|
QVariantMap parseSingleJson(const QVariantMap json);
|
||||||
|
QString url(const bool isForecast = false);
|
||||||
|
// properties
|
||||||
|
int m_apiVersion = 0;
|
||||||
|
bool m_active = true;
|
||||||
|
QString m_comment = QString("empty");
|
||||||
|
int m_interval = 3600;
|
||||||
|
QString m_name = QString("none");
|
||||||
|
int m_number = -1;
|
||||||
|
QString m_city = QString("New York");
|
||||||
|
QString m_country = QString("us");
|
||||||
|
int m_ts = 0;
|
||||||
|
// values
|
||||||
|
int times = 0;
|
||||||
|
QVariantMap values;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* EXTWEATHER_H */
|
271
sources/extsysmon/extweather.ui
Normal file
271
sources/extsysmon/extweather.ui
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ExtWeather</class>
|
||||||
|
<widget class="QDialog" name="ExtWeather">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>420</width>
|
||||||
|
<height>301</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Configuration</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_name">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_name">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_name"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_comment">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_comment">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Comment</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_comment"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_number">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_number">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tag</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_numberValue">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_city">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_city">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>City</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_city"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_country">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_country">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Country</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_country"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_timestamp">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_timestamp">
|
||||||
|
<property name="text">
|
||||||
|
<string>Timestamp</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_timestamp">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>40</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_active">
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_active">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_active">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Active</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_interval">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_interval">
|
||||||
|
<property name="text">
|
||||||
|
<string>Interval</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_interval">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>60</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>ExtWeather</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>ExtWeather</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -17,6 +17,8 @@
|
|||||||
#define AWESAPI 3
|
#define AWESAPI 3
|
||||||
// extupgrade api version
|
// extupgrade api version
|
||||||
#define AWEUAPI 2
|
#define AWEUAPI 2
|
||||||
|
// extweather api version
|
||||||
|
#define AWEWAPI 1
|
||||||
|
|
||||||
// links
|
// links
|
||||||
#define HOMEPAGE "http://arcanis.name/projects/awesome-widgets/"
|
#define HOMEPAGE "http://arcanis.name/projects/awesome-widgets/"
|
||||||
|
Loading…
Reference in New Issue
Block a user