Compare commits

..

17 Commits

Author SHA1 Message Date
14cee9dbc7 release 2.0.5 2014-10-05 00:20:09 +04:00
5759273e4c add workaroud for resizing 2014-10-04 01:17:34 +04:00
4387bb1e76 some fixes which was introduced with the latest patches 2014-10-02 06:13:10 +04:00
03af5f0e49 upd task, add ability to use $ symbol over $$ 2014-10-02 05:10:02 +04:00
7f6afbcb4d add resizing 2014-10-01 03:15:28 +04:00
4a320bc5d6 more correct destuction 2014-10-01 02:59:47 +04:00
29d34525a3 fix plasma crash caused by label destruction 2014-10-01 02:57:06 +04:00
0ab74b493c fix #31, update submodules 2014-10-01 02:33:10 +04:00
952fa97fcc Merge branch 'master' of github.com:arcan1s/awesome-widgets 2014-10-01 02:02:13 +04:00
677ed1ab5e fix update netdev 2014-10-01 02:01:18 +04:00
deb0b3bdbb chenge forceupdate logic 2014-09-29 00:59:19 +04:00
20c85f0d42 fix number of issue 2014-09-28 23:12:33 +04:00
f9a37f0cb2 edit echange log, fix #20 2014-09-26 01:43:22 +04:00
0c8013c26b add tooltip bottom 2014-09-26 01:41:27 +04:00
6b9e19ed58 Merge branch 'master' of github.com:arcan1s/awesome-widgets 2014-09-25 23:25:08 +04:00
432ab694fd update changelog 2014-09-25 23:24:33 +04:00
c506183247 fix battery tooltip 2014-09-24 09:51:46 +04:00
13 changed files with 83 additions and 47 deletions

View File

@ -1,4 +1,10 @@
V.2.0.4:
Ver.2.0.5:
+ add tooltip bottom (#30)
* fix network interface update
* fix battery tooltip bug
* edit DP layout (#31)
Ver.2.0.4:
* more correct work with batteries
Ver.2.0.3:

View File

@ -1,3 +1,9 @@
Вер.2.0.5:
+ добавлен нижний край к тултипу (#30)
* исправлен баг с обновлением сетевого интерфейса
* исправлен баг с тултипом батареи
* отредактирована разметка DP (#31)
Вер.2.0.4:
* более корректная работа с батареями

View File

@ -1,8 +1,8 @@
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
# Maintainer: Evgeniy Alekseev <arcanis at archlinux dot org>
pkgname=kdeplasma-applets-awesome-widgets
_pkgname=awesome-widgets
pkgver=2.0.4
pkgver=2.0.5
pkgrel=1
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
arch=('i686' 'x86_64')
@ -19,7 +19,7 @@ optdepends=("amarok: for music player monitor"
makedepends=('automoc4' 'cmake')
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
install=${pkgname}.install
md5sums=('21a3de6376bb7ebb779bfc927e98eb91')
md5sums=('a86de1841491ea1fc1d8021c5b3d9d43')
backup=('usr/share/config/extsysmon.conf')
prepare() {

View File

@ -292,8 +292,7 @@ Additional information
TODO (wish list)
----------------
* 3rdpatry modules support (C++, Python and Shell modules in the plan)
* graphical bars support
See [milestones](https://github.com/arcan1s/awesome-widgets/milestones) for more details.
Links
-----

View File

@ -1,9 +1,5 @@
post_install() {
kbuildsycoca4 > /dev/null 2>&1
cat << __EOF
To migrate to version 2.* and newer see this article:
http://arcanis.name/en/2014/09/04/migration-to-v2/
__EOF
}
post_upgrade() {

View File

@ -8,7 +8,7 @@ cmake_policy (SET CMP0015 NEW)
project (awesome-widgets)
set (PROJECT_VERSION_MAJOR 2)
set (PROJECT_VERSION_MINOR 0)
set (PROJECT_VERSION_PATCH 4)
set (PROJECT_VERSION_PATCH 5)
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)

View File

@ -83,9 +83,9 @@ void AwesomeWidget::createActions()
connect(contextMenu[1], SIGNAL(triggered(bool)), this, SLOT(showReadme()));
contextMenu.append(new QAction(QIcon::fromTheme(QString("stock-refresh")),
i18n("Update text"), this));
connect(contextMenu[2], SIGNAL(triggered(bool)), this, SLOT(updateNetworkDevice()));
connect(contextMenu[2], SIGNAL(triggered(bool)), extsysmonEngine, SLOT(updateAllSources()));
connect(contextMenu[2], SIGNAL(triggered(bool)), sysmonEngine, SLOT(updateAllSources()));
connect(contextMenu[2], SIGNAL(triggered(bool)), this, SLOT(updateNetworkDevice()));
}
@ -202,10 +202,7 @@ void AwesomeWidget::init()
setLayout(mainLayout);
textLabel = new CustomLabel(this, debug);
QGraphicsProxyWidget *pw = new QGraphicsProxyWidget(this);
pw->setAttribute(Qt::WA_TranslucentBackground, true);
pw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
textLabel->setAttribute(Qt::WA_TranslucentBackground, true);
textLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
pw->setWidget(textLabel);
mainLayout->addItem(pw, 0, 0);

View File

@ -65,7 +65,7 @@ public slots:
void configChanged();
// update events
void sendNotification(const QString eventId, const QString message);
void updateNetworkDevice();
void updateNetworkDevice(const bool delay = true);
void updateText(const bool clear = false);
void updateTooltip();

View File

@ -198,13 +198,13 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0);
}
if ((configuration[QString("batteryTooltip")].toInt() == 2) &&
(!isnan(data[QString("bat0")].toFloat()))) {
(!isnan(data[QString("bat")].toFloat()))) {
if (tooltipValues[QString("bat")].count() > configuration[QString("tooltipNumber")].toInt())
tooltipValues[QString("bat")].takeFirst();
if (data[QString("ac")].toBool())
tooltipValues[QString("bat0")].append(data[QString("bat0")].toFloat());
tooltipValues[QString("bat")].append(data[QString("bat")].toFloat());
else
tooltipValues[QString("bat0")].append(-data[QString("bat0")].toFloat());
tooltipValues[QString("bat")].append(-data[QString("bat")].toFloat());
}
} else if (sourceName == QString("cpu/system/TotalLoad")) {
values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
@ -340,12 +340,12 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
tooltipValues[QString("down")].append(data[QString("value")].toFloat());
}
networkDeviceUpdate++;
if (networkDeviceUpdate == 30) {
if (networkDeviceUpdate >= 30) {
networkDeviceUpdate = 0;
if (configuration[QString("useCustomNetdev")].toInt() == 2) {
if (configuration[QString("useCustomNetdev")].toInt() == 0) {
sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), this);
sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), this);
updateNetworkDevice();
updateNetworkDevice(false);
sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"),
this, configuration[QString("interval")].toInt());
sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"),

View File

@ -43,7 +43,7 @@ void AwesomeWidget::reinit()
keys = getKeys();
foundKeys = findKeys();
updateNetworkDevice();
updateNetworkDevice(false);
connectToEngine();
}
@ -63,10 +63,13 @@ void AwesomeWidget::sendNotification(const QString eventId, const QString messag
}
void AwesomeWidget::updateNetworkDevice()
void AwesomeWidget::updateNetworkDevice(const bool delay)
{
if (debug) qDebug() << PDEBUG;
if (delay)
networkDeviceUpdate = 30;
else
values[QString("netdev")] = getNetworkDevice();
}
@ -76,9 +79,12 @@ void AwesomeWidget::updateText(const bool clear)
if (debug) qDebug() << PDEBUG;
QString text = configuration[QString("text")];
if (!clear)
if (!clear) {
text.replace(QString("$$"), QString("$\\$\\"));
for (int i=0; i<foundKeys.count(); i++)
text.replace(QString("$") + foundKeys[i], values[foundKeys[i]]);
text.replace(QString("$\\$\\"), QString("$$"));
}
textLabel->setText(formatLine[0] + text + formatLine[1]);
update();
}
@ -88,7 +94,7 @@ void AwesomeWidget::updateTooltip()
{
if (debug) qDebug() << PDEBUG;
toolTipView->resize(100.0 * counts[QString("tooltip")], 100.0);
toolTipView->resize(100.0 * counts[QString("tooltip")], 105.0);
// boundaries
QMap<QString, float> boundaries;
boundaries[QString("cpu")] = 100.0;
@ -137,9 +143,9 @@ void AwesomeWidget::updateTooltip()
if (down) shift -= 100.0;
for (int j=0; j<tooltipValues[trueKeys[i]].count()-1; j++) {
float x1 = j * normX + shift;
float y1 = - fabs(tooltipValues[trueKeys[i]][j]) * normY;
float y1 = - fabs(tooltipValues[trueKeys[i]][j]) * normY + 5.0;
float x2 = (j + 1) * normX + shift;
float y2 = - fabs(tooltipValues[trueKeys[i]][j+1]) * normY;
float y2 = - fabs(tooltipValues[trueKeys[i]][j+1]) * normY + 5.0;
if (isBattery) {
if (tooltipValues[trueKeys[i]][j+1] > 0)
pen.setColor(QColor(configuration[QString("batteryColor")]));

View File

@ -27,8 +27,9 @@
#include <QDebug>
#include <QFile>
#include <QGraphicsGridLayout>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsProxyWidget>
#include <QGraphicsView>
#include <QMouseEvent>
#include <QProcessEnvironment>
#include <QTextCodec>
@ -37,7 +38,7 @@
CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num, const bool debugCmd)
: Plasma::Label(wid),
: QLabel(0),
debug(debugCmd),
number(num),
widget(wid)
@ -59,13 +60,14 @@ int CustomPlasmaLabel::getNumber()
}
void CustomPlasmaLabel::mousePressEvent(QGraphicsSceneMouseEvent *event)
void CustomPlasmaLabel::mousePressEvent(QMouseEvent *event)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button();
if (event->button() == Qt::LeftButton)
widget->setCurrentDesktop(number);
emit(QLabel::mousePressEvent(event));
}
@ -183,15 +185,14 @@ void DesktopPanel::reinit()
// clear
// labels
for (int i=0; i<labels.count(); i++) {
layout->removeItem(labels[i]);
for (int i=0; i<proxyWidgets.count(); i++) {
layout->removeItem(proxyWidgets[i]);
proxyWidgets[i]->setWidget(0);
delete labels[i];
delete proxyWidgets[i];
}
labels.clear();
// layout
layout = new QGraphicsGridLayout();
layout->setContentsMargins(1, 1, 1, 1);
setLayout(layout);
proxyWidgets.clear();
// add
// layout
@ -199,16 +200,22 @@ void DesktopPanel::reinit()
setBackgroundHints(NoBackground);
// labels
for (int i=0; i<desktopNames.count(); i++) {
labels.append(new CustomPlasmaLabel(this, i));
proxyWidgets.append(new QGraphicsProxyWidget(this));
labels.append(new CustomPlasmaLabel(this, i, debug));
labels[i]->setWordWrap(false);
labels[i]->setAttribute(Qt::WA_NoSystemBackground, true);
labels[i]->setAttribute(Qt::WA_TranslucentBackground, true);
proxyWidgets[i]->setWidget(labels[i]);
if (configuration[QString("layout")].toInt() == 0)
layout->addItem(labels[i], 0, i);
layout->addItem(proxyWidgets[i], 0, i);
else
layout->addItem(labels[i], i, 0);
layout->addItem(proxyWidgets[i], i, 0);
}
updateText(true);
for (int i=0; i<proxyWidgets.count(); i++) {
labels[i]->adjustSize();
proxyWidgets[i]->setGeometry(labels[i]->geometry());
}
}
@ -271,6 +278,22 @@ void DesktopPanel::updateText(const bool first)
labels[i]->setText(text);
}
update();
int height = 0;
int width = 0;
for (int i=0; i<proxyWidgets.count(); i++) {
labels[i]->adjustSize();
proxyWidgets[i]->setGeometry(labels[i]->geometry());
if (configuration[QString("layout")].toInt() == 0) {
width += proxyWidgets[i]->geometry().width();
if (height < proxyWidgets[i]->geometry().height())
height = proxyWidgets[i]->geometry().height();
} else {
height += proxyWidgets[i]->geometry().height();
if (width < proxyWidgets[i]->geometry().width())
width = proxyWidgets[i]->geometry().width();
}
}
layout->setMinimumSize(width, height);
}

View File

@ -21,7 +21,7 @@
#include <Plasma/Applet>
#include <Plasma/DataEngine>
#include <Plasma/Label>
#include <QLabel>
#include <ui_appearance.h>
#include <ui_toggle.h>
@ -29,21 +29,23 @@
class QGraphicsGridLayout;
class QGraphicsProxyWidget;
class DesktopPanel;
class CustomPlasmaLabel : public Plasma::Label
class CustomPlasmaLabel : public QLabel
{
Q_OBJECT
public:
CustomPlasmaLabel(DesktopPanel *wid, const int num,
CustomPlasmaLabel(DesktopPanel *wid,
const int num,
const bool debugCmd = false);
~CustomPlasmaLabel();
int getNumber();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
private:
// debug
@ -89,6 +91,7 @@ private:
void updateText(const bool first = false);
// ui
QGraphicsGridLayout *layout;
QList<QGraphicsProxyWidget *> proxyWidgets;
QList<CustomPlasmaLabel *> labels;
// debug
bool debug;