diff --git a/CHANGELOG b/CHANGELOG
index 4d9c8e8..a7f14e1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,9 @@
-ver.2.3.4:
+Ver.2.3.4:
++ add support of load average (la1, la5, la15 tags)
- fix bug with invalid network data calculation
-* update pattern parsing to recent plasma changes
+* improve work with data updating (#57)
+* move plugin part back to private
+* cast plugin as type, not signleton (#57)
Ver.2.3.3:
* change text rendering from Qt to native
diff --git a/CHANGELOG-RU b/CHANGELOG-RU
index 281108e..c5dd528 100644
--- a/CHANGELOG-RU
+++ b/CHANGELOG-RU
@@ -1,3 +1,10 @@
+Вер.2.3.4:
++ добавлена поддержа LA (теги la1, la5, la15)
+- исправлен баг с неправильным расчетам скорости сети
+* улучшена работа с обновлениями виджета (#57)
+* плагин опять стал приватным
+* исправлен каст плагина с синглтона (#57)
+
Вер.2.3.3:
* изменен рендеринг с Qt на нативный
diff --git a/arch/PKGBUILD b/arch/PKGBUILD
index aaf4819..edd9f77 100644
--- a/arch/PKGBUILD
+++ b/arch/PKGBUILD
@@ -2,7 +2,7 @@
pkgname=plasma5-applet-awesome-widgets
_pkgname=awesome-widgets
-pkgver=2.3.3
+pkgver=2.3.4
pkgrel=1
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
arch=('i686' 'x86_64')
@@ -17,7 +17,7 @@ optdepends=("catalyst: for GPU monitor"
makedepends=('cmake' 'extra-cmake-modules')
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
install=${pkgname}.install
-md5sums=('a40592d66d9b5149fc7d470dc3e355cb')
+md5sums=('74e5b45df042e81c20f5e8bf421451f8')
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
prepare() {
diff --git a/sources/awesome-widget/package/contents/ui/main.qml b/sources/awesome-widget/package/contents/ui/main.qml
index 839c363..650770b 100644
--- a/sources/awesome-widget/package/contents/ui/main.qml
+++ b/sources/awesome-widget/package/contents/ui/main.qml
@@ -66,7 +66,8 @@ Item {
}
signal dropSource(string sourceName)
- signal needUpdate
+ signal needTextUpdate(string newText)
+ signal needToolTipUpdate(string newText)
signal sizeUpdate
@@ -91,7 +92,7 @@ Item {
onNewData: {
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
// FIXME: ugly workaround to make some sources working
- systemmonitorDE.interval = plasmoid.configuration.interval
+// systemmonitorDE.interval = plasmoid.configuration.interval
awKeys.setDataBySource(sourceName, data, settings)
}
@@ -112,7 +113,7 @@ Item {
onNewData: {
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
// FIXME: ugly workaround to make some sources working
- extsysmonDE.interval = plasmoid.configuration.interval
+// extsysmonDE.interval = plasmoid.configuration.interval
awKeys.setDataBySource(sourceName, data, settings)
}
@@ -175,7 +176,8 @@ Item {
Plasmoid.userConfiguringChanged(false)
// connect data
awKeys.dropSourceFromDataengine.connect(dropSource)
- awKeys.needToBeUpdated.connect(needUpdate)
+ awKeys.needTextToBeUpdated.connect(needTextUpdate)
+ awKeys.needToolTipToBeUpdated.connect(needToolTipUpdate)
}
onDropSource: {
@@ -185,15 +187,19 @@ Item {
systemmonitorDE.disconnectSource(sourceName)
}
- onNeedUpdate: {
- if (debug) console.log("[main::onNeedUpdate]")
-
- text.text = awKeys.parsePattern()
- tooltip.text = awKeys.toolTipImage()
+ onNeedTextUpdate: {
+ if (debug) console.log("[main::onNeedTextUpdate]")
+ text.text = newText
sizeUpdate()
}
+ onNeedToolTipUpdate: {
+ if (debug) console.log("[main::onNeedToolTipUpdate]")
+
+ tooltip.text = newText
+ }
+
onSizeUpdate: {
if (debug) console.log("[main::onSizeUpdate]")
@@ -223,7 +229,7 @@ Item {
awKeys.setPopupEnabled(plasmoid.configuration.notify)
awKeys.setWrapNewLines(plasmoid.configuration.wrapNewLines)
- needUpdate()
+ needTextUpdate(plasmoid.configuration.text)
}
function action_checkUpdates() {
diff --git a/sources/awesome-widget/plugin/awactions.cpp b/sources/awesome-widget/plugin/awactions.cpp
index 3889935..9a95eaa 100644
--- a/sources/awesome-widget/plugin/awactions.cpp
+++ b/sources/awesome-widget/plugin/awactions.cpp
@@ -215,7 +215,8 @@ void AWActions::showUpdates(QString version)
text += i18n("New version : %1", version) + QString("\n\n");
text += i18n("Click \"Ok\" to download");
- int select = QMessageBox::information(0, i18n("There are updates"), text, QMessageBox::Ok | QMessageBox::Cancel);
+ int select = QMessageBox::information(nullptr, i18n("There are updates"), text,
+ QMessageBox::Ok | QMessageBox::Cancel);
switch (select) {
case QMessageBox::Ok:
QDesktopServices::openUrl(QString(RELEASES) + version);
diff --git a/sources/awesome-widget/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp
index b733d54..f283cb5 100644
--- a/sources/awesome-widget/plugin/awkeys.cpp
+++ b/sources/awesome-widget/plugin/awkeys.cpp
@@ -51,6 +51,9 @@ AWKeys::AWKeys(QObject *parent)
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
debug = (debugEnv == QString("yes"));
+ // backend
+ connect(this, SIGNAL(needToBeUpdated()), this, SLOT(dataUpdate()));
+
// init dialog
dialog = new QDialog(nullptr);
widgetDialog = new QListWidget(dialog);
@@ -73,11 +76,6 @@ AWKeys::~AWKeys()
if (debug) qDebug() << PDEBUG;
delete toolTip;
- delete createButton;
- delete copyButton;
- delete deleteButton;
- delete dialogButtons;
- delete widgetDialog;
delete dialog;
graphicalItems.clear();
@@ -165,22 +163,6 @@ QString AWKeys::parsePattern()
}
-QString AWKeys::toolTipImage()
-{
- if(debug) qDebug() << PDEBUG;
- if (toolTip == nullptr) return QString("");
-
- if (keys.isEmpty()) return QString();
-
- QPixmap tooltip = toolTip->image();
- QByteArray byteArray;
- QBuffer buffer(&byteArray);
- tooltip.save(&buffer, "PNG");
-
- return QString("
").arg(QString(byteArray.toBase64()));
-}
-
-
QSize AWKeys::toolTipSize()
{
if (debug) qDebug() << PDEBUG;
@@ -327,6 +309,10 @@ QStringList AWKeys::dictKeys(const bool sorted)
allKeys.append(QString("desktop"));
allKeys.append(QString("ndesktop"));
allKeys.append(QString("tdesktops"));
+ // load average
+ allKeys.append(QString("la15"));
+ allKeys.append(QString("la5"));
+ allKeys.append(QString("la1"));
// bars
QStringList graphicalItemsKeys;
for (int i=0; iimage();
+ QByteArray byteArray;
+ QBuffer buffer(&byteArray);
+ tooltip.save(&buffer, "PNG");
+
+ return QString("
").arg(QString(byteArray.toBase64()));
+}
+
+
QStringList AWKeys::findGraphicalItems()
{
if (debug) qDebug() << PDEBUG;
diff --git a/sources/awesome-widget/plugin/awkeys.h b/sources/awesome-widget/plugin/awkeys.h
index be1ad76..ffc895c 100644
--- a/sources/awesome-widget/plugin/awkeys.h
+++ b/sources/awesome-widget/plugin/awkeys.h
@@ -57,7 +57,6 @@ public:
Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
Q_INVOKABLE bool isDebugEnabled();
Q_INVOKABLE QString parsePattern();
- Q_INVOKABLE QString toolTipImage();
Q_INVOKABLE QSize toolTipSize();
// keys
Q_INVOKABLE void addDevice(const QString source);
@@ -74,9 +73,12 @@ public:
signals:
void dropSourceFromDataengine(const QString source);
+ void needTextToBeUpdated(const QString newText);
+ void needToolTipToBeUpdated(const QString newText);
void needToBeUpdated();
private slots:
+ void dataUpdate();
void loadKeysFromCache();
void reinitKeys();
// editor
@@ -93,10 +95,10 @@ private:
QString htmlValue(QString key);
int numberCpus();
float temperature(const float temp, const QString units);
+ QString toolTipImage();
// find methods
QStringList findGraphicalItems();
QStringList findKeys();
- // get methods
// get methods
QList getExtQuotes();
QList getExtScripts();
diff --git a/sources/awesome-widget/plugin/awtooltip.cpp b/sources/awesome-widget/plugin/awtooltip.cpp
index 568c139..d0e5dd8 100644
--- a/sources/awesome-widget/plugin/awtooltip.cpp
+++ b/sources/awesome-widget/plugin/awtooltip.cpp
@@ -33,7 +33,7 @@ AWToolTip::AWToolTip(QObject *parent, QVariantMap settings)
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
debug = (debugEnv == QString("yes"));
- toolTipScene = new QGraphicsScene();
+ toolTipScene = new QGraphicsScene(nullptr);
toolTipView = new QGraphicsView(toolTipScene);
toolTipView->setStyleSheet(QString("background: transparent"));
toolTipView->setContentsMargins(0, 0, 0, 0);
@@ -72,7 +72,6 @@ AWToolTip::~AWToolTip()
{
if (debug) qDebug() << PDEBUG;
- delete toolTipView;
delete toolTipScene;
}
@@ -94,10 +93,9 @@ QPixmap AWToolTip::image()
toolTipScene->clear();
QPen pen = QPen();
// background
- if (configuration[QString("useTooltipBackground")].toBool())
- toolTipScene->setBackgroundBrush(QBrush(QColor(configuration[QString("tooltipBackground")].toString())));
- else
- toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
+ toolTipScene->setBackgroundBrush(configuration[QString("useTooltipBackground")].toBool() ?
+ QBrush(QColor(configuration[QString("tooltipBackground")].toString())) :
+ QBrush(Qt::NoBrush));
bool down = false;
for (int i=0; i(data[requiredKeys[i]].count());
diff --git a/sources/awesome-widget/plugin/graphicalitem.h b/sources/awesome-widget/plugin/graphicalitem.h
index 5168f53..50f522b 100644
--- a/sources/awesome-widget/plugin/graphicalitem.h
+++ b/sources/awesome-widget/plugin/graphicalitem.h
@@ -52,7 +52,8 @@ public:
};
explicit GraphicalItem(QWidget *parent = nullptr, const QString desktopName = QString(),
- const QStringList directories = QStringList(), const bool debugCmd = false);
+ const QStringList directories = QStringList(),
+ const bool debugCmd = false);
~GraphicalItem();
QString fileName();
QString image(const float value);
diff --git a/sources/extsysmon/extquotes.cpp b/sources/extsysmon/extquotes.cpp
index 637851d..3b5e941 100644
--- a/sources/extsysmon/extquotes.cpp
+++ b/sources/extsysmon/extquotes.cpp
@@ -151,12 +151,12 @@ void ExtQuotes::setApiVersion(const int _apiVersion)
}
-void ExtQuotes::setActive(const bool state)
+void ExtQuotes::setActive(const bool _state)
{
if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "State" << state;
+ if (debug) qDebug() << PDEBUG << ":" << "State" << _state;
- m_active = state;
+ m_active = _state;
}
diff --git a/sources/extsysmon/extscript.cpp b/sources/extsysmon/extscript.cpp
index 69577eb..1f35bbb 100644
--- a/sources/extsysmon/extscript.cpp
+++ b/sources/extsysmon/extscript.cpp
@@ -196,12 +196,12 @@ void ExtScript::setApiVersion(const int _apiVersion)
}
-void ExtScript::setActive(const bool state)
+void ExtScript::setActive(const bool _state)
{
if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "State" << state;
+ if (debug) qDebug() << PDEBUG << ":" << "State" << _state;
- m_active = state;
+ m_active = _state;
}
@@ -519,7 +519,7 @@ void ExtScript::updateValue()
if (debug) qDebug() << PDEBUG << ":" << "Output" << qoutput;
break;
case stderr2stdout:
- value = QString("%1\t%2").arg(qdebug).arg(qoutput);
+ value = QString("%1\n%2").arg(qdebug).arg(qoutput);
break;
case nothing:
default:
diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp
index c92957f..890d5ca 100644
--- a/sources/extsysmon/extsysmon.cpp
+++ b/sources/extsysmon/extsysmon.cpp
@@ -333,14 +333,14 @@ QVariantMap ExtendedSysMon::getBattery(const QString acpiPath)
(fullLevelFile.open(QIODevice::ReadOnly))) {
float batCurrent = QString(currentLevelFile.readLine()).trimmed().toFloat();
float batFull = QString(fullLevelFile.readLine()).trimmed().toFloat();
- battery[QString("bat%1").arg(i)] = 100 * batCurrent / batFull;
+ battery[QString("bat%1").arg(i)] = static_cast(100 * batCurrent / batFull);
currentLevel += batCurrent;
fullLevel += batFull;
}
currentLevelFile.close();
fullLevelFile.close();
}
- battery[QString("bat")] = 100 * currentLevel / fullLevel;
+ battery[QString("bat")] = static_cast(100 * currentLevel / fullLevel);
return battery;
}
diff --git a/sources/extsysmon/extupgrade.cpp b/sources/extsysmon/extupgrade.cpp
index 5b0c742..0d9900c 100644
--- a/sources/extsysmon/extupgrade.cpp
+++ b/sources/extsysmon/extupgrade.cpp
@@ -146,12 +146,12 @@ void ExtUpgrade::setApiVersion(const int _apiVersion)
}
-void ExtUpgrade::setActive(const bool state)
+void ExtUpgrade::setActive(const bool _state)
{
if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "State" << state;
+ if (debug) qDebug() << PDEBUG << ":" << "State" << _state;
- m_active = state;
+ m_active = _state;
}
@@ -251,7 +251,7 @@ int ExtUpgrade::run()
if (!m_active) return value;
if ((times == 1) && (process->state() == QProcess::NotRunning))
- process->start(QString("bash -c \"%1\"").arg(m_executable));
+ process->start(QString("sh -c \"%1\"").arg(m_executable));
else if (times >= m_interval)
times = 0;
times++;