mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
implement script function
This commit is contained in:
parent
a4af7ffc07
commit
7e095c4349
@ -78,7 +78,9 @@ private slots:
|
|||||||
void reinit();
|
void reinit();
|
||||||
void replyRecieved(QNetworkReply *reply);
|
void replyRecieved(QNetworkReply *reply);
|
||||||
// configuration interface
|
// configuration interface
|
||||||
|
void addCustomScript();
|
||||||
void addNewPkgCommand(QTableWidgetItem *item);
|
void addNewPkgCommand(QTableWidgetItem *item);
|
||||||
|
void contextMenuCustomCommand(const QPoint pos);
|
||||||
void contextMenuPkgCommand(const QPoint pos);
|
void contextMenuPkgCommand(const QPoint pos);
|
||||||
void editCustomCommand(const int row, const int column);
|
void editCustomCommand(const int row, const int column);
|
||||||
void editFanItem(QListWidgetItem *item);
|
void editFanItem(QListWidgetItem *item);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QInputDialog>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
@ -390,7 +391,12 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
output->setCheckState(Qt::Unchecked);
|
output->setCheckState(Qt::Unchecked);
|
||||||
uiDEConfig.tableWidget_customCommand->setItem(i, 2, output);
|
uiDEConfig.tableWidget_customCommand->setItem(i, 2, output);
|
||||||
uiDEConfig.tableWidget_customCommand->setItem(i, 3, new QTableWidgetItem(externalScripts[i]->getPrefix()));
|
uiDEConfig.tableWidget_customCommand->setItem(i, 3, new QTableWidgetItem(externalScripts[i]->getPrefix()));
|
||||||
uiDEConfig.tableWidget_customCommand->setItem(i, 4, new QTableWidgetItem(QString::number(externalScripts[i]->getRedirect())));
|
QComboBox *redirect = new QComboBox();
|
||||||
|
redirect->addItem(QString("out2err"));
|
||||||
|
redirect->addItem(QString("nothing"));
|
||||||
|
redirect->addItem(QString("err2out"));
|
||||||
|
redirect->setCurrentIndex(externalScripts[i]->getRedirect() + 1);
|
||||||
|
uiDEConfig.tableWidget_customCommand->setCellWidget(i, 4, redirect);
|
||||||
}
|
}
|
||||||
externalScripts.clear();
|
externalScripts.clear();
|
||||||
uiDEConfig.lineEdit_desktopCmd->setText(deSettings[QString("DESKTOPCMD")]);
|
uiDEConfig.lineEdit_desktopCmd->setText(deSettings[QString("DESKTOPCMD")]);
|
||||||
@ -472,6 +478,8 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
this, SLOT(editTempItem(QListWidgetItem *)));
|
this, SLOT(editTempItem(QListWidgetItem *)));
|
||||||
connect(uiDEConfig.tableWidget_customCommand, SIGNAL(cellDoubleClicked(int, int)),
|
connect(uiDEConfig.tableWidget_customCommand, SIGNAL(cellDoubleClicked(int, int)),
|
||||||
this, SLOT(editCustomCommand(int, int)));
|
this, SLOT(editCustomCommand(int, int)));
|
||||||
|
connect(uiDEConfig.tableWidget_customCommand, SIGNAL(customContextMenuRequested(QPoint)),
|
||||||
|
this, SLOT(contextMenuCustomCommand(QPoint)));
|
||||||
connect(uiDEConfig.tableWidget_pkgCommand, SIGNAL(itemChanged(QTableWidgetItem *)),
|
connect(uiDEConfig.tableWidget_pkgCommand, SIGNAL(itemChanged(QTableWidgetItem *)),
|
||||||
this, SLOT(addNewPkgCommand(QTableWidgetItem *)));
|
this, SLOT(addNewPkgCommand(QTableWidgetItem *)));
|
||||||
connect(uiDEConfig.tableWidget_pkgCommand, SIGNAL(customContextMenuRequested(QPoint)),
|
connect(uiDEConfig.tableWidget_pkgCommand, SIGNAL(customContextMenuRequested(QPoint)),
|
||||||
@ -584,7 +592,8 @@ void AwesomeWidget::configAccepted()
|
|||||||
else
|
else
|
||||||
script->setHasOutput(false);
|
script->setHasOutput(false);
|
||||||
script->setPrefix(uiDEConfig.tableWidget_customCommand->item(i, 3)->text());
|
script->setPrefix(uiDEConfig.tableWidget_customCommand->item(i, 3)->text());
|
||||||
script->setRedirect((ExtScript::Redirect)uiDEConfig.tableWidget_customCommand->item(i, 4)->text().toInt());
|
int redirect = ((QComboBox *)uiDEConfig.tableWidget_customCommand->cellWidget(i, 4))->currentIndex() - 1;
|
||||||
|
script->setRedirect((ExtScript::Redirect)redirect);
|
||||||
script->writeConfiguration();
|
script->writeConfiguration();
|
||||||
delete script;
|
delete script;
|
||||||
}
|
}
|
||||||
@ -732,6 +741,57 @@ void AwesomeWidget::configChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AwesomeWidget::addCustomScript()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString name = QInputDialog::getText(0, i18n("Enter script name"),
|
||||||
|
i18n("Name"));
|
||||||
|
if (name.isEmpty()) return;
|
||||||
|
QString localDir = KGlobal::dirs()->locateLocal("data", "plasma_engine_extsysmon/scripts");
|
||||||
|
|
||||||
|
QString fileName = QDir(localDir).absoluteFilePath(name);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Script" << fileName;
|
||||||
|
QFile configFile(fileName);
|
||||||
|
if (!configFile.open(QIODevice::WriteOnly)) return;
|
||||||
|
configFile.write("#!/bin/bash\n");
|
||||||
|
configFile.close();
|
||||||
|
configFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner |
|
||||||
|
QFile::ReadGroup | QFile::ExeGroup |
|
||||||
|
QFile::ReadOther | QFile::ExeOther);
|
||||||
|
QDesktopServices::openUrl(QUrl(fileName));
|
||||||
|
|
||||||
|
fileName = QDir(localDir).absoluteFilePath(name + QString(".conf"));
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration" << fileName;
|
||||||
|
configFile.setFileName(fileName);
|
||||||
|
if (!configFile.open(QIODevice::WriteOnly)) return;
|
||||||
|
configFile.write("ACTIVE=false\n");
|
||||||
|
configFile.write("INTERVAL=1\n");
|
||||||
|
configFile.write("OUTPUT=true\n");
|
||||||
|
configFile.write("PREFIX=\n");
|
||||||
|
configFile.write("REDIRECT=0\n");
|
||||||
|
configFile.close();
|
||||||
|
|
||||||
|
int i = uiDEConfig.tableWidget_customCommand->rowCount();
|
||||||
|
uiDEConfig.tableWidget_customCommand->insertRow(i);
|
||||||
|
QTableWidgetItem *nameItem = new QTableWidgetItem(name);
|
||||||
|
nameItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
|
||||||
|
nameItem->setCheckState(Qt::Unchecked);
|
||||||
|
uiDEConfig.tableWidget_customCommand->setItem(i, 0, nameItem);
|
||||||
|
uiDEConfig.tableWidget_customCommand->setItem(i, 1, new QTableWidgetItem(QString::number(1)));
|
||||||
|
QTableWidgetItem *output = new QTableWidgetItem();
|
||||||
|
output->setCheckState(Qt::Checked);
|
||||||
|
uiDEConfig.tableWidget_customCommand->setItem(i, 2, output);
|
||||||
|
uiDEConfig.tableWidget_customCommand->setItem(i, 3, new QTableWidgetItem(QString("")));
|
||||||
|
QComboBox *redirect = new QComboBox();
|
||||||
|
redirect->addItem(QString("out2err"));
|
||||||
|
redirect->addItem(QString("nothing"));
|
||||||
|
redirect->addItem(QString("err2out"));
|
||||||
|
redirect->setCurrentIndex(1);
|
||||||
|
uiDEConfig.tableWidget_customCommand->setCellWidget(i, 4, redirect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::addNewPkgCommand(QTableWidgetItem *item)
|
void AwesomeWidget::addNewPkgCommand(QTableWidgetItem *item)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -747,6 +807,31 @@ void AwesomeWidget::addNewPkgCommand(QTableWidgetItem *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AwesomeWidget::contextMenuCustomCommand(const QPoint pos)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (uiDEConfig.tableWidget_customCommand->currentItem() == 0) return;
|
||||||
|
|
||||||
|
QMenu menu(uiDEConfig.tableWidget_customCommand);
|
||||||
|
QAction *edit = menu.addAction(QIcon::fromTheme("document-edit"), i18n("Edit"));
|
||||||
|
QAction *create = menu.addAction(QIcon::fromTheme("document-new"), i18n("Create"));
|
||||||
|
QAction *remove = menu.addAction(QIcon::fromTheme("edit-delete"), i18n("Remove"));
|
||||||
|
QAction *action = menu.exec(uiDEConfig.tableWidget_customCommand->viewport()->mapToGlobal(pos));
|
||||||
|
if (action == edit) {
|
||||||
|
editCustomCommand(uiDEConfig.tableWidget_customCommand->currentRow(), 0);
|
||||||
|
} else if (action == create) {
|
||||||
|
addCustomScript();
|
||||||
|
} else if (action == remove) {
|
||||||
|
int row = uiDEConfig.tableWidget_customCommand->currentRow();
|
||||||
|
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_engine_extsysmon/scripts");
|
||||||
|
ExtScript *script = new ExtScript(uiDEConfig.tableWidget_customCommand->item(row, 0)->text(), dirs, debug);
|
||||||
|
script->tryDelete();
|
||||||
|
delete script;
|
||||||
|
uiDEConfig.tableWidget_customCommand->removeRow(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::contextMenuPkgCommand(const QPoint pos)
|
void AwesomeWidget::contextMenuPkgCommand(const QPoint pos)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -766,7 +851,7 @@ void AwesomeWidget::editCustomCommand(const int row, const int column)
|
|||||||
Q_UNUSED(column);
|
Q_UNUSED(column);
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QString name = uiDEConfig.tableWidget_customCommand->itemAt(row, 0)->text();
|
QString name = uiDEConfig.tableWidget_customCommand->item(row, 0)->text();
|
||||||
QString localDir = KStandardDirs::locateLocal("data", "plasma_engine_extsysmon/scripts");
|
QString localDir = KStandardDirs::locateLocal("data", "plasma_engine_extsysmon/scripts");
|
||||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_engine_extsysmon/scripts");
|
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_engine_extsysmon/scripts");
|
||||||
for (int i=0; i<dirs.count(); i++) {
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>700</width>
|
<width>700</width>
|
||||||
<height>588</height>
|
<height>586</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -43,10 +43,87 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>684</width>
|
<width>684</width>
|
||||||
<height>572</height>
|
<height>570</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="5" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_hddtempCmd">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_hddtempCmd">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>hddtemp cmd</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_hddtempCmd">
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_gpudev">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_gpudev">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>GPU device</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_gpudev">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">auto</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">disable</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">nvidia</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">ati</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<layout class="QHBoxLayout" name="layout_hdddev">
|
<layout class="QHBoxLayout" name="layout_hdddev">
|
||||||
<item>
|
<item>
|
||||||
@ -80,6 +157,49 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_playerSelect">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_playerSelect">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Music player</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_playerSelect">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">mpris</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">mpd</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<layout class="QHBoxLayout" name="layout_mpdport">
|
<layout class="QHBoxLayout" name="layout_mpdport">
|
||||||
<item>
|
<item>
|
||||||
@ -135,10 +255,10 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="0">
|
||||||
<layout class="QHBoxLayout" name="layout_gpudev">
|
<layout class="QHBoxLayout" name="layout_desktopCmd">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_gpudev">
|
<widget class="QLabel" name="label_desktopCmd">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>200</width>
|
||||||
@ -146,78 +266,12 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>GPU device</string>
|
<string>Desktop check cmd</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_gpudev">
|
<widget class="QLineEdit" name="lineEdit_desktopCmd">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">auto</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">disable</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">nvidia</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">ati</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="0">
|
|
||||||
<spacer name="spacer_dataengine">
|
|
||||||
<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 row="5" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_hddtempCmd">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_hddtempCmd">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>hddtemp cmd</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_hddtempCmd">
|
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
@ -225,49 +279,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_playerSelect">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_playerSelect">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Music player</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_playerSelect">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">mpris</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">mpd</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<layout class="QHBoxLayout" name="layout_mpdaddress">
|
<layout class="QHBoxLayout" name="layout_mpdaddress">
|
||||||
<item>
|
<item>
|
||||||
@ -292,10 +303,23 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="11" column="0">
|
||||||
<layout class="QHBoxLayout" name="layout_desktopCmd">
|
<spacer name="spacer_dataengine">
|
||||||
|
<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 row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_acpi">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_desktopCmd">
|
<widget class="QLabel" name="label_acpi">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>200</width>
|
||||||
@ -303,19 +327,60 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Desktop check cmd</string>
|
<string>ACPI path</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_desktopCmd">
|
<widget class="QLineEdit" name="lineEdit_acpi">
|
||||||
<property name="alignment">
|
<property name="toolTip">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<string>"/sys/class/power_supply/" by default</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QTableWidget" name="tableWidget_customCommand">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Interval</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Output</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Prefix</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Redirect</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="8" column="0">
|
||||||
<layout class="QVBoxLayout" name="layout_mpris">
|
<layout class="QVBoxLayout" name="layout_mpris">
|
||||||
<item>
|
<item>
|
||||||
@ -440,69 +505,6 @@ del - remove item</string>
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QTableWidget" name="tableWidget_customCommand">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Editable
|
|
||||||
del - remove item</string>
|
|
||||||
</property>
|
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
|
||||||
<bool>true</bool>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="verticalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Name</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Interval</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Output</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Prefix</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Redirect</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_acpi">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_acpi">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>ACPI path</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_acpi">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>"/sys/class/power_supply/" by default</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -233,6 +233,19 @@ ExtScript::ScriptData ExtScript::run(const int time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::tryDelete()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
|
QString fileName = dirs[i] + QDir::separator() + name;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << fileName << QFile::remove(fileName);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << fileName + QString(".conf") <<
|
||||||
|
QFile::remove(fileName + QString(".conf"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExtScript::writeConfiguration()
|
void ExtScript::writeConfiguration()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
ScriptData run(const int time);
|
ScriptData run(const int time);
|
||||||
|
void tryDelete();
|
||||||
void writeConfiguration();
|
void writeConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user