Compare commits

...

18 Commits

Author SHA1 Message Date
081f7a3c88 release 3.3.3 2017-08-03 01:47:10 +03:00
707fa727c5 split awkeysaggregator class 2017-07-28 04:57:07 +03:00
5d0c05e856 make tests great again (iteration #2) 2017-07-27 17:20:59 +03:00
4625afa0b9 add docker files, improve dbus interface 2017-07-27 16:47:20 +03:00
5c56f813d2 make tests great again!
Also dbus adaptor has been renamed, because it does not allow to
register one service for several applications (like plasmashell and
    plasmawindowed)
2017-07-26 20:23:26 +03:00
5e08434835 fix issue with invalid (up|down)total($|kb) calculation (see #127)
also renamed *total* tags to *tot* for consistency with other tags:

  * uptotal.* -> uptot.*
  * downtotal.* -> downtot.*
  * pstotal -> pstot
2017-07-24 15:07:36 +03:00
d2e6f2fe38 some refactoring
* massive changes inside includes, drop unused definitions
* rewrite some initialization methods to avoid additional
freeing/allocation
* drop some explicit destructors calls
2017-07-14 03:34:05 +03:00
e90e1da096 Small fixes
* update translations, add target to update translations
* add custom keys support to config helper
2017-07-13 19:15:10 +03:00
9d0a1bd70c rewrite formtatter* and customkeys* to share their code 2017-07-12 03:28:03 +03:00
7ce3e8b1cf add custom keys configuration 2017-07-10 01:43:21 +03:00
7a00dce7c5 initial implementation of custom keys 2017-07-07 00:52:16 +03:00
1a7530a847 commit metadata files too 2017-06-02 17:46:37 +03:00
1702045550 update changelog 2017-06-02 17:38:27 +03:00
fe88c72498 release 3.3.2 2017-06-02 17:35:35 +03:00
737759d03f Bug fixing
* fix bug with invalid applet and configuration load with newest qt
* fix bug with invalid DP configuration
* fix bug with invalid HTML tags operations
2017-06-02 17:34:27 +03:00
934e30819c rename deadbeef defaults 2017-05-21 23:07:12 +03:00
a4d3a09f26 add patch for mpris 2017-05-17 17:47:34 +03:00
acc4df92bc fix invalid mpris parser
In some cases it causes the error like:

Error message "Интерфейс «(null)» для пути /org/mpris/MediaPlayer2 объекта не найден"

(for example deadbeef was affected). Suggested patch should fix this
issue and seems to be working with at least deadbeef and qmmp mpris
engines.
2017-05-17 17:43:18 +03:00
109 changed files with 3504 additions and 3523 deletions

11
.docker/Dockerfile-arch Normal file
View File

@ -0,0 +1,11 @@
FROM base/archlinux
RUN pacman -Sy
# toolchain
RUN pacman -S --noconfirm base-devel cmake extra-cmake-modules python
# kf5 and qt5 libraries
RUN pacman -S --noconfirm plasma-framework
# required by tests
RUN pacman -S --noconfirm xorg-server-xvfb

View File

@ -0,0 +1,12 @@
FROM multiarch/ubuntu-core:amd64-xenial
RUN apt-get update
# toolchain
RUN apt-get install -y cmake extra-cmake-modules g++ git gettext
# kf5 and qt5 libraries
RUN apt-get install -y libkf5i18n-dev libkf5notifications-dev libkf5service-dev \
libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev \
plasma-framework
# required by tests
RUN apt-get install -y xvfb

View File

@ -0,0 +1,12 @@
FROM multiarch/ubuntu-core:i386-xenial
RUN apt-get update
# toolchain
RUN apt-get install -y cmake extra-cmake-modules g++ git gettext
# kf5 and qt5 libraries
RUN apt-get install -y libkf5i18n-dev libkf5notifications-dev libkf5service-dev \
libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev \
plasma-framework
# required by tests
RUN apt-get install -y xvfb

14
.docker/build-arch.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
rm -rf build-arch
mkdir build-arch
# build
cd build-arch
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_BUILD_TYPE=Optimization -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FUTURE=ON -DBUILD_TESTING=ON ../sources
make
# tests
xvfb-run make test

16
.docker/build-ubuntu-package.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -e
rm -rf build-ubuntu
mkdir build-ubuntu
# patches
git apply patches/qt5.6-qversionnumber.patch
git apply patches/qt5.5-qstringlist-and-qinfo.patch
# build
cd build-ubuntu
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_BUILD_TYPE=Optimization -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FUTURE=ON -DBUILD_DEB_PACKAGE=ON ../sources
make package

18
.docker/build-ubuntu.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
rm -rf build-ubuntu
mkdir build-ubuntu
# patches
git apply patches/qt5.6-qversionnumber.patch
git apply patches/qt5.5-qstringlist-and-qinfo.patch
# build
cd build-ubuntu
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_BUILD_TYPE=Optimization -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FUTURE=ON -DBUILD_TESTING=ON ../sources
make
# tests
xvfb-run make test

View File

@ -1,20 +1,13 @@
sudo: required
dist: trusty
language: cpp
os:
- linux
env:
- DOCKER_TAG="arcan1s/awesome-widgets"
before_script:
- sudo apt-add-repository -y ppa:kubuntu-ppa/backports
- sudo sed -i 's/trusty/wily/g' /etc/apt/sources.list
- sudo sed -i 's/trusty/wily/g' /etc/apt/sources.list.d/kubuntu-ppa-backports-trusty.list
- sudo apt-get -qq update
- sudo apt-get -y -qq -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install libkf5i18n-dev libkf5notifications-dev libkf5service-dev libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev extra-cmake-modules cmake g++
- rm -rf build
- mkdir build
services:
- docker
script:
- cd build
- cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_USE_QT_SYS_PATHS=ON ../sources
- make
before_install:
- docker build --tag="${DOCKER_TAG}" .docker
scirpt:
- docker run "${DOCKER_TAG}" .docker/build.sh

View File

@ -1,3 +1,15 @@
Ver.3.3.3:
+ add custom keys support (#101)
* DBus interface improvements
* rename tags (up|down|ps)total.* to (up|down|ps)tot.*
- fix issue with invalid (up|down)total($|kb) calculation (#127)
- fix issue with wrong applet identation (#125)
Ver.3.3.2:
- fix bug with invalid DP colour configuration
- fix bug with invalid HTML tags operation
* update to newest Qt and plasma
Ver.3.3.1:
+ add ability to direct issue report (#104)
+ add key completion (#105)

View File

@ -2,7 +2,7 @@
pkgname=plasma5-applet-awesome-widgets
_pkgname=awesome-widgets
pkgver=3.3.1
pkgver=3.3.3
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' 'python')
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
install=${pkgname}.install
md5sums=('306027b017f940c9c5eaffb65ff82a7f')
md5sums=('ce2413868cbb230e358e75a15975a1e5')
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
prepare() {

View File

@ -1,14 +1,15 @@
diff --git a/sources/awdebug.h b/sources/awdebug.h
index 8447c65..9f8e298 100644
index 8447c65..4eef49a 100644
--- a/sources/awdebug.h
+++ b/sources/awdebug.h
@@ -23,10 +23,14 @@
@@ -23,10 +23,15 @@
#include "version.h"
+#ifndef qCInfo
+#define qCInfo qCDebug
+#endif
+
+
namespace AWDebug
{
@ -19,7 +20,7 @@ index 8447c65..9f8e298 100644
"fatal}FF%{endif}][%{category}][%{function}] "
"%{message}";
diff --git a/sources/awesome-widget/plugin/awkeysaggregator.h b/sources/awesome-widget/plugin/awkeysaggregator.h
index d29672e..f15a729 100644
index d6d5d1a..ee301df 100644
--- a/sources/awesome-widget/plugin/awkeysaggregator.h
+++ b/sources/awesome-widget/plugin/awkeysaggregator.h
@@ -21,6 +21,7 @@
@ -28,5 +29,5 @@ index d29672e..f15a729 100644
#include <QObject>
+#include <QStringList>
#include "version.h"
class AWFormatterHelper;

View File

@ -15,7 +15,7 @@ set(PROJECT_CONTACT "esalexeev@gmail.com")
set(PROJECT_LICENSE "GPL3")
set(PROJECT_VERSION_MAJOR "3")
set(PROJECT_VERSION_MINOR "3")
set(PROJECT_VERSION_PATCH "1")
set(PROJECT_VERSION_PATCH "3")
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
# append git version if any
set(PROJECT_COMMIT_SHA "Commit hash" CACHE INTERNAL "")

View File

@ -72,7 +72,7 @@ Item {
ComboBoxSelector {
id: fontWeight
model: general.fontWeightModel
model: General.fontWeightModel
text: i18n("Font weight")
value: plasmoid.configuration.fontWeight
onValueEdited: cfg_fontWeight = newValue
@ -80,7 +80,7 @@ Item {
ComboBoxSelector {
id: fontStyle
model: general.fontStyleModel
model: General.fontStyleModel
text: i18n("Font style")
value: plasmoid.configuration.fontStyle
onValueEdited: cfg_fontStyle = newValue
@ -94,7 +94,7 @@ Item {
ComboBoxSelector {
id: textStyle
model: general.textStyleModel
model: General.textStyleModel
text: i18n("Style")
value: plasmoid.configuration.textStyle
onValueEdited: cfg_textStyle = newValue

View File

@ -167,8 +167,8 @@ Item {
'name': 'clementine'
},
{
'label': 'deadbeef',
'name': 'deadbeef'
'label': 'DeaDBeeF',
'name': 'DeaDBeeF'
},
{
'label': 'vlc',

View File

@ -95,16 +95,16 @@ Item {
textFormat: Text.RichText
wrapMode: plasmoid.configuration.wrapText ? Text.WordWrap : Text.NoWrap
horizontalAlignment: general.align[plasmoid.configuration.textAlign]
horizontalAlignment: General.align[plasmoid.configuration.textAlign]
verticalAlignment: Text.AlignVCenter
color: plasmoid.configuration.fontColor
font.family: plasmoid.configuration.fontFamily
font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false
font.pointSize: plasmoid.configuration.fontSize
font.weight: general.fontWeight[plasmoid.configuration.fontWeight]
font.weight: General.fontWeight[plasmoid.configuration.fontWeight]
style: general.textStyle[plasmoid.configuration.textStyle]
style: General.textStyle[plasmoid.configuration.textStyle]
styleColor: plasmoid.configuration.textStyleColor
PlasmaCore.ToolTipArea {

View File

@ -3,7 +3,7 @@
# common QML constants
singleton general 1.0 file:///usr/share/awesomewidgets/qml/general.qml
singleton General 1.0 file:///usr/share/awesomewidgets/qml/General.qml
# custom QML UI classes
AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml

View File

@ -58,7 +58,7 @@ Item {
backend: awKeys
notifyBackend: awActions
textArea: textPattern
groups: general.awTagRegexp
groups: General.awTagRegexp
}
AWExtensions {

View File

@ -20,7 +20,7 @@ X-Plasma-RemoteLocation=
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
X-KDE-PluginInfo-Version=3.3.1
X-KDE-PluginInfo-Version=3.3.3
X-KDE-PluginInfo-Website=https://arcanis.me/projects/awesome-widgets/
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends=

View File

@ -0,0 +1,189 @@
/***************************************************************************
* 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 "awabstractpairconfig.h"
#include "ui_awabstractpairconfig.h"
#include <KI18n/KLocalizedString>
#include <QPushButton>
#include "awabstractselector.h"
#include "awdebug.h"
AWAbstractPairConfig::AWAbstractPairConfig(QWidget *_parent,
const bool _hasEdit,
const QStringList &_keys)
: QDialog(_parent)
, ui(new Ui::AWAbstractPairConfig)
, m_hasEdit(_hasEdit)
, m_keys(_keys)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
// edit feature
if (m_hasEdit) {
m_editButton = ui->buttonBox->addButton(i18n("Edit"),
QDialogButtonBox::ActionRole);
connect(m_editButton, SIGNAL(clicked(bool)), this, SLOT(edit()));
}
}
AWAbstractPairConfig::~AWAbstractPairConfig()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
clearSelectors();
delete ui;
}
void AWAbstractPairConfig::showDialog()
{
// update dialog
updateDialog();
// exec dialog
return execDialog();
}
void AWAbstractPairConfig::setEditable(const bool _first, const bool _second)
{
qCDebug(LOG_AW) << "Set editable" << _first << _second;
m_editable = {_first, _second};
}
void AWAbstractPairConfig::edit()
{
m_helper->editPairs();
updateDialog();
}
void AWAbstractPairConfig::updateUi()
{
QPair<QString, QString> current
= static_cast<AWAbstractSelector *>(sender())->current();
int index
= m_selectors.indexOf(static_cast<AWAbstractSelector *>(sender()));
if ((current.first.isEmpty()) && (current.second.isEmpty())) {
// remove current selector if it is empty and does not last
if (sender() == m_selectors.last())
return;
AWAbstractSelector *selector = m_selectors.takeAt(index);
ui->verticalLayout->removeWidget(selector);
selector->deleteLater();
} else {
// add new selector if something changed
if (sender() != m_selectors.last())
return;
auto keys = initKeys();
addSelector(keys.first, keys.second, QPair<QString, QString>());
}
}
void AWAbstractPairConfig::addSelector(const QStringList &_keys,
const QStringList &_values,
const QPair<QString, QString> &_current)
{
qCDebug(LOG_AW) << "Add selector with keys" << _keys << "values" << _values
<< "and current ones" << _current;
AWAbstractSelector *selector
= new AWAbstractSelector(ui->scrollAreaWidgetContents, m_editable);
selector->init(_keys, _values, _current);
ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1, selector);
connect(selector, SIGNAL(selectionChanged()), this, SLOT(updateUi()));
m_selectors.append(selector);
}
void AWAbstractPairConfig::clearSelectors()
{
for (auto &selector : m_selectors) {
disconnect(selector, SIGNAL(selectionChanged()), this,
SLOT(updateUi()));
ui->verticalLayout->removeWidget(selector);
selector->deleteLater();
}
m_selectors.clear();
}
void AWAbstractPairConfig::execDialog()
{
int ret = exec();
QHash<QString, QString> data;
for (auto &selector : m_selectors) {
QPair<QString, QString> select = selector->current();
if (select.first.isEmpty())
continue;
data[select.first] = select.second;
}
// save configuration if required
switch (ret) {
case 0:
break;
case 1:
default:
m_helper->writeItems(data);
m_helper->removeUnusedKeys(data.keys());
break;
}
}
QPair<QStringList, QStringList> AWAbstractPairConfig::initKeys() const
{
// we are adding empty string at the start
QStringList left = {""};
left.append(m_helper->leftKeys().isEmpty() ? m_keys : m_helper->leftKeys());
left.sort();
QStringList right = {""};
right.append(m_helper->rightKeys().isEmpty() ? m_keys
: m_helper->rightKeys());
right.sort();
return QPair<QStringList, QStringList>(left, right);
}
void AWAbstractPairConfig::updateDialog()
{
clearSelectors();
auto pairs = m_helper->pairs();
auto keys = initKeys();
for (auto &key : m_helper->keys())
addSelector(keys.first, keys.second,
QPair<QString, QString>(key, m_helper->pairs()[key]));
// empty one
addSelector(keys.first, keys.second, QPair<QString, QString>());
}

View File

@ -0,0 +1,75 @@
/***************************************************************************
* 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 AWABSTRACTPAIRCONFIG_H
#define AWABSTRACTPAIRCONFIG_H
#include <QDialog>
#include "awabstractpairhelper.h"
class AWAbstractSelector;
namespace Ui
{
class AWAbstractPairConfig;
}
class AWAbstractPairConfig : public QDialog
{
Q_OBJECT
public:
explicit AWAbstractPairConfig(QWidget *_parent = nullptr,
const bool _hasEdit = false,
const QStringList &_keys = QStringList());
virtual ~AWAbstractPairConfig();
template <class T> void initHelper()
{
if (m_helper)
delete m_helper;
m_helper = new T(this);
}
void showDialog();
// properties
void setEditable(const bool _first, const bool _second);
private slots:
void edit();
void updateUi();
private:
QPushButton *m_editButton = nullptr;
Ui::AWAbstractPairConfig *ui = nullptr;
AWAbstractPairHelper *m_helper = nullptr;
QList<AWAbstractSelector *> m_selectors;
// properties
QPair<bool, bool> m_editable = {false, false};
bool m_hasEdit = false;
QStringList m_keys;
// methods
void addSelector(const QStringList &_keys, const QStringList &_values,
const QPair<QString, QString> &_current);
void clearSelectors();
void execDialog();
QPair<QStringList, QStringList> initKeys() const;
void updateDialog();
};
#endif /* AWABSTRACTPAIRCONFIG_H */

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AWFormatterConfig</class>
<widget class="QDialog" name="AWFormatterConfig">
<class>AWAbstractPairConfig</class>
<widget class="QDialog" name="AWAbstractPairConfig">
<property name="geometry">
<rect>
<x>0</x>
@ -60,7 +60,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AWFormatterConfig</receiver>
<receiver>AWAbstractPairConfig</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@ -76,7 +76,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AWFormatterConfig</receiver>
<receiver>AWAbstractPairConfig</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

View File

@ -0,0 +1,135 @@
/***************************************************************************
* 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 "awabstractpairhelper.h"
#include <QSettings>
#include <QStandardPaths>
#include "awdebug.h"
AWAbstractPairHelper::AWAbstractPairHelper(const QString &_filePath,
const QString &_section)
: m_filePath(_filePath)
, m_section(_section)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
initItems();
}
AWAbstractPairHelper::~AWAbstractPairHelper()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
}
QStringList AWAbstractPairHelper::keys() const
{
return m_pairs.keys();
}
QHash<QString, QString> AWAbstractPairHelper::pairs() const
{
return m_pairs;
}
QStringList AWAbstractPairHelper::values() const
{
return m_pairs.values();
}
void AWAbstractPairHelper::initItems()
{
m_pairs.clear();
QStringList configs = QStandardPaths::locateAll(
QStandardPaths::GenericDataLocation, m_filePath);
for (auto &fileName : configs) {
QSettings settings(fileName, QSettings::IniFormat);
qCInfo(LOG_AW) << "Configuration file" << settings.fileName();
settings.beginGroup(m_section);
QStringList keys = settings.childKeys();
for (auto &key : keys) {
QString value = settings.value(key).toString();
qCInfo(LOG_AW) << "Found key" << key << "for value" << value << "in"
<< settings.fileName();
if (value.isEmpty()) {
qCInfo(LOG_AW) << "Skip empty value for" << key;
continue;
}
m_pairs[key] = value;
}
settings.endGroup();
}
}
bool AWAbstractPairHelper::writeItems(
const QHash<QString, QString> &_configuration) const
{
qCDebug(LOG_AW) << "Write configuration" << _configuration;
QString fileName = QString("%1/%2")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation))
.arg(m_filePath);
QSettings settings(fileName, QSettings::IniFormat);
qCInfo(LOG_AW) << "Configuration file" << fileName;
settings.beginGroup(m_section);
for (auto &key : _configuration.keys())
settings.setValue(key, _configuration[key]);
settings.endGroup();
settings.sync();
return (settings.status() == QSettings::NoError);
}
bool AWAbstractPairHelper::removeUnusedKeys(const QStringList &_keys) const
{
qCDebug(LOG_AW) << "Remove keys" << _keys;
QString fileName = QString("%1/%2")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation))
.arg(m_filePath);
QSettings settings(fileName, QSettings::IniFormat);
qCInfo(LOG_AW) << "Configuration file" << fileName;
settings.beginGroup(m_section);
QStringList foundKeys = settings.childKeys();
for (auto &key : foundKeys) {
if (_keys.contains(key))
continue;
settings.remove(key);
}
settings.endGroup();
settings.sync();
return (settings.status() == QSettings::NoError);
}

View File

@ -0,0 +1,52 @@
/***************************************************************************
* 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 AWABSTRACTPAIRHELPER_H
#define AWABSTRACTPAIRHELPER_H
#include <QHash>
class AWAbstractPairHelper
{
public:
explicit AWAbstractPairHelper(const QString &_filePath = "",
const QString &_section = "");
virtual ~AWAbstractPairHelper();
QStringList keys() const;
QHash<QString, QString> pairs() const;
QStringList values() const;
// read-write methods
virtual void initItems();
virtual bool
writeItems(const QHash<QString, QString> &_configuration) const;
virtual bool removeUnusedKeys(const QStringList &_keys) const;
// configuration related
virtual void editPairs() = 0;
virtual QStringList leftKeys() = 0;
virtual QStringList rightKeys() = 0;
private:
// properties
QHash<QString, QString> m_pairs;
QString m_filePath;
QString m_section;
};
#endif /* AWABSTRACTPAIRHELPER_H */

View File

@ -43,8 +43,6 @@ AWActions::AWActions(QObject *_parent)
AWActions::~AWActions()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
delete m_updateHelper;
}

View File

@ -21,11 +21,9 @@
#include <QDesktopServices>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include "awdebug.h"

View File

@ -22,6 +22,7 @@
#include <QDir>
#include <QQmlPropertyMap>
#include <QSettings>
#include <QStandardPaths>
#include <QTextCodec>
#include "awdebug.h"
@ -31,6 +32,10 @@ AWConfigHelper::AWConfigHelper(QObject *_parent)
: QObject(_parent)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
m_baseDir = QString("%1/awesomewidgets")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation));
}
@ -108,9 +113,14 @@ bool AWConfigHelper::exportConfiguration(QObject *_nativeConfig,
readFile(settings, "weathers",
QString("%1/weather/awesomewidgets-extweather-ids.json")
.arg(m_baseDir));
settings.endGroup();
settings.beginGroup("ini");
// formatter settings
readFile(settings, "formatters",
QString("%1/formatters/formatters.ini").arg(m_baseDir));
// custom keys settings
readFile(settings, "custom", QString("%1/custom.ini").arg(m_baseDir));
settings.endGroup();
// sync settings
@ -151,9 +161,14 @@ QVariantMap AWConfigHelper::importConfiguration(const QString &_fileName,
writeFile(settings, "weathers",
QString("%1/weather/awesomewidgets-extweather-ids.json")
.arg(m_baseDir));
settings.endGroup();
settings.beginGroup("ini");
// formatter settings
writeFile(settings, "formatters",
QString("%1/formatters/formatters.ini").arg(m_baseDir));
// custom keys settings
writeFile(settings, "custom", QString("%1/custom.ini").arg(m_baseDir));
settings.endGroup();
}
@ -290,7 +305,7 @@ void AWConfigHelper::readFile(QSettings &_settings, const QString &_key,
file.close();
_settings.setValue(_key, text);
} else {
qCWarning(LOG_AW) << "Could not open" << file.fileName();
qCWarning(LOG_AW) << "Could not open to read" << file.fileName();
}
}
@ -311,6 +326,6 @@ void AWConfigHelper::writeFile(QSettings &_settings, const QString &_key,
out.flush();
file.close();
} else {
qCWarning(LOG_AW) << "Could not open" << file.fileName();
qCWarning(LOG_AW) << "Could not open to write" << file.fileName();
}
}

View File

@ -20,7 +20,6 @@
#define AWCONFIGHELPER_H
#include <QObject>
#include <QStandardPaths>
#include <QVariant>
@ -57,15 +56,9 @@ private:
void writeFile(QSettings &_settings, const QString &_key,
const QString &_fileName) const;
// properties
QString m_baseDir = QString("%1/awesomewidgets")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation));
QStringList m_dirs = QStringList() << "desktops"
<< "quotes"
<< "scripts"
<< "upgrade"
<< "weather"
<< "formatters";
QString m_baseDir;
QStringList m_dirs
= {"desktops", "quotes", "scripts", "upgrade", "weather", "formatters"};
};

View File

@ -0,0 +1,38 @@
/***************************************************************************
* 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 "awcustomkeysconfig.h"
#include "awcustomkeyshelper.h"
#include "awdebug.h"
AWCustomKeysConfig::AWCustomKeysConfig(QWidget *_parent,
const QStringList &_keys)
: AWAbstractPairConfig(_parent, false, _keys)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
setEditable(true, false);
initHelper<AWCustomKeysHelper>();
}
AWCustomKeysConfig::~AWCustomKeysConfig()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
}

View File

@ -16,23 +16,21 @@
***************************************************************************/
#ifndef AWFORMATTERCONFIGFACTORY_H
#define AWFORMATTERCONFIGFACTORY_H
#ifndef AWCUSTOMKEYSCONFIG_H
#define AWCUSTOMKEYSCONFIG_H
#include <QObject>
#include "awabstractpairconfig.h"
class AWFormatterConfigFactory : public QObject
class AWCustomKeysConfig : public AWAbstractPairConfig
{
Q_OBJECT
public:
explicit AWFormatterConfigFactory(QObject *_parent = nullptr);
virtual ~AWFormatterConfigFactory();
Q_INVOKABLE void showDialog(const QStringList &_keys);
private:
explicit AWCustomKeysConfig(QWidget *_parent = nullptr,
const QStringList &_keys = QStringList());
virtual ~AWCustomKeysConfig();
};
#endif /* AWFORMATTERCONFIGFACTORY_H */
#endif /* AWCUSTOMKEYSCONFIG_H */

View File

@ -0,0 +1,78 @@
/***************************************************************************
* 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 "awcustomkeyshelper.h"
#include <QSet>
#include "awdebug.h"
AWCustomKeysHelper::AWCustomKeysHelper(QObject *_parent)
: QObject(_parent)
, AWAbstractPairHelper("awesomewidgets/custom.ini", "Custom")
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
}
AWCustomKeysHelper::~AWCustomKeysHelper()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
}
QString AWCustomKeysHelper::source(const QString &_key) const
{
qCDebug(LOG_AW) << "Get source by key" << _key;
return pairs()[_key];
}
QStringList AWCustomKeysHelper::sources() const
{
return QSet<QString>::fromList(values()).toList();
}
QStringList AWCustomKeysHelper::refinedSources() const
{
auto allSources = QSet<QString>::fromList(pairs().values());
QSet<QString> output;
while (output != allSources) {
output.clear();
for (auto &src : allSources)
output.insert(pairs().contains(src) ? source(src) : src);
allSources = output;
}
return output.toList();
}
QStringList AWCustomKeysHelper::leftKeys()
{
return keys();
}
QStringList AWCustomKeysHelper::rightKeys()
{
return QStringList();
}

View File

@ -0,0 +1,47 @@
/***************************************************************************
* 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 AWCUSTOMKEYSHELPER_H
#define AWCUSTOMKEYSHELPER_H
#include <QObject>
#include "awabstractpairhelper.h"
class AWCustomKeysHelper : public QObject, public AWAbstractPairHelper
{
Q_OBJECT
public:
explicit AWCustomKeysHelper(QObject *_parent = nullptr);
virtual ~AWCustomKeysHelper();
// get
QString source(const QString &_key) const;
QStringList sources() const;
QStringList refinedSources() const;
// configuration related
virtual void editPairs(){};
virtual QStringList leftKeys();
virtual QStringList rightKeys();
private:
};
#endif /* AWCUSTOMKEYSHELPER_H */

View File

@ -22,7 +22,6 @@
#include <QBuffer>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QPixmap>
#include <cmath>
@ -44,8 +43,6 @@ AWDataAggregator::AWDataAggregator(QObject *_parent)
m_boundaries["batTooltip"] = 100.0;
initScene();
connect(this, SIGNAL(updateData(const QVariantHash &)), this,
SLOT(dataUpdate(const QVariantHash &)));
}
@ -57,14 +54,6 @@ AWDataAggregator::~AWDataAggregator()
}
QList<float> AWDataAggregator::getData(const QString &_key) const
{
qCDebug(LOG_AW) << "Key" << _key;
return m_values[QString("%1Tooltip").arg(_key)];
}
QString AWDataAggregator::htmlImage(const QPixmap &_source) const
{
QByteArray byteArray;

View File

@ -35,18 +35,16 @@ class AWDataAggregator : public QObject
public:
explicit AWDataAggregator(QObject *_parent = nullptr);
virtual ~AWDataAggregator();
QList<float> getData(const QString &_key) const;
QString htmlImage(const QPixmap &_source) const;
void setParameters(const QVariantMap &_settings);
QPixmap tooltipImage();
signals:
void updateData(const QVariantHash &_values);
void toolTipPainted(const QString &_image) const;
private slots:
public slots:
void dataUpdate(const QVariantHash &_values);
signals:
void toolTipPainted(const QString &_image) const;
private:
// ui
QGraphicsScene *m_toolTipScene = nullptr;

View File

@ -28,6 +28,20 @@ AWDataEngineAggregator::AWDataEngineAggregator(QObject *_parent)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
m_consumer = new Plasma::DataEngineConsumer();
m_dataEngines["systemmonitor"] = m_consumer->dataEngine("systemmonitor");
m_dataEngines["extsysmon"] = m_consumer->dataEngine("extsysmon");
m_dataEngines["time"] = m_consumer->dataEngine("time");
// additional method required by systemmonitor structure
m_newSourceConnection = connect(
m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
[this](const QString source) {
emit(deviceAdded(source));
m_dataEngines["systemmonitor"]->connectSource(source, parent(),
1000);
});
// required to define Qt::QueuedConnection for signal-slot connection
qRegisterMetaType<Plasma::DataEngine::Data>("Plasma::DataEngine::Data");
}
@ -37,16 +51,7 @@ AWDataEngineAggregator::~AWDataEngineAggregator()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
clear();
}
void AWDataEngineAggregator::clear()
{
// disconnect sources first
disconnectSources();
m_dataEngines.clear();
delete m_consumer;
}
@ -55,27 +60,31 @@ void AWDataEngineAggregator::disconnectSources()
for (auto dataengine : m_dataEngines.values())
for (auto &source : dataengine->sources())
dataengine->disconnectSource(source, parent());
disconnect(m_newSourceConnection);
}
void AWDataEngineAggregator::initDataEngines(const int _interval)
void AWDataEngineAggregator::reconnectSources(const int _interval)
{
qCDebug(LOG_AW) << "Init dataengines with interval" << _interval;
qCDebug(LOG_AW) << "Reconnect sources with interval" << _interval;
m_consumer = new Plasma::DataEngineConsumer();
m_dataEngines["systemmonitor"] = m_consumer->dataEngine("systemmonitor");
m_dataEngines["extsysmon"] = m_consumer->dataEngine("extsysmon");
m_dataEngines["time"] = m_consumer->dataEngine("time");
disconnectSources();
// additional method required by systemmonitor structure
connect(m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
[this, _interval](const QString source) {
emit(deviceAdded(source));
m_dataEngines["systemmonitor"]->connectSource(source, parent(),
_interval);
});
m_dataEngines["systemmonitor"]->connectAllSources(parent(), _interval);
m_dataEngines["extsysmon"]->connectAllSources(parent(), _interval);
m_dataEngines["time"]->connectSource("Local", parent(), 1000);
return reconnectSources(_interval);
m_newSourceConnection = connect(
m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
[this, _interval](const QString source) {
emit(deviceAdded(source));
m_dataEngines["systemmonitor"]->connectSource(source, parent(),
_interval);
});
#ifdef BUILD_FUTURE
createQueuedConnection();
#endif /* BUILD_FUTURE */
}
@ -84,26 +93,12 @@ void AWDataEngineAggregator::dropSource(const QString &_source)
qCDebug(LOG_AW) << "Source" << _source;
// HACK there is no possibility to check to which dataengine source
// connected we will try to disconnect it from systemmonitor and extsysmon
// connected we will try to disconnect it from all engines
for (auto dataengine : m_dataEngines.values())
dataengine->disconnectSource(_source, parent());
}
void AWDataEngineAggregator::reconnectSources(const int _interval)
{
qCDebug(LOG_AW) << "Reconnect sources with interval" << _interval;
m_dataEngines["systemmonitor"]->connectAllSources(parent(), _interval);
m_dataEngines["extsysmon"]->connectAllSources(parent(), _interval);
m_dataEngines["time"]->connectSource("Local", parent(), 1000);
#ifdef BUILD_FUTURE
createQueuedConnection();
#endif /* BUILD_FUTURE */
}
void AWDataEngineAggregator::createQueuedConnection()
{
// HACK additional method which forces QueuedConnection instead of Auto one

View File

@ -32,21 +32,20 @@ class AWDataEngineAggregator : public QObject
public:
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
virtual ~AWDataEngineAggregator();
void clear();
void disconnectSources();
void initDataEngines(const int _interval);
void reconnectSources(const int _interval);
signals:
void deviceAdded(const QString &_source);
public slots:
void dropSource(const QString &_source);
void reconnectSources(const int _interval);
private:
void createQueuedConnection();
Plasma::DataEngineConsumer *m_consumer = nullptr;
QHash<QString, Plasma::DataEngine *> m_dataEngines;
QMetaObject::Connection m_newSourceConnection;
};

View File

@ -0,0 +1,448 @@
/***************************************************************************
* 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 "awdataenginemapper.h"
#include <QRegExp>
#include "awdebug.h"
#include "awformatterhelper.h"
AWDataEngineMapper::AWDataEngineMapper(QObject *_parent,
AWFormatterHelper *_custom)
: QObject(_parent)
, m_customFormatters(_custom)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
// default formatters
// memory
m_formatter["mem"] = AWKeysAggregator::FormatterType::Float;
m_formatter["memtotmb"] = AWKeysAggregator::FormatterType::MemMBFormat;
m_formatter["memtotgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
// network
m_formatter["down"] = AWKeysAggregator::FormatterType::NetSmartFormat;
m_formatter["downkb"] = AWKeysAggregator::FormatterType::Integer;
m_formatter["downtot"] = AWKeysAggregator::FormatterType::MemMBFormat;
m_formatter["downtotkb"] = AWKeysAggregator::FormatterType::Integer;
m_formatter["downunits"] = AWKeysAggregator::FormatterType::NetSmartUnits;
m_formatter["up"] = AWKeysAggregator::FormatterType::NetSmartFormat;
m_formatter["upkb"] = AWKeysAggregator::FormatterType::Integer;
m_formatter["uptot"] = AWKeysAggregator::FormatterType::MemMBFormat;
m_formatter["uptotkb"] = AWKeysAggregator::FormatterType::Integer;
m_formatter["upunits"] = AWKeysAggregator::FormatterType::NetSmartUnits;
// swap
m_formatter["swap"] = AWKeysAggregator::FormatterType::Float;
m_formatter["swaptotmb"] = AWKeysAggregator::FormatterType::MemMBFormat;
m_formatter["swaptotgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
}
AWDataEngineMapper::~AWDataEngineMapper()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
}
AWKeysAggregator::FormatterType
AWDataEngineMapper::formatter(const QString &_key) const
{
qCDebug(LOG_AW) << "Get formatter for key" << _key;
return m_formatter.value(_key, AWKeysAggregator::FormatterType::NoFormat);
}
QStringList AWDataEngineMapper::keysFromSource(const QString &_source) const
{
qCDebug(LOG_AW) << "Search for source" << _source;
return m_map.values(_source);
}
// HACK units required to define should the value be calculated as temperature
// or fan data
QStringList AWDataEngineMapper::registerSource(const QString &_source,
const QString &_units,
const QStringList &_keys)
{
qCDebug(LOG_AW) << "Source" << _source << "with units" << _units;
// regular expressions
QRegExp cpuRegExp = QRegExp("cpu/cpu.*/TotalLoad");
QRegExp cpuclRegExp = QRegExp("cpu/cpu.*/clock");
QRegExp hddrRegExp = QRegExp("disk/.*/Rate/rblk");
QRegExp hddwRegExp = QRegExp("disk/.*/Rate/wblk");
QRegExp mountFillRegExp = QRegExp("partitions/.*/filllevel");
QRegExp mountFreeRegExp = QRegExp("partitions/.*/freespace");
QRegExp mountUsedRegExp = QRegExp("partitions/.*/usedspace");
QRegExp netRegExp
= QRegExp("network/interfaces/.*/(receiver|transmitter)/data$");
QRegExp netTotalRegExp
= QRegExp("network/interfaces/.*/(receiver|transmitter)/dataTotal$");
if (_source == "battery/ac") {
// AC
m_map[_source] = "ac";
m_formatter["ac"] = AWKeysAggregator::FormatterType::ACFormat;
} else if (_source.startsWith("battery/")) {
// battery stats
QString key = _source;
key.remove("battery/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::IntegerThree;
} else if (_source == "cpu/system/TotalLoad") {
// cpu
m_map[_source] = "cpu";
m_formatter["cpu"] = AWKeysAggregator::FormatterType::Float;
} else if (_source.contains(cpuRegExp)) {
// cpus
QString key = _source;
key.remove("cpu/").remove("/TotalLoad");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Float;
} else if (_source == "cpu/system/AverageClock") {
// cpucl
m_map[_source] = "cpucl";
m_formatter["cpucl"] = AWKeysAggregator::FormatterType::Integer;
} else if (_source.contains(cpuclRegExp)) {
// cpucls
QString key = _source;
key.remove("cpu/cpu").remove("/clock");
key = QString("cpucl%1").arg(key);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
} else if (_source.startsWith("custom")) {
// custom
QString key = _source;
key.remove("custom/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "desktop/current/name") {
// current desktop name
m_map[_source] = "desktop";
m_formatter["desktop"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "desktop/current/number") {
// current desktop number
m_map[_source] = "ndesktop";
m_formatter["ndesktop"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "desktop/total/number") {
// desktop count
m_map[_source] = "tdesktops";
m_formatter["tdesktops"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.contains(hddrRegExp)) {
// read speed
QString device = _source;
device.remove("/Rate/rblk");
int index = m_devices["disk"].indexOf(device);
if (index > -1) {
QString key = QString("hddr%1").arg(index);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
}
} else if (_source.contains(hddwRegExp)) {
// write speed
QString device = _source;
device.remove("/Rate/wblk");
int index = m_devices["disk"].indexOf(device);
if (index > -1) {
QString key = QString("hddw%1").arg(index);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
}
} else if (_source == "gpu/load") {
// gpu load
m_map[_source] = "gpu";
m_formatter["gpu"] = AWKeysAggregator::FormatterType::Float;
} else if (_source == "gpu/temperature") {
// gpu temperature
m_map[_source] = "gputemp";
m_formatter["gputemp"] = AWKeysAggregator::FormatterType::Temperature;
} else if (_source.contains(mountFillRegExp)) {
// fill level
QString device = _source;
device.remove("partitions").remove("/filllevel");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
QString key = QString("hdd%1").arg(index);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Float;
// additional keys
m_formatter[QString("hddtotmb%1").arg(index)]
= AWKeysAggregator::FormatterType::MemMBFormat;
m_formatter[QString("hddtotgb%1").arg(index)]
= AWKeysAggregator::FormatterType::MemGBFormat;
}
} else if (_source.contains(mountFreeRegExp)) {
// free space
QString device = _source;
device.remove("partitions").remove("/freespace");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
// mb
QString key = QString("hddfreemb%1").arg(index);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
key = QString("hddfreegb%1").arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::MemGBFormat;
}
} else if (_source.contains(mountUsedRegExp)) {
// used
QString device = _source;
device.remove("partitions").remove("/usedspace");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
// mb
QString key = QString("hddmb%1").arg(index);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
key = QString("hddgb%1").arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::MemGBFormat;
}
} else if (_source.startsWith("hdd/temperature")) {
// hdd temperature
QString device = _source;
device.remove("hdd/temperature");
int index = m_devices["hdd"].indexOf(device);
if (index > -1) {
QString key = QString("hddtemp%1").arg(index);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Temperature;
}
} else if (_source.startsWith("cpu/system/loadavg")) {
// load average
QString time = _source;
time.remove("cpu/system/loadavg");
QString key = QString("la%1").arg(time);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::FloatTwoSymbols;
} else if (_source == "mem/physical/application") {
// app memory
// mb
m_map[_source] = "memmb";
m_formatter["memmb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "memgb");
m_formatter["memgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/physical/free") {
// free memory
// mb
m_map[_source] = "memfreemb";
m_formatter["memfreemb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "memfreegb");
m_formatter["memfreegb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/physical/used") {
// used memory
// mb
m_map[_source] = "memusedmb";
m_formatter["memusedmb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "memusedgb");
m_formatter["memusedgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "network/current/name") {
// network device
m_map[_source] = "netdev";
m_formatter["netdev"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.startsWith("network/response")) {
// network response
QString key = _source;
key.remove("network/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.contains(netRegExp)) {
// network speed
QString type = _source.contains("receiver") ? "down" : "up";
int index = m_devices["net"].indexOf(_source.split('/')[2]);
if (index > -1) {
// kb
QString key = QString("%1kb%2").arg(type).arg(index);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
// smart
key = QString("%1%2").arg(type).arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::NetSmartFormat;
// units
key = QString("%1units%2").arg(type).arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::NetSmartUnits;
}
} else if (_source.contains(netTotalRegExp)) {
// network data total
QString type = _source.contains("receiver") ? "down" : "up";
int index = m_devices["net"].indexOf(_source.split('/')[2]);
if (index > -1) {
// kb
QString key = QString("%1totkb%2").arg(type).arg(index);
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
// mb
key = QString("%1tot%2").arg(type).arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::MemMBFormat;
}
} else if (_source.startsWith("upgrade")) {
// package manager
QString key = _source;
key.remove("upgrade/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::IntegerThree;
} else if (_source.startsWith("player")) {
// player
QString key = _source;
key.remove("player/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "ps/running/count") {
// running processes count
m_map[_source] = "pscount";
m_formatter["pscount"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "ps/running/list") {
// list of running processes
m_map[_source] = "ps";
m_formatter["ps"] = AWKeysAggregator::FormatterType::List;
} else if (_source == "ps/total/count") {
// total processes count
m_map[_source] = "pstot";
m_formatter["pstot"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.startsWith("quotes")) {
// quotes
QString key = _source;
key.remove("quotes/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Quotes;
} else if (_source == "mem/swap/free") {
// free swap
// mb
m_map[_source] = "swapfreemb";
m_formatter["swapfreemb"]
= AWKeysAggregator::FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "swapfreegb");
m_formatter["swapfreegb"]
= AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/swap/used") {
// used swap
// mb
m_map[_source] = "swapmb";
m_formatter["swapmb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "swapgb");
m_formatter["swapgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source.startsWith("lmsensors/")) {
// temperature
int index = m_devices["temp"].indexOf(_source);
// HACK on DE initialization there are no units key
if (_units.isEmpty())
return QStringList({QString("temp%1").arg(index)});
if (index > -1) {
QString key = QString("temp%1").arg(index);
m_map[_source] = key;
m_formatter[key]
= _units == "°C" ? AWKeysAggregator::FormatterType::Temperature
: AWKeysAggregator::FormatterType::Integer;
}
} else if (_source == "Local") {
// time
m_map[_source] = "time";
m_formatter["time"] = AWKeysAggregator::FormatterType::Time;
// custom time
m_map.insertMulti(_source, "ctime");
m_formatter["ctime"] = AWKeysAggregator::FormatterType::TimeCustom;
// ISO time
m_map.insertMulti(_source, "isotime");
m_formatter["isotime"] = AWKeysAggregator::FormatterType::TimeISO;
// long time
m_map.insertMulti(_source, "longtime");
m_formatter["longtime"] = AWKeysAggregator::FormatterType::TimeLong;
// short time
m_map.insertMulti(_source, "shorttime");
m_formatter["shorttime"] = AWKeysAggregator::FormatterType::TimeShort;
// timestamp
m_map.insertMulti(_source, "tstime");
m_formatter["tstime"] = AWKeysAggregator::FormatterType::Timestamp;
} else if (_source == "system/uptime") {
// uptime
m_map[_source] = "uptime";
m_formatter["uptime"] = AWKeysAggregator::FormatterType::Uptime;
// custom uptime
m_map.insertMulti(_source, "cuptime");
m_formatter["cuptime"] = AWKeysAggregator::FormatterType::UptimeCustom;
} else if (_source.startsWith("weather/temperature")) {
// temperature
QString key = _source;
key.remove("weather/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Temperature;
} else if (_source.startsWith("weather/")) {
// other weather
QString key = _source;
key.remove("weather/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.startsWith("load/load")) {
// load source
QString key = _source;
key.remove("load/");
m_map[_source] = key;
m_formatter[key] = AWKeysAggregator::FormatterType::Temperature;
}
QStringList foundKeys = keysFromSource(_source);
// rewrite formatters for custom ones
QStringList customFormattersKeys;
if (m_customFormatters)
customFormattersKeys = m_customFormatters->definedFormatters();
qCInfo(LOG_AW) << "Looking for formatters" << foundKeys << "in"
<< customFormattersKeys;
for (auto &key : foundKeys) {
if (!customFormattersKeys.contains(key))
continue;
m_formatter[key] = AWKeysAggregator::FormatterType::Custom;
}
// drop key from dictionary if no one user requested key required it
qCInfo(LOG_AW) << "Looking for keys" << foundKeys << "in" << _keys;
bool required
= _keys.isEmpty() || std::any_of(foundKeys.cbegin(), foundKeys.cend(),
[&_keys](const QString &key) {
return _keys.contains(key);
});
if (!required) {
m_map.remove(_source);
for (auto &key : foundKeys)
m_formatter.remove(key);
}
return keysFromSource(_source);
}
void AWDataEngineMapper::setDevices(const QHash<QString, QStringList> &_devices)
{
qCDebug(LOG_AW) << "Devices" << _devices;
m_devices = _devices;
}

View File

@ -0,0 +1,55 @@
/***************************************************************************
* 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 AWDATAENGINEMAPPER_H
#define AWDATAENGINEMAPPER_H
#include <QHash>
#include <QObject>
#include "awkeysaggregator.h"
class AWFormatterHelper;
class AWDataEngineMapper : public QObject
{
Q_OBJECT
public:
explicit AWDataEngineMapper(QObject *_parent = nullptr,
AWFormatterHelper *_custom = nullptr);
virtual ~AWDataEngineMapper();
// get methods
AWKeysAggregator::FormatterType formatter(const QString &_key) const;
QStringList keysFromSource(const QString &_source) const;
// set methods
QStringList registerSource(const QString &_source, const QString &_units,
const QStringList &_keys);
void setDevices(const QHash<QString, QStringList> &_devices);
private:
AWFormatterHelper *m_customFormatters = nullptr;
// variables
QHash<QString, QStringList> m_devices;
QHash<QString, AWKeysAggregator::FormatterType> m_formatter;
QHash<QString, QString> m_map;
};
#endif /* AWDATAENGINEMAPPER_H */

View File

@ -17,6 +17,9 @@
#include "awdbusadaptor.h"
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include "awdebug.h"
#include "awkeys.h"
@ -35,6 +38,25 @@ AWDBusAdaptor::~AWDBusAdaptor()
}
QStringList AWDBusAdaptor::ActiveServices() const
{
QDBusMessage listServices = QDBusConnection::sessionBus().interface()->call(
QDBus::BlockWithGui, "ListNames");
if (listServices.arguments().isEmpty()) {
qCWarning(LOG_DBUS) << "Could not find any DBus service";
return {};
}
QStringList arguments = listServices.arguments().first().toStringList();
return std::accumulate(arguments.cbegin(), arguments.cend(), QStringList(),
[](QStringList &source, QString service) {
if (service.startsWith(AWDBUS_SERVICE))
source.append(service);
return source;
});
}
QString AWDBusAdaptor::Info(const QString &key) const
{
return m_plugin->infoByKey(key);

View File

@ -37,6 +37,7 @@ public:
public slots:
// get methods
QStringList ActiveServices() const;
QString Info(const QString &key) const;
QStringList Keys(const QString &regexp) const;
QString Value(const QString &key) const;
@ -48,10 +49,7 @@ public slots:
private:
AWKeys *m_plugin = nullptr;
QStringList m_logLevels = QStringList() << "debug"
<< "info"
<< "warning"
<< "critical";
QStringList m_logLevels = {"debug", "info", "warning", "critical"};
};

View File

@ -22,8 +22,8 @@
#include "awactions.h"
#include "awbugreporter.h"
#include "awconfighelper.h"
#include "awformatterconfigfactory.h"
#include "awkeys.h"
#include "awpairconfigfactory.h"
#include "awtelemetryhandler.h"
@ -34,8 +34,7 @@ void AWPlugin::registerTypes(const char *uri)
qmlRegisterType<AWActions>(uri, 1, 0, "AWActions");
qmlRegisterType<AWBugReporter>(uri, 1, 0, "AWBugReporter");
qmlRegisterType<AWConfigHelper>(uri, 1, 0, "AWConfigHelper");
qmlRegisterType<AWFormatterConfigFactory>(uri, 1, 0,
"AWFormatterConfigFactory");
qmlRegisterType<AWPairConfigFactory>(uri, 1, 0, "AWPairConfigFactory");
qmlRegisterType<AWKeys>(uri, 1, 0, "AWKeys");
qmlRegisterType<AWTelemetryHandler>(uri, 1, 0, "AWTelemetryHandler");
}

View File

@ -16,168 +16,22 @@
***************************************************************************/
#include "awformatterconfig.h"
#include "ui_awformatterconfig.h"
#include <KI18n/KLocalizedString>
#include <QPushButton>
#include "awabstractselector.h"
#include "awdebug.h"
#include "awformatterhelper.h"
AWFormatterConfig::AWFormatterConfig(QWidget *_parent, const QStringList &_keys)
: QDialog(_parent)
, ui(new Ui::AWFormatterConfig)
, m_keys(_keys)
: AWAbstractPairConfig(_parent, true, _keys)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
ui->setupUi(this);
m_editButton
= ui->buttonBox->addButton(i18n("Edit"), QDialogButtonBox::ActionRole);
init();
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(m_editButton, SIGNAL(clicked(bool)), this, SLOT(editFormatters()));
setEditable(false, false);
initHelper<AWFormatterHelper>();
}
AWFormatterConfig::~AWFormatterConfig()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
clearSelectors();
delete m_helper;
delete ui;
}
void AWFormatterConfig::showDialog()
{
// update dialog
updateDialog();
// exec dialog
return execDialog();
}
void AWFormatterConfig::editFormatters()
{
m_helper->editItems();
updateDialog();
}
void AWFormatterConfig::updateUi()
{
QPair<QString, QString> current
= static_cast<AWAbstractSelector *>(sender())->current();
int index
= m_selectors.indexOf(static_cast<AWAbstractSelector *>(sender()));
if ((current.first.isEmpty()) && (current.second.isEmpty())) {
// remove current selector if it is empty and does not last
if (sender() == m_selectors.last())
return;
AWAbstractSelector *selector = m_selectors.takeAt(index);
ui->verticalLayout->removeWidget(selector);
selector->deleteLater();
} else {
// add new selector if something changed
if (sender() != m_selectors.last())
return;
auto keys = initKeys();
addSelector(keys.first, keys.second, QPair<QString, QString>());
}
}
void AWFormatterConfig::addSelector(const QStringList &_keys,
const QStringList &_values,
const QPair<QString, QString> &_current)
{
qCDebug(LOG_AW) << "Add selector with keys" << _keys << "values" << _values
<< "and current ones" << _current;
AWAbstractSelector *selector
= new AWAbstractSelector(ui->scrollAreaWidgetContents);
selector->init(_keys, _values, _current);
ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1, selector);
connect(selector, SIGNAL(selectionChanged()), this, SLOT(updateUi()));
m_selectors.append(selector);
}
void AWFormatterConfig::clearSelectors()
{
for (auto &selector : m_selectors) {
disconnect(selector, SIGNAL(selectionChanged()), this,
SLOT(updateUi()));
ui->verticalLayout->removeWidget(selector);
selector->deleteLater();
}
m_selectors.clear();
}
void AWFormatterConfig::execDialog()
{
int ret = exec();
QHash<QString, QString> data;
for (auto &selector : m_selectors) {
QPair<QString, QString> select = selector->current();
if (select.first.isEmpty())
continue;
data[select.first] = select.second;
}
// save configuration if required
switch (ret) {
case 0:
break;
case 1:
default:
m_helper->writeFormatters(data);
m_helper->removeUnusedFormatters(data.keys());
break;
}
}
void AWFormatterConfig::init()
{
delete m_helper;
m_helper = new AWFormatterHelper(this);
}
QPair<QStringList, QStringList> AWFormatterConfig::initKeys() const
{
// we are adding empty string at the start
QStringList keys = QStringList() << "";
keys.append(m_keys);
keys.sort();
QStringList knownFormatters = QStringList() << "";
knownFormatters.append(m_helper->knownFormatters());
knownFormatters.sort();
return QPair<QStringList, QStringList>(keys, knownFormatters);
}
void AWFormatterConfig::updateDialog()
{
clearSelectors();
QHash<QString, QString> appliedFormatters = m_helper->getFormatters();
auto keys = initKeys();
for (auto &key : appliedFormatters.keys())
addSelector(keys.first, keys.second,
QPair<QString, QString>(key, appliedFormatters[key]));
// empty one
addSelector(keys.first, keys.second, QPair<QString, QString>());
}

View File

@ -19,17 +19,10 @@
#ifndef AWFORMATTERCONFIG_H
#define AWFORMATTERCONFIG_H
#include <QDialog>
#include "awabstractpairconfig.h"
class AWAbstractSelector;
class AWFormatterHelper;
namespace Ui
{
class AWFormatterConfig;
}
class AWFormatterConfig : public QDialog
class AWFormatterConfig : public AWAbstractPairConfig
{
Q_OBJECT
@ -37,27 +30,6 @@ public:
explicit AWFormatterConfig(QWidget *_parent = nullptr,
const QStringList &_keys = QStringList());
virtual ~AWFormatterConfig();
Q_INVOKABLE void showDialog();
private slots:
void editFormatters();
void updateUi();
private:
QPushButton *m_editButton = nullptr;
Ui::AWFormatterConfig *ui = nullptr;
AWFormatterHelper *m_helper = nullptr;
QList<AWAbstractSelector *> m_selectors;
// properties
QStringList m_keys;
// methods
void addSelector(const QStringList &_keys, const QStringList &_values,
const QPair<QString, QString> &_current);
void clearSelectors();
void execDialog();
void init();
QPair<QStringList, QStringList> initKeys() const;
void updateDialog();
};

View File

@ -35,10 +35,11 @@
AWFormatterHelper::AWFormatterHelper(QWidget *_parent)
: AbstractExtItemAggregator(_parent, "formatters")
, AWAbstractPairHelper("awesomewidgets/formatters/formatters.ini",
"Formatters")
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
m_filePath = "awesomewidgets/formatters/formatters.ini";
initItems();
}
@ -52,6 +53,26 @@ AWFormatterHelper::~AWFormatterHelper()
}
void AWFormatterHelper::initItems()
{
initFormatters();
AWAbstractPairHelper::initItems();
// assign internal storage
m_formatters.clear();
for (auto &key : pairs().keys()) {
auto name = pairs()[key];
if (!m_formattersClasses.contains(name)) {
qCWarning(LOG_AW)
<< "Invalid formatter" << name << "found in" << key;
continue;
}
m_formatters[key] = m_formattersClasses[name];
}
}
QString AWFormatterHelper::convert(const QVariant &_value,
const QString &_name) const
{
@ -68,16 +89,6 @@ QStringList AWFormatterHelper::definedFormatters() const
}
QHash<QString, QString> AWFormatterHelper::getFormatters() const
{
QHash<QString, QString> map;
for (auto &tag : m_formatters.keys())
map[tag] = m_formatters[tag]->name();
return map;
}
QList<AbstractExtItem *> AWFormatterHelper::items() const
{
QList<AbstractExtItem *> converted;
@ -88,61 +99,24 @@ QList<AbstractExtItem *> AWFormatterHelper::items() const
}
QStringList AWFormatterHelper::knownFormatters() const
void AWFormatterHelper::editPairs()
{
return editItems();
}
QStringList AWFormatterHelper::leftKeys()
{
return QStringList();
}
QStringList AWFormatterHelper::rightKeys()
{
return m_formattersClasses.keys();
}
bool AWFormatterHelper::removeUnusedFormatters(const QStringList &_keys) const
{
qCDebug(LOG_AW) << "Remove formatters" << _keys;
QString fileName = QString("%1/%2")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation))
.arg(m_filePath);
QSettings settings(fileName, QSettings::IniFormat);
qCInfo(LOG_AW) << "Configuration file" << fileName;
settings.beginGroup("Formatters");
QStringList foundKeys = settings.childKeys();
for (auto &key : foundKeys) {
if (_keys.contains(key))
continue;
settings.remove(key);
}
settings.endGroup();
settings.sync();
return (settings.status() == QSettings::NoError);
}
bool AWFormatterHelper::writeFormatters(
const QHash<QString, QString> &_configuration) const
{
qCDebug(LOG_AW) << "Write configuration" << _configuration;
QString fileName = QString("%1/%2")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation))
.arg(m_filePath);
QSettings settings(fileName, QSettings::IniFormat);
qCInfo(LOG_AW) << "Configuration file" << fileName;
settings.beginGroup("Formatters");
for (auto &key : _configuration.keys())
settings.setValue(key, _configuration[key]);
settings.endGroup();
settings.sync();
return (settings.status() == QSettings::NoError);
}
void AWFormatterHelper::editItems()
{
repaintList();
@ -183,47 +157,52 @@ void AWFormatterHelper::initFormatters()
{
m_formattersClasses.clear();
for (int i = m_directories.count() - 1; i >= 0; i--) {
QStringList files
= QDir(m_directories.at(i)).entryList(QDir::Files, QDir::Name);
auto dirs = directories();
for (auto &dir : dirs) {
QStringList files = QDir(dir).entryList(QDir::Files, QDir::Name);
for (auto &file : files) {
// check filename
if (!file.endsWith(".desktop"))
continue;
qCInfo(LOG_AW) << "Found file" << file << "in"
<< m_directories.at(i);
QString filePath
= QString("%1/%2").arg(m_directories.at(i)).arg(file);
auto metadata = readMetadata(filePath);
QString name = metadata.first;
if (m_formattersClasses.contains(name))
qCInfo(LOG_AW) << "Found file" << file << "in" << dir;
QString filePath = QString("%1/%2").arg(dir).arg(file);
// check if already exists
auto values = m_formattersClasses.values();
if (std::any_of(values.cbegin(), values.cend(),
[&filePath](const AWAbstractFormatter *item) {
return (item->fileName() == filePath);
}))
continue;
auto metadata = readMetadata(filePath);
switch (metadata.second) {
case AWAbstractFormatter::FormatterClass::DateTime:
m_formattersClasses[name]
m_formattersClasses[metadata.first]
= new AWDateTimeFormatter(this, filePath);
break;
case AWAbstractFormatter::FormatterClass::Float:
m_formattersClasses[name]
m_formattersClasses[metadata.first]
= new AWFloatFormatter(this, filePath);
break;
case AWAbstractFormatter::FormatterClass::List:
m_formattersClasses[name] = new AWListFormatter(this, filePath);
m_formattersClasses[metadata.first]
= new AWListFormatter(this, filePath);
break;
case AWAbstractFormatter::FormatterClass::Script:
m_formattersClasses[name]
m_formattersClasses[metadata.first]
= new AWScriptFormatter(this, filePath);
break;
case AWAbstractFormatter::FormatterClass::String:
m_formattersClasses[name]
m_formattersClasses[metadata.first]
= new AWStringFormatter(this, filePath);
break;
case AWAbstractFormatter::FormatterClass::Json:
m_formattersClasses[name] = new AWJsonFormatter(this, filePath);
m_formattersClasses[metadata.first]
= new AWJsonFormatter(this, filePath);
break;
case AWAbstractFormatter::FormatterClass::NoFormat:
m_formattersClasses[name] = new AWNoFormatter(this, filePath);
m_formattersClasses[metadata.first]
= new AWNoFormatter(this, filePath);
break;
}
}
@ -231,55 +210,6 @@ void AWFormatterHelper::initFormatters()
}
void AWFormatterHelper::initKeys()
{
m_formatters.clear();
QStringList configs = QStandardPaths::locateAll(
QStandardPaths::GenericDataLocation, m_filePath);
for (auto &fileName : configs) {
QSettings settings(fileName, QSettings::IniFormat);
qCInfo(LOG_AW) << "Configuration file" << settings.fileName();
settings.beginGroup("Formatters");
QStringList keys = settings.childKeys();
for (auto &key : keys) {
QString name = settings.value(key).toString();
qCInfo(LOG_AW) << "Found formatter" << name << "for key" << key
<< "in" << settings.fileName();
if (name.isEmpty()) {
qCInfo(LOG_AW) << "Skip empty formatter for" << key;
continue;
}
if (!m_formattersClasses.contains(name)) {
qCWarning(LOG_AW)
<< "Invalid formatter" << name << "found in" << key;
continue;
}
m_formatters[key] = m_formattersClasses[name];
}
settings.endGroup();
}
}
void AWFormatterHelper::installDirectories()
{
// create directory at $HOME
QString localDir = QString("%1/awesomewidgets/formatters")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation));
QDir localDirectory;
if (localDirectory.mkpath(localDir))
qCInfo(LOG_AW) << "Created directory" << localDir;
m_directories = QStandardPaths::locateAll(
QStandardPaths::GenericDataLocation, "awesomewidgets/formatters",
QStandardPaths::LocateDirectory);
}
QPair<QString, AWAbstractFormatter::FormatterClass>
AWFormatterHelper::readMetadata(const QString &_filePath) const
{
@ -298,13 +228,8 @@ AWFormatterHelper::readMetadata(const QString &_filePath) const
void AWFormatterHelper::doCreateItem()
{
QStringList selection = QStringList() << "NoFormat"
<< "DateTime"
<< "Float"
<< "List"
<< "Script"
<< "String"
<< "Json";
QStringList selection
= {"NoFormat", "DateTime", "Float", "List", "Script", "String", "Json"};
bool ok;
QString select = QInputDialog::getItem(
this, i18n("Select type"), i18n("Type:"), selection, 0, false, &ok);
@ -333,11 +258,3 @@ void AWFormatterHelper::doCreateItem()
return createItem<AWNoFormatter>();
}
}
void AWFormatterHelper::initItems()
{
installDirectories();
initFormatters();
initKeys();
}

View File

@ -20,26 +20,28 @@
#define AWFORMATTERHELPER_H
#include "abstractextitemaggregator.h"
#include "awabstractformatter.h"
#include "awabstractpairhelper.h"
class AWAbstractFormatter;
class AWFormatterHelper : public AbstractExtItemAggregator
class AWFormatterHelper : public AbstractExtItemAggregator,
public AWAbstractPairHelper
{
Q_OBJECT
public:
explicit AWFormatterHelper(QWidget *_parent = nullptr);
virtual ~AWFormatterHelper();
// read-write methods
void initItems();
// methods
QString convert(const QVariant &_value, const QString &_name) const;
QStringList definedFormatters() const;
QHash<QString, QString> getFormatters() const;
QList<AbstractExtItem *> items() const;
QStringList knownFormatters() const;
bool removeUnusedFormatters(const QStringList &_keys) const;
bool writeFormatters(const QHash<QString, QString> &_configuration) const;
// configuration related
virtual void editPairs();
virtual QStringList leftKeys();
virtual QStringList rightKeys();
public slots:
void editItems();
@ -49,16 +51,11 @@ private:
AWAbstractFormatter::FormatterClass
defineFormatterClass(const QString &_stringType) const;
void initFormatters();
void initKeys();
void installDirectories();
QPair<QString, AWAbstractFormatter::FormatterClass>
readMetadata(const QString &_filePath) const;
// parent methods
void doCreateItem();
void initItems();
// properties
QStringList m_directories;
QString m_filePath;
QHash<QString, AWAbstractFormatter *> m_formatters;
QHash<QString, AWAbstractFormatter *> m_formattersClasses;
};

View File

@ -19,7 +19,6 @@
#include <QDir>
#include <QNetworkInterface>
#include <QRegExp>
#include <QSettings>
#include <QStandardPaths>
@ -86,6 +85,7 @@ bool AWKeyCache::addKeyToCache(const QString &_type, const QString &_key)
QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys,
const QStringList &_bars,
const QVariantMap &_tooltip,
const QStringList &_userKeys,
const QStringList &_allKeys)
{
qCDebug(LOG_AW) << "Looking for required keys in" << _keys << _bars
@ -94,6 +94,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys,
// initial copy
QSet<QString> used = QSet<QString>::fromList(_keys);
used.unite(QSet<QString>::fromList(_bars));
used.unite(QSet<QString>::fromList(_userKeys));
// insert keys from tooltip
for (auto &key : _tooltip.keys()) {
if ((key.endsWith("Tooltip")) && (_tooltip[key].toBool())) {
@ -146,9 +147,8 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys,
used << "swapgb"
<< "swapfreegb";
// network keys
QStringList netKeys({"up", "upkb", "uptotal", "uptotalkb", "upunits",
"down", "downkb", "downtotal", "downtotalkb",
"downunits"});
QStringList netKeys({"up", "upkb", "uptot", "uptotkb", "upunits", "down",
"downkb", "downtot", "downtotkb", "downunits"});
for (auto &key : netKeys) {
if (!used.contains(key))
continue;

View File

@ -29,6 +29,7 @@ namespace AWKeyCache
bool addKeyToCache(const QString &_type, const QString &_key = "");
QStringList getRequiredKeys(const QStringList &_keys, const QStringList &_bars,
const QVariantMap &_tooltip,
const QStringList &_userKeys,
const QStringList &_allKeys);
QHash<QString, QStringList> loadKeysFromCache();
};

View File

@ -22,6 +22,7 @@
#include <QRegExp>
#include <QThread>
#include "awcustomkeyshelper.h"
#include "awdebug.h"
#include "awkeycache.h"
#include "awpatternfunctions.h"
@ -38,20 +39,22 @@ AWKeyOperations::AWKeyOperations(QObject *_parent)
: QObject(_parent)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
m_customKeys = new AWCustomKeysHelper(this);
m_graphicalItems
= new ExtItemAggregator<GraphicalItem>(nullptr, "desktops");
m_extNetRequest
= new ExtItemAggregator<ExtNetworkRequest>(nullptr, "requests");
m_extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, "quotes");
m_extScripts = new ExtItemAggregator<ExtScript>(nullptr, "scripts");
m_extUpgrade = new ExtItemAggregator<ExtUpgrade>(nullptr, "upgrade");
m_extWeather = new ExtItemAggregator<ExtWeather>(nullptr, "weather");
}
AWKeyOperations::~AWKeyOperations()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
// extensions
delete m_graphicalItems;
delete m_extNetRequest;
delete m_extQuotes;
delete m_extScripts;
delete m_extUpgrade;
delete m_extWeather;
}
@ -119,12 +122,12 @@ QStringList AWKeyOperations::dictKeys() const
for (int i = 0; i < m_devices["net"].count(); i++) {
allKeys.append(QString("downunits%1").arg(i));
allKeys.append(QString("upunits%1").arg(i));
allKeys.append(QString("downtotalkb%1").arg(i));
allKeys.append(QString("downtotal%1").arg(i));
allKeys.append(QString("downtotkb%1").arg(i));
allKeys.append(QString("downtot%1").arg(i));
allKeys.append(QString("downkb%1").arg(i));
allKeys.append(QString("down%1").arg(i));
allKeys.append(QString("uptotalkb%1").arg(i));
allKeys.append(QString("uptotal%1").arg(i));
allKeys.append(QString("uptotkb%1").arg(i));
allKeys.append(QString("uptot%1").arg(i));
allKeys.append(QString("upkb%1").arg(i));
allKeys.append(QString("up%1").arg(i));
}
@ -159,6 +162,8 @@ QStringList AWKeyOperations::dictKeys() const
// bars
for (auto &item : m_graphicalItems->activeItems())
allKeys.append(item->tag("bar"));
// user defined keys
allKeys.append(m_customKeys->keys());
// static keys
allKeys.append(QString(STATIC_KEYS).split(','));
@ -180,6 +185,24 @@ GraphicalItem *AWKeyOperations::giByKey(const QString &_key) const
}
QStringList AWKeyOperations::requiredUserKeys() const
{
return m_customKeys->refinedSources();
}
QStringList AWKeyOperations::userKeys() const
{
return m_customKeys->keys();
}
QString AWKeyOperations::userKeySource(const QString &_key) const
{
return m_customKeys->source(_key);
}
QString AWKeyOperations::infoByKey(const QString &_key) const
{
qCDebug(LOG_AW) << "Requested key" << _key;
@ -314,29 +337,13 @@ void AWKeyOperations::addKeyToCache(const QString &_type, const QString &_key)
void AWKeyOperations::reinitKeys()
{
// renew extensions
// 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;
m_extScripts = nullptr;
delete m_extUpgrade;
m_extUpgrade = nullptr;
delete m_extWeather;
m_extWeather = nullptr;
// create
m_graphicalItems
= new ExtItemAggregator<GraphicalItem>(nullptr, "desktops");
m_extNetRequest
= new ExtItemAggregator<ExtNetworkRequest>(nullptr, "requests");
m_extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, "quotes");
m_extScripts = new ExtItemAggregator<ExtScript>(nullptr, "scripts");
m_extUpgrade = new ExtItemAggregator<ExtUpgrade>(nullptr, "upgrade");
m_extWeather = new ExtItemAggregator<ExtWeather>(nullptr, "weather");
m_customKeys->initItems();
m_graphicalItems->initItems();
m_extNetRequest->initItems();
m_extQuotes->initItems();
m_extScripts->initItems();
m_extUpgrade->initItems();
m_extWeather->initItems();
// init
QStringList allKeys = dictKeys();

View File

@ -19,24 +19,18 @@
#ifndef AWKEYOPERATIONS_H
#define AWKEYOPERATIONS_H
#include <Plasma/DataEngine>
#include <QMutex>
#include <QObject>
#include "extitemaggregator.h"
class AWDataAggregator;
class AWDataEngineAggregator;
class AWKeysAggregator;
class AWCustomKeysHelper;
class ExtNetworkRequest;
class ExtQuotes;
class ExtScript;
class ExtUpgrade;
class ExtWeather;
class GraphicalItem;
class QThreadPool;
class AWKeyOperations : public QObject
{
@ -52,6 +46,9 @@ public:
// keys
QStringList dictKeys() const;
GraphicalItem *giByKey(const QString &_key) const;
QStringList requiredUserKeys() const;
QStringList userKeys() const;
QString userKeySource(const QString &_key) const;
// values
QString infoByKey(const QString &_key) const;
QString pattern() const;
@ -70,6 +67,7 @@ private:
void addKeyToCache(const QString &_type, const QString &_key = "");
void reinitKeys();
// objects
AWCustomKeysHelper *m_customKeys = nullptr;
ExtItemAggregator<GraphicalItem> *m_graphicalItems = nullptr;
ExtItemAggregator<ExtNetworkRequest> *m_extNetRequest = nullptr;
ExtItemAggregator<ExtQuotes> *m_extQuotes = nullptr;

View File

@ -19,7 +19,6 @@
#include <QDBusConnection>
#include <QDBusError>
#include <QRegExp>
#include <QThread>
#include <QTimer>
#include <QtConcurrent/QtConcurrent>
@ -76,24 +75,9 @@ AWKeys::~AWKeys()
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
m_timer->stop();
delete m_timer;
// delete dbus session
qlonglong id = reinterpret_cast<qlonglong>(this);
QDBusConnection::sessionBus().unregisterObject(QString("/%1").arg(id));
// core
delete m_dataEngineAggregator;
delete m_threadPool;
delete m_aggregator;
delete m_dataAggregator;
delete m_keyOperator;
}
bool AWKeys::isDBusActive() const
{
return m_dbusActive;
}
@ -122,8 +106,7 @@ void AWKeys::initKeys(const QString &_currentPattern, const int _interval,
m_aggregator->initFormatters();
m_keyOperator->setPattern(_currentPattern);
m_keyOperator->updateCache();
m_dataEngineAggregator->clear();
m_dataEngineAggregator->initDataEngines(_interval);
m_dataEngineAggregator->reconnectSources(_interval);
// timer
m_timer->setInterval(_interval);
@ -161,6 +144,9 @@ QStringList AWKeys::dictKeys(const bool _sorted, const QString &_regexp) const
// check if functions asked
if (_regexp == "functions")
return QString(STATIC_FUNCTIONS).split(',');
// check if user defined keys asked
if (_regexp == "userdefined")
return m_keyOperator->userKeys();
QStringList allKeys = m_keyOperator->dictKeys();
// sort if required
@ -250,10 +236,11 @@ void AWKeys::reinitKeys(const QStringList &_currentKeys)
barKeys.append(item->usedKeys());
}
// get required keys
m_requiredKeys
= m_optimize ? AWKeyCache::getRequiredKeys(
m_foundKeys, barKeys, m_tooltipParams, _currentKeys)
: QStringList();
m_requiredKeys = m_optimize
? AWKeyCache::getRequiredKeys(
m_foundKeys, barKeys, m_tooltipParams,
m_keyOperator->requiredUserKeys(), _currentKeys)
: QStringList();
// set key data to m_aggregator
m_aggregator->setDevices(m_keyOperator->devices());
@ -266,10 +253,11 @@ void AWKeys::updateTextData()
m_mutex.lock();
calculateValues();
QString text = parsePattern(m_keyOperator->pattern());
// update tooltip values under lock
m_dataAggregator->dataUpdate(m_values);
m_mutex.unlock();
emit(needTextToBeUpdated(text));
emit(m_dataAggregator->updateData(m_values));
}
@ -303,13 +291,13 @@ void AWKeys::calculateValues()
= m_keyOperator->devices("net").indexOf(m_values["netdev"].toString());
m_values["down"] = m_values[QString("down%1").arg(netIndex)];
m_values["downkb"] = m_values[QString("downkb%1").arg(netIndex)];
m_values["downtotal"] = m_values[QString("downtotal%1").arg(netIndex)];
m_values["downtotalkb"] = m_values[QString("downtotalkb%1").arg(netIndex)];
m_values["downtot"] = m_values[QString("downtot%1").arg(netIndex)];
m_values["downtotkb"] = m_values[QString("downtotkb%1").arg(netIndex)];
m_values["downunits"] = m_values[QString("downunits%1").arg(netIndex)];
m_values["up"] = m_values[QString("up%1").arg(netIndex)];
m_values["upkb"] = m_values[QString("upkb%1").arg(netIndex)];
m_values["uptotal"] = m_values[QString("uptotal%1").arg(netIndex)];
m_values["uptotalkb"] = m_values[QString("uptotalkb%1").arg(netIndex)];
m_values["uptot"] = m_values[QString("uptot%1").arg(netIndex)];
m_values["uptotkb"] = m_values[QString("uptotkb%1").arg(netIndex)];
m_values["upunits"] = m_values[QString("upunits%1").arg(netIndex)];
// swaptot*
@ -321,6 +309,10 @@ void AWKeys::calculateValues()
m_values["swap"] = 100.0f * m_values["swapmb"].toFloat()
/ m_values["swaptotmb"].toFloat();
// user defined keys
for (auto &key : m_keyOperator->userKeys())
m_values[key] = m_values[m_keyOperator->userKeySource(key)];
// lambdas
for (auto &key : m_foundLambdas)
m_values[key] = AWPatternFunctions::expandLambdas(
@ -334,18 +326,25 @@ void AWKeys::createDBusInterface()
qlonglong id = reinterpret_cast<qlonglong>(this);
// create session
QDBusConnection bus = QDBusConnection::sessionBus();
if (!bus.registerService(AWDBUS_SERVICE))
qCWarning(LOG_AW) << "Could not register DBus service, last error"
<< bus.lastError().message();
if (!bus.registerObject(QString("/%1").arg(id), new AWDBusAdaptor(this),
QDBusConnection::ExportAllContents)) {
qCWarning(LOG_AW) << "Could not register DBus object, last error"
<< bus.lastError().message();
m_dbusActive = false;
QDBusConnection instanceBus = QDBusConnection::sessionBus();
// HACK we are going to use different services because it binds to
// application
if (instanceBus.registerService(
QString("%1.i%2").arg(AWDBUS_SERVICE).arg(id))) {
if (!instanceBus.registerObject(AWDBUS_PATH, new AWDBusAdaptor(this),
QDBusConnection::ExportAllContents))
qCWarning(LOG_AW) << "Could not register DBus object, last error"
<< instanceBus.lastError().message();
} else {
m_dbusActive = true;
qCWarning(LOG_AW) << "Could not register DBus service, last error"
<< instanceBus.lastError().message();
}
// and same instance but for id independent service
QDBusConnection commonBus = QDBusConnection::sessionBus();
if (commonBus.registerService(AWDBUS_SERVICE))
commonBus.registerObject(AWDBUS_PATH, new AWDBusAdaptor(this),
QDBusConnection::ExportAllContents);
}
@ -360,14 +359,8 @@ QString AWKeys::parsePattern(QString _pattern) const
// main keys
for (auto &key : m_foundKeys)
_pattern.replace(
QString("$%1").arg(key),
[this](const QString &tag, const QVariant &value) {
QString strValue = m_aggregator->formatter(value, tag);
if ((!tag.startsWith("custom")) && (!tag.startsWith("weather")))
strValue.replace(" ", "&nbsp;");
return strValue;
}(key, m_values[key]));
_pattern.replace(QString("$%1").arg(key),
m_aggregator->formatter(m_values[key], key));
// bars
for (auto &bar : m_foundBars) {

View File

@ -39,14 +39,13 @@ class AWKeys : public QObject
public:
explicit AWKeys(QObject *_parent = nullptr);
virtual ~AWKeys();
bool isDBusActive() const;
Q_INVOKABLE void initDataAggregator(const QVariantMap &_tooltipParams);
Q_INVOKABLE void initKeys(const QString &_currentPattern,
const int _interval, const int _limit,
const bool _optimize);
Q_INVOKABLE void setAggregatorProperty(const QString &_key,
const QVariant &_value);
Q_INVOKABLE void setWrapNewLines(const bool _wrap = false);
Q_INVOKABLE void setWrapNewLines(const bool _wrap);
// additional method to force load keys from Qml UI. Used in some
// configuration pages
Q_INVOKABLE void updateCache();
@ -88,7 +87,6 @@ private:
AWKeyOperations *m_keyOperator = nullptr;
QTimer *m_timer = nullptr;
// variables
bool m_dbusActive = false;
QVariantMap m_tooltipParams;
QStringList m_foundBars, m_foundKeys, m_foundLambdas, m_requiredKeys;
QVariantHash m_values;

View File

@ -21,10 +21,11 @@
#include <QDateTime>
#include <QLocale>
#include <QRegExp>
#include "awdataenginemapper.h"
#include "awdebug.h"
#include "awformatterhelper.h"
#include "version.h"
AWKeysAggregator::AWKeysAggregator(QObject *_parent)
@ -32,42 +33,25 @@ AWKeysAggregator::AWKeysAggregator(QObject *_parent)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
m_customFormatters = new AWFormatterHelper(nullptr);
m_mapper = new AWDataEngineMapper(this, m_customFormatters);
// sort time keys
m_timeKeys = QString(TIME_KEYS).split(',');
m_timeKeys.sort();
std::reverse(m_timeKeys.begin(), m_timeKeys.end());
// default formatters
// memory
m_formatter["mem"] = FormatterType::Float;
m_formatter["memtotmb"] = FormatterType::MemMBFormat;
m_formatter["memtotgb"] = FormatterType::MemGBFormat;
// network
m_formatter["down"] = FormatterType::NetSmartFormat;
m_formatter["downkb"] = FormatterType::Integer;
m_formatter["downunits"] = FormatterType::NetSmartUnits;
m_formatter["up"] = FormatterType::NetSmartFormat;
m_formatter["upkb"] = FormatterType::Integer;
m_formatter["upunits"] = FormatterType::NetSmartUnits;
// swap
m_formatter["swap"] = FormatterType::Float;
m_formatter["swaptotmb"] = FormatterType::MemMBFormat;
m_formatter["swaptotgb"] = FormatterType::MemGBFormat;
}
AWKeysAggregator::~AWKeysAggregator()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
delete m_customFormatters;
}
void AWKeysAggregator::initFormatters()
{
if (m_customFormatters)
delete m_customFormatters;
m_customFormatters = new AWFormatterHelper(nullptr);
m_customFormatters->initItems();
}
@ -79,7 +63,7 @@ QString AWKeysAggregator::formatter(const QVariant &_data,
QString output;
QLocale loc = m_translate ? QLocale::system() : QLocale::c();
// case block
switch (m_formatter[_key]) {
switch (m_mapper->formatter(_key)) {
case FormatterType::Float:
output = QString("%1").arg(_data.toFloat(), 5, 'f', 1);
break;
@ -171,8 +155,9 @@ QString AWKeysAggregator::formatter(const QVariant &_data,
QString("%1").arg(minutes, 2, 10, QChar('0')));
source.replace("$m", QString("%1").arg(minutes));
return source;
}(m_formatter[_key] == FormatterType::Uptime ? "$ddd$hhh$mmm"
: m_customUptime,
}(m_mapper->formatter(_key) == FormatterType::Uptime
? "$ddd$hhh$mmm"
: m_customUptime,
static_cast<int>(_data.toFloat()));
break;
case FormatterType::NoFormat:
@ -184,6 +169,10 @@ QString AWKeysAggregator::formatter(const QVariant &_data,
break;
}
// replace spaces to non-breakable ones
if (!_key.startsWith("custom") && (!_key.startsWith("weather")))
output.replace(" ", "&nbsp;");
return output;
}
@ -192,7 +181,7 @@ QStringList AWKeysAggregator::keysFromSource(const QString &_source) const
{
qCDebug(LOG_AW) << "Search for source" << _source;
return m_map.values(_source);
return m_mapper->keysFromSource(_source);
}
@ -232,7 +221,7 @@ void AWKeysAggregator::setDevices(const QHash<QString, QStringList> &_devices)
{
qCDebug(LOG_AW) << "Devices" << _devices;
m_devices = _devices;
m_mapper->setDevices(_devices);
}
@ -252,364 +241,13 @@ void AWKeysAggregator::setTranslate(const bool _translate)
}
// HACK units required to define should the value be calculated as temperature
// or fan data
QStringList AWKeysAggregator::registerSource(const QString &_source,
const QString &_units,
const QStringList &_keys)
{
qCDebug(LOG_AW) << "Source" << _source << "with units" << _units;
// regular expressions
QRegExp cpuRegExp = QRegExp("cpu/cpu.*/TotalLoad");
QRegExp cpuclRegExp = QRegExp("cpu/cpu.*/clock");
QRegExp hddrRegExp = QRegExp("disk/.*/Rate/rblk");
QRegExp hddwRegExp = QRegExp("disk/.*/Rate/wblk");
QRegExp mountFillRegExp = QRegExp("partitions/.*/filllevel");
QRegExp mountFreeRegExp = QRegExp("partitions/.*/freespace");
QRegExp mountUsedRegExp = QRegExp("partitions/.*/usedspace");
QRegExp netRegExp
= QRegExp("network/interfaces/.*/(receiver|transmitter)/data$");
QRegExp netTotalRegExp
= QRegExp("network/interfaces/.*/(receiver|transmitter)/dataTotal$");
if (_source == "battery/ac") {
// AC
m_map[_source] = "ac";
m_formatter["ac"] = FormatterType::ACFormat;
} else if (_source.startsWith("battery/")) {
// battery stats
QString key = _source;
key.remove("battery/");
m_map[_source] = key;
m_formatter[key] = FormatterType::IntegerThree;
} else if (_source == "cpu/system/TotalLoad") {
// cpu
m_map[_source] = "cpu";
m_formatter["cpu"] = FormatterType::Float;
} else if (_source.contains(cpuRegExp)) {
// cpus
QString key = _source;
key.remove("cpu/").remove("/TotalLoad");
m_map[_source] = key;
m_formatter[key] = FormatterType::Float;
} else if (_source == "cpu/system/AverageClock") {
// cpucl
m_map[_source] = "cpucl";
m_formatter["cpucl"] = FormatterType::Integer;
} else if (_source.contains(cpuclRegExp)) {
// cpucls
QString key = _source;
key.remove("cpu/cpu").remove("/clock");
key = QString("cpucl%1").arg(key);
m_map[_source] = key;
m_formatter[key] = FormatterType::Integer;
} else if (_source.startsWith("custom")) {
// custom
QString key = _source;
key.remove("custom/");
m_map[_source] = key;
m_formatter[key] = FormatterType::NoFormat;
} else if (_source == "desktop/current/name") {
// current desktop name
m_map[_source] = "desktop";
m_formatter["desktop"] = FormatterType::NoFormat;
} else if (_source == "desktop/current/number") {
// current desktop number
m_map[_source] = "ndesktop";
m_formatter["ndesktop"] = FormatterType::NoFormat;
} else if (_source == "desktop/total/number") {
// desktop count
m_map[_source] = "tdesktops";
m_formatter["tdesktops"] = FormatterType::NoFormat;
} else if (_source.contains(hddrRegExp)) {
// read speed
QString device = _source;
device.remove("/Rate/rblk");
int index = m_devices["disk"].indexOf(device);
if (index > -1) {
QString key = QString("hddr%1").arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::Integer;
}
} else if (_source.contains(hddwRegExp)) {
// write speed
QString device = _source;
device.remove("/Rate/wblk");
int index = m_devices["disk"].indexOf(device);
if (index > -1) {
QString key = QString("hddw%1").arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::Integer;
}
} else if (_source == "gpu/load") {
// gpu load
m_map[_source] = "gpu";
m_formatter["gpu"] = FormatterType::Float;
} else if (_source == "gpu/temperature") {
// gpu temperature
m_map[_source] = "gputemp";
m_formatter["gputemp"] = FormatterType::Temperature;
} else if (_source.contains(mountFillRegExp)) {
// fill level
QString device = _source;
device.remove("partitions").remove("/filllevel");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
QString key = QString("hdd%1").arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::Float;
// additional keys
m_formatter[QString("hddtotmb%1").arg(index)]
= FormatterType::MemMBFormat;
m_formatter[QString("hddtotgb%1").arg(index)]
= FormatterType::MemGBFormat;
}
} else if (_source.contains(mountFreeRegExp)) {
// free space
QString device = _source;
device.remove("partitions").remove("/freespace");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
// mb
QString key = QString("hddfreemb%1").arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::MemMBFormat;
// gb
key = QString("hddfreegb%1").arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = FormatterType::MemGBFormat;
}
} else if (_source.contains(mountUsedRegExp)) {
// used
QString device = _source;
device.remove("partitions").remove("/usedspace");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
// mb
QString key = QString("hddmb%1").arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::MemMBFormat;
// gb
key = QString("hddgb%1").arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = FormatterType::MemGBFormat;
}
} else if (_source.startsWith("hdd/temperature")) {
// hdd temperature
QString device = _source;
device.remove("hdd/temperature");
int index = m_devices["hdd"].indexOf(device);
if (index > -1) {
QString key = QString("hddtemp%1").arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::Temperature;
}
} else if (_source.startsWith("cpu/system/loadavg")) {
// load average
QString time = _source;
time.remove("cpu/system/loadavg");
QString key = QString("la%1").arg(time);
m_map[_source] = key;
m_formatter[key] = FormatterType::FloatTwoSymbols;
} else if (_source == "mem/physical/application") {
// app memory
// mb
m_map[_source] = "memmb";
m_formatter["memmb"] = FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "memgb");
m_formatter["memgb"] = FormatterType::MemGBFormat;
} else if (_source == "mem/physical/free") {
// free memory
// mb
m_map[_source] = "memfreemb";
m_formatter["memfreemb"] = FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "memfreegb");
m_formatter["memfreegb"] = FormatterType::MemGBFormat;
} else if (_source == "mem/physical/used") {
// used memory
// mb
m_map[_source] = "memusedmb";
m_formatter["memusedmb"] = FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "memusedgb");
m_formatter["memusedgb"] = FormatterType::MemGBFormat;
} else if (_source == "network/current/name") {
// network device
m_map[_source] = "netdev";
m_formatter["netdev"] = FormatterType::NoFormat;
} else if (_source.startsWith("network/response")) {
// network response
QString key = _source;
key.remove("network/");
m_map[_source] = key;
m_formatter[key] = FormatterType::NoFormat;
} else if (_source.contains(netRegExp)) {
// network speed
QString type = _source.contains("receiver") ? "down" : "up";
int index = m_devices["net"].indexOf(_source.split('/')[2]);
if (index > -1) {
// kb
QString key = QString("%1kb%2").arg(type).arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::Integer;
// smart
key = QString("%1%2").arg(type).arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = FormatterType::NetSmartFormat;
// units
key = QString("%1units%2").arg(type).arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = FormatterType::NetSmartUnits;
}
} else if (_source.contains(netTotalRegExp)) {
// network data total
QString type = _source.contains("receiver") ? "down" : "up";
int index = m_devices["net"].indexOf(_source.split('/')[2]);
if (index > -1) {
// kb
QString key = QString("%1totalkb%2").arg(type).arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::Integer;
// mb
key = QString("%1total%2").arg(type).arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = FormatterType::MemMBFormat;
}
} else if (_source.startsWith("upgrade")) {
// package manager
QString key = _source;
key.remove("upgrade/");
m_map[_source] = key;
m_formatter[key] = FormatterType::IntegerThree;
} else if (_source.startsWith("player")) {
// player
QString key = _source;
key.remove("player/");
m_map[_source] = key;
m_formatter[key] = FormatterType::NoFormat;
} else if (_source == "ps/running/count") {
// running processes count
m_map[_source] = "pscount";
m_formatter["pscount"] = FormatterType::NoFormat;
} else if (_source == "ps/running/list") {
// list of running processes
m_map[_source] = "ps";
m_formatter["ps"] = FormatterType::List;
} else if (_source == "ps/total/count") {
// total processes count
m_map[_source] = "pstotal";
m_formatter["pstotal"] = FormatterType::NoFormat;
} else if (_source.startsWith("quotes")) {
// quotes
QString key = _source;
key.remove("quotes/");
m_map[_source] = key;
m_formatter[key] = FormatterType::Quotes;
} else if (_source == "mem/swap/free") {
// free swap
// mb
m_map[_source] = "swapfreemb";
m_formatter["swapfreemb"] = FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "swapfreegb");
m_formatter["swapfreegb"] = FormatterType::MemGBFormat;
} else if (_source == "mem/swap/used") {
// used swap
// mb
m_map[_source] = "swapmb";
m_formatter["swapmb"] = FormatterType::MemMBFormat;
// gb
m_map.insertMulti(_source, "swapgb");
m_formatter["swapgb"] = FormatterType::MemGBFormat;
} else if (_source.startsWith("lmsensors/")) {
// temperature
int index = m_devices["temp"].indexOf(_source);
// HACK on DE initialization there are no units key
if (_units.isEmpty())
return QStringList({QString("temp%1").arg(index)});
if (index > -1) {
QString key = QString("temp%1").arg(index);
m_map[_source] = key;
m_formatter[key] = _units == "°C" ? FormatterType::Temperature
: FormatterType::Integer;
}
} else if (_source == "Local") {
// time
m_map[_source] = "time";
m_formatter["time"] = FormatterType::Time;
// custom time
m_map.insertMulti(_source, "ctime");
m_formatter["ctime"] = FormatterType::TimeCustom;
// ISO time
m_map.insertMulti(_source, "isotime");
m_formatter["isotime"] = FormatterType::TimeISO;
// long time
m_map.insertMulti(_source, "longtime");
m_formatter["longtime"] = FormatterType::TimeLong;
// short time
m_map.insertMulti(_source, "shorttime");
m_formatter["shorttime"] = FormatterType::TimeShort;
// timestamp
m_map.insertMulti(_source, "tstime");
m_formatter["tstime"] = FormatterType::Timestamp;
} else if (_source == "system/uptime") {
// uptime
m_map[_source] = "uptime";
m_formatter["uptime"] = FormatterType::Uptime;
// custom uptime
m_map.insertMulti(_source, "cuptime");
m_formatter["cuptime"] = FormatterType::UptimeCustom;
} else if (_source.startsWith("weather/temperature")) {
// temperature
QString key = _source;
key.remove("weather/");
m_map[_source] = key;
m_formatter[key] = FormatterType::Temperature;
} else if (_source.startsWith("weather/")) {
// other weather
QString key = _source;
key.remove("weather/");
m_map[_source] = key;
m_formatter[key] = FormatterType::NoFormat;
} else if (_source.startsWith("load/load")) {
// load source
QString key = _source;
key.remove("load/");
m_map[_source] = key;
m_formatter[key] = FormatterType::Temperature;
}
QStringList foundKeys = keysFromSource(_source);
// rewrite formatters for custom ones
QStringList customFormattersKeys;
if (m_customFormatters)
customFormattersKeys = m_customFormatters->definedFormatters();
qCInfo(LOG_AW) << "Looking for fprmatters" << foundKeys << "in"
<< customFormattersKeys;
for (auto &key : foundKeys) {
if (!customFormattersKeys.contains(key))
continue;
m_formatter[key] = FormatterType::Custom;
}
// drop key from dictionary if no one user requested key required it
qCInfo(LOG_AW) << "Looking for keys" << foundKeys << "in" << _keys;
bool required
= _keys.isEmpty() || std::any_of(foundKeys.cbegin(), foundKeys.cend(),
[&_keys](const QString &key) {
return _keys.contains(key);
});
if (!required) {
m_map.remove(_source);
for (auto &key : foundKeys)
m_formatter.remove(key);
}
return keysFromSource(_source);
return m_mapper->registerSource(_source, _units, _keys);
}

View File

@ -22,10 +22,9 @@
#include <QHash>
#include <QObject>
#include "version.h"
class AWFormatterHelper;
class AWDataEngineMapper;
class AWKeysAggregator : public QObject
{
@ -38,6 +37,7 @@ class AWKeysAggregator : public QObject
Q_PROPERTY(QString tempUnits MEMBER m_tempUnits WRITE setTempUnits);
Q_PROPERTY(bool translate MEMBER m_translate WRITE setTranslate);
public:
enum class FormatterType {
// general formatters
Custom,
@ -66,7 +66,6 @@ class AWKeysAggregator : public QObject
UptimeCustom
};
public:
explicit AWKeysAggregator(QObject *_parent = nullptr);
virtual ~AWKeysAggregator();
void initFormatters();
@ -89,15 +88,13 @@ public slots:
private:
float temperature(const float temp) const;
AWFormatterHelper *m_customFormatters = nullptr;
QStringList m_timeKeys = QString(TIME_KEYS).split(',');
AWDataEngineMapper *m_mapper = nullptr;
QStringList m_timeKeys;
// variables
QString m_acOffline;
QString m_acOnline;
QString m_customTime;
QString m_customUptime;
QHash<QString, QStringList> m_devices;
QHash<QString, FormatterType> m_formatter;
QHash<QString, QString> m_map;
QString m_tempUnits;
bool m_translate = false;
};

View File

@ -15,28 +15,37 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "awformatterconfigfactory.h"
#include "awpairconfigfactory.h"
#include "awcustomkeysconfig.h"
#include "awdebug.h"
#include "awformatterconfig.h"
AWFormatterConfigFactory::AWFormatterConfigFactory(QObject *_parent)
AWPairConfigFactory::AWPairConfigFactory(QObject *_parent)
: QObject(_parent)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
}
AWFormatterConfigFactory::~AWFormatterConfigFactory()
AWPairConfigFactory::~AWPairConfigFactory()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
}
void AWFormatterConfigFactory::showDialog(const QStringList &_keys)
void AWPairConfigFactory::showFormatterDialog(const QStringList &_keys)
{
AWFormatterConfig *config = new AWFormatterConfig(nullptr, _keys);
config->showDialog();
config->deleteLater();
}
void AWPairConfigFactory::showKeysDialog(const QStringList &_keys)
{
AWCustomKeysConfig *config = new AWCustomKeysConfig(nullptr, _keys);
config->showDialog();
config->deleteLater();
}

View File

@ -0,0 +1,39 @@
/***************************************************************************
* 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 AWPAIRCONFIGFACTORY_H
#define AWPAIRCONFIGFACTORY_H
#include <QObject>
class AWPairConfigFactory : public QObject
{
Q_OBJECT
public:
explicit AWPairConfigFactory(QObject *_parent = nullptr);
virtual ~AWPairConfigFactory();
Q_INVOKABLE void showFormatterDialog(const QStringList &_keys);
Q_INVOKABLE void showKeysDialog(const QStringList &_keys);
private:
};
#endif /* AWPAIRCONFIGFACTORY_H */

View File

@ -18,10 +18,8 @@
#include "awtelemetryhandler.h"
#include <QJsonDocument>
#include <QJsonParseError>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QSettings>
#include <QStandardPaths>
#include <QUuid>

View File

@ -20,10 +20,8 @@
#define AWTELEMETRYHANDLER_H
#include <QObject>
#include <QtCore/QVariant>
class QAbstractButton;
class QNetworkReply;
class AWTelemetryHandler : public QObject

View File

@ -21,10 +21,8 @@
#include <QDesktopServices>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QSettings>
#include "awdebug.h"

View File

@ -24,7 +24,6 @@
#include <QTime>
#include "abstractextitemaggregator.h"
#include "awdebug.h"
#include "qcronscheduler.h"
@ -47,7 +46,7 @@ AbstractExtItem::~AbstractExtItem()
if (m_socket) {
m_socket->close();
m_socket->removeServer(socket());
delete m_socket;
m_socket->deleteLater();
}
}

View File

@ -20,7 +20,7 @@
#include <KI18n/KLocalizedString>
#include <QFileInfo>
#include <QDir>
#include <QInputDialog>
#include <QPushButton>
@ -33,6 +33,15 @@ AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *_parent,
{
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
// create directory at $HOME
QString localDir = QString("%1/awesomewidgets/%2")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation))
.arg(type());
QDir localDirectory;
if (localDirectory.mkpath(localDir))
qCInfo(LOG_LIB) << "Created directory" << localDir;
ui->setupUi(this);
copyButton
= ui->buttonBox->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
@ -182,6 +191,17 @@ QVariant AbstractExtItemAggregator::configArgs() const
}
QStringList AbstractExtItemAggregator::directories() const
{
auto dirs
= QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/%1").arg(type()),
QStandardPaths::LocateDirectory);
return dirs;
}
QString AbstractExtItemAggregator::type() const
{
return m_type;

View File

@ -67,11 +67,13 @@ public:
void deleteItem();
void editItem();
QString getName();
virtual void initItems() = 0;
AbstractExtItem *itemFromWidget();
void repaintList();
int uniqNumber() const;
// get methods
QVariant configArgs() const;
QStringList directories() const;
virtual QList<AbstractExtItem *> items() const = 0;
QString type() const;
// set methods
@ -92,7 +94,6 @@ private:
QString m_type;
// ui methods
virtual void doCreateItem() = 0;
virtual void initItems() = 0;
};

View File

@ -22,7 +22,6 @@
#include <KI18n/KLocalizedString>
#include <QDateTime>
#include <QDir>
#include <QSettings>
#include "awdebug.h"

View File

@ -18,9 +18,10 @@
#ifndef AWDATETIMEFORMATTER_H
#define AWDATETIMEFORMATTER_H
#include "awabstractformatter.h"
#include <QLocale>
#include "awabstractformatter.h"
namespace Ui
{

View File

@ -21,7 +21,6 @@
#include <KI18n/KLocalizedString>
#include <QDir>
#include <QSettings>
#include "awdebug.h"

View File

@ -21,7 +21,6 @@
#include <KI18n/KLocalizedString>
#include <QDir>
#include <QJSEngine>
#include <QSettings>

View File

@ -21,7 +21,6 @@
#include <KI18n/KLocalizedString>
#include <QDir>
#include <QSettings>
#include "awdebug.h"

View File

@ -121,7 +121,7 @@ queueLimit=0
swapTooltip=true
swapTooltipColor=#ffff00
tempUnits=Celsius
text="<body bgcolor=\"#000000\">\n<p align=\"justify\">Uptime: $cuptime<br>\nRAM: &nbsp;$mem&nbsp;&nbsp;$bar5<br>\nSwap: $swap&nbsp;&nbsp;$bar6<br>\nCPU: &nbsp;$cpu&nbsp;&nbsp;$bar7<br>\nCPU Temp: $temp0&deg;C<br>\nDown: $down$downunits&nbsp;&nbsp;&nbsp;&nbsp;$downtotal<br>\n$bar8<br>\nUp:&nbsp;&nbsp; $up$upunits&nbsp;&nbsp;&nbsp;&nbsp;$uptotal<br>\n$bar9<br></p>\n</body>\n"
text="<body bgcolor=\"#000000\">\n<p align=\"justify\">Uptime: $cuptime<br>\nRAM: &nbsp;$mem&nbsp;&nbsp;$bar5<br>\nSwap: $swap&nbsp;&nbsp;$bar6<br>\nCPU: &nbsp;$cpu&nbsp;&nbsp;$bar7<br>\nCPU Temp: $temp0&deg;C<br>\nDown: $down$downunits&nbsp;&nbsp;&nbsp;&nbsp;$downtot<br>\n$bar8<br>\nUp:&nbsp;&nbsp; $up$upunits&nbsp;&nbsp;&nbsp;&nbsp;$uptot<br>\n$bar9<br></p>\n</body>\n"
textAlign=center
tooltipBackground=#ffffff
tooltipNumber=100

View File

@ -61,6 +61,19 @@ public:
qCInfo(LOG_LIB) << "Dialog returns" << ret;
};
void initItems()
{
m_items.clear();
m_activeItems.clear();
m_items = getItems();
for (auto &item : m_items) {
if (!item->isActive())
continue;
m_activeItems.append(static_cast<T *>(item));
}
};
void initSockets()
{
// HACK as soon as per one widget instance we have two objects each of
@ -114,29 +127,23 @@ private:
QList<AbstractExtItem *> getItems()
{
// create directory at $HOME
QString localDir = QString("%1/awesomewidgets/%2")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation))
.arg(type());
QDir localDirectory;
if (localDirectory.mkpath(localDir))
qCInfo(LOG_LIB) << "Created directory" << localDir;
QStringList dirs = QStandardPaths::locateAll(
QStandardPaths::GenericDataLocation,
QString("awesomewidgets/%1").arg(type()),
QStandardPaths::LocateDirectory);
QStringList names;
QList<AbstractExtItem *> items;
auto dirs = directories();
for (auto &dir : dirs) {
QStringList files = QDir(dir).entryList(QDir::Files, QDir::Name);
for (auto &file : files) {
if ((!file.endsWith(".desktop")) || (names.contains(file)))
// check filename
if (!file.endsWith(".desktop"))
continue;
qCInfo(LOG_LIB) << "Found file" << file << "in" << dir;
names.append(file);
QString filePath = QString("%1/%2").arg(dir).arg(file);
// check if already exists
if (std::any_of(items.cbegin(), items.cend(),
[&filePath](AbstractExtItem *item) {
return (item->fileName() == filePath);
}))
continue;
items.append(new T(this, filePath));
}
}
@ -148,19 +155,6 @@ private:
});
return items;
};
void initItems()
{
m_items.clear();
m_activeItems.clear();
m_items = getItems();
for (auto &item : m_items) {
if (!item->isActive())
continue;
m_activeItems.append(static_cast<T *>(item));
}
};
};

View File

@ -21,8 +21,6 @@
#include <KI18n/KLocalizedString>
#include <QDir>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QSettings>
#include <QTextCodec>

View File

@ -22,9 +22,6 @@
#include <QDir>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QSettings>
#include <QUrlQuery>

View File

@ -22,7 +22,6 @@
#include <QDir>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QSettings>
#include <QStandardPaths>
#include <QTextCodec>

View File

@ -21,7 +21,6 @@
#include <KI18n/KLocalizedString>
#include <QDir>
#include <QRegExp>
#include <QSettings>
#include <QTextCodec>

View File

@ -22,9 +22,6 @@
#include <QDir>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QSettings>
#include <QStandardPaths>
@ -72,7 +69,6 @@ ExtWeather::~ExtWeather()
disconnect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest()));
m_manager->deleteLater();
delete m_providerObject;
delete ui;
}

View File

@ -38,6 +38,19 @@ GraphicalItem::GraphicalItem(QWidget *_parent, const QString &_filePath)
{
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
// init scene
m_scene = new QGraphicsScene();
m_scene->setBackgroundBrush(QBrush(Qt::NoBrush));
// init view
m_view = new QGraphicsView(m_scene);
m_view->setStyleSheet("background: transparent");
m_view->setContentsMargins(0, 0, 0, 0);
m_view->setFrameShape(QFrame::NoFrame);
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// init helper
m_helper = new GraphicalItemHelper(this, m_scene);
if (!_filePath.isEmpty())
readConfiguration();
ui->setupUi(this);
@ -58,9 +71,7 @@ GraphicalItem::~GraphicalItem()
{
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
delete m_scene;
delete ui;
delete m_helper;
}
@ -141,24 +152,7 @@ QString GraphicalItem::image(const QVariant &value)
void GraphicalItem::initScene()
{
// cleanup
delete m_helper;
delete m_scene;
// init scene
m_scene = new QGraphicsScene();
m_scene->setBackgroundBrush(QBrush(Qt::NoBrush));
// init view
m_view = new QGraphicsView(m_scene);
m_view->setStyleSheet("background: transparent");
m_view->setContentsMargins(0, 0, 0, 0);
m_view->setFrameShape(QFrame::NoFrame);
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_view->resize(m_width + 5, m_height + 5);
// init helper
m_helper = new GraphicalItemHelper(this, m_scene);
m_helper->setParameters(activeColor(), inactiveColor(), itemWidth(),
itemHeight(), count());
}

View File

@ -17,7 +17,6 @@
#include "graphicalitemhelper.h"
#include <QColor>
#include <QGraphicsEllipseItem>
#include <QGraphicsScene>
#include <QUrl>

View File

@ -44,7 +44,6 @@ QCronScheduler::~QCronScheduler()
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
m_timer->stop();
delete m_timer;
}

View File

@ -39,8 +39,8 @@ Item {
property alias cfg_currentFontSize: fontSize.value
property string cfg_currentFontWeight: fontWeight.value
property string cfg_currentFontStyle: fontStyle.value
property alias cfg_currentFontColor: selectColor.text
property alias cfg_currentTextStyleColor: selectStyleColor.text
property alias cfg_currentFontColor: selectColor.value
property alias cfg_currentTextStyleColor: selectStyleColor.value
property string cfg_currentTextStyle: textStyle.value
@ -65,7 +65,7 @@ Item {
ComboBoxSelector {
id: fontWeight
model: general.fontWeightModel
model: General.fontWeightModel
text: i18n("Font weight")
value: plasmoid.configuration.currentFontWeight
onValueEdited: cfg_currentFontWeight = newValue
@ -73,7 +73,7 @@ Item {
ComboBoxSelector {
id: fontStyle
model: general.fontStyleModel
model: General.fontStyleModel
text: i18n("Font style")
value: plasmoid.configuration.currentFontStyle
onValueEdited: cfg_currentFontStyle = newValue
@ -87,7 +87,7 @@ Item {
ComboBoxSelector {
id: textStyle
model: general.textStyleModel
model: General.textStyleModel
text: i18n("Style")
value: plasmoid.configuration.currentTextStyle
onValueEdited: cfg_currentTextStyle = newValue

View File

@ -65,7 +65,7 @@ Item {
ComboBoxSelector {
id: fontWeight
model: general.fontWeightModel
model: General.fontWeightModel
text: i18n("Font weight")
value: plasmoid.configuration.fontWeight
onValueEdited: cfg_fontWeight = newValue
@ -73,7 +73,7 @@ Item {
ComboBoxSelector {
id: fontStyle
model: general.fontStyleModel
model: General.fontStyleModel
text: i18n("Font style")
value: plasmoid.configuration.fontStyle
onValueEdited: cfg_fontStyle = newValue
@ -87,7 +87,7 @@ Item {
ComboBoxSelector {
id: textStyle
model: general.textStyleModel
model: General.textStyleModel
text: i18n("Style")
value: plasmoid.configuration.textStyle
onValueEdited: cfg_textStyle = newValue

View File

@ -123,16 +123,16 @@ Item {
repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily
repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic" ? true : false
repeater.itemAt(i).font.pointSize = plasmoid.configuration.currentFontSize
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.currentFontWeight]
repeater.itemAt(i).style = general.textStyle[plasmoid.configuration.currentTextStyle]
repeater.itemAt(i).font.weight = General.fontWeight[plasmoid.configuration.currentFontWeight]
repeater.itemAt(i).style = General.textStyle[plasmoid.configuration.currentTextStyle]
repeater.itemAt(i).styleColor = plasmoid.configuration.currentTextStyleColor
} else {
repeater.itemAt(i).color = plasmoid.configuration.fontColor
repeater.itemAt(i).font.family = plasmoid.configuration.fontFamily
repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle == "italic" ? true : false
repeater.itemAt(i).font.pointSize = plasmoid.configuration.fontSize
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.fontWeight]
repeater.itemAt(i).style = general.textStyle[plasmoid.configuration.textStyle]
repeater.itemAt(i).font.weight = General.fontWeight[plasmoid.configuration.fontWeight]
repeater.itemAt(i).style = General.textStyle[plasmoid.configuration.textStyle]
repeater.itemAt(i).styleColor = plasmoid.configuration.textStyleColor
}
repeater.itemAt(i).update()

View File

@ -3,7 +3,7 @@
# common QML constants
singleton general 1.0 file:///usr/share/awesomewidgets/qml/general.qml
singleton General 1.0 file:///usr/share/awesomewidgets/qml/General.qml
# custom QML UI classes
AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml

View File

@ -52,7 +52,7 @@ Item {
backend: dpAdds
notifyBackend: dpAdds
textArea: textPattern
groups: general.dpTagRegexp
groups: General.dpTagRegexp
}
AWTextEditor {

View File

@ -20,7 +20,7 @@ X-Plasma-RemoteLocation=
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel
X-KDE-PluginInfo-Version=3.3.1
X-KDE-PluginInfo-Version=3.3.3
X-KDE-PluginInfo-Website=https://arcanis.me/projects/awesome-widgets/
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends=

View File

@ -27,8 +27,6 @@
#include <QGraphicsView>
#include <QHBoxLayout>
#include <QListWidget>
#include <QMessageBox>
#include <QPixmap>
#include <QScreen>
#include <fontdialog/fontdialog.h>

View File

@ -18,7 +18,6 @@
#include "extsysmon.h"
#include <QFile>
#include <QRegExp>
#include <QSettings>
#include <QStandardPaths>
@ -50,8 +49,6 @@ ExtendedSysMon::ExtendedSysMon(QObject *_parent, const QVariantList &_args)
ExtendedSysMon::~ExtendedSysMon()
{
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
delete m_aggregator;
}

View File

@ -37,8 +37,6 @@ CustomSource::CustomSource(QObject *_parent, const QStringList &_args)
CustomSource::~CustomSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete m_extScripts;
}

View File

@ -73,8 +73,10 @@ QString PlayerSource::getAutoMpris() const
{
QDBusMessage listServices = QDBusConnection::sessionBus().interface()->call(
QDBus::BlockWithGui, "ListNames");
if (listServices.arguments().isEmpty())
if (listServices.arguments().isEmpty()) {
qCWarning(LOG_ESS) << "Could not find any DBus service";
return "";
}
QStringList arguments = listServices.arguments().first().toStringList();
for (auto &arg : arguments) {
@ -353,7 +355,7 @@ QVariantHash PlayerSource::getPlayerMprisInfo(const QString &_mpris) const
= QVariantList({"org.mpris.MediaPlayer2.Player", "Metadata"});
QDBusMessage request = QDBusMessage::createMethodCall(
QString("org.mpris.MediaPlayer2.%1").arg(_mpris),
"/org/mpris/MediaPlayer2", "", "Get");
"/org/mpris/MediaPlayer2", "org.freedesktop.DBus.Properties", "Get");
request.setArguments(args);
QDBusMessage response
= bus.call(request, QDBus::BlockWithGui, REQUEST_TIMEOUT);

View File

@ -37,8 +37,6 @@ QuotesSource::QuotesSource(QObject *_parent, const QStringList &_args)
QuotesSource::~QuotesSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete m_extQuotes;
}

View File

@ -38,8 +38,6 @@ RequestSource::RequestSource(QObject *_parent, const QStringList &_args)
RequestSource::~RequestSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete m_extNetRequest;
}

View File

@ -37,8 +37,6 @@ UpgradeSource::UpgradeSource(QObject *_parent, const QStringList &_args)
UpgradeSource::~UpgradeSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete m_extUpgrade;
}

View File

@ -37,8 +37,6 @@ WeatherSource::WeatherSource(QObject *_parent, const QStringList &_args)
WeatherSource::~WeatherSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete m_extWeather;
}

View File

@ -28,8 +28,8 @@ Row {
// backend
property var backend
AWFormatterConfigFactory {
id: awFormatter
AWPairConfigFactory {
id: awPairConfig
}
AWTelemetryHandler {
id: awTelemetryHandler
@ -41,15 +41,21 @@ Row {
signal showMessage(string message)
QtControls.Button {
width: parent.width * 3 / 10
width: parent.width * 3 / 15
text: i18n("Edit bars")
onClicked: backend.editItem("graphicalitem")
}
QtControls.Button {
width: parent.width * 3 / 10
width: parent.width * 3 / 15
text: i18n("Formatters")
onClicked: awFormatter.showDialog(backend.dictKeys(true))
onClicked: awPairConfig.showFormatterDialog(backend.dictKeys(true))
}
QtControls.Button {
width: parent.width * 3 / 15
text: i18n("User keys")
onClicked: awPairConfig.showKeysDialog(backend.dictKeys(true))
}
QtControls.Button {

View File

@ -90,6 +90,14 @@ Item {
function insert(text) {
textArea.insert(textArea.cursorPosition, text)
}
function removeSelection() {
textArea.remove(textArea.selectionStart, textArea.selectionEnd)
}
function selectedText() {
return textArea.selectedText
}
}

View File

@ -70,6 +70,10 @@ QtObject {
"label": i18n("Network"),
"regexp": "^(netdev|(down|up(?!time)).*)"
},
{
"label": i18n("Network request"),
"regexp": "^response.*"
},
{
"label": i18n("Music player"),
"regexp": "(^|d|s)(album|artist|duration|progress|title)"
@ -97,6 +101,10 @@ QtObject {
{
"label": i18n("Functions"),
"regexp": "functions"
},
{
"label": i18n("User defined"),
"regexp": "userdefined"
}
]
property variant dpTagRegexp: [

View File

@ -31,10 +31,10 @@ QtControls.Button {
function updateText() {
// get selected text
var selected = textField.selectedText
var selected = textField.selectedText()
// remove it from widget
textField.remove(textField.selectionStart, textField.selectionEnd)
textField.removeSelection()
// insert edited text
textField.insert(textField.cursorPosition, start + selected + end)
textField.insert(start + selected + end)
}
}

View File

@ -3,7 +3,7 @@
# common QML constants
singleton general 1.0 file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/general.qml
singleton General 1.0 file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/General.qml
# custom QML UI classes
AboutTab file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AboutTab.qml

View File

@ -42,9 +42,12 @@ foreach (TEST_MODULE ${TEST_MODULES})
elseif (TEST_MODULE MATCHES "awkeycache")
set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awkeycache.cpp)
elseif (TEST_MODULE MATCHES "awkeys")
set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awactions.cpp
set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awabstractpairhelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awactions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awcustomkeyshelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awdataaggregator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awdataengineaggregator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awdataenginemapper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awdbusadaptor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awformatterhelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awkeycache.cpp
@ -55,7 +58,9 @@ foreach (TEST_MODULE ${TEST_MODULES})
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awupdatehelper.cpp
${PROJECT_TRDPARTY_DIR}/fontdialog/fontdialog.cpp)
elseif (TEST_MODULE MATCHES "awpatternfunctions")
set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awformatterhelper.cpp
set(${TEST_MODULE}_SOURCES ${${TEST_MODULE}_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awabstractpairhelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awdataenginemapper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awformatterhelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awkeysaggregator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../awesome-widget/plugin/awpatternfunctions.cpp)
elseif (TEST_MODULE MATCHES "awtelemetryhandler")

View File

@ -168,16 +168,23 @@ void TestAWKeys::test_valueByKey()
void TestAWKeys::test_dbus()
{
if (!plugin->isDBusActive())
QSKIP("No DBus session created, skip DBus test");
// get id
qlonglong id = reinterpret_cast<qlonglong>(plugin);
// create connection and message
QDBusConnection bus = QDBusConnection::sessionBus();
// check if there is active sessions first
QDBusMessage sessions = QDBusMessage::createMethodCall(
AWDBUS_SERVICE, AWDBUS_PATH, AWDBUS_SERVICE, "ActiveServicess");
QDBusMessage sessionsResponse = bus.call(sessions, QDBus::BlockWithGui);
if (sessionsResponse.arguments().isEmpty())
QSKIP("No active sessions found, skip DBus tests");
// dbus checks
QDBusMessage request = QDBusMessage::createMethodCall(
AWDBUS_SERVICE, QString("/%1").arg(id), AWDBUS_SERVICE, "WhoAmI");
QString("%1.i%2").arg(AWDBUS_SERVICE).arg(id), AWDBUS_PATH,
AWDBUS_SERVICE, "WhoAmI");
// send message to dbus
QDBusMessage response = bus.call(request, QDBus::BlockWithGui);

View File

@ -27,3 +27,8 @@ foreach (_current_PO_FILE ${_po_files})
list(APPEND _gmoFiles ${_gmoFile})
endforeach (_current_PO_FILE)
add_custom_target(aw_pofiles ALL DEPENDS ${_gmoFiles})
add_custom_target(
translations
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/extract_messages.sh
)

View File

@ -6,16 +6,16 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
"POT-Creation-Date: 2017-05-05 18:15+0300\n"
"PO-Revision-Date: 2017-05-05 18:17+0300\n"
"POT-Creation-Date: 2017-07-13 17:39+0300\n"
"PO-Revision-Date: 2017-07-13 17:51+0300\n"
"Last-Translator: Evgeniy Alekseev <esalexeev@gmail.com>\n"
"Language-Team: English <kde-russian@lists.kde.ru>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<"
"=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Lokalize 2.0\n"
msgid "Version %1 (build date %2)"
@ -328,6 +328,9 @@ msgstr "Battery active color"
msgid "Battery inactive color"
msgstr "Battery inactive color"
msgid "Edit"
msgstr "Edit"
msgid "Run %1"
msgstr "Run %1"
@ -367,9 +370,6 @@ msgstr "High GPU load"
msgid "Network device has been changed to %1"
msgstr "Network device has been changed to %1"
msgid "Edit"
msgstr "Edit"
msgid "Select type"
msgstr "Select type"
@ -553,7 +553,7 @@ msgid "Select path"
msgstr "Select path"
msgid "Images (*.png *.bpm *.jpg);;All files (*.*)"
msgstr ""
msgstr "Images (*.png *.bpm *.jpg);;All files (*.*)"
msgid "Use custom formula"
msgstr "Use custom formula"
@ -627,6 +627,9 @@ msgstr "Edit bars"
msgid "Formatters"
msgstr "Formatters"
msgid "User keys"
msgstr "User keys"
msgid "Preview"
msgstr "Preview"
@ -647,10 +650,10 @@ msgid "Acknowledgment"
msgstr "Acknowledgment"
msgid "Report a bug"
msgstr ""
msgstr "Report a bug"
msgid "Report subject"
msgstr ""
msgstr "Report subject"
msgid "Description"
msgstr "Description"
@ -694,21 +697,6 @@ msgstr "Could not save configuration file"
msgid "Select a font"
msgstr "Select a font"
msgid "Bgcolor"
msgstr "Bgcolor"
msgid "Import"
msgstr "Import"
msgid "Import plasmoid settings"
msgstr "Import plasmoid settings"
msgid "Import extensions"
msgstr "Import extensions"
msgid "Import additional files"
msgstr "Import additional files"
msgid "AC"
msgstr "AC"
@ -718,6 +706,9 @@ msgstr "Bars"
msgid "Desktops"
msgstr "Desktops"
msgid "Network request"
msgstr "Network request"
msgid "Scripts"
msgstr "Scripts"
@ -736,6 +727,9 @@ msgstr "Weathers"
msgid "Functions"
msgstr "Functions"
msgid "User defined"
msgstr "User defined"
msgid "All"
msgstr "All"
@ -766,457 +760,17 @@ msgstr "raised"
msgid "sunken"
msgstr "sunken"
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Evgeniy Alekseev"
msgid "Bgcolor"
msgstr "Bgcolor"
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "esalexeev@gmail.com"
msgid "Import"
msgstr "Import"
#~ msgid "Edit scripts"
#~ msgstr "Edit scripts"
msgid "Import plasmoid settings"
msgstr "Import plasmoid settings"
#~ msgid "Edit tickers"
#~ msgstr "Edit tickers"
msgid "Import extensions"
msgstr "Import extensions"
#~ msgid "Edit command"
#~ msgstr "Edit command"
#~ msgid "Edit weather"
#~ msgstr "Edit weather"
#~ msgid "Use image for active"
#~ msgstr "Use image for active"
#~ msgid "Active color"
#~ msgstr "Active color"
#~ msgid "Use image for inactive"
#~ msgstr "Use image for inactive"
#~ msgid "Inactive color"
#~ msgstr "Inactive color"
#~ msgid "Add lambda"
#~ msgstr "Add lambda"
#~ msgid "Free space on %1 less than 10%"
#~ msgstr "Free space on %1 less than 10%"
#~ msgid "Top Edge"
#~ msgstr "Top Edge"
#~ msgid "Bottom Edge"
#~ msgstr "Bottom Edge"
#~ msgid "Left Edge"
#~ msgstr "Left Edge"
#~ msgid "Right Edge"
#~ msgstr "Right Edge"
#~ msgid "Unknown location (%1)"
#~ msgstr "Unknown location (%1)"
#~ msgid "Ticker: %1"
#~ msgstr "Ticker: %1"
#~ msgid "Exec: %1"
#~ msgstr "Exec: %1"
#~ msgid "Run ksysguard"
#~ msgstr "Run ksysguard"
#~ msgid "Update text"
#~ msgstr "Update text"
#~ msgid "Check for updates"
#~ msgstr "Check for updates"
#~ msgid "Enable popup on mouse click"
#~ msgstr "Enable popup on mouse click"
#~ msgid ""
#~ "$dddd - long weekday\n"
#~ "$ddd - short weekday\n"
#~ "$dd - day\n"
#~ "$d - day w\\o zero\n"
#~ "$MMMM - long month\n"
#~ "$MMM - short month\n"
#~ "$MM - month\n"
#~ "$M - month w\\o zero\n"
#~ "$yyyy - year\n"
#~ "$yy - short year\n"
#~ "$hh - hours (24 only)\n"
#~ "$h - hours w\\o zero (24 only)\n"
#~ "$mm - minutes\n"
#~ "$m - minutes w\\o zero\n"
#~ "$ss - seconds\n"
#~ "$s - seconds w\\o zero"
#~ msgstr ""
#~ "$dddd - long weekday\n"
#~ "$ddd - short weekday\n"
#~ "$dd - day\n"
#~ "$d - day w\\o zero\n"
#~ "$MMMM - long month\n"
#~ "$MMM - short month\n"
#~ "$MM - month\n"
#~ "$M - month w\\o zero\n"
#~ "$yyyy - year\n"
#~ "$yy - short year\n"
#~ "$hh - hours (24 only)\n"
#~ "$h - hours w\\o zero (24 only)\n"
#~ "$mm - minutes\n"
#~ "$m - minutes w\\o zero\n"
#~ "$ss - seconds\n"
#~ "$s - seconds w\\o zero"
#~ msgid ""
#~ "$dd - uptime days\n"
#~ "$d - uptime days without zero\n"
#~ "$hh - uptime hours\n"
#~ "$h - uptime hours without zero\n"
#~ "$mm - uptime minutes\n"
#~ "$m - uptime minutes without zero"
#~ msgstr ""
#~ "$dd - uptime days\n"
#~ "$d - uptime days without zero\n"
#~ "$hh - uptime hours\n"
#~ "$h - uptime hours without zero\n"
#~ "$mm - uptime minutes\n"
#~ "$m - uptime minutes without zero"
#~ msgid "Temperature devices"
#~ msgstr "Temperature devices"
#~ msgid "Editable"
#~ msgstr "Editable"
#~ msgid "Fan devices"
#~ msgstr "Fan devices"
#~ msgid "Mount points"
#~ msgstr "Mount points"
#~ msgid "HDD devices (speed)"
#~ msgstr "HDD (speed)"
#~ msgid "HDD devices (temp)"
#~ msgstr "HDD (temp)"
#~ msgid "Disable auto select device and set specified device"
#~ msgstr "Disable auto select device and set specified device"
#~ msgid "Set network device"
#~ msgstr "Set network device"
#~ msgid "Line, which returns when AC is online"
#~ msgstr "Line, which returns when AC is online"
#~ msgid "Line, which returns when AC is offline"
#~ msgstr "Line, which returns when AC is offline"
#~ msgid "\"/sys/class/power_supply/\" by default"
#~ msgstr "\"/sys/class/power_supply/\" by default"
#~ msgid "<b>NOTE:</b> Player DBus interface should be an active"
#~ msgstr "<b>NOTE:</b> Player DBus interface should be an active"
#~ msgid "Configuration"
#~ msgstr "Configuration"
#~ msgid "Ctrl+B"
#~ msgstr "Ctrl+B"
#~ msgid "Ctrl+I"
#~ msgstr "Ctrl+I"
#~ msgid "Ctrl+U"
#~ msgstr "Ctrl+U"
#~ msgid "Null lines"
#~ msgstr "Null lines"
#~ msgid "Desktop check cmd"
#~ msgstr "Desktop check cmd"
#~ msgid "Battery device"
#~ msgstr "Battery device"
#~ msgid "\"/sys/class/power_supply/BAT0/capacity\" by default"
#~ msgstr "\"/sys/class/power_supply/BAT0/capacity\" by default"
#~ msgid "Add stretch to left/top of the layout"
#~ msgstr "Add stretch to left/top of the layout"
#~ msgid "Add stretch to right/bottom of the layout"
#~ msgstr "Add stretch to right/bottom of the layout"
#~ msgid "Appearance configuration"
#~ msgstr "Appearance configuration"
#~ msgid "Widget configuration"
#~ msgstr "Widget configuration"
#~ msgid "\"/sys/class/net\" by default"
#~ msgstr "\"/sys/class/net\" by default"
#~ msgid "Custom command to run"
#~ msgstr "Custom command to run"
#~ msgid ""
#~ "$time - time in default format\n"
#~ "$isotime - time in ISO format\n"
#~ "$shorttime - time in short format\n"
#~ "$longtime - time in log format\n"
#~ "$custom - custom time format"
#~ msgstr ""
#~ "$time - time in default format\n"
#~ "$isotime - time in ISO format\n"
#~ "$shorttime - time in short format\n"
#~ "$longtime - time in log format\n"
#~ "$custom - custom time format"
#~ msgid "Uptime"
#~ msgstr "Uptime"
#~ msgid ""
#~ "$uptime - system uptime\n"
#~ "$custom - custom format"
#~ msgstr ""
#~ "$uptime - system uptime\n"
#~ "$custom - custom format"
#~ msgid ""
#~ "$cpu - total load CPU, %\n"
#~ "$cpu0 - load CPU for core 0, %\n"
#~ "...\n"
#~ "$cpu9 - load CPU for core 9, %\n"
#~ "...\n"
#~ "$cpuN - load CPU for core N, %"
#~ msgstr ""
#~ "$cpu - total load CPU, %\n"
#~ "$cpu0 - load CPU for core 0, %\n"
#~ "...\n"
#~ "$cpu9 - load CPU for core 9, %\n"
#~ "...\n"
#~ "$cpuN - load CPU for core N, %"
#~ msgid ""
#~ "$cpucl - average CPU clock, MHz\n"
#~ "$cpucl0 - CPU clock for core 0, MHz\n"
#~ "...\n"
#~ "$cpucl9 - CPU clock for core 9, MHz\n"
#~ "...\n"
#~ "$cpuclN - CPU clock for core N, MHz"
#~ msgstr ""
#~ "$cpucl - average CPU clock, MHz\n"
#~ "$cpucl0 - CPU clock for core 0, MHz\n"
#~ "...\n"
#~ "$cpucl9 - CPU clock for core 9, MHz\n"
#~ "...\n"
#~ "$cpuclN - CPU clock for core N, MHz"
#~ msgid "$tempN - physical temperature on device N (from 0). Example: $temp0"
#~ msgstr "$tempN - physical temperature on device N (from 0). Example: $temp0"
#~ msgid "$gpu - gpu usage, %"
#~ msgstr "$gpu - gpu usage, %"
#~ msgid "GPU Temp"
#~ msgstr "GPU Temp"
#~ msgid "$gputemp - physical temperature on GPU"
#~ msgstr "$gputemp - physical temperature on GPU"
#~ msgid ""
#~ "$mem - RAM usage, %\n"
#~ "$memmb - RAM usage, MB\n"
#~ "$memgb - RAM usage, GB\n"
#~ "$memtotmb - total RAM, MB\n"
#~ "$memtotgb - total RAM, GB"
#~ msgstr ""
#~ "$mem - RAM usage, %\n"
#~ "$memmb - RAM usage, MB\n"
#~ "$memgb - RAM usage, GB\n"
#~ "$memtotmb - total RAM, MB\n"
#~ "$memtotgb - total RAM, GB"
#~ msgid ""
#~ "$swap - swap usage, %\n"
#~ "$swapmb - swap usage, MB\n"
#~ "$swapgb - swap usage, GB\n"
#~ "$swaptotmb - total swap, MB\n"
#~ "$swaptotgb - total swap, GB"
#~ msgstr ""
#~ "$swap - swap usage, %\n"
#~ "$swapmb - swap usage, MB\n"
#~ "$swapgb - swap usage, GB\n"
#~ "$swaptotmb - total swap, MB\n"
#~ "$swaptotgb - total swap, GB"
#~ msgid ""
#~ "$hddN - usage for mount point N (from 0), %. Example: $hdd0\n"
#~ "$hddmbN - usage for mount point N (from 0), MB. Example: $hddmb0\n"
#~ "$hddgbN - usage for mount point N (from 0), GB. Example: $hddgb0\n"
#~ "$hddtotmbN - total size of mount point N (from 0), MB. Example: "
#~ "$hddtotmb0\n"
#~ "$hddtotgbN - total size of mount point N (from 0), GB. Example: $hddtotgb0"
#~ msgstr ""
#~ "$hddN - usage for mount point N (from 0), %. Example: $hdd0\n"
#~ "$hddmbN - usage for mount point N (from 0), MB. Example: $hddmb0\n"
#~ "$hddgbN - usage for mount point N (from 0), GB. Example: $hddgb0\n"
#~ "$hddtotmbN - total size of mount point N (from 0), MB. Example: "
#~ "$hddtotmb0\n"
#~ "$hddtotgbN - total size of mount point N (from 0), GB. Example: $hddtotgb0"
#~ msgid "HDD speed"
#~ msgstr "HDD speed"
#~ msgid ""
#~ "$hddrN - read speed HDD N (from 0), KB/s. Example: $hddr0\n"
#~ "$hddwN - write speed HDD N (from 0), KB/s. Example: $hddw0"
#~ msgstr ""
#~ "$hddrN - read speed HDD N (from 0), KB/s. Example: $hddr0\n"
#~ "$hddwN - write speed HDD N (from 0), KB/s. Example: $hddw0"
#~ msgid "HDD temp"
#~ msgstr "HDD temp"
#~ msgid ""
#~ "$hddtempN - physical temperature on device N (from 0). Example: $hddtemp0"
#~ msgstr ""
#~ "$hddtempN - physical temperature on device N (from 0). Example: $hddtemp0"
#~ msgid ""
#~ "$down - download speed, KB/s\n"
#~ "$up - upload speed, KB/s\n"
#~ "$netdev - current network device"
#~ msgstr ""
#~ "$down - download speed, KB/s\n"
#~ "$up - upload speed, KB/s\n"
#~ "$netdev - current network device"
#~ msgid ""
#~ "$bat - battery charge, %\n"
#~ "$ac - AC status"
#~ msgstr ""
#~ "$bat - battery charge, %\n"
#~ "$ac - AC status"
#~ msgid ""
#~ "$album - song album\n"
#~ "$artist - song artist\n"
#~ "$progress - song progress\n"
#~ "$time - song duration\n"
#~ "$title - song title"
#~ msgstr ""
#~ "$album - song album\n"
#~ "$artist - song artist\n"
#~ "$progress - song progress\n"
#~ "$time - song duration\n"
#~ "$title - song title"
#~ msgid "Processes"
#~ msgstr "Processes"
#~ msgid ""
#~ "$pscount - number of running processes\n"
#~ "$pstotal - total number of running processes\n"
#~ "$ps - list of running processes comma separated"
#~ msgstr ""
#~ "$pscount - number of running processes\n"
#~ "$pstotal - total number of running processes\n"
#~ "$ps - list of running processes comma separated"
#~ msgid ""
#~ "$pkgcountN - number of packages which are available for updates, command "
#~ "N. For example $pkgcount0"
#~ msgstr ""
#~ "$pkgcountN - number of packages which are available for updates, command "
#~ "N. For example $pkgcount0"
#~ msgid ""
#~ "$customN - get output from custom command N (from N). Example `$custom0`"
#~ msgstr ""
#~ "$customN - get output from custom command N (from N). Example `$custom0`"
#~ msgid ""
#~ "$name - desktop name\n"
#~ "$number - desktop number\n"
#~ "$total - total number of desktops"
#~ msgstr ""
#~ "$name - desktop name\n"
#~ "$number - desktop number\n"
#~ "$total - total number of desktops"
#~ msgid "pacman -Qu"
#~ msgstr "pacman -Qu"
#~ msgid "apt-show-versions -u -b"
#~ msgstr "apt-show-versions -u -b"
#~ msgid "aptitude search '~U'"
#~ msgstr "aptitude search '~U'"
#~ msgid "yum list updates"
#~ msgstr "yum list updates"
#~ msgid "pkg_version -I -l '<'"
#~ msgstr "pkg_version -I -l '<'"
#~ msgid "urpmq --auto-select"
#~ msgstr "urpmq --auto-select"
#~ msgid "amarok"
#~ msgstr "amarok"
#~ msgid "mpd"
#~ msgstr "mpd"
#~ msgid "qmmp"
#~ msgstr "qmmp"
#~ msgid "auto"
#~ msgstr "auto"
#~ msgid "nvidia"
#~ msgstr "nvidia"
#~ msgid "ati"
#~ msgstr "ati"
#~ msgid "$hddN - usage for mount point N (from 0), %. Example: $hdd0"
#~ msgstr "$hddN - usage for mount point N (from 0), %. Example: $hdd0"
#~ msgid ""
#~ "$ds - uptime days\n"
#~ "$hs - uptime hours\n"
#~ "$ms - uptime minutes"
#~ msgstr ""
#~ "$ds - uptime days\n"
#~ "$hs - uptime hours\n"
#~ "$ms - uptime minutes"
#~ msgid ""
#~ "Command to run, example:\n"
#~ "wget -qO- http://ifconfig.me/ip - get external IP"
#~ msgstr ""
#~ "Command to run, example:\n"
#~ "wget -qO- http://ifconfig.me/ip - get external IP"
#~ msgid "@@/;@@ - mount point usage, %"
#~ msgstr "@@/;@@ - mount point usage, %"
#~ msgid "@@/dev/sda@@ - physical temperature on /dev/sda"
#~ msgstr "@@/dev/sda@@ - physical temperature on /dev/sda"
#~ msgid ""
#~ "$net - network speed, down/up, KB/s\n"
#~ "$netdev - current network device\n"
#~ "@@eth0@@ - disable auto select device and set specified device"
#~ msgstr ""
#~ "$net - network speed, down/up, KB/s\n"
#~ "$netdev - current network device\n"
#~ "@@eth0@@ - disable auto select device and set specified device"
msgid "Import additional files"
msgstr "Import additional files"

View File

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Awesome widgets\n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
"POT-Creation-Date: 2017-05-05 18:15+0300\n"
"POT-Creation-Date: 2017-07-13 17:39+0300\n"
"PO-Revision-Date: 2016-08-03 15:30+0000\n"
"Last-Translator: Ernesto Avilés Vázquez <whippiii@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/arcanis/awesome-widgets/"
@ -338,6 +338,9 @@ msgstr "Color de la batería activa"
msgid "Battery inactive color"
msgstr "Color de la batería inactiva"
msgid "Edit"
msgstr "Editar"
msgid "Run %1"
msgstr "Ejecutar %1"
@ -377,9 +380,6 @@ msgstr "Carga alta de GPU"
msgid "Network device has been changed to %1"
msgstr "El dispositivo de red ha sido cambiado a %1"
msgid "Edit"
msgstr "Editar"
msgid "Select type"
msgstr "Elegir tipo"
@ -639,6 +639,9 @@ msgstr "Editar barras"
msgid "Formatters"
msgstr "Formateadores"
msgid "User keys"
msgstr ""
msgid "Preview"
msgstr "Vista previa"
@ -708,21 +711,6 @@ msgstr "No se pudo guardar el archivo de configuración"
msgid "Select a font"
msgstr "Elige un tipo de letra"
msgid "Bgcolor"
msgstr "Color de fondo"
msgid "Import"
msgstr "Importar"
msgid "Import plasmoid settings"
msgstr "Importar configuraciones de plasmoide"
msgid "Import extensions"
msgstr "Extensiones a importar"
msgid "Import additional files"
msgstr "Importar archivos adicionales"
msgid "AC"
msgstr "CA"
@ -732,6 +720,10 @@ msgstr "Barras"
msgid "Desktops"
msgstr "Escritorios"
#, fuzzy
msgid "Network request"
msgstr "Red"
msgid "Scripts"
msgstr "Guiones"
@ -750,6 +742,9 @@ msgstr "Tiempo"
msgid "Functions"
msgstr "Funciones"
msgid "User defined"
msgstr ""
msgid "All"
msgstr ""
@ -781,22 +776,17 @@ msgstr ""
msgid "sunken"
msgstr ""
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Tu nombre"
msgid "Bgcolor"
msgstr "Color de fondo"
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "Tu correo electrónico"
msgid "Import"
msgstr "Importar"
#~ msgid "Edit scripts"
#~ msgstr "Editar scripts"
msgid "Import plasmoid settings"
msgstr "Importar configuraciones de plasmoide"
#~ msgid "Edit tickers"
#~ msgstr "Editar tickets"
msgid "Import extensions"
msgstr "Extensiones a importar"
#~ msgid "Edit command"
#~ msgstr "Editar orden"
#~ msgid "Edit weather"
#~ msgstr "Editar tiempo"
msgid "Import additional files"
msgstr "Importar archivos adicionales"

View File

@ -1,27 +1,31 @@
#!/bin/bash
# root of translatable sources
BASEDIR="../"
# properties
PROJECT="awesome-widgets"
BUGADDR="https://github.com/arcan1s/awesome-widgets/issues"
WORKDIR=$(pwd)
# root of translatable sources
SCRIPTDIR="$(dirname -- $(readlink -f -- $0))"
BASEDIR="${SCRIPTDIR}/../"
WORKDIR="$(pwd)"
# translations tags
# dunno what does this magic do actually
TAGS="-ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 -kI18N_NOOP:1 \
-kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3"
find "${BASEDIR}" -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' | sort > "${WORKDIR}/rcfiles.list"
xargs --arg-file="${WORKDIR}/rcfiles.list" > "${WORKDIR}/rc.cpp"
echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> "${WORKDIR}/rc.cpp"
echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> "${WORKDIR}/rc.cpp"
find "${BASEDIR}" -name '*.cpp' -o -name '*.h' -o -name '*.qml' | sort > "${WORKDIR}/infiles.list"
echo "rc.cpp" >> "${WORKDIR}/infiles.list"
find "${BASEDIR}" \
-name '*.cpp' -o -name '*.h' -o -name '*.qml' -o -name '*.ui' -o -name '*.rc' | \
sort > "${WORKDIR}/infiles.list"
xgettext -C --no-location --msgid-bugs-address="${BUGADDR}" ${TAGS} \
--files-from="infiles.list" -D "${BASEDIR}" -D "${WORKDIR}" -o "${PROJECT}.pot" || exit 1
--files-from="${WORKDIR}/infiles.list" -D "${BASEDIR}" -D "${WORKDIR}" \
-o "${PROJECT}.pot" || exit 1
TRANSLATIONS=$(find . -name '*.po')
TRANSLATIONS=$(find "${BASEDIR}" -name '*.po')
for TR in ${TRANSLATIONS}; do
msgmerge -U -q --backup=off "${TR}" "${PROJECT}.pot"
msgmerge -U -q --backup=off "${TR}" "${WORKDIR}/${PROJECT}.pot"
msgattrib --no-obsolete -o "${TR}" "${TR}"
done
rm -f "rcfiles.list" "infiles.list" "rc.cpp"
rm -f "${WORKDIR}/infiles.list"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
"POT-Creation-Date: 2017-05-05 18:15+0300\n"
"POT-Creation-Date: 2017-07-13 17:39+0300\n"
"PO-Revision-Date: 2015-07-31 22:16+0300\n"
"Last-Translator: Evgeniy Alekseev <esalexeev@gmail.com>\n"
"Language-Team: French <kde-russian@lists.kde.ru>\n"
@ -346,6 +346,10 @@ msgstr "Couleur active batterie"
msgid "Battery inactive color"
msgstr "Couleur batterie inactive"
#, fuzzy
msgid "Edit"
msgstr "Modifiable"
msgid "Run %1"
msgstr "Éxecuter %1"
@ -385,10 +389,6 @@ msgstr "Haute charge GPU"
msgid "Network device has been changed to %1"
msgstr "L'interface réseau à été changée en %1"
#, fuzzy
msgid "Edit"
msgstr "Modifiable"
#, fuzzy
msgid "Select type"
msgstr "Sélectionner l'étiquette"
@ -667,6 +667,9 @@ msgstr "Modifier les barres"
msgid "Formatters"
msgstr ""
msgid "User keys"
msgstr ""
msgid "Preview"
msgstr ""
@ -735,22 +738,6 @@ msgstr ""
msgid "Select a font"
msgstr "Sélectionner une police"
#, fuzzy
msgid "Bgcolor"
msgstr "Couleur processeur"
msgid "Import"
msgstr ""
msgid "Import plasmoid settings"
msgstr ""
msgid "Import extensions"
msgstr ""
msgid "Import additional files"
msgstr ""
msgid "AC"
msgstr ""
@ -760,6 +747,10 @@ msgstr ""
msgid "Desktops"
msgstr ""
#, fuzzy
msgid "Network request"
msgstr "Voisinage réseau"
#, fuzzy
msgid "Scripts"
msgstr "Modifier les scripts"
@ -782,6 +773,9 @@ msgstr "Modifier les tickers"
msgid "Functions"
msgstr ""
msgid "User defined"
msgstr ""
msgid "All"
msgstr ""
@ -813,431 +807,18 @@ msgstr ""
msgid "sunken"
msgstr ""
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Evgeniy Alekseev MerMouY"
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "esalexeev@gmail.com mermouy@gmail.com"
#~ msgid "Edit scripts"
#~ msgstr "Modifier les scripts"
#~ msgid "Edit tickers"
#~ msgstr "Modifier les tickers"
#~ msgid "Edit command"
#~ msgstr "Modifier la commande"
#, fuzzy
#~ msgid "Edit weather"
#~ msgstr "Modifier les tickers"
msgid "Bgcolor"
msgstr "Couleur processeur"
#, fuzzy
#~ msgid "Active color"
#~ msgstr "Batterie"
msgid "Import"
msgstr ""
#, fuzzy
#~ msgid "Inactive color"
#~ msgstr "Batterie"
msgid "Import plasmoid settings"
msgstr ""
#~ msgid "Free space on %1 less than 10%"
#~ msgstr "Espace libre sur %1 inférieur à 10%"
msgid "Import extensions"
msgstr ""
#~ msgid "Top Edge"
#~ msgstr "Bord du haut"
#~ msgid "Bottom Edge"
#~ msgstr "Bord du bas"
#~ msgid "Left Edge"
#~ msgstr "Bord gauche"
#~ msgid "Right Edge"
#~ msgstr "Bord droit"
#~ msgid "Unknown location (%1)"
#~ msgstr "Position inconnue (%1)"
#~ msgid "Exec: %1"
#~ msgstr "Exec: %1"
#~ msgid "Run ksysguard"
#~ msgstr "Lancer ksysguard"
#~ msgid "Update text"
#~ msgstr "Mettre à jour le texte"
#~ msgid "Enable popup on mouse click"
#~ msgstr "Popup lors d'un click souris"
#~ msgid ""
#~ "$dddd - long weekday\n"
#~ "$ddd - short weekday\n"
#~ "$dd - day\n"
#~ "$d - day w\\o zero\n"
#~ "$MMMM - long month\n"
#~ "$MMM - short month\n"
#~ "$MM - month\n"
#~ "$M - month w\\o zero\n"
#~ "$yyyy - year\n"
#~ "$yy - short year\n"
#~ "$hh - hours (24 only)\n"
#~ "$h - hours w\\o zero (24 only)\n"
#~ "$mm - minutes\n"
#~ "$m - minutes w\\o zero\n"
#~ "$ss - seconds\n"
#~ "$s - seconds w\\o zero"
#~ msgstr ""
#~ "$dddd - Jour de la semaine long\n"
#~ "$ddd - Jour de la semaine court\n"
#~ "$dd - jour\n"
#~ "$d - jour sans zéro\n"
#~ "$MMMM - mois long\n"
#~ "$MMM - mois court\n"
#~ "$MM - mois\n"
#~ "$M - mois sans zéro\n"
#~ "$yyyy - année\n"
#~ "$yy - année courte\n"
#~ "$hh - heures (24 uniquement)\n"
#~ "$h - heures sans zéro (24 uniquement)\n"
#~ "$mm - minutes\n"
#~ "$m - minutes sans zéro\n"
#~ "$ss - secondes\n"
#~ "$s - secondes sans zéro"
#~ msgid ""
#~ "$dd - uptime days\n"
#~ "$d - uptime days without zero\n"
#~ "$hh - uptime hours\n"
#~ "$h - uptime hours without zero\n"
#~ "$mm - uptime minutes\n"
#~ "$m - uptime minutes without zero"
#~ msgstr ""
#~ "$dd - temps de fonctionnement en jours\n"
#~ "$d - temps de fonctionnement en jours sans zéro\n"
#~ "$hh - temps de fonctionnement en heures\n"
#~ "$h - temps de fonctionnement en heures sans zéro\n"
#~ "$mm - temps de fonctionnement en minutes\n"
#~ "$m - temps de fonctionnement en minutes sans zéro"
#~ msgid "Temperature devices"
#~ msgstr "Temperature des périphériques"
#~ msgid "Editable"
#~ msgstr "Modifiable"
#, fuzzy
#~ msgid "Fan devices"
#~ msgstr "Périphérique d'alimentation"
#~ msgid "Mount points"
#~ msgstr "Points de montage"
#~ msgid "HDD devices (speed)"
#~ msgstr "Périphériques HDD (la vitesse)"
#~ msgid "HDD devices (temp)"
#~ msgstr "Périphériques HDD (température)"
#~ msgid "Disable auto select device and set specified device"
#~ msgstr ""
#~ "Désactiver la sélection automatique de périphériques et le sélectionner "
#~ "manuellement"
#~ msgid "Set network device"
#~ msgstr "Sélectionner le périphérique réseau"
#~ msgid "Line, which returns when AC is online"
#~ msgstr "Ligne qui est renvoyée lorsque l'alimentation est branchée"
#~ msgid "Line, which returns when AC is offline"
#~ msgstr "Ligne, qui est renvoyée lorsque l'alimentation est débranchée"
#, fuzzy
#~ msgid "\"/sys/class/power_supply/\" by default"
#~ msgstr "\"/sys/class/power_supply/AC/online\" par défaut"
#~ msgid "Ctrl+B"
#~ msgstr "Ctrl+B"
#~ msgid "Ctrl+I"
#~ msgstr "Ctrl+I"
#~ msgid "Ctrl+U"
#~ msgstr "Ctrl+U"
#~ msgid "Null lines"
#~ msgstr "Nombre d'éléments pour les conseils"
#~ msgid "Battery device"
#~ msgstr "Batterie"
#~ msgid "\"/sys/class/power_supply/BAT0/capacity\" by default"
#~ msgstr "\"/sys/class/power_supply/BAT0/capacity\" par défaut"
#~ msgid "Add stretch to left/top of the layout"
#~ msgstr "Étirer le positionnement vers haut/gauche"
#~ msgid "Add stretch to right/bottom of the layout"
#~ msgstr "Étirer le positionnement vers bas/droite"
#~ msgid "\"/sys/class/net\" by default"
#~ msgstr "\"/sys/class/net\" par défaut"
#~ msgid "Custom command to run"
#~ msgstr "Commande personnalisée à exécuter"
#~ msgid ""
#~ "$time - time in default format\n"
#~ "$isotime - time in ISO format\n"
#~ "$shorttime - time in short format\n"
#~ "$longtime - time in log format\n"
#~ "$custom - custom time format"
#~ msgstr ""
#~ "$time - l'heure au format par défaut\n"
#~ "$isotime - l'heure au format ISO\n"
#~ "$shorttime - l'heure format court\n"
#~ "$longtime - l'heure au format log\n"
#~ "$custom - l'heure, format personnalisé"
#~ msgid "Uptime"
#~ msgstr "temps de fonctionnement"
#~ msgid ""
#~ "$uptime - system uptime\n"
#~ "$custom - custom format"
#~ msgstr ""
#~ "$uptime - temps de fonctionnement\n"
#~ "$custom - format personnalisé"
#~ msgid ""
#~ "$cpu - total load CPU, %\n"
#~ "$cpu0 - load CPU for core 0, %\n"
#~ "...\n"
#~ "$cpu9 - load CPU for core 9, %\n"
#~ "...\n"
#~ "$cpuN - load CPU for core N, %"
#~ msgstr ""
#~ "$cpu - charge totale du processeur, %\n"
#~ "$cpu0 - charge du processeur pour le coeur 0, %\n"
#~ "...\n"
#~ "$cpuN - charge processeur pour le coeur N, %"
#~ msgid ""
#~ "$cpucl - average CPU clock, MHz\n"
#~ "$cpucl0 - CPU clock for core 0, MHz\n"
#~ "...\n"
#~ "$cpucl9 - CPU clock for core 9, MHz\n"
#~ "...\n"
#~ "$cpuclN - CPU clock for core N, MHz"
#~ msgstr ""
#~ "$cpucl - Moyenne de l'horloge du processeur, MHz\n"
#~ "$cpucl0 - Horloge du coeur 0, MHz\n"
#~ "...\n"
#~ "$cpuclN - Horloge du coeur N, MHz"
#~ msgid "$tempN - physical temperature on device N (from 0). Example: $temp0"
#~ msgstr ""
#~ "$tempN - Température physique du périphérique N (à partir de 0). Exemple: "
#~ "$temp0"
#~ msgid "$gpu - gpu usage, %"
#~ msgstr "$gpu - utilisation du processeur graphique, %"
#~ msgid "GPU Temp"
#~ msgstr "Temp du processeur graphique"
#~ msgid "$gputemp - physical temperature on GPU"
#~ msgstr "$gputemp - Température physique du processeur graphique"
#~ msgid ""
#~ "$mem - RAM usage, %\n"
#~ "$memmb - RAM usage, MB\n"
#~ "$memgb - RAM usage, GB\n"
#~ "$memtotmb - total RAM, MB\n"
#~ "$memtotgb - total RAM, GB"
#~ msgstr ""
#~ "$mem - utilisation de la RAM, %\n"
#~ "$memmb - utilisation de la RAM, MB\n"
#~ "$memgb - utilisation de la RAM, GB\n"
#~ "$memtotmb - RAM, MB\n"
#~ "$memtotgb - RAM, GB"
#~ msgid ""
#~ "$swap - swap usage, %\n"
#~ "$swapmb - swap usage, MB\n"
#~ "$swapgb - swap usage, GB\n"
#~ "$swaptotmb - total swap, MB\n"
#~ "$swaptotgb - total swap, GB"
#~ msgstr ""
#~ "$swap - utilisation swap, %\n"
#~ "$swapmb - utilisation swap, MB\n"
#~ "$swapgb - utilisation swap, MB\n"
#~ "$swaptotmb - swap, MB\n"
#~ "$swaptotgb - swap, GB"
#~ msgid ""
#~ "$hddN - usage for mount point N (from 0), %. Example: $hdd0\n"
#~ "$hddmbN - usage for mount point N (from 0), MB. Example: $hddmb0\n"
#~ "$hddgbN - usage for mount point N (from 0), GB. Example: $hddgb0\n"
#~ "$hddtotmbN - total size of mount point N (from 0), MB. Example: "
#~ "$hddtotmb0\n"
#~ "$hddtotgbN - total size of mount point N (from 0), GB. Example: $hddtotgb0"
#~ msgstr ""
#~ "$hddN - utilisation du point de montage N (à partir de 0), %. Exemple: "
#~ "$hdd0\n"
#~ "$hddmbN - utilisation du point de montage N (à partir de 0), MB. Exemple: "
#~ "$hddmb0\n"
#~ "$hddgbN - utilisation du point de montage N (à partir de 0), GB. Exemple: "
#~ "$hddgb0\n"
#~ "$hddtotmbN - taille totale de point de montage N (à partir de 0), MB. "
#~ "Exemple: $hddtotmb0\n"
#~ "$hddtotgbN - taille totale de point de montage N (à partir de 0), GB. "
#~ "Exemple: $hddtotgb0"
#~ msgid "HDD speed"
#~ msgstr "Vitesse HDD"
#~ msgid ""
#~ "$hddrN - read speed HDD N (from 0), KB/s. Example: $hddr0\n"
#~ "$hddwN - write speed HDD N (from 0), KB/s. Example: $hddw0"
#~ msgstr ""
#~ "$hddrN - vitesse de lecture HDD N (à partir de 0), KB/s. Exemple: $hddr0\n"
#~ "$hddwN - vitesse d'écriture HDD N (à partir de 0), KB/s. Exemple: $hddw0"
#~ msgid "HDD temp"
#~ msgstr "Température HDD"
#~ msgid ""
#~ "$hddtempN - physical temperature on device N (from 0). Example: $hddtemp0"
#~ msgstr ""
#~ "$hddtempN - température physique du périphérique N (à partir de 0). "
#~ "Exemple: $hddtemp0"
#~ msgid ""
#~ "$down - download speed, KB/s\n"
#~ "$up - upload speed, KB/s\n"
#~ "$netdev - current network device"
#~ msgstr ""
#~ "$down - vitesse de téléchargement, KB/s\n"
#~ "$up - vitesse ascendante, KB/s\n"
#~ "$netdev - périphérique réseau actuel"
#~ msgid ""
#~ "$bat - battery charge, %\n"
#~ "$ac - AC status"
#~ msgstr ""
#~ "$bat - charge de la batterie, %\n"
#~ "$ac - état de l'alimentation"
#~ msgid ""
#~ "$album - song album\n"
#~ "$artist - song artist\n"
#~ "$progress - song progress\n"
#~ "$time - song duration\n"
#~ "$title - song title"
#~ msgstr ""
#~ "$album - album du morceau\n"
#~ "$artist - artiste du morceau\n"
#~ "$progress - avancement du morceau\n"
#~ "$time - durée du morceau\n"
#~ "$title - titre du morceau"
#~ msgid "Processes"
#~ msgstr "Processus"
#~ msgid ""
#~ "$pscount - number of running processes\n"
#~ "$pstotal - total number of running processes\n"
#~ "$ps - list of running processes comma separated"
#~ msgstr ""
#~ "$pscount - nombre de processus actifs\n"
#~ "$pstotal - nombre total de processus actifs\n"
#~ "$ps - liste des processus actifs séparés par une virgule"
#~ msgid ""
#~ "$pkgcountN - number of packages which are available for updates, command "
#~ "N. For example $pkgcount0"
#~ msgstr ""
#~ "$pkgcountN - nombre de paquets à mettre à jour, commande N. Par exemple "
#~ "$pkgcount0"
#~ msgid ""
#~ "$customN - get output from custom command N (from N). Example `$custom0`"
#~ msgstr ""
#~ "$customN - sortie d'une commande personnelle N (à partir de 0). Exemple: "
#~ "$custom0"
#~ msgid "pacman -Qu"
#~ msgstr "pacman -Qu"
#~ msgid "apt-show-versions -u -b"
#~ msgstr "apt-show-versions -u -b"
#~ msgid "aptitude search '~U'"
#~ msgstr "aptitude search '~U'"
#~ msgid "yum list updates"
#~ msgstr "yum list updates"
#~ msgid "pkg_version -I -l '<'"
#~ msgstr "pkg_version -I -l '<'"
#~ msgid "urpmq --auto-select"
#~ msgstr "urpmq --auto-select"
#~ msgid "$hddN - usage for mount point N (from 0), %. Example: $hdd0"
#~ msgstr ""
#~ "$hddN - espace occupé sur le point de montage N (à partir de 0), %. "
#~ "Exemple: $hdd0"
#~ msgid "amarok"
#~ msgstr "amarok"
#~ msgid "mpd"
#~ msgstr "mpd"
#~ msgid "qmmp"
#~ msgstr "qmmp"
#~ msgid "auto"
#~ msgstr "auto"
#~ msgid "nvidia"
#~ msgstr "nvidia"
#~ msgid "ati"
#~ msgstr "ati"
#~ msgid ""
#~ "$ds - uptime days\n"
#~ "$hs - uptime hours\n"
#~ "$ms - uptime minutes"
#~ msgstr ""
#~ "$ds - uptime days\n"
#~ "$hs - uptime hours\n"
#~ "$ms - uptime minutes"
#~ msgid ""
#~ "Command to run, example:\n"
#~ "wget -qO- http://ifconfig.me/ip - get external IP"
#~ msgstr ""
#~ "Command to run, example:\n"
#~ "wget -qO- http://ifconfig.me/ip - get external IP"
#~ msgid "@@/;@@ - mount point usage, %"
#~ msgstr "@@/;@@ - mount point usage, %"
#~ msgid "@@/dev/sda@@ - physical temperature on /dev/sda"
#~ msgstr "@@/dev/sda@@ - physical temperature on /dev/sda"
#~ msgid ""
#~ "$net - network speed, down/up, KB/s\n"
#~ "$netdev - current network device\n"
#~ "@@eth0@@ - disable auto select device and set specified device"
#~ msgstr ""
#~ "$net - network speed, down/up, KB/s\n"
#~ "$netdev - current network device\n"
#~ "@@eth0@@ - disable auto select device and set specified device"
msgid "Import additional files"
msgstr ""

Some files were not shown because too many files have changed in this diff Show More