mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-09 20:05:51 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
b431d2c6cf | |||
f96b3fcb07 | |||
f534a6854a | |||
b51c97abbb | |||
8dc3510a30 | |||
fce098cb5c | |||
5f4bf9ec29 |
13
CHANGELOG
13
CHANGELOG
@ -1,9 +1,20 @@
|
|||||||
|
Ver.2.3.0:
|
||||||
|
+ implement fitlers support to ExtScripts (ApiVer = 3) (#53)
|
||||||
|
+ implement ability to wrap `\n` as new lines (#53)
|
||||||
|
+ implement key sorting in comboboxes
|
||||||
|
+ implement (perc)(bid|ask|price)chg tag support (ApiVer = 2)
|
||||||
|
+ implement timeouts to quotes (#54)
|
||||||
|
- fix bug with invalid html parsing
|
||||||
|
* move from XML to JSON in ExtQuotes (ApiVer = 2)
|
||||||
|
* more pretty configuration UI
|
||||||
|
* some part of refactoring
|
||||||
|
|
||||||
Ver.2.2.2:
|
Ver.2.2.2:
|
||||||
+ add quotes support (#46)
|
+ add quotes support (#46)
|
||||||
+ add support of properties height and width (#47)
|
+ add support of properties height and width (#47)
|
||||||
+ add transtaltion support to the plugins (#50)
|
+ add transtaltion support to the plugins (#50)
|
||||||
+ add support of key caching
|
+ add support of key caching
|
||||||
+ add support of X-AW-Number to ExtScript and ExtUpgrade (ApiVer=2)
|
+ add support of X-AW-Number to ExtScript and ExtUpgrade (ApiVer = 2)
|
||||||
+ add reconnection to DataEngine (in some cases some values are not updated)
|
+ add reconnection to DataEngine (in some cases some values are not updated)
|
||||||
+ add widgets width and height update
|
+ add widgets width and height update
|
||||||
- fix bug with Ext* items update (#49)
|
- fix bug with Ext* items update (#49)
|
||||||
|
11
CHANGELOG-RU
11
CHANGELOG-RU
@ -1,3 +1,14 @@
|
|||||||
|
Вер.2.3.0:
|
||||||
|
+ добавлена поддержка фильтров в ExtScript (ApiVer = 3) (#53)
|
||||||
|
+ добавлена возможность отображать `\n`, как перенос строки (#53)
|
||||||
|
+ добавлена сортировка ключей в комбобоксах
|
||||||
|
+ добавлена поддержка тегов (perc)(bid|ask|price)chg (ApiVer = 2)
|
||||||
|
+ добавлены таймауты запросов котировок (#54)
|
||||||
|
- исправлен баг с неправильным парсингом html
|
||||||
|
* ExtQuotes теперь использует JSON вместо XML (ApiVer = 2)
|
||||||
|
* более красивый UI настроек
|
||||||
|
* некоторый рефакторинг
|
||||||
|
|
||||||
Вер.2.2.2:
|
Вер.2.2.2:
|
||||||
+ добавлена поддержка котировок (#46)
|
+ добавлена поддержка котировок (#46)
|
||||||
+ добавлена поддержка свойств height и width (#47)
|
+ добавлена поддержка свойств height и width (#47)
|
||||||
|
@ -27,8 +27,7 @@ Instruction
|
|||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* kdebase-workspace (*if KDE4 is used*) **or** plasma-framework (*if KF5 is used*)
|
* plasma-framework
|
||||||
* lm_sensors (*for definition temperature device*)
|
|
||||||
|
|
||||||
Optional dependencies
|
Optional dependencies
|
||||||
---------------------
|
---------------------
|
||||||
@ -42,7 +41,7 @@ Make dependencies
|
|||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
* cmake
|
* cmake
|
||||||
* automoc4 (*if KDE4 is used*) or extra-cmake-modules (*if KF5 is used*)
|
* extra-cmake-modules
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
@ -72,4 +71,5 @@ Links
|
|||||||
* [Scripts and bars](http://arcanis.name/en/2014/12/19/aw-v21-bells-and-whistles/)
|
* [Scripts and bars](http://arcanis.name/en/2014/12/19/aw-v21-bells-and-whistles/)
|
||||||
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Awesome+Widgets?content=157124)
|
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Awesome+Widgets?content=157124)
|
||||||
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
||||||
* Archlinux [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-awesome-widgets/) package
|
* Archlinux [AUR](https://aur.archlinux.org/packages/plasma5-applet-awesome-widgets/) package
|
||||||
|
* [OpenSuse](http://software.opensuse.org/package/awesome-widgets) package
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
pkgname=plasma5-applet-awesome-widgets
|
pkgname=plasma5-applet-awesome-widgets
|
||||||
_pkgname=awesome-widgets
|
_pkgname=awesome-widgets
|
||||||
pkgver=2.2.2
|
pkgver=2.3.0
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
@ -20,7 +20,7 @@ optdepends=("amarok: for music player monitor"
|
|||||||
makedepends=('cmake' 'extra-cmake-modules')
|
makedepends=('cmake' 'extra-cmake-modules')
|
||||||
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
||||||
install=${pkgname}.install
|
install=${pkgname}.install
|
||||||
md5sums=('73e176a124f8bfe43a0a112307624bfe')
|
md5sums=('3c79159d6de7b737d386d8ab7eb1ccf0')
|
||||||
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
|
@ -10,8 +10,8 @@ set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
|||||||
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||||
set (PROJECT_LICENSE "GPLv3")
|
set (PROJECT_LICENSE "GPLv3")
|
||||||
set (PROJECT_VERSION_MAJOR 2)
|
set (PROJECT_VERSION_MAJOR 2)
|
||||||
set (PROJECT_VERSION_MINOR 2)
|
set (PROJECT_VERSION_MINOR 3)
|
||||||
set (PROJECT_VERSION_PATCH 2)
|
set (PROJECT_VERSION_PATCH 0)
|
||||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
||||||
|
@ -8,7 +8,7 @@ configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.de
|
|||||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
||||||
find_package (Qt5 REQUIRED COMPONENTS Core Network Qml Xml)
|
find_package (Qt5 REQUIRED COMPONENTS Core Network Qml)
|
||||||
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma)
|
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma)
|
||||||
|
|
||||||
include (KDEInstallDirs)
|
include (KDEInstallDirs)
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
<entry name="notify" type="bool">
|
<entry name="notify" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="wrapNewLines" type="bool">
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
<entry name="background" type="bool">
|
<entry name="background" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -48,6 +48,12 @@ Item {
|
|||||||
text: AWActions.getAboutText("header")
|
text: AWActions.getAboutText("header")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: AWActions.getAboutText("version")
|
||||||
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignJustify
|
horizontalAlignment: Text.AlignJustify
|
||||||
@ -62,9 +68,11 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
font.capitalization: Font.SmallCaps
|
font.capitalization: Font.SmallCaps
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignBottom
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
text: AWActions.getAboutText("copy")
|
text: AWActions.getAboutText("copy")
|
||||||
}
|
}
|
||||||
@ -83,8 +91,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignJustify
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
verticalAlignment: Text.AlignTop
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
text: AWActions.getAboutText("3rdparty")
|
text: AWActions.getAboutText("3rdparty")
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ Item {
|
|||||||
property alias cfg_height: widgetHeight.value
|
property alias cfg_height: widgetHeight.value
|
||||||
property alias cfg_width: widgetWidth.value
|
property alias cfg_width: widgetWidth.value
|
||||||
property alias cfg_notify: notify.checked
|
property alias cfg_notify: notify.checked
|
||||||
|
property alias cfg_wrapNewLines: wrapNewLines.checked
|
||||||
property alias cfg_background: background.checked
|
property alias cfg_background: background.checked
|
||||||
property alias cfg_customTime: customTime.text
|
property alias cfg_customTime: customTime.text
|
||||||
property alias cfg_customUptime: customUptime.text
|
property alias cfg_customUptime: customUptime.text
|
||||||
@ -98,6 +99,20 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.heigth
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: wrapNewLines
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Wrap new lines")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -273,7 +273,7 @@ Item {
|
|||||||
if (debug) console.log("[dataengine::onCompleted]")
|
if (debug) console.log("[dataengine::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
|
@ -199,7 +199,10 @@ Item {
|
|||||||
if (debug) console.log("[main::onUserConfiguringChanged]")
|
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings, plasmoid.configuration.notify)
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
|
AWKeys.initTooltip(tooltipSettings)
|
||||||
|
AWKeys.setPopupEnabled(plasmoid.configuration.notify)
|
||||||
|
AWKeys.setWrapNewLines(plasmoid.configuration.wrapNewLines)
|
||||||
|
|
||||||
needUpdate()
|
needUpdate()
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ Item {
|
|||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 12
|
||||||
text: i18n("Font")
|
text: i18n("Font")
|
||||||
iconName: "font"
|
iconName: "font"
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-indent-more"
|
iconName: "format-indent-more"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -111,6 +113,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-bold"
|
iconName: "format-text-bold"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -123,6 +126,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-italic"
|
iconName: "format-text-italic"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -135,6 +139,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-underline"
|
iconName: "format-text-underline"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -147,6 +152,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-strikethrough"
|
iconName: "format-text-strikethrough"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -160,6 +166,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-left"
|
iconName: "format-justify-left"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -172,6 +179,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-center"
|
iconName: "format-justify-center"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -184,6 +192,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-right"
|
iconName: "format-justify-right"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -196,6 +205,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-fill"
|
iconName: "format-justify-fill"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -310,7 +320,7 @@ Item {
|
|||||||
if (debug) console.log("[widget::onCompleted]")
|
if (debug) console.log("[widget::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
tags.model = AWKeys.dictKeys()
|
tags.model = AWKeys.dictKeys(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
set (PLUGIN_NAME awplugin)
|
set (PLUGIN_NAME awplugin)
|
||||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
||||||
|
|
||||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS} ${Qt5Xml_DEFINITIONS})
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
||||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5Qml_INCLUDE_DIRS})
|
||||||
${Qt5Network_INCLUDE_DIRS}
|
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Qml_LIBRARIES})
|
||||||
${Qt5Qml_INCLUDE_DIRS}
|
|
||||||
${Qt5Xml_INCLUDE_DIRS})
|
|
||||||
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
|
||||||
${Qt5Network_LIBRARIES}
|
|
||||||
${Qt5Qml_LIBRARIES}
|
|
||||||
${Qt5Xml_LIBRARIES})
|
|
||||||
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||||
${Notifications_INCLUDE_DIR})
|
${Notifications_INCLUDE_DIR})
|
||||||
set (Kf5_LIBRARIES KF5::I18n
|
set (Kf5_LIBRARIES KF5::I18n
|
||||||
|
@ -101,6 +101,8 @@ QString AWActions::getAboutText(const QString type)
|
|||||||
QString text;
|
QString text;
|
||||||
if (type == QString("header"))
|
if (type == QString("header"))
|
||||||
text = QString(NAME);
|
text = QString(NAME);
|
||||||
|
else if (type == QString("version"))
|
||||||
|
text = i18n("Version %1 (build date %2)", QString(VERSION), QString(BUILD_DATE));
|
||||||
else if (type == QString("description"))
|
else if (type == QString("description"))
|
||||||
text = i18n("A set of minimalistic plasmoid widgets");
|
text = i18n("A set of minimalistic plasmoid widgets");
|
||||||
else if (type == QString("links"))
|
else if (type == QString("links"))
|
||||||
@ -130,11 +132,11 @@ QString AWActions::getAboutText(const QString type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> AWActions::getFont(const QMap<QString, QVariant> defaultFont)
|
QVariantMap AWActions::getFont(const QVariantMap defaultFont)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QMap<QString, QVariant> fontMap;
|
QVariantMap fontMap;
|
||||||
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
||||||
defaultFont[QString("size")].toInt(),
|
defaultFont[QString("size")].toInt(),
|
||||||
400, false, defaultFont[QString("color")].toString());
|
400, false, defaultFont[QString("color")].toString());
|
||||||
@ -148,14 +150,14 @@ QMap<QString, QVariant> AWActions::getFont(const QMap<QString, QVariant> default
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> AWActions::readDataEngineConfiguration()
|
QVariantMap AWActions::readDataEngineConfiguration()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
QSettings settings(fileName, QSettings::IniFormat);
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
QMap<QString, QVariant> configuration;
|
QVariantMap configuration;
|
||||||
|
|
||||||
settings.beginGroup(QString("Configuration"));
|
settings.beginGroup(QString("Configuration"));
|
||||||
configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
||||||
@ -172,7 +174,7 @@ QMap<QString, QVariant> AWActions::readDataEngineConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWActions::writeDataEngineConfiguration(const QMap<QString, QVariant> configuration)
|
void AWActions::writeDataEngineConfiguration(const QVariantMap configuration)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ public:
|
|||||||
Q_INVOKABLE void showReadme();
|
Q_INVOKABLE void showReadme();
|
||||||
// configuration slots
|
// configuration slots
|
||||||
Q_INVOKABLE QString getAboutText(const QString type = QString("header"));
|
Q_INVOKABLE QString getAboutText(const QString type = QString("header"));
|
||||||
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont);
|
||||||
// dataengine
|
// dataengine
|
||||||
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
Q_INVOKABLE QVariantMap readDataEngineConfiguration();
|
||||||
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message,
|
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message,
|
||||||
|
@ -86,9 +86,7 @@ AWKeys::~AWKeys()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWKeys::initKeys(const QString currentPattern,
|
void AWKeys::initKeys(const QString currentPattern)
|
||||||
const QMap<QString, QVariant> tooltipParams,
|
|
||||||
const bool popup)
|
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
@ -100,7 +98,6 @@ void AWKeys::initKeys(const QString currentPattern,
|
|||||||
keys.clear();
|
keys.clear();
|
||||||
foundBars.clear();
|
foundBars.clear();
|
||||||
foundKeys.clear();
|
foundKeys.clear();
|
||||||
if (toolTip != nullptr) delete toolTip;
|
|
||||||
|
|
||||||
// init
|
// init
|
||||||
pattern = currentPattern;
|
pattern = currentPattern;
|
||||||
@ -113,12 +110,34 @@ void AWKeys::initKeys(const QString currentPattern,
|
|||||||
addKeyToCache(QString("Network"));
|
addKeyToCache(QString("Network"));
|
||||||
loadKeysFromCache();
|
loadKeysFromCache();
|
||||||
reinitKeys();
|
reinitKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWKeys::initTooltip(const QVariantMap tooltipParams)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
if (toolTip != nullptr) delete toolTip;
|
||||||
toolTip = new AWToolTip(this, tooltipParams);
|
toolTip = new AWToolTip(this, tooltipParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWKeys::setPopupEnabled(const bool popup)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
enablePopup = popup;
|
enablePopup = popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWKeys::setWrapNewLines(const bool wrap)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
wrapNewLines = wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AWKeys::isDebugEnabled()
|
bool AWKeys::isDebugEnabled()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -135,11 +154,12 @@ QString AWKeys::parsePattern()
|
|||||||
QString parsed = pattern;
|
QString parsed = pattern;
|
||||||
parsed.replace(QString("$$"), QString("$\\$\\"));
|
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||||
for (int i=0; i<foundKeys.count(); i++)
|
for (int i=0; i<foundKeys.count(); i++)
|
||||||
parsed.replace(QString("$%1").arg(foundKeys[i]), valueByKey(foundKeys[i]));
|
parsed.replace(QString("$%1").arg(foundKeys[i]), htmlValue(foundKeys[i]));
|
||||||
parsed.replace(QString(" "), QString(" "));
|
|
||||||
for (int i=0; i<foundBars.count(); i++)
|
for (int i=0; i<foundBars.count(); i++)
|
||||||
parsed.replace(QString("$%1").arg(foundBars[i]), getItemByTag(foundBars[i])->image(valueByKey(foundBars[i]).toFloat()));
|
parsed.replace(QString("$%1").arg(foundBars[i]), getItemByTag(foundBars[i])->image(valueByKey(foundBars[i]).toFloat()));
|
||||||
parsed.replace(QString("$\\$\\"), QString("$$"));
|
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||||
|
// wrap new lines if required
|
||||||
|
if (wrapNewLines) parsed.replace(QString("\n"), QString("<br>"));
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
@ -148,6 +168,7 @@ QString AWKeys::parsePattern()
|
|||||||
QString AWKeys::toolTipImage()
|
QString AWKeys::toolTipImage()
|
||||||
{
|
{
|
||||||
if(debug) qDebug() << PDEBUG;
|
if(debug) qDebug() << PDEBUG;
|
||||||
|
if (toolTip == nullptr) return QString("");
|
||||||
|
|
||||||
if (keys.isEmpty()) return QString();
|
if (keys.isEmpty()) return QString();
|
||||||
|
|
||||||
@ -163,6 +184,7 @@ QString AWKeys::toolTipImage()
|
|||||||
QSize AWKeys::toolTipSize()
|
QSize AWKeys::toolTipSize()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (toolTip == nullptr) return QSize();
|
||||||
|
|
||||||
return toolTip->getSize();
|
return toolTip->getSize();
|
||||||
}
|
}
|
||||||
@ -194,7 +216,7 @@ void AWKeys::addDevice(const QString source)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList AWKeys::dictKeys()
|
QStringList AWKeys::dictKeys(const bool sorted)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
@ -293,8 +315,14 @@ QStringList AWKeys::dictKeys()
|
|||||||
// quotes
|
// quotes
|
||||||
for (int i=extQuotes.count()-1; i>=0; i--) {
|
for (int i=extQuotes.count()-1; i>=0; i--) {
|
||||||
allKeys.append(extQuotes[i]->tag(QString("ask")));
|
allKeys.append(extQuotes[i]->tag(QString("ask")));
|
||||||
|
allKeys.append(extQuotes[i]->tag(QString("askchg")));
|
||||||
|
allKeys.append(extQuotes[i]->tag(QString("percaskchg")));
|
||||||
allKeys.append(extQuotes[i]->tag(QString("bid")));
|
allKeys.append(extQuotes[i]->tag(QString("bid")));
|
||||||
|
allKeys.append(extQuotes[i]->tag(QString("bidchg")));
|
||||||
|
allKeys.append(extQuotes[i]->tag(QString("percbidchg")));
|
||||||
allKeys.append(extQuotes[i]->tag(QString("price")));
|
allKeys.append(extQuotes[i]->tag(QString("price")));
|
||||||
|
allKeys.append(extQuotes[i]->tag(QString("pricechg")));
|
||||||
|
allKeys.append(extQuotes[i]->tag(QString("percpricechg")));
|
||||||
}
|
}
|
||||||
// custom
|
// custom
|
||||||
for (int i=extScripts.count()-1; i>=0; i--)
|
for (int i=extScripts.count()-1; i>=0; i--)
|
||||||
@ -312,6 +340,9 @@ QStringList AWKeys::dictKeys()
|
|||||||
for (int i=graphicalItemsKeys.count()-1; i>=0; i--)
|
for (int i=graphicalItemsKeys.count()-1; i>=0; i--)
|
||||||
allKeys.append(graphicalItemsKeys[i]);
|
allKeys.append(graphicalItemsKeys[i]);
|
||||||
|
|
||||||
|
// sort if required
|
||||||
|
if (sorted) allKeys.sort();
|
||||||
|
|
||||||
return allKeys;
|
return allKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,9 +360,8 @@ QStringList AWKeys::getHddDevices()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AWKeys::setDataBySource(const QString sourceName,
|
bool AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
||||||
const QMap<QString, QVariant> data,
|
const QVariantMap params)
|
||||||
const QMap<QString, QVariant> params)
|
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
|
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
|
||||||
@ -339,6 +369,7 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
|||||||
if (sourceName == QString("update")) return true;
|
if (sourceName == QString("update")) return true;
|
||||||
|
|
||||||
// checking
|
// checking
|
||||||
|
if (toolTip == nullptr) return false;
|
||||||
if (!checkKeys(data)) return false;
|
if (!checkKeys(data)) return false;
|
||||||
if (keys.isEmpty()) return false;
|
if (keys.isEmpty()) return false;
|
||||||
|
|
||||||
@ -373,7 +404,8 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
|||||||
values[QString("ac")] = params[QString("acOffline")].toString();
|
values[QString("ac")] = params[QString("acOffline")].toString();
|
||||||
} else {
|
} else {
|
||||||
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0);
|
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0);
|
||||||
toolTip->setData(QString("batTooltip"), data[data.keys()[i]].toFloat(), data[QString("ac")].toBool());
|
toolTip->setData(QString("batTooltip"), data[data.keys()[i]].toFloat(),
|
||||||
|
data[QString("ac")].toBool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (sourceName == QString("cpu/system/TotalLoad")) {
|
} else if (sourceName == QString("cpu/system/TotalLoad")) {
|
||||||
@ -531,7 +563,7 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
|||||||
values[QString("down%1").arg(i)] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
values[QString("down%1").arg(i)] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (device == networkDevice()) {
|
if (device == values[QString("netdev")]) {
|
||||||
values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
||||||
toolTip->setData(QString("downTooltip"), data[QString("value")].toFloat());
|
toolTip->setData(QString("downTooltip"), data[QString("value")].toFloat());
|
||||||
}
|
}
|
||||||
@ -545,7 +577,7 @@ bool AWKeys::setDataBySource(const QString sourceName,
|
|||||||
values[QString("up%1").arg(i)] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
values[QString("up%1").arg(i)] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (device == networkDevice()) {
|
if (device == values[QString("netdev")]) {
|
||||||
values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
||||||
toolTip->setData(QString("upTooltip"), data[QString("value")].toFloat());
|
toolTip->setData(QString("upTooltip"), data[QString("value")].toFloat());
|
||||||
}
|
}
|
||||||
@ -646,8 +678,8 @@ void AWKeys::graphicalValueByKey()
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
QString tag = QInputDialog::getItem(0, i18n("Select tag"),
|
QString tag = QInputDialog::getItem(0, i18n("Select tag"), i18n("Tag"),
|
||||||
i18n("Tag"), keys, 0, false, &ok);
|
dictKeys(true), 0, false, &ok);
|
||||||
|
|
||||||
if ((!ok) || (tag.isEmpty())) return;
|
if ((!ok) || (tag.isEmpty())) return;
|
||||||
QString message = i18n("Tag: %1", tag);
|
QString message = i18n("Tag: %1", tag);
|
||||||
@ -684,11 +716,9 @@ QString AWKeys::infoByKey(QString key)
|
|||||||
if (extUpgrade[i]->tag() != key) continue;
|
if (extUpgrade[i]->tag() != key) continue;
|
||||||
return extUpgrade[i]->executable();
|
return extUpgrade[i]->executable();
|
||||||
}
|
}
|
||||||
else if ((key.startsWith(QString("ask"))) ||
|
else if (key.contains(QRegExp(QString("(^|perc)(ask|bid|price)(chg|)"))))
|
||||||
(key.startsWith(QString("bid"))) ||
|
|
||||||
(key.startsWith(QString("price"))))
|
|
||||||
for (int i=0; i<extQuotes.count(); i++) {
|
for (int i=0; i<extQuotes.count(); i++) {
|
||||||
if (extQuotes[i]->number() != key.remove(QRegExp(QString("^(ask|bid|price)"))).toInt()) continue;
|
if (extQuotes[i]->number() != key.remove(QRegExp(QString("(^|perc)(ask|bid|price)(chg|)"))).toInt()) continue;
|
||||||
return extQuotes[i]->ticker();
|
return extQuotes[i]->ticker();
|
||||||
}
|
}
|
||||||
else if (key.startsWith(QString("temp")))
|
else if (key.startsWith(QString("temp")))
|
||||||
@ -1247,7 +1277,7 @@ void AWKeys::addKeyToCache(const QString type, const QString key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AWKeys::checkKeys(const QMap<QString, QVariant> data)
|
bool AWKeys::checkKeys(const QVariantMap data)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Data" << data;
|
if (debug) qDebug() << PDEBUG << ":" << "Data" << data;
|
||||||
@ -1256,22 +1286,15 @@ bool AWKeys::checkKeys(const QMap<QString, QVariant> data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString AWKeys::networkDevice()
|
QString AWKeys::htmlValue(QString key)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
|
||||||
|
|
||||||
QString device = QString("lo");
|
QString value = values[key];
|
||||||
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
if (!key.startsWith(QString("custom")))
|
||||||
for (int i=0; i<rawInterfaceList.count(); i++)
|
value.replace(QString(" "), QString(" "));
|
||||||
if ((rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsUp)) &&
|
return value;
|
||||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsLoopBack)) &&
|
|
||||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsPointToPoint))) {
|
|
||||||
device = rawInterfaceList[i].name();
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return device;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,20 +51,20 @@ public:
|
|||||||
AWKeys(QObject *parent = nullptr);
|
AWKeys(QObject *parent = nullptr);
|
||||||
~AWKeys();
|
~AWKeys();
|
||||||
|
|
||||||
Q_INVOKABLE void initKeys(const QString currentPattern,
|
Q_INVOKABLE void initKeys(const QString currentPattern);
|
||||||
const QMap<QString, QVariant> tooltipParams,
|
Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams);
|
||||||
const bool popup = false);
|
Q_INVOKABLE void setPopupEnabled(const bool popup = false);
|
||||||
|
Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
|
||||||
Q_INVOKABLE bool isDebugEnabled();
|
Q_INVOKABLE bool isDebugEnabled();
|
||||||
Q_INVOKABLE QString parsePattern();
|
Q_INVOKABLE QString parsePattern();
|
||||||
Q_INVOKABLE QString toolTipImage();
|
Q_INVOKABLE QString toolTipImage();
|
||||||
Q_INVOKABLE QSize toolTipSize();
|
Q_INVOKABLE QSize toolTipSize();
|
||||||
// keys
|
// keys
|
||||||
Q_INVOKABLE void addDevice(const QString source);
|
Q_INVOKABLE void addDevice(const QString source);
|
||||||
Q_INVOKABLE QStringList dictKeys();
|
Q_INVOKABLE QStringList dictKeys(const bool sorted = false);
|
||||||
Q_INVOKABLE QStringList getHddDevices();
|
Q_INVOKABLE QStringList getHddDevices();
|
||||||
Q_INVOKABLE bool setDataBySource(const QString sourceName,
|
Q_INVOKABLE bool setDataBySource(const QString sourceName, const QVariantMap data,
|
||||||
const QMap<QString, QVariant> data,
|
const QVariantMap params);
|
||||||
const QMap<QString, QVariant> params);
|
|
||||||
// values
|
// values
|
||||||
Q_INVOKABLE void graphicalValueByKey();
|
Q_INVOKABLE void graphicalValueByKey();
|
||||||
Q_INVOKABLE QString infoByKey(QString key);
|
Q_INVOKABLE QString infoByKey(QString key);
|
||||||
@ -85,8 +85,8 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
// methods
|
// methods
|
||||||
void addKeyToCache(const QString type, const QString key = QString(""));
|
void addKeyToCache(const QString type, const QString key = QString(""));
|
||||||
bool checkKeys(const QMap<QString, QVariant> data);
|
bool checkKeys(const QVariantMap data);
|
||||||
QString networkDevice();
|
QString htmlValue(QString key);
|
||||||
int numberCpus();
|
int numberCpus();
|
||||||
float temperature(const float temp, const QString units);
|
float temperature(const float temp, const QString units);
|
||||||
// find methods
|
// find methods
|
||||||
@ -111,6 +111,7 @@ private:
|
|||||||
// variables
|
// variables
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
bool enablePopup = false;
|
bool enablePopup = false;
|
||||||
|
bool wrapNewLines = false;
|
||||||
QList<GraphicalItem *> graphicalItems;
|
QList<GraphicalItem *> graphicalItems;
|
||||||
QList<ExtQuotes *> extQuotes;
|
QList<ExtQuotes *> extQuotes;
|
||||||
QList<ExtScript *> extScripts;
|
QList<ExtScript *> extScripts;
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
|
||||||
AWToolTip::AWToolTip(QObject *parent,
|
AWToolTip::AWToolTip(QObject *parent, QVariantMap settings)
|
||||||
QMap<QString, QVariant> settings)
|
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
configuration(settings)
|
configuration(settings)
|
||||||
{
|
{
|
||||||
|
@ -32,8 +32,7 @@ class AWToolTip : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AWToolTip(QObject *parent = nullptr,
|
AWToolTip(QObject *parent = nullptr, QVariantMap settings = QVariantMap());
|
||||||
QMap<QString, QVariant> settings = QMap<QString, QVariant>());
|
|
||||||
~AWToolTip();
|
~AWToolTip();
|
||||||
|
|
||||||
QSize getSize();
|
QSize getSize();
|
||||||
@ -48,7 +47,7 @@ private:
|
|||||||
// variables
|
// variables
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
int counts = 0;
|
int counts = 0;
|
||||||
QMap<QString, QVariant> configuration;
|
QVariantMap configuration;
|
||||||
QMap<QString, float> boundaries;
|
QMap<QString, float> boundaries;
|
||||||
QMap<QString, QList<float>> data;
|
QMap<QString, QList<float>> data;
|
||||||
QStringList requiredKeys;
|
QStringList requiredKeys;
|
||||||
|
@ -48,6 +48,12 @@ Item {
|
|||||||
text: DPAdds.getAboutText("header")
|
text: DPAdds.getAboutText("header")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: DPAdds.getAboutText("version")
|
||||||
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignJustify
|
horizontalAlignment: Text.AlignJustify
|
||||||
@ -62,9 +68,11 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
font.capitalization: Font.SmallCaps
|
font.capitalization: Font.SmallCaps
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignBottom
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
text: DPAdds.getAboutText("copy")
|
text: DPAdds.getAboutText("copy")
|
||||||
}
|
}
|
||||||
@ -83,8 +91,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignJustify
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
verticalAlignment: Text.AlignTop
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
text: DPAdds.getAboutText("3rdparty")
|
text: DPAdds.getAboutText("3rdparty")
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ Item {
|
|||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 12
|
||||||
text: i18n("Font")
|
text: i18n("Font")
|
||||||
iconName: "font"
|
iconName: "font"
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-indent-more"
|
iconName: "format-indent-more"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -83,6 +85,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-bold"
|
iconName: "format-text-bold"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -95,6 +98,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-italic"
|
iconName: "format-text-italic"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -107,6 +111,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-underline"
|
iconName: "format-text-underline"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -119,6 +124,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-strikethrough"
|
iconName: "format-text-strikethrough"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -132,6 +138,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-left"
|
iconName: "format-justify-left"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -144,6 +151,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-center"
|
iconName: "format-justify-center"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -156,6 +164,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-right"
|
iconName: "format-justify-right"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -168,6 +177,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-fill"
|
iconName: "format-justify-fill"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -189,7 +189,6 @@ QString DPAdds::parsePattern(const QString pattern, const int desktop)
|
|||||||
parsed.replace(QString("$$"), QString("$\\$\\"));
|
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||||
for (int i=0; i<keys.count(); i++)
|
for (int i=0; i<keys.count(); i++)
|
||||||
parsed.replace(QString("$%1").arg(keys[i]), valueByKey(keys[i], desktop));
|
parsed.replace(QString("$%1").arg(keys[i]), valueByKey(keys[i], desktop));
|
||||||
parsed.replace(QString(" "), QString(" "));
|
|
||||||
parsed.replace(QString("$\\$\\"), QString("$$"));
|
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
@ -221,7 +220,7 @@ void DPAdds::setPanelsToControl(const QString newPanels)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DPAdds::setToolTipData(const QMap<QString, QVariant> tooltipData)
|
void DPAdds::setToolTipData(const QVariantMap tooltipData)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Data" << tooltipData;
|
if (debug) qDebug() << PDEBUG << ":" << "Data" << tooltipData;
|
||||||
@ -240,9 +239,10 @@ QString DPAdds::valueByKey(const QString key, int desktop)
|
|||||||
|
|
||||||
QString currentMark = currentDesktop() == desktop ? mark : QString("");
|
QString currentMark = currentDesktop() == desktop ? mark : QString("");
|
||||||
if (key == QString("mark"))
|
if (key == QString("mark"))
|
||||||
return QString("%1").arg(currentMark, mark.count(), QLatin1Char(' '));
|
return QString("%1").arg(currentMark, mark.count(), QLatin1Char(' '))
|
||||||
|
.replace(QString(" "), QString(" "));
|
||||||
else if (key == QString("name"))
|
else if (key == QString("name"))
|
||||||
return KWindowSystem::desktopName(desktop);
|
return KWindowSystem::desktopName(desktop).replace(QString(" "), QString(" "));
|
||||||
else if (key == QString("number"))
|
else if (key == QString("number"))
|
||||||
return QString::number(desktop);
|
return QString::number(desktop);
|
||||||
else if (key == QString("total"))
|
else if (key == QString("total"))
|
||||||
@ -310,6 +310,8 @@ QString DPAdds::getAboutText(const QString type)
|
|||||||
QString text;
|
QString text;
|
||||||
if (type == QString("header"))
|
if (type == QString("header"))
|
||||||
text = QString(NAME);
|
text = QString(NAME);
|
||||||
|
else if (type == QString("version"))
|
||||||
|
text = i18n("Version %1 (build date %2)", QString(VERSION), QString(BUILD_DATE));
|
||||||
else if (type == QString("description"))
|
else if (type == QString("description"))
|
||||||
text = i18n("A set of minimalistic plasmoid widgets");
|
text = i18n("A set of minimalistic plasmoid widgets");
|
||||||
else if (type == QString("links"))
|
else if (type == QString("links"))
|
||||||
@ -339,11 +341,11 @@ QString DPAdds::getAboutText(const QString type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> DPAdds::getFont(const QMap<QString, QVariant> defaultFont)
|
QVariantMap DPAdds::getFont(const QVariantMap defaultFont)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QMap<QString, QVariant> fontMap;
|
QVariantMap fontMap;
|
||||||
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
||||||
defaultFont[QString("size")].toInt(),
|
defaultFont[QString("size")].toInt(),
|
||||||
400, false, defaultFont[QString("color")].toString());
|
400, false, defaultFont[QString("color")].toString());
|
||||||
|
@ -55,12 +55,12 @@ public:
|
|||||||
// values
|
// values
|
||||||
Q_INVOKABLE void setMark(const QString newMark);
|
Q_INVOKABLE void setMark(const QString newMark);
|
||||||
Q_INVOKABLE void setPanelsToControl(const QString newPanels);
|
Q_INVOKABLE void setPanelsToControl(const QString newPanels);
|
||||||
Q_INVOKABLE void setToolTipData(const QMap<QString, QVariant> tooltipData);
|
Q_INVOKABLE void setToolTipData(const QVariantMap tooltipData);
|
||||||
Q_INVOKABLE QString valueByKey(const QString key, int desktop = -1);
|
Q_INVOKABLE QString valueByKey(const QString key, int desktop = -1);
|
||||||
// configuration slots
|
// configuration slots
|
||||||
Q_INVOKABLE QString editPanelsToContol(const QString current);
|
Q_INVOKABLE QString editPanelsToContol(const QString current);
|
||||||
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
||||||
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void desktopChanged();
|
void desktopChanged();
|
||||||
|
@ -4,7 +4,7 @@ set (PLUGIN_NAME ${SUBPROJECT})
|
|||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
# find required libaries
|
# find required libaries
|
||||||
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets Xml)
|
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets)
|
||||||
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
||||||
@ -14,9 +14,9 @@ include (KDECMakeSettings)
|
|||||||
include (KDECompilerSettings)
|
include (KDECompilerSettings)
|
||||||
|
|
||||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
|
||||||
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS})
|
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
|
||||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
|
||||||
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS})
|
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||||
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
|
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
|
||||||
|
|
||||||
include_directories (${CMAKE_SOURCE_DIR}
|
include_directories (${CMAKE_SOURCE_DIR}
|
||||||
|
@ -20,11 +20,10 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDomDocument>
|
#include <QJsonDocument>
|
||||||
#include <QDomElement>
|
#include <QJsonParseError>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
@ -45,8 +44,14 @@ ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName, const QStringLis
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
values[QString("ask")] = 0.0;
|
values[QString("ask")] = 0.0;
|
||||||
|
values[QString("askchg")] = 0.0;
|
||||||
|
values[QString("percaskchg")] = 0.0;
|
||||||
values[QString("bid")] = 0.0;
|
values[QString("bid")] = 0.0;
|
||||||
|
values[QString("bidchg")] = 0.0;
|
||||||
|
values[QString("percbidchg")] = 0.0;
|
||||||
values[QString("price")] = 0.0;
|
values[QString("price")] = 0.0;
|
||||||
|
values[QString("pricechg")] = 0.0;
|
||||||
|
values[QString("percpricechg")] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -237,7 +242,8 @@ QMap<QString, float> ExtQuotes::run()
|
|||||||
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
||||||
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(quotesReplyReceived(QNetworkReply *)));
|
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(quotesReplyReceived(QNetworkReply *)));
|
||||||
|
|
||||||
manager->get(QNetworkRequest(QUrl(url())));
|
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url())));
|
||||||
|
new QReplyTimeout(reply, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update value
|
// update value
|
||||||
@ -314,42 +320,37 @@ void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error message" << reply->errorString();
|
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
|
||||||
|
|
||||||
if (reply->error() != QNetworkReply::NoError) {
|
QJsonParseError error;
|
||||||
reply->deleteLater();
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
|
||||||
|
reply->deleteLater();
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Json parse error" << error.errorString();
|
||||||
|
if ((reply->error() != QNetworkReply::NoError) ||
|
||||||
|
(error.error != QJsonParseError::NoError)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
QVariantMap jsonQuotes = jsonDoc.toVariant().toMap()[QString("query")].toMap();
|
||||||
QDomDocument doc;
|
jsonQuotes = jsonQuotes[QString("results")].toMap()[QString("quote")].toMap();
|
||||||
if (!doc.setContent(reply)) {
|
float value;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Could not parse answer to XML";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QDomNodeList fields;
|
|
||||||
|
|
||||||
// ask
|
// ask
|
||||||
fields = doc.elementsByTagName(QString("Ask"));
|
value = jsonQuotes[QString("Ask")].toString().toFloat();
|
||||||
for (int i=0; i<fields.size(); i++) {
|
values[QString("askchg")] = values[QString("ask")] == 0 ? 0.0 : value - values[QString("ask")];
|
||||||
values[QString("ask")] = fields.item(i).toElement().text().toFloat();
|
values[QString("percaskchg")] = 100 * values[QString("askchg")] / values[QString("ask")];
|
||||||
if (debug) qDebug() << PDEBUG << "Found ask" << values[QString("ask")];
|
values[QString("ask")] = value;
|
||||||
}
|
|
||||||
|
|
||||||
// bid
|
// bid
|
||||||
fields = doc.elementsByTagName(QString("Bid"));
|
value = jsonQuotes[QString("Bid")].toString().toFloat();
|
||||||
for (int i=0; i<fields.size(); i++) {
|
values[QString("bidchg")] = values[QString("bid")] == 0 ? 0.0 : value - values[QString("bid")];
|
||||||
values[QString("bid")] = fields.item(i).toElement().text().toFloat();
|
values[QString("percbidchg")] = 100 * values[QString("bidchg")] / values[QString("bid")];
|
||||||
if (debug) qDebug() << PDEBUG << "Found bid" << values[QString("bid")];
|
values[QString("bid")] = value;
|
||||||
}
|
|
||||||
|
|
||||||
// last trade
|
// last trade
|
||||||
fields = doc.elementsByTagName(QString("LastTradePriceOnly"));
|
value = jsonQuotes[QString("LastTradePriceOnly")].toString().toFloat();
|
||||||
for (int i=0; i<fields.size(); i++) {
|
values[QString("pricechg")] = values[QString("price")] == 0 ? 0.0 : value - values[QString("price")];
|
||||||
values[QString("price")] = fields.item(i).toElement().text().toFloat();
|
values[QString("percpricechg")] = 100 * values[QString("pricechg")] / values[QString("price")];
|
||||||
if (debug) qDebug() << PDEBUG << "Found last trade" << values[QString("price")];
|
values[QString("price")] = value;
|
||||||
}
|
|
||||||
|
|
||||||
reply->deleteLater();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,11 +20,29 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#define YAHOO_URL "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in (\"$TICKER\")&env=store://datatables.org/alltableswithkeys"
|
#define YAHOO_URL "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol=\"$TICKER\"&env=store://datatables.org/alltableswithkeys&format=json"
|
||||||
|
|
||||||
|
|
||||||
class QNetworkReply;
|
class QReplyTimeout : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
QReplyTimeout(QNetworkReply *reply, const int timeout) : QObject(reply)
|
||||||
|
{
|
||||||
|
QTimer::singleShot(timeout, this, SLOT(timeout()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void timeout()
|
||||||
|
{
|
||||||
|
QNetworkReply *reply = static_cast<QNetworkReply *>(parent());
|
||||||
|
if (reply->isRunning()) reply->close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ExtQuotes;
|
class ExtQuotes;
|
||||||
|
@ -20,7 +20,10 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
@ -38,6 +41,7 @@ ExtScript::ExtScript(QWidget *parent, const QString scriptName, const QStringLis
|
|||||||
{
|
{
|
||||||
m_name = m_fileName;
|
m_name = m_fileName;
|
||||||
readConfiguration();
|
readConfiguration();
|
||||||
|
readJsonFilters();
|
||||||
// init process
|
// init process
|
||||||
process = new QProcess(this);
|
process = new QProcess(this);
|
||||||
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue()));
|
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue()));
|
||||||
@ -89,6 +93,22 @@ QString ExtScript::fileName()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList ExtScript::filters()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_filters;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtScript::hasOutput()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int ExtScript::interval()
|
int ExtScript::interval()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -97,6 +117,14 @@ int ExtScript::interval()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtScript::isActive()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString ExtScript::name()
|
QString ExtScript::name()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -141,6 +169,7 @@ QString ExtScript::strRedirect()
|
|||||||
case stderr2stdout:
|
case stderr2stdout:
|
||||||
value = QString("stderr2stdout");
|
value = QString("stderr2stdout");
|
||||||
break;
|
break;
|
||||||
|
case nothing:
|
||||||
default:
|
default:
|
||||||
value = QString("nothing");
|
value = QString("nothing");
|
||||||
break;
|
break;
|
||||||
@ -158,22 +187,6 @@ QString ExtScript::tag()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ExtScript::hasOutput()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return m_output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ExtScript::isActive()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return m_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExtScript::setApiVersion(const int _apiVersion)
|
void ExtScript::setApiVersion(const int _apiVersion)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -210,12 +223,22 @@ void ExtScript::setExecutable(const QString _executable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExtScript::setHasOutput(const bool state)
|
void ExtScript::setFilters(const QStringList _filters)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
if (debug) qDebug() << PDEBUG << ":" << "Filters" << _filters;
|
||||||
|
|
||||||
m_output = state;
|
for (int i=0; i<_filters.count(); i++)
|
||||||
|
updateFilter(_filters[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setHasOutput(const bool _state)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "State" << _state;
|
||||||
|
|
||||||
|
m_output = _state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -285,6 +308,41 @@ void ExtScript::setStrRedirect(const QString _redirect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::applyFilters(QString _value)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Value" << _value;
|
||||||
|
|
||||||
|
for (int i=0; i<m_filters.count(); i++) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Found filter" << m_filters[i];
|
||||||
|
QVariantMap filter = jsonFilters[m_filters[i]].toMap();
|
||||||
|
if (filter.isEmpty()) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Could not find filter in the json";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int j=0; j<filter.keys().count(); j++)
|
||||||
|
_value.replace(filter.keys()[j], filter[filter.keys()[j]].toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::updateFilter(const QString _filter, const bool _add)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Filter" << _filter;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Should be added" << _add;
|
||||||
|
|
||||||
|
if (_add) {
|
||||||
|
if (m_filters.contains(_filter)) return;
|
||||||
|
m_filters.append(_filter);
|
||||||
|
} else {
|
||||||
|
m_filters.removeOne(_filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExtScript::readConfiguration()
|
void ExtScript::readConfiguration()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -305,6 +363,9 @@ void ExtScript::readConfiguration()
|
|||||||
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||||
// api == 2
|
// api == 2
|
||||||
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
|
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
|
||||||
|
// api == 3
|
||||||
|
setFilters(settings.value(QString("X-AW-Filters"), m_filters).toString()
|
||||||
|
.split(QChar(','), QString::SkipEmptyParts));
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,6 +380,30 @@ void ExtScript::readConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::readJsonFilters()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||||
|
QString("awesomewidgets/scripts/awesomewidgets-extscripts-filters.json"));
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
|
QFile jsonFile(fileName);
|
||||||
|
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
return;
|
||||||
|
QString jsonText = jsonFile.readAll();
|
||||||
|
jsonFile.close();
|
||||||
|
|
||||||
|
QJsonParseError error;
|
||||||
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Json parse error" << error.errorString();
|
||||||
|
if (error.error != QJsonParseError::NoError)
|
||||||
|
return;
|
||||||
|
jsonFilters = jsonDoc.toVariant().toMap();
|
||||||
|
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Filters" << jsonFilters;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString ExtScript::run()
|
QString ExtScript::run()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -351,6 +436,10 @@ int ExtScript::showConfiguration()
|
|||||||
ui->checkBox_output->setCheckState(m_output ? Qt::Checked : Qt::Unchecked);
|
ui->checkBox_output->setCheckState(m_output ? Qt::Checked : Qt::Unchecked);
|
||||||
ui->comboBox_redirect->setCurrentIndex(static_cast<int>(m_redirect));
|
ui->comboBox_redirect->setCurrentIndex(static_cast<int>(m_redirect));
|
||||||
ui->spinBox_interval->setValue(m_interval);
|
ui->spinBox_interval->setValue(m_interval);
|
||||||
|
// filters
|
||||||
|
ui->checkBox_colorFilter->setCheckState(m_filters.contains(QString("color")) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
ui->checkBox_linesFilter->setCheckState(m_filters.contains(QString("newline")) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
ui->checkBox_spaceFilter->setCheckState(m_filters.contains(QString("space")) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
|
||||||
int ret = exec();
|
int ret = exec();
|
||||||
if (ret != 1) return ret;
|
if (ret != 1) return ret;
|
||||||
@ -364,6 +453,10 @@ int ExtScript::showConfiguration()
|
|||||||
setHasOutput(ui->checkBox_output->checkState() == Qt::Checked);
|
setHasOutput(ui->checkBox_output->checkState() == Qt::Checked);
|
||||||
setStrRedirect(ui->comboBox_redirect->currentText());
|
setStrRedirect(ui->comboBox_redirect->currentText());
|
||||||
setInterval(ui->spinBox_interval->value());
|
setInterval(ui->spinBox_interval->value());
|
||||||
|
// filters
|
||||||
|
updateFilter(QString("color"), ui->checkBox_colorFilter->checkState() == Qt::Checked);
|
||||||
|
updateFilter(QString("newline"), ui->checkBox_linesFilter->checkState() == Qt::Checked);
|
||||||
|
updateFilter(QString("space"), ui->checkBox_spaceFilter->checkState() == Qt::Checked);
|
||||||
|
|
||||||
writeConfiguration();
|
writeConfiguration();
|
||||||
return ret;
|
return ret;
|
||||||
@ -404,6 +497,7 @@ void ExtScript::writeConfiguration()
|
|||||||
settings.setValue(QString("X-AW-Redirect"), strRedirect());
|
settings.setValue(QString("X-AW-Redirect"), strRedirect());
|
||||||
settings.setValue(QString("X-AW-Interval"), m_interval);
|
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||||
settings.setValue(QString("X-AW-Number"), m_number);
|
settings.setValue(QString("X-AW-Number"), m_number);
|
||||||
|
settings.setValue(QString("X-AW-Filters"), m_filters.join(QChar(',')));
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.sync();
|
settings.sync();
|
||||||
@ -433,4 +527,7 @@ void ExtScript::updateValue()
|
|||||||
value = qoutput;
|
value = qoutput;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filters
|
||||||
|
value = applyFilters(value);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#define EXTSCRIPT_H
|
#define EXTSCRIPT_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QMap>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
|
|
||||||
@ -29,15 +30,16 @@ namespace Ui {
|
|||||||
class ExtScript : public QDialog
|
class ExtScript : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
||||||
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
||||||
Q_PROPERTY(QString name READ name WRITE setName)
|
|
||||||
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
||||||
Q_PROPERTY(QString executable READ executable WRITE setExecutable)
|
Q_PROPERTY(QString executable READ executable WRITE setExecutable)
|
||||||
Q_PROPERTY(int number READ number WRITE setNumber)
|
Q_PROPERTY(QStringList filters READ filters WRITE setFilters)
|
||||||
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
|
|
||||||
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
|
||||||
Q_PROPERTY(bool output READ hasOutput WRITE setHasOutput)
|
|
||||||
Q_PROPERTY(int interval READ interval WRITE setInterval)
|
Q_PROPERTY(int interval READ interval WRITE setInterval)
|
||||||
|
Q_PROPERTY(QString name READ name WRITE setName)
|
||||||
|
Q_PROPERTY(int number READ number WRITE setNumber)
|
||||||
|
Q_PROPERTY(bool output READ hasOutput WRITE setHasOutput)
|
||||||
|
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
|
||||||
Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect)
|
Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -55,20 +57,23 @@ public:
|
|||||||
QString comment();
|
QString comment();
|
||||||
QString executable();
|
QString executable();
|
||||||
QString fileName();
|
QString fileName();
|
||||||
|
QStringList filters();
|
||||||
|
bool hasOutput();
|
||||||
int interval();
|
int interval();
|
||||||
|
bool isActive();
|
||||||
QString name();
|
QString name();
|
||||||
int number();
|
int number();
|
||||||
QString prefix();
|
QString prefix();
|
||||||
Redirect redirect();
|
Redirect redirect();
|
||||||
|
// derivatives
|
||||||
QString strRedirect();
|
QString strRedirect();
|
||||||
QString tag();
|
QString tag();
|
||||||
bool hasOutput();
|
|
||||||
bool isActive();
|
|
||||||
// set methods
|
// set methods
|
||||||
void setApiVersion(const int _apiVersion = 0);
|
void setApiVersion(const int _apiVersion = 0);
|
||||||
void setActive(const bool _state = true);
|
void setActive(const bool _state = true);
|
||||||
void setComment(const QString _comment = QString("empty"));
|
void setComment(const QString _comment = QString("empty"));
|
||||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||||
|
void setFilters(const QStringList _filters = QStringList());
|
||||||
void setHasOutput(const bool _state = true);
|
void setHasOutput(const bool _state = true);
|
||||||
void setInterval(const int _interval = 1);
|
void setInterval(const int _interval = 1);
|
||||||
void setName(const QString _name = QString("none"));
|
void setName(const QString _name = QString("none"));
|
||||||
@ -76,9 +81,13 @@ public:
|
|||||||
void setPrefix(const QString _prefix = QString(""));
|
void setPrefix(const QString _prefix = QString(""));
|
||||||
void setRedirect(const Redirect _redirect = nothing);
|
void setRedirect(const Redirect _redirect = nothing);
|
||||||
void setStrRedirect(const QString _redirect = QString("nothing"));
|
void setStrRedirect(const QString _redirect = QString("nothing"));
|
||||||
|
// filters
|
||||||
|
QString applyFilters(QString _value);
|
||||||
|
void updateFilter(const QString _filter, const bool _add = true);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
|
void readJsonFilters();
|
||||||
QString run();
|
QString run();
|
||||||
int showConfiguration();
|
int showConfiguration();
|
||||||
bool tryDelete();
|
bool tryDelete();
|
||||||
@ -98,13 +107,16 @@ private:
|
|||||||
bool m_active = true;
|
bool m_active = true;
|
||||||
QString m_comment = QString("empty");
|
QString m_comment = QString("empty");
|
||||||
QString m_executable = QString("/usr/bin/true");
|
QString m_executable = QString("/usr/bin/true");
|
||||||
|
QStringList m_filters = QStringList();
|
||||||
int m_interval = 1;
|
int m_interval = 1;
|
||||||
QString m_name = QString("none");
|
QString m_name = QString("none");
|
||||||
int m_number = -1;
|
int m_number = -1;
|
||||||
bool m_output = true;
|
bool m_output = true;
|
||||||
QString m_prefix = QString("");
|
QString m_prefix = QString("");
|
||||||
Redirect m_redirect = nothing;
|
Redirect m_redirect = nothing;
|
||||||
|
// internal properties
|
||||||
Q_PID childProcess = 0;
|
Q_PID childProcess = 0;
|
||||||
|
QVariantMap jsonFilters = QVariantMap();
|
||||||
int times = 0;
|
int times = 0;
|
||||||
QString value = QString();
|
QString value = QString();
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>420</width>
|
<width>420</width>
|
||||||
<height>304</height>
|
<height>424</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -244,6 +244,105 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_filters">
|
||||||
|
<property name="title">
|
||||||
|
<string>Additional filters</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_colorFilter">
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_colorFilter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_colorFilter">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Wrap colors</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_linesFilter">
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_linesFilter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_linesFilter">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Wrap new lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_spaceFilter">
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_spaceFilter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_spaceFilter">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Wrap spaces</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -303,12 +303,12 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> ExtendedSysMon::getBattery(const QString acpiPath)
|
QVariantMap ExtendedSysMon::getBattery(const QString acpiPath)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "ACPI path" << acpiPath;
|
if (debug) qDebug() << PDEBUG << ":" << "ACPI path" << acpiPath;
|
||||||
|
|
||||||
QMap<QString, QVariant> battery;
|
QVariantMap battery;
|
||||||
battery[QString("ac")] = false;
|
battery[QString("ac")] = false;
|
||||||
battery[QString("bat")] = 0;
|
battery[QString("bat")] = 0;
|
||||||
QFile acFile(acpiPath + QString("/AC/online"));
|
QFile acFile(acpiPath + QString("/AC/online"));
|
||||||
@ -344,13 +344,13 @@ QMap<QString, QVariant> ExtendedSysMon::getBattery(const QString acpiPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> ExtendedSysMon::getCurrentDesktop()
|
QVariantMap ExtendedSysMon::getCurrentDesktop()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
int number = KWindowSystem::currentDesktop();
|
int number = KWindowSystem::currentDesktop();
|
||||||
int total = KWindowSystem::numberOfDesktops();
|
int total = KWindowSystem::numberOfDesktops();
|
||||||
QMap<QString, QVariant> currentDesktop;
|
QVariantMap currentDesktop;
|
||||||
currentDesktop[QString("currentName")] = KWindowSystem::desktopName(number);
|
currentDesktop[QString("currentName")] = KWindowSystem::desktopName(number);
|
||||||
currentDesktop[QString("currentNumber")] = number;
|
currentDesktop[QString("currentNumber")] = number;
|
||||||
QStringList list;
|
QStringList list;
|
||||||
@ -499,17 +499,15 @@ QString ExtendedSysMon::getNetworkDevice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> ExtendedSysMon::getPlayerInfo(const QString playerName,
|
QVariantMap ExtendedSysMon::getPlayerInfo(const QString playerName, const QString mpdAddress,
|
||||||
const QString mpdAddress,
|
const QString mpdPort, QString mpris)
|
||||||
const QString mpdPort,
|
|
||||||
QString mpris)
|
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "player" << playerName;
|
if (debug) qDebug() << PDEBUG << ":" << "player" << playerName;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "MPD" << mpdAddress + QString(":") + mpdPort;
|
if (debug) qDebug() << PDEBUG << ":" << "MPD" << QString("%1:%2").arg(mpdAddress).arg(mpdPort);
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "MPRIS" << mpris;
|
if (debug) qDebug() << PDEBUG << ":" << "MPRIS" << mpris;
|
||||||
|
|
||||||
QMap<QString, QVariant> info;
|
QVariantMap info;
|
||||||
info[QString("album")] = QString("unknown");
|
info[QString("album")] = QString("unknown");
|
||||||
info[QString("artist")] = QString("unknown");
|
info[QString("artist")] = QString("unknown");
|
||||||
info[QString("duration")] = QString("0");
|
info[QString("duration")] = QString("0");
|
||||||
@ -530,13 +528,12 @@ QMap<QString, QVariant> ExtendedSysMon::getPlayerInfo(const QString playerName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress,
|
QVariantMap ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress, const QString mpdPort)
|
||||||
const QString mpdPort)
|
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "MPD" << mpdAddress + QString(":") + mpdPort;
|
if (debug) qDebug() << PDEBUG << ":" << "MPD" << QString("%1:%2").arg(mpdAddress).arg(mpdPort);
|
||||||
|
|
||||||
QMap<QString, QVariant> info;
|
QVariantMap info;
|
||||||
info[QString("album")] = QString("unknown");
|
info[QString("album")] = QString("unknown");
|
||||||
info[QString("artist")] = QString("unknown");
|
info[QString("artist")] = QString("unknown");
|
||||||
info[QString("duration")] = QString("0");
|
info[QString("duration")] = QString("0");
|
||||||
@ -572,12 +569,12 @@ QMap<QString, QVariant> ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddres
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> ExtendedSysMon::getPlayerMprisInfo(const QString mpris)
|
QVariantMap ExtendedSysMon::getPlayerMprisInfo(const QString mpris)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << "MPRIS" << mpris;
|
if (debug) qDebug() << PDEBUG << "MPRIS" << mpris;
|
||||||
|
|
||||||
QMap<QString, QVariant> info;
|
QVariantMap info;
|
||||||
info[QString("album")] = QString("unknown");
|
info[QString("album")] = QString("unknown");
|
||||||
info[QString("artist")] = QString("unknown");
|
info[QString("artist")] = QString("unknown");
|
||||||
info[QString("duration")] = 0;
|
info[QString("duration")] = 0;
|
||||||
@ -622,7 +619,7 @@ QMap<QString, QVariant> ExtendedSysMon::getPlayerMprisInfo(const QString mpris)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> ExtendedSysMon::getPsStats()
|
QVariantMap ExtendedSysMon::getPsStats()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
@ -641,7 +638,7 @@ QMap<QString, QVariant> ExtendedSysMon::getPsStats()
|
|||||||
if (output.contains(QString("running"))) running.append(cmdFile.readAll());
|
if (output.contains(QString("running"))) running.append(cmdFile.readAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QVariant> psStats;
|
QVariantMap psStats;
|
||||||
psStats[QString("pscount")] = running.count();
|
psStats[QString("pscount")] = running.count();
|
||||||
psStats[QString("ps")] = running.join(QString(","));
|
psStats[QString("ps")] = running.join(QString(","));
|
||||||
psStats[QString("pstotal")] = directories.count();
|
psStats[QString("pstotal")] = directories.count();
|
||||||
@ -665,7 +662,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << source;
|
if (debug) qDebug() << PDEBUG << ":" << "Source" << source;
|
||||||
|
|
||||||
if (source == QString("battery")) {
|
if (source == QString("battery")) {
|
||||||
QMap<QString, QVariant> battery = getBattery(configuration[QString("ACPIPATH")]);
|
QVariantMap battery = getBattery(configuration[QString("ACPIPATH")]);
|
||||||
setData(source, QString("ac"), battery[QString("ac")].toBool());
|
setData(source, QString("ac"), battery[QString("ac")].toBool());
|
||||||
for (int i=0; i<battery.keys().count(); i++) {
|
for (int i=0; i<battery.keys().count(); i++) {
|
||||||
if (battery.keys()[i] == QString("ac")) continue;
|
if (battery.keys()[i] == QString("ac")) continue;
|
||||||
@ -675,7 +672,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
for (int i=0; i<externalScripts.count(); i++)
|
for (int i=0; i<externalScripts.count(); i++)
|
||||||
setData(source, externalScripts[i]->tag(), externalScripts[i]->run());
|
setData(source, externalScripts[i]->tag(), externalScripts[i]->run());
|
||||||
} else if (source == QString("desktop")) {
|
} else if (source == QString("desktop")) {
|
||||||
QMap<QString, QVariant> desktop = getCurrentDesktop();
|
QVariantMap desktop = getCurrentDesktop();
|
||||||
for (int i=0; i<desktop.keys().count(); i++)
|
for (int i=0; i<desktop.keys().count(); i++)
|
||||||
setData(source, desktop.keys()[i], desktop[desktop.keys()[i]]);
|
setData(source, desktop.keys()[i], desktop[desktop.keys()[i]]);
|
||||||
} else if (source == QString("gpu")) {
|
} else if (source == QString("gpu")) {
|
||||||
@ -697,22 +694,28 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
for (int i=0; i<externalUpgrade.count(); i++)
|
for (int i=0; i<externalUpgrade.count(); i++)
|
||||||
setData(source, externalUpgrade[i]->tag(), externalUpgrade[i]->run());
|
setData(source, externalUpgrade[i]->tag(), externalUpgrade[i]->run());
|
||||||
} else if (source == QString("player")) {
|
} else if (source == QString("player")) {
|
||||||
QMap<QString, QVariant> player = getPlayerInfo(configuration[QString("PLAYER")],
|
QVariantMap player = getPlayerInfo(configuration[QString("PLAYER")],
|
||||||
configuration[QString("MPDADDRESS")],
|
configuration[QString("MPDADDRESS")],
|
||||||
configuration[QString("MPDPORT")],
|
configuration[QString("MPDPORT")],
|
||||||
configuration[QString("MPRIS")]);
|
configuration[QString("MPRIS")]);
|
||||||
for (int i=0; i<player.keys().count(); i++)
|
for (int i=0; i<player.keys().count(); i++)
|
||||||
setData(source, player.keys()[i], player[player.keys()[i]]);
|
setData(source, player.keys()[i], player[player.keys()[i]]);
|
||||||
} else if (source == QString("ps")) {
|
} else if (source == QString("ps")) {
|
||||||
QMap<QString, QVariant> ps = getPsStats();
|
QVariantMap ps = getPsStats();
|
||||||
for (int i=0; i<ps.keys().count(); i++)
|
for (int i=0; i<ps.keys().count(); i++)
|
||||||
setData(source, ps.keys()[i], ps[ps.keys()[i]]);
|
setData(source, ps.keys()[i], ps[ps.keys()[i]]);
|
||||||
} else if (source == QString("quotes")) {
|
} else if (source == QString("quotes")) {
|
||||||
for (int i=0; i<externalQuotes.count(); i++) {
|
for (int i=0; i<externalQuotes.count(); i++) {
|
||||||
QMap<QString, float> data = externalQuotes[i]->run();
|
QMap<QString, float> data = externalQuotes[i]->run();
|
||||||
setData(source, externalQuotes[i]->tag(QString("ask")), data[QString("ask")]);
|
setData(source, externalQuotes[i]->tag(QString("ask")), data[QString("ask")]);
|
||||||
|
setData(source, externalQuotes[i]->tag(QString("askchg")), data[QString("askchg")]);
|
||||||
|
setData(source, externalQuotes[i]->tag(QString("percaskchg")), data[QString("percaskchg")]);
|
||||||
setData(source, externalQuotes[i]->tag(QString("bid")), data[QString("bid")]);
|
setData(source, externalQuotes[i]->tag(QString("bid")), data[QString("bid")]);
|
||||||
|
setData(source, externalQuotes[i]->tag(QString("bidchg")), data[QString("bidchg")]);
|
||||||
|
setData(source, externalQuotes[i]->tag(QString("percbidchg")), data[QString("percbidchg")]);
|
||||||
setData(source, externalQuotes[i]->tag(QString("price")), data[QString("price")]);
|
setData(source, externalQuotes[i]->tag(QString("price")), data[QString("price")]);
|
||||||
|
setData(source, externalQuotes[i]->tag(QString("pricechg")), data[QString("pricechg")]);
|
||||||
|
setData(source, externalQuotes[i]->tag(QString("percpricechg")), data[QString("percpricechg")]);
|
||||||
}
|
}
|
||||||
} else if (source == QString("update")) {
|
} else if (source == QString("update")) {
|
||||||
setData(source, QString("value"), true);
|
setData(source, QString("value"), true);
|
||||||
|
@ -33,20 +33,20 @@ public:
|
|||||||
explicit ExtendedSysMon(QObject *parent, const QVariantList &args);
|
explicit ExtendedSysMon(QObject *parent, const QVariantList &args);
|
||||||
~ExtendedSysMon();
|
~ExtendedSysMon();
|
||||||
// update functions
|
// update functions
|
||||||
QMap<QString, QVariant> getBattery(const QString acpiPath);
|
QVariantMap getBattery(const QString acpiPath);
|
||||||
QMap<QString, QVariant> getCurrentDesktop();
|
QVariantMap getCurrentDesktop();
|
||||||
float getGpu(const QString device);
|
float getGpu(const QString device);
|
||||||
float getGpuTemp(const QString device);
|
float getGpuTemp(const QString device);
|
||||||
float getHddTemp(const QString cmd, const QString device);
|
float getHddTemp(const QString cmd, const QString device);
|
||||||
QString getNetworkDevice();
|
QString getNetworkDevice();
|
||||||
QMap<QString, QVariant> getPlayerInfo(const QString playerName,
|
QVariantMap getPlayerInfo(const QString playerName,
|
||||||
const QString mpdAddress = QString(),
|
const QString mpdAddress = QString(),
|
||||||
const QString mpdPort = QString(),
|
const QString mpdPort = QString(),
|
||||||
const QString mpris = QString());
|
const QString mpris = QString());
|
||||||
QMap<QString, QVariant> getPlayerMpdInfo(const QString mpdAddress = QString(),
|
QVariantMap getPlayerMpdInfo(const QString mpdAddress = QString(),
|
||||||
const QString mpdPort = QString());
|
const QString mpdPort = QString());
|
||||||
QMap<QString, QVariant> getPlayerMprisInfo(const QString mpris = QString());
|
QVariantMap getPlayerMprisInfo(const QString mpris = QString());
|
||||||
QMap<QString, QVariant> getPsStats();
|
QVariantMap getPsStats();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool sourceRequestEvent(const QString &source);
|
bool sourceRequestEvent(const QString &source);
|
||||||
|
@ -4,6 +4,6 @@ Name=AAPL.NASDAQ
|
|||||||
Comment=Apple Inc
|
Comment=Apple Inc
|
||||||
X-AW-Ticker="AAPL"
|
X-AW-Ticker="AAPL"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=0
|
X-AW-Number=0
|
||||||
|
@ -4,6 +4,6 @@ Name=EUR/RUB
|
|||||||
Comment=EUR/RUB
|
Comment=EUR/RUB
|
||||||
X-AW-Ticker="EURRUB=X"
|
X-AW-Ticker="EURRUB=X"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=1
|
X-AW-Number=1
|
||||||
|
@ -4,6 +4,6 @@ Name=EUR/USD
|
|||||||
Comment=EUR/USD
|
Comment=EUR/USD
|
||||||
X-AW-Ticker="EURUSD=X"
|
X-AW-Ticker="EURUSD=X"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=2
|
X-AW-Number=2
|
||||||
|
@ -4,6 +4,6 @@ Name=GOOG.NASDAQ
|
|||||||
Comment=Google Inc
|
Comment=Google Inc
|
||||||
X-AW-Ticker="GOOG"
|
X-AW-Ticker="GOOG"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=3
|
X-AW-Number=3
|
||||||
|
@ -4,6 +4,6 @@ Name=MSFT.NASDAQ
|
|||||||
Comment=Microsoft Corp
|
Comment=Microsoft Corp
|
||||||
X-AW-Ticker="MSFT"
|
X-AW-Ticker="MSFT"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=4
|
X-AW-Number=4
|
||||||
|
@ -4,6 +4,6 @@ Name=RTS
|
|||||||
Comment=RTS Index
|
Comment=RTS Index
|
||||||
X-AW-Ticker="RTS.RS"
|
X-AW-Ticker="RTS.RS"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=5
|
X-AW-Number=5
|
||||||
|
@ -4,6 +4,6 @@ Name=S&P
|
|||||||
Comment=S&P 500 Index
|
Comment=S&P 500 Index
|
||||||
X-AW-Ticker="^GSPC"
|
X-AW-Ticker="^GSPC"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=6
|
X-AW-Number=6
|
||||||
|
@ -4,6 +4,6 @@ Name=USD/RUB
|
|||||||
Comment=USD/RUB
|
Comment=USD/RUB
|
||||||
X-AW-Ticker="USDRUB=X"
|
X-AW-Ticker="USDRUB=X"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=8
|
X-AW-Number=8
|
||||||
|
@ -4,6 +4,6 @@ Name=VIX
|
|||||||
Comment=Volatility S&P 500
|
Comment=Volatility S&P 500
|
||||||
X-AW-Ticker="^VIX"
|
X-AW-Ticker="^VIX"
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=2
|
||||||
X-AW-Interval=60
|
X-AW-Interval=60
|
||||||
X-AW-Number=7
|
X-AW-Number=7
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"color": {
|
||||||
|
"\u001b[0;30m": "<span style=\"color:'#000000';\">",
|
||||||
|
"\u001b[1;30m": "<span style=\"color:'#808080';\">",
|
||||||
|
"\u001b[0;31m": "<span style=\"color:'#800000';\">",
|
||||||
|
"\u001b[1;31m": "<span style=\"color:'#ff0000';\">",
|
||||||
|
"\u001b[0;32m": "<span style=\"color:'#008000';\">",
|
||||||
|
"\u001b[1;32m": "<span style=\"color:'#00ff00';\">",
|
||||||
|
"\u001b[0;33m": "<span style=\"color:'#808000';\">",
|
||||||
|
"\u001b[1;33m": "<span style=\"color:'#ffff00';\">",
|
||||||
|
"\u001b[0;34m": "<span style=\"color:'#000080';\">",
|
||||||
|
"\u001b[1;34m": "<span style=\"color:'#0000ff';\">",
|
||||||
|
"\u001b[0;35m": "<span style=\"color:'#800080';\">",
|
||||||
|
"\u001b[1;35m": "<span style=\"color:'#ff00ff';\">",
|
||||||
|
"\u001b[0;36m": "<span style=\"color:'#008080';\">",
|
||||||
|
"\u001b[1;36m": "<span style=\"color:'#00ffff';\">",
|
||||||
|
"\u001b[0;37m": "<span style=\"color:'#c0c0c0';\">",
|
||||||
|
"\u001b[1;37m": "<span style=\"color:'#ffffff';\">",
|
||||||
|
"\u001b[0m": "</span>"
|
||||||
|
},
|
||||||
|
"newline": {
|
||||||
|
"\n": "<br>",
|
||||||
|
"\n\r": "<br>",
|
||||||
|
"\t": "	",
|
||||||
|
"\v": ""
|
||||||
|
},
|
||||||
|
"space": {
|
||||||
|
" ": " "
|
||||||
|
}
|
||||||
|
}
|
@ -8,5 +8,6 @@ X-AW-Active=true
|
|||||||
X-AW-Output=true
|
X-AW-Output=true
|
||||||
X-AW-Redirect=nothing
|
X-AW-Redirect=nothing
|
||||||
X-AW-Interval=1
|
X-AW-Interval=1
|
||||||
X-AW-ApiVersion=2
|
X-AW-ApiVersion=3
|
||||||
X-AW-Number=0
|
X-AW-Number=0
|
||||||
|
X-AW-Filters=
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
// graphical items api version
|
// graphical items api version
|
||||||
#define AWGIAPI 1
|
#define AWGIAPI 1
|
||||||
// extquotes api version
|
// extquotes api version
|
||||||
#define AWEQAPI 1
|
#define AWEQAPI 2
|
||||||
// extscript api version
|
// extscript api version
|
||||||
#define AWESAPI 2
|
#define AWESAPI 3
|
||||||
// extupgrade api version
|
// extupgrade api version
|
||||||
#define AWEUAPI 2
|
#define AWEUAPI 2
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user