mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
add network request source
This commit is contained in:
parent
7565ea2e82
commit
06f4882a2d
@ -42,12 +42,14 @@ const QStringList getBuildData()
|
||||
metadata.append(QString(" BUILD_DATE: %1").arg(BUILD_DATE));
|
||||
// configuration
|
||||
metadata.append(QString("API details:"));
|
||||
metadata.append(QString(" AWGIAPI: %1").arg(AWGIAPI));
|
||||
metadata.append(QString(" AWEQAPI: %1").arg(AWEQAPI));
|
||||
metadata.append(QString(" AWESAPI: %1").arg(AWESAPI));
|
||||
metadata.append(QString(" AWEUAPI: %1").arg(AWEUAPI));
|
||||
metadata.append(QString(" AWEWAPI: %1").arg(AWEWAPI));
|
||||
metadata.append(QString(" AWEFAPI: %1").arg(AWEFAPI));
|
||||
metadata.append(QString(" AW_GRAPHITEM_API: %1").arg(AW_GRAPHITEM_API));
|
||||
metadata.append(QString(" AW_EXTQUOTES_API: %1").arg(AW_EXTQUOTES_API));
|
||||
metadata.append(QString(" AW_EXTSCRIPT_API: %1").arg(AW_EXTSCRIPT_API));
|
||||
metadata.append(
|
||||
QString(" AW_EXTUPGRADE_API: %1").arg(AW_EXTUPGRADE_API));
|
||||
metadata.append(
|
||||
QString(" AW_EXTWEATHER_API: %1").arg(AW_EXTWEATHER_API));
|
||||
metadata.append(QString(" AW_FORMATTER_API: %1").arg(AW_FORMATTER_API));
|
||||
metadata.append(QString(" REQUEST_TIMEOUT: %1").arg(REQUEST_TIMEOUT));
|
||||
metadata.append(QString(" TIME_KEYS: %1").arg(TIME_KEYS));
|
||||
metadata.append(QString(" STATIC_KEYS: %1").arg(STATIC_KEYS));
|
||||
|
@ -221,8 +221,8 @@ Item {
|
||||
}
|
||||
|
||||
ButtonSelector {
|
||||
value: i18n("Quotes monitor")
|
||||
onButtonActivated: awKeys.editItem("extquotes")
|
||||
value: i18n("Network requests")
|
||||
onButtonActivated: awKeys.editItem("extnetworkrequest")
|
||||
}
|
||||
|
||||
ButtonSelector {
|
||||
@ -230,6 +230,11 @@ Item {
|
||||
onButtonActivated: awKeys.editItem("extupgrade")
|
||||
}
|
||||
|
||||
ButtonSelector {
|
||||
value: i18n("Quotes monitor")
|
||||
onButtonActivated: awKeys.editItem("extquotes")
|
||||
}
|
||||
|
||||
ButtonSelector {
|
||||
value: i18n("Weather")
|
||||
onButtonActivated: awKeys.editItem("extweather")
|
||||
|
@ -327,7 +327,7 @@ void AWFormatterHelper::doCreateItem()
|
||||
case AWAbstractFormatter::FormatterClass::String:
|
||||
return createItem<AWStringFormatter>();
|
||||
case AWAbstractFormatter::FormatterClass::Json:
|
||||
return createItem<AWNoFormatter>();
|
||||
return createItem<AWJsonFormatter>();
|
||||
case AWAbstractFormatter::FormatterClass::NoFormat:
|
||||
return createItem<AWNoFormatter>();
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "awkeycache.h"
|
||||
#include "awpatternfunctions.h"
|
||||
// extensions
|
||||
#include "extnetworkrequest.h"
|
||||
#include "extquotes.h"
|
||||
#include "extscript.h"
|
||||
#include "extupgrade.h"
|
||||
@ -46,6 +47,7 @@ AWKeyOperations::~AWKeyOperations()
|
||||
|
||||
// extensions
|
||||
delete m_graphicalItems;
|
||||
delete m_extNetRequest;
|
||||
delete m_extQuotes;
|
||||
delete m_extScripts;
|
||||
delete m_extUpgrade;
|
||||
@ -151,6 +153,9 @@ QStringList AWKeyOperations::dictKeys() const
|
||||
// custom
|
||||
for (auto item : m_extScripts->activeItems())
|
||||
allKeys.append(item->tag(QString("custom")));
|
||||
// network requests
|
||||
for (auto item : m_extNetRequest->activeItems())
|
||||
allKeys.append(item->tag(QString("response")));
|
||||
// bars
|
||||
for (auto item : m_graphicalItems->activeItems())
|
||||
allKeys.append(item->tag(QString("bar")));
|
||||
@ -225,6 +230,10 @@ QString AWKeyOperations::infoByKey(QString key) const
|
||||
} else if (key.startsWith(QString("temp"))) {
|
||||
output
|
||||
= m_devices[QString("temp")][key.remove(QString("temp")).toInt()];
|
||||
} else if (key.startsWith(QString("response"))) {
|
||||
AbstractExtItem *item = m_extNetRequest->itemByTag(key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else {
|
||||
output = QString("(none)");
|
||||
}
|
||||
@ -257,6 +266,8 @@ void AWKeyOperations::editItem(const QString type)
|
||||
keys.sort();
|
||||
m_graphicalItems->setConfigArgs(keys);
|
||||
return m_graphicalItems->editItems();
|
||||
} else if (type == QString("extnetworkrequest")) {
|
||||
return m_extNetRequest->editItems();
|
||||
} else if (type == QString("extquotes")) {
|
||||
return m_extQuotes->editItems();
|
||||
} else if (type == QString("extscript")) {
|
||||
@ -308,6 +319,8 @@ void AWKeyOperations::reinitKeys()
|
||||
// delete them if any
|
||||
delete m_graphicalItems;
|
||||
m_graphicalItems = nullptr;
|
||||
delete m_extNetRequest;
|
||||
m_extNetRequest = nullptr;
|
||||
delete m_extQuotes;
|
||||
m_extQuotes = nullptr;
|
||||
delete m_extScripts;
|
||||
@ -319,6 +332,8 @@ void AWKeyOperations::reinitKeys()
|
||||
// create
|
||||
m_graphicalItems
|
||||
= new ExtItemAggregator<GraphicalItem>(nullptr, QString("desktops"));
|
||||
m_extNetRequest = new ExtItemAggregator<ExtNetworkRequest>(
|
||||
nullptr, QString("requests"));
|
||||
m_extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, QString("quotes"));
|
||||
m_extScripts
|
||||
= new ExtItemAggregator<ExtScript>(nullptr, QString("scripts"));
|
||||
|
@ -30,6 +30,7 @@
|
||||
class AWDataAggregator;
|
||||
class AWDataEngineAggregator;
|
||||
class AWKeysAggregator;
|
||||
class ExtNetworkRequest;
|
||||
class ExtQuotes;
|
||||
class ExtScript;
|
||||
class ExtUpgrade;
|
||||
@ -70,6 +71,7 @@ private:
|
||||
void reinitKeys();
|
||||
// objects
|
||||
ExtItemAggregator<GraphicalItem> *m_graphicalItems = nullptr;
|
||||
ExtItemAggregator<ExtNetworkRequest> *m_extNetRequest = nullptr;
|
||||
ExtItemAggregator<ExtQuotes> *m_extQuotes = nullptr;
|
||||
ExtItemAggregator<ExtScript> *m_extScripts = nullptr;
|
||||
ExtItemAggregator<ExtUpgrade> *m_extUpgrade = nullptr;
|
||||
|
@ -441,6 +441,12 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
|
||||
// network device
|
||||
m_map[source] = QString("netdev");
|
||||
m_formatter[QString("netdev")] = FormatterType::NoFormat;
|
||||
} else if (source.startsWith(QString("network/response"))) {
|
||||
// network response
|
||||
QString key = source;
|
||||
key.remove(QString("network/"));
|
||||
m_map[source] = key;
|
||||
m_formatter[key] = FormatterType::NoFormat;
|
||||
} else if (source.contains(netRegExp)) {
|
||||
// network speed
|
||||
QString type = source.contains(QString("receiver")) ? QString("down")
|
||||
|
@ -144,7 +144,7 @@ void AWTelemetryHandler::uploadTelemetry(const QString group,
|
||||
|
||||
// generate payload
|
||||
QVariantMap payload;
|
||||
payload[QString("api")] = AWTEAPI;
|
||||
payload[QString("api")] = AW_TELEMETRY_API;
|
||||
payload[QString("client_id")] = m_clientId;
|
||||
payload[QString("metadata")] = value;
|
||||
payload[QString("type")] = group;
|
||||
|
@ -19,6 +19,7 @@ set(SUBPROJECT_FORMATTERS ${CMAKE_CURRENT_SOURCE_DIR}/formatters)
|
||||
set(SUBPROJECT_GRAPHITEMS ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
set(SUBPROJECT_QUOTES ${CMAKE_CURRENT_SOURCE_DIR}/quotes)
|
||||
set(SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
||||
set(SUBPROJECT_REQUESTS ${CMAKE_CURRENT_SOURCE_DIR}/requests)
|
||||
set(SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
|
||||
set(SUBPROJECT_WEATHER ${CMAKE_CURRENT_SOURCE_DIR}/weather)
|
||||
file(GLOB SUBPROJECT_WEATHER_JSON_IN *.json)
|
||||
@ -37,6 +38,7 @@ install(DIRECTORY ${SUBPROJECT_FORMATTERS} DESTINATION ${DATA_INSTALL_DIR}/${PRO
|
||||
install(DIRECTORY ${SUBPROJECT_GRAPHITEMS} 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_REQUESTS} 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})
|
||||
install(FILES ${SUBPROJECT_INI} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
|
@ -115,7 +115,7 @@ void AWDateTimeFormatter::readConfiguration()
|
||||
settings.value(QString("X-AW-Translate"), translateString()).toBool());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEFAPI);
|
||||
bumpApi(AW_FORMATTER_API);
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ int AWDateTimeFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWEFAPI);
|
||||
setApiVersion(AW_FORMATTER_API);
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setFormat(ui->lineEdit_format->text());
|
||||
setTranslateString(ui->checkBox_translate->checkState() == Qt::Checked);
|
||||
|
@ -210,7 +210,7 @@ void AWFloatFormatter::readConfiguration()
|
||||
setSummand(settings.value(QString("X-AW-Summand"), summand()).toDouble());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEFAPI);
|
||||
bumpApi(AW_FORMATTER_API);
|
||||
}
|
||||
|
||||
|
||||
@ -236,7 +236,7 @@ int AWFloatFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWEFAPI);
|
||||
setApiVersion(AW_FORMATTER_API);
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setFormat(ui->comboBox_format->currentText().at(0).toLatin1());
|
||||
setPrecision(ui->spinBox_precision->value());
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QSettings>
|
||||
|
||||
#include "awdebug.h"
|
||||
@ -51,7 +52,12 @@ QString AWJsonFormatter::convert(const QVariant &_value) const
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Convert value" << _value;
|
||||
|
||||
QVariant converted = _value;
|
||||
// check if _value is string and parse first if required
|
||||
QJsonDocument json
|
||||
= _value.type() == QVariant::String
|
||||
? QJsonDocument::fromJson(_value.toString().toUtf8())
|
||||
: QJsonDocument::fromVariant(_value);
|
||||
QVariant converted = json.toVariant();
|
||||
for (auto &element : m_splittedPath)
|
||||
converted = getFromJson(converted, element);
|
||||
|
||||
@ -99,7 +105,7 @@ void AWJsonFormatter::readConfiguration()
|
||||
setPath(settings.value(QString("X-AW-Path"), path()).toString());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEFAPI);
|
||||
bumpApi(AW_FORMATTER_API);
|
||||
}
|
||||
|
||||
|
||||
@ -109,7 +115,7 @@ int AWJsonFormatter::showConfiguration(const QVariant args)
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
ui->lineEdit_comment->setText(comment());
|
||||
ui->label_typeValue->setText(QString("NoFormat"));
|
||||
ui->label_typeValue->setText(QString("Json"));
|
||||
ui->lineEdit_path->setText(path());
|
||||
|
||||
int ret = exec();
|
||||
@ -117,7 +123,7 @@ int AWJsonFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWEFAPI);
|
||||
setApiVersion(AW_FORMATTER_API);
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setPath(ui->lineEdit_path->text());
|
||||
|
||||
|
@ -132,7 +132,7 @@ void AWListFormatter::readConfiguration()
|
||||
setSorted(settings.value(QString("X-AW-Sort"), isSorted()).toBool());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEFAPI);
|
||||
bumpApi(AW_FORMATTER_API);
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ int AWListFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWEFAPI);
|
||||
setApiVersion(AW_FORMATTER_API);
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setFilter(ui->lineEdit_filter->text());
|
||||
setSeparator(ui->lineEdit_separator->text());
|
||||
|
@ -79,7 +79,7 @@ int AWNoFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWEFAPI);
|
||||
setApiVersion(AW_FORMATTER_API);
|
||||
setStrType(ui->label_typeValue->text());
|
||||
|
||||
writeConfiguration();
|
||||
|
@ -152,7 +152,7 @@ void AWScriptFormatter::readConfiguration()
|
||||
settings.value(QString("X-AW-HasReturn"), hasReturn()).toBool());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEFAPI);
|
||||
bumpApi(AW_FORMATTER_API);
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ int AWScriptFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWEFAPI);
|
||||
setApiVersion(AW_FORMATTER_API);
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setAppendCode(ui->checkBox_appendCode->checkState() == Qt::Checked);
|
||||
setHasReturn(ui->checkBox_hasReturn->checkState() == Qt::Checked);
|
||||
|
@ -133,7 +133,7 @@ void AWStringFormatter::readConfiguration()
|
||||
settings.value(QString("X-AW-ForceWidth"), forceWidth()).toBool());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEFAPI);
|
||||
bumpApi(AW_FORMATTER_API);
|
||||
}
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ int AWStringFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWEFAPI);
|
||||
setApiVersion(AW_FORMATTER_API);
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setCount(ui->spinBox_width->value());
|
||||
setFillChar(ui->lineEdit_fill->text().at(0));
|
||||
|
210
sources/awesomewidgets/extnetworkrequest.cpp
Normal file
210
sources/awesomewidgets/extnetworkrequest.cpp
Normal file
@ -0,0 +1,210 @@
|
||||
/***************************************************************************
|
||||
* 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 "extnetworkrequest.h"
|
||||
#include "ui_extnetworkrequest.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include <qreplytimeout/qreplytimeout.h>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
ExtNetworkRequest::ExtNetworkRequest(QWidget *parent, const QString filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
, ui(new Ui::ExtNetworkRequest)
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
if (!filePath.isEmpty())
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
m_values[tag(QString("response"))] = QString();
|
||||
|
||||
// HACK declare as child of nullptr to avoid crash with plasmawindowed
|
||||
// in the destructor
|
||||
m_manager = new QNetworkAccessManager(nullptr);
|
||||
connect(m_manager, SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(networkReplyReceived(QNetworkReply *)));
|
||||
}
|
||||
|
||||
|
||||
ExtNetworkRequest::~ExtNetworkRequest()
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
disconnect(m_manager, SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(networkReplyReceived(QNetworkReply *)));
|
||||
|
||||
m_manager->deleteLater();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
ExtNetworkRequest *ExtNetworkRequest::copy(const QString _fileName,
|
||||
const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtNetworkRequest *item
|
||||
= new ExtNetworkRequest(static_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
item->setStringUrl(stringUrl());
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
QString ExtNetworkRequest::stringUrl() const
|
||||
{
|
||||
return m_stringUrl;
|
||||
}
|
||||
|
||||
|
||||
QString ExtNetworkRequest::uniq() const
|
||||
{
|
||||
return m_url.toString();
|
||||
}
|
||||
|
||||
|
||||
void ExtNetworkRequest::setStringUrl(const QString _url)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Url" << _url;
|
||||
|
||||
m_stringUrl = _url;
|
||||
initUrl();
|
||||
}
|
||||
|
||||
|
||||
void ExtNetworkRequest::readConfiguration()
|
||||
{
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
QSettings settings(fileName(), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setStringUrl(settings.value(QString("X-AW-Url"), stringUrl()).toString());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AW_EXTNETREQUEST_API);
|
||||
}
|
||||
|
||||
|
||||
QVariantHash ExtNetworkRequest::run()
|
||||
{
|
||||
if ((!isActive()) || (m_isRunning))
|
||||
return m_values;
|
||||
|
||||
if (m_times == 1) {
|
||||
qCInfo(LOG_LIB) << "Send request";
|
||||
m_isRunning = true;
|
||||
QNetworkReply *reply = m_manager->get(QNetworkRequest(m_url));
|
||||
new QReplyTimeout(reply, REQUEST_TIMEOUT);
|
||||
}
|
||||
|
||||
// update value
|
||||
if (m_times >= interval())
|
||||
m_times = 0;
|
||||
m_times++;
|
||||
|
||||
return m_values;
|
||||
}
|
||||
|
||||
|
||||
int ExtNetworkRequest::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
ui->lineEdit_comment->setText(comment());
|
||||
ui->label_numberValue->setText(QString("%1").arg(number()));
|
||||
ui->lineEdit_url->setText(stringUrl());
|
||||
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked
|
||||
: Qt::Unchecked);
|
||||
ui->spinBox_interval->setValue(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(AW_EXTNETREQUEST_API);
|
||||
setStringUrl(ui->lineEdit_url->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void ExtNetworkRequest::writeConfiguration() const
|
||||
{
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(writtableConfig(), QSettings::IniFormat);
|
||||
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("X-AW-Url"), stringUrl());
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
void ExtNetworkRequest::networkReplyReceived(QNetworkReply *reply)
|
||||
{
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
qCWarning(LOG_AW) << "An error occurs" << reply->error()
|
||||
<< "with message" << reply->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
m_isRunning = false;
|
||||
m_values[tag(QString("response"))]
|
||||
= QTextCodec::codecForMib(106)->toUnicode(reply->readAll()).trimmed();
|
||||
|
||||
emit(dataReceived(m_values));
|
||||
}
|
||||
|
||||
|
||||
void ExtNetworkRequest::initUrl()
|
||||
{
|
||||
m_url = QUrl(m_stringUrl);
|
||||
}
|
||||
|
||||
|
||||
void ExtNetworkRequest::translate()
|
||||
{
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label_url->setText(i18n("URL"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
}
|
71
sources/awesomewidgets/extnetworkrequest.h
Normal file
71
sources/awesomewidgets/extnetworkrequest.h
Normal file
@ -0,0 +1,71 @@
|
||||
/***************************************************************************
|
||||
* 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 EXTNETWORKREQUEST_H
|
||||
#define EXTNETWORKREQUEST_H
|
||||
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ExtNetworkRequest;
|
||||
}
|
||||
|
||||
class ExtNetworkRequest : public AbstractExtItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString stringUrl READ stringUrl WRITE setStringUrl)
|
||||
|
||||
public:
|
||||
explicit ExtNetworkRequest(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
virtual ~ExtNetworkRequest();
|
||||
ExtNetworkRequest *copy(const QString _fileName, const int _number);
|
||||
// get methods
|
||||
QString stringUrl() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setStringUrl(const QString _url = QString("https://httpbin.org/get"));
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void networkReplyReceived(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *m_manager = nullptr;
|
||||
QUrl m_url;
|
||||
bool m_isRunning = false;
|
||||
Ui::ExtNetworkRequest *ui = nullptr;
|
||||
void initUrl();
|
||||
void translate();
|
||||
// properties
|
||||
QString m_stringUrl = QString("https://httpbin.org/get");
|
||||
// values
|
||||
int m_times = 0;
|
||||
QVariantHash m_values;
|
||||
};
|
||||
|
||||
|
||||
#endif /* EXTNETWORKREQUEST_H */
|
227
sources/awesomewidgets/extnetworkrequest.ui
Normal file
227
sources/awesomewidgets/extnetworkrequest.ui
Normal file
@ -0,0 +1,227 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExtNetworkRequest</class>
|
||||
<widget class="QDialog" name="ExtNetworkRequest">
|
||||
<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_url">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_url">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>URL</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_url"/>
|
||||
</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>ExtNetworkRequest</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>ExtNetworkRequest</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>
|
@ -119,7 +119,7 @@ void ExtQuotes::readConfiguration()
|
||||
setTicker(settings.value(QString("X-AW-Ticker"), ticker()).toString());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEQAPI);
|
||||
bumpApi(AW_EXTQUOTES_API);
|
||||
}
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ int ExtQuotes::showConfiguration(const QVariant args)
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWEQAPI);
|
||||
setApiVersion(AW_EXTQUOTES_API);
|
||||
setTicker(ui->lineEdit_ticker->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
|
@ -229,7 +229,7 @@ void ExtScript::readConfiguration()
|
||||
.split(QChar(','), QString::SkipEmptyParts));
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWESAPI);
|
||||
bumpApi(AW_EXTSCRIPT_API);
|
||||
}
|
||||
|
||||
|
||||
@ -313,7 +313,7 @@ int ExtScript::showConfiguration(const QVariant args)
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWESAPI);
|
||||
setApiVersion(AW_EXTSCRIPT_API);
|
||||
setExecutable(ui->lineEdit_command->text());
|
||||
setPrefix(ui->lineEdit_prefix->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
|
@ -136,7 +136,7 @@ void ExtUpgrade::readConfiguration()
|
||||
setFilter(settings.value(QString("X-AW-Filter"), filter()).toString());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEUAPI);
|
||||
bumpApi(AW_EXTUPGRADE_API);
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ int ExtUpgrade::showConfiguration(const QVariant args)
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWEUAPI);
|
||||
setApiVersion(AW_EXTUPGRADE_API);
|
||||
setExecutable(ui->lineEdit_command->text());
|
||||
setFilter(ui->lineEdit_filter->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
|
@ -227,7 +227,7 @@ void ExtWeather::readConfiguration()
|
||||
settings.value(QString("X-AW-Provider"), strProvider()).toString());
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWEWAPI);
|
||||
bumpApi(AW_EXTWEATHER_API);
|
||||
}
|
||||
|
||||
|
||||
@ -301,7 +301,7 @@ int ExtWeather::showConfiguration(const QVariant args)
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWEWAPI);
|
||||
setApiVersion(AW_EXTWEATHER_API);
|
||||
setCity(ui->lineEdit_city->text());
|
||||
setCountry(ui->lineEdit_country->text());
|
||||
setProvider(static_cast<Provider>(ui->comboBox_provider->currentIndex()));
|
||||
|
@ -455,7 +455,7 @@ void GraphicalItem::readConfiguration()
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWGIAPI);
|
||||
bumpApi(AW_GRAPHITEM_API);
|
||||
initScene();
|
||||
}
|
||||
|
||||
@ -504,7 +504,7 @@ int GraphicalItem::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWGIAPI);
|
||||
setApiVersion(AW_GRAPHITEM_API);
|
||||
setCount(ui->spinBox_count->value());
|
||||
setCustom(ui->checkBox_custom->isChecked());
|
||||
setBar(m_custom ? ui->lineEdit_customValue->text()
|
||||
|
9
sources/awesomewidgets/requests/httpbin.desktop
Normal file
9
sources/awesomewidgets/requests/httpbin.desktop
Normal file
@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=httpbin
|
||||
Comment=httpbin example
|
||||
X-AW-Ticker=https://httpbin.org/get
|
||||
X-AW-Active=false
|
||||
X-AW-ApiVersion=1
|
||||
X-AW-Interval=10
|
||||
X-AW-Number=0
|
@ -29,6 +29,7 @@
|
||||
#include "playersource.h"
|
||||
#include "processessource.h"
|
||||
#include "quotessource.h"
|
||||
#include "requestsource.h"
|
||||
#include "upgradesource.h"
|
||||
#include "weathersource.h"
|
||||
|
||||
@ -134,6 +135,11 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> config)
|
||||
= new ProcessesSource(this, QStringList());
|
||||
for (auto source : processesItem->sources())
|
||||
m_map[source] = processesItem;
|
||||
// network request
|
||||
AbstractExtSysMonSource *requestItem
|
||||
= new RequestSource(this, QStringList());
|
||||
for (auto source : requestItem->sources())
|
||||
m_map[source] = requestItem;
|
||||
// quotes
|
||||
AbstractExtSysMonSource *quotesItem = new QuotesSource(this, QStringList());
|
||||
for (auto source : quotesItem->sources())
|
||||
|
95
sources/extsysmonsources/requestsource.cpp
Normal file
95
sources/extsysmonsources/requestsource.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
/***************************************************************************
|
||||
* 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 "requestsource.h"
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "extnetworkrequest.h"
|
||||
|
||||
|
||||
RequestSource::RequestSource(QObject *parent, const QStringList args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 0);
|
||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||
|
||||
m_extNetRequest = new ExtItemAggregator<ExtNetworkRequest>(
|
||||
nullptr, QString("requests"));
|
||||
m_sources = getSources();
|
||||
}
|
||||
|
||||
|
||||
RequestSource::~RequestSource()
|
||||
{
|
||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_extNetRequest;
|
||||
}
|
||||
|
||||
|
||||
QVariant RequestSource::data(QString source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
int ind = index(source);
|
||||
source.remove(QString("network/"));
|
||||
if (!m_values.contains(source)) {
|
||||
QVariantHash data = m_extNetRequest->itemByTagNumber(ind)->run();
|
||||
for (auto key : data.keys())
|
||||
m_values[key] = data[key];
|
||||
}
|
||||
QVariant value = m_values.take(source);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap RequestSource::initialData(QString source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
int ind = index(source);
|
||||
QVariantMap data;
|
||||
if (source.startsWith(QString("network/response"))) {
|
||||
data[QString("min")] = QString("");
|
||||
data[QString("max")] = QString("");
|
||||
data[QString("name")]
|
||||
= QString("Network response for %1")
|
||||
.arg(m_extNetRequest->itemByTagNumber(ind)->uniq());
|
||||
data[QString("type")] = QString("QString");
|
||||
data[QString("units")] = QString("");
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
QStringList RequestSource::sources() const
|
||||
{
|
||||
return m_sources;
|
||||
}
|
||||
|
||||
|
||||
QStringList RequestSource::getSources()
|
||||
{
|
||||
QStringList sources;
|
||||
for (auto item : m_extNetRequest->activeItems())
|
||||
sources.append(
|
||||
QString("network/%1").arg(item->tag(QString("response"))));
|
||||
|
||||
return sources;
|
||||
}
|
50
sources/extsysmonsources/requestsource.h
Normal file
50
sources/extsysmonsources/requestsource.h
Normal file
@ -0,0 +1,50 @@
|
||||
/***************************************************************************
|
||||
* 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 REQUESTSOURCE_H
|
||||
#define REQUESTSOURCE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "abstractextsysmonsource.h"
|
||||
#include "extitemaggregator.h"
|
||||
|
||||
|
||||
class ExtNetworkRequest;
|
||||
|
||||
class RequestSource : public AbstractExtSysMonSource
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RequestSource(QObject *parent, const QStringList args);
|
||||
virtual ~RequestSource();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
void run(){};
|
||||
QStringList sources() const;
|
||||
|
||||
private:
|
||||
QStringList getSources();
|
||||
// configuration and values
|
||||
ExtItemAggregator<ExtNetworkRequest> *m_extNetRequest = nullptr;
|
||||
QStringList m_sources;
|
||||
QVariantHash m_values;
|
||||
};
|
||||
|
||||
|
||||
#endif /* REQUESTSOURCE_H */
|
@ -25,19 +25,21 @@ const char CHANGELOG[] = "@PROJECT_CHANGELOG@";
|
||||
|
||||
// configuraion
|
||||
// graphical items api version
|
||||
const int AWGIAPI = 5;
|
||||
const int AW_GRAPHITEM_API = 5;
|
||||
// extquotes api version
|
||||
const int AWEQAPI = 3;
|
||||
const int AW_EXTQUOTES_API = 3;
|
||||
// extscript api version
|
||||
const int AWESAPI = 4;
|
||||
const int AW_EXTSCRIPT_API = 4;
|
||||
// extupgrade api version
|
||||
const int AWEUAPI = 3;
|
||||
const int AW_EXTUPGRADE_API = 3;
|
||||
// extweather api version
|
||||
const int AWEWAPI = 3;
|
||||
const int AW_EXTWEATHER_API = 3;
|
||||
// extnetworkrequest api version
|
||||
const int AW_EXTNETREQUEST_API = 1;
|
||||
// formatter api version
|
||||
const int AWEFAPI = 2;
|
||||
const int AW_FORMATTER_API = 3;
|
||||
// telemetry api version
|
||||
const int AWTEAPI = 1;
|
||||
const int AW_TELEMETRY_API = 1;
|
||||
// dbus adaptor properties
|
||||
// use define here instead of normal const definition for moc
|
||||
#define AWDBUS_SERVICE_NAME "org.kde.plasma.awesomewidget"
|
||||
|
Loading…
Reference in New Issue
Block a user