mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-06-29 15:15:45 +00:00
Compare commits
41 Commits
Author | SHA1 | Date | |
---|---|---|---|
24b143f43a | |||
df473c53b5 | |||
3122c2fa8c | |||
08cb7d9abe | |||
e38863ebc2 | |||
1cddf6f14d | |||
7405b2ba1d | |||
6fbe897b27 | |||
5f7c35a37c | |||
6173b60806 | |||
4c9e39ec9b | |||
429393998c | |||
c9acb0bdcd | |||
16305a91c4 | |||
bbb9aa0747 | |||
983b808247 | |||
c61a5ac092 | |||
3b6df44489 | |||
4742617e3e | |||
880a986782 | |||
b699095f38 | |||
a065e96bc3 | |||
1110929b14 | |||
c7d998eb12 | |||
eb63ef5e96 | |||
327d5a7ff9 | |||
2b9505207c | |||
cd36c4ed68 | |||
903a1a454d | |||
cf5d713d2e | |||
467a3bf508 | |||
4e78e0e1dd | |||
d01fb91e36 | |||
61ed3a444f | |||
494590475a | |||
27ab7d9cd7 | |||
1869a68122 | |||
aa0a4b417d | |||
41deb8ef72 | |||
aa15e13713 | |||
ad63f78929 |
32
CHANGELOG
32
CHANGELOG
@ -1,3 +1,35 @@
|
||||
Ver.2.4.0:
|
||||
+ add support of weather items
|
||||
+ add support of load average (la1, la5, la15 tags)
|
||||
+ add "drop key cache" button
|
||||
+ add support of clang building
|
||||
+ create ExtItems aggregator
|
||||
+ add time to debug information
|
||||
+ add ability to disable player monitor
|
||||
- fix bug with invalid network data calculation
|
||||
- fix warning with fond dialog init
|
||||
* rewrite ExtItems to use own abstract class
|
||||
* improve work with data updating (#57)
|
||||
* move to signal-slot interface painting
|
||||
* move plugin part back to private
|
||||
* cast plugin as type, not signleton (#57)
|
||||
* change logic in data building inside DataEngine
|
||||
* edit build and drop different DataEngine packaging
|
||||
* rewrite QMap to QHash if possible
|
||||
* rewrite to use iterators if possible
|
||||
* list of desktops is now represented as QStringList
|
||||
* refactoring
|
||||
|
||||
Ver.2.3.3:
|
||||
* change text rendering from Qt to native
|
||||
|
||||
Ver.2.3.2:
|
||||
+ change network speed units from KB/s to MB/s if value is more than 1000 KB/s (metrics are the same)
|
||||
- fix bug with no actions on link activation (thanks to infans)
|
||||
* improve quotes support, e.g. fix plasma crash
|
||||
* rewrite main widget to signal-slot update model
|
||||
* improve battery calculation for system which has several batteries
|
||||
|
||||
Ver.2.3.1:
|
||||
- fix bug with no updates from configuration UI
|
||||
- fix invalid vertical tab parsing
|
||||
|
32
CHANGELOG-RU
32
CHANGELOG-RU
@ -1,3 +1,35 @@
|
||||
Вер.2.4.0:
|
||||
+ добавлена поддержка погоды
|
||||
+ добавлена поддержка LA (теги la1, la5, la15)
|
||||
+ добавлена кнопка "Сбросить кеш"
|
||||
+ добавлена поддержка сборки с clang
|
||||
+ добавлен ExtItem агрегатор
|
||||
+ добавлено время в дебаг вывод
|
||||
+ добавлена возможность отключить монитор плеера
|
||||
- исправлен баг с неправильным расчетам скорости сети
|
||||
- исправлен баг с неправильной инициализацией диалога шрифтов
|
||||
* переписаны ExtItems для использования собственного абстрактного класса
|
||||
* улучшена работа с обновлениями виджета (#57)
|
||||
* рисование интерфейса переписано на модель сигнал-слот
|
||||
* плагин опять стал приватным
|
||||
* исправлен каст плагина с синглтона (#57)
|
||||
* изменена логика показа данных в DataEngine
|
||||
* изменена сборка пакета и прекращена поддержка отдельного пакета с DataEngine
|
||||
* замена QMap на QHash, если возможно
|
||||
* замена циклов на итераторы, если возможно
|
||||
* список рабочий столов сейчас представлен, как QStringList
|
||||
* рефакторинг
|
||||
|
||||
Вер.2.3.3:
|
||||
* изменен рендеринг с Qt на нативный
|
||||
|
||||
Вер.2.3.2:
|
||||
+ добавлено изменение скорости интернета с KB/s на MB/s, если величина более 1000 KB/s
|
||||
- пофикшен баг с отсутствием действия при активации ссылки (спасибо infans)
|
||||
* улучшена поддержка котировок, например пофикшен возможный сегфолт плазмы
|
||||
* переписать основной виджет к модели сигнал-слот
|
||||
* улучшена поддержка расчета заряда батареи для нескольких батарей
|
||||
|
||||
Вер.2.3.1:
|
||||
- пофикшен баг с отсутствием обновлений значений из настроек
|
||||
- убрана поддержка фильтра `\t`
|
||||
|
@ -35,7 +35,7 @@ Optional dependencies
|
||||
* proprietary video driver
|
||||
* hddtemp
|
||||
* smartmontools
|
||||
* music player (mpd or supported MPRIS)
|
||||
* music player (mpd or MPRIS supported)
|
||||
|
||||
Make dependencies
|
||||
-----------------
|
||||
@ -53,7 +53,7 @@ Installation
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../
|
||||
make && sudo make install
|
||||
|
||||
**NOTE** on Plasma 5 it may require `-DKDE_INSTALL_USE_QT_SYS_PATHS=ON` flag
|
||||
**NOTE** on Plasma 5 it very likely requires `-DKDE_INSTALL_USE_QT_SYS_PATHS=ON` flag
|
||||
|
||||
Additional information
|
||||
======================
|
||||
@ -72,4 +72,4 @@ Links
|
||||
* 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)
|
||||
* Archlinux [AUR](https://aur.archlinux.org/packages/plasma5-applet-awesome-widgets/) package
|
||||
* [OpenSuse](http://software.opensuse.org/package/awesome-widgets) package
|
||||
* [OpenSuse](http://software.opensuse.org/search?q=awesome-widgets) packages, [KF5 OpenSuse](http://software.opensuse.org/package/plasma5-awesome-widgets) package
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
pkgname=plasma5-applet-awesome-widgets
|
||||
_pkgname=awesome-widgets
|
||||
pkgver=2.3.1
|
||||
pkgver=2.4.0
|
||||
pkgrel=1
|
||||
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||
arch=('i686' 'x86_64')
|
||||
@ -17,7 +17,7 @@ optdepends=("catalyst: for GPU monitor"
|
||||
makedepends=('cmake' 'extra-cmake-modules')
|
||||
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
||||
install=${pkgname}.install
|
||||
md5sums=('90e640b6679b4cf0f6f99cf6da2848f3')
|
||||
md5sums=('9b870da6ecefef584f11b6ba6bf9a397')
|
||||
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
||||
|
||||
prepare() {
|
||||
|
@ -17,7 +17,7 @@ optdepends=("amarok: for music player monitor"
|
||||
"mpd: for music player monitor"
|
||||
"nvidia-utils: for GPU monitor"
|
||||
"qmmp: for music player monitor")
|
||||
makedepends=('cmake' 'extra-cmake-modules')
|
||||
makedepends=('cmake' 'extra-cmake-modules' 'git')
|
||||
source=(${_pkgname}::git+https://github.com/arcan1s/awesome-widgets/)
|
||||
install=${pkgname}.install
|
||||
md5sums=('SKIP')
|
||||
|
@ -1,23 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
SRCDIR="sources"
|
||||
MAJOR=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||
MINOR=$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||
PATCH=$(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||
MAJOR=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $2}' | sed 's/.$//g')
|
||||
MINOR=$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $2}' | sed 's/.$//g')
|
||||
PATCH=$(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $2}' | sed 's/.$//g')
|
||||
VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||
|
||||
# update submodules
|
||||
git submodule update --init --recursive
|
||||
|
||||
# build dataengine
|
||||
ARCHIVE="extsysmon"
|
||||
# create archive
|
||||
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f ${ARCHIVE}-${VERSION}-src.tar.xz
|
||||
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
||||
cp -r "${SRCDIR}/${ARCHIVE}" "${ARCHIVE}"
|
||||
tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
||||
rm -rf "${ARCHIVE}"
|
||||
|
||||
# build widget
|
||||
ARCHIVE="awesome-widgets"
|
||||
FILES="AUTHORS CHANGELOG CHANGELOG-RU COPYING"
|
||||
|
@ -8,7 +8,7 @@ ProjectRootRelative=./
|
||||
|
||||
[CMake][CMake Build Directory 0]
|
||||
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
||||
Build Type=Release
|
||||
Build Type=Debug
|
||||
CMake Binary=file:///usr/bin/cmake
|
||||
Environment Profile=
|
||||
Extra Arguments=
|
||||
|
2
sources/3rdparty/pdebug
vendored
2
sources/3rdparty/pdebug
vendored
Submodule sources/3rdparty/pdebug updated: 294a590bb9...75e4a0df83
18
sources/3rdparty/qreplytimeout/qreplytimeout.cpp
vendored
Normal file
18
sources/3rdparty/qreplytimeout/qreplytimeout.cpp
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
#include "qreplytimeout.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
QReplyTimeout::QReplyTimeout(QNetworkReply *reply, const int timeout)
|
||||
: QObject(reply)
|
||||
{
|
||||
QTimer::singleShot(timeout, this, SLOT(timeout()));
|
||||
}
|
||||
|
||||
|
||||
void QReplyTimeout::timeout()
|
||||
{
|
||||
QNetworkReply *reply = static_cast<QNetworkReply *>(parent());
|
||||
if (reply->isRunning())
|
||||
reply->close();
|
||||
}
|
17
sources/3rdparty/qreplytimeout/qreplytimeout.h
vendored
Normal file
17
sources/3rdparty/qreplytimeout/qreplytimeout.h
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// from here http://codereview.stackexchange.com/questions/30031/qnetworkreply-network-reply-timeout-helper
|
||||
// no license provided
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class QReplyTimeout : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QReplyTimeout(QNetworkReply *reply, const int timeout);
|
||||
|
||||
public slots:
|
||||
void timeout();
|
||||
};
|
@ -1,46 +1,63 @@
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
cmake_policy (SET CMP0003 OLD)
|
||||
cmake_policy (SET CMP0002 OLD)
|
||||
cmake_policy (SET CMP0011 NEW)
|
||||
cmake_policy (SET CMP0015 NEW)
|
||||
# some fucking magic
|
||||
cmake_policy(SET CMP0003 OLD)
|
||||
cmake_policy(SET CMP0002 OLD)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
if (POLICY CMP0063)
|
||||
cmake_policy(SET CMP0063 OLD)
|
||||
endif()
|
||||
|
||||
project (awesomewidgets)
|
||||
set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||
set (PROJECT_LICENSE "GPLv3")
|
||||
set (PROJECT_VERSION_MAJOR 2)
|
||||
set (PROJECT_VERSION_MINOR 3)
|
||||
set (PROJECT_VERSION_PATCH 1)
|
||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||
project(awesomewidgets)
|
||||
set(PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||
set(PROJECT_CONTACT "esalexeev@gmail.com")
|
||||
set(PROJECT_LICENSE "GPL3")
|
||||
set(PROJECT_VERSION_MAJOR 2)
|
||||
set(PROJECT_VERSION_MINOR 4)
|
||||
set(PROJECT_VERSION_PATCH 0)
|
||||
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_YEAR "%Y")
|
||||
string(TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
||||
string(TIMESTAMP CURRENT_YEAR "%Y")
|
||||
|
||||
message (STATUS "Project: ${PROJECT_NAME}")
|
||||
message (STATUS "Version: ${PROJECT_VERSION}")
|
||||
message (STATUS "Build date: ${CURRENT_DATE}")
|
||||
message(STATUS "Project: ${PROJECT_NAME}")
|
||||
message(STATUS "Version: ${PROJECT_VERSION}")
|
||||
message(STATUS "Build date: ${CURRENT_DATE}")
|
||||
|
||||
option(BUILD_PLASMOIDS "Build plasmoids" ON)
|
||||
|
||||
# flags
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
# avoid newer gcc warnings
|
||||
add_definitions (-D_DEFAULT_SOURCE)
|
||||
else ()
|
||||
message (STATUS "Unknown compiler")
|
||||
endif ()
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set (CMAKE_VERBOSE_MAKEFILE ON)
|
||||
endif ()
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
# avoid newer gcc warnings
|
||||
add_definitions(-D_DEFAULT_SOURCE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -stdlib=libc++")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
# linker flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lc++abi")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "-lc++abi")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-lc++abi")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown compiler")
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
endif()
|
||||
|
||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
set(PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
||||
set(PROJECT_LIBRARY awesomewidgets)
|
||||
include(libraries.cmake)
|
||||
|
||||
add_subdirectory (extsysmon)
|
||||
add_subdirectory (awesome-widget)
|
||||
add_subdirectory (desktop-panel)
|
||||
|
||||
# translations
|
||||
add_subdirectory (translations)
|
||||
add_subdirectory(awesomewidgets)
|
||||
add_subdirectory(extsysmon)
|
||||
if(BUILD_PLASMOIDS)
|
||||
add_subdirectory(awesome-widget)
|
||||
add_subdirectory(desktop-panel)
|
||||
add_subdirectory(translations)
|
||||
endif()
|
||||
|
@ -1,19 +1,7 @@
|
||||
# set project name
|
||||
set (SUBPROJECT plasma_applet_awesome-widget)
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
set(SUBPROJECT plasma_applet_awesome-widget)
|
||||
message(STATUS "Subproject ${SUBPROJECT}")
|
||||
|
||||
# prepare
|
||||
configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||
configure_file(metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||
|
||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
|
||||
find_package (Qt5 REQUIRED COMPONENTS Core Network Qml)
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
add_subdirectory (plugin)
|
||||
plasma_install_package (package org.kde.plasma.awesomewidget)
|
||||
add_subdirectory(plugin)
|
||||
plasma_install_package(package org.kde.plasma.awesomewidget)
|
||||
|
@ -19,17 +19,21 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: aboutPage
|
||||
AWActions {
|
||||
id: awActions;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property bool debug: awActions.isDebugEnabled()
|
||||
|
||||
|
||||
Column {
|
||||
@ -45,26 +49,27 @@ Item {
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: AWActions.getAboutText("header")
|
||||
text: awActions.getAboutText("header")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: AWActions.getAboutText("version")
|
||||
text: awActions.getAboutText("version")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: AWActions.getAboutText("description")
|
||||
text: awActions.getAboutText("description")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("links")
|
||||
text: awActions.getAboutText("links")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
@ -74,7 +79,7 @@ Item {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignBottom
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("copy")
|
||||
text: awActions.getAboutText("copy")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,7 +92,7 @@ Item {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: AWActions.getAboutText("translators")
|
||||
text: awActions.getAboutText("translators")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
@ -96,7 +101,8 @@ Item {
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
verticalAlignment: Text.AlignTop
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("3rdparty")
|
||||
text: awActions.getAboutText("3rdparty")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,17 +18,22 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: advancedPage
|
||||
// backend
|
||||
AWActions {
|
||||
id: awActions;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property bool debug: awActions.isDebugEnabled()
|
||||
|
||||
property alias cfg_height: widgetHeight.value
|
||||
property alias cfg_width: widgetWidth.value
|
||||
@ -249,6 +254,21 @@ Item {
|
||||
text: plasmoid.configuration.acOffline
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectFont
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Drop key cache")
|
||||
onClicked: awActions.dropCache()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
@ -20,17 +20,22 @@ import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: appearancePage
|
||||
// backend
|
||||
AWActions {
|
||||
id: awActions;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property bool debug: awActions.isDebugEnabled()
|
||||
property variant weight: {
|
||||
25: 0,
|
||||
50: 1,
|
||||
@ -84,7 +89,10 @@ Item {
|
||||
id: selectFont
|
||||
width: parent.width * 2 / 3
|
||||
text: plasmoid.configuration.fontFamily
|
||||
onClicked: fontDialog.visible = true
|
||||
onClicked: {
|
||||
fontDialog.setFont()
|
||||
fontDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,13 +232,22 @@ Item {
|
||||
QtDialogs.FontDialog {
|
||||
id: fontDialog
|
||||
title: i18n("Select a font")
|
||||
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||
signal setFont
|
||||
|
||||
onAccepted: {
|
||||
selectFont.text = fontDialog.font.family
|
||||
fontSize.value = fontDialog.font.pointSize
|
||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||
}
|
||||
onSetFont: {
|
||||
fontDialog.font = Qt.font({
|
||||
family: selectFont.text,
|
||||
pointSize: fontSize.value > 0 ? fontSize.value : 12,
|
||||
italic: fontStyle.currentIndex == 1,
|
||||
weight: Font.Normal,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
@ -21,17 +21,25 @@ import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: dataenginePage
|
||||
// backend
|
||||
AWKeys {
|
||||
id: awKeys;
|
||||
}
|
||||
AWActions {
|
||||
id: awActions;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property bool debug: awActions.isDebugEnabled()
|
||||
property variant tooltipSettings: {
|
||||
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||
@ -53,7 +61,7 @@ Item {
|
||||
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||
}
|
||||
|
||||
property variant cfg_dataengine: AWActions.readDataEngineConfiguration()
|
||||
property variant cfg_dataengine: awActions.readDataEngineConfiguration()
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
@ -87,7 +95,7 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Edit scripts")
|
||||
onClicked: AWKeys.editItem("extscript")
|
||||
onClicked: awKeys.editItem("extscript")
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +136,7 @@ Item {
|
||||
QtControls.ComboBox {
|
||||
id: hdd
|
||||
width: parent.width * 3 / 5
|
||||
model: AWKeys.getHddDevices(true)
|
||||
model: awKeys.getHddDevices(true)
|
||||
Component.onCompleted: {
|
||||
for (var i=0; i<model.length; i++) {
|
||||
if (model[i] == cfg_dataengine["HDDDEV"]) {
|
||||
@ -223,7 +231,7 @@ Item {
|
||||
QtControls.ComboBox {
|
||||
id: player
|
||||
width: parent.width * 3 / 5
|
||||
model: ["mpris", "mpd"]
|
||||
model: ["disable", "mpris", "mpd"]
|
||||
Component.onCompleted: {
|
||||
for (var i=0; i<model.length; i++) {
|
||||
if (model[i] == cfg_dataengine["PLAYER"]) {
|
||||
@ -247,7 +255,7 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Edit tickers")
|
||||
onClicked: AWKeys.editItem("extquotes")
|
||||
onClicked: awKeys.editItem("extquotes")
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,7 +272,24 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Edit command")
|
||||
onClicked: AWKeys.editItem("extupgrade")
|
||||
onClicked: awKeys.editItem("extupgrade")
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Weather")
|
||||
}
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Edit weather")
|
||||
onClicked: awKeys.editItem("extweather")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -273,7 +298,7 @@ Item {
|
||||
if (debug) console.log("[dataengine::onCompleted]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(plasmoid.configuration.text)
|
||||
awKeys.initKeys(plasmoid.configuration.text)
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
@ -283,6 +308,6 @@ Item {
|
||||
cfg_dataengine["HDDDEV"] = hdd.currentText
|
||||
cfg_dataengine["PLAYER"] = player.currentText
|
||||
cfg_dataengine["MPRIS"] = mpris.currentText
|
||||
AWActions.writeDataEngineConfiguration(cfg_dataengine)
|
||||
awActions.writeDataEngineConfiguration(cfg_dataengine)
|
||||
}
|
||||
}
|
||||
|
@ -22,14 +22,21 @@ import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import "."
|
||||
|
||||
|
||||
Item {
|
||||
id: main
|
||||
// backend
|
||||
AWKeys {
|
||||
id: awKeys;
|
||||
}
|
||||
AWActions {
|
||||
id: awActions;
|
||||
}
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property bool debug: awActions.isDebugEnabled()
|
||||
property variant settings: {
|
||||
"customTime": plasmoid.configuration.customTime,
|
||||
"customUptime": plasmoid.configuration.customUptime,
|
||||
@ -55,10 +62,14 @@ Item {
|
||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||
"batInTooltipColor": plasmoid.configuration.batInTooltipColor,
|
||||
// additinal field to parse AC status
|
||||
"acOnline": plasmoid.configuration.acOnline
|
||||
}
|
||||
|
||||
signal needUpdate
|
||||
signal dropSource(string sourceName)
|
||||
signal needTextUpdate(string newText)
|
||||
signal needToolTipUpdate(string newText)
|
||||
signal sizeUpdate
|
||||
|
||||
|
||||
@ -82,16 +93,15 @@ Item {
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
// FIXME: ugly workaround to make some sources working
|
||||
systemmonitorDE.interval = plasmoid.configuration.interval
|
||||
|
||||
if (AWKeys.setDataBySource(sourceName, data, settings)) disconnectSource(sourceName)
|
||||
awKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
|
||||
onSourceAdded: {
|
||||
if (debug) console.log("[main::onSourceAdded] : Source " + source)
|
||||
|
||||
AWKeys.addDevice(source)
|
||||
awKeys.addDevice(source)
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,10 +113,9 @@ Item {
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
// FIXME: ugly workaround to make some sources working
|
||||
extsysmonDE.interval = plasmoid.configuration.interval
|
||||
|
||||
if (AWKeys.setDataBySource(sourceName, data, settings)) needUpdate()
|
||||
awKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,7 +128,7 @@ Item {
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
awKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +137,7 @@ Item {
|
||||
Text {
|
||||
id: text
|
||||
anchors.fill: parent
|
||||
renderType: Text.NativeRendering
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.NoWrap
|
||||
|
||||
@ -164,17 +174,32 @@ Item {
|
||||
// plasmoid.setAction("report", i18n("Mail to developers"), "email")
|
||||
// init submodule
|
||||
Plasmoid.userConfiguringChanged(false)
|
||||
// connect data
|
||||
awKeys.dropSourceFromDataengine.connect(dropSource)
|
||||
awKeys.needTextToBeUpdated.connect(needTextUpdate)
|
||||
awKeys.needToolTipToBeUpdated.connect(needToolTipUpdate)
|
||||
}
|
||||
|
||||
onNeedUpdate: {
|
||||
if (debug) console.log("[main::onNeedUpdate]")
|
||||
onDropSource: {
|
||||
if (debug) console.log("[main::onDropSource]")
|
||||
if (debug) console.log("[main::onDropSource] : Source " + sourceName)
|
||||
|
||||
text.text = AWKeys.parsePattern()
|
||||
tooltip.text = AWKeys.toolTipImage()
|
||||
systemmonitorDE.disconnectSource(sourceName)
|
||||
}
|
||||
|
||||
onNeedTextUpdate: {
|
||||
if (debug) console.log("[main::onNeedTextUpdate]")
|
||||
|
||||
text.text = newText
|
||||
sizeUpdate()
|
||||
}
|
||||
|
||||
onNeedToolTipUpdate: {
|
||||
if (debug) console.log("[main::onNeedToolTipUpdate]")
|
||||
|
||||
tooltip.text = newText
|
||||
}
|
||||
|
||||
onSizeUpdate: {
|
||||
if (debug) console.log("[main::onSizeUpdate]")
|
||||
|
||||
@ -199,35 +224,35 @@ Item {
|
||||
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(plasmoid.configuration.text)
|
||||
AWKeys.initTooltip(tooltipSettings)
|
||||
AWKeys.setPopupEnabled(plasmoid.configuration.notify)
|
||||
AWKeys.setWrapNewLines(plasmoid.configuration.wrapNewLines)
|
||||
awKeys.initKeys(plasmoid.configuration.text)
|
||||
awKeys.initTooltip(tooltipSettings)
|
||||
awKeys.setPopupEnabled(plasmoid.configuration.notify)
|
||||
awKeys.setWrapNewLines(plasmoid.configuration.wrapNewLines)
|
||||
|
||||
needUpdate()
|
||||
needTextUpdate(plasmoid.configuration.text)
|
||||
}
|
||||
|
||||
function action_checkUpdates() {
|
||||
if (debug) console.log("[main::action_checkUpdates]")
|
||||
|
||||
AWActions.checkUpdates()
|
||||
awActions.checkUpdates()
|
||||
}
|
||||
|
||||
function action_showReadme() {
|
||||
if (debug) console.log("[main::action_showReadme]")
|
||||
|
||||
AWActions.showReadme()
|
||||
awActions.showReadme()
|
||||
}
|
||||
|
||||
function action_report() {
|
||||
if (debug) console.log("[main::action_report]")
|
||||
|
||||
AWActions.sendEmail()
|
||||
awActions.sendEmail()
|
||||
}
|
||||
|
||||
function action_requestKey() {
|
||||
if (debug) console.log("[main::action_requestKey]")
|
||||
|
||||
AWKeys.graphicalValueByKey()
|
||||
awKeys.graphicalValueByKey()
|
||||
}
|
||||
}
|
||||
|
@ -20,17 +20,22 @@ import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: tooltipPage
|
||||
// backend
|
||||
AWActions {
|
||||
id: awActions;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property bool debug: awActions.isDebugEnabled()
|
||||
|
||||
property alias cfg_tooltipNumber: tooltipNumber.value
|
||||
property alias cfg_useTooltipBackground: useTooltipBackground.checked
|
||||
|
@ -19,17 +19,25 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: widgetPage
|
||||
// backend
|
||||
AWKeys {
|
||||
id: awKeys;
|
||||
}
|
||||
AWActions {
|
||||
id: awActions;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property bool debug: awActions.isDebugEnabled()
|
||||
property variant settings: {
|
||||
"customTime": plasmoid.configuration.customTime,
|
||||
"customUptime": plasmoid.configuration.customUptime,
|
||||
@ -70,6 +78,7 @@ Item {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Detailed information may be found on <a href=\"http://arcanis.name/projects/awesome-widgets/\">project homepage</a>")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
|
||||
Row {
|
||||
@ -88,7 +97,7 @@ Item {
|
||||
"family": plasmoid.configuration.fontFamily,
|
||||
"size": plasmoid.configuration.fontSize
|
||||
}
|
||||
var font = AWActions.getFont(defaultFont)
|
||||
var font = awActions.getFont(defaultFont)
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
@ -248,10 +257,10 @@ Item {
|
||||
|
||||
var message = i18n("Tag: %1", tags.currentText)
|
||||
message += "<br>"
|
||||
message += i18n("Value: %1", AWKeys.valueByKey(tags.currentText))
|
||||
message += i18n("Value: %1", awKeys.valueByKey(tags.currentText))
|
||||
message += "<br>"
|
||||
message += i18n("Info: %1", AWKeys.infoByKey(tags.currentText))
|
||||
AWActions.sendNotification("tag", message)
|
||||
message += i18n("Info: %1", awKeys.infoByKey(tags.currentText))
|
||||
awActions.sendNotification("tag", message)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -262,7 +271,7 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width
|
||||
text: i18n("Edit bars")
|
||||
onClicked: AWKeys.editItem("graphicalitem")
|
||||
onClicked: awKeys.editItem("graphicalitem")
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +295,7 @@ Item {
|
||||
onNewData: {
|
||||
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
awKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,7 +308,7 @@ Item {
|
||||
onNewData: {
|
||||
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
awKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,7 +321,7 @@ Item {
|
||||
onNewData: {
|
||||
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
awKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +329,7 @@ Item {
|
||||
if (debug) console.log("[widget::onCompleted]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(plasmoid.configuration.text)
|
||||
tags.model = AWKeys.dictKeys(true)
|
||||
awKeys.initKeys(plasmoid.configuration.text)
|
||||
tags.model = awKeys.dictKeys(true)
|
||||
}
|
||||
}
|
||||
|
@ -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=2.3.0
|
||||
X-KDE-PluginInfo-Version=2.4.0
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
|
@ -1,38 +1,25 @@
|
||||
set (PLUGIN_NAME awplugin)
|
||||
set(PLUGIN_NAME awplugin)
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5Qml_INCLUDE_DIRS})
|
||||
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Qml_LIBRARIES})
|
||||
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||
${Notifications_INCLUDE_DIR})
|
||||
set (Kf5_LIBRARIES KF5::I18n
|
||||
KF5::Notifications)
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE}
|
||||
)
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
../../extsysmon
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../extsysmon
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE})
|
||||
file(GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
|
||||
file(GLOB SUBPROJECT_UI *.ui)
|
||||
file(GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
|
||||
# task source is required by extscripts
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
||||
../../extsysmon/extquotes.cpp
|
||||
../../extsysmon/extscript.cpp
|
||||
../../extsysmon/extupgrade.cpp)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
set (SUBPROJECT_DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
qt5_wrap_ui(SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library(${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER})
|
||||
target_link_libraries(${PLUGIN_NAME} ${PROJECT_LIBRARY} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/awesomewidget)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/awesomewidget)
|
||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
install (DIRECTORY ${SUBPROJECT_DESKTOP} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||
install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||
install(FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
@ -67,7 +69,26 @@ void AWActions::checkUpdates()
|
||||
}
|
||||
|
||||
|
||||
void AWActions::runCmd(const QString cmd)
|
||||
bool AWActions::dropCache() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName = QString("%1/awesomewidgets.ndx")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
|
||||
|
||||
return QFile(fileName).remove();
|
||||
}
|
||||
|
||||
|
||||
bool AWActions::isDebugEnabled() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
|
||||
void AWActions::runCmd(const QString cmd) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||
@ -79,13 +100,13 @@ void AWActions::runCmd(const QString cmd)
|
||||
}
|
||||
|
||||
|
||||
void AWActions::sendEmail()
|
||||
void AWActions::sendEmail() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
}
|
||||
|
||||
|
||||
void AWActions::showReadme()
|
||||
void AWActions::showReadme() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -93,7 +114,7 @@ void AWActions::showReadme()
|
||||
}
|
||||
|
||||
|
||||
QString AWActions::getAboutText(const QString type)
|
||||
QString AWActions::getAboutText(const QString type) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
|
||||
@ -122,9 +143,9 @@ QString AWActions::getAboutText(const QString type)
|
||||
QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts);
|
||||
for (int i=0; i<trdPartyList.count(); i++)
|
||||
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)")
|
||||
.arg(trdPartyList[i].split(QChar(','))[0])
|
||||
.arg(trdPartyList[i].split(QChar(','))[1])
|
||||
.arg(trdPartyList[i].split(QChar(','))[2]);
|
||||
.arg(trdPartyList.at(i).split(QChar(','))[0])
|
||||
.arg(trdPartyList.at(i).split(QChar(','))[1])
|
||||
.arg(trdPartyList.at(i).split(QChar(','))[2]);
|
||||
text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
|
||||
}
|
||||
|
||||
@ -132,7 +153,7 @@ QString AWActions::getAboutText(const QString type)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap AWActions::getFont(const QVariantMap defaultFont)
|
||||
QVariantMap AWActions::getFont(const QVariantMap defaultFont) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -150,7 +171,7 @@ QVariantMap AWActions::getFont(const QVariantMap defaultFont)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap AWActions::readDataEngineConfiguration()
|
||||
QVariantMap AWActions::readDataEngineConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -174,7 +195,7 @@ QVariantMap AWActions::readDataEngineConfiguration()
|
||||
}
|
||||
|
||||
|
||||
void AWActions::writeDataEngineConfiguration(const QVariantMap configuration)
|
||||
void AWActions::writeDataEngineConfiguration(const QVariantMap configuration) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -197,7 +218,8 @@ void AWActions::writeDataEngineConfiguration(const QVariantMap configuration)
|
||||
}
|
||||
|
||||
|
||||
void AWActions::sendNotification(const QString eventId, const QString message, const bool enablePopup)
|
||||
void AWActions::sendNotification(const QString eventId, const QString message,
|
||||
const bool enablePopup)
|
||||
{
|
||||
if ((eventId == QString("event")) && (!enablePopup)) return;
|
||||
|
||||
@ -206,7 +228,7 @@ void AWActions::sendNotification(const QString eventId, const QString message, c
|
||||
}
|
||||
|
||||
|
||||
void AWActions::showUpdates(QString version)
|
||||
void AWActions::showUpdates(QString version) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -215,7 +237,8 @@ void AWActions::showUpdates(QString version)
|
||||
text += i18n("New version : %1", version) + QString("\n\n");
|
||||
text += i18n("Click \"Ok\" to download");
|
||||
|
||||
int select = QMessageBox::information(0, i18n("There are updates"), text, QMessageBox::Ok | QMessageBox::Cancel);
|
||||
int select = QMessageBox::information(nullptr, i18n("There are updates"), text,
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
switch (select) {
|
||||
case QMessageBox::Ok:
|
||||
QDesktopServices::openUrl(QString(RELEASES) + version);
|
||||
@ -224,30 +247,32 @@ void AWActions::showUpdates(QString version)
|
||||
}
|
||||
|
||||
|
||||
void AWActions::versionReplyRecieved(QNetworkReply *reply)
|
||||
void AWActions::versionReplyRecieved(QNetworkReply *reply) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString answer = reply->readAll();
|
||||
if (!answer.contains(QString("tag_name"))) return;
|
||||
QString version = QString(VERSION);
|
||||
if (debug) qDebug() << PDEBUG << answer;
|
||||
for (int i=0; i<answer.split(QString("tag_name")).count(); i++) {
|
||||
version = answer.split(QString("tag_name"))[1].split(QChar(','))[0];
|
||||
version.remove(QChar('"'));
|
||||
version.remove(QChar(':'));
|
||||
version.remove(QString("V."));
|
||||
break;
|
||||
QJsonParseError error;
|
||||
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;
|
||||
}
|
||||
|
||||
int old_major = QString(VERSION).split(QChar('.'))[0].toInt();
|
||||
int old_minor = QString(VERSION).split(QChar('.'))[1].toInt();
|
||||
int old_patch = QString(VERSION).split(QChar('.'))[2].toInt();
|
||||
int new_major = QString(version).split(QChar('.'))[0].toInt();
|
||||
int new_minor = QString(version).split(QChar('.'))[1].toInt();
|
||||
int new_patch = QString(version).split(QChar('.'))[2].toInt();
|
||||
// convert to map
|
||||
QVariantMap firstRelease = jsonDoc.toVariant().toList().first().toMap();
|
||||
QString version = firstRelease[QString("tag_name")].toString();
|
||||
version.remove(QString("V."));
|
||||
|
||||
int old_major = QString(VERSION).split(QChar('.')).at(0).toInt();
|
||||
int old_minor = QString(VERSION).split(QChar('.')).at(1).toInt();
|
||||
int old_patch = QString(VERSION).split(QChar('.')).at(2).toInt();
|
||||
int new_major = QString(version).split(QChar('.')).at(0).toInt();
|
||||
int new_minor = QString(version).split(QChar('.')).at(1).toInt();
|
||||
int new_patch = QString(version).split(QChar('.')).at(2).toInt();
|
||||
if ((old_major < new_major) ||
|
||||
((old_major == new_major) && (old_minor < new_minor)) ||
|
||||
((old_major == new_major) && (old_minor == new_minor) && (old_patch < new_patch)))
|
||||
showUpdates(version);
|
||||
return showUpdates(version);
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
#ifndef AWACTIONS_H
|
||||
#define AWACTIONS_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
@ -35,23 +34,25 @@ public:
|
||||
~AWActions();
|
||||
|
||||
Q_INVOKABLE void checkUpdates();
|
||||
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true"));
|
||||
Q_INVOKABLE void sendEmail();
|
||||
Q_INVOKABLE void showReadme();
|
||||
Q_INVOKABLE bool dropCache() const;
|
||||
Q_INVOKABLE bool isDebugEnabled() const;
|
||||
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true")) const;
|
||||
Q_INVOKABLE void sendEmail() const;
|
||||
Q_INVOKABLE void showReadme() const;
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString getAboutText(const QString type = QString("header"));
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont);
|
||||
Q_INVOKABLE QString getAboutText(const QString type = QString("header")) const;
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const;
|
||||
// dataengine
|
||||
Q_INVOKABLE QVariantMap readDataEngineConfiguration();
|
||||
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration);
|
||||
Q_INVOKABLE QVariantMap readDataEngineConfiguration() const;
|
||||
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration) const;
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message,
|
||||
const bool enablePopup = false);
|
||||
|
||||
private slots:
|
||||
void showUpdates(QString version);
|
||||
void versionReplyRecieved(QNetworkReply *reply);
|
||||
void showUpdates(QString version) const;
|
||||
void versionReplyRecieved(QNetworkReply *reply) const;
|
||||
|
||||
private:
|
||||
// variables
|
||||
|
@ -23,28 +23,10 @@
|
||||
#include "awkeys.h"
|
||||
|
||||
|
||||
static QObject *awactions_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
|
||||
return new AWActions();
|
||||
}
|
||||
|
||||
|
||||
static QObject *awkeys_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
|
||||
return new AWKeys();
|
||||
}
|
||||
|
||||
|
||||
void AWPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.awesomewidget"));
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.awesomewidget"));
|
||||
|
||||
qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider);
|
||||
qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider);
|
||||
qmlRegisterType<AWActions>(uri, 1, 0, "AWActions");
|
||||
qmlRegisterType<AWKeys>(uri, 1, 0, "AWKeys");
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,34 +19,25 @@
|
||||
#ifndef AWKEYS_H
|
||||
#define AWKEYS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QListWidget>
|
||||
#include <QMap>
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QPushButton>
|
||||
#include <QVariant>
|
||||
|
||||
#include "extitemaggregator.h"
|
||||
|
||||
|
||||
class AWToolTip;
|
||||
class ExtQuotes;
|
||||
class ExtScript;
|
||||
class ExtUpgrade;
|
||||
class ExtWeather;
|
||||
class GraphicalItem;
|
||||
|
||||
class AWKeys : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum RequestedItem {
|
||||
Nothing,
|
||||
RequestedGraphicalItem,
|
||||
RequestedExtQuotes,
|
||||
RequestedExtScript,
|
||||
RequestedExtUpgrade
|
||||
};
|
||||
|
||||
public:
|
||||
AWKeys(QObject *parent = nullptr);
|
||||
~AWKeys();
|
||||
@ -55,70 +46,56 @@ public:
|
||||
Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams);
|
||||
Q_INVOKABLE void setPopupEnabled(const bool popup = false);
|
||||
Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
|
||||
Q_INVOKABLE bool isDebugEnabled();
|
||||
Q_INVOKABLE QString parsePattern();
|
||||
Q_INVOKABLE QString toolTipImage();
|
||||
Q_INVOKABLE QSize toolTipSize();
|
||||
Q_INVOKABLE QString parsePattern() const;
|
||||
Q_INVOKABLE QSize toolTipSize() const;
|
||||
// keys
|
||||
Q_INVOKABLE void addDevice(const QString source);
|
||||
Q_INVOKABLE QStringList dictKeys(const bool sorted = false);
|
||||
Q_INVOKABLE QStringList getHddDevices();
|
||||
Q_INVOKABLE bool setDataBySource(const QString sourceName, const QVariantMap data,
|
||||
Q_INVOKABLE QStringList dictKeys(const bool sorted = false) const;
|
||||
Q_INVOKABLE QStringList getHddDevices() const;
|
||||
Q_INVOKABLE void setDataBySource(const QString sourceName, const QVariantMap data,
|
||||
const QVariantMap params);
|
||||
// values
|
||||
Q_INVOKABLE void graphicalValueByKey();
|
||||
Q_INVOKABLE QString infoByKey(QString key);
|
||||
Q_INVOKABLE QString valueByKey(QString key);
|
||||
Q_INVOKABLE void graphicalValueByKey() const;
|
||||
Q_INVOKABLE QString infoByKey(QString key) const;
|
||||
Q_INVOKABLE QString valueByKey(QString key) const;
|
||||
// configuration
|
||||
Q_INVOKABLE void editItem(const QString type);
|
||||
|
||||
signals:
|
||||
void dropSourceFromDataengine(const QString source);
|
||||
void needTextToBeUpdated(const QString newText) const;
|
||||
void needToolTipToBeUpdated(const QString newText) const;
|
||||
void needToBeUpdated();
|
||||
|
||||
private slots:
|
||||
void dataUpdate() const;
|
||||
void loadKeysFromCache();
|
||||
void reinitKeys();
|
||||
// editor
|
||||
void editItemButtonPressed(QAbstractButton *button);
|
||||
void copyBar(const QString original);
|
||||
void copyQuotes(const QString original);
|
||||
void copyScript(const QString original);
|
||||
void copyUpgrade(const QString original);
|
||||
|
||||
private:
|
||||
// methods
|
||||
void addKeyToCache(const QString type, const QString key = QString(""));
|
||||
bool checkKeys(const QVariantMap data);
|
||||
QString htmlValue(QString key);
|
||||
int numberCpus();
|
||||
float temperature(const float temp, const QString units);
|
||||
QString htmlValue(QString key) const;
|
||||
int numberCpus() const;
|
||||
float temperature(const float temp, const QString units) const;
|
||||
// find methods
|
||||
QStringList findGraphicalItems();
|
||||
QStringList findKeys();
|
||||
QStringList findGraphicalItems() const;
|
||||
QStringList findKeys() const;
|
||||
// get methods
|
||||
QList<ExtQuotes *> getExtQuotes();
|
||||
QList<ExtScript *> getExtScripts();
|
||||
QList<ExtUpgrade *> getExtUpgrade();
|
||||
QList<GraphicalItem *> getGraphicalItems();
|
||||
GraphicalItem *getItemByTag(const QString tag);
|
||||
QStringList getTimeKeys();
|
||||
GraphicalItem *getItemByTag(const QString tag) const;
|
||||
QStringList getTimeKeys() const;
|
||||
AWToolTip *toolTip = nullptr;
|
||||
// graphical elements
|
||||
QDialog *dialog = nullptr;
|
||||
QListWidget *widgetDialog = nullptr;
|
||||
QDialogButtonBox *dialogButtons = nullptr;
|
||||
QPushButton *copyButton = nullptr;
|
||||
QPushButton *createButton = nullptr;
|
||||
QPushButton *deleteButton = nullptr;
|
||||
RequestedItem requestedItem = Nothing;
|
||||
// variables
|
||||
bool debug = false;
|
||||
bool enablePopup = false;
|
||||
bool wrapNewLines = false;
|
||||
QList<GraphicalItem *> graphicalItems;
|
||||
QList<ExtQuotes *> extQuotes;
|
||||
QList<ExtScript *> extScripts;
|
||||
QList<ExtUpgrade *> extUpgrade;
|
||||
QStringList foundBars, foundKeys, keys;
|
||||
ExtItemAggregator<GraphicalItem> *graphicalItems;
|
||||
ExtItemAggregator<ExtQuotes> *extQuotes;
|
||||
ExtItemAggregator<ExtScript> *extScripts;
|
||||
ExtItemAggregator<ExtUpgrade> *extUpgrade;
|
||||
ExtItemAggregator<ExtWeather> *extWeather;
|
||||
QString pattern;
|
||||
QMap<QString, QString> values;
|
||||
QStringList foundBars, foundKeys, keys;
|
||||
QHash<QString, QString> values;
|
||||
QStringList diskDevices, hddDevices, mountDevices, networkDevices, tempDevices;
|
||||
};
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "awtooltip.h"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QDebug>
|
||||
#include <QProcessEnvironment>
|
||||
#include <math.h>
|
||||
@ -26,14 +27,14 @@
|
||||
|
||||
AWToolTip::AWToolTip(QObject *parent, QVariantMap settings)
|
||||
: QObject(parent),
|
||||
configuration(settings)
|
||||
configuration(qvariant_cast<QVariantHash>(settings))
|
||||
{
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
debug = (debugEnv == QString("yes"));
|
||||
|
||||
toolTipScene = new QGraphicsScene();
|
||||
toolTipScene = new QGraphicsScene(nullptr);
|
||||
toolTipView = new QGraphicsView(toolTipScene);
|
||||
toolTipView->setStyleSheet(QString("background: transparent"));
|
||||
toolTipView->setContentsMargins(0, 0, 0, 0);
|
||||
@ -65,6 +66,9 @@ AWToolTip::AWToolTip(QObject *parent, QVariantMap settings)
|
||||
if (configuration[QString("downTooltip")].toBool()) requiredKeys.append(QString("downTooltip"));
|
||||
if (configuration[QString("upTooltip")].toBool()) requiredKeys.append(QString("upTooltip"));
|
||||
if (configuration[QString("batTooltip")].toBool()) requiredKeys.append(QString("batTooltip"));
|
||||
|
||||
connect(this, SIGNAL(updateData(QHash<QString, QString>)),
|
||||
this, SLOT(dataUpdate(QHash<QString, QString>)));
|
||||
}
|
||||
|
||||
|
||||
@ -72,12 +76,33 @@ AWToolTip::~AWToolTip()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete toolTipView;
|
||||
delete toolTipScene;
|
||||
}
|
||||
|
||||
|
||||
QSize AWToolTip::getSize()
|
||||
void AWToolTip::dataUpdate(QHash<QString, QString> values)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// battery update requires info is AC online or not
|
||||
setData(QString("batTooltip"), values[QString("bat")].toFloat(),
|
||||
values[QString("ac")] == configuration[QString("acOnline")]);
|
||||
// usual case
|
||||
setData(QString("cpuTooltip"), values[QString("cpu")].toFloat());
|
||||
setData(QString("cpuclTooltip"), values[QString("cpucl")].toFloat());
|
||||
setData(QString("memTooltip"), values[QString("mem")].toFloat());
|
||||
setData(QString("swapTooltip"), values[QString("swap")].toFloat());
|
||||
// network may be showed as float (MB/s) or as int (KB/s)
|
||||
setData(QString("downTooltip"), values[QString("down")].contains(QChar('.')) ?
|
||||
values[QString("down")].toFloat() * 1024.0 : values[QString("down")].toFloat());
|
||||
setData(QString("upTooltip"), values[QString("up")].contains(QChar('.')) ?
|
||||
values[QString("up")].toFloat() * 1024.0 : values[QString("up")].toFloat());
|
||||
|
||||
emit(toolTipPainted(htmlImage()));
|
||||
}
|
||||
|
||||
|
||||
QSize AWToolTip::getSize() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -85,6 +110,19 @@ QSize AWToolTip::getSize()
|
||||
}
|
||||
|
||||
|
||||
QString AWToolTip::htmlImage()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QPixmap rawImage = image();
|
||||
QByteArray byteArray;
|
||||
QBuffer buffer(&byteArray);
|
||||
rawImage.save(&buffer, "PNG");
|
||||
|
||||
return QString("<img src=\"data:image/png;base64,%1\"/>").arg(QString(byteArray.toBase64()));
|
||||
}
|
||||
|
||||
|
||||
QPixmap AWToolTip::image()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -94,32 +132,31 @@ QPixmap AWToolTip::image()
|
||||
toolTipScene->clear();
|
||||
QPen pen = QPen();
|
||||
// background
|
||||
if (configuration[QString("useTooltipBackground")].toBool())
|
||||
toolTipScene->setBackgroundBrush(QBrush(QColor(configuration[QString("tooltipBackground")].toString())));
|
||||
else
|
||||
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
toolTipScene->setBackgroundBrush(configuration[QString("useTooltipBackground")].toBool() ?
|
||||
QBrush(QColor(configuration[QString("tooltipBackground")].toString())) :
|
||||
QBrush(Qt::NoBrush));
|
||||
bool down = false;
|
||||
for (int i=0; i<requiredKeys.count(); i++) {
|
||||
float normX = 100.0 / static_cast<float>(data[requiredKeys[i]].count());
|
||||
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
|
||||
if (requiredKeys[i] != QString("batTooltip"))
|
||||
pen.setColor(QColor(configuration[QString("%1Color").arg(requiredKeys[i])].toString()));
|
||||
float normX = 100.0 / static_cast<float>(data[requiredKeys.at(i)].count());
|
||||
float normY = 100.0 / (1.5 * boundaries[requiredKeys.at(i)]);
|
||||
if (requiredKeys.at(i) != QString("batTooltip"))
|
||||
pen.setColor(QColor(configuration[QString("%1Color").arg(requiredKeys.at(i))].toString()));
|
||||
float shift = i * 100.0;
|
||||
if (down) shift -= 100.0;
|
||||
for (int j=0; j<data[requiredKeys[i]].count()-1; j++) {
|
||||
for (int j=0; j<data[requiredKeys.at(i)].count()-1; j++) {
|
||||
float x1 = j * normX + shift;
|
||||
float y1 = - fabs(data[requiredKeys[i]][j]) * normY + 5.0;
|
||||
float y1 = - fabs(data[requiredKeys.at(i)].at(j)) * normY + 5.0;
|
||||
float x2 = (j + 1) * normX + shift;
|
||||
float y2 = - fabs(data[requiredKeys[i]][j+1]) * normY + 5.0;
|
||||
if (requiredKeys[i] == QString("batTooltip")) {
|
||||
if (data[requiredKeys[i]][j+1] > 0)
|
||||
float y2 = - fabs(data[requiredKeys.at(i)].at(j+1)) * normY + 5.0;
|
||||
if (requiredKeys.at(i) == QString("batTooltip")) {
|
||||
if (data[requiredKeys.at(i)].at(j+1) > 0)
|
||||
pen.setColor(QColor(configuration[QString("batTooltipColor")].toString()));
|
||||
else
|
||||
pen.setColor(QColor(configuration[QString("batInTooltipColor")].toString()));
|
||||
}
|
||||
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
||||
}
|
||||
if (requiredKeys[i] == QString("downTooltip")) down = true;
|
||||
if (requiredKeys.at(i) == QString("downTooltip")) down = true;
|
||||
}
|
||||
|
||||
return toolTipView->grab();
|
||||
@ -142,12 +179,12 @@ void AWToolTip::setData(const QString source, float value, const bool ac)
|
||||
data[source].append(-value);
|
||||
|
||||
if ((source == QString("downTooltip")) || (source == QString("upTooltip"))) {
|
||||
for (int i=0; i<data[QString("downTooltip")].count(); i++)
|
||||
if (boundaries[QString("downTooltip")] < data[QString("downTooltip")][i])
|
||||
boundaries[QString("downTooltip")] = data[QString("downTooltip")][i];
|
||||
for (int i=0; i<data[QString("upTooltip")].count(); i++)
|
||||
if (boundaries[QString("downTooltip")] < data[QString("upTooltip")][i])
|
||||
boundaries[QString("downTooltip")] = data[QString("upTooltip")][i];
|
||||
foreach(float val, data[QString("downTooltip")])
|
||||
if (boundaries[QString("downTooltip")] < val)
|
||||
boundaries[QString("downTooltip")] = val;
|
||||
foreach(float val, data[QString("upTooltip")])
|
||||
if (boundaries[QString("downTooltip")] < val)
|
||||
boundaries[QString("downTooltip")] = val;
|
||||
boundaries[QString("downTooltip")] *= 1.2;
|
||||
boundaries[QString("upTooltip")] = boundaries[QString("downTooltip")];
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QMap>
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
#include <QVariant>
|
||||
@ -34,22 +34,29 @@ class AWToolTip : public QObject
|
||||
public:
|
||||
AWToolTip(QObject *parent = nullptr, QVariantMap settings = QVariantMap());
|
||||
~AWToolTip();
|
||||
|
||||
QSize getSize();
|
||||
QSize getSize() const;
|
||||
QString htmlImage();
|
||||
QPixmap image();
|
||||
void setData(const QString source, float value,
|
||||
const bool ac = true);
|
||||
|
||||
signals:
|
||||
void updateData(QHash<QString, QString> values);
|
||||
void toolTipPainted(QString image);
|
||||
|
||||
private slots:
|
||||
void dataUpdate(QHash<QString, QString> values);
|
||||
|
||||
private:
|
||||
// ui
|
||||
QGraphicsScene *toolTipScene = nullptr;
|
||||
QGraphicsView *toolTipView = nullptr;
|
||||
void setData(const QString source, float value,
|
||||
const bool ac = true);
|
||||
// variables
|
||||
bool debug = false;
|
||||
int counts = 0;
|
||||
QVariantMap configuration;
|
||||
QMap<QString, float> boundaries;
|
||||
QMap<QString, QList<float>> data;
|
||||
QVariantHash configuration;
|
||||
QHash<QString, float> boundaries;
|
||||
QHash<QString, QList<float>> data;
|
||||
QStringList requiredKeys;
|
||||
QSize size;
|
||||
};
|
||||
|
@ -1,3 +1,3 @@
|
||||
module org.kde.plasma.awesomewidget
|
||||
module org.kde.plasma.private.awesomewidget
|
||||
|
||||
plugin awplugin
|
||||
|
35
sources/awesomewidgets/CMakeLists.txt
Normal file
35
sources/awesomewidgets/CMakeLists.txt
Normal file
@ -0,0 +1,35 @@
|
||||
set(SUBPROJECT ${PROJECT_LIBRARY})
|
||||
message(STATUS "Subproject ${SUBPROJECT}")
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE}
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.cpp)
|
||||
file(GLOB SUBPROJECT_HEADER *.h ${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.h)
|
||||
file(GLOB SUBPROJECT_UI *.ui)
|
||||
set(SUBPROJECT_GRAPHITEMS ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
set(SUBPROJECT_QUOTES ${CMAKE_CURRENT_SOURCE_DIR}/quotes)
|
||||
set(SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
||||
set(SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
|
||||
set(SUBPROJECT_WEATHER ${CMAKE_CURRENT_SOURCE_DIR}/weather)
|
||||
|
||||
qt5_wrap_cpp(SUBPROJECT_MOC_SOURCE ${SUBPROJECT_HEADER})
|
||||
qt5_wrap_ui(SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library(${SUBPROJECT} STATIC ${SUBPROJECT_SOURCE} ${SUBPROJECT_MOC_SOURCE}
|
||||
${SUBPROJECT_HEADER} ${SUBPROJECT_UI_HEADER})
|
||||
target_link_libraries(${SUBPROJECT} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
# install
|
||||
install(DIRECTORY ${SUBPROJECT_GRAPHITEMS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(DIRECTORY ${SUBPROJECT_QUOTES} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(DIRECTORY ${SUBPROJECT_WEATHER} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
248
sources/awesomewidgets/abstractextitem.cpp
Normal file
248
sources/awesomewidgets/abstractextitem.cpp
Normal file
@ -0,0 +1,248 @@
|
||||
/***************************************************************************
|
||||
* 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 "abstractextitem.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTime>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
AbstractExtItem::AbstractExtItem(QWidget *parent, const QString desktopName,
|
||||
const QStringList directories, const bool debugCmd)
|
||||
: QDialog(parent),
|
||||
m_fileName(desktopName),
|
||||
m_dirs(directories),
|
||||
debug(debugCmd)
|
||||
{
|
||||
m_name = m_fileName;
|
||||
}
|
||||
|
||||
|
||||
AbstractExtItem::~AbstractExtItem()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
T *AbstractExtItem::copy(const QString fileName, const int number)
|
||||
{
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(number)
|
||||
|
||||
// an analog of pure virtual method
|
||||
return new T();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int AbstractExtItem::apiVersion() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_apiVersion;
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::comment() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
|
||||
QStringList AbstractExtItem::directories() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_dirs;
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::fileName() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
|
||||
int AbstractExtItem::interval() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_interval;
|
||||
}
|
||||
|
||||
|
||||
bool AbstractExtItem::isActive() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_active;
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::name() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
int AbstractExtItem::number() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_number;
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::tag(const QString _type) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Tag type" << _type;
|
||||
|
||||
return QString("%1%2").arg(_type).arg(m_number);
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setApiVersion(const int _apiVersion)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||
|
||||
m_apiVersion = _apiVersion;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setActive(const bool _state)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "State" << _state;
|
||||
|
||||
m_active = _state;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setComment(const QString _comment)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||
|
||||
m_comment = _comment;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setInterval(const int _interval)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
|
||||
if (_interval <= 0) return;
|
||||
|
||||
m_interval = _interval;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setName(const QString _name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setNumber(int _number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
|
||||
if (_number == -1) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
|
||||
qsrand(QTime::currentTime().msec());
|
||||
_number = qrand() % 1000;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
|
||||
}
|
||||
|
||||
m_number = _number;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs.at(i)).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs.at(i)).arg(m_fileName), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setName(settings.value(QString("Name"), m_name).toString());
|
||||
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
|
||||
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
||||
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
|
||||
settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool AbstractExtItem::tryDelete() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
foreach(QString dir, m_dirs) {
|
||||
bool status = QFile::remove(QString("%1/%2").arg(dir).arg(m_fileName));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(dir).arg(m_fileName) << status;
|
||||
}
|
||||
|
||||
// check if exists
|
||||
foreach(QString dir, m_dirs)
|
||||
if (QFile::exists(QString("%1/%2").arg(dir).arg(m_fileName))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs.first()).arg(m_fileName), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||
settings.setValue(QString("Name"), m_name);
|
||||
settings.setValue(QString("Comment"), m_comment);
|
||||
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
||||
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||
settings.setValue(QString("X-AW-Number"), m_number);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
@ -15,82 +15,72 @@
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef EXTUPGRADE_H
|
||||
#define EXTUPGRADE_H
|
||||
#ifndef ABSTRACTEXTITEM_H
|
||||
#define ABSTRACTEXTITEM_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QProcess>
|
||||
#include <QInputDialog>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class ExtUpgrade;
|
||||
}
|
||||
|
||||
class ExtUpgrade : public QDialog
|
||||
class AbstractExtItem : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
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 executable READ executable WRITE setExecutable)
|
||||
Q_PROPERTY(int null READ null WRITE setNull)
|
||||
Q_PROPERTY(int number READ number WRITE setNumber)
|
||||
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
||||
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
||||
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
||||
Q_PROPERTY(QStringList directories READ directories)
|
||||
Q_PROPERTY(QString fileName READ fileName)
|
||||
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(QString uniq READ uniq)
|
||||
|
||||
public:
|
||||
explicit ExtUpgrade(QWidget *parent = nullptr, const QString upgradeName = QString(),
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
~ExtUpgrade();
|
||||
explicit AbstractExtItem(QWidget *parent = nullptr, const QString desktopName = QString(),
|
||||
const QStringList directories = QStringList(),
|
||||
const bool debugCmd = false);
|
||||
virtual ~AbstractExtItem();
|
||||
template <class T> T *copy(const QString fileName, const int number);
|
||||
// get methods
|
||||
int apiVersion();
|
||||
QString comment();
|
||||
QString executable();
|
||||
QString fileName();
|
||||
int interval();
|
||||
QString name();
|
||||
int null();
|
||||
int number();
|
||||
QString tag();
|
||||
bool isActive();
|
||||
int apiVersion() const;
|
||||
QString comment() const;
|
||||
QStringList directories() const;
|
||||
QString fileName() const;
|
||||
int interval() const;
|
||||
bool isActive() const;
|
||||
QString name() const;
|
||||
int number() const;
|
||||
QString tag(const QString _type) const;
|
||||
virtual QString uniq() const = 0;
|
||||
// set methods
|
||||
void setApiVersion(const int _apiVersion = 0);
|
||||
void setActive(const bool _state = true);
|
||||
void setComment(const QString _comment = QString("empty"));
|
||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||
void setInterval(const int _interval = 1);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setNull(const int _null = 0);
|
||||
void setNumber(int _number = -1);
|
||||
void setInterval(const int _interval = 0);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int run();
|
||||
int showConfiguration();
|
||||
bool tryDelete();
|
||||
void writeConfiguration();
|
||||
|
||||
private slots:
|
||||
void updateValue();
|
||||
virtual void readConfiguration();
|
||||
virtual QVariantHash run() = 0;
|
||||
virtual int showConfiguration(const QVariant args = QVariant()) = 0;
|
||||
bool tryDelete() const;
|
||||
virtual void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
QStringList m_dirs;
|
||||
bool debug;
|
||||
QProcess *process = nullptr;
|
||||
Ui::ExtUpgrade *ui;
|
||||
virtual void translate() = 0;
|
||||
// properties
|
||||
int m_apiVersion = 0;
|
||||
bool m_active = true;
|
||||
QString m_comment = QString("empty");
|
||||
QString m_executable = QString("/usr/bin/true");
|
||||
int m_interval = 1;
|
||||
QString m_name = QString("none");
|
||||
int m_null = 0;
|
||||
int m_number = -1;
|
||||
int m_interval = 3600;
|
||||
int times = 0;
|
||||
int value = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* EXTUPGRADE_H */
|
||||
#endif /* ABSTRACTEXTITEM_H */
|
115
sources/awesomewidgets/abstractextitemaggregator.cpp
Normal file
115
sources/awesomewidgets/abstractextitemaggregator.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
/***************************************************************************
|
||||
* 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 "abstractextitemaggregator.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QHBoxLayout>
|
||||
#include <QInputDialog>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
|
||||
AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *parent, const bool debugCmd)
|
||||
: QWidget(parent),
|
||||
debug(debugCmd)
|
||||
{
|
||||
dialog = new QDialog(this);
|
||||
widgetDialog = new QListWidget(dialog);
|
||||
dialogButtons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close,
|
||||
Qt::Vertical, dialog);
|
||||
copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
|
||||
createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole);
|
||||
deleteButton = dialogButtons->addButton(i18n("Remove"), QDialogButtonBox::ActionRole);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
layout->addWidget(widgetDialog);
|
||||
layout->addWidget(dialogButtons);
|
||||
dialog->setLayout(layout);
|
||||
|
||||
connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)),
|
||||
this, SLOT(editItemButtonPressed(QAbstractButton *)));
|
||||
connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||
connect(widgetDialog, SIGNAL(itemActivated(QListWidgetItem *)),
|
||||
this, SLOT(editItemActivated(QListWidgetItem *)));
|
||||
}
|
||||
|
||||
|
||||
AbstractExtItemAggregator::~AbstractExtItemAggregator()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItemAggregator::getName()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(this, i18n("Enter file name"),
|
||||
i18n("File name"), QLineEdit::Normal,
|
||||
QString(""), &ok);
|
||||
if ((!ok) || (name.isEmpty())) return QString("");
|
||||
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
QVariant AbstractExtItemAggregator::configArgs() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_configArgs;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItemAggregator::setConfigArgs(const QVariant _configArgs)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration arguments" << _configArgs;
|
||||
|
||||
m_configArgs = _configArgs;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItemAggregator::editItemActivated(QListWidgetItem *item)
|
||||
{
|
||||
Q_UNUSED(item)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return editItem();
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItemAggregator::editItemButtonPressed(QAbstractButton *button)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (static_cast<QPushButton *>(button) == copyButton)
|
||||
return copyItem();
|
||||
else if (static_cast<QPushButton *>(button) == createButton)
|
||||
return createItem();
|
||||
else if (static_cast<QPushButton *>(button) == deleteButton)
|
||||
return deleteItem();
|
||||
else if (dialogButtons->buttonRole(button) == QDialogButtonBox::AcceptRole)
|
||||
return editItem();
|
||||
}
|
66
sources/awesomewidgets/abstractextitemaggregator.h
Normal file
66
sources/awesomewidgets/abstractextitemaggregator.h
Normal file
@ -0,0 +1,66 @@
|
||||
/***************************************************************************
|
||||
* 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 ABSTRACTEXTITEMAGGREGATOR_H
|
||||
#define ABSTRACTEXTITEMAGGREGATOR_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QListWidget>
|
||||
#include <QObject>
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
// additinal class since QObject macro does not allow class templates
|
||||
class AbstractExtItemAggregator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVariant configArgs READ configArgs WRITE setConfigArgs)
|
||||
|
||||
public:
|
||||
AbstractExtItemAggregator(QWidget *parent = nullptr, const bool debugCmd = false);
|
||||
virtual ~AbstractExtItemAggregator();
|
||||
QString getName();
|
||||
// ui
|
||||
QDialog *dialog = nullptr;
|
||||
QListWidget *widgetDialog = nullptr;
|
||||
QDialogButtonBox *dialogButtons = nullptr;
|
||||
QPushButton *copyButton = nullptr;
|
||||
QPushButton *createButton = nullptr;
|
||||
QPushButton *deleteButton = nullptr;
|
||||
// get methods
|
||||
QVariant configArgs() const;
|
||||
// set methods
|
||||
void setConfigArgs(const QVariant _configArgs);
|
||||
|
||||
private slots:
|
||||
void editItemActivated(QListWidgetItem *item);
|
||||
void editItemButtonPressed(QAbstractButton *button);
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
QVariant m_configArgs;
|
||||
// methods
|
||||
virtual void copyItem() = 0;
|
||||
virtual void createItem() = 0;
|
||||
virtual void deleteItem() = 0;
|
||||
virtual void editItem() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* ABSTRACTEXTITEMAGGREGATOR_H */
|
@ -9,4 +9,5 @@ X-AW-Type=Horizontal
|
||||
X-AW-Direction=LeftToRight
|
||||
X-AW-Height=25
|
||||
X-AW-Width=100
|
||||
X-AW-ApiVersion=1
|
||||
X-AW-ApiVersion=2
|
||||
X-AW-Number=3
|
@ -9,4 +9,5 @@ X-AW-Type=Horizontal
|
||||
X-AW-Direction=LeftToRight
|
||||
X-AW-Height=25
|
||||
X-AW-Width=100
|
||||
X-AW-ApiVersion=1
|
||||
X-AW-ApiVersion=2
|
||||
X-AW-Number=0
|
@ -9,4 +9,5 @@ X-AW-Type=Horizontal
|
||||
X-AW-Direction=LeftToRight
|
||||
X-AW-Height=25
|
||||
X-AW-Width=100
|
||||
X-AW-ApiVersion=1
|
||||
X-AW-ApiVersion=2
|
||||
X-AW-Number=1
|
@ -9,4 +9,5 @@ X-AW-Type=Horizontal
|
||||
X-AW-Direction=LeftToRight
|
||||
X-AW-Height=25
|
||||
X-AW-Width=100
|
||||
X-AW-ApiVersion=1
|
||||
X-AW-ApiVersion=2
|
||||
X-AW-Number=2
|
221
sources/awesomewidgets/extitemaggregator.h
Normal file
221
sources/awesomewidgets/extitemaggregator.h
Normal file
@ -0,0 +1,221 @@
|
||||
/***************************************************************************
|
||||
* 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 EXTITEMAGGREGATOR_H
|
||||
#define EXTITEMAGGREGATOR_H
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "abstractextitemaggregator.h"
|
||||
|
||||
|
||||
template <class T>
|
||||
class ExtItemAggregator : public AbstractExtItemAggregator
|
||||
{
|
||||
public:
|
||||
explicit ExtItemAggregator(QWidget *parent, const QString type,
|
||||
const bool debugCmd = false)
|
||||
: AbstractExtItemAggregator(parent, debugCmd),
|
||||
debug(debugCmd),
|
||||
m_type(type)
|
||||
{
|
||||
initItems();
|
||||
};
|
||||
|
||||
~ExtItemAggregator()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
m_items.clear();
|
||||
}
|
||||
|
||||
void editItems()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
repaint();
|
||||
int ret = dialog->exec();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Dialog returns" << ret;
|
||||
};
|
||||
|
||||
void initItems()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
m_items.clear();
|
||||
m_items = getItems();
|
||||
};
|
||||
|
||||
T *itemFromWidget() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QListWidgetItem *item = widgetDialog->currentItem();
|
||||
if (item == nullptr) return nullptr;
|
||||
|
||||
int originalItem = -1;
|
||||
for (int i=0; i<m_items.count(); i++) {
|
||||
if (m_items.at(i)->fileName() != item->text()) continue;
|
||||
originalItem = i;
|
||||
break;
|
||||
}
|
||||
|
||||
return originalItem == -1 ? nullptr : m_items[originalItem];
|
||||
};
|
||||
|
||||
QList<T *> items() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_items;
|
||||
};
|
||||
|
||||
int uniqNumber() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QList<int> tagList;
|
||||
foreach(T *item, m_items) tagList.append(item->number());
|
||||
int number = 0;
|
||||
while (tagList.contains(number)) number++;
|
||||
|
||||
return number;
|
||||
};
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
QList<T *> m_items;
|
||||
QString m_type;
|
||||
|
||||
// init method
|
||||
QList<T *> getItems()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// create directory at $HOME
|
||||
QString localDir = QString("%1/awesomewidgets/%2")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation))
|
||||
.arg(m_type);
|
||||
QDir localDirectory;
|
||||
if (localDirectory.mkpath(localDir))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/%1").arg(m_type),
|
||||
QStandardPaths::LocateDirectory);
|
||||
QStringList names;
|
||||
QList<T *> items;
|
||||
foreach(QString dir, dirs) {
|
||||
QStringList files = QDir(dir).entryList(QDir::Files, QDir::Name);
|
||||
foreach(QString file, files) {
|
||||
if (!file.endsWith(QString(".desktop"))) continue;
|
||||
if (names.contains(file)) continue;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << file << "in" << dir;
|
||||
names.append(file);
|
||||
items.append(new T(this, file, dirs, debug));
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
void repaint()
|
||||
{
|
||||
widgetDialog->clear();
|
||||
foreach(T *_item, m_items) {
|
||||
QListWidgetItem *item = new QListWidgetItem(_item->fileName(), widgetDialog);
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Name: %1", _item->name()));
|
||||
tooltip.append(i18n("Comment: %1", _item->comment()));
|
||||
tooltip.append(i18n("Identity: %1", _item->uniq()));
|
||||
item->setToolTip(tooltip.join(QChar('\n')));
|
||||
widgetDialog->addItem(item);
|
||||
}
|
||||
};
|
||||
|
||||
// methods
|
||||
void copyItem()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
T *source = itemFromWidget();
|
||||
QString fileName = getName();
|
||||
int number = uniqNumber();
|
||||
if ((source == nullptr) || (fileName.isEmpty())) return;
|
||||
|
||||
T *newItem = source->copy(fileName, number);
|
||||
if (newItem->showConfiguration(configArgs()) == 1) {
|
||||
initItems();
|
||||
repaint();
|
||||
}
|
||||
};
|
||||
|
||||
void createItem()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName = getName();
|
||||
int number = uniqNumber();
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/%1").arg(m_type),
|
||||
QStandardPaths::LocateDirectory);
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
T *newItem = new T(this, fileName, dirs, debug);
|
||||
newItem->setNumber(number);
|
||||
if (newItem->showConfiguration(configArgs()) == 1) {
|
||||
initItems();
|
||||
repaint();
|
||||
}
|
||||
};
|
||||
|
||||
void deleteItem()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
T *source = itemFromWidget();
|
||||
if (source == nullptr) return;
|
||||
|
||||
if (source->tryDelete()) {
|
||||
initItems();
|
||||
repaint();
|
||||
}
|
||||
};
|
||||
|
||||
void editItem()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
T *source = itemFromWidget();
|
||||
if (source == nullptr) return;
|
||||
|
||||
if (source->showConfiguration(configArgs()) == 1) {
|
||||
initItems();
|
||||
repaint();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif /* EXTITEMAGGREGATOR_H */
|
266
sources/awesomewidgets/extquotes.cpp
Normal file
266
sources/awesomewidgets/extquotes.cpp
Normal file
@ -0,0 +1,266 @@
|
||||
/***************************************************************************
|
||||
* 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 "extquotes.h"
|
||||
#include "ui_extquotes.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <qreplytimeout/qreplytimeout.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName,
|
||||
const QStringList directories, const bool debugCmd)
|
||||
: AbstractExtItem(parent, quotesName, directories, debugCmd),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::ExtQuotes)
|
||||
{
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
values[tag(QString("ask"))] = 0.0;
|
||||
values[tag(QString("askchg"))] = 0.0;
|
||||
values[tag(QString("percaskchg"))] = 0.0;
|
||||
values[tag(QString("bid"))] = 0.0;
|
||||
values[tag(QString("bidchg"))] = 0.0;
|
||||
values[tag(QString("percbidchg"))] = 0.0;
|
||||
values[tag(QString("price"))] = 0.0;
|
||||
values[tag(QString("pricechg"))] = 0.0;
|
||||
values[tag(QString("percpricechg"))] = 0.0;
|
||||
|
||||
manager = new QNetworkAccessManager(this);
|
||||
connect(manager, SIGNAL(finished(QNetworkReply *)),
|
||||
this, SLOT(quotesReplyReceived(QNetworkReply *)));
|
||||
}
|
||||
|
||||
|
||||
ExtQuotes::~ExtQuotes()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
disconnect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(quotesReplyReceived(QNetworkReply *)));
|
||||
|
||||
delete manager;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
ExtQuotes *ExtQuotes::copy(const QString fileName, const int number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ExtQuotes *item = new ExtQuotes(static_cast<QWidget *>(parent()), fileName,
|
||||
directories(), debug);
|
||||
item->setActive(isActive());
|
||||
item->setApiVersion(apiVersion());
|
||||
item->setComment(comment());
|
||||
item->setInterval(interval());
|
||||
item->setName(name());
|
||||
item->setNumber(number);
|
||||
item->setTicker(ticker());
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::ticker() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_ticker;
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::uniq() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_ticker;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setTicker(const QString _ticker)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Ticker" << _ticker;
|
||||
|
||||
m_ticker = _ticker;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) continue;
|
||||
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setTicker(settings.value(QString("X-AW-Ticker"), m_ticker).toString());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
// update for current API
|
||||
if ((apiVersion() > 0) && (apiVersion() < AWEQAPI)) {
|
||||
setApiVersion(AWEQAPI);
|
||||
writeConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QVariantHash ExtQuotes::run()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if ((!isActive()) || (isRunning)) return values;
|
||||
|
||||
if (times == 1) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Send request";
|
||||
isRunning = true;
|
||||
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url())));
|
||||
new QReplyTimeout(reply, 1000);
|
||||
}
|
||||
|
||||
// update value
|
||||
if (times >= interval()) times = 0;
|
||||
times++;
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
int ExtQuotes::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
ui->lineEdit_comment->setText(comment());
|
||||
ui->label_numberValue->setText(QString("%1").arg(number()));
|
||||
ui->lineEdit_ticker->setText(m_ticker);
|
||||
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked);
|
||||
ui->spinBox_interval->setValue(interval());
|
||||
|
||||
int ret = exec();
|
||||
if (ret != 1) return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWEQAPI);
|
||||
setTicker(ui->lineEdit_ticker->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("X-AW-Ticker"), m_ticker);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
|
||||
|
||||
isRunning = false;
|
||||
QJsonParseError error;
|
||||
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;
|
||||
}
|
||||
QVariantMap jsonQuotes = jsonDoc.toVariant().toMap()[QString("query")].toMap();
|
||||
jsonQuotes = jsonQuotes[QString("results")].toMap()[QString("quote")].toMap();
|
||||
float value;
|
||||
|
||||
// ask
|
||||
value = jsonQuotes[QString("Ask")].toString().toFloat();
|
||||
values[tag(QString("askchg"))] = values[QString("ask")].toFloat() == 0.0 ? 0.0 :
|
||||
value - values[QString("ask")].toFloat();
|
||||
values[tag(QString("percaskchg"))] = 100.0 * values[QString("askchg")].toFloat() / values[QString("ask")].toFloat();
|
||||
values[tag(QString("ask"))] = value;
|
||||
|
||||
// bid
|
||||
value = jsonQuotes[QString("Bid")].toString().toFloat();
|
||||
values[tag(QString("bidchg"))] = values[QString("bid")].toFloat() == 0.0 ? 0.0 :
|
||||
value - values[QString("bid")].toFloat();
|
||||
values[tag(QString("percbidchg"))] = 100.0 * values[QString("bidchg")].toFloat() / values[QString("bid")].toFloat();
|
||||
values[tag(QString("bid"))] = value;
|
||||
|
||||
// last trade
|
||||
value = jsonQuotes[QString("LastTradePriceOnly")].toString().toFloat();
|
||||
values[tag(QString("pricechg"))] = values[QString("price")].toFloat() == 0.0 ? 0.0 :
|
||||
value - values[QString("price")].toFloat();
|
||||
values[tag(QString("percpricechg"))] = 100.0 * values[QString("pricechg")].toFloat() / values[QString("price")].toFloat();
|
||||
values[tag(QString("price"))] = value;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label->setText(i18n("<html><head/><body><p>Use YAHOO! finance ticker to get quotes for the instrument. Refer to <a href=\"http://finance.yahoo.com/\"><span style=\" text-decoration: underline; color:#0057ae;\">http://finance.yahoo.com/</span></a></p></body></html>"));
|
||||
ui->label_ticker->setText(i18n("Ticker"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::url() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString apiUrl = QString(YAHOO_URL);
|
||||
apiUrl.replace(QString("$TICKER"), m_ticker);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "API url" << apiUrl;
|
||||
|
||||
return apiUrl;
|
||||
}
|
@ -18,97 +18,56 @@
|
||||
#ifndef EXTQUOTES_H
|
||||
#define EXTQUOTES_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include <QNetworkReply>
|
||||
#include <QTimer>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
|
||||
#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 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 {
|
||||
class ExtQuotes;
|
||||
}
|
||||
|
||||
class ExtQuotes : public QDialog
|
||||
class ExtQuotes : public AbstractExtItem
|
||||
{
|
||||
Q_OBJECT
|
||||
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(int interval READ interval WRITE setInterval)
|
||||
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
||||
Q_PROPERTY(int number READ number WRITE setNumber)
|
||||
Q_PROPERTY(QString ticker READ ticker WRITE setTicker)
|
||||
|
||||
public:
|
||||
explicit ExtQuotes(QWidget *parent = nullptr, const QString quotesName = QString(),
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
const QStringList directories = QStringList(),
|
||||
const bool debugCmd = false);
|
||||
~ExtQuotes();
|
||||
ExtQuotes *copy(const QString fileName, const int number);
|
||||
// get methods
|
||||
int apiVersion();
|
||||
QString comment();
|
||||
QString fileName();
|
||||
int interval();
|
||||
bool isActive();
|
||||
QString name();
|
||||
int number();
|
||||
QString tag(const QString _type = QString("price"));
|
||||
QString ticker();
|
||||
QString ticker() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setApiVersion(const int _apiVersion = 0);
|
||||
void setActive(const bool _state = true);
|
||||
void setComment(const QString _comment = QString("empty"));
|
||||
void setInterval(const int _interval = 0);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setNumber(int _number = -1);
|
||||
void setTicker(const QString _ticker = QString("EURUSD=X"));
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QMap<QString, float> run();
|
||||
int showConfiguration();
|
||||
bool tryDelete();
|
||||
void writeConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void quotesReplyReceived(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
QStringList m_dirs;
|
||||
bool debug;
|
||||
QNetworkAccessManager *manager;
|
||||
bool isRunning = false;
|
||||
Ui::ExtQuotes *ui;
|
||||
QString url();
|
||||
void translate();
|
||||
QString url() const;
|
||||
// properties
|
||||
int m_apiVersion = 0;
|
||||
bool m_active = true;
|
||||
QString m_comment = QString("empty");
|
||||
int m_interval = 60;
|
||||
QString m_name = QString("none");
|
||||
int m_number = -1;
|
||||
QString m_ticker = QString("EURUSD=X");
|
||||
// values
|
||||
int times = 0;
|
||||
QMap<QString, float> values;
|
||||
QVariantHash values;
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "extscript.h"
|
||||
#include "ui_extscript.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
@ -25,29 +27,28 @@
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextCodec>
|
||||
#include <QTime>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtScript::ExtScript(QWidget *parent, const QString scriptName, const QStringList directories, const bool debugCmd)
|
||||
: QDialog(parent),
|
||||
m_fileName(scriptName),
|
||||
m_dirs(directories),
|
||||
ExtScript::ExtScript(QWidget *parent, const QString scriptName,
|
||||
const QStringList directories, const bool debugCmd)
|
||||
: AbstractExtItem(parent, scriptName, directories, debugCmd),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::ExtScript)
|
||||
{
|
||||
m_name = m_fileName;
|
||||
readConfiguration();
|
||||
readJsonFilters();
|
||||
// init process
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
value[tag(QString("custom"))] = QString("");
|
||||
|
||||
process = new QProcess(this);
|
||||
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue()));
|
||||
process->waitForFinished(0);
|
||||
// init ui
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
@ -61,23 +62,28 @@ ExtScript::~ExtScript()
|
||||
}
|
||||
|
||||
|
||||
int ExtScript::apiVersion()
|
||||
ExtScript *ExtScript::copy(const QString fileName, const int number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_apiVersion;
|
||||
ExtScript *item = new ExtScript(static_cast<QWidget *>(parent()), fileName,
|
||||
directories(), debug);
|
||||
item->setActive(isActive());
|
||||
item->setApiVersion(apiVersion());
|
||||
item->setComment(comment());
|
||||
item->setExecutable(executable());
|
||||
item->setHasOutput(hasOutput());
|
||||
item->setInterval(interval());
|
||||
item->setName(name());
|
||||
item->setNumber(number);
|
||||
item->setPrefix(prefix());
|
||||
item->setRedirect(redirect());
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::comment()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::executable()
|
||||
QString ExtScript::executable() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -85,15 +91,7 @@ QString ExtScript::executable()
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::fileName()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
|
||||
QStringList ExtScript::filters()
|
||||
QStringList ExtScript::filters() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -101,7 +99,7 @@ QStringList ExtScript::filters()
|
||||
}
|
||||
|
||||
|
||||
bool ExtScript::hasOutput()
|
||||
bool ExtScript::hasOutput() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -109,39 +107,7 @@ bool ExtScript::hasOutput()
|
||||
}
|
||||
|
||||
|
||||
int ExtScript::interval()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_interval;
|
||||
}
|
||||
|
||||
|
||||
bool ExtScript::isActive()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_active;
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::name()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
int ExtScript::number()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_number;
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::prefix()
|
||||
QString ExtScript::prefix() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -149,7 +115,7 @@ QString ExtScript::prefix()
|
||||
}
|
||||
|
||||
|
||||
ExtScript::Redirect ExtScript::redirect()
|
||||
ExtScript::Redirect ExtScript::redirect() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -157,7 +123,15 @@ ExtScript::Redirect ExtScript::redirect()
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::strRedirect()
|
||||
QString ExtScript::uniq() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_executable;
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::strRedirect() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -179,41 +153,6 @@ QString ExtScript::strRedirect()
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::tag()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return QString("custom%1").arg(m_number);
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setApiVersion(const int _apiVersion)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||
|
||||
m_apiVersion = _apiVersion;
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setActive(const bool state)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
||||
|
||||
m_active = state;
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setComment(const QString _comment)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||
|
||||
m_comment = _comment;
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setExecutable(const QString _executable)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -228,8 +167,8 @@ void ExtScript::setFilters(const QStringList _filters)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Filters" << _filters;
|
||||
|
||||
for (int i=0; i<_filters.count(); i++)
|
||||
updateFilter(_filters[i]);
|
||||
foreach(QString filter, _filters)
|
||||
updateFilter(filter);
|
||||
}
|
||||
|
||||
|
||||
@ -242,40 +181,6 @@ void ExtScript::setHasOutput(const bool _state)
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setInterval(const int _interval)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
|
||||
if (_interval <= 0) return;
|
||||
|
||||
m_interval = _interval;
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setName(const QString _name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setNumber(int _number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
|
||||
if (_number == -1) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
|
||||
qsrand(QTime::currentTime().msec());
|
||||
_number = qrand() % 1000;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
|
||||
}
|
||||
|
||||
m_number = _number;
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setPrefix(const QString _prefix)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -308,20 +213,20 @@ void ExtScript::setStrRedirect(const QString _redirect)
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::applyFilters(QString _value)
|
||||
QString ExtScript::applyFilters(QString _value) const
|
||||
{
|
||||
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();
|
||||
foreach(QString filt, m_filters) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Found filter" << filt;
|
||||
QVariantMap filter = jsonFilters[filt].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());
|
||||
foreach(QString f, filter.keys())
|
||||
_value.replace(f, filter[f].toString());
|
||||
}
|
||||
|
||||
return _value;
|
||||
@ -346,23 +251,17 @@ void ExtScript::updateFilter(const QString _filter, const bool _add)
|
||||
void ExtScript::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) continue;
|
||||
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setName(settings.value(QString("Name"), m_name).toString());
|
||||
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
|
||||
setExecutable(settings.value(QString("Exec"), m_executable).toString());
|
||||
setPrefix(settings.value(QString("X-AW-Prefix"), m_prefix).toString());
|
||||
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
||||
setHasOutput(settings.value(QString("X-AW-Output"), QVariant(m_output)).toString() == QString("true"));
|
||||
setStrRedirect(settings.value(QString("X-AW-Redirect"), strRedirect()).toString());
|
||||
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||
// api == 2
|
||||
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));
|
||||
@ -373,7 +272,7 @@ void ExtScript::readConfiguration()
|
||||
setRedirect(stdout2stderr);
|
||||
|
||||
// update for current API
|
||||
if ((m_apiVersion > 0) && (m_apiVersion < AWESAPI)) {
|
||||
if ((apiVersion() > 0) && (apiVersion() < AWESAPI)) {
|
||||
setApiVersion(AWESAPI);
|
||||
writeConfiguration();
|
||||
}
|
||||
@ -396,18 +295,17 @@ void ExtScript::readJsonFilters()
|
||||
QJsonParseError error;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Json parse error" << error.errorString();
|
||||
if (error.error != QJsonParseError::NoError)
|
||||
return;
|
||||
if (error.error != QJsonParseError::NoError) return;
|
||||
jsonFilters = jsonDoc.toVariant().toMap();
|
||||
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Filters" << jsonFilters;
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::run()
|
||||
QVariantHash ExtScript::run()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (!m_active) return value;
|
||||
if (!isActive()) return value;
|
||||
|
||||
if ((times == 1) && (process->state() == QProcess::NotRunning)) {
|
||||
QStringList cmdList;
|
||||
@ -415,7 +313,7 @@ QString ExtScript::run()
|
||||
cmdList.append(m_executable);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmdList.join(QChar(' '));
|
||||
process->start(cmdList.join(QChar(' ')));
|
||||
} else if (times >= m_interval)
|
||||
} else if (times >= interval())
|
||||
times = 0;
|
||||
times++;
|
||||
|
||||
@ -423,19 +321,20 @@ QString ExtScript::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtScript::showConfiguration()
|
||||
int ExtScript::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(m_name);
|
||||
ui->lineEdit_comment->setText(m_comment);
|
||||
ui->label_numberValue->setText(QString("%1").arg(m_number));
|
||||
ui->lineEdit_name->setText(name());
|
||||
ui->lineEdit_comment->setText(comment());
|
||||
ui->label_numberValue->setText(QString("%1").arg(number()));
|
||||
ui->lineEdit_command->setText(m_executable);
|
||||
ui->lineEdit_prefix->setText(m_prefix);
|
||||
ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked);
|
||||
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked);
|
||||
ui->checkBox_output->setCheckState(m_output ? Qt::Checked : Qt::Unchecked);
|
||||
ui->comboBox_redirect->setCurrentIndex(static_cast<int>(m_redirect));
|
||||
ui->spinBox_interval->setValue(m_interval);
|
||||
ui->spinBox_interval->setValue(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);
|
||||
@ -463,40 +362,19 @@ int ExtScript::showConfiguration()
|
||||
}
|
||||
|
||||
|
||||
bool ExtScript::tryDelete()
|
||||
void ExtScript::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||
|
||||
// check if exists
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::writeConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||
settings.setValue(QString("Name"), m_name);
|
||||
settings.setValue(QString("Comment"), m_comment);
|
||||
settings.setValue(QString("Exec"), m_executable);
|
||||
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||
settings.setValue(QString("X-AW-Prefix"), m_prefix);
|
||||
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
||||
settings.setValue(QString("X-AW-Output"), QVariant(m_output).toString());
|
||||
settings.setValue(QString("X-AW-Redirect"), strRedirect());
|
||||
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||
settings.setValue(QString("X-AW-Number"), m_number);
|
||||
settings.setValue(QString("X-AW-Filters"), m_filters.join(QChar(',')));
|
||||
settings.endGroup();
|
||||
|
||||
@ -512,6 +390,7 @@ void ExtScript::updateValue()
|
||||
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardError()).trimmed();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << qdebug;
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardOutput()).trimmed();
|
||||
QString strValue;
|
||||
|
||||
switch (m_redirect) {
|
||||
case stdout2stderr:
|
||||
@ -519,15 +398,35 @@ void ExtScript::updateValue()
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Output" << qoutput;
|
||||
break;
|
||||
case stderr2stdout:
|
||||
value = QString("%1\t%2").arg(qdebug).arg(qoutput);
|
||||
strValue = QString("%1\n%2").arg(qdebug).arg(qoutput);
|
||||
break;
|
||||
case nothing:
|
||||
default:
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Debug" << qdebug;
|
||||
value = qoutput;
|
||||
strValue = qoutput;
|
||||
break;
|
||||
}
|
||||
|
||||
// filters
|
||||
value = applyFilters(value);
|
||||
value[tag(QString("custom"))] = applyFilters(strValue);
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label_command->setText(i18n("Command"));
|
||||
ui->label_prefix->setText(i18n("Prefix"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->checkBox_output->setText(i18n("Has output"));
|
||||
ui->label_redirect->setText(i18n("Redirect"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
ui->groupBox_filters->setTitle(i18n("Additional filters"));
|
||||
ui->checkBox_colorFilter->setText(i18n("Wrap colors"));
|
||||
ui->checkBox_linesFilter->setText(i18n("Wrap new lines"));
|
||||
ui->checkBox_spaceFilter->setText(i18n("Wrap spaces"));
|
||||
}
|
@ -18,26 +18,21 @@
|
||||
#ifndef EXTSCRIPT_H
|
||||
#define EXTSCRIPT_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include <QProcess>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class ExtScript;
|
||||
}
|
||||
|
||||
class ExtScript : public QDialog
|
||||
class ExtScript : public AbstractExtItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
||||
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
||||
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
||||
Q_PROPERTY(QString executable READ executable WRITE setExecutable)
|
||||
Q_PROPERTY(QStringList filters READ filters WRITE setFilters)
|
||||
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)
|
||||
@ -50,67 +45,48 @@ public:
|
||||
};
|
||||
|
||||
explicit ExtScript(QWidget *parent = nullptr, const QString scriptName = QString(),
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
const QStringList directories = QStringList(),
|
||||
const bool debugCmd = false);
|
||||
~ExtScript();
|
||||
ExtScript *copy(const QString fileName, const int number);
|
||||
// get methods
|
||||
int apiVersion();
|
||||
QString comment();
|
||||
QString executable();
|
||||
QString fileName();
|
||||
QStringList filters();
|
||||
bool hasOutput();
|
||||
int interval();
|
||||
bool isActive();
|
||||
QString name();
|
||||
int number();
|
||||
QString prefix();
|
||||
Redirect redirect();
|
||||
QString executable() const;
|
||||
QStringList filters() const;
|
||||
bool hasOutput() const;
|
||||
QString prefix() const;
|
||||
Redirect redirect() const;
|
||||
QString uniq() const;
|
||||
// derivatives
|
||||
QString strRedirect();
|
||||
QString tag();
|
||||
QString strRedirect() const;
|
||||
// set methods
|
||||
void setApiVersion(const int _apiVersion = 0);
|
||||
void setActive(const bool _state = true);
|
||||
void setComment(const QString _comment = QString("empty"));
|
||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||
void setFilters(const QStringList _filters = QStringList());
|
||||
void setHasOutput(const bool _state = true);
|
||||
void setInterval(const int _interval = 1);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setNumber(int _number = -1);
|
||||
void setPrefix(const QString _prefix = QString(""));
|
||||
void setRedirect(const Redirect _redirect = nothing);
|
||||
void setStrRedirect(const QString _redirect = QString("nothing"));
|
||||
// filters
|
||||
QString applyFilters(QString _value);
|
||||
QString applyFilters(QString _value) const;
|
||||
void updateFilter(const QString _filter, const bool _add = true);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
void readJsonFilters();
|
||||
QString run();
|
||||
int showConfiguration();
|
||||
bool tryDelete();
|
||||
void writeConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void updateValue();
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
QStringList m_dirs;
|
||||
bool debug;
|
||||
QProcess *process = nullptr;
|
||||
Ui::ExtScript *ui;
|
||||
void translate();
|
||||
// properties
|
||||
int m_apiVersion = 0;
|
||||
bool m_active = true;
|
||||
QString m_comment = QString("empty");
|
||||
QString m_executable = QString("/usr/bin/true");
|
||||
QStringList m_filters = QStringList();
|
||||
int m_interval = 1;
|
||||
QString m_name = QString("none");
|
||||
int m_number = -1;
|
||||
bool m_output = true;
|
||||
QString m_prefix = QString("");
|
||||
Redirect m_redirect = nothing;
|
||||
@ -118,7 +94,7 @@ private:
|
||||
Q_PID childProcess = 0;
|
||||
QVariantMap jsonFilters = QVariantMap();
|
||||
int times = 0;
|
||||
QString value = QString();
|
||||
QVariantHash value;
|
||||
};
|
||||
|
||||
|
230
sources/awesomewidgets/extupgrade.cpp
Normal file
230
sources/awesomewidgets/extupgrade.cpp
Normal file
@ -0,0 +1,230 @@
|
||||
/***************************************************************************
|
||||
* 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 "extupgrade.h"
|
||||
#include "ui_extupgrade.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName,
|
||||
const QStringList directories, const bool debugCmd)
|
||||
: AbstractExtItem(parent, upgradeName, directories, debugCmd),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::ExtUpgrade)
|
||||
{
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
value[tag(QString("pkgcount"))] = 0;
|
||||
|
||||
process = new QProcess(this);
|
||||
connect(process, SIGNAL(finished(int)), this, SLOT(updateValue()));
|
||||
process->waitForFinished(0);
|
||||
}
|
||||
|
||||
|
||||
ExtUpgrade::~ExtUpgrade()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
process->kill();
|
||||
delete process;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
ExtUpgrade *ExtUpgrade::copy(const QString fileName, const int number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ExtUpgrade *item = new ExtUpgrade(static_cast<QWidget *>(parent()), fileName,
|
||||
directories(), debug);
|
||||
item->setActive(isActive());
|
||||
item->setApiVersion(apiVersion());
|
||||
item->setComment(comment());
|
||||
item->setExecutable(executable());
|
||||
item->setInterval(interval());
|
||||
item->setName(name());
|
||||
item->setNumber(number);
|
||||
item->setNull(null());
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
QString ExtUpgrade::executable() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_executable;
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::null() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_null;
|
||||
}
|
||||
|
||||
|
||||
QString ExtUpgrade::uniq() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_executable;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setExecutable(const QString _executable)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Executable" << _executable;
|
||||
|
||||
m_executable = _executable;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setNull(const int _null)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Null lines" << _null;
|
||||
if (_null < 0) return;
|
||||
|
||||
m_null = _null;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) continue;
|
||||
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setExecutable(settings.value(QString("Exec"), m_executable).toString());
|
||||
setNull(settings.value(QString("X-AW-Null"), m_null).toInt());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
// update for current API
|
||||
if ((apiVersion() > 0) && (apiVersion() < AWEUAPI)) {
|
||||
setApiVersion(AWEUAPI);
|
||||
writeConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QVariantHash ExtUpgrade::run()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (!isActive()) return value;
|
||||
|
||||
if ((times == 1) && (process->state() == QProcess::NotRunning))
|
||||
process->start(QString("sh -c \"%1\"").arg(m_executable));
|
||||
else if (times >= interval())
|
||||
times = 0;
|
||||
times++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
ui->lineEdit_comment->setText(comment());
|
||||
ui->label_numberValue->setText(QString("%1").arg(number()));
|
||||
ui->lineEdit_command->setText(m_executable);
|
||||
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked);
|
||||
ui->spinBox_null->setValue(m_null);
|
||||
ui->spinBox_interval->setValue(interval());
|
||||
|
||||
int ret = exec();
|
||||
if (ret != 1) return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWEUAPI);
|
||||
setExecutable(ui->lineEdit_command->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
setNull(ui->spinBox_null->value());
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Exec"), m_executable);
|
||||
settings.setValue(QString("X-AW-Null"), m_null);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::updateValue()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process->exitCode();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process->readAllStandardError();
|
||||
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardOutput()).trimmed();
|
||||
value[tag(QString("pkgcount"))] = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count() - m_null;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label_command->setText(i18n("Command"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->label_null->setText(i18n("Null"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
}
|
73
sources/awesomewidgets/extupgrade.h
Normal file
73
sources/awesomewidgets/extupgrade.h
Normal file
@ -0,0 +1,73 @@
|
||||
/***************************************************************************
|
||||
* 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 EXTUPGRADE_H
|
||||
#define EXTUPGRADE_H
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class ExtUpgrade;
|
||||
}
|
||||
|
||||
class ExtUpgrade : public AbstractExtItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString executable READ executable WRITE setExecutable)
|
||||
Q_PROPERTY(int null READ null WRITE setNull)
|
||||
|
||||
public:
|
||||
explicit ExtUpgrade(QWidget *parent = nullptr, const QString upgradeName = QString(),
|
||||
const QStringList directories = QStringList(),
|
||||
const bool debugCmd = false);
|
||||
~ExtUpgrade();
|
||||
ExtUpgrade *copy(const QString fileName, const int number);
|
||||
// get methods
|
||||
QString executable() const;
|
||||
int null() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||
void setNull(const int _null = 0);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void updateValue();
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
QProcess *process = nullptr;
|
||||
Ui::ExtUpgrade *ui;
|
||||
void translate();
|
||||
// properties
|
||||
QString m_executable = QString("/usr/bin/true");
|
||||
int m_null = 0;
|
||||
// internal properties
|
||||
int times = 0;
|
||||
QVariantHash value;
|
||||
};
|
||||
|
||||
|
||||
#endif /* EXTUPGRADE_H */
|
429
sources/awesomewidgets/extweather.cpp
Normal file
429
sources/awesomewidgets/extweather.cpp
Normal file
@ -0,0 +1,429 @@
|
||||
/***************************************************************************
|
||||
* 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 "extweather.h"
|
||||
#include "ui_extweather.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <qreplytimeout/qreplytimeout.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtWeather::ExtWeather(QWidget *parent, const QString weatherName,
|
||||
const QStringList directories, const bool debugCmd)
|
||||
: AbstractExtItem(parent, weatherName, directories, debugCmd),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::ExtWeather)
|
||||
{
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
values[tag(QString("weatherId"))] = 0;
|
||||
values[tag(QString("weather"))] = QString("");
|
||||
values[tag(QString("humidity"))] = 0;
|
||||
values[tag(QString("pressure"))] = 0.0;
|
||||
values[tag(QString("temperature"))] = 0.0;
|
||||
|
||||
manager = new QNetworkAccessManager(this);
|
||||
connect(manager, SIGNAL(finished(QNetworkReply *)),
|
||||
this, SLOT(weatherReplyReceived(QNetworkReply *)));
|
||||
}
|
||||
|
||||
|
||||
ExtWeather::~ExtWeather()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
disconnect(manager, SIGNAL(finished(QNetworkReply *)),
|
||||
this, SLOT(weatherReplyReceived(QNetworkReply *)));
|
||||
|
||||
delete manager;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
ExtWeather *ExtWeather::copy(const QString fileName, const int number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ExtWeather *item = new ExtWeather(static_cast<QWidget *>(parent()), fileName,
|
||||
directories(), debug);
|
||||
item->setActive(isActive());
|
||||
item->setApiVersion(apiVersion());
|
||||
item->setCity(city());
|
||||
item->setComment(comment());
|
||||
item->setCountry(country());
|
||||
item->setInterval(interval());
|
||||
item->setName(name());
|
||||
item->setNumber(number);
|
||||
item->setTs(ts());
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::weatherFromInt(const int _id) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "ID" << _id;
|
||||
// refer to http://openweathermap.org/weather-conditions
|
||||
|
||||
QString weather;
|
||||
switch (_id) {
|
||||
case 800:
|
||||
// 01d
|
||||
weather = QString("\u2600");
|
||||
break;
|
||||
case 801:
|
||||
// 02d
|
||||
weather = QString("\u26C5");
|
||||
break;
|
||||
case 802:
|
||||
case 803:
|
||||
// 03d
|
||||
weather = QString("\u2601");
|
||||
break;
|
||||
case 804:
|
||||
// 04d
|
||||
weather = QString("\u2601");
|
||||
break;
|
||||
case 300:
|
||||
case 301:
|
||||
case 302:
|
||||
case 310:
|
||||
case 311:
|
||||
case 312:
|
||||
case 313:
|
||||
case 314:
|
||||
case 321:
|
||||
case 520:
|
||||
case 521:
|
||||
case 522:
|
||||
case 531:
|
||||
// 09d
|
||||
weather = QString("\u2602");
|
||||
break;
|
||||
case 500:
|
||||
case 501:
|
||||
case 502:
|
||||
case 503:
|
||||
case 504:
|
||||
// 10d
|
||||
weather = QString("\u2614");
|
||||
break;
|
||||
case 200:
|
||||
case 201:
|
||||
case 202:
|
||||
case 210:
|
||||
case 211:
|
||||
case 212:
|
||||
case 221:
|
||||
case 230:
|
||||
case 231:
|
||||
case 232:
|
||||
// 11d
|
||||
weather = QString("\u2608");
|
||||
break;
|
||||
case 511:
|
||||
case 600:
|
||||
case 601:
|
||||
case 602:
|
||||
case 611:
|
||||
case 612:
|
||||
case 615:
|
||||
case 616:
|
||||
case 620:
|
||||
case 621:
|
||||
case 622:
|
||||
// 13d
|
||||
weather = QString("\u2603");
|
||||
// weather = QString("\u26C4");
|
||||
break;
|
||||
case 701:
|
||||
case 711:
|
||||
case 721:
|
||||
case 731:
|
||||
case 741:
|
||||
case 751:
|
||||
case 761:
|
||||
case 762:
|
||||
case 771:
|
||||
case 781:
|
||||
// 50d
|
||||
weather = QString("\u26C5");
|
||||
break;
|
||||
default:
|
||||
// extreme other conditions
|
||||
weather = QString("\u2604");
|
||||
break;
|
||||
}
|
||||
|
||||
return weather;
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::city() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_city;
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::country() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_country;
|
||||
}
|
||||
|
||||
|
||||
int ExtWeather::ts() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_ts;
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::uniq() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return QString("%1 (%2) at %3").arg(m_city).arg(m_country).arg(m_ts);
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::setCity(const QString _city)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "City" << _city;
|
||||
|
||||
m_city = _city;
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::setCountry(const QString _country)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Country" << _country;
|
||||
|
||||
m_country = _country;
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::setTs(const int _ts)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Timestamp" << _ts;
|
||||
|
||||
m_ts = _ts;
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) continue;
|
||||
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setCity(settings.value(QString("X-AW-City"), m_city).toString());
|
||||
setCountry(settings.value(QString("X-AW-Country"), m_country).toString());
|
||||
setTs(settings.value(QString("X-AW-TS"), m_ts).toInt());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
// update for current API
|
||||
if ((apiVersion() > 0) && (apiVersion() < AWEWAPI)) {
|
||||
setApiVersion(AWEWAPI);
|
||||
writeConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QVariantHash ExtWeather::run()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if ((!isActive()) || (isRunning)) return values;
|
||||
|
||||
if (times == 1) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Send request";
|
||||
isRunning = true;
|
||||
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url(m_ts != 0))));
|
||||
new QReplyTimeout(reply, 1000);
|
||||
}
|
||||
|
||||
// update value
|
||||
if (times >= interval()) times = 0;
|
||||
times++;
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
int ExtWeather::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
ui->lineEdit_comment->setText(comment());
|
||||
ui->label_numberValue->setText(QString("%1").arg(number()));
|
||||
ui->lineEdit_city->setText(m_city);
|
||||
ui->lineEdit_country->setText(m_country);
|
||||
ui->spinBox_timestamp->setValue(m_ts);
|
||||
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked);
|
||||
ui->spinBox_interval->setValue(interval());
|
||||
|
||||
int ret = exec();
|
||||
if (ret != 1) return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWEWAPI);
|
||||
setCity(ui->lineEdit_city->text());
|
||||
setCountry(ui->lineEdit_country->text());
|
||||
setTs(ui->spinBox_timestamp->value());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("X-AW-City"), m_city);
|
||||
settings.setValue(QString("X-AW-Country"), m_country);
|
||||
settings.setValue(QString("X-AW-TS"), m_ts);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
|
||||
|
||||
isRunning = false;
|
||||
QJsonParseError error;
|
||||
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;
|
||||
}
|
||||
|
||||
// convert to map
|
||||
QVariantMap json = jsonDoc.toVariant().toMap();
|
||||
if (json[QString("cod")].toInt() != 200) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Invalid return code";
|
||||
return;
|
||||
}
|
||||
|
||||
QVariantHash data;
|
||||
if (m_ts == 0)
|
||||
data = parseSingleJson(json);
|
||||
else {
|
||||
QVariantList list = json[QString("list")].toList();
|
||||
data = parseSingleJson(list.count() <= m_ts ? list.at(m_ts-1).toMap() : list.last().toMap());
|
||||
}
|
||||
foreach(QString key, data.keys()) values[tag(key)] = data[key];
|
||||
}
|
||||
|
||||
|
||||
QVariantHash ExtWeather::parseSingleJson(const QVariantMap json) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QVariantHash output;
|
||||
|
||||
// weather status
|
||||
QVariantList weather = json[QString("weather")].toList();
|
||||
if (!weather.isEmpty()) {
|
||||
int _id = weather.first().toMap()[QString("id")].toInt();
|
||||
output[QString("weatherId")] = _id;
|
||||
output[QString("weather")] = weatherFromInt(_id);
|
||||
}
|
||||
|
||||
// main data
|
||||
QVariantMap mainWeather = json[QString("main")].toMap();
|
||||
if (!weather.isEmpty()) {
|
||||
output[QString("humidity")] = mainWeather[QString("humidity")].toFloat();
|
||||
output[QString("pressure")] = mainWeather[QString("pressure")].toFloat();
|
||||
output[QString("temperature")] = mainWeather[QString("temp")].toFloat();
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label_city->setText(i18n("City"));
|
||||
ui->label_country->setText(i18n("Country"));
|
||||
ui->label_timestamp->setText(i18n("Timestamp"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::url(const bool isForecast) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << "Is forecast" << isForecast;
|
||||
|
||||
QString apiUrl = isForecast ? QString(OWM_FORECAST_URL) : QString(OWM_URL);
|
||||
apiUrl.replace(QString("$CITY"), m_city);
|
||||
apiUrl.replace(QString("$COUNTRY"), m_country);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "API url" << apiUrl;
|
||||
|
||||
return apiUrl;
|
||||
}
|
85
sources/awesomewidgets/extweather.h
Normal file
85
sources/awesomewidgets/extweather.h
Normal file
@ -0,0 +1,85 @@
|
||||
/***************************************************************************
|
||||
* 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 EXTWEATHER_H
|
||||
#define EXTWEATHER_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
|
||||
#define OWM_URL "http://api.openweathermap.org/data/2.5/weather?q=$CITY,$COUNTRY&units=metric"
|
||||
#define OWM_FORECAST_URL "http://api.openweathermap.org/data/2.5/forecast?q=$CITY,$COUNTRY&units=metric"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class ExtWeather;
|
||||
}
|
||||
|
||||
class ExtWeather : public AbstractExtItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString city READ city WRITE setCity)
|
||||
Q_PROPERTY(QString country READ country WRITE setCountry)
|
||||
Q_PROPERTY(int ts READ ts WRITE setTs)
|
||||
|
||||
public:
|
||||
explicit ExtWeather(QWidget *parent = nullptr, const QString weatherName = QString(),
|
||||
const QStringList directories = QStringList(),
|
||||
const bool debugCmd = false);
|
||||
~ExtWeather();
|
||||
ExtWeather *copy(const QString fileName, const int number);
|
||||
QString weatherFromInt(const int _id) const;
|
||||
// get methods
|
||||
QString city() const;
|
||||
QString country() const;
|
||||
int ts() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setCity(const QString _city = QString("London"));
|
||||
void setCountry(const QString _country = QString("uk"));
|
||||
void setTs(const int _ts = 0);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void weatherReplyReceived(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
QNetworkAccessManager *manager;
|
||||
bool isRunning = false;
|
||||
Ui::ExtWeather *ui;
|
||||
QVariantHash parseSingleJson(const QVariantMap json) const;
|
||||
void translate();
|
||||
QString url(const bool isForecast = false) const;
|
||||
// properties
|
||||
QString m_city = QString("London");
|
||||
QString m_country = QString("uk");
|
||||
int m_ts = 0;
|
||||
// values
|
||||
int times = 0;
|
||||
QVariantHash values;
|
||||
};
|
||||
|
||||
|
||||
#endif /* EXTWEATHER_H */
|
271
sources/awesomewidgets/extweather.ui
Normal file
271
sources/awesomewidgets/extweather.ui
Normal file
@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExtWeather</class>
|
||||
<widget class="QDialog" name="ExtWeather">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>420</width>
|
||||
<height>301</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Configuration</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_name">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_name"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_comment">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_comment">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_comment"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_number">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_number">
|
||||
<property name="text">
|
||||
<string>Tag</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_numberValue">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_city">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_city">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>City</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_city"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_country">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_country">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Country</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_country"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_timestamp">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_timestamp">
|
||||
<property name="text">
|
||||
<string>Timestamp</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_timestamp">
|
||||
<property name="maximum">
|
||||
<number>40</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_active">
|
||||
<item>
|
||||
<spacer name="spacer_active">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_active">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Active</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_interval">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_interval">
|
||||
<property name="text">
|
||||
<string>Interval</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_interval">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>60</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ExtWeather</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ExtWeather</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -34,16 +34,16 @@
|
||||
#include "version.h"
|
||||
|
||||
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd)
|
||||
: QDialog(parent),
|
||||
m_fileName(desktopName),
|
||||
m_dirs(directories),
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
|
||||
const QStringList directories, const bool debugCmd)
|
||||
: AbstractExtItem(parent, desktopName, directories, debugCmd),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::GraphicalItem)
|
||||
{
|
||||
readConfiguration();
|
||||
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
connect(ui->pushButton_activeColor, SIGNAL(clicked()), this, SLOT(changeColor()));
|
||||
connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this, SLOT(changeColor()));
|
||||
}
|
||||
@ -57,7 +57,31 @@ GraphicalItem::~GraphicalItem()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::image(const float value)
|
||||
GraphicalItem *GraphicalItem::copy(const QString fileName, const int number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
GraphicalItem *item = new GraphicalItem(static_cast<QWidget *>(parent()),
|
||||
fileName, directories(), debug);
|
||||
item->setActive(isActive());
|
||||
item->setActiveColor(activeColor());
|
||||
item->setApiVersion(apiVersion());
|
||||
item->setBar(bar());
|
||||
item->setComment(comment());
|
||||
item->setDirection(direction());
|
||||
item->setHeight(height());
|
||||
item->setInactiveColor(inactiveColor());
|
||||
item->setInterval(interval());
|
||||
item->setName(QString("bar%1").arg(number));
|
||||
item->setNumber(number);
|
||||
item->setType(type());
|
||||
item->setWidth(width());
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::image(const float value) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
|
||||
@ -137,39 +161,7 @@ QString GraphicalItem::image(const float value)
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::fileName()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::apiVersion()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_apiVersion;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::name()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::comment()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::bar()
|
||||
QString GraphicalItem::bar() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -177,7 +169,7 @@ QString GraphicalItem::bar()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::activeColor()
|
||||
QString GraphicalItem::activeColor() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -185,7 +177,7 @@ QString GraphicalItem::activeColor()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::inactiveColor()
|
||||
QString GraphicalItem::inactiveColor() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -193,7 +185,7 @@ QString GraphicalItem::inactiveColor()
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::Type GraphicalItem::type()
|
||||
GraphicalItem::Type GraphicalItem::type() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -201,7 +193,7 @@ GraphicalItem::Type GraphicalItem::type()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::strType()
|
||||
QString GraphicalItem::strType() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -222,7 +214,7 @@ QString GraphicalItem::strType()
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::Direction GraphicalItem::direction()
|
||||
GraphicalItem::Direction GraphicalItem::direction() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -230,7 +222,7 @@ GraphicalItem::Direction GraphicalItem::direction()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::strDirection()
|
||||
QString GraphicalItem::strDirection() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -248,7 +240,7 @@ QString GraphicalItem::strDirection()
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::height()
|
||||
int GraphicalItem::height() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -256,7 +248,7 @@ int GraphicalItem::height()
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::width()
|
||||
int GraphicalItem::width() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -264,30 +256,11 @@ int GraphicalItem::width()
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setApiVersion(const int _apiVersion)
|
||||
QString GraphicalItem::uniq() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||
|
||||
m_apiVersion = _apiVersion;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setName(const QString _name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setComment(const QString _comment)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||
|
||||
m_comment = _comment;
|
||||
return m_bar;
|
||||
}
|
||||
|
||||
|
||||
@ -393,15 +366,13 @@ void GraphicalItem::setWidth(const int _width)
|
||||
void GraphicalItem::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) continue;
|
||||
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setName(settings.value(QString("Name"), m_name).toString());
|
||||
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||
setApiVersion(settings.value(QString("X-AW-ApiVersion"), AWGIAPI).toInt());
|
||||
setBar(settings.value(QString("X-AW-Value"), m_bar).toString());
|
||||
setActiveColor(settings.value(QString("X-AW-ActiveColor"), m_activeColor).toString());
|
||||
setInactiveColor(settings.value(QString("X-AW-InactiveColor"), m_inactiveColor).toString());
|
||||
@ -409,17 +380,35 @@ void GraphicalItem::readConfiguration()
|
||||
setStrDirection(settings.value(QString("X-AW-Direction"), strDirection()).toString());
|
||||
setHeight(settings.value(QString("X-AW-Height"), m_height).toInt());
|
||||
setWidth(settings.value(QString("X-AW-Width"), m_width).toInt());
|
||||
// api == 2
|
||||
if (apiVersion() < 2) setNumber(bar().remove(QString("bar")).toInt());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
// update for current API
|
||||
if ((apiVersion() > 0) && (apiVersion() < AWGIAPI)) {
|
||||
setApiVersion(AWGIAPI);
|
||||
writeConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::showConfiguration(const QStringList tags)
|
||||
QVariantHash GraphicalItem::run()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_nameValue->setText(m_name);
|
||||
ui->lineEdit_comment->setText(m_comment);
|
||||
// required by abstract class
|
||||
return QVariantHash();
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::showConfiguration(const QVariant args)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
QStringList tags = args.toStringList();
|
||||
|
||||
ui->label_nameValue->setText(name());
|
||||
ui->lineEdit_comment->setText(comment());
|
||||
ui->comboBox_value->addItems(tags);
|
||||
ui->comboBox_value->addItem(m_bar);
|
||||
ui->comboBox_value->setCurrentIndex(ui->comboBox_value->count() - 1);
|
||||
@ -449,33 +438,15 @@ int GraphicalItem::showConfiguration(const QStringList tags)
|
||||
}
|
||||
|
||||
|
||||
bool GraphicalItem::tryDelete()
|
||||
void GraphicalItem::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||
|
||||
// check if exists
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::writeConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||
settings.setValue(QString("Name"), m_name);
|
||||
settings.setValue(QString("Comment"), m_comment);
|
||||
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||
settings.setValue(QString("X-AW-Value"), m_bar);
|
||||
settings.setValue(QString("X-AW-ActiveColor"), m_activeColor);
|
||||
settings.setValue(QString("X-AW-InactiveColor"), m_inactiveColor);
|
||||
@ -493,8 +464,8 @@ void GraphicalItem::changeColor()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QColor color = stringToColor((dynamic_cast<QPushButton *>(sender()))->text());
|
||||
QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
|
||||
QColor color = stringToColor((static_cast<QPushButton *>(sender()))->text());
|
||||
QColor newColor = QColorDialog::getColor(color, this, tr("Select color"),
|
||||
QColorDialog::ShowAlphaChannel);
|
||||
if (!newColor.isValid()) return;
|
||||
|
||||
@ -503,11 +474,11 @@ void GraphicalItem::changeColor()
|
||||
colorText.append(QString("%1").arg(newColor.green()));
|
||||
colorText.append(QString("%1").arg(newColor.blue()));
|
||||
colorText.append(QString("%1").arg(newColor.alpha()));
|
||||
dynamic_cast<QPushButton *>(sender())->setText(colorText.join(QChar(',')));
|
||||
static_cast<QPushButton *>(sender())->setText(colorText.join(QChar(',')));
|
||||
}
|
||||
|
||||
|
||||
QColor GraphicalItem::stringToColor(const QString _color)
|
||||
QColor GraphicalItem::stringToColor(const QString _color) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||
@ -516,10 +487,26 @@ QColor GraphicalItem::stringToColor(const QString _color)
|
||||
QStringList listColor = _color.split(QChar(','));
|
||||
while (listColor.count() < 4)
|
||||
listColor.append(QString("0"));
|
||||
qcolor.setRed(listColor[0].toInt());
|
||||
qcolor.setGreen(listColor[1].toInt());
|
||||
qcolor.setBlue(listColor[2].toInt());
|
||||
qcolor.setAlpha(listColor[3].toInt());
|
||||
qcolor.setRed(listColor.at(0).toInt());
|
||||
qcolor.setGreen(listColor.at(1).toInt());
|
||||
qcolor.setBlue(listColor.at(2).toInt());
|
||||
qcolor.setAlpha(listColor.at(3).toInt());
|
||||
|
||||
return qcolor;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_value->setText(i18n("Value"));
|
||||
ui->label_activeColor->setText(i18n("Active color"));
|
||||
ui->label_inactiveColor->setText(i18n("Inactive color"));
|
||||
ui->label_type->setText(i18n("Type"));
|
||||
ui->label_direction->setText(i18n("Direction"));
|
||||
ui->label_height->setText(i18n("Height"));
|
||||
ui->label_width->setText(i18n("Width"));
|
||||
}
|
@ -19,19 +19,17 @@
|
||||
#define GRAPHICALITEM_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QDialog>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class GraphicalItem;
|
||||
}
|
||||
|
||||
class GraphicalItem : public QDialog
|
||||
class GraphicalItem : public AbstractExtItem
|
||||
{
|
||||
Q_OBJECT
|
||||
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 bar READ bar WRITE setBar)
|
||||
Q_PROPERTY(QString activeColor READ activeColor WRITE setActiveColor)
|
||||
Q_PROPERTY(QString inactiveColor READ inactiveColor WRITE setInactiveColor)
|
||||
@ -52,27 +50,23 @@ public:
|
||||
};
|
||||
|
||||
explicit GraphicalItem(QWidget *parent = nullptr, const QString desktopName = QString(),
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
const QStringList directories = QStringList(),
|
||||
const bool debugCmd = false);
|
||||
~GraphicalItem();
|
||||
QString fileName();
|
||||
QString image(const float value);
|
||||
GraphicalItem *copy(const QString fileName, const int number);
|
||||
QString image(const float value) const;
|
||||
// get methods
|
||||
int apiVersion();
|
||||
QString name();
|
||||
QString comment();
|
||||
QString bar();
|
||||
QString activeColor();
|
||||
QString inactiveColor();
|
||||
Type type();
|
||||
QString strType();
|
||||
Direction direction();
|
||||
QString strDirection();
|
||||
int height();
|
||||
int width();
|
||||
QString bar() const;
|
||||
QString activeColor() const;
|
||||
QString inactiveColor() const;
|
||||
Type type() const;
|
||||
QString strType() const;
|
||||
Direction direction() const;
|
||||
QString strDirection() const;
|
||||
int height() const;
|
||||
int width() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setApiVersion(const int _apiVersion = 0);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setComment(const QString _comment = QString("empty"));
|
||||
void setBar(const QString _bar = QString("cpu"));
|
||||
void setActiveColor(const QString _color = QString("0,0,0,130"));
|
||||
void setInactiveColor(const QString _color = QString("255,255,255,130"));
|
||||
@ -85,19 +79,20 @@ public:
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QStringList tags = QStringList());
|
||||
bool tryDelete();
|
||||
void writeConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void changeColor();
|
||||
|
||||
private:
|
||||
QColor stringToColor(const QString _color);
|
||||
QString m_fileName;
|
||||
QStringList m_dirs;
|
||||
bool debug;
|
||||
Ui::GraphicalItem *ui;
|
||||
QColor stringToColor(const QString _color) const;
|
||||
void translate();
|
||||
// properties
|
||||
int m_apiVersion = 0;
|
||||
QString m_name = QString("none");
|
11
sources/awesomewidgets/weather/london.desktop
Normal file
11
sources/awesomewidgets/weather/london.desktop
Normal file
@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Comment=London current weather
|
||||
Encoding=UTF-8
|
||||
Name=London current
|
||||
X-AW-Active=false
|
||||
X-AW-ApiVersion=1
|
||||
X-AW-City=London
|
||||
X-AW-Country=uk
|
||||
X-AW-Interval=3600
|
||||
X-AW-Number=0
|
||||
X-AW-TS=0
|
@ -1,19 +1,7 @@
|
||||
# set project name
|
||||
set (SUBPROJECT plasma_applet_desktop-panel)
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
set(SUBPROJECT plasma_applet_desktop-panel)
|
||||
message(STATUS "Subproject ${SUBPROJECT}")
|
||||
|
||||
# prepare
|
||||
configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||
configure_file(metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||
|
||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
|
||||
find_package (Qt5 REQUIRED COMPONENTS Core Qml)
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma Service WindowSystem)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
add_subdirectory (plugin)
|
||||
plasma_install_package (package org.kde.plasma.desktoppanel)
|
||||
add_subdirectory(plugin)
|
||||
plasma_install_package(package org.kde.plasma.desktoppanel)
|
||||
|
@ -19,17 +19,22 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.desktoppanel 1.0
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: aboutPage
|
||||
// backend
|
||||
DPAdds {
|
||||
id: dpAdds;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
property bool debug: dpAdds.isDebugEnabled()
|
||||
|
||||
|
||||
Column {
|
||||
@ -45,26 +50,27 @@ Item {
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: DPAdds.getAboutText("header")
|
||||
text: dpAdds.getAboutText("header")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: DPAdds.getAboutText("version")
|
||||
text: dpAdds.getAboutText("version")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: DPAdds.getAboutText("description")
|
||||
text: dpAdds.getAboutText("description")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
textFormat: Text.RichText
|
||||
text: DPAdds.getAboutText("links")
|
||||
text: dpAdds.getAboutText("links")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
@ -74,7 +80,7 @@ Item {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignBottom
|
||||
textFormat: Text.RichText
|
||||
text: DPAdds.getAboutText("copy")
|
||||
text: dpAdds.getAboutText("copy")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,7 +93,7 @@ Item {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: DPAdds.getAboutText("translators")
|
||||
text: dpAdds.getAboutText("translators")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
@ -96,7 +102,8 @@ Item {
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
verticalAlignment: Text.AlignTop
|
||||
textFormat: Text.RichText
|
||||
text: DPAdds.getAboutText("3rdparty")
|
||||
text: dpAdds.getAboutText("3rdparty")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,17 +20,22 @@ import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.desktoppanel 1.0
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: activeAppearancePage
|
||||
// backend
|
||||
DPAdds {
|
||||
id: dpAdds;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
property bool debug: dpAdds.isDebugEnabled()
|
||||
property variant weight: {
|
||||
25: 0,
|
||||
50: 1,
|
||||
@ -63,7 +68,10 @@ Item {
|
||||
id: selectFont
|
||||
width: parent.width * 2 / 3
|
||||
text: plasmoid.configuration.currentFontFamily
|
||||
onClicked: fontDialog.visible = true
|
||||
onClicked: {
|
||||
fontDialog.setFont()
|
||||
fontDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,13 +211,22 @@ Item {
|
||||
QtDialogs.FontDialog {
|
||||
id: fontDialog
|
||||
title: i18n("Select a font")
|
||||
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||
signal setFont
|
||||
|
||||
onAccepted: {
|
||||
selectFont.text = fontDialog.font.family
|
||||
fontSize.value = fontDialog.font.pointSize
|
||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||
}
|
||||
onSetFont: {
|
||||
fontDialog.font = Qt.font({
|
||||
family: selectFont.text,
|
||||
pointSize: fontSize.value > 0 ? fontSize.value : 12,
|
||||
italic: fontStyle.currentIndex == 1,
|
||||
weight: Font.Normal,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
@ -20,17 +20,22 @@ import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.desktoppanel 1.0
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: advancedPage
|
||||
// backend
|
||||
DPAdds {
|
||||
id: dpAdds;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
property bool debug: dpAdds.isDebugEnabled()
|
||||
|
||||
property alias cfg_height: widgetHeight.value
|
||||
property alias cfg_width: widgetWidth.value
|
||||
@ -237,7 +242,7 @@ Item {
|
||||
// QtControls.Button {
|
||||
// width: parent.width * 3 / 5
|
||||
// text: i18n("Edit panels")
|
||||
// onClicked: cfg_panels = DPAdds.editPanelsToContol(plasmoid.configuration.panels)
|
||||
// onClicked: cfg_panels = dpAdds.editPanelsToContol(plasmoid.configuration.panels)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -20,17 +20,22 @@ import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.desktoppanel 1.0
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: inactiveAppearancePage
|
||||
// backend
|
||||
DPAdds {
|
||||
id: dpAdds;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property bool debug: dpAdds.isDebugEnabled()
|
||||
property variant weight: {
|
||||
25: 0,
|
||||
50: 1,
|
||||
@ -63,7 +68,10 @@ Item {
|
||||
id: selectFont
|
||||
width: parent.width * 2 / 3
|
||||
text: plasmoid.configuration.fontFamily
|
||||
onClicked: fontDialog.visible = true
|
||||
onClicked: {
|
||||
fontDialog.setFont()
|
||||
fontDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,13 +211,22 @@ Item {
|
||||
QtDialogs.FontDialog {
|
||||
id: fontDialog
|
||||
title: i18n("Select a font")
|
||||
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||
signal setFont
|
||||
|
||||
onAccepted: {
|
||||
selectFont.text = fontDialog.font.family
|
||||
fontSize.value = fontDialog.font.pointSize
|
||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||
}
|
||||
onSetFont: {
|
||||
fontDialog.font = Qt.font({
|
||||
family: selectFont.text,
|
||||
pointSize: fontSize.value > 0 ? fontSize.value : 12,
|
||||
italic: fontStyle.currentIndex == 1,
|
||||
weight: Font.Normal,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
@ -22,14 +22,18 @@ import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.desktoppanel 1.0
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
import "."
|
||||
|
||||
|
||||
Item {
|
||||
id: main
|
||||
// backend
|
||||
DPAdds {
|
||||
id: dpAdds;
|
||||
}
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
property bool debug: dpAdds.isDebugEnabled()
|
||||
property variant tooltipSettings: {
|
||||
"tooltipColor": plasmoid.configuration.tooltipColor,
|
||||
"tooltipType": plasmoid.configuration.tooltipType,
|
||||
@ -54,31 +58,32 @@ Item {
|
||||
// ui
|
||||
GridLayout {
|
||||
anchors.fill: parent
|
||||
columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops()
|
||||
rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1
|
||||
columns: plasmoid.configuration.verticalLayout ? 1 : dpAdds.numberOfDesktops()
|
||||
rows: plasmoid.configuration.verticalLayout ? dpAdds.numberOfDesktops() : 1
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
Layout.columnSpan: 0
|
||||
Layout.rowSpan: 0
|
||||
model: DPAdds.numberOfDesktops()
|
||||
model: dpAdds.numberOfDesktops()
|
||||
|
||||
Text {
|
||||
id: text
|
||||
height: contentHeight
|
||||
width: contentWidth
|
||||
renderType: Text.NativeRendering
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.NoWrap
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
text: DPAdds.parsePattern(plasmoid.configuration.text, index + 1)
|
||||
text: dpAdds.parsePattern(plasmoid.configuration.text, index + 1)
|
||||
property alias tooltip: tooltip
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: DPAdds.setCurrentDesktop(index + 1);
|
||||
onClicked: dpAdds.setCurrentDesktop(index + 1);
|
||||
onEntered: needTooltipUpdate()
|
||||
}
|
||||
|
||||
@ -111,8 +116,8 @@ Item {
|
||||
timer.start()
|
||||
return
|
||||
}
|
||||
repeater.itemAt(i).text = DPAdds.parsePattern(plasmoid.configuration.text, i + 1)
|
||||
if (DPAdds.currentDesktop() == i + 1) {
|
||||
repeater.itemAt(i).text = dpAdds.parsePattern(plasmoid.configuration.text, i + 1)
|
||||
if (dpAdds.currentDesktop() == i + 1) {
|
||||
repeater.itemAt(i).color = plasmoid.configuration.currentFontColor
|
||||
repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic" ? true : false
|
||||
@ -136,7 +141,7 @@ Item {
|
||||
if (debug) console.log("[main::onNeedTooltipUpdate]")
|
||||
|
||||
for (var i=0; i<repeater.count; i++) {
|
||||
repeater.itemAt(i).tooltip.text = DPAdds.toolTipImage(i + 1)
|
||||
repeater.itemAt(i).tooltip.text = dpAdds.toolTipImage(i + 1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,16 +173,16 @@ Item {
|
||||
Plasmoid.onActivated: {
|
||||
if (debug) console.log("[main::onActivated]")
|
||||
|
||||
// DPAdds.changePanelsState()
|
||||
// dpAdds.changePanelsState()
|
||||
}
|
||||
|
||||
Plasmoid.onUserConfiguringChanged: {
|
||||
if (plasmoid.userConfiguring) return
|
||||
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||
|
||||
DPAdds.setMark(plasmoid.configuration.mark)
|
||||
DPAdds.setPanelsToControl(plasmoid.configuration.panels)
|
||||
DPAdds.setToolTipData(tooltipSettings)
|
||||
dpAdds.setMark(plasmoid.configuration.mark)
|
||||
dpAdds.setPanelsToControl(plasmoid.configuration.panels)
|
||||
dpAdds.setToolTipData(tooltipSettings)
|
||||
|
||||
needUpdate()
|
||||
}
|
||||
@ -187,7 +192,7 @@ Item {
|
||||
|
||||
// init submodule
|
||||
Plasmoid.userConfiguringChanged(false)
|
||||
DPAdds.desktopChanged.connect(needUpdate)
|
||||
DPAdds.windowListChanged.connect(needTooltipUpdate)
|
||||
dpAdds.desktopChanged.connect(needUpdate)
|
||||
dpAdds.windowListChanged.connect(needTooltipUpdate)
|
||||
}
|
||||
}
|
||||
|
@ -18,17 +18,22 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
|
||||
import org.kde.plasma.desktoppanel 1.0
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: widgetPage
|
||||
// backend
|
||||
DPAdds {
|
||||
id: dpAdds;
|
||||
}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
property bool debug: dpAdds.isDebugEnabled()
|
||||
|
||||
property alias cfg_text: textPattern.text
|
||||
|
||||
@ -42,6 +47,7 @@ Item {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Detailed information may be found on <a href=\"http://arcanis.name/projects/awesome-widgets/\">project homepage</a>")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
|
||||
Row {
|
||||
@ -60,7 +66,7 @@ Item {
|
||||
"family": plasmoid.configuration.fontFamily,
|
||||
"size": plasmoid.configuration.fontSize
|
||||
}
|
||||
var font = DPAdds.getFont(defaultFont)
|
||||
var font = dpAdds.getFont(defaultFont)
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
@ -197,7 +203,7 @@ Item {
|
||||
QtControls.ComboBox {
|
||||
id: tags
|
||||
width: parent.width - addTagButton.width - showValueButton.width
|
||||
model: DPAdds.dictKeys()
|
||||
model: dpAdds.dictKeys()
|
||||
}
|
||||
QtControls.Button {
|
||||
id: addTagButton
|
||||
@ -221,8 +227,8 @@ Item {
|
||||
|
||||
var message = i18n("Tag: %1", tags.currentText)
|
||||
message += "<br>"
|
||||
message += i18n("Value: %1", DPAdds.valueByKey(tags.currentText))
|
||||
DPAdds.sendNotification("tag", message)
|
||||
message += i18n("Value: %1", dpAdds.valueByKey(tags.currentText))
|
||||
dpAdds.sendNotification("tag", message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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=2.3.0
|
||||
X-KDE-PluginInfo-Version=2.4.0
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
|
@ -1,33 +1,23 @@
|
||||
set (PLUGIN_NAME dpplugin)
|
||||
set(PLUGIN_NAME dpplugin)
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.desktoppanel\")
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Qml_INCLUDE_DIRS})
|
||||
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
||||
${Qt5Qml_LIBRARIES})
|
||||
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||
${Notifications_INCLUDE_DIR}
|
||||
${Plasma_INCLUDE_DIR})
|
||||
set (Kf5_LIBRARIES KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::Plasma
|
||||
KF5::WindowSystem)
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE}
|
||||
)
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE})
|
||||
file(GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
||||
file(GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
add_library(${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||
target_link_libraries(${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/desktoppanel)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/desktoppanel)
|
||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
install(TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
|
||||
install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
|
||||
install(FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
|
@ -22,18 +22,9 @@
|
||||
#include "dpadds.h"
|
||||
|
||||
|
||||
static QObject *dpadds_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
|
||||
return new DPAdds();
|
||||
}
|
||||
|
||||
|
||||
void DPPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.desktoppanel"));
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.desktoppanel"));
|
||||
|
||||
qmlRegisterSingletonType<DPAdds>(uri, 1, 0, "DPAdds", dpadds_singletontype_provider);
|
||||
qmlRegisterType<DPAdds>(uri, 1, 0, "DPAdds");
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include <fontdialog/fontdialog.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <pdebug/pdebug-time.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
@ -42,6 +43,8 @@
|
||||
DPAdds::DPAdds(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
qInstallMessageHandler(debugString);
|
||||
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
@ -59,7 +62,7 @@ DPAdds::~DPAdds()
|
||||
}
|
||||
|
||||
|
||||
bool DPAdds::isDebugEnabled()
|
||||
bool DPAdds::isDebugEnabled() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -67,7 +70,7 @@ bool DPAdds::isDebugEnabled()
|
||||
}
|
||||
|
||||
|
||||
int DPAdds::currentDesktop()
|
||||
int DPAdds::currentDesktop() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -75,7 +78,7 @@ int DPAdds::currentDesktop()
|
||||
}
|
||||
|
||||
|
||||
QStringList DPAdds::dictKeys()
|
||||
QStringList DPAdds::dictKeys() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -89,7 +92,7 @@ QStringList DPAdds::dictKeys()
|
||||
}
|
||||
|
||||
|
||||
int DPAdds::numberOfDesktops()
|
||||
int DPAdds::numberOfDesktops() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -97,7 +100,7 @@ int DPAdds::numberOfDesktops()
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::toolTipImage(const int desktop)
|
||||
QString DPAdds::toolTipImage(const int desktop) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||
@ -107,8 +110,7 @@ QString DPAdds::toolTipImage(const int desktop)
|
||||
DesktopWindowsInfo info = getInfoByDesktop(desktop);
|
||||
if (tooltipType == QString("names")) {
|
||||
QStringList windowList;
|
||||
for (int i=0; i<info.windowsData.count(); i++)
|
||||
windowList.append(info.windowsData[i].name);
|
||||
foreach(WindowData data, info.windowsData) windowList.append(data.name);
|
||||
return QString("<ul><li>%1</li></ul>").arg(windowList.join(QString("</li><li>")));
|
||||
}
|
||||
// init
|
||||
@ -136,8 +138,8 @@ QString DPAdds::toolTipImage(const int desktop)
|
||||
QPen pen = QPen();
|
||||
pen.setWidthF(2.0 * info.desktop.width() / 400.0);
|
||||
pen.setColor(QColor(tooltipColor));
|
||||
for (int i=0; i<info.windowsData.count(); i++) {
|
||||
QRect rect = info.windowsData[i].rect;
|
||||
foreach(WindowData data, info.windowsData) {
|
||||
QRect rect = data.rect;
|
||||
toolTipScene->addLine(rect.left() + margin, rect.bottom() + margin,
|
||||
rect.left() + margin, rect.top() + margin, pen);
|
||||
toolTipScene->addLine(rect.left() + margin, rect.top() + margin,
|
||||
@ -149,22 +151,19 @@ QString DPAdds::toolTipImage(const int desktop)
|
||||
}
|
||||
} else if (tooltipType == QString("clean")) {
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
for (int i=0; i<info.desktopsData.count(); i++) {
|
||||
QPixmap desktop = screen->grabWindow(info.desktopsData[i].id);
|
||||
toolTipScene->addPixmap(desktop)
|
||||
->setOffset(info.desktopsData[i].rect.left(), info.desktopsData[i].rect.top());
|
||||
foreach(WindowData data, info.desktopsData) {
|
||||
QPixmap desktop = screen->grabWindow(data.id);
|
||||
toolTipScene->addPixmap(desktop)->setOffset(data.rect.left(), data.rect.top());
|
||||
}
|
||||
} else if (tooltipType == QString("windows")) {
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
for (int i=0; i<info.desktopsData.count(); i++) {
|
||||
QPixmap desktop = screen->grabWindow(info.desktopsData[i].id);
|
||||
toolTipScene->addPixmap(desktop)
|
||||
->setOffset(info.desktopsData[i].rect.left(), info.desktopsData[i].rect.top());
|
||||
foreach(WindowData data, info.desktopsData) {
|
||||
QPixmap desktop = screen->grabWindow(data.id);
|
||||
toolTipScene->addPixmap(desktop)->setOffset(data.rect.left(), data.rect.top());
|
||||
}
|
||||
for (int i=0; i<info.windowsData.count(); i++) {
|
||||
QPixmap window = screen->grabWindow(info.windowsData[i].id);
|
||||
toolTipScene->addPixmap(window)
|
||||
->setOffset(info.windowsData[i].rect.left(), info.windowsData[i].rect.top());
|
||||
foreach(WindowData data, info.windowsData) {
|
||||
QPixmap window = screen->grabWindow(data.id);
|
||||
toolTipScene->addPixmap(window)->setOffset(data.rect.left(), data.rect.top());
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,15 +179,14 @@ QString DPAdds::toolTipImage(const int desktop)
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::parsePattern(const QString pattern, const int desktop)
|
||||
QString DPAdds::parsePattern(const QString pattern, const int desktop) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString parsed = pattern;
|
||||
QStringList keys = dictKeys();
|
||||
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||
for (int i=0; i<keys.count(); i++)
|
||||
parsed.replace(QString("$%1").arg(keys[i]), valueByKey(keys[i], desktop));
|
||||
foreach(QString key, dictKeys())
|
||||
parsed.replace(QString("$%1").arg(key), valueByKey(key, desktop));
|
||||
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||
|
||||
return parsed;
|
||||
@ -215,8 +213,8 @@ void DPAdds::setPanelsToControl(const QString newPanels)
|
||||
for (int i=0; i<count; i++)
|
||||
panelsToControl.append(i);
|
||||
} else
|
||||
for (int i=0; i<newPanels.split(QChar(',')).count(); i++)
|
||||
panelsToControl.append(newPanels.split(QChar(','))[i].toInt());
|
||||
foreach(QString panel, newPanels.split(QChar(',')))
|
||||
panelsToControl.append(panel.toInt());
|
||||
}
|
||||
|
||||
|
||||
@ -231,7 +229,7 @@ void DPAdds::setToolTipData(const QVariantMap tooltipData)
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::valueByKey(const QString key, int desktop)
|
||||
QString DPAdds::valueByKey(const QString key, int desktop) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
|
||||
@ -271,7 +269,7 @@ QString DPAdds::editPanelsToContol(const QString current)
|
||||
// fill
|
||||
QList<Plasma::Containment *> panels = getPanels();
|
||||
for (int i=0; i<panels.count(); i++) {
|
||||
QListWidgetItem *item = new QListWidgetItem(panelLocationToStr(panels[i]->location()), widget);
|
||||
QListWidgetItem *item = new QListWidgetItem(panelLocationToStr(panels.at(i)->location()), widget);
|
||||
if ((current.split(QChar(',')).contains(QString::number(i))) ||
|
||||
(current == QString("-1")))
|
||||
item->setCheckState(Qt::Checked);
|
||||
@ -302,7 +300,7 @@ QString DPAdds::editPanelsToContol(const QString current)
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::getAboutText(const QString type)
|
||||
QString DPAdds::getAboutText(const QString type) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
|
||||
@ -331,9 +329,9 @@ QString DPAdds::getAboutText(const QString type)
|
||||
QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts);
|
||||
for (int i=0; i<trdPartyList.count(); i++)
|
||||
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)")
|
||||
.arg(trdPartyList[i].split(QChar(','))[0])
|
||||
.arg(trdPartyList[i].split(QChar(','))[1])
|
||||
.arg(trdPartyList[i].split(QChar(','))[2]);
|
||||
.arg(trdPartyList.at(i).split(QChar(',')).at(0))
|
||||
.arg(trdPartyList.at(i).split(QChar(',')).at(1))
|
||||
.arg(trdPartyList.at(i).split(QChar(',')).at(2));
|
||||
text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
|
||||
}
|
||||
|
||||
@ -341,7 +339,7 @@ QString DPAdds::getAboutText(const QString type)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap DPAdds::getFont(const QVariantMap defaultFont)
|
||||
QVariantMap DPAdds::getFont(const QVariantMap defaultFont) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -359,7 +357,7 @@ QVariantMap DPAdds::getFont(const QVariantMap defaultFont)
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::changePanelsState()
|
||||
void DPAdds::changePanelsState() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (panelsToControl.isEmpty()) return;
|
||||
@ -367,16 +365,16 @@ void DPAdds::changePanelsState()
|
||||
// QList<Plasma::Containment *> panels = getPanels();
|
||||
// for (int i=0; i<panels.count(); i++) {
|
||||
// if (!panelsToControl.contains(i)) continue;
|
||||
// bool wasVisible = panels[i]->view()->isVisible();
|
||||
// int winId = panels[i]->view()->winId();
|
||||
// bool wasVisible = panels.at(i)->view()->isVisible();
|
||||
// int winId = panels.at(i)->view()->winId();
|
||||
// if (wasVisible) {
|
||||
// if (debug) qDebug() << PDEBUG << ":" << "Hide panel";
|
||||
// KWindowInfo oldInfo = KWindowSystem::windowInfo(winId, NET::WMState);
|
||||
// oldState = oldInfo.state();
|
||||
// panels[i]->view()->setVisible(false);
|
||||
// panels.at(i)->view()->setVisible(false);
|
||||
// } else {
|
||||
// if (debug) qDebug() << PDEBUG << ":" << "Show panel";
|
||||
// panels[i]->view()->setVisible(true);
|
||||
// panels.at(i)->view()->setVisible(true);
|
||||
// KWindowSystem::clearState(winId, NET::KeepAbove);
|
||||
// KWindowSystem::setState(winId, oldState | NET::StaysOnTop);
|
||||
// KWindowSystem::setOnAllDesktops(winId, true);
|
||||
@ -393,7 +391,7 @@ void DPAdds::sendNotification(const QString eventId, const QString message)
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::setCurrentDesktop(const int desktop)
|
||||
void DPAdds::setCurrentDesktop(const int desktop) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||
@ -402,7 +400,7 @@ void DPAdds::setCurrentDesktop(const int desktop)
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::changeDesktop(const int desktop)
|
||||
void DPAdds::changeDesktop(const int desktop) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||
@ -411,7 +409,7 @@ void DPAdds::changeDesktop(const int desktop)
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::changeWindowList(const WId window)
|
||||
void DPAdds::changeWindowList(const WId window) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Window" << window;
|
||||
@ -420,7 +418,7 @@ void DPAdds::changeWindowList(const WId window)
|
||||
}
|
||||
|
||||
|
||||
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop)
|
||||
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||
@ -429,15 +427,14 @@ DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop)
|
||||
DesktopWindowsInfo info;
|
||||
info.desktop = KWindowSystem::workArea(desktop);
|
||||
|
||||
QList<WId> windows = KWindowSystem::windows();
|
||||
for (int i=0; i<windows.count(); i++) {
|
||||
KWindowInfo winInfo = KWindowInfo(windows[i],
|
||||
foreach(WId id, KWindowSystem::windows()) {
|
||||
KWindowInfo winInfo = KWindowInfo(id,
|
||||
NET::Property::WMDesktop | NET::Property::WMGeometry |
|
||||
NET::Property::WMState | NET::Property::WMWindowType |
|
||||
NET::Property::WMVisibleName);
|
||||
if (!winInfo.isOnDesktop(desktop)) continue;
|
||||
WindowData data;
|
||||
data.id = windows[i];
|
||||
data.id = id;
|
||||
data.name = winInfo.visibleName();
|
||||
data.rect = winInfo.geometry();
|
||||
if (winInfo.windowType(NET::WindowTypeMask::NormalMask) == NET::WindowType::Normal) {
|
||||
@ -452,22 +449,23 @@ DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop)
|
||||
}
|
||||
|
||||
|
||||
QList<Plasma::Containment *> DPAdds::getPanels()
|
||||
QList<Plasma::Containment *> DPAdds::getPanels() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// Plasma::Corona *corona = new Plasma::Corona(this);
|
||||
QList<Plasma::Containment *> panels;
|
||||
// for (int i=0; i<corona->containments().count(); i++)
|
||||
// if (corona->containments()[i]->containmentType() == Plasma::Types::ContainmentType::PanelContainment)
|
||||
// panels.append(corona->containments()[i]);
|
||||
// foreach(Plasma::Containment *cont, corona->containments()) {
|
||||
// if (cont->containmentType() != Plasma::Types::ContainmentType::PanelContainment) continue
|
||||
// panels.append(cont);
|
||||
// }
|
||||
// delete corona;
|
||||
|
||||
return panels;
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::panelLocationToStr(Plasma::Types::Location location)
|
||||
QString DPAdds::panelLocationToStr(Plasma::Types::Location location) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Location" << location;
|
||||
|
@ -46,39 +46,39 @@ public:
|
||||
DPAdds(QObject *parent = nullptr);
|
||||
~DPAdds();
|
||||
|
||||
Q_INVOKABLE bool isDebugEnabled();
|
||||
Q_INVOKABLE int currentDesktop();
|
||||
Q_INVOKABLE QStringList dictKeys();
|
||||
Q_INVOKABLE int numberOfDesktops();
|
||||
Q_INVOKABLE QString toolTipImage(const int desktop);
|
||||
Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop);
|
||||
Q_INVOKABLE bool isDebugEnabled() const;
|
||||
Q_INVOKABLE int currentDesktop() const;
|
||||
Q_INVOKABLE QStringList dictKeys() const;
|
||||
Q_INVOKABLE int numberOfDesktops() const;
|
||||
Q_INVOKABLE QString toolTipImage(const int desktop) const;
|
||||
Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop) const;
|
||||
// values
|
||||
Q_INVOKABLE void setMark(const QString newMark);
|
||||
Q_INVOKABLE void setPanelsToControl(const QString newPanels);
|
||||
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) const;
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString editPanelsToContol(const QString current);
|
||||
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont);
|
||||
Q_INVOKABLE QString getAboutText(const QString type = "header") const;
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const;
|
||||
|
||||
signals:
|
||||
void desktopChanged();
|
||||
void windowListChanged();
|
||||
void desktopChanged() const;
|
||||
void windowListChanged() const;
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE void changePanelsState();
|
||||
Q_INVOKABLE void changePanelsState() const;
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message);
|
||||
Q_INVOKABLE void setCurrentDesktop(const int desktop);
|
||||
Q_INVOKABLE void setCurrentDesktop(const int desktop) const;
|
||||
|
||||
private slots:
|
||||
void changeDesktop(const int desktop);
|
||||
void changeWindowList(const WId window);
|
||||
void changeDesktop(const int desktop) const;
|
||||
void changeWindowList(const WId window) const;
|
||||
|
||||
private:
|
||||
DesktopWindowsInfo getInfoByDesktop(const int desktop);
|
||||
QList<Plasma::Containment *> getPanels();
|
||||
QString panelLocationToStr(Plasma::Types::Location location);
|
||||
DesktopWindowsInfo getInfoByDesktop(const int desktop) const;
|
||||
QList<Plasma::Containment *> getPanels() const;
|
||||
QString panelLocationToStr(Plasma::Types::Location location) const;
|
||||
// variables
|
||||
bool debug = false;
|
||||
int oldState, tooltipWidth = 200;
|
||||
|
@ -1,3 +1,3 @@
|
||||
module org.kde.plasma.desktoppanel
|
||||
module org.kde.plasma.private.desktoppanel
|
||||
|
||||
plugin dpplugin
|
||||
|
@ -1,57 +1,37 @@
|
||||
# set project name
|
||||
set (SUBPROJECT plasma_dataengine_extsysmon)
|
||||
set (PLUGIN_NAME ${SUBPROJECT})
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
set(SUBPROJECT plasma_dataengine_extsysmon)
|
||||
set(PLUGIN_NAME ${SUBPROJECT})
|
||||
message(STATUS "Subproject ${SUBPROJECT}")
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
||||
|
||||
# find required libaries
|
||||
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets)
|
||||
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../${PROJECT_LIBRARY}/
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE}
|
||||
)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
|
||||
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${KDE_INCLUDE})
|
||||
|
||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
file (GLOB SUBPROJECT_CONF *.conf)
|
||||
set (SUBPROJECT_QUOTES ${CMAKE_CURRENT_SOURCE_DIR}/quotes)
|
||||
set (SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
||||
set (SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
|
||||
file(GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||
file(RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||
file(GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
||||
set(TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
file(GLOB SUBPROJECT_CONF *.conf)
|
||||
|
||||
# prepare
|
||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
configure_file(${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
|
||||
# make
|
||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem
|
||||
${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES})
|
||||
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
qt5_wrap_cpp(TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
qt5_wrap_ui(SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library(${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries(${PLUGIN_NAME} ${PROJECT_LIBRARY} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
kcoreaddons_desktop_to_json(${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
|
||||
# install
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
install (DIRECTORY ${SUBPROJECT_QUOTES} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install(FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
|
@ -1,366 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "extquotes.h"
|
||||
#include "ui_extquotes.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
#include <QTime>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName, const QStringList directories, const bool debugCmd)
|
||||
: QDialog(parent),
|
||||
m_fileName(quotesName),
|
||||
m_dirs(directories),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::ExtQuotes)
|
||||
{
|
||||
m_name = m_fileName;
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
|
||||
values[QString("ask")] = 0.0;
|
||||
values[QString("askchg")] = 0.0;
|
||||
values[QString("percaskchg")] = 0.0;
|
||||
values[QString("bid")] = 0.0;
|
||||
values[QString("bidchg")] = 0.0;
|
||||
values[QString("percbidchg")] = 0.0;
|
||||
values[QString("price")] = 0.0;
|
||||
values[QString("pricechg")] = 0.0;
|
||||
values[QString("percpricechg")] = 0.0;
|
||||
}
|
||||
|
||||
|
||||
ExtQuotes::~ExtQuotes()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
int ExtQuotes::apiVersion()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_apiVersion;
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::comment()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::fileName()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
|
||||
int ExtQuotes::interval()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_interval;
|
||||
}
|
||||
|
||||
|
||||
bool ExtQuotes::isActive()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_active;
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::name()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
int ExtQuotes::number()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_number;
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::tag(const QString _type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Tag type" << _type;
|
||||
|
||||
return QString("%1%2").arg(_type).arg(m_number);
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::ticker()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_ticker;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setApiVersion(const int _apiVersion)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||
|
||||
m_apiVersion = _apiVersion;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setActive(const bool state)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
||||
|
||||
m_active = state;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setComment(const QString _comment)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||
|
||||
m_comment = _comment;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setInterval(const int _interval)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
|
||||
|
||||
m_interval = _interval;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setName(const QString _name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setNumber(int _number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
|
||||
if (_number == -1) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
|
||||
qsrand(QTime::currentTime().msec());
|
||||
_number = qrand() % 1000;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
|
||||
}
|
||||
|
||||
m_number = _number;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setTicker(const QString _ticker)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Ticker" << _ticker;
|
||||
|
||||
m_ticker = _ticker;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setName(settings.value(QString("Name"), m_name).toString());
|
||||
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
|
||||
setTicker(settings.value(QString("X-AW-Ticker"), m_ticker).toString());
|
||||
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
||||
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
// update for current API
|
||||
if ((m_apiVersion > 0) && (m_apiVersion < AWEQAPI)) {
|
||||
setApiVersion(AWEQAPI);
|
||||
writeConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, float> ExtQuotes::run()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (!m_active) return values;
|
||||
|
||||
if (times == 1) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Send request";
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
||||
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(quotesReplyReceived(QNetworkReply *)));
|
||||
|
||||
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url())));
|
||||
new QReplyTimeout(reply, 1000);
|
||||
}
|
||||
|
||||
// update value
|
||||
if (times >= m_interval) times = 0;
|
||||
times++;
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
int ExtQuotes::showConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(m_name);
|
||||
ui->lineEdit_comment->setText(m_comment);
|
||||
ui->label_numberValue->setText(QString("%1").arg(m_number));
|
||||
ui->lineEdit_ticker->setText(m_ticker);
|
||||
ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked);
|
||||
ui->spinBox_interval->setValue(m_interval);
|
||||
|
||||
int ret = exec();
|
||||
if (ret != 1) return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWEQAPI);
|
||||
setTicker(ui->lineEdit_ticker->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool ExtQuotes::tryDelete()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||
|
||||
// check if exists
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::writeConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||
settings.setValue(QString("Name"), m_name);
|
||||
settings.setValue(QString("Comment"), m_comment);
|
||||
settings.setValue(QString("X-AW-Ticker"), m_ticker);
|
||||
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
||||
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||
settings.setValue(QString("X-AW-Number"), m_number);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
|
||||
|
||||
QJsonParseError error;
|
||||
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;
|
||||
}
|
||||
QVariantMap jsonQuotes = jsonDoc.toVariant().toMap()[QString("query")].toMap();
|
||||
jsonQuotes = jsonQuotes[QString("results")].toMap()[QString("quote")].toMap();
|
||||
float value;
|
||||
|
||||
// ask
|
||||
value = jsonQuotes[QString("Ask")].toString().toFloat();
|
||||
values[QString("askchg")] = values[QString("ask")] == 0 ? 0.0 : value - values[QString("ask")];
|
||||
values[QString("percaskchg")] = 100 * values[QString("askchg")] / values[QString("ask")];
|
||||
values[QString("ask")] = value;
|
||||
|
||||
// bid
|
||||
value = jsonQuotes[QString("Bid")].toString().toFloat();
|
||||
values[QString("bidchg")] = values[QString("bid")] == 0 ? 0.0 : value - values[QString("bid")];
|
||||
values[QString("percbidchg")] = 100 * values[QString("bidchg")] / values[QString("bid")];
|
||||
values[QString("bid")] = value;
|
||||
|
||||
// last trade
|
||||
value = jsonQuotes[QString("LastTradePriceOnly")].toString().toFloat();
|
||||
values[QString("pricechg")] = values[QString("price")] == 0 ? 0.0 : value - values[QString("price")];
|
||||
values[QString("percpricechg")] = 100 * values[QString("pricechg")] / values[QString("price")];
|
||||
values[QString("price")] = value;
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::url()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString apiUrl = QString(YAHOO_URL);
|
||||
apiUrl.replace(QString("$TICKER"), m_ticker);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "API url" << apiUrl;
|
||||
|
||||
return apiUrl;
|
||||
}
|
@ -15,7 +15,6 @@
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "extsysmon.h"
|
||||
|
||||
#include <KWindowSystem>
|
||||
@ -36,11 +35,13 @@
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <pdebug/pdebug-time.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
#include "extquotes.h"
|
||||
#include "extscript.h"
|
||||
#include "extupgrade.h"
|
||||
#include "extweather.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
@ -48,6 +49,7 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList &args)
|
||||
: Plasma::DataEngine(parent, args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
qInstallMessageHandler(debugString);
|
||||
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
@ -56,9 +58,11 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList &args)
|
||||
|
||||
setMinimumPollingInterval(333);
|
||||
readConfiguration();
|
||||
initQuotes();
|
||||
initScripts();
|
||||
initUpgrade();
|
||||
|
||||
externalQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, QString("quotes"), debug);
|
||||
externalScripts = new ExtItemAggregator<ExtScript>(nullptr, QString("scripts"), debug);
|
||||
externalUpgrade = new ExtItemAggregator<ExtUpgrade>(nullptr, QString("upgrade"), debug);
|
||||
externalWeather = new ExtItemAggregator<ExtWeather>(nullptr, QString("weather"), debug);
|
||||
}
|
||||
|
||||
|
||||
@ -66,27 +70,28 @@ ExtendedSysMon::~ExtendedSysMon()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
externalQuotes.clear();
|
||||
externalScripts.clear();
|
||||
externalUpgrade.clear();
|
||||
delete externalQuotes;
|
||||
delete externalScripts;
|
||||
delete externalUpgrade;
|
||||
delete externalWeather;
|
||||
}
|
||||
|
||||
|
||||
QString ExtendedSysMon::getAllHdd()
|
||||
QStringList ExtendedSysMon::getAllHdd() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList allDevices = QDir(QString("/dev")).entryList(QDir::System, QDir::Name);
|
||||
QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$")));
|
||||
for (int i=0; i<devices.count(); i++)
|
||||
devices[i] = QString("/dev/%1").arg(devices[i]);
|
||||
devices[i] = QString("/dev/%1").arg(devices.at(i));
|
||||
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Device list" << devices;
|
||||
return devices.join(QChar(','));
|
||||
return devices;
|
||||
}
|
||||
|
||||
|
||||
QString ExtendedSysMon::getAutoGpu()
|
||||
QString ExtendedSysMon::getAutoGpu() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -105,18 +110,18 @@ QString ExtendedSysMon::getAutoGpu()
|
||||
}
|
||||
|
||||
|
||||
QString ExtendedSysMon::getAutoMpris()
|
||||
QString ExtendedSysMon::getAutoMpris() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QDBusMessage listServices = QDBusConnection::sessionBus().interface()->call(QDBus::BlockWithGui, QString("ListNames"));
|
||||
if (listServices.arguments().isEmpty()) return QString();
|
||||
QStringList arguments = listServices.arguments()[0].toStringList();
|
||||
QStringList arguments = listServices.arguments().first().toStringList();
|
||||
|
||||
for (int i=0; i<arguments.count(); i++) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Service found" << arguments[i];
|
||||
if (!arguments[i].startsWith(QString("org.mpris.MediaPlayer2."))) continue;
|
||||
QString service = arguments[i];
|
||||
foreach(QString arg, arguments) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Service found" << arg;
|
||||
if (!arg.startsWith(QString("org.mpris.MediaPlayer2."))) continue;
|
||||
QString service = arg;
|
||||
service.remove(QString("org.mpris.MediaPlayer2."));
|
||||
return service;
|
||||
}
|
||||
@ -125,93 +130,6 @@ QString ExtendedSysMon::getAutoMpris()
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::initQuotes()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// create directory at $HOME and create dirs list
|
||||
QString localDir = QString("%1/awesomewidgets/quotes")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/quotes"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
|
||||
QStringList names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
||||
for (int j=0; j<files.count(); j++) {
|
||||
if (!files[j].endsWith(QString(".desktop"))) continue;
|
||||
if (names.contains(files[j])) continue;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||
names.append(files[j]);
|
||||
externalQuotes.append(new ExtQuotes(0, files[j], dirs, debug));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::initScripts()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// create directory at $HOME and create dirs list
|
||||
QString localDir = QString("%1/awesomewidgets/scripts")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/scripts"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
|
||||
QStringList names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
||||
for (int j=0; j<files.count(); j++) {
|
||||
if (!files[j].endsWith(QString(".desktop"))) continue;
|
||||
if (names.contains(files[j])) continue;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||
names.append(files[j]);
|
||||
externalScripts.append(new ExtScript(0, files[j], dirs, debug));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::initUpgrade()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// create directory at $HOME and create dirs list
|
||||
QString localDir = QString("%1/awesomewidgets/upgrade")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/upgrade"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
|
||||
QStringList names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
||||
for (int j=0; j<files.count(); j++) {
|
||||
if (!files[j].endsWith(QString(".desktop"))) continue;
|
||||
if (names.contains(files[j])) continue;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||
names.append(files[j]);
|
||||
externalUpgrade.append(new ExtUpgrade(0, files[j], dirs, debug));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QStringList ExtendedSysMon::sources() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -229,6 +147,7 @@ QStringList ExtendedSysMon::sources() const
|
||||
source.append(QString("ps"));
|
||||
source.append(QString("quotes"));
|
||||
source.append(QString("update"));
|
||||
source.append(QString("weather"));
|
||||
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Sources" << source;
|
||||
return source;
|
||||
@ -243,7 +162,7 @@ void ExtendedSysMon::readConfiguration()
|
||||
QString("plasma-dataengine-extsysmon.conf"));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
QMap<QString, QString> rawConfig;
|
||||
QHash<QString, QString> rawConfig;
|
||||
|
||||
settings.beginGroup(QString("Configuration"));
|
||||
rawConfig[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/")).toString();
|
||||
@ -260,7 +179,7 @@ void ExtendedSysMon::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString> rawConfig)
|
||||
QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QString> rawConfig) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -273,7 +192,7 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString
|
||||
(rawConfig[QString("GPUDEV")] != QString("nvidia")))
|
||||
rawConfig[QString("GPUDEV")] = getAutoGpu();
|
||||
// hdddev
|
||||
allHddDevices = getAllHdd().split(QChar(','), QString::SkipEmptyParts);
|
||||
QStringList allHddDevices = getAllHdd();
|
||||
if (rawConfig[QString("HDDDEV")] == QString("all"))
|
||||
rawConfig[QString("HDDDEV")] = allHddDevices.join(QChar(','));
|
||||
else if (rawConfig[QString("HDDDEV")] == QString("disable"))
|
||||
@ -282,10 +201,9 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString
|
||||
QStringList deviceList = rawConfig[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
||||
QStringList devices;
|
||||
QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$");
|
||||
for (int i=0; i<deviceList.count(); i++)
|
||||
if ((QFile::exists(deviceList[i])) &&
|
||||
(diskRegexp.indexIn(deviceList[i]) > -1))
|
||||
devices.append(deviceList[i]);
|
||||
foreach(QString device, deviceList)
|
||||
if ((QFile::exists(device)) && (diskRegexp.indexIn(device) > -1))
|
||||
devices.append(device);
|
||||
if (devices.isEmpty())
|
||||
rawConfig[QString("HDDDEV")] = allHddDevices.join(QChar(','));
|
||||
else
|
||||
@ -293,77 +211,78 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString
|
||||
}
|
||||
// player
|
||||
if ((rawConfig[QString("PLAYER")] != QString("mpd")) &&
|
||||
(rawConfig[QString("PLAYER")] != QString("mpris")))
|
||||
(rawConfig[QString("PLAYER")] != QString("mpris")) &&
|
||||
(rawConfig[QString("PLAYER")] != QString("disable")))
|
||||
rawConfig[QString("PLAYER")] = QString("mpris");
|
||||
|
||||
for (int i=0; i<rawConfig.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" <<
|
||||
rawConfig.keys()[i] + QString("=") + rawConfig[rawConfig.keys()[i]];
|
||||
foreach(QString key, rawConfig.keys())
|
||||
if (debug) qDebug() << PDEBUG << ":" << key << "=" << rawConfig[key];
|
||||
return rawConfig;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap ExtendedSysMon::getBattery(const QString acpiPath)
|
||||
QVariantHash ExtendedSysMon::getBattery(const QString acpiPath) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "ACPI path" << acpiPath;
|
||||
|
||||
QVariantMap battery;
|
||||
QVariantHash battery;
|
||||
battery[QString("ac")] = false;
|
||||
battery[QString("bat")] = 0;
|
||||
QFile acFile(acpiPath + QString("/AC/online"));
|
||||
|
||||
// adaptor
|
||||
QFile acFile(QString("%1/AC/online").arg(acpiPath));
|
||||
if (acFile.open(QIODevice::ReadOnly)) {
|
||||
if (QString(acFile.readLine()).trimmed().toInt() == 1)
|
||||
battery[QString("ac")] = true;
|
||||
}
|
||||
acFile.close();
|
||||
|
||||
// batterites
|
||||
QStringList allDevices = QDir(acpiPath).entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
|
||||
QStringList batDevices;
|
||||
QRegExp batRegexp = QRegExp(QString("BAT.*"));
|
||||
for (int i=0; i<allDevices.count(); i++)
|
||||
if (allDevices[i].contains(batRegexp))
|
||||
batDevices.append(allDevices[i]);
|
||||
float currentLevel = 0.0;
|
||||
float fullLevel = 0.0;
|
||||
QStringList batDevices = QDir(acpiPath).entryList(QStringList() << QString("BAT*"),
|
||||
QDir::Dirs | QDir::NoDotAndDotDot,
|
||||
QDir::Name);
|
||||
for (int i=0; i<batDevices.count(); i++) {
|
||||
QFile batFile(QString("%1/%2/capacity").arg(acpiPath).arg(batDevices[i]));
|
||||
if (batFile.open(QIODevice::ReadOnly))
|
||||
battery[QString("bat%1").arg(i)] = QString(batFile.readLine()).trimmed().toInt();
|
||||
batFile.close();
|
||||
QFile currentLevelFile(QString("%1/%2/energy_now").arg(acpiPath).arg(batDevices.at(i)));
|
||||
QFile fullLevelFile(QString("%1/%2/energy_full").arg(acpiPath).arg(batDevices.at(i)));
|
||||
if ((currentLevelFile.open(QIODevice::ReadOnly)) &&
|
||||
(fullLevelFile.open(QIODevice::ReadOnly))) {
|
||||
float batCurrent = QString(currentLevelFile.readLine()).trimmed().toFloat();
|
||||
float batFull = QString(fullLevelFile.readLine()).trimmed().toFloat();
|
||||
battery[QString("bat%1").arg(i)] = static_cast<int>(100 * batCurrent / batFull);
|
||||
currentLevel += batCurrent;
|
||||
fullLevel += batFull;
|
||||
}
|
||||
currentLevelFile.close();
|
||||
fullLevelFile.close();
|
||||
}
|
||||
float number = 0.0;
|
||||
float average = 0.0;
|
||||
for (int i=0; i<battery.keys().count(); i++) {
|
||||
if (battery.keys()[i] == QString("ac")) continue;
|
||||
if (battery.keys()[i] == QString("bat")) continue;
|
||||
average += battery[battery.keys()[i]].toInt();
|
||||
number++;
|
||||
}
|
||||
battery[QString("bat")] = int(average / number);
|
||||
battery[QString("bat")] = static_cast<int>(100 * currentLevel / fullLevel);
|
||||
|
||||
return battery;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap ExtendedSysMon::getCurrentDesktop()
|
||||
QVariantHash ExtendedSysMon::getCurrentDesktop() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
int number = KWindowSystem::currentDesktop();
|
||||
int total = KWindowSystem::numberOfDesktops();
|
||||
QVariantMap currentDesktop;
|
||||
QVariantHash currentDesktop;
|
||||
currentDesktop[QString("currentName")] = KWindowSystem::desktopName(number);
|
||||
currentDesktop[QString("currentNumber")] = number;
|
||||
QStringList list;
|
||||
currentDesktop[QString("list")] = QStringList();
|
||||
for (int i=1; i<total+1; i++)
|
||||
list.append(KWindowSystem::desktopName(i));
|
||||
currentDesktop[QString("list")] = list.join(QString(";;"));
|
||||
currentDesktop[QString("list")].toStringList().append(KWindowSystem::desktopName(i));
|
||||
currentDesktop[QString("number")] = total;
|
||||
|
||||
return currentDesktop;
|
||||
}
|
||||
|
||||
|
||||
float ExtendedSysMon::getGpu(const QString device)
|
||||
float ExtendedSysMon::getGpu(const QString device) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Device" << device;
|
||||
@ -383,30 +302,27 @@ float ExtendedSysMon::getGpu(const QString device)
|
||||
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||
if (configuration[QString("GPUDEV")] == QString("nvidia"))
|
||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("<gpu_util>"))) {
|
||||
QString load = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
|
||||
.remove(QString("<gpu_util>"))
|
||||
.remove(QString("</gpu_util>"))
|
||||
.remove(QChar('%'));
|
||||
value = load.toFloat();
|
||||
}
|
||||
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.contains(QString("<gpu_util>"))) continue;
|
||||
QString load = str.remove(QString("<gpu_util>")).remove(QString("</gpu_util>"))
|
||||
.remove(QChar('%'));
|
||||
value = load.toFloat();
|
||||
break;
|
||||
}
|
||||
else if (configuration[QString("GPUDEV")] == QString("ati"))
|
||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("load"))) {
|
||||
QString load = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
|
||||
.split(QChar(' '), QString::SkipEmptyParts)[3]
|
||||
.remove(QChar('%'));
|
||||
value = load.toFloat();
|
||||
}
|
||||
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.contains(QString("load"))) continue;
|
||||
QString load = str.split(QChar(' '), QString::SkipEmptyParts)[3]
|
||||
.remove(QChar('%'));
|
||||
value = load.toFloat();
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
float ExtendedSysMon::getGpuTemp(const QString device)
|
||||
float ExtendedSysMon::getGpuTemp(const QString device) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Device" << device;
|
||||
@ -426,28 +342,25 @@ float ExtendedSysMon::getGpuTemp(const QString device)
|
||||
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
|
||||
if (configuration[QString("GPUDEV")] == QString("nvidia"))
|
||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("<gpu_temp>"))) {
|
||||
QString temp = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
|
||||
.remove(QString("<gpu_temp>"))
|
||||
.remove(QString("C</gpu_temp>"));
|
||||
value = temp.toFloat();
|
||||
}
|
||||
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.contains(QString("<gpu_temp>"))) continue;
|
||||
QString temp = str.remove(QString("<gpu_temp>")).remove(QString("C</gpu_temp>"));
|
||||
value = temp.toFloat();
|
||||
break;
|
||||
}
|
||||
else if (configuration[QString("GPUDEV")] == QString("ati"))
|
||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("Temperature"))) {
|
||||
QString temp = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
|
||||
.split(QChar(' '), QString::SkipEmptyParts)[4];
|
||||
value = temp.toFloat();
|
||||
}
|
||||
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.contains(QString("Temperature"))) continue;
|
||||
QString temp = str.split(QChar(' '), QString::SkipEmptyParts).at(4);
|
||||
value = temp.toFloat();
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
float ExtendedSysMon::getHddTemp(const QString cmd, const QString device)
|
||||
float ExtendedSysMon::getHddTemp(const QString cmd, const QString device) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||
@ -463,15 +376,15 @@ float ExtendedSysMon::getHddTemp(const QString cmd, const QString device)
|
||||
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||
if (smartctl) {
|
||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
||||
if (!qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].startsWith(QString("194"))) continue;
|
||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].split(QChar(' '), QString::SkipEmptyParts).count() < 9) break;
|
||||
value = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].split(QChar(' '), QString::SkipEmptyParts)[9].toFloat();
|
||||
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.startsWith(QString("194"))) continue;
|
||||
if (str.split(QChar(' '), QString::SkipEmptyParts).count() < 9) break;
|
||||
value = str.split(QChar(' '), QString::SkipEmptyParts).at(9).toFloat();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (qoutput.split(QChar(':'), QString::SkipEmptyParts).count() >= 3) {
|
||||
QString temp = qoutput.split(QChar(':'), QString::SkipEmptyParts)[2];
|
||||
QString temp = qoutput.split(QChar(':'), QString::SkipEmptyParts).at(2);
|
||||
temp.remove(QChar(0260)).remove(QChar('C'));
|
||||
value = temp.toFloat();
|
||||
}
|
||||
@ -481,17 +394,17 @@ float ExtendedSysMon::getHddTemp(const QString cmd, const QString device)
|
||||
}
|
||||
|
||||
|
||||
QString ExtendedSysMon::getNetworkDevice()
|
||||
QString ExtendedSysMon::getNetworkDevice() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString device = QString("lo");
|
||||
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
||||
for (int i=0; i<rawInterfaceList.count(); i++)
|
||||
if ((rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsUp)) &&
|
||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsLoopBack)) &&
|
||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsPointToPoint))) {
|
||||
device = rawInterfaceList[i].name();
|
||||
foreach(QNetworkInterface interface, rawInterfaceList)
|
||||
if ((interface.flags().testFlag(QNetworkInterface::IsUp)) &&
|
||||
(!interface.flags().testFlag(QNetworkInterface::IsLoopBack)) &&
|
||||
(!interface.flags().testFlag(QNetworkInterface::IsPointToPoint))) {
|
||||
device = interface.name();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -499,15 +412,15 @@ QString ExtendedSysMon::getNetworkDevice()
|
||||
}
|
||||
|
||||
|
||||
QVariantMap ExtendedSysMon::getPlayerInfo(const QString playerName, const QString mpdAddress,
|
||||
const QString mpdPort, QString mpris)
|
||||
QVariantHash ExtendedSysMon::getPlayerInfo(const QString playerName, const QString mpdAddress,
|
||||
const QString mpdPort, QString mpris) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "player" << playerName;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "MPD" << QString("%1:%2").arg(mpdAddress).arg(mpdPort);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "MPRIS" << mpris;
|
||||
|
||||
QVariantMap info;
|
||||
QVariantHash info;
|
||||
info[QString("album")] = QString("unknown");
|
||||
info[QString("artist")] = QString("unknown");
|
||||
info[QString("duration")] = QString("0");
|
||||
@ -528,12 +441,12 @@ QVariantMap ExtendedSysMon::getPlayerInfo(const QString playerName, const QStrin
|
||||
}
|
||||
|
||||
|
||||
QVariantMap ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress, const QString mpdPort)
|
||||
QVariantHash ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress, const QString mpdPort) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "MPD" << QString("%1:%2").arg(mpdAddress).arg(mpdPort);
|
||||
|
||||
QVariantMap info;
|
||||
QVariantHash info;
|
||||
info[QString("album")] = QString("unknown");
|
||||
info[QString("artist")] = QString("unknown");
|
||||
info[QString("duration")] = QString("0");
|
||||
@ -549,19 +462,17 @@ QVariantMap ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress, const QSt
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||
QString qstr = QString("");
|
||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
||||
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
|
||||
if (qstr.split(QString(": "), QString::SkipEmptyParts).count() > 1) {
|
||||
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Album"))
|
||||
info[QString("album")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
|
||||
info[QString("artist")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time")) {
|
||||
info[QString("duration")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[0];
|
||||
info[QString("progress")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[1];
|
||||
} else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
|
||||
info[QString("title")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (str.split(QString(": "), QString::SkipEmptyParts).count() > 1) {
|
||||
if (str.split(QString(": "), QString::SkipEmptyParts).first() == QString("Album"))
|
||||
info[QString("album")] = str.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||
else if (str.split(QString(": "), QString::SkipEmptyParts).first() == QString("Artist"))
|
||||
info[QString("artist")] = str.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||
else if (str.split(QString(": "), QString::SkipEmptyParts).first() == QString("time")) {
|
||||
info[QString("duration")] = str.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[0];
|
||||
info[QString("progress")] = str.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[1];
|
||||
} else if (str.split(QString(": "), QString::SkipEmptyParts).first() == QString("Title"))
|
||||
info[QString("title")] = str.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -569,57 +480,60 @@ QVariantMap ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress, const QSt
|
||||
}
|
||||
|
||||
|
||||
QVariantMap ExtendedSysMon::getPlayerMprisInfo(const QString mpris)
|
||||
QVariantHash ExtendedSysMon::getPlayerMprisInfo(const QString mpris) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << "MPRIS" << mpris;
|
||||
|
||||
QVariantMap info;
|
||||
QVariantHash info;
|
||||
info[QString("album")] = QString("unknown");
|
||||
info[QString("artist")] = QString("unknown");
|
||||
info[QString("duration")] = 0;
|
||||
info[QString("progress")] = 0;
|
||||
info[QString("title")] = QString("unknown");
|
||||
|
||||
// init
|
||||
QDBusArgument arg;
|
||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||
QDBusMessage response, request;
|
||||
QVariantMap map;
|
||||
|
||||
// general information
|
||||
request = QDBusMessage::createMethodCall(QString("org.mpris.MediaPlayer2.%1").arg(mpris),
|
||||
QString("/Player"),
|
||||
QString(""),
|
||||
QString("GetMetadata"));
|
||||
response = bus.call(request, QDBus::BlockWithGui);
|
||||
if (response.arguments().size() == 0) {
|
||||
// comes from the following request:
|
||||
// qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata
|
||||
// or the same but using dbus-send:
|
||||
// dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'
|
||||
QVariantList args = QVariantList() << QString("org.mpris.MediaPlayer2.Player") << QString("Metadata");
|
||||
QDBusMessage request = QDBusMessage::createMethodCall(QString("org.mpris.MediaPlayer2.%1").arg(mpris),
|
||||
QString("/org/mpris/MediaPlayer2"),
|
||||
QString(""),
|
||||
QString("Get"));
|
||||
request.setArguments(args);
|
||||
QDBusMessage response = bus.call(request, QDBus::BlockWithGui);
|
||||
if ((response.type() != QDBusMessage::ReplyMessage) || (response.arguments().isEmpty())) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error message" << response.errorMessage();
|
||||
} else {
|
||||
arg = response.arguments()[0].value<QDBusArgument>();
|
||||
arg >> map;
|
||||
info[QString("album")] = map[QString("album")];
|
||||
info[QString("artist")] = map[QString("artist")];
|
||||
info[QString("duration")] = map[QString("time")];
|
||||
info[QString("title")] = map[QString("title")];
|
||||
// another portion of dirty magic
|
||||
QVariantHash map = qdbus_cast<QVariantHash>(response.arguments().first()
|
||||
.value<QDBusVariant>().variant()
|
||||
.value<QDBusArgument>());
|
||||
info[QString("album")] = map.value(QString("xesam:album"), QString("unknown"));
|
||||
// artist is array
|
||||
info[QString("artist")] = map.value(QString("xesam:artist"), QString("unknown")).toString();
|
||||
info[QString("duration")] = map.value(QString("mpris:length"), 0).toInt() / (1000 * 1000);
|
||||
info[QString("title")] = map.value(QString("xesam:title"), QString("unknown"));
|
||||
}
|
||||
|
||||
// position
|
||||
request = QDBusMessage::createMethodCall(QString("org.mpris.MediaPlayer2.%1").arg(mpris),
|
||||
QString("/Player"),
|
||||
QString(""),
|
||||
QString("PositionGet"));
|
||||
args[1] = QString("Position");
|
||||
request.setArguments(args);
|
||||
response = bus.call(request, QDBus::BlockWithGui);
|
||||
if (response.arguments().size() == 0) {
|
||||
if ((response.type() != QDBusMessage::ReplyMessage) || (response.arguments().isEmpty())) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error message" << response.errorMessage();
|
||||
} else
|
||||
info[QString("progress")] = response.arguments()[0].toInt() / 1000;
|
||||
// this cast is simpler than the previous one ;)
|
||||
info[QString("progress")] = response.arguments().first().value<QDBusVariant>()
|
||||
.variant().toLongLong() / (1000 * 1000);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap ExtendedSysMon::getPsStats()
|
||||
QVariantHash ExtendedSysMon::getPsStats() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -628,17 +542,17 @@ QVariantMap ExtendedSysMon::getPsStats()
|
||||
QStringList directories = allDirectories.filter(QRegExp(QString("(\\d+)")));
|
||||
QStringList running;
|
||||
|
||||
for (int i=0; i<directories.count(); i++) {
|
||||
QFile statusFile(QString("/proc/%1/status").arg(directories[i]));
|
||||
foreach(QString dir, directories) {
|
||||
QFile statusFile(QString("/proc/%1/status").arg(dir));
|
||||
if (!statusFile.open(QIODevice::ReadOnly)) continue;
|
||||
QFile cmdFile(QString("/proc/%1/cmdline").arg(directories[i]));
|
||||
QFile cmdFile(QString("/proc/%1/cmdline").arg(dir));
|
||||
if (!cmdFile.open(QIODevice::ReadOnly)) continue;
|
||||
|
||||
QString output = statusFile.readAll();
|
||||
if (output.contains(QString("running"))) running.append(cmdFile.readAll());
|
||||
}
|
||||
|
||||
QVariantMap psStats;
|
||||
QVariantHash psStats;
|
||||
psStats[QString("pscount")] = running.count();
|
||||
psStats[QString("ps")] = running.join(QString(","));
|
||||
psStats[QString("pstotal")] = directories.count();
|
||||
@ -662,63 +576,54 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << source;
|
||||
|
||||
if (source == QString("battery")) {
|
||||
QVariantMap battery = getBattery(configuration[QString("ACPIPATH")]);
|
||||
setData(source, QString("ac"), battery[QString("ac")].toBool());
|
||||
for (int i=0; i<battery.keys().count(); i++) {
|
||||
if (battery.keys()[i] == QString("ac")) continue;
|
||||
setData(source, battery.keys()[i], battery[battery.keys()[i]].toInt());
|
||||
}
|
||||
QVariantHash battery = getBattery(configuration[QString("ACPIPATH")]);
|
||||
foreach(QString key, battery.keys()) setData(source, key, battery[key]);
|
||||
} else if (source == QString("custom")) {
|
||||
for (int i=0; i<externalScripts.count(); i++)
|
||||
setData(source, externalScripts[i]->tag(), externalScripts[i]->run());
|
||||
foreach(ExtScript *script, externalScripts->items()) {
|
||||
QVariantHash data = script->run();
|
||||
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
||||
}
|
||||
} else if (source == QString("desktop")) {
|
||||
QVariantMap desktop = getCurrentDesktop();
|
||||
for (int i=0; i<desktop.keys().count(); i++)
|
||||
setData(source, desktop.keys()[i], desktop[desktop.keys()[i]]);
|
||||
QVariantHash desktop = getCurrentDesktop();
|
||||
foreach(QString key, desktop.keys()) setData(source, key, desktop[key]);
|
||||
} else if (source == QString("gpu")) {
|
||||
setData(source, QString("value"), getGpu(configuration[QString("GPUDEV")]));
|
||||
} else if (source == QString("gputemp")) {
|
||||
setData(source, QString("value"), getGpuTemp(configuration[QString("GPUDEV")]));
|
||||
} else if (source == QString("hddtemp")) {
|
||||
// fill empty list
|
||||
for (int i=0; i<allHddDevices.count(); i++)
|
||||
setData(source, allHddDevices[i], 0.0);
|
||||
QStringList deviceList = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
||||
for (int i=0; i<deviceList.count(); i++) {
|
||||
setData(source, deviceList[i],
|
||||
getHddTemp(configuration[QString("HDDTEMPCMD")], deviceList[i]));
|
||||
}
|
||||
QStringList allHddDevices = getAllHdd();
|
||||
foreach(QString device, allHddDevices)
|
||||
setData(source, device, deviceList.contains(device) ?
|
||||
getHddTemp(configuration[QString("HDDTEMPCMD")], device) : 0.0);
|
||||
} else if (source == QString("netdev")) {
|
||||
setData(source, QString("value"), getNetworkDevice());
|
||||
} else if (source == QString("pkg")) {
|
||||
for (int i=0; i<externalUpgrade.count(); i++)
|
||||
setData(source, externalUpgrade[i]->tag(), externalUpgrade[i]->run());
|
||||
foreach(ExtUpgrade *upgrade, externalUpgrade->items()) {
|
||||
QVariantHash data = upgrade->run();
|
||||
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
||||
}
|
||||
} else if (source == QString("player")) {
|
||||
QVariantMap player = getPlayerInfo(configuration[QString("PLAYER")],
|
||||
configuration[QString("MPDADDRESS")],
|
||||
configuration[QString("MPDPORT")],
|
||||
configuration[QString("MPRIS")]);
|
||||
for (int i=0; i<player.keys().count(); i++)
|
||||
setData(source, player.keys()[i], player[player.keys()[i]]);
|
||||
QVariantHash player = getPlayerInfo(configuration[QString("PLAYER")],
|
||||
configuration[QString("MPDADDRESS")],
|
||||
configuration[QString("MPDPORT")],
|
||||
configuration[QString("MPRIS")]);
|
||||
foreach(QString key, player.keys()) setData(source, key, player[key]);
|
||||
} else if (source == QString("ps")) {
|
||||
QVariantMap ps = getPsStats();
|
||||
for (int i=0; i<ps.keys().count(); i++)
|
||||
setData(source, ps.keys()[i], ps[ps.keys()[i]]);
|
||||
QVariantHash ps = getPsStats();
|
||||
foreach(QString key, ps.keys()) setData(source, key, ps[key]);
|
||||
} else if (source == QString("quotes")) {
|
||||
for (int i=0; i<externalQuotes.count(); i++) {
|
||||
QMap<QString, float> data = externalQuotes[i]->run();
|
||||
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("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("pricechg")), data[QString("pricechg")]);
|
||||
setData(source, externalQuotes[i]->tag(QString("percpricechg")), data[QString("percpricechg")]);
|
||||
foreach(ExtQuotes *quote, externalQuotes->items()) {
|
||||
QVariantHash data = quote->run();
|
||||
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
||||
}
|
||||
} else if (source == QString("update")) {
|
||||
setData(source, QString("value"), true);
|
||||
} else if (source == QString("weather")) {
|
||||
foreach(ExtWeather *weather, externalWeather->items()) {
|
||||
QVariantHash data = weather->run();
|
||||
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -20,10 +20,13 @@
|
||||
|
||||
#include <Plasma/DataEngine>
|
||||
|
||||
#include "extitemaggregator.h"
|
||||
|
||||
|
||||
class ExtQuotes;
|
||||
class ExtScript;
|
||||
class ExtUpgrade;
|
||||
class ExtWeather;
|
||||
|
||||
class ExtendedSysMon : public Plasma::DataEngine
|
||||
{
|
||||
@ -33,20 +36,20 @@ public:
|
||||
explicit ExtendedSysMon(QObject *parent, const QVariantList &args);
|
||||
~ExtendedSysMon();
|
||||
// update functions
|
||||
QVariantMap getBattery(const QString acpiPath);
|
||||
QVariantMap getCurrentDesktop();
|
||||
float getGpu(const QString device);
|
||||
float getGpuTemp(const QString device);
|
||||
float getHddTemp(const QString cmd, const QString device);
|
||||
QString getNetworkDevice();
|
||||
QVariantMap getPlayerInfo(const QString playerName,
|
||||
const QString mpdAddress = QString(),
|
||||
const QString mpdPort = QString(),
|
||||
const QString mpris = QString());
|
||||
QVariantMap getPlayerMpdInfo(const QString mpdAddress = QString(),
|
||||
const QString mpdPort = QString());
|
||||
QVariantMap getPlayerMprisInfo(const QString mpris = QString());
|
||||
QVariantMap getPsStats();
|
||||
QVariantHash getBattery(const QString acpiPath) const;
|
||||
QVariantHash getCurrentDesktop() const;
|
||||
float getGpu(const QString device) const;
|
||||
float getGpuTemp(const QString device) const;
|
||||
float getHddTemp(const QString cmd, const QString device) const;
|
||||
QString getNetworkDevice() const;
|
||||
QVariantHash getPlayerInfo(const QString playerName,
|
||||
const QString mpdAddress = QString(),
|
||||
const QString mpdPort = QString(),
|
||||
const QString mpris = QString()) const;
|
||||
QVariantHash getPlayerMpdInfo(const QString mpdAddress = QString(),
|
||||
const QString mpdPort = QString()) const;
|
||||
QVariantHash getPlayerMprisInfo(const QString mpris = QString()) const;
|
||||
QVariantHash getPsStats() const;
|
||||
|
||||
protected:
|
||||
bool sourceRequestEvent(const QString &source);
|
||||
@ -55,21 +58,18 @@ protected:
|
||||
|
||||
private:
|
||||
// configuration
|
||||
QMap<QString, QString> configuration;
|
||||
QList<ExtQuotes *> externalQuotes;
|
||||
QList<ExtScript *> externalScripts;
|
||||
QList<ExtUpgrade *> externalUpgrade;
|
||||
QHash<QString, QString> configuration;
|
||||
ExtItemAggregator<ExtQuotes> *externalQuotes;
|
||||
ExtItemAggregator<ExtScript> *externalScripts;
|
||||
ExtItemAggregator<ExtUpgrade> *externalUpgrade;
|
||||
ExtItemAggregator<ExtWeather> *externalWeather;
|
||||
bool debug;
|
||||
// reread configuration
|
||||
QStringList allHddDevices;
|
||||
QString getAllHdd();
|
||||
QString getAutoGpu();
|
||||
QString getAutoMpris();
|
||||
void initQuotes();
|
||||
void initScripts();
|
||||
void initUpgrade();
|
||||
QStringList getAllHdd() const;
|
||||
QString getAutoGpu() const;
|
||||
QString getAutoMpris() const;
|
||||
void readConfiguration();
|
||||
QMap<QString, QString> updateConfiguration(QMap<QString, QString> rawConfig);
|
||||
QHash<QString, QString> updateConfiguration(QHash<QString, QString> rawConfig) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,338 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "extupgrade.h"
|
||||
#include "ui_extupgrade.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
#include <QTime>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName, const QStringList directories, const bool debugCmd)
|
||||
: QDialog(parent),
|
||||
m_fileName(upgradeName),
|
||||
m_dirs(directories),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::ExtUpgrade)
|
||||
{
|
||||
m_name = m_fileName;
|
||||
readConfiguration();
|
||||
// init process
|
||||
process = new QProcess(this);
|
||||
connect(process, SIGNAL(finished(int)), this, SLOT(updateValue()));
|
||||
process->waitForFinished(0);
|
||||
// init ui
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
ExtUpgrade::~ExtUpgrade()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
process->kill();
|
||||
delete process;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::apiVersion()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_apiVersion;
|
||||
}
|
||||
|
||||
|
||||
QString ExtUpgrade::comment()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
|
||||
QString ExtUpgrade::executable()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_executable;
|
||||
}
|
||||
|
||||
|
||||
QString ExtUpgrade::fileName()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::interval()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_interval;
|
||||
}
|
||||
|
||||
|
||||
QString ExtUpgrade::name()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::null()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_null;
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::number()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_number;
|
||||
}
|
||||
|
||||
|
||||
QString ExtUpgrade::tag()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return QString("pkgcount%1").arg(m_number);
|
||||
}
|
||||
|
||||
|
||||
bool ExtUpgrade::isActive()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_active;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setApiVersion(const int _apiVersion)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||
|
||||
m_apiVersion = _apiVersion;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setActive(const bool state)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
||||
|
||||
m_active = state;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setComment(const QString _comment)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||
|
||||
m_comment = _comment;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setExecutable(const QString _executable)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Executable" << _executable;
|
||||
|
||||
m_executable = _executable;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setInterval(const int _interval)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
|
||||
|
||||
m_interval = _interval;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setName(const QString _name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setNull(const int _null)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Null lines" << _null;
|
||||
if (_null < 0) return;
|
||||
|
||||
m_null = _null;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setNumber(int _number)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
|
||||
if (_number == -1) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
|
||||
qsrand(QTime::currentTime().msec());
|
||||
_number = qrand() % 1000;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
|
||||
}
|
||||
|
||||
m_number = _number;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setName(settings.value(QString("Name"), m_name).toString());
|
||||
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
|
||||
setExecutable(settings.value(QString("Exec"), m_executable).toString());
|
||||
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
||||
setNull(settings.value(QString("X-AW-Null"), m_null).toInt());
|
||||
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||
// api == 2
|
||||
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
// update for current API
|
||||
if ((m_apiVersion > 0) && (m_apiVersion < AWEUAPI)) {
|
||||
setApiVersion(AWEUAPI);
|
||||
writeConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::run()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (!m_active) return value;
|
||||
|
||||
if ((times == 1) && (process->state() == QProcess::NotRunning))
|
||||
process->start(QString("bash -c \"%1\"").arg(m_executable));
|
||||
else if (times >= m_interval)
|
||||
times = 0;
|
||||
times++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::showConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(m_name);
|
||||
ui->lineEdit_comment->setText(m_comment);
|
||||
ui->label_numberValue->setText(QString("%1").arg(m_number));
|
||||
ui->lineEdit_command->setText(m_executable);
|
||||
ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked);
|
||||
ui->spinBox_null->setValue(m_null);
|
||||
ui->spinBox_interval->setValue(m_interval);
|
||||
|
||||
int ret = exec();
|
||||
if (ret != 1) return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setNumber(ui->label_numberValue->text().toInt());
|
||||
setApiVersion(AWEUAPI);
|
||||
setExecutable(ui->lineEdit_command->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
setNull(ui->spinBox_null->value());
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool ExtUpgrade::tryDelete()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||
|
||||
// check if exists
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::writeConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||
settings.setValue(QString("Name"), m_name);
|
||||
settings.setValue(QString("Comment"), m_comment);
|
||||
settings.setValue(QString("Exec"), m_executable);
|
||||
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
||||
settings.setValue(QString("X-AW-Null"), m_null);
|
||||
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||
settings.setValue(QString("X-AW-Number"), m_number);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::updateValue()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process->exitCode();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process->readAllStandardError();
|
||||
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardOutput()).trimmed();
|
||||
value = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count() - m_null;
|
||||
}
|
@ -14,5 +14,5 @@ MPDPORT=6600
|
||||
# MPRIS player name or 'auto'. In the most cases it should be a player name
|
||||
## DBus path is org.mpris.MediaPlayer2.amarok
|
||||
MPRIS=auto
|
||||
# Player name. Supported players are 'mpd', 'mpris'
|
||||
# Player name. Supported players are 'mpd', 'mpris', 'disable'
|
||||
PLAYER=mpris
|
||||
|
25
sources/libraries.cmake
Normal file
25
sources/libraries.cmake
Normal file
@ -0,0 +1,25 @@
|
||||
find_package(Gettext REQUIRED)
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core DBus Network Qml Widgets)
|
||||
find_package(ECM 0.0.11 REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package(KF5 REQUIRED COMPONENTS I18n Notifications Plasma Service WindowSystem)
|
||||
|
||||
include(KDEInstallDirs)
|
||||
include(KDECMakeSettings)
|
||||
include(KDECompilerSettings)
|
||||
|
||||
add_definitions(
|
||||
${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Network_DEFINITIONS}
|
||||
${Qt5Qml_DEFINITIONS} ${Qt5Widgets_DEFINITIONS}
|
||||
)
|
||||
set(Qt_INCLUDE
|
||||
${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}
|
||||
${Qt5Qml_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}
|
||||
)
|
||||
set(Kf5_INCLUDE ${I18n_INCLUDE_DIR} ${Notifications_INCLUDE_DIR} ${Plasma_INCLUDE_DIR})
|
||||
|
||||
set(Qt_LIBRARIES
|
||||
${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES}
|
||||
${Qt5Qml_LIBRARIES} ${Qt5Widgets_LIBRARIES}
|
||||
)
|
||||
set(Kf5_LIBRARIES KF5::I18n KF5::Notifications KF5::Plasma KF5::WindowSystem)
|
@ -1,9 +1,29 @@
|
||||
find_package(Gettext REQUIRED)
|
||||
set(MO_NAME plasma_applet_org.kde.plasma.awesomewidget.mo)
|
||||
set(SND_MO_NAME plasma_applet_org.kde.plasma.desktoppanel.mo)
|
||||
|
||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n)
|
||||
include (KDEInstallDirs)
|
||||
file(GLOB _po_files *.po)
|
||||
set(_gmoFiles)
|
||||
|
||||
add_subdirectory (awesome-widget)
|
||||
add_subdirectory (desktop-panel)
|
||||
foreach(_current_PO_FILE ${_po_files})
|
||||
get_filename_component(_lang ${_current_PO_FILE} NAME_WE)
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
|
||||
add_custom_command(
|
||||
OUTPUT ${_gmoFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${_current_PO_FILE}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo
|
||||
DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES/
|
||||
RENAME ${MO_NAME}
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo
|
||||
DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES/
|
||||
RENAME ${SND_MO_NAME}
|
||||
)
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach(_current_PO_FILE)
|
||||
add_custom_target(aw_pofiles ALL DEPENDS ${_gmoFiles})
|
||||
|
@ -1,18 +0,0 @@
|
||||
set (MO_NAME plasma_applet_org.kde.plasma.awesomewidget.mo)
|
||||
|
||||
file (GLOB _po_files *.po)
|
||||
set (_gmoFiles)
|
||||
|
||||
foreach (_current_PO_FILE ${_po_files})
|
||||
get_filename_component (_lang ${_current_PO_FILE} NAME_WE)
|
||||
set (_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
|
||||
add_custom_command (OUTPUT ${_gmoFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${_current_PO_FILE}
|
||||
)
|
||||
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES/ RENAME ${MO_NAME})
|
||||
list (APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach (_current_PO_FILE)
|
||||
add_custom_target (aw_pofiles ALL DEPENDS ${_gmoFiles})
|
@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
# root of translatable sources
|
||||
BASEDIR="../../"
|
||||
PATHS="awesome-widget\|extsysmon"
|
||||
PROJECT="plasma_applet_awesome-widget" # project name
|
||||
BUGADDR="https://github.com/arcan1s/awesome-widgets/issues" # MSGID-Bugs
|
||||
# working dir
|
||||
WDIR=`pwd`
|
||||
|
||||
|
||||
echo "Preparing rc files"
|
||||
cd ${BASEDIR}
|
||||
# we use simple sorting to make sure the lines do not jump around too much from system to system
|
||||
find . -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' | grep ${PATHS} | sort > ${WDIR}/rcfiles.list
|
||||
xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/rc.cpp
|
||||
# additional string for KAboutData
|
||||
echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> ${WDIR}/rc.cpp
|
||||
echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> ${WDIR}/rc.cpp
|
||||
cd ${WDIR}
|
||||
echo "Done preparing rc files"
|
||||
|
||||
echo "Extracting messages"
|
||||
cd ${BASEDIR}
|
||||
# see above on sorting
|
||||
find . -name '*.cpp' -o -name '*.h' -o -name '*.qml' | grep ${PATHS} | sort > ${WDIR}/infiles.list
|
||||
echo "rc.cpp" >> ${WDIR}/infiles.list
|
||||
cd ${WDIR}
|
||||
xgettext --from-code=UTF-8 -C -kde -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 \
|
||||
--msgid-bugs-address="${BUGADDR}" \
|
||||
--files-from=infiles.list -D ${BASEDIR} -D ${WDIR} -o ${PROJECT}.pot || { echo "Error while calling xgettext, aborting."; exit 1; }
|
||||
echo "Done extracting messages"
|
||||
|
||||
echo "Merging translations"
|
||||
catalogs=`find . -name '*.po'`
|
||||
for cat in $catalogs; do
|
||||
echo $cat
|
||||
msgmerge -o $cat.new $cat ${PROJECT}.pot
|
||||
mv $cat.new $cat
|
||||
done
|
||||
echo "Done merging translations"
|
||||
|
||||
|
||||
echo "Cleaning up"
|
||||
cd ${WDIR}
|
||||
rm -f rcfiles.list infiles.list rc.cpp
|
||||
echo "Done"
|
||||
|
@ -1,499 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
|
||||
"POT-Creation-Date: 2015-06-01 01:48+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: awesome-widget/package/contents/config/config.qml:25
|
||||
msgid "Widget"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/config/config.qml:31
|
||||
msgid "Advanced"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/config/config.qml:37
|
||||
msgid "Tooltip"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/config/config.qml:43
|
||||
msgid "Appearance"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/config/config.qml:49
|
||||
msgid "DataEngine"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/config/config.qml:55
|
||||
#: awesome-widget/package/contents/ui/about.qml:42
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/about.qml:83
|
||||
msgid "Acknowledgment"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:56
|
||||
msgid "Widget height, px"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:76
|
||||
msgid "Widget width, px"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:98
|
||||
msgid "Enable notifications"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:112
|
||||
msgid "Wrap new lines"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:126
|
||||
msgid "Enable background"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:138
|
||||
msgid "Custom time format"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:155
|
||||
msgid "Custom uptime format"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:172
|
||||
msgid "Temperature units"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:180
|
||||
msgid "Celsius"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:184
|
||||
msgid "Fahrenheit"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:188
|
||||
msgid "Kelvin"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:192
|
||||
msgid "Reaumur"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:196
|
||||
msgid "cm^-1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:200
|
||||
msgid "kJ/mol"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:204
|
||||
msgid "kcal/mol"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:227
|
||||
msgid "AC online tag"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/advanced.qml:244
|
||||
msgid "AC offline tag"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:61
|
||||
msgid "Time interval"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:81
|
||||
#: awesome-widget/package/contents/ui/widget.qml:80
|
||||
msgid "Font"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:99
|
||||
msgid "Font size"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:119
|
||||
msgid "Font weight"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:127
|
||||
msgid "light"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:131
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:174
|
||||
msgid "normal"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:135
|
||||
msgid "demi bold"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:139
|
||||
msgid "bold"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:143
|
||||
msgid "black"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:166
|
||||
msgid "Font style"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:178
|
||||
msgid "italic"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:201
|
||||
msgid "Font color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:219
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:131
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:183
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:235
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:287
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:339
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:391
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:421
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:473
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:503
|
||||
msgid "Select a color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/appearance.qml:226
|
||||
msgid "Select a font"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:69
|
||||
msgid "ACPI path"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:85
|
||||
msgid "Custom scripts"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:89
|
||||
msgid "Edit scripts"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:102
|
||||
msgid "GPU device"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:126
|
||||
msgid "HDD"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:150
|
||||
msgid "hddtemp cmd"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:166
|
||||
msgid "MPD address"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:182
|
||||
msgid "MPD port"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:201
|
||||
msgid "MPRIS player name"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:221
|
||||
msgid "Music player"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:245
|
||||
msgid "Quotes monitor"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:249
|
||||
msgid "Edit tickers"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:262
|
||||
msgid "Package manager"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/dataengine.qml:266
|
||||
msgid "Edit command"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/main.qml:161
|
||||
msgid "Request key"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/main.qml:162
|
||||
msgid "Show README"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/main.qml:163
|
||||
msgid "Check updates"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:62
|
||||
msgid ""
|
||||
"CPU, CPU clock, memory, swap and network labels support graphical tooltip. "
|
||||
"To enable them just make needed checkbox fully checked."
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:73
|
||||
msgid "Number of values for tooltips"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:93
|
||||
msgid "Background"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:145
|
||||
msgid "CPU color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:197
|
||||
msgid "CPU clock color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:249
|
||||
msgid "Memory color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:301
|
||||
msgid "Swap color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:353
|
||||
msgid "Download speed color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:405
|
||||
msgid "Upload speed color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:435
|
||||
msgid "Battery active color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/tooltip.qml:487
|
||||
msgid "Battery inactive color"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/widget.qml:72
|
||||
msgid ""
|
||||
"Detailed information may be found on <a href=\"http://arcanis.name/projects/"
|
||||
"awesome-widgets/\">project homepage</a>"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/widget.qml:231
|
||||
msgid "Add"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/widget.qml:244
|
||||
msgid "Show value"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/widget.qml:249
|
||||
#: awesome-widget/plugin/awkeys.cpp:685 awesome-widget/plugin/awkeys.cpp:752
|
||||
#: awesome-widget/plugin/awkeys.cpp:1052
|
||||
msgid "Tag: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/widget.qml:251
|
||||
#: awesome-widget/plugin/awkeys.cpp:687
|
||||
msgid "Value: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/widget.qml:253
|
||||
msgid "Info: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/package/contents/ui/widget.qml:264
|
||||
msgid "Edit bars"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:76
|
||||
msgid "Run %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:105
|
||||
msgid "Version %1 (build date %2)"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:107
|
||||
msgid "A set of minimalistic plasmoid widgets"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:109
|
||||
msgid "Links:"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:110
|
||||
msgid "Homepage"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:111
|
||||
msgid "Repository"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:112
|
||||
msgid "Bugtracker"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:113
|
||||
msgid "Translation issue"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:114
|
||||
msgid "AUR packages"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:115
|
||||
msgid "openSUSE packages"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:118
|
||||
msgid "This software is licensed under %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:120
|
||||
msgid "Translators: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:128
|
||||
msgid "This software uses: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:143
|
||||
msgid "Select font"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:214
|
||||
msgid "Current version : %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:215
|
||||
msgid "New version : %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:216
|
||||
msgid "Click \"Ok\" to download"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awactions.cpp:218
|
||||
msgid "There are updates"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:59
|
||||
msgid "Copy"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:60
|
||||
msgid "Create"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:61
|
||||
msgid "Remove"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:395
|
||||
msgid "AC online"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:397
|
||||
msgid "AC offline"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:415
|
||||
msgid "High CPU load"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:464
|
||||
msgid "High GPU load"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:478
|
||||
msgid "Free space on %1 less than 10%"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:543
|
||||
msgid "High memory usage"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:551
|
||||
msgid "Network device has been changed to %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:621
|
||||
msgid "Swap is used"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:681
|
||||
msgid "Select tag"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:681
|
||||
msgid "Tag"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:753 awesome-widget/plugin/awkeys.cpp:763
|
||||
#: awesome-widget/plugin/awkeys.cpp:774 awesome-widget/plugin/awkeys.cpp:785
|
||||
#: awesome-widget/plugin/awkeys.cpp:1053 awesome-widget/plugin/awkeys.cpp:1108
|
||||
#: awesome-widget/plugin/awkeys.cpp:1168 awesome-widget/plugin/awkeys.cpp:1225
|
||||
msgid "Comment: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:762 awesome-widget/plugin/awkeys.cpp:773
|
||||
#: awesome-widget/plugin/awkeys.cpp:784 awesome-widget/plugin/awkeys.cpp:1107
|
||||
#: awesome-widget/plugin/awkeys.cpp:1167 awesome-widget/plugin/awkeys.cpp:1224
|
||||
msgid "Name: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:764 awesome-widget/plugin/awkeys.cpp:1109
|
||||
msgid "Ticker: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:775 awesome-widget/plugin/awkeys.cpp:786
|
||||
#: awesome-widget/plugin/awkeys.cpp:1169 awesome-widget/plugin/awkeys.cpp:1226
|
||||
msgid "Exec: %1"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:1012 awesome-widget/plugin/awkeys.cpp:1077
|
||||
#: awesome-widget/plugin/awkeys.cpp:1134 awesome-widget/plugin/awkeys.cpp:1193
|
||||
msgid "Enter file name"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/awkeys.cpp:1013 awesome-widget/plugin/awkeys.cpp:1078
|
||||
#: awesome-widget/plugin/awkeys.cpp:1135 awesome-widget/plugin/awkeys.cpp:1194
|
||||
msgid "File name"
|
||||
msgstr ""
|
||||
|
||||
#: awesome-widget/plugin/graphicalitem.cpp:497
|
||||
msgid "Select color"
|
||||
msgstr ""
|
||||
|
||||
#: translations/awesome-widget/rc.cpp:1 rc.cpp:1
|
||||
msgctxt "NAME OF TRANSLATORS"
|
||||
msgid "Your names"
|
||||
msgstr ""
|
||||
|
||||
#: translations/awesome-widget/rc.cpp:2 rc.cpp:2
|
||||
msgctxt "EMAIL OF TRANSLATORS"
|
||||
msgid "Your emails"
|
||||
msgstr ""
|
644
sources/translations/awesome-widgets.pot
Normal file
644
sources/translations/awesome-widgets.pot
Normal file
@ -0,0 +1,644 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
|
||||
"POT-Creation-Date: 2015-08-01 22:13+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#, kde-format
|
||||
msgid "Widget"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Advanced"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Tooltip"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Appearance"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "DataEngine"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Acknowledgment"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Widget height, px"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Widget width, px"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Enable notifications"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Wrap new lines"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Enable background"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Custom time format"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Custom uptime format"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Temperature units"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Celsius"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Fahrenheit"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Kelvin"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Reaumur"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "cm^-1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "kJ/mol"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "kcal/mol"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "AC online tag"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "AC offline tag"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Drop key cache"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Time interval"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Font"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Font size"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Font weight"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "light"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "normal"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "demi bold"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "bold"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "black"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Font style"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "italic"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Font color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Select a color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Select a font"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "ACPI path"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Custom scripts"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Edit scripts"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "GPU device"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "HDD"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "hddtemp cmd"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "MPD address"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "MPD port"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "MPRIS player name"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Music player"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Quotes monitor"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Edit tickers"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Package manager"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Edit command"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Weather"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Edit weather"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Request key"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Show README"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Check updates"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"CPU, CPU clock, memory, swap and network labels support graphical tooltip. "
|
||||
"To enable them just make needed checkbox fully checked."
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Number of values for tooltips"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Background"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "CPU color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "CPU clock color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Memory color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Swap color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Download speed color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Upload speed color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Battery active color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Battery inactive color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Detailed information may be found on <a href=\"http://arcanis.name/projects/"
|
||||
"awesome-widgets/\">project homepage</a>"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Add"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Show value"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Tag: %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Value: %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Info: %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Edit bars"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Run %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Version %1 (build date %2)"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "A set of minimalistic plasmoid widgets"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Links:"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Homepage"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Repository"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Bugtracker"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Translation issue"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "AUR packages"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "openSUSE packages"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "This software is licensed under %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Translators: %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "This software uses: %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Select font"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Current version : %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "New version : %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Click \"Ok\" to download"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "There are updates"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "AC online"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "AC offline"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "High CPU load"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "High GPU load"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Free space on %1 less than 10%"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "High memory usage"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Network device has been changed to %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Swap is used"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Select tag"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Tag"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Copy"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Create"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Remove"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Enter file name"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "File name"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Name: %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Comment: %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Identity: %1"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Comment"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"<html><head/><body><p>Use YAHOO! finance ticker to get quotes for the "
|
||||
"instrument. Refer to <a href=\"http://finance.yahoo.com/\"><span style=\" "
|
||||
"text-decoration: underline; color:#0057ae;\">http://finance.yahoo.com/</"
|
||||
"span></a></p></body></html>"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Ticker"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Active"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Interval"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Command"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Prefix"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Has output"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Redirect"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Additional filters"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Wrap colors"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Wrap spaces"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Null"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "City"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Country"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Timestamp"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Value"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Active color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Inactive color"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Direction"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Height"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Width"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Active desktop"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Inactive desktop"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Tooltip type"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "contours"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "windows"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "clean desktop"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "names"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "none"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Tooltip width"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Vertical layout"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Mark"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Top Edge"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Bottom Edge"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Left Edge"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Right Edge"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgid "Unknown location (%1)"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgctxt "NAME OF TRANSLATORS"
|
||||
msgid "Your names"
|
||||
msgstr ""
|
||||
|
||||
#, kde-format
|
||||
msgctxt "EMAIL OF TRANSLATORS"
|
||||
msgid "Your emails"
|
||||
msgstr ""
|
@ -1,18 +0,0 @@
|
||||
set (MO_NAME plasma_applet_org.kde.plasma.desktoppanel.mo)
|
||||
|
||||
file (GLOB _po_files *.po)
|
||||
set (_gmoFiles)
|
||||
|
||||
foreach (_current_PO_FILE ${_po_files})
|
||||
get_filename_component (_lang ${_current_PO_FILE} NAME_WE)
|
||||
set (_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
|
||||
add_custom_command (OUTPUT ${_gmoFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${_current_PO_FILE}
|
||||
)
|
||||
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES/ RENAME ${MO_NAME})
|
||||
list (APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach (_current_PO_FILE)
|
||||
add_custom_target (dp_pofiles ALL DEPENDS ${_gmoFiles})
|
@ -1,347 +0,0 @@
|
||||
# Copyright (C) 2014
|
||||
# This file is distributed under the same license as the PyTextMonitor package.
|
||||
#
|
||||
# Evgeniy Alekseev <esalexeev@gmail.com>, 2014, 2015.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
|
||||
"POT-Creation-Date: 2015-05-22 00:05+0300\n"
|
||||
"PO-Revision-Date: 2015-05-22 00:06+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"
|
||||
"X-Generator: Lokalize 2.0\n"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:25
|
||||
msgid "Widget"
|
||||
msgstr "Widget"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:31
|
||||
msgid "Advanced"
|
||||
msgstr "Advanced"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:37
|
||||
msgid "Active desktop"
|
||||
msgstr "Active desktop"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:43
|
||||
msgid "Inactive desktop"
|
||||
msgstr "Inactive desktop"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:49
|
||||
#: desktop-panel/package/contents/ui/about.qml:42
|
||||
msgid "About"
|
||||
msgstr "About"
|
||||
|
||||
#: desktop-panel/package/contents/ui/about.qml:75
|
||||
msgid "Acknowledgment"
|
||||
msgstr "Acknowledgment"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:60
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:60
|
||||
#: desktop-panel/package/contents/ui/widget.qml:51
|
||||
msgid "Font"
|
||||
msgstr "Font"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:78
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:78
|
||||
msgid "Font size"
|
||||
msgstr "Font size"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:98
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:98
|
||||
msgid "Font weight"
|
||||
msgstr "Font weight"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:106
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:106
|
||||
msgid "light"
|
||||
msgstr "light"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:110
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:153
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:110
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:153
|
||||
msgid "normal"
|
||||
msgstr "normal"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:114
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:114
|
||||
msgid "demi bold"
|
||||
msgstr "demi bold"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:118
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:118
|
||||
msgid "bold"
|
||||
msgstr "bold"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:122
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:122
|
||||
msgid "black"
|
||||
msgstr "black"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:145
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:145
|
||||
msgid "Font style"
|
||||
msgstr "Font style"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:157
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:157
|
||||
msgid "italic"
|
||||
msgstr "italic"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:180
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:163
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:180
|
||||
msgid "Font color"
|
||||
msgstr "Font color"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:198
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:247
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:198
|
||||
msgid "Select a color"
|
||||
msgstr "Select a color"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:205
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:205
|
||||
msgid "Select a font"
|
||||
msgstr "Select a font"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:56
|
||||
msgid "Widget height, px"
|
||||
msgstr "Widget height, px"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:76
|
||||
msgid "Widget width, px"
|
||||
msgstr "Widget width, px"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:96
|
||||
msgid "Tooltip type"
|
||||
msgstr "Tooltip type"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:104
|
||||
msgid "contours"
|
||||
msgstr "contours"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:108
|
||||
msgid "windows"
|
||||
msgstr "windows"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:112
|
||||
msgid "clean desktop"
|
||||
msgstr "clean desktop"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:116
|
||||
msgid "names"
|
||||
msgstr "names"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:120
|
||||
msgid "none"
|
||||
msgstr "none"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:143
|
||||
msgid "Tooltip width"
|
||||
msgstr "Tooltip width"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:188
|
||||
msgid "Enable background"
|
||||
msgstr "Enable background"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:202
|
||||
msgid "Vertical layout"
|
||||
msgstr "Vertical layout"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:214
|
||||
msgid "Mark"
|
||||
msgstr "Mark"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:44
|
||||
msgid ""
|
||||
"Detailed information may be found on <a href=\"http://arcanis.name/projects/"
|
||||
"awesome-widgets/\">project homepage</a>"
|
||||
msgstr ""
|
||||
"Detailed information may be found on <a href=\"http://arcanis.name/projects/"
|
||||
"awesome-widgets/\">project homepage</a>"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:194
|
||||
msgid "Add"
|
||||
msgstr "Add"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:207
|
||||
msgid "Show value"
|
||||
msgstr "Show value"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:212
|
||||
msgid "Tag: %1"
|
||||
msgstr "Tag: %1"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:214
|
||||
msgid "Value: %1"
|
||||
msgstr "Value: %1"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:314
|
||||
msgid "A set of minimalistic plasmoid widgets"
|
||||
msgstr "A set of minimalistic plasmoid widgets"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:316
|
||||
msgid "Links:"
|
||||
msgstr "Links:"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:317
|
||||
msgid "Homepage"
|
||||
msgstr "Homepage"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:318
|
||||
msgid "Repository"
|
||||
msgstr "Repository"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:319
|
||||
msgid "Bugtracker"
|
||||
msgstr "Bugtracker"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:320
|
||||
msgid "Translation issue"
|
||||
msgstr "Translation issue"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:321
|
||||
msgid "AUR packages"
|
||||
msgstr "AUR packages"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:322
|
||||
msgid "openSUSE packages"
|
||||
msgstr "openSUSE packages"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:325
|
||||
msgid "This software is licensed under %1"
|
||||
msgstr "This software is licensed under %1"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:327
|
||||
msgid "Translators: %1"
|
||||
msgstr "Translators: %1"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:335
|
||||
msgid "This software uses: %1"
|
||||
msgstr "This software uses: %1"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:350
|
||||
msgid "Select font"
|
||||
msgstr "Select font"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:475
|
||||
msgid "Top Edge"
|
||||
msgstr "Top Edge"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:477
|
||||
msgid "Bottom Edge"
|
||||
msgstr "Bottom Edge"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:479
|
||||
msgid "Left Edge"
|
||||
msgstr "Left Edge"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:481
|
||||
msgid "Right Edge"
|
||||
msgstr "Right Edge"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:483
|
||||
msgid "Unknown location (%1)"
|
||||
msgstr "Unknown location (%1)"
|
||||
|
||||
#: translations/desktop-panel/rc.cpp:1 rc.cpp:1
|
||||
msgctxt "NAME OF TRANSLATORS"
|
||||
msgid "Your names"
|
||||
msgstr "Evgeniy Alekseev"
|
||||
|
||||
#: translations/desktop-panel/rc.cpp:2 rc.cpp:2
|
||||
msgctxt "EMAIL OF TRANSLATORS"
|
||||
msgid "Your emails"
|
||||
msgstr "esalexeev@gmail.com"
|
||||
|
||||
#~ msgid "Unknown Position (%1)"
|
||||
#~ msgstr "Unknown Position (%1)"
|
||||
|
||||
#~ msgid "Appearance"
|
||||
#~ msgstr "Appearance"
|
||||
|
||||
#~ msgid "Toggle panels"
|
||||
#~ msgstr "Toggle panels"
|
||||
|
||||
#~ msgid "To control panels please set widget shortcut."
|
||||
#~ msgstr "To control panels please set widget shortcut."
|
||||
|
||||
#~ msgid "A mark which will be shown if this desktop is active"
|
||||
#~ msgstr "A mark which will be shown if this desktop is active"
|
||||
|
||||
#~ msgid "Ctrl+B"
|
||||
#~ msgstr "Ctrl+B"
|
||||
|
||||
#~ msgid "Ctrl+I"
|
||||
#~ msgstr "Ctrl+I"
|
||||
|
||||
#~ msgid "Ctrl+U"
|
||||
#~ msgstr "Ctrl+U"
|
||||
|
||||
#~ msgid "px"
|
||||
#~ msgstr "px"
|
||||
|
||||
#~ msgid "Window border color on tooltip"
|
||||
#~ msgstr "Window border color on tooltip"
|
||||
|
||||
#~ msgid "Enable tooltip"
|
||||
#~ msgstr "Enable tooltip"
|
||||
|
||||
#~ msgid "Windows"
|
||||
#~ msgstr "Windows"
|
||||
|
||||
#~ msgid "Contours"
|
||||
#~ msgstr "Contours"
|
||||
|
||||
#~ msgid "Clean desktop"
|
||||
#~ msgstr "Clean desktop"
|
||||
|
||||
#~ msgid "Show windows instead of contours"
|
||||
#~ msgstr "Show windows instead of contours"
|
||||
|
||||
#~ msgid "Time interval"
|
||||
#~ msgstr "Time interval"
|
||||
|
||||
#~ msgid "Command to change desktop"
|
||||
#~ msgstr "Command to change desktop"
|
||||
|
||||
#~ msgid "Command which will change the current desktop"
|
||||
#~ msgstr "Command which will change the current desktop"
|
||||
|
||||
#~ 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 "Pattern"
|
||||
#~ msgstr "Pattern"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "$mark - show mark if the current desktop is active\n"
|
||||
#~ "$name - desktop name\n"
|
||||
#~ "$number - desktop number\n"
|
||||
#~ "$total - total number of desktops"
|
||||
#~ msgstr ""
|
||||
#~ "$mark - show mark if the current desktop is active\n"
|
||||
#~ "$name - desktop name\n"
|
||||
#~ "$number - desktop number\n"
|
||||
#~ "$total - total number of desktops"
|
||||
|
||||
#~ msgid "Set font family"
|
||||
#~ msgstr "Set font family"
|
||||
|
||||
#~ msgid "Set font weight"
|
||||
#~ msgstr "Set font weight"
|
||||
|
||||
#~ msgid "Set font style"
|
||||
#~ msgstr "Set font style"
|
@ -1,316 +0,0 @@
|
||||
# Copyright (C) 2014
|
||||
# This file is distributed under the same license as the PyTextMonitor package.
|
||||
#
|
||||
# Ernesto Avilés Vzqz <whippiii@gmail.com>, 2014.
|
||||
# Evgeniy Alekseev <esalexeev@gmail.com>, 2014.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
|
||||
"POT-Creation-Date: 2015-05-22 00:05+0300\n"
|
||||
"PO-Revision-Date: 2015-06-03 21:06-0500\n"
|
||||
"Last-Translator: Ernesto Avilés Vázquez <whippiii@gmail.com>\n"
|
||||
"Language-Team: Spanish <kde-i18n-doc@kde.org>\n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 1.7.6\n"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:25
|
||||
msgid "Widget"
|
||||
msgstr "Widget"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:31
|
||||
msgid "Advanced"
|
||||
msgstr "Avanzado"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:37
|
||||
msgid "Active desktop"
|
||||
msgstr "Escritorio activo"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:43
|
||||
msgid "Inactive desktop"
|
||||
msgstr "Escritorio inactivo"
|
||||
|
||||
#: desktop-panel/package/contents/config/config.qml:49
|
||||
#: desktop-panel/package/contents/ui/about.qml:42
|
||||
msgid "About"
|
||||
msgstr "Acerca de"
|
||||
|
||||
#: desktop-panel/package/contents/ui/about.qml:75
|
||||
msgid "Acknowledgment"
|
||||
msgstr "Reconocimiento"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:60
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:60
|
||||
#: desktop-panel/package/contents/ui/widget.qml:51
|
||||
msgid "Font"
|
||||
msgstr "Tipo de letra"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:78
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:78
|
||||
msgid "Font size"
|
||||
msgstr "Tamaño de letra"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:98
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:98
|
||||
msgid "Font weight"
|
||||
msgstr "Grosor de letra"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:106
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:106
|
||||
msgid "light"
|
||||
msgstr "fina"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:110
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:153
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:110
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:153
|
||||
msgid "normal"
|
||||
msgstr "normal"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:114
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:114
|
||||
msgid "demi bold"
|
||||
msgstr "medio negrita"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:118
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:118
|
||||
msgid "bold"
|
||||
msgstr "negrita"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:122
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:122
|
||||
msgid "black"
|
||||
msgstr "negro"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:145
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:145
|
||||
msgid "Font style"
|
||||
msgstr "Estilo de letra"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:157
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:157
|
||||
msgid "italic"
|
||||
msgstr "cursiva"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:180
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:163
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:180
|
||||
msgid "Font color"
|
||||
msgstr "Color de letra"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:198
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:247
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:198
|
||||
msgid "Select a color"
|
||||
msgstr "Elige un color"
|
||||
|
||||
#: desktop-panel/package/contents/ui/activeapp.qml:205
|
||||
#: desktop-panel/package/contents/ui/inactiveapp.qml:205
|
||||
msgid "Select a font"
|
||||
msgstr "Elige un tipo de letra"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:56
|
||||
msgid "Widget height, px"
|
||||
msgstr "Alto del widget, px"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:76
|
||||
msgid "Widget width, px"
|
||||
msgstr "Ancho del widget, px"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:96
|
||||
msgid "Tooltip type"
|
||||
msgstr "Tipo de ventana emergente"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:104
|
||||
msgid "contours"
|
||||
msgstr "contornos"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:108
|
||||
msgid "windows"
|
||||
msgstr "ventanas"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:112
|
||||
msgid "clean desktop"
|
||||
msgstr "limpiar escritorio"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:116
|
||||
msgid "names"
|
||||
msgstr "nombres"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:120
|
||||
msgid "none"
|
||||
msgstr "ninguno"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:143
|
||||
msgid "Tooltip width"
|
||||
msgstr "Ancho de la ventana emergente"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:188
|
||||
msgid "Enable background"
|
||||
msgstr "Habilitar fondo"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:202
|
||||
msgid "Vertical layout"
|
||||
msgstr "Orientación vertical"
|
||||
|
||||
#: desktop-panel/package/contents/ui/advanced.qml:214
|
||||
msgid "Mark"
|
||||
msgstr "Marca"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:44
|
||||
msgid ""
|
||||
"Detailed information may be found on <a href=\"http://arcanis.name/projects/"
|
||||
"awesome-widgets/\">project homepage</a>"
|
||||
msgstr ""
|
||||
"Puedes encontrar información detallada en el <a href=\"http://arcanis.name/"
|
||||
"projects/awesome-widgets/\">sitio del proyecto</a>"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:194
|
||||
msgid "Add"
|
||||
msgstr "Añadir"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:207
|
||||
msgid "Show value"
|
||||
msgstr "Mostrar valor"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:212
|
||||
msgid "Tag: %1"
|
||||
msgstr "Etiqueta: %1"
|
||||
|
||||
#: desktop-panel/package/contents/ui/widget.qml:214
|
||||
msgid "Value: %1"
|
||||
msgstr "Valor: %1"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:314
|
||||
msgid "A set of minimalistic plasmoid widgets"
|
||||
msgstr "Un conjunto de plasmoides minimalistas"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:316
|
||||
msgid "Links:"
|
||||
msgstr "Enlaces:"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:317
|
||||
msgid "Homepage"
|
||||
msgstr "Página principal"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:318
|
||||
msgid "Repository"
|
||||
msgstr "Repositorio"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:319
|
||||
msgid "Bugtracker"
|
||||
msgstr "Reporte de errores"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:320
|
||||
msgid "Translation issue"
|
||||
msgstr "Problemas de traducción"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:321
|
||||
msgid "AUR packages"
|
||||
msgstr "Paquetes AUR"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:322
|
||||
msgid "openSUSE packages"
|
||||
msgstr "Paquetes de openSUSE"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:325
|
||||
msgid "This software is licensed under %1"
|
||||
msgstr "Este software está licenciado bajo %1"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:327
|
||||
msgid "Translators: %1"
|
||||
msgstr "Traductores: %1"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:335
|
||||
msgid "This software uses: %1"
|
||||
msgstr "Este software usa: %1"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:350
|
||||
msgid "Select font"
|
||||
msgstr "Elegir tipo de letra"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:475
|
||||
msgid "Top Edge"
|
||||
msgstr "Borde superior"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:477
|
||||
msgid "Bottom Edge"
|
||||
msgstr "Borde inferior"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:479
|
||||
msgid "Left Edge"
|
||||
msgstr "Borde izquierdo"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:481
|
||||
msgid "Right Edge"
|
||||
msgstr "Borde derecho"
|
||||
|
||||
#: desktop-panel/plugin/dpadds.cpp:483
|
||||
msgid "Unknown location (%1)"
|
||||
msgstr "Ubicación desconocida (%1)"
|
||||
|
||||
#: translations/desktop-panel/rc.cpp:1 rc.cpp:1
|
||||
msgctxt "NAME OF TRANSLATORS"
|
||||
msgid "Your names"
|
||||
msgstr "Tu nombre"
|
||||
|
||||
#: translations/desktop-panel/rc.cpp:2 rc.cpp:2
|
||||
msgctxt "EMAIL OF TRANSLATORS"
|
||||
msgid "Your emails"
|
||||
msgstr "Tu correo electrónico"
|
||||
|
||||
#~ msgid "Unknown Position (%1)"
|
||||
#~ msgstr "Posición desconocida (%1)"
|
||||
|
||||
#~ msgid "Appearance"
|
||||
#~ msgstr "Apariencia"
|
||||
|
||||
#~ msgid "Toggle panels"
|
||||
#~ msgstr "Conmutar paneles"
|
||||
|
||||
#~ msgid "To control panels please set widget shortcut."
|
||||
#~ msgstr ""
|
||||
#~ "Para controlar los paneles establece el atajo del teclado para el widget."
|
||||
|
||||
#~ msgid "A mark which will be shown if this desktop is active"
|
||||
#~ msgstr "Una marca será mostrada si este escritorio está activo"
|
||||
|
||||
#~ msgid "Ctrl+B"
|
||||
#~ msgstr "Ctrl+B"
|
||||
|
||||
#~ msgid "Ctrl+I"
|
||||
#~ msgstr "Ctrl+I"
|
||||
|
||||
#~ msgid "Ctrl+U"
|
||||
#~ msgstr "Ctrl+U"
|
||||
|
||||
#~ msgid "px"
|
||||
#~ msgstr "px"
|
||||
|
||||
#~ msgid "Window border color on tooltip"
|
||||
#~ msgstr "Color del borde de la ventana emergente"
|
||||
|
||||
#~ msgid "Enable tooltip"
|
||||
#~ msgstr "Habilitar ventana emergente"
|
||||
|
||||
#~ msgid "Windows"
|
||||
#~ msgstr "Ventanas"
|
||||
|
||||
#~ msgid "Contours"
|
||||
#~ msgstr "Contornos"
|
||||
|
||||
#~ msgid "Clean desktop"
|
||||
#~ msgstr "Limpiar escritorio"
|
||||
|
||||
#~ msgid "Time interval"
|
||||
#~ msgstr "Intervalo de tiempo"
|
||||
|
||||
#~ msgid "Add stretch to left/top of the layout"
|
||||
#~ msgstr "Añadir extensión a la izquierda/superior de la distribución"
|
||||
|
||||
#~ msgid "Add stretch to right/bottom of the layout"
|
||||
#~ msgstr "Añadir extensión a la derecha/inferior de la distribución"
|
@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
# root of translatable sources
|
||||
BASEDIR="../../"
|
||||
PATHS="desktop-panel"
|
||||
PROJECT="plasma_applet_desktop-panel" # project name
|
||||
BUGADDR="https://github.com/arcan1s/awesome-widgets/issues" # MSGID-Bugs
|
||||
# working dir
|
||||
WDIR=`pwd`
|
||||
|
||||
|
||||
echo "Preparing rc files"
|
||||
cd ${BASEDIR}
|
||||
# we use simple sorting to make sure the lines do not jump around too much from system to system
|
||||
find . -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' | grep ${PATHS} | sort > ${WDIR}/rcfiles.list
|
||||
xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/rc.cpp
|
||||
# additional string for KAboutData
|
||||
echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> ${WDIR}/rc.cpp
|
||||
echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> ${WDIR}/rc.cpp
|
||||
cd ${WDIR}
|
||||
echo "Done preparing rc files"
|
||||
|
||||
echo "Extracting messages"
|
||||
cd ${BASEDIR}
|
||||
# see above on sorting
|
||||
find . -name '*.cpp' -o -name '*.h' -o -name '*.qml' | grep ${PATHS} | sort > ${WDIR}/infiles.list
|
||||
echo "rc.cpp" >> ${WDIR}/infiles.list
|
||||
cd ${WDIR}
|
||||
xgettext --from-code=UTF-8 -C -kde -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 \
|
||||
--msgid-bugs-address="${BUGADDR}" \
|
||||
--files-from=infiles.list -D ${BASEDIR} -D ${WDIR} -o ${PROJECT}.pot || { echo "Error while calling xgettext, aborting."; exit 1; }
|
||||
echo "Done extracting messages"
|
||||
|
||||
echo "Merging translations"
|
||||
catalogs=`find . -name '*.po'`
|
||||
for cat in $catalogs; do
|
||||
echo $cat
|
||||
msgmerge -o $cat.new $cat ${PROJECT}.pot
|
||||
mv $cat.new $cat
|
||||
done
|
||||
echo "Done merging translations"
|
||||
|
||||
|
||||
echo "Cleaning up"
|
||||
cd ${WDIR}
|
||||
rm -f rcfiles.list infiles.list rc.cpp
|
||||
echo "Done"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user