mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-01 16:05:56 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
7ae90bf82d | |||
bcf26156d1 | |||
4cee2535ee | |||
e1ebd87871 | |||
4cef889fd4 | |||
d785839d1d | |||
cf6ccc293b |
@ -1,3 +1,10 @@
|
|||||||
|
Ver.2.2.1:
|
||||||
|
+ add key X-AW-Interval to ExtUpgrade (ApiVer = 1, default = 3600)
|
||||||
|
+ add values cache to ExtScript and ExtUpgrade
|
||||||
|
+ add support isActive to ExtUpgrade
|
||||||
|
* change cmake version check
|
||||||
|
* improve logic of ExtScript and ExtUpgrade
|
||||||
|
|
||||||
Ver.2.2.0:
|
Ver.2.2.0:
|
||||||
* port to Plasma 5
|
* port to Plasma 5
|
||||||
+ add support of windows list in tooltip
|
+ add support of windows list in tooltip
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Вер.2.2.1:
|
||||||
|
+ добавлен ключ X-AW-Interval в ExtUpgrade (ApiVer = 1, default = 3600)
|
||||||
|
+ добавлено кеширование значений в ExtScript и ExtUpgrade
|
||||||
|
+ добавлена поддержка isActive в ExtUpgrade
|
||||||
|
* изменена проверка версий cmake
|
||||||
|
* улучшена логика работы ExtScript и ExtUpgrade
|
||||||
|
|
||||||
Вер.2.2.0:
|
Вер.2.2.0:
|
||||||
* портирование на Plasma 5
|
* портирование на Plasma 5
|
||||||
+ добавлена поддержка списка окон в тултипе
|
+ добавлена поддержка списка окон в тултипе
|
||||||
|
15
README.md
15
README.md
@ -27,7 +27,7 @@ Instruction
|
|||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* kdebase-workspace
|
* kdebase-workspace (*if KDE4 is used*) **or** plasma-framework (*if KF5 is used*)
|
||||||
* lm_sensors (*for definition temperature device*)
|
* lm_sensors (*for definition temperature device*)
|
||||||
|
|
||||||
Optional dependencies
|
Optional dependencies
|
||||||
@ -35,13 +35,14 @@ Optional dependencies
|
|||||||
|
|
||||||
* proprietary video driver
|
* proprietary video driver
|
||||||
* hddtemp
|
* hddtemp
|
||||||
|
* smartmontools
|
||||||
* music player (mpd or supported MPRIS)
|
* music player (mpd or supported MPRIS)
|
||||||
|
|
||||||
Make dependencies
|
Make dependencies
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
* automoc4
|
|
||||||
* cmake
|
* cmake
|
||||||
|
* automoc4 (*if KDE4 is used*) or extra-cmake-modules (*if KF5 is used*)
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
@ -50,15 +51,11 @@ Installation
|
|||||||
* install
|
* install
|
||||||
|
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
|
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../
|
||||||
make && make install
|
|
||||||
|
|
||||||
Also you may install it to `/`:
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
|
|
||||||
make && sudo make install
|
make && sudo make install
|
||||||
|
|
||||||
|
**NOTE** on Plasma 5 it may require `-DKDE_INSTALL_USE_QT_SYS_PATHS=ON` flag
|
||||||
|
|
||||||
Additional information
|
Additional information
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
pkgname=kdeplasma-applets-awesome-widgets
|
pkgname=kdeplasma-applets-awesome-widgets
|
||||||
_pkgname=awesome-widgets
|
_pkgname=awesome-widgets
|
||||||
pkgver=2.2.0
|
pkgver=2.2.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
@ -20,7 +20,7 @@ optdepends=("amarok: for music player monitor"
|
|||||||
makedepends=('automoc4' 'cmake')
|
makedepends=('automoc4' 'cmake')
|
||||||
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
||||||
install=${pkgname}.install
|
install=${pkgname}.install
|
||||||
md5sums=('a8b46415c387b98d5df1a79bb985f709')
|
md5sums=('74099a8150aa1992b8a168934878d928')
|
||||||
backup=('usr/share/config/plasma-dataengine-extsysmon.conf')
|
backup=('usr/share/config/plasma-dataengine-extsysmon.conf')
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
pkgname=plasma5-applet-awesome-widgets
|
pkgname=plasma5-applet-awesome-widgets
|
||||||
_pkgname=awesome-widgets
|
_pkgname=awesome-widgets
|
||||||
pkgver=2.2.0
|
pkgver=2.2.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
url="http://arcanis.name/projects/awesome-widgets"
|
url="http://arcanis.name/projects/awesome-widgets"
|
||||||
license=('GPL3')
|
license=('GPL3')
|
||||||
depends=('lm_sensors' 'plasma-framework')
|
depends=('plasma-framework')
|
||||||
optdepends=("amarok: for music player monitor"
|
optdepends=("amarok: for music player monitor"
|
||||||
"clementine: for music player monitor"
|
"clementine: for music player monitor"
|
||||||
"catalyst: for GPU monitor"
|
"catalyst: for GPU monitor"
|
||||||
@ -20,7 +20,7 @@ optdepends=("amarok: for music player monitor"
|
|||||||
makedepends=('cmake' 'extra-cmake-modules')
|
makedepends=('cmake' 'extra-cmake-modules')
|
||||||
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
||||||
install=${pkgname}.install
|
install=${pkgname}.install
|
||||||
md5sums=('a8b46415c387b98d5df1a79bb985f709')
|
md5sums=('74099a8150aa1992b8a168934878d928')
|
||||||
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required (VERSION 2.8.12)
|
cmake_minimum_required (VERSION 2.8)
|
||||||
|
|
||||||
cmake_policy (SET CMP0003 OLD)
|
cmake_policy (SET CMP0003 OLD)
|
||||||
cmake_policy (SET CMP0002 OLD)
|
cmake_policy (SET CMP0002 OLD)
|
||||||
@ -11,7 +11,7 @@ set (PROJECT_CONTACT "esalexeev@gmail.com")
|
|||||||
set (PROJECT_LICENSE "GPLv3")
|
set (PROJECT_LICENSE "GPLv3")
|
||||||
set (PROJECT_VERSION_MAJOR 2)
|
set (PROJECT_VERSION_MAJOR 2)
|
||||||
set (PROJECT_VERSION_MINOR 2)
|
set (PROJECT_VERSION_MINOR 2)
|
||||||
set (PROJECT_VERSION_PATCH 0)
|
set (PROJECT_VERSION_PATCH 1)
|
||||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
||||||
@ -22,6 +22,10 @@ message (STATUS "Version: ${PROJECT_VERSION}")
|
|||||||
message (STATUS "Build date: ${CURRENT_DATE}")
|
message (STATUS "Build date: ${CURRENT_DATE}")
|
||||||
|
|
||||||
option (BUILD_KDE4 "Build on KDE4" OFF)
|
option (BUILD_KDE4 "Build on KDE4" OFF)
|
||||||
|
# update minimum cmake version
|
||||||
|
if (NOT BUILD_KDE4)
|
||||||
|
cmake_minimum_required (VERSION 2.8.12)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
@ -971,6 +971,7 @@ void AwesomeWidget::copyPkgCommand(const QString original)
|
|||||||
upgrade->setExecutable(originalUpgrade->executable());
|
upgrade->setExecutable(originalUpgrade->executable());
|
||||||
upgrade->setName(originalUpgrade->name());
|
upgrade->setName(originalUpgrade->name());
|
||||||
upgrade->setNull(originalUpgrade->null());
|
upgrade->setNull(originalUpgrade->null());
|
||||||
|
upgrade->setInterval(originalUpgrade->interval());
|
||||||
delete originalUpgrade;
|
delete originalUpgrade;
|
||||||
|
|
||||||
if (upgrade->showConfiguration() == 1) {
|
if (upgrade->showConfiguration() == 1) {
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
set (SUBPROJECT plasma_applet_awesome-widget)
|
set (SUBPROJECT plasma_applet_awesome-widget)
|
||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
|
# prepare
|
||||||
|
configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||||
|
|
||||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
||||||
|
@ -1077,6 +1077,7 @@ void AWKeys::copyUpgrade(const QString original)
|
|||||||
upgrade->setExecutable(extUpgrade[originalItem]->executable());
|
upgrade->setExecutable(extUpgrade[originalItem]->executable());
|
||||||
upgrade->setName(extUpgrade[originalItem]->name());
|
upgrade->setName(extUpgrade[originalItem]->name());
|
||||||
upgrade->setNull(extUpgrade[originalItem]->null());
|
upgrade->setNull(extUpgrade[originalItem]->null());
|
||||||
|
upgrade->setInterval(extUpgrade[originalItem]->interval());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upgrade->showConfiguration() == 1) {
|
if (upgrade->showConfiguration() == 1) {
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
set (SUBPROJECT plasma_applet_desktop-panel)
|
set (SUBPROJECT plasma_applet_desktop-panel)
|
||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
|
# prepare
|
||||||
|
configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||||
|
|
||||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
||||||
|
@ -273,46 +273,45 @@ void ExtScript::readConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ExtScript::ScriptData ExtScript::run(const int time)
|
QString ExtScript::run()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (!m_active) return value;
|
||||||
|
|
||||||
ScriptData response;
|
if (times == 1) {
|
||||||
response.active = m_active;
|
QStringList cmdList;
|
||||||
response.name = m_name;
|
if (!m_prefix.isEmpty())
|
||||||
response.refresh = false;
|
cmdList.append(m_prefix);
|
||||||
if (!m_active) return response;
|
cmdList.append(m_executable);
|
||||||
if (time != m_interval) return response;
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmdList.join(QChar(' '));
|
||||||
response.refresh = true;
|
TaskResult process = runTask(cmdList.join(QChar(' ')));
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||||
|
if (process.exitCode != 0)
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||||
|
|
||||||
QStringList cmdList;
|
QString info = QString::number(process.exitCode) + QString(":") +
|
||||||
if (!m_prefix.isEmpty())
|
QTextCodec::codecForMib(106)->toUnicode(process.error).trimmed();
|
||||||
cmdList.append(m_prefix);
|
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||||
cmdList.append(m_executable);
|
switch (m_redirect) {
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmdList.join(QChar(' '));
|
case stdout2stderr:
|
||||||
TaskResult process = runTask(cmdList.join(QChar(' ')));
|
if (debug) qDebug() << PDEBUG << ":" << "Debug" << info;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
if (debug) qDebug() << PDEBUG << ":" << "Output" << qoutput;
|
||||||
if (process.exitCode != 0)
|
break;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
case stderr2stdout:
|
||||||
|
value = info + QString("\t") + qoutput;
|
||||||
QString info = QString::number(process.exitCode) + QString(":") +
|
break;
|
||||||
QTextCodec::codecForMib(106)->toUnicode(process.error).trimmed();
|
default:
|
||||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
if (debug) qDebug() << PDEBUG << ":" << "Debug" << info;
|
||||||
switch (m_redirect) {
|
value = qoutput;
|
||||||
case stdout2stderr:
|
break;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Debug" << info;
|
}
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Output" << qoutput;
|
|
||||||
break;
|
|
||||||
case stderr2stdout:
|
|
||||||
response.output = info + QString("\t") + qoutput;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Debug" << info;
|
|
||||||
response.output = qoutput;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
// update value
|
||||||
|
times++;
|
||||||
|
if (times >= m_interval) times = 0;
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,12 +44,6 @@ public:
|
|||||||
nothing,
|
nothing,
|
||||||
stderr2stdout
|
stderr2stdout
|
||||||
};
|
};
|
||||||
typedef struct {
|
|
||||||
bool active;
|
|
||||||
QString name;
|
|
||||||
QString output;
|
|
||||||
bool refresh;
|
|
||||||
} ScriptData;
|
|
||||||
|
|
||||||
explicit ExtScript(QWidget *parent = 0, const QString scriptName = QString(),
|
explicit ExtScript(QWidget *parent = 0, const QString scriptName = QString(),
|
||||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||||
@ -80,7 +74,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
ScriptData run(const int time);
|
QString run();
|
||||||
int showConfiguration();
|
int showConfiguration();
|
||||||
int tryDelete();
|
int tryDelete();
|
||||||
void writeConfiguration();
|
void writeConfiguration();
|
||||||
@ -100,6 +94,8 @@ private:
|
|||||||
bool m_output = true;
|
bool m_output = true;
|
||||||
QString m_prefix = QString("");
|
QString m_prefix = QString("");
|
||||||
Redirect m_redirect = nothing;
|
Redirect m_redirect = nothing;
|
||||||
|
int times = 0;
|
||||||
|
QString value = QString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,7 +145,6 @@ void ExtendedSysMon::initScripts()
|
|||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
#endif /* BUILD_KDE4 */
|
#endif /* BUILD_KDE4 */
|
||||||
|
|
||||||
times.clear();
|
|
||||||
QStringList names;
|
QStringList names;
|
||||||
for (int i=0; i<dirs.count(); i++) {
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
||||||
@ -155,7 +154,6 @@ void ExtendedSysMon::initScripts()
|
|||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||||
names.append(files[j]);
|
names.append(files[j]);
|
||||||
externalScripts.append(new ExtScript(0, files[j], dirs, debug));
|
externalScripts.append(new ExtScript(0, files[j], dirs, debug));
|
||||||
times.append(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -666,15 +664,8 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
setData(source, battery.keys()[i], battery[battery.keys()[i]].toInt());
|
setData(source, battery.keys()[i], battery[battery.keys()[i]].toInt());
|
||||||
}
|
}
|
||||||
} else if (source == QString("custom")) {
|
} else if (source == QString("custom")) {
|
||||||
for (int i=0; i<externalScripts.count(); i++) {
|
for (int i=0; i<externalScripts.count(); i++)
|
||||||
ExtScript::ScriptData data = externalScripts[i]->run(times[i]);
|
setData(source, QString("custom") + QString::number(i), externalScripts[i]->run());
|
||||||
if (!data.active) return true;
|
|
||||||
if (data.refresh) {
|
|
||||||
times[i] = 1;
|
|
||||||
setData(source, QString("custom") + QString::number(i), data.output);
|
|
||||||
} else
|
|
||||||
times[i]++;
|
|
||||||
}
|
|
||||||
} else if (source == QString("desktop")) {
|
} else if (source == QString("desktop")) {
|
||||||
QMap<QString, QVariant> desktop = getCurrentDesktop();
|
QMap<QString, QVariant> desktop = getCurrentDesktop();
|
||||||
for (int i=0; i<desktop.keys().count(); i++)
|
for (int i=0; i<desktop.keys().count(); i++)
|
||||||
@ -694,12 +685,8 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
} else if (source == QString("netdev")) {
|
} else if (source == QString("netdev")) {
|
||||||
setData(source, QString("value"), getNetworkDevice());
|
setData(source, QString("value"), getNetworkDevice());
|
||||||
} else if (source == QString("pkg")) {
|
} else if (source == QString("pkg")) {
|
||||||
if (pkgTimeUpdate > SEC_IN_HOUR) {
|
for (int i=0; i<externalUpgrade.count(); i++)
|
||||||
for (int i=0; i<externalUpgrade.count(); i++)
|
setData(source, QString("pkgcount") + QString::number(i), externalUpgrade[i]->run());
|
||||||
setData(source, QString("pkgcount") + QString::number(i), externalUpgrade[i]->run());
|
|
||||||
pkgTimeUpdate = 0;
|
|
||||||
}
|
|
||||||
pkgTimeUpdate++;
|
|
||||||
} else if (source == QString("player")) {
|
} else if (source == QString("player")) {
|
||||||
QMap<QString, QVariant> player = getPlayerInfo(configuration[QString("PLAYER")],
|
QMap<QString, QVariant> player = getPlayerInfo(configuration[QString("PLAYER")],
|
||||||
configuration[QString("MPDADDRESS")],
|
configuration[QString("MPDADDRESS")],
|
||||||
|
@ -18,10 +18,6 @@
|
|||||||
#ifndef EXTSYSMON_H
|
#ifndef EXTSYSMON_H
|
||||||
#define EXTSYSMON_H
|
#define EXTSYSMON_H
|
||||||
|
|
||||||
#ifndef SEC_IN_HOUR
|
|
||||||
#define SEC_IN_HOUR 60*60
|
|
||||||
#endif /* SEC_IN_HOUR */
|
|
||||||
|
|
||||||
#include <Plasma/DataEngine>
|
#include <Plasma/DataEngine>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
@ -61,10 +57,7 @@ private:
|
|||||||
QMap<QString, QString> configuration;
|
QMap<QString, QString> configuration;
|
||||||
QList<ExtScript *> externalScripts;
|
QList<ExtScript *> externalScripts;
|
||||||
QList<ExtUpgrade *> externalUpgrade;
|
QList<ExtUpgrade *> externalUpgrade;
|
||||||
QList<int> times;
|
|
||||||
bool debug;
|
bool debug;
|
||||||
// FIXME dirty hack to avoid update package information every second
|
|
||||||
int pkgTimeUpdate = SEC_IN_HOUR;
|
|
||||||
// reread configuration
|
// reread configuration
|
||||||
QStringList allHddDevices;
|
QStringList allHddDevices;
|
||||||
QString getAllHdd();
|
QString getAllHdd();
|
||||||
|
@ -82,6 +82,14 @@ QString ExtUpgrade::fileName()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtUpgrade::interval()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString ExtUpgrade::name()
|
QString ExtUpgrade::name()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -142,6 +150,15 @@ void ExtUpgrade::setExecutable(const QString _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)
|
void ExtUpgrade::setName(const QString _name)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -176,6 +193,7 @@ void ExtUpgrade::readConfiguration()
|
|||||||
setExecutable(settings.value(QString("Exec"), m_executable).toString());
|
setExecutable(settings.value(QString("Exec"), m_executable).toString());
|
||||||
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
||||||
setNull(settings.value(QString("X-AW-Null"), m_null).toInt());
|
setNull(settings.value(QString("X-AW-Null"), m_null).toInt());
|
||||||
|
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,15 +202,23 @@ void ExtUpgrade::readConfiguration()
|
|||||||
int ExtUpgrade::run()
|
int ExtUpgrade::run()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (!m_active) return value;
|
||||||
|
|
||||||
TaskResult process = runTask(QString("bash -c \"") + m_executable + QString("\""));
|
if (times == 1) {
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
TaskResult process = runTask(QString("bash -c \"") + m_executable + QString("\""));
|
||||||
if (process.exitCode != 0)
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
if (process.exitCode != 0)
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||||
|
|
||||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||||
|
value = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count() - m_null;
|
||||||
|
}
|
||||||
|
|
||||||
return (qoutput.split(QChar('\n'), QString::SkipEmptyParts).count() - m_null);
|
// update value
|
||||||
|
times++;
|
||||||
|
if (times >= m_interval) times = 0;
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -208,6 +234,7 @@ int ExtUpgrade::showConfiguration()
|
|||||||
else
|
else
|
||||||
ui->checkBox_active->setCheckState(Qt::Unchecked);
|
ui->checkBox_active->setCheckState(Qt::Unchecked);
|
||||||
ui->spinBox_null->setValue(m_null);
|
ui->spinBox_null->setValue(m_null);
|
||||||
|
ui->spinBox_interval->setValue(m_interval);
|
||||||
|
|
||||||
int ret = exec();
|
int ret = exec();
|
||||||
if (ret != 1) return ret;
|
if (ret != 1) return ret;
|
||||||
@ -217,6 +244,7 @@ int ExtUpgrade::showConfiguration()
|
|||||||
setExecutable(ui->lineEdit_command->text());
|
setExecutable(ui->lineEdit_command->text());
|
||||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||||
setNull(ui->spinBox_null->value());
|
setNull(ui->spinBox_null->value());
|
||||||
|
setInterval(ui->spinBox_interval->value());
|
||||||
|
|
||||||
writeConfiguration();
|
writeConfiguration();
|
||||||
return ret;
|
return ret;
|
||||||
@ -253,6 +281,7 @@ void ExtUpgrade::writeConfiguration()
|
|||||||
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||||
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
||||||
settings.setValue(QString("X-AW-Null"), m_null);
|
settings.setValue(QString("X-AW-Null"), m_null);
|
||||||
|
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.sync();
|
settings.sync();
|
||||||
|
@ -34,6 +34,7 @@ class ExtUpgrade : public QDialog
|
|||||||
Q_PROPERTY(QString executable READ executable WRITE setExecutable)
|
Q_PROPERTY(QString executable READ executable WRITE setExecutable)
|
||||||
Q_PROPERTY(int null READ null WRITE setNull)
|
Q_PROPERTY(int null READ null WRITE setNull)
|
||||||
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
||||||
|
Q_PROPERTY(int interval READ interval WRITE setInterval)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExtUpgrade(QWidget *parent = 0, const QString upgradeName = QString(),
|
explicit ExtUpgrade(QWidget *parent = 0, const QString upgradeName = QString(),
|
||||||
@ -44,6 +45,7 @@ public:
|
|||||||
QString comment();
|
QString comment();
|
||||||
QString executable();
|
QString executable();
|
||||||
QString fileName();
|
QString fileName();
|
||||||
|
int interval();
|
||||||
QString name();
|
QString name();
|
||||||
int null();
|
int null();
|
||||||
bool isActive();
|
bool isActive();
|
||||||
@ -54,6 +56,7 @@ public:
|
|||||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||||
void setName(const QString _name = QString("none"));
|
void setName(const QString _name = QString("none"));
|
||||||
void setNull(const int _null = 0);
|
void setNull(const int _null = 0);
|
||||||
|
void setInterval(const int _interval = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
@ -74,6 +77,9 @@ private:
|
|||||||
QString m_executable = QString("/usr/bin/true");
|
QString m_executable = QString("/usr/bin/true");
|
||||||
QString m_name = QString("none");
|
QString m_name = QString("none");
|
||||||
int m_null = 0;
|
int m_null = 0;
|
||||||
|
int m_interval = 3600;
|
||||||
|
int times = 0;
|
||||||
|
int value = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,6 +137,36 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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>500</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>3600</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -6,4 +6,5 @@ Exec=pacman -Qu
|
|||||||
X-AW-Prefix=
|
X-AW-Prefix=
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-Null=0
|
X-AW-Null=0
|
||||||
|
X-AW-Interval=3600
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=1
|
||||||
|
@ -6,4 +6,5 @@ Exec=apt-show-versions -u -b
|
|||||||
X-AW-Prefix=
|
X-AW-Prefix=
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-Null=0
|
X-AW-Null=0
|
||||||
|
X-AW-Interval=3600
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=1
|
||||||
|
@ -6,4 +6,5 @@ Exec=yum list updates
|
|||||||
X-AW-Prefix=
|
X-AW-Prefix=
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-Null=3
|
X-AW-Null=3
|
||||||
|
X-AW-Interval=3600
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=1
|
||||||
|
@ -6,4 +6,5 @@ Exec=urpmq --auto-select
|
|||||||
X-AW-Prefix=
|
X-AW-Prefix=
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-Null=0
|
X-AW-Null=0
|
||||||
|
X-AW-Interval=3600
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=1
|
||||||
|
@ -6,4 +6,5 @@ Exec=aptitude search '~U'
|
|||||||
X-AW-Prefix=
|
X-AW-Prefix=
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-Null=0
|
X-AW-Null=0
|
||||||
|
X-AW-Interval=3600
|
||||||
X-AW-ApiVersion=1
|
X-AW-ApiVersion=1
|
||||||
|
@ -19,4 +19,4 @@ foreach (_current_PO_FILE ${_po_files})
|
|||||||
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 ${MO_NAME})
|
||||||
list (APPEND _gmoFiles ${_gmoFile})
|
list (APPEND _gmoFiles ${_gmoFile})
|
||||||
endforeach (_current_PO_FILE)
|
endforeach (_current_PO_FILE)
|
||||||
add_custom_target (pofiles ALL DEPENDS ${_gmoFiles})
|
add_custom_target (aw_pofiles ALL DEPENDS ${_gmoFiles})
|
||||||
|
@ -19,4 +19,4 @@ foreach (_current_PO_FILE ${_po_files})
|
|||||||
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 ${MO_NAME})
|
||||||
list (APPEND _gmoFiles ${_gmoFile})
|
list (APPEND _gmoFiles ${_gmoFile})
|
||||||
endforeach (_current_PO_FILE)
|
endforeach (_current_PO_FILE)
|
||||||
add_custom_target (pofiles ALL DEPENDS ${_gmoFiles})
|
add_custom_target (dp_pofiles ALL DEPENDS ${_gmoFiles})
|
||||||
|
Reference in New Issue
Block a user