mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
udpate aw-kde4
This commit is contained in:
parent
bb88892125
commit
862d14dc0e
@ -409,7 +409,7 @@ QStringList AwesomeWidget::findGraphicalItems()
|
|||||||
|
|
||||||
QStringList orderedKeys;
|
QStringList orderedKeys;
|
||||||
for (int i=0; i<graphicalItems.count(); i++)
|
for (int i=0; i<graphicalItems.count(); i++)
|
||||||
orderedKeys.append(graphicalItems[i]->getName() + graphicalItems[i]->getBar());
|
orderedKeys.append(graphicalItems[i]->name() + graphicalItems[i]->bar());
|
||||||
orderedKeys.sort();
|
orderedKeys.sort();
|
||||||
QStringList selectedKeys;
|
QStringList selectedKeys;
|
||||||
for (int i=orderedKeys.count()-1; i>=0; i--)
|
for (int i=orderedKeys.count()-1; i>=0; i--)
|
||||||
@ -453,7 +453,7 @@ GraphicalItem *AwesomeWidget::getItemByTag(const QString tag)
|
|||||||
|
|
||||||
GraphicalItem *item = nullptr;
|
GraphicalItem *item = nullptr;
|
||||||
for (int i=0; i< graphicalItems.count(); i++) {
|
for (int i=0; i< graphicalItems.count(); i++) {
|
||||||
if ((graphicalItems[i]->getName() + graphicalItems[i]->getBar()) != tag) continue;
|
if ((graphicalItems[i]->name() + graphicalItems[i]->bar()) != tag) continue;
|
||||||
item = graphicalItems[i];
|
item = graphicalItems[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ QMap<QString, QString> AwesomeWidget::readDataEngineConfiguration()
|
|||||||
rawConfig[QString("PKGNULL")] = QString("0");
|
rawConfig[QString("PKGNULL")] = QString("0");
|
||||||
rawConfig[QString("PLAYER")] = QString("mpris");
|
rawConfig[QString("PLAYER")] = QString("mpris");
|
||||||
|
|
||||||
QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf");
|
QString fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-extsysmon.conf");
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
QFile configFile(fileName);
|
QFile configFile(fileName);
|
||||||
if (!configFile.open(QIODevice::ReadOnly))
|
if (!configFile.open(QIODevice::ReadOnly))
|
||||||
@ -82,7 +82,7 @@ void AwesomeWidget::writeDataEngineConfiguration(const QMap<QString, QString> se
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QMap<QString, QString> config = updateDataEngineConfiguration(settings);
|
QMap<QString, QString> config = updateDataEngineConfiguration(settings);
|
||||||
QString fileName = KGlobal::dirs()->locateLocal("config", "extsysmon.conf");
|
QString fileName = KGlobal::dirs()->locateLocal("config", "plasma-dataengine-extsysmon.conf");
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
QFile configFile(fileName);
|
QFile configFile(fileName);
|
||||||
if (!configFile.open(QIODevice::WriteOnly)) return;
|
if (!configFile.open(QIODevice::WriteOnly)) return;
|
||||||
@ -148,7 +148,7 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
uiWidConfig.comboBox_tags->clear();
|
uiWidConfig.comboBox_tags->clear();
|
||||||
uiWidConfig.comboBox_tags->addItems(getKeys());
|
uiWidConfig.comboBox_tags->addItems(getKeys());
|
||||||
for (int i=0; i<graphicalItems.count(); i++)
|
for (int i=0; i<graphicalItems.count(); i++)
|
||||||
uiWidConfig.comboBox_tags->addItem(graphicalItems[i]->getName() + graphicalItems[i]->getBar());
|
uiWidConfig.comboBox_tags->addItem(graphicalItems[i]->name() + graphicalItems[i]->bar());
|
||||||
|
|
||||||
// advanced
|
// advanced
|
||||||
if (configuration[QString("background")].toInt() == 0)
|
if (configuration[QString("background")].toInt() == 0)
|
||||||
@ -302,10 +302,10 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
uiAdvancedConfig.lineEdit_acOffline->setText(configuration[QString("acOffline")]);
|
uiAdvancedConfig.lineEdit_acOffline->setText(configuration[QString("acOffline")]);
|
||||||
uiAdvancedConfig.listWidget_bars->clear();
|
uiAdvancedConfig.listWidget_bars->clear();
|
||||||
for (int i=0; i<graphicalItems.count(); i++) {
|
for (int i=0; i<graphicalItems.count(); i++) {
|
||||||
QListWidgetItem *item = new QListWidgetItem(graphicalItems[i]->getFileName());
|
QListWidgetItem *item = new QListWidgetItem(graphicalItems[i]->fileName());
|
||||||
QStringList tooltip;
|
QStringList tooltip;
|
||||||
tooltip.append(i18n("Tag: %1", graphicalItems[i]->getName() + graphicalItems[i]->getBar()));
|
tooltip.append(i18n("Tag: %1", graphicalItems[i]->name() + graphicalItems[i]->bar()));
|
||||||
tooltip.append(i18n("Comment: %1", graphicalItems[i]->getComment()));
|
tooltip.append(i18n("Comment: %1", graphicalItems[i]->comment()));
|
||||||
item->setToolTip(tooltip.join(QChar('\n')));
|
item->setToolTip(tooltip.join(QChar('\n')));
|
||||||
uiAdvancedConfig.listWidget_bars->addItem(item);
|
uiAdvancedConfig.listWidget_bars->addItem(item);
|
||||||
}
|
}
|
||||||
@ -377,11 +377,11 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
QList<ExtScript *> externalScripts = initScripts();
|
QList<ExtScript *> externalScripts = initScripts();
|
||||||
uiDEConfig.listWidget_custom->clear();
|
uiDEConfig.listWidget_custom->clear();
|
||||||
for (int i=0; i<externalScripts.count(); i++) {
|
for (int i=0; i<externalScripts.count(); i++) {
|
||||||
QListWidgetItem *item = new QListWidgetItem(externalScripts[i]->getFileName());
|
QListWidgetItem *item = new QListWidgetItem(externalScripts[i]->fileName());
|
||||||
QStringList tooltip;
|
QStringList tooltip;
|
||||||
tooltip.append(i18n("Name: %1", externalScripts[i]->getName()));
|
tooltip.append(i18n("Name: %1", externalScripts[i]->name()));
|
||||||
tooltip.append(i18n("Comment: %1", externalScripts[i]->getComment()));
|
tooltip.append(i18n("Comment: %1", externalScripts[i]->comment()));
|
||||||
tooltip.append(i18n("Exec: %1", externalScripts[i]->getExec()));
|
tooltip.append(i18n("Exec: %1", externalScripts[i]->exec()));
|
||||||
item->setToolTip(tooltip.join(QChar('\n')));
|
item->setToolTip(tooltip.join(QChar('\n')));
|
||||||
uiDEConfig.listWidget_custom->addItem(item);
|
uiDEConfig.listWidget_custom->addItem(item);
|
||||||
}
|
}
|
||||||
@ -722,7 +722,7 @@ void AwesomeWidget::addBar()
|
|||||||
while (true) {
|
while (true) {
|
||||||
bool exit = true;
|
bool exit = true;
|
||||||
for (int i=0; i<graphicalItems.count(); i++)
|
for (int i=0; i<graphicalItems.count(); i++)
|
||||||
if (graphicalItems[i]->getName() == QString("bar%1").arg(number)) {
|
if (graphicalItems[i]->name() == QString("bar%1").arg(number)) {
|
||||||
number++;
|
number++;
|
||||||
exit = false;
|
exit = false;
|
||||||
break;
|
break;
|
||||||
@ -800,7 +800,7 @@ void AwesomeWidget::contextMenuBars(const QPoint pos)
|
|||||||
copyBar(uiAdvancedConfig.listWidget_bars->currentItem()->text());
|
copyBar(uiAdvancedConfig.listWidget_bars->currentItem()->text());
|
||||||
else if (action == remove)
|
else if (action == remove)
|
||||||
for (int i=0; i<graphicalItems.count(); i++) {
|
for (int i=0; i<graphicalItems.count(); i++) {
|
||||||
if (graphicalItems[i]->getFileName() != uiAdvancedConfig.listWidget_bars->currentItem()->text())
|
if (graphicalItems[i]->fileName() != uiAdvancedConfig.listWidget_bars->currentItem()->text())
|
||||||
continue;
|
continue;
|
||||||
graphicalItems[i]->tryDelete();
|
graphicalItems[i]->tryDelete();
|
||||||
graphicalItems.takeAt(i);
|
graphicalItems.takeAt(i);
|
||||||
@ -856,7 +856,7 @@ void AwesomeWidget::copyBar(const QString original)
|
|||||||
while (true) {
|
while (true) {
|
||||||
bool exit = true;
|
bool exit = true;
|
||||||
for (int i=0; i<graphicalItems.count(); i++)
|
for (int i=0; i<graphicalItems.count(); i++)
|
||||||
if (graphicalItems[i]->getName() == QString("bar%1").arg(number)) {
|
if (graphicalItems[i]->name() == QString("bar%1").arg(number)) {
|
||||||
number++;
|
number++;
|
||||||
exit = false;
|
exit = false;
|
||||||
break;
|
break;
|
||||||
@ -880,20 +880,20 @@ void AwesomeWidget::copyBar(const QString original)
|
|||||||
|
|
||||||
GraphicalItem *originalItem = nullptr;
|
GraphicalItem *originalItem = nullptr;
|
||||||
for (int i=0; i<graphicalItems.count(); i++) {
|
for (int i=0; i<graphicalItems.count(); i++) {
|
||||||
if (graphicalItems[i]->getFileName() != original) continue;
|
if (graphicalItems[i]->fileName() != original) continue;
|
||||||
originalItem = graphicalItems[i];
|
originalItem = graphicalItems[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GraphicalItem *item = new GraphicalItem(0, name, dirs, debug);
|
GraphicalItem *item = new GraphicalItem(0, name, dirs, debug);
|
||||||
item->setName(QString("bar%1").arg(number));
|
item->setName(QString("bar%1").arg(number));
|
||||||
item->setComment(originalItem->getComment());
|
item->setComment(originalItem->comment());
|
||||||
item->setBar(originalItem->getBar());
|
item->setBar(originalItem->bar());
|
||||||
item->setActiveColor(originalItem->getActiveColor());
|
item->setActiveColor(originalItem->activeColor());
|
||||||
item->setInactiveColor(originalItem->getInactiveColor());
|
item->setInactiveColor(originalItem->inactiveColor());
|
||||||
item->setType(originalItem->getStrType());
|
item->setType(originalItem->type());
|
||||||
item->setDirection(originalItem->getStrDirection());
|
item->setDirection(originalItem->direction());
|
||||||
item->setHeight(originalItem->getHeight());
|
item->setHeight(originalItem->height());
|
||||||
item->setWidth(originalItem->getWidth());
|
item->setWidth(originalItem->width());
|
||||||
delete originalItem;
|
delete originalItem;
|
||||||
|
|
||||||
item->showConfiguration(bars);
|
item->showConfiguration(bars);
|
||||||
@ -916,13 +916,13 @@ void AwesomeWidget::copyCustomCommand(const QString original)
|
|||||||
ExtScript *originalScript = new ExtScript(0, original, dirs, debug);
|
ExtScript *originalScript = new ExtScript(0, original, dirs, debug);
|
||||||
ExtScript *script = new ExtScript(0, name, dirs, debug);
|
ExtScript *script = new ExtScript(0, name, dirs, debug);
|
||||||
script->setActive(originalScript->isActive());
|
script->setActive(originalScript->isActive());
|
||||||
script->setComment(originalScript->getComment());
|
script->setComment(originalScript->comment());
|
||||||
script->setExec(originalScript->getExec());
|
script->setExecutable(originalScript->executable());
|
||||||
script->setHasOutput(originalScript->hasOutput());
|
script->setHasOutput(originalScript->hasOutput());
|
||||||
script->setInterval(originalScript->getInterval());
|
script->setInterval(originalScript->interval());
|
||||||
script->setName(originalScript->getName());
|
script->setName(originalScript->name());
|
||||||
script->setPrefix(originalScript->getPrefix());
|
script->setPrefix(originalScript->prefix());
|
||||||
script->setRedirect(originalScript->getStrRedirect());
|
script->setRedirect(originalScript->redirect());
|
||||||
delete originalScript;
|
delete originalScript;
|
||||||
|
|
||||||
script->showConfiguration();
|
script->showConfiguration();
|
||||||
@ -943,7 +943,7 @@ void AwesomeWidget::editBar(QListWidgetItem *item)
|
|||||||
bars.append(keys.filter((QRegExp(QString("^bat.*")))));
|
bars.append(keys.filter((QRegExp(QString("^bat.*")))));
|
||||||
|
|
||||||
for (int i=0; i<graphicalItems.count(); i++) {
|
for (int i=0; i<graphicalItems.count(); i++) {
|
||||||
if (graphicalItems[i]->getFileName() != item->text()) continue;
|
if (graphicalItems[i]->fileName() != item->text()) continue;
|
||||||
graphicalItems[i]->showConfiguration(bars);
|
graphicalItems[i]->showConfiguration(bars);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
|
|||||||
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0);
|
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0);
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*bat"))) > -1) {
|
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*bat"))) > -1) {
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
for (int j=0; j<foundBars.count(); j++) {
|
||||||
if (getItemByTag(foundBars[j])->getBar() != data.keys()[i]) continue;
|
if (getItemByTag(foundBars[j])->bar() != data.keys()[i]) continue;
|
||||||
values[foundBars[j]] = values[data.keys()[i]];
|
values[foundBars[j]] = values[data.keys()[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
|
|||||||
values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*cpu(?!cl).*"))) > -1) {
|
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*cpu(?!cl).*"))) > -1) {
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
for (int j=0; j<foundBars.count(); j++) {
|
||||||
if (getItemByTag(foundBars[j])->getBar() != QString("cpu")) continue;
|
if (getItemByTag(foundBars[j])->bar() != QString("cpu")) continue;
|
||||||
values[foundBars[j]] = QString("%1").arg(data[QString("value")].toFloat());
|
values[foundBars[j]] = QString("%1").arg(data[QString("value")].toFloat());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
|
|||||||
values[QString("cpu") + number] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
values[QString("cpu") + number] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*cpu(?!cl).*"))) > -1) {
|
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*cpu(?!cl).*"))) > -1) {
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
for (int j=0; j<foundBars.count(); j++) {
|
||||||
if (getItemByTag(foundBars[j])->getBar() != (QString("cpu") + number)) continue;
|
if (getItemByTag(foundBars[j])->bar() != (QString("cpu") + number)) continue;
|
||||||
values[foundBars[j]] = values[QString("cpu") + number];
|
values[foundBars[j]] = values[QString("cpu") + number];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
|
|||||||
values[QString("gpu")] = QString("%1").arg(data[QString("GPU")].toFloat(), 5, 'f', 1);
|
values[QString("gpu")] = QString("%1").arg(data[QString("GPU")].toFloat(), 5, 'f', 1);
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*gpu"))) > -1) {
|
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*gpu"))) > -1) {
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
for (int j=0; j<foundBars.count(); j++) {
|
||||||
if (getItemByTag(foundBars[j])->getBar() != QString("gpu")) continue;
|
if (getItemByTag(foundBars[j])->bar() != QString("gpu")) continue;
|
||||||
values[foundBars[j]] = values[QString("gpu")];
|
values[foundBars[j]] = values[QString("gpu")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
|
|||||||
values[QString("hdd") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
values[QString("hdd") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*hdd([0-9].*"))) > -1) {
|
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*hdd([0-9].*"))) > -1) {
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
for (int j=0; j<foundBars.count(); j++) {
|
||||||
if (getItemByTag(foundBars[j])->getBar() != (QString("hdd") + QString::number(i))) continue;
|
if (getItemByTag(foundBars[j])->bar() != (QString("hdd") + QString::number(i))) continue;
|
||||||
values[foundBars[j]] = values[QString("hdd") + QString::number(i)];
|
values[foundBars[j]] = values[QString("hdd") + QString::number(i)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
|
|||||||
}
|
}
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*mem"))) > -1) {
|
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*mem"))) > -1) {
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
for (int j=0; j<foundBars.count(); j++) {
|
||||||
if (getItemByTag(foundBars[j])->getBar() != QString("mem")) continue;
|
if (getItemByTag(foundBars[j])->bar() != QString("mem")) continue;
|
||||||
values[foundBars[j]] = values[QString("mem")];
|
values[foundBars[j]] = values[QString("mem")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -438,7 +438,7 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng
|
|||||||
}
|
}
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*swap"))) > -1) {
|
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*swap"))) > -1) {
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
for (int j=0; j<foundBars.count(); j++) {
|
||||||
if (getItemByTag(foundBars[j])->getBar() != QString("swap")) continue;
|
if (getItemByTag(foundBars[j])->bar() != QString("swap")) continue;
|
||||||
values[foundBars[j]] = values[QString("swap")];
|
values[foundBars[j]] = values[QString("swap")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,13 @@
|
|||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd)
|
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
fileName(desktopName),
|
m_fileName(desktopName),
|
||||||
dirs(directories),
|
m_dirs(directories),
|
||||||
debug(debugCmd),
|
debug(debugCmd),
|
||||||
ui(new Ui::GraphicalItem)
|
ui(new Ui::GraphicalItem)
|
||||||
{
|
{
|
||||||
@ -53,14 +55,14 @@ GraphicalItem::~GraphicalItem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getImage(const float value)
|
QString GraphicalItem::image(const float value)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
|
if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
|
||||||
if (_bar == QString("none")) return QString("");
|
if (m_bar == QString("none")) return QString("");
|
||||||
|
|
||||||
QColor active = stringToColor(_activeColor);
|
QColor active = stringToColor(m_activeColor);
|
||||||
QColor inactive = stringToColor(_inactiveColor);
|
QColor inactive = stringToColor(m_inactiveColor);
|
||||||
float percent = value / 100.0;
|
float percent = value / 100.0;
|
||||||
int scale[2] = {1, 1};
|
int scale[2] = {1, 1};
|
||||||
QPen pen = QPen();
|
QPen pen = QPen();
|
||||||
@ -72,47 +74,51 @@ QString GraphicalItem::getImage(const float value)
|
|||||||
view->setFrameShape(QFrame::NoFrame);
|
view->setFrameShape(QFrame::NoFrame);
|
||||||
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
view->resize(_width + 5.0, _height + 5.0);
|
view->resize(m_width + 5.0, m_height + 5.0);
|
||||||
|
|
||||||
// paint
|
// paint
|
||||||
switch(_type) {
|
switch(m_type) {
|
||||||
case Vertical:
|
case Vertical:
|
||||||
pen.setWidth(_width);
|
pen.setWidth(m_width);
|
||||||
// inactive
|
// inactive
|
||||||
pen.setColor(inactive);
|
pen.setColor(inactive);
|
||||||
scene->addLine(0.5 * _width, -0.5 * _width, 0.5 * _width, (1.0 - percent) * _height - 0.5 * _width, pen);
|
scene->addLine(0.5 * m_width, -0.5 * m_width, 0.5 * m_width,
|
||||||
|
(1.0 - percent) * m_height - 0.5 * m_width, pen);
|
||||||
// active
|
// active
|
||||||
pen.setColor(active);
|
pen.setColor(active);
|
||||||
scene->addLine(0.5 * _width, (1.0 - percent) * _height + 0.5 * _width, 0.5 * _width, _height + 0.5 * _width, pen);
|
scene->addLine(0.5 * m_width, (1.0 - percent) * m_height + 0.5 * m_width,
|
||||||
|
0.5 * m_width, m_height + 0.5 * m_width, pen);
|
||||||
// scale
|
// scale
|
||||||
scale[1] = -2 * (int)_direction + 1;
|
scale[1] = -2 * static_cast<int>(m_direction) + 1;
|
||||||
break;
|
break;
|
||||||
case Circle:
|
case Circle:
|
||||||
QGraphicsEllipseItem *circle;
|
QGraphicsEllipseItem *circle;
|
||||||
pen.setWidth(1.0);
|
pen.setWidth(1.0);
|
||||||
// inactive
|
// inactive
|
||||||
pen.setColor(inactive);
|
pen.setColor(inactive);
|
||||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(inactive, Qt::SolidPattern));
|
circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(inactive, Qt::SolidPattern));
|
||||||
circle->setSpanAngle(- (1.0 - percent) * 360.0 * 16.0);
|
circle->setSpanAngle(- (1.0 - percent) * 360.0 * 16.0);
|
||||||
circle->setStartAngle(90.0 * 16.0 - percent * 360.0 * 16.0);
|
circle->setStartAngle(90.0 * 16.0 - percent * 360.0 * 16.0);
|
||||||
// active
|
// active
|
||||||
pen.setColor(active);
|
pen.setColor(active);
|
||||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(active, Qt::SolidPattern));
|
circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(active, Qt::SolidPattern));
|
||||||
circle->setSpanAngle(- percent * 360.0 * 16.0);
|
circle->setSpanAngle(- percent * 360.0 * 16.0);
|
||||||
circle->setStartAngle(90.0 * 16.0);
|
circle->setStartAngle(90.0 * 16.0);
|
||||||
// scale
|
// scale
|
||||||
scale[0] = -2 *(int)_direction + 1;
|
scale[0] = -2 * static_cast<int>(m_direction) + 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pen.setWidth(_height);
|
pen.setWidth(m_height);
|
||||||
// inactive
|
// inactive
|
||||||
pen.setColor(inactive);
|
pen.setColor(inactive);
|
||||||
scene->addLine(percent * _width + 0.5 * _height, 0.5 * _height, _width + 0.5 * _height, 0.5 * _height, pen);
|
scene->addLine(percent * m_width + 0.5 * m_height, 0.5 * m_height,
|
||||||
|
m_width + 0.5 * m_height, 0.5 * m_height, pen);
|
||||||
// active
|
// active
|
||||||
pen.setColor(active);
|
pen.setColor(active);
|
||||||
scene->addLine(-0.5 * _height, 0.5 * _height, percent * _width - 0.5 * _height, 0.5 * _height, pen);
|
scene->addLine(-0.5 * m_height, 0.5 * m_height,
|
||||||
|
percent * m_width - 0.5 * m_height, 0.5 * m_height, pen);
|
||||||
// scale
|
// scale
|
||||||
scale[0] = -2 * (int)_direction + 1;
|
scale[0] = -2 * static_cast<int>(m_direction) + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,68 +135,76 @@ QString GraphicalItem::getImage(const float value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getFileName()
|
QString GraphicalItem::fileName()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return fileName;
|
return m_fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getName()
|
int GraphicalItem::apiVersion()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _name;
|
return m_apiVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getComment()
|
QString GraphicalItem::name()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _comment;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getBar()
|
QString GraphicalItem::comment()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _bar;
|
return m_comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getActiveColor()
|
QString GraphicalItem::bar()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _activeColor;
|
return m_bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getInactiveColor()
|
QString GraphicalItem::activeColor()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _inactiveColor;
|
return m_activeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GraphicalItem::Type GraphicalItem::getType()
|
QString GraphicalItem::inactiveColor()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _type;
|
return m_inactiveColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getStrType()
|
GraphicalItem::Type GraphicalItem::type()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::strType()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QString value;
|
QString value;
|
||||||
switch(_type) {
|
switch(m_type) {
|
||||||
case Vertical:
|
case Vertical:
|
||||||
value = QString("Vertical");
|
value = QString("Vertical");
|
||||||
break;
|
break;
|
||||||
@ -206,20 +220,20 @@ QString GraphicalItem::getStrType()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GraphicalItem::Direction GraphicalItem::getDirection()
|
GraphicalItem::Direction GraphicalItem::direction()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _direction;
|
return m_direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getStrDirection()
|
QString GraphicalItem::strDirection()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QString value;
|
QString value;
|
||||||
switch (_direction) {
|
switch (m_direction) {
|
||||||
case RightToLeft:
|
case RightToLeft:
|
||||||
value = QString("RightToLeft");
|
value = QString("RightToLeft");
|
||||||
break;
|
break;
|
||||||
@ -232,117 +246,145 @@ QString GraphicalItem::getStrDirection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GraphicalItem::getHeight()
|
int GraphicalItem::height()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _height;
|
return m_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GraphicalItem::getWidth()
|
int GraphicalItem::width()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
return _width;
|
return m_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setName(const QString name)
|
void GraphicalItem::setApiVersion(const int _apiVersion)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << name;
|
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||||
|
|
||||||
_name = name;
|
m_apiVersion = _apiVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setComment(const QString comment)
|
void GraphicalItem::setName(const QString _name)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << comment;
|
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||||
|
|
||||||
_comment = comment;
|
m_name = _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setBar(const QString bar)
|
void GraphicalItem::setComment(const QString _comment)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Bar" << bar;
|
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||||
|
|
||||||
|
m_comment = _comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setBar(const QString _bar)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Bar" << _bar;
|
||||||
|
|
||||||
_bar = bar;
|
|
||||||
if ((!_bar.contains(QRegExp(QString("cpu(?!cl).*")))) &&
|
if ((!_bar.contains(QRegExp(QString("cpu(?!cl).*")))) &&
|
||||||
(!_bar.contains(QRegExp(QString("gpu")))) &&
|
(!_bar.contains(QRegExp(QString("gpu")))) &&
|
||||||
(!_bar.contains(QRegExp(QString("mem")))) &&
|
(!_bar.contains(QRegExp(QString("mem")))) &&
|
||||||
(!_bar.contains(QRegExp(QString("swap")))) &&
|
(!_bar.contains(QRegExp(QString("swap")))) &&
|
||||||
(!_bar.contains(QRegExp(QString("hdd[0-9].*")))) &&
|
(!_bar.contains(QRegExp(QString("hdd[0-9].*")))) &&
|
||||||
(!_bar.contains(QRegExp(QString("bat.*")))))
|
(!_bar.contains(QRegExp(QString("bat.*")))))
|
||||||
_bar = QString("none");
|
m_bar = QString("none");
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setActiveColor(const QString color)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << color;
|
|
||||||
|
|
||||||
_activeColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setInactiveColor(const QString color)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << color;
|
|
||||||
|
|
||||||
_inactiveColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setType(const QString type)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
|
|
||||||
|
|
||||||
if (type == QString("Vertical"))
|
|
||||||
_type = Vertical;
|
|
||||||
else if (type == QString("Circle"))
|
|
||||||
_type = Circle;
|
|
||||||
else
|
else
|
||||||
_type = Horizontal;
|
m_bar = _bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setDirection(const QString direction)
|
void GraphicalItem::setActiveColor(const QString _color)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Direction" << direction;
|
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||||
|
|
||||||
if (direction == QString("RightToLeft"))
|
m_activeColor = _color;
|
||||||
_direction = RightToLeft;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setInactiveColor(const QString _color)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||||
|
|
||||||
|
m_inactiveColor = _color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setType(const Type _type)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
|
||||||
|
|
||||||
|
m_type = _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setStrType(const QString _type)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
|
||||||
|
|
||||||
|
if (_type == QString("Vertical"))
|
||||||
|
setType(Vertical);
|
||||||
|
else if (_type == QString("Circle"))
|
||||||
|
setType(Circle);
|
||||||
else
|
else
|
||||||
_direction = LeftToRight;
|
setType(Horizontal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setHeight(const int height)
|
void GraphicalItem::setDirection(const Direction _direction)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Height" << height;
|
if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
|
||||||
if (height <= 0) return;
|
|
||||||
|
|
||||||
_height = height;
|
m_direction = _direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setWidth(const int width)
|
void GraphicalItem::setStrDirection(const QString _direction)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Width" << width;
|
if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
|
||||||
if (width <= 0) return;
|
|
||||||
|
|
||||||
_width = width;
|
if (_direction == QString("RightToLeft"))
|
||||||
|
setDirection(RightToLeft);
|
||||||
|
else
|
||||||
|
setDirection(LeftToRight);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setHeight(const int _height)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Height" << _height;
|
||||||
|
if (_height <= 0) return;
|
||||||
|
|
||||||
|
m_height = _height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setWidth(const int _width)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Width" << _width;
|
||||||
|
if (_width <= 0) return;
|
||||||
|
|
||||||
|
m_width = _width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -350,19 +392,21 @@ void GraphicalItem::readConfiguration()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
for (int i=dirs.count()-1; i>=0; i--) {
|
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||||
if (!QDir(dirs[i]).entryList(QDir::Files).contains(fileName)) continue;
|
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||||
QSettings settings(dirs[i] + QDir::separator() + fileName, QSettings::IniFormat);
|
QSettings settings(m_dirs[i] + QDir::separator() + m_fileName, QSettings::IniFormat);
|
||||||
|
|
||||||
settings.beginGroup(QString("Desktop Entry"));
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
setName(settings.value(QString("Name"), _name).toString());
|
setName(settings.value(QString("Name"), m_name).toString());
|
||||||
setComment(settings.value(QString("Comment"), _comment).toString());
|
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||||
setBar(settings.value(QString("X-AW-Value"), _bar).toString());
|
setApiVersion(settings.value(QString("X-AW-ApiVersion"), AWGIAPI).toInt());
|
||||||
setActiveColor(settings.value(QString("X-AW-ActiveColor"), _activeColor).toString());
|
setBar(settings.value(QString("X-AW-Value"), m_bar).toString());
|
||||||
setInactiveColor(settings.value(QString("X-AW-InactiveColor"), _inactiveColor).toString());
|
setActiveColor(settings.value(QString("X-AW-ActiveColor"), m_activeColor).toString());
|
||||||
setType(settings.value(QString("X-AW-Type"), getStrType()).toString());
|
setInactiveColor(settings.value(QString("X-AW-InactiveColor"), m_inactiveColor).toString());
|
||||||
setDirection(settings.value(QString("X-AW-Direction"), getStrDirection()).toString());
|
setStrType(settings.value(QString("X-AW-Type"), strType()).toString());
|
||||||
setHeight(settings.value(QString("X-AW-Height"), QString::number(_height)).toInt());
|
setStrDirection(settings.value(QString("X-AW-Direction"), strDirection()).toString());
|
||||||
setWidth(settings.value(QString("X-AW-Width"), QString::number(_width)).toInt());
|
setHeight(settings.value(QString("X-AW-Height"), m_height).toInt());
|
||||||
|
setWidth(settings.value(QString("X-AW-Width"), m_width).toInt());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,27 +416,29 @@ void GraphicalItem::showConfiguration(const QStringList tags)
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
ui->label_nameValue->setText(_name);
|
ui->label_nameValue->setText(m_name);
|
||||||
ui->lineEdit_comment->setText(_comment);
|
ui->lineEdit_comment->setText(m_comment);
|
||||||
ui->comboBox_value->addItems(tags);
|
ui->comboBox_value->addItems(tags);
|
||||||
ui->comboBox_value->addItem(_bar);
|
ui->comboBox_value->addItem(m_bar);
|
||||||
ui->comboBox_value->setCurrentIndex(ui->comboBox_value->count() - 1);
|
ui->comboBox_value->setCurrentIndex(ui->comboBox_value->count() - 1);
|
||||||
ui->pushButton_activeColor->setText(_activeColor);
|
ui->pushButton_activeColor->setText(m_activeColor);
|
||||||
ui->pushButton_inactiveColor->setText(_inactiveColor);
|
ui->pushButton_inactiveColor->setText(m_inactiveColor);
|
||||||
ui->comboBox_type->setCurrentIndex((int)_type);
|
ui->comboBox_type->setCurrentIndex(static_cast<int>(m_type));
|
||||||
ui->comboBox_direction->setCurrentIndex((int)_direction);
|
ui->comboBox_direction->setCurrentIndex(static_cast<int>(m_direction));
|
||||||
ui->spinBox_height->setValue(_height);
|
ui->spinBox_height->setValue(m_height);
|
||||||
ui->spinBox_width->setValue(_width);
|
ui->spinBox_width->setValue(m_width);
|
||||||
|
|
||||||
int ret = exec();
|
int ret = exec();
|
||||||
if (ret != 1) return;
|
if (ret != 1) return;
|
||||||
|
|
||||||
setName(ui->label_nameValue->text());
|
setName(ui->label_nameValue->text());
|
||||||
setComment(ui->lineEdit_comment->text());
|
setComment(ui->lineEdit_comment->text());
|
||||||
|
setApiVersion(AWGIAPI);
|
||||||
setBar(ui->comboBox_value->currentText());
|
setBar(ui->comboBox_value->currentText());
|
||||||
setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&')));
|
setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&')));
|
||||||
setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&')));
|
setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&')));
|
||||||
setType(ui->comboBox_type->currentText());
|
setStrType(ui->comboBox_type->currentText());
|
||||||
setDirection(ui->comboBox_direction->currentText());
|
setStrDirection(ui->comboBox_direction->currentText());
|
||||||
setHeight(ui->spinBox_height->value());
|
setHeight(ui->spinBox_height->value());
|
||||||
setWidth(ui->spinBox_width->value());
|
setWidth(ui->spinBox_width->value());
|
||||||
|
|
||||||
@ -404,9 +450,9 @@ void GraphicalItem::tryDelete()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
for (int i=0; i<dirs.count(); i++)
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << dirs[i] + QDir::separator() + fileName <<
|
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << m_dirs[i] + QDir::separator() + m_fileName <<
|
||||||
QFile::remove(dirs[i] + QDir::separator() + fileName);
|
QFile::remove(m_dirs[i] + QDir::separator() + m_fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -414,22 +460,23 @@ void GraphicalItem::writeConfiguration()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QSettings settings(dirs[0] + QDir::separator() + fileName, QSettings::IniFormat);
|
QSettings settings(m_dirs[0] + QDir::separator() + m_fileName, QSettings::IniFormat);
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||||
|
|
||||||
settings.beginGroup(QString("Desktop Entry"));
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
|
||||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||||
settings.setValue(QString("Name"), _name);
|
settings.setValue(QString("Name"), m_name);
|
||||||
settings.setValue(QString("Comment"), _comment);
|
settings.setValue(QString("Comment"), m_comment);
|
||||||
settings.setValue(QString("X-AW-Value"), _bar);
|
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||||
settings.setValue(QString("X-AW-ActiveColor"), _activeColor);
|
settings.setValue(QString("X-AW-Value"), m_bar);
|
||||||
settings.setValue(QString("X-AW-InactiveColor"), _inactiveColor);
|
settings.setValue(QString("X-AW-ActiveColor"), m_activeColor);
|
||||||
settings.setValue(QString("X-AW-Type"), getStrType());
|
settings.setValue(QString("X-AW-InactiveColor"), m_inactiveColor);
|
||||||
settings.setValue(QString("X-AW-Direction"), getStrDirection());
|
settings.setValue(QString("X-AW-Type"), strType());
|
||||||
settings.setValue(QString("X-AW-Height"), _height);
|
settings.setValue(QString("X-AW-Direction"), strDirection());
|
||||||
settings.setValue(QString("X-AW-Width"), _width);
|
settings.setValue(QString("X-AW-Height"), m_height);
|
||||||
|
settings.setValue(QString("X-AW-Width"), m_width);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.sync();
|
settings.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,17 +495,17 @@ void GraphicalItem::changeColor()
|
|||||||
colorText.append(QString("%1").arg(newColor.green()));
|
colorText.append(QString("%1").arg(newColor.green()));
|
||||||
colorText.append(QString("%1").arg(newColor.blue()));
|
colorText.append(QString("%1").arg(newColor.blue()));
|
||||||
colorText.append(QString("%1").arg(newColor.alpha()));
|
colorText.append(QString("%1").arg(newColor.alpha()));
|
||||||
((QPushButton *)sender())->setText(colorText.join(QChar(',')));
|
dynamic_cast<QPushButton *>(sender())->setText(colorText.join(QChar(',')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QColor GraphicalItem::stringToColor(const QString color)
|
QColor GraphicalItem::stringToColor(const QString _color)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << color;
|
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||||
|
|
||||||
QColor qcolor;
|
QColor qcolor;
|
||||||
QStringList listColor = color.split(QChar(','));
|
QStringList listColor = _color.split(QChar(','));
|
||||||
while (listColor.count() < 4)
|
while (listColor.count() < 4)
|
||||||
listColor.append(QString("0"));
|
listColor.append(QString("0"));
|
||||||
qcolor.setRed(listColor[0].toInt());
|
qcolor.setRed(listColor[0].toInt());
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class GraphicalItem;
|
class GraphicalItem;
|
||||||
}
|
}
|
||||||
@ -28,6 +29,16 @@ class GraphicalItem;
|
|||||||
class GraphicalItem : public QDialog
|
class GraphicalItem : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
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)
|
||||||
|
Q_PROPERTY(Type type READ type WRITE setType)
|
||||||
|
Q_PROPERTY(Direction direction READ direction WRITE setDirection)
|
||||||
|
Q_PROPERTY(int height READ height WRITE setHeight)
|
||||||
|
Q_PROPERTY(int width READ width WRITE setWidth)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Direction {
|
enum Direction {
|
||||||
@ -43,30 +54,34 @@ public:
|
|||||||
explicit GraphicalItem(QWidget *parent = 0, const QString desktopName = QString(),
|
explicit GraphicalItem(QWidget *parent = 0, const QString desktopName = QString(),
|
||||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||||
~GraphicalItem();
|
~GraphicalItem();
|
||||||
QString getImage(const float value);
|
QString fileName();
|
||||||
|
QString image(const float value);
|
||||||
// get methods
|
// get methods
|
||||||
QString getFileName();
|
int apiVersion();
|
||||||
QString getName();
|
QString name();
|
||||||
QString getComment();
|
QString comment();
|
||||||
QString getBar();
|
QString bar();
|
||||||
QString getActiveColor();
|
QString activeColor();
|
||||||
QString getInactiveColor();
|
QString inactiveColor();
|
||||||
Type getType();
|
Type type();
|
||||||
QString getStrType();
|
QString strType();
|
||||||
Direction getDirection();
|
Direction direction();
|
||||||
QString getStrDirection();
|
QString strDirection();
|
||||||
int getHeight();
|
int height();
|
||||||
int getWidth();
|
int width();
|
||||||
// set methods
|
// set methods
|
||||||
void setName(const QString name = QString("none"));
|
void setApiVersion(const int _apiVersion = 0);
|
||||||
void setComment(const QString comment = QString("empty"));
|
void setName(const QString _name = QString("none"));
|
||||||
void setBar(const QString bar = QString("cpu"));
|
void setComment(const QString _comment = QString("empty"));
|
||||||
void setActiveColor(const QString color = QString("0,0,0,130"));
|
void setBar(const QString _bar = QString("cpu"));
|
||||||
void setInactiveColor(const QString color = QString("255,255,255,130"));
|
void setActiveColor(const QString _color = QString("0,0,0,130"));
|
||||||
void setType(const QString type = QString("Horizontal"));
|
void setInactiveColor(const QString _color = QString("255,255,255,130"));
|
||||||
void setDirection(const QString direction = QString("LeftToRight"));
|
void setType(const Type _type = Horizontal);
|
||||||
void setHeight(const int height = 100);
|
void setStrType(const QString _type = QString("Horizontal"));
|
||||||
void setWidth(const int width = 100);
|
void setDirection(const Direction _direction = LeftToRight);
|
||||||
|
void setStrDirection(const QString _direction = QString("LeftToRight"));
|
||||||
|
void setHeight(const int _height = 100);
|
||||||
|
void setWidth(const int _width = 100);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
@ -78,21 +93,23 @@ private slots:
|
|||||||
void changeColor();
|
void changeColor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor stringToColor(const QString color);
|
QColor stringToColor(const QString _color);
|
||||||
QString fileName;
|
QString m_fileName;
|
||||||
QStringList dirs;
|
QStringList m_dirs;
|
||||||
bool debug;
|
bool debug;
|
||||||
Ui::GraphicalItem *ui;
|
Ui::GraphicalItem *ui;
|
||||||
// properties
|
// properties
|
||||||
QString _name = QString("none");
|
int m_apiVersion = 0;
|
||||||
QString _comment = QString("empty");
|
QString m_name = QString("none");
|
||||||
QString _bar = QString("cpu");
|
QString m_comment = QString("empty");
|
||||||
QString _activeColor = QString("0,0,0,130");
|
QString m_bar = QString("cpu");
|
||||||
QString _inactiveColor = QString("255,255,255,130");
|
QString m_activeColor = QString("0,0,0,130");
|
||||||
Type _type = Horizontal;
|
QString m_inactiveColor = QString("255,255,255,130");
|
||||||
Direction _direction = LeftToRight;
|
Type m_type = Horizontal;
|
||||||
int _height = 100;
|
Direction m_direction = LeftToRight;
|
||||||
int _width = 100;
|
int m_height = 100;
|
||||||
|
int m_width = 100;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* GRAPHICALITEM_H */
|
#endif /* GRAPHICALITEM_H */
|
||||||
|
@ -85,7 +85,7 @@ void AwesomeWidget::updateText(const bool clear)
|
|||||||
for (int i=0; i<foundKeys.count(); i++)
|
for (int i=0; i<foundKeys.count(); i++)
|
||||||
text.replace(QString("$") + foundKeys[i], values[foundKeys[i]]);
|
text.replace(QString("$") + foundKeys[i], values[foundKeys[i]]);
|
||||||
for (int i=0; i<foundBars.count(); i++)
|
for (int i=0; i<foundBars.count(); i++)
|
||||||
text.replace(QString("$") + foundBars[i], getItemByTag(foundBars[i])->getImage(values[foundBars[i]].toFloat()));
|
text.replace(QString("$") + foundBars[i], getItemByTag(foundBars[i])->image(values[foundBars[i]].toFloat()));
|
||||||
text.replace(QString("$\\$\\"), QString("$$"));
|
text.replace(QString("$\\$\\"), QString("$$"));
|
||||||
}
|
}
|
||||||
textLabel->setText(formatLine[0] + text + formatLine[1]);
|
textLabel->setText(formatLine[0] + text + formatLine[1]);
|
||||||
|
@ -6,8 +6,6 @@ message (STATUS "Subproject ${SUBPROJECT}")
|
|||||||
find_package (KDE4 REQUIRED)
|
find_package (KDE4 REQUIRED)
|
||||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||||
|
|
||||||
add_subdirectory (po)
|
|
||||||
|
|
||||||
include (KDE4Defaults)
|
include (KDE4Defaults)
|
||||||
include_directories (${CMAKE_SOURCE_DIR}
|
include_directories (${CMAKE_SOURCE_DIR}
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
|
@ -52,7 +52,7 @@ if (BUILD_KDE4)
|
|||||||
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||||
kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI})
|
kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI})
|
||||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
|
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
|
||||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
|
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTNETWORK_LIBRARY})
|
||||||
else ()
|
else ()
|
||||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||||
|
Loading…
Reference in New Issue
Block a user