diff --git a/sources/awesome-widget/graphicalitem.cpp b/sources/awesome-widget/graphicalitem.cpp
index 4d8a695..2913285 100644
--- a/sources/awesome-widget/graphicalitem.cpp
+++ b/sources/awesome-widget/graphicalitem.cpp
@@ -280,6 +280,7 @@ void GraphicalItem::setHeight(const int height)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Height" << height;
+ if (height <= 0) return;
_height = height;
}
@@ -289,6 +290,7 @@ void GraphicalItem::setWidth(const int width)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Width" << width;
+ if (width <= 0) return;
_width = width;
}
diff --git a/sources/awesome-widget/graphicalitem.h b/sources/awesome-widget/graphicalitem.h
index 5a02a8a..ad30901 100644
--- a/sources/awesome-widget/graphicalitem.h
+++ b/sources/awesome-widget/graphicalitem.h
@@ -55,15 +55,15 @@ public:
int getHeight();
int getWidth();
// set methods
- void setName(const QString name);
- void setComment(const QString comment);
- void setBar(const QString bar);
- void setActiveColor(const QColor color);
- void setInactiveColor(const QColor color);
- void setType(const QString type);
- void setDirection(const QString direction);
- void setHeight(const int height);
- void setWidth(const int width);
+ void setName(const QString name = QString("none"));
+ void setComment(const QString comment = QString("empty"));
+ void setBar(const QString bar = QString("cpu"));
+ void setActiveColor(const QColor color = QColor(255, 255, 255, 0));
+ void setInactiveColor(const QColor color = QColor(255, 255, 255, 255));
+ void setType(const QString type = QString("Horizontal"));
+ void setDirection(const QString direction = QString("LeftToRight"));
+ void setHeight(const int height = 100);
+ void setWidth(const int width = 100);
public slots:
void readConfiguration();
diff --git a/sources/awesome-widget/graphicalitem.ui b/sources/awesome-widget/graphicalitem.ui
index 1678c71..03693b8 100644
--- a/sources/awesome-widget/graphicalitem.ui
+++ b/sources/awesome-widget/graphicalitem.ui
@@ -6,7 +6,7 @@
0
0
- 408
+ 420
329
@@ -39,6 +39,12 @@
-
+
+
+ 200
+ 0
+
+
Comment
diff --git a/sources/ext-sysmon/extscript.cpp b/sources/ext-sysmon/extscript.cpp
index 389d769..fa5e65c 100644
--- a/sources/ext-sysmon/extscript.cpp
+++ b/sources/ext-sysmon/extscript.cpp
@@ -46,28 +46,6 @@ ExtScript::~ExtScript()
}
-void ExtScript::addDirectory(const QString dir)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Directory" << dir;
-
- QString absPath = QDir(dir).absolutePath();
- if (!QDir(absPath).exists()) return;
- for (int i=0; itoUnicode(process.error).trimmed();
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
- switch(redirect) {
+ switch(_redirect) {
case stdout2stderr:
if (debug) qDebug() << PDEBUG << ":" << "Debug" << info;
if (debug) qDebug() << PDEBUG << ":" << "Output" << qoutput;
@@ -231,13 +203,19 @@ ExtScript::ScriptData ExtScript::run(const int time)
response.output = qoutput;
break;
}
- if (!output)
+ if (!_output)
response.output = QString::number(process.exitCode);
return response;
}
+void ExtScript::showConfiguration()
+{
+ if (debug) qDebug() << PDEBUG;
+}
+
+
void ExtScript::tryDelete()
{
if (debug) qDebug() << PDEBUG;
@@ -273,17 +251,17 @@ void ExtScript::fromExternalConfiguration(const QMap settings)
if (debug) qDebug() << PDEBUG;
if (settings.contains(QString("ACTIVE")))
- active = (settings[QString("ACTIVE")] == QString("true"));
+ _active = (settings[QString("ACTIVE")] == QString("true"));
if (settings.contains(QString("INTERVAL")))
- interval = settings[QString("INTERVAL")].toInt();
+ _interval = settings[QString("INTERVAL")].toInt();
if (settings.contains(QString("PREFIX")))
- prefix = settings[QString("PREFIX")];
+ _prefix = settings[QString("PREFIX")];
if (settings.contains(QString("OUTPUT")))
- output = (settings[QString("OUTPUT")] == QString("true"));
+ _output = (settings[QString("OUTPUT")] == QString("true"));
if (settings.contains(QString("REDIRECT")))
- redirect = (Redirect)settings[QString("REDIRECT")].toInt();
- if (!output)
- redirect = stdout2stderr;
+ _redirect = (Redirect)settings[QString("REDIRECT")].toInt();
+ if (!_output)
+ _redirect = stdout2stderr;
}
@@ -318,17 +296,17 @@ QMap ExtScript::toExternalConfiguration()
if (debug) qDebug() << PDEBUG;
QMap settings;
- if (active)
+ if (_active)
settings[QString("ACTIVE")] = QString("true");
else
settings[QString("ACTIVE")] = QString("false");
- settings[QString("INTERVAL")] = QString::number(interval);
- settings[QString("PREFIX")] = prefix;
- if (output)
+ settings[QString("INTERVAL")] = QString::number(_interval);
+ settings[QString("PREFIX")] = _prefix;
+ if (_output)
settings[QString("OUTPUT")] = QString("true");
else
settings[QString("OUTPUT")] = QString("false");
- settings[QString("REDIRECT")] = QString::number(redirect);
+ settings[QString("REDIRECT")] = QString::number(_redirect);
return settings;
}
diff --git a/sources/ext-sysmon/extscript.h b/sources/ext-sysmon/extscript.h
index a841d3f..28257a5 100644
--- a/sources/ext-sysmon/extscript.h
+++ b/sources/ext-sysmon/extscript.h
@@ -31,7 +31,7 @@ class ExtScript : public QDialog
public:
enum Redirect {
- stdout2stderr = -1,
+ stdout2stderr = 0,
nothing,
stderr2stdout
};
@@ -41,28 +41,28 @@ public:
QString output;
bool refresh;
} ScriptData;
+
explicit ExtScript(QWidget *parent = 0, const QString scriptName = QString(),
const QStringList directories = QStringList(), const bool debugCmd = false);
~ExtScript();
- // configuration
- void addDirectory(const QString dir);
- QStringList directories();
+ // get methods
int getInterval();
QString getName();
QString getPrefix();
Redirect getRedirect();
bool hasOutput();
bool isActive();
+ // set methods
void setActive(const bool state = true);
- void setDirectories(const QStringList directories);
void setHasOutput(const bool state = true);
- void setInterval(const int inter = 1);
- void setPrefix(const QString pref = QString(""));
- void setRedirect(const Redirect redir);
+ void setInterval(const int interval = 1);
+ void setPrefix(const QString prefix = QString(""));
+ void setRedirect(const QString redirect = QString("nothing"));
public slots:
void readConfiguration();
ScriptData run(const int time);
+ void showConfiguration();
void tryDelete();
void writeConfiguration();
@@ -77,11 +77,12 @@ private:
QMap getConfigurationFromFile(const QString fileName);
QMap toExternalConfiguration();
// properties
- bool active = true;
- int interval = 1;
- bool output = true;
- QString prefix = QString("");
- Redirect redirect = nothing;
+ bool _active = true;
+ QString _comment = QString("");
+ int _interval = 1;
+ bool _output = true;
+ QString _prefix = QString("");
+ Redirect _redirect = nothing;
};
diff --git a/sources/ext-sysmon/extscript.ui b/sources/ext-sysmon/extscript.ui
index d2dd7df..0e2a003 100644
--- a/sources/ext-sysmon/extscript.ui
+++ b/sources/ext-sysmon/extscript.ui
@@ -1,3 +1,4 @@
+
ExtScript
@@ -5,29 +6,198 @@
0
0
- 240
- 320
+ 420
+ 301
- Dialog
+ Configuration
-
-
-
- 10
- 270
- 221
- 41
-
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
+
+
-
+
+
-
+
+
+
+ 200
+ 0
+
+
+
+ Name
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 200
+ 0
+
+
+
+ Comment
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 200
+ 0
+
+
+
+ Command
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 200
+ 0
+
+
+
+ Prefix
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Active
+
+
+
+ -
+
+
+ Has output
+
+
+
+ -
+
+
-
+
+
+ Redirect
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
-
+
+ stdout2stderr
+
+
+ -
+
+ nothing
+
+
+ -
+
+ stderr2stdout
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Interval
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ 1
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
diff --git a/sources/ext-sysmon/scripts/aw-get-external-ip b/sources/ext-sysmon/scripts/aw-get-external-ip
deleted file mode 100755
index 60b9621..0000000
--- a/sources/ext-sysmon/scripts/aw-get-external-ip
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-curl ip4.telize.com
diff --git a/sources/ext-sysmon/scripts/aw-get-external-ip.conf b/sources/ext-sysmon/scripts/aw-get-external-ip.conf
deleted file mode 100644
index f5650f0..0000000
--- a/sources/ext-sysmon/scripts/aw-get-external-ip.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-ACTIVE=true
-INTERVAL=1
-PREFIX=
-OUTPUT=true
-REDIRECT=0
diff --git a/sources/ext-sysmon/scripts/aw-script-template b/sources/ext-sysmon/scripts/aw-script-template
deleted file mode 100755
index 0995f2c..0000000
--- a/sources/ext-sysmon/scripts/aw-script-template
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/python
-
-print ("Hello the f$%king world!")
diff --git a/sources/ext-sysmon/scripts/aw-script-template.conf b/sources/ext-sysmon/scripts/aw-script-template.conf
deleted file mode 100644
index ca472a1..0000000
--- a/sources/ext-sysmon/scripts/aw-script-template.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-# is this script active?
-ACTIVE=false
-# update interval in default plasmoid interval
-INTERVAL=1
-# does this script have output?
-# set to 'false' if it is an action and will not show text in the plasmoid
-OUTPUT=true
-# prefix to run this script. Usually this field should be blank,
-# but you may want to set command (e.g. script language) directly
-PREFIX=
-# redirect output streams
-# -1: stdout to stderr
-# 0: do nothing
-# 1: stderr to stdout
-REDIRECT=0
diff --git a/sources/ext-sysmon/scripts/get-external-ip.desktop b/sources/ext-sysmon/scripts/get-external-ip.desktop
new file mode 100644
index 0000000..5d9d860
--- /dev/null
+++ b/sources/ext-sysmon/scripts/get-external-ip.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=aw-get-external-ip
+Comment=Custom command to get external IP
+Exec=curl ip4.telize.com
+X-AW-Prefix=
+X-AW-Active=true
+X-AW-Output=true
+X-AW-Redirect=nothing
+X-AW-Interval=1
diff --git a/sources/ext-sysmon/scripts/script-template.desktop b/sources/ext-sysmon/scripts/script-template.desktop
new file mode 100644
index 0000000..746ac0f
--- /dev/null
+++ b/sources/ext-sysmon/scripts/script-template.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=aw-script-template
+Comment=Template for external script
+Exec=/path/to/some/command
+X-AW-Prefix=/prefix/to/command/if/required
+X-AW-Active=false
+X-AW-Output=false
+X-AW-Redirect=nothing
+X-AW-Interval=1