mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 16:07:19 +00:00
update extscript to inherit from QDialog
This commit is contained in:
parent
e54ab7e1a5
commit
16d7ca2005
@ -16,7 +16,8 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||||
${PROJECT_TRDPARTY_DIR}
|
${PROJECT_TRDPARTY_DIR}
|
||||||
../ext-sysmon)
|
../ext-sysmon
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../ext-sysmon)
|
||||||
|
|
||||||
# set sources
|
# set sources
|
||||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||||
|
@ -585,7 +585,7 @@ void AwesomeWidget::configAccepted()
|
|||||||
deSettings[QString("ACPIPATH")] = uiDEConfig.lineEdit_acpi->text();
|
deSettings[QString("ACPIPATH")] = uiDEConfig.lineEdit_acpi->text();
|
||||||
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<uiDEConfig.tableWidget_customCommand->rowCount(); i++) {
|
for (int i=0; i<uiDEConfig.tableWidget_customCommand->rowCount(); i++) {
|
||||||
ExtScript *script = new ExtScript(uiDEConfig.tableWidget_customCommand->item(i, 0)->text(), dirs, debug);
|
ExtScript *script = new ExtScript(0, uiDEConfig.tableWidget_customCommand->item(i, 0)->text(), dirs, debug);
|
||||||
if (uiDEConfig.tableWidget_customCommand->item(i, 0)->checkState() == Qt::Checked)
|
if (uiDEConfig.tableWidget_customCommand->item(i, 0)->checkState() == Qt::Checked)
|
||||||
script->setActive(true);
|
script->setActive(true);
|
||||||
else
|
else
|
||||||
@ -862,7 +862,7 @@ void AwesomeWidget::contextMenuCustomCommand(const QPoint pos)
|
|||||||
} else if (action == remove) {
|
} else if (action == remove) {
|
||||||
int row = uiDEConfig.tableWidget_customCommand->currentRow();
|
int row = uiDEConfig.tableWidget_customCommand->currentRow();
|
||||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_engine_extsysmon/scripts");
|
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_engine_extsysmon/scripts");
|
||||||
ExtScript *script = new ExtScript(uiDEConfig.tableWidget_customCommand->item(row, 0)->text(), dirs, debug);
|
ExtScript *script = new ExtScript(0, uiDEConfig.tableWidget_customCommand->item(row, 0)->text(), dirs, debug);
|
||||||
script->tryDelete();
|
script->tryDelete();
|
||||||
delete script;
|
delete script;
|
||||||
uiDEConfig.tableWidget_customCommand->removeRow(row);
|
uiDEConfig.tableWidget_customCommand->removeRow(row);
|
||||||
@ -976,7 +976,7 @@ QList<ExtScript *> AwesomeWidget::initScripts()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
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(files[j], dirs, debug));
|
externalScripts.append(new ExtScript(0, files[j], dirs, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
492
sources/awesome-widget/desktopconfig.ui
Normal file
492
sources/awesome-widget/desktopconfig.ui
Normal file
@ -0,0 +1,492 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DEWindow</class>
|
||||||
|
<widget class="QWidget" name="DEWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>700</width>
|
||||||
|
<height>584</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>700</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string notr="true">DE</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QScrollArea" name="scrollArea_dattaengine">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="contents_dattaengine">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>684</width>
|
||||||
|
<height>568</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="4" 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="2" 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="3" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_hdddev">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_hdddev">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>HDD</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_hdddev">
|
||||||
|
<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>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="8" 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">
|
||||||
|
<layout class="QHBoxLayout" name="layout_mpdport">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_mpdport">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>MPD port</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_mpdport">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>19</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_mpdport">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>180</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>50000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>6600</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_mpdaddress">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_mpdaddress">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>MPD address</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_mpdaddress">
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="10" 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="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>
|
||||||
|
<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="7" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="layout_mpris">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_mprisInfo">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>NOTE:</b> Player DBus interface should be an active</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_mprisSelect">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_mpris">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>MPRIS player name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_mpris">
|
||||||
|
<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>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">auto</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">amarok</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">audacious</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">clementine</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">deadbeef</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">vlc</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">qmmp</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">xmms2</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="layout_pkgCommand">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="tableWidget_pkgCommand">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Editable
|
||||||
|
del - remove item</string>
|
||||||
|
</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>Package manager</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Null lines</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -1,5 +1,7 @@
|
|||||||
# set project name
|
# set project name
|
||||||
set (SUBPROJECT plasma_engine_extsysmon)
|
set (SUBPROJECT plasma_engine_extsysmon)
|
||||||
|
set (PLUGIN_NAME ${SUBPROJECT})
|
||||||
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
# find required libaries
|
# find required libaries
|
||||||
find_package (KDE4 REQUIRED)
|
find_package (KDE4 REQUIRED)
|
||||||
@ -13,11 +15,11 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||||
${PROJECT_TRDPARTY_DIR})
|
${PROJECT_TRDPARTY_DIR})
|
||||||
|
|
||||||
set (PLUGIN_NAME ${SUBPROJECT})
|
|
||||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||||
|
file (GLOB SUBPROJECT_UI *.ui)
|
||||||
file (GLOB SUBPROJECT_CONF *.conf)
|
file (GLOB SUBPROJECT_CONF *.conf)
|
||||||
set (SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
set (SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJEC
|
|||||||
|
|
||||||
# make
|
# make
|
||||||
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_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})
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "extscript.h"
|
#include "extscript.h"
|
||||||
|
#include "ui_extscript.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -25,19 +26,23 @@
|
|||||||
#include <task/taskadds.h>
|
#include <task/taskadds.h>
|
||||||
|
|
||||||
|
|
||||||
ExtScript::ExtScript(const QString scriptName, const QStringList directories, const bool debugCmd)
|
ExtScript::ExtScript(QWidget *parent, const QString scriptName, const QStringList directories, const bool debugCmd) :
|
||||||
: QObject(0),
|
QDialog(parent),
|
||||||
name(scriptName),
|
name(scriptName),
|
||||||
dirs(directories),
|
dirs(directories),
|
||||||
debug(debugCmd)
|
debug(debugCmd),
|
||||||
|
ui(new Ui::ExtScript)
|
||||||
{
|
{
|
||||||
readConfiguration();
|
readConfiguration();
|
||||||
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ExtScript::~ExtScript()
|
ExtScript::~ExtScript()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,11 +18,14 @@
|
|||||||
#ifndef EXTSCRIPT_H
|
#ifndef EXTSCRIPT_H
|
||||||
#define EXTSCRIPT_H
|
#define EXTSCRIPT_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QDialog>
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
|
|
||||||
class ExtScript : public QObject
|
namespace Ui {
|
||||||
|
class ExtScript;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExtScript : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -38,8 +41,8 @@ public:
|
|||||||
QString output;
|
QString output;
|
||||||
bool refresh;
|
bool refresh;
|
||||||
} ScriptData;
|
} ScriptData;
|
||||||
|
explicit ExtScript(QWidget *parent = 0, const QString scriptName = QString(),
|
||||||
ExtScript(const QString scriptName, const QStringList directories, const bool debugCmd = false);
|
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||||
~ExtScript();
|
~ExtScript();
|
||||||
// configuration
|
// configuration
|
||||||
void addDirectory(const QString dir);
|
void addDirectory(const QString dir);
|
||||||
@ -63,21 +66,22 @@ public slots:
|
|||||||
void tryDelete();
|
void tryDelete();
|
||||||
void writeConfiguration();
|
void writeConfiguration();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString name;
|
||||||
|
QStringList dirs;
|
||||||
|
bool debug;
|
||||||
|
Ui::ExtScript *ui;
|
||||||
// configuration
|
// configuration
|
||||||
void fromExternalConfiguration(const QMap<QString, QString> settings);
|
void fromExternalConfiguration(const QMap<QString, QString> settings);
|
||||||
QMap<QString, QString> getConfigurationFromFile(const QString fileName);
|
QMap<QString, QString> getConfigurationFromFile(const QString fileName);
|
||||||
QMap<QString, QString> toExternalConfiguration();
|
QMap<QString, QString> toExternalConfiguration();
|
||||||
// properties
|
// properties
|
||||||
bool active = true;
|
bool active = true;
|
||||||
QString name;
|
|
||||||
QStringList dirs;
|
|
||||||
int interval = 1;
|
int interval = 1;
|
||||||
bool output = true;
|
bool output = true;
|
||||||
QString prefix = QString("");
|
QString prefix = QString("");
|
||||||
Redirect redirect = nothing;
|
Redirect redirect = nothing;
|
||||||
// other
|
|
||||||
bool debug;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
67
sources/ext-sysmon/extscript.ui
Normal file
67
sources/ext-sysmon/extscript.ui
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<ui version="4.0">
|
||||||
|
<class>ExtScript</class>
|
||||||
|
<widget class="QDialog" name="ExtScript">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>240</width>
|
||||||
|
<height>320</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>270</y>
|
||||||
|
<width>221</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>ExtScript</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>ExtScript</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -130,7 +130,7 @@ void ExtendedSysMon::initScripts()
|
|||||||
if (names.contains(files[j])) continue;
|
if (names.contains(files[j])) continue;
|
||||||
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(files[j], dirs, debug));
|
externalScripts.append(new ExtScript(0, files[j], dirs, debug));
|
||||||
times.append(1);
|
times.append(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,384 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of awesome-widgets *
|
|
||||||
* *
|
|
||||||
* awesome-widgets is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "graphicalitem.h"
|
|
||||||
|
|
||||||
#include <QBuffer>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QGraphicsEllipseItem>
|
|
||||||
#include <QGraphicsScene>
|
|
||||||
#include <QGraphicsView>
|
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
|
|
||||||
GraphicalItem::GraphicalItem(const QString desktopName, const QStringList directories, const bool debugCmd)
|
|
||||||
: fileName(desktopName),
|
|
||||||
dirs(directories),
|
|
||||||
debug(debugCmd)
|
|
||||||
{
|
|
||||||
readConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GraphicalItem::~GraphicalItem()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getImage(const float value)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
|
|
||||||
if (_bar == QString("none")) return QString("");
|
|
||||||
|
|
||||||
float percent = value / 100.0;
|
|
||||||
int scale[2] = {1, 1};
|
|
||||||
QPen pen = QPen();
|
|
||||||
QGraphicsScene *scene = new QGraphicsScene();
|
|
||||||
scene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
|
||||||
QGraphicsView *view = new QGraphicsView(scene);
|
|
||||||
view->setStyleSheet(QString("background: transparent"));
|
|
||||||
view->setContentsMargins(0, 0, 0, 0);
|
|
||||||
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
||||||
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
||||||
view->resize(_width + 5.0, _height + 5.0);
|
|
||||||
|
|
||||||
// paint
|
|
||||||
switch(_type) {
|
|
||||||
case Vertical:
|
|
||||||
pen.setWidth(_width);
|
|
||||||
// inactive
|
|
||||||
pen.setColor(_inactiveColor);
|
|
||||||
scene->addLine(0.5 * _width, 0.0, 0.5 * _width, _height, pen);
|
|
||||||
// active
|
|
||||||
pen.setColor(_activeColor);
|
|
||||||
scene->addLine(0.5 * _width, (1.0 - percent) * _height + 0.5 * _width, 0.5 * _width, _height + 0.5 * _width, pen);
|
|
||||||
// scale
|
|
||||||
scale[1] = (int)_direction;
|
|
||||||
break;
|
|
||||||
case Circle:
|
|
||||||
QGraphicsEllipseItem *circle;
|
|
||||||
pen.setWidth(1.0);
|
|
||||||
// inactive
|
|
||||||
pen.setColor(_inactiveColor);
|
|
||||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(_inactiveColor, Qt::SolidPattern));
|
|
||||||
circle->setSpanAngle((1.0 - percent) * 360.0 * 16.0);
|
|
||||||
circle->setStartAngle(180.0 * 16.0 - (1.0 - percent) * 360.0 * 16.0);
|
|
||||||
// active
|
|
||||||
pen.setColor(_activeColor);
|
|
||||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(_activeColor, Qt::SolidPattern));
|
|
||||||
circle->setSpanAngle(percent * 360.0 * 16.0);
|
|
||||||
circle->setStartAngle(180.0 * 16.0);
|
|
||||||
// scale
|
|
||||||
scale[0] = (int)_direction;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pen.setWidth(_height);
|
|
||||||
// inactive
|
|
||||||
pen.setColor(_inactiveColor);
|
|
||||||
scene->addLine(0.0, 0.5 * _height, _width, 0.5 * _height, pen);
|
|
||||||
// active
|
|
||||||
pen.setColor(_activeColor);
|
|
||||||
scene->addLine(-0.5 * _height, 0.5 * _height, percent * _width - 0.5 * _height, 0.5 * _height, pen);
|
|
||||||
// scale
|
|
||||||
scale[0] = (int)_direction;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert
|
|
||||||
QPixmap pixmap = QPixmap::grabWidget(view).transformed(QTransform().scale(scale[0], scale[1]));
|
|
||||||
QByteArray byteArray;
|
|
||||||
QBuffer buffer(&byteArray);
|
|
||||||
pixmap.save(&buffer, "PNG");
|
|
||||||
QString url = QString("<img src=\"data:image/png;base64,%1\"/>").arg(QString(byteArray.toBase64()));
|
|
||||||
delete view;
|
|
||||||
delete scene;
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getName()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getComment()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString GraphicalItem::getBar()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _bar;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QColor GraphicalItem::getActiveColor()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _activeColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QColor GraphicalItem::getInactiveColor()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _inactiveColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GraphicalItem::Type GraphicalItem::getType()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _type;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GraphicalItem::Direction GraphicalItem::getDirection()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GraphicalItem::getHeight()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _height;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GraphicalItem::getWidth()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return _width;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setName(const QString name)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << name;
|
|
||||||
|
|
||||||
_name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setComment(const QString comment)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << comment;
|
|
||||||
|
|
||||||
_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).*")))) &&
|
|
||||||
(!_bar.contains(QRegExp(QString("gpu")))) &&
|
|
||||||
(!_bar.contains(QRegExp(QString("mem")))) &&
|
|
||||||
(!_bar.contains(QRegExp(QString("swap")))) &&
|
|
||||||
(!_bar.contains(QRegExp(QString("hdd[0-9].*")))) &&
|
|
||||||
(!_bar.contains(QRegExp(QString("bat.*")))))
|
|
||||||
_bar = QString("none");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setActiveColor(const QColor color)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << color;
|
|
||||||
|
|
||||||
_activeColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setInactiveColor(const QColor 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
|
|
||||||
_type = Horizontal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setDirection(const QString direction)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Direction" << direction;
|
|
||||||
|
|
||||||
if (direction == QString("RightToLeft"))
|
|
||||||
_direction = RightToLeft;
|
|
||||||
else
|
|
||||||
_direction = LeftToRight;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setHeight(const int height)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Height" << height;
|
|
||||||
|
|
||||||
_height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::setWidth(const int width)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Width" << width;
|
|
||||||
|
|
||||||
_width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::readConfiguration()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
for (int i=dirs.count()-1; i>=0; i--) {
|
|
||||||
if (!QDir(dirs[i]).entryList(QDir::Files).contains(fileName)) continue;
|
|
||||||
QSettings settings(dirs[i] + QDir::separator() + fileName, QSettings::IniFormat);
|
|
||||||
settings.beginGroup(QString("Desktop Entry"));
|
|
||||||
QStringList childKeys = settings.childKeys();
|
|
||||||
for (int i=0; i<childKeys.count(); i++) {
|
|
||||||
if (childKeys[i] == QString("Name")) {
|
|
||||||
setName(settings.value(childKeys[i]).toString());
|
|
||||||
} else if (childKeys[i] == QString("Comment")) {
|
|
||||||
setComment(settings.value(childKeys[i]).toString());
|
|
||||||
} else if (childKeys[i] == QString("X-AW-Value")) {
|
|
||||||
setBar(settings.value(childKeys[i]).toString());
|
|
||||||
} else if (childKeys[i] == QString("X-AW-ActiveColor")) {
|
|
||||||
QStringList color = settings.value(childKeys[i]).toString().split(QChar(','));
|
|
||||||
setActiveColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt(), color[3].toInt()));
|
|
||||||
} else if (childKeys[i] == QString("X-AW-InactiveColor")) {
|
|
||||||
QStringList color = settings.value(childKeys[i]).toString().split(QChar(','));
|
|
||||||
setInactiveColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt(), color[3].toInt()));
|
|
||||||
} else if (childKeys[i] == QString("X-AW-Type")) {
|
|
||||||
setType(settings.value(childKeys[i]).toString());
|
|
||||||
} else if (childKeys[i] == QString("X-AW-Direction")) {
|
|
||||||
setDirection(settings.value(childKeys[i]).toString());
|
|
||||||
} else if (childKeys[i] == QString("X-AW-Height")) {
|
|
||||||
setHeight(settings.value(childKeys[i]).toInt());
|
|
||||||
} else if (childKeys[i] == QString("X-AW-Width")) {
|
|
||||||
setWidth(settings.value(childKeys[i]).toInt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::showConfiguration()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::tryDelete()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
for (int i=0; i<dirs.count(); i++)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << fileName << QFile::remove(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::writeConfiguration()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QSettings settings(dirs[0] + QDir::separator() + fileName, QSettings::IniFormat);
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
|
||||||
settings.beginGroup(QString("Desktop Entry"));
|
|
||||||
|
|
||||||
QString strValue;
|
|
||||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
|
||||||
settings.setValue(QString("Name"), _name);
|
|
||||||
settings.setValue(QString("Comment"), _comment);
|
|
||||||
settings.setValue(QString("X-AW-Value"), _bar);
|
|
||||||
settings.setValue(QString("X-AW-ActiveColor"), QString("%1,%2,%3,%4")
|
|
||||||
.arg(_activeColor.red()).arg(_activeColor.green())
|
|
||||||
.arg(_activeColor.blue()).arg(_activeColor.alpha()));
|
|
||||||
settings.setValue(QString("X-AW-InactiveColor"), QString("%1,%2,%3,%4")
|
|
||||||
.arg(_inactiveColor.red()).arg(_inactiveColor.green())
|
|
||||||
.arg(_inactiveColor.blue()).arg(_inactiveColor.alpha()));
|
|
||||||
switch(_type) {
|
|
||||||
case Vertical:
|
|
||||||
strValue = QString("Vertical");
|
|
||||||
break;
|
|
||||||
case Circle:
|
|
||||||
strValue = QString("Circle");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strValue = QString("Horizontal");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
settings.setValue(QString("X-AW-Type"), strValue);
|
|
||||||
switch (_direction) {
|
|
||||||
case RightToLeft:
|
|
||||||
strValue = QString("RightToLeft");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strValue = QString("LeftToRight");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
settings.setValue(QString("X-AW-Direction"), strValue);
|
|
||||||
settings.setValue(QString("X-AW-Height"), _height);
|
|
||||||
settings.setValue(QString("X-AW-Width"), _width);
|
|
||||||
|
|
||||||
settings.endGroup();
|
|
||||||
settings.sync();
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of awesome-widgets *
|
|
||||||
* *
|
|
||||||
* awesome-widgets is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef GRAPHICALITEM_H
|
|
||||||
#define GRAPHICALITEM_H
|
|
||||||
|
|
||||||
#include <QColor>
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
|
|
||||||
class GraphicalItem : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum Direction {
|
|
||||||
RightToLeft = -1,
|
|
||||||
LeftToRight = 1
|
|
||||||
};
|
|
||||||
enum Type {
|
|
||||||
Horizontal = 0,
|
|
||||||
Vertical,
|
|
||||||
Circle
|
|
||||||
};
|
|
||||||
|
|
||||||
GraphicalItem(const QString desktopName, const QStringList directories, const bool debugCmd = false);
|
|
||||||
~GraphicalItem();
|
|
||||||
QString getImage(const float value);
|
|
||||||
// get methods
|
|
||||||
QString getName();
|
|
||||||
QString getComment();
|
|
||||||
QString getBar();
|
|
||||||
QColor getActiveColor();
|
|
||||||
QColor getInactiveColor();
|
|
||||||
Type getType();
|
|
||||||
Direction getDirection();
|
|
||||||
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);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void readConfiguration();
|
|
||||||
void showConfiguration();
|
|
||||||
void tryDelete();
|
|
||||||
void writeConfiguration();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString fileName;
|
|
||||||
QStringList dirs;
|
|
||||||
bool debug;
|
|
||||||
// properties
|
|
||||||
QString _name = QString("none");
|
|
||||||
QString _comment = QString("empty");
|
|
||||||
QString _bar = QString("cpu");
|
|
||||||
QColor _activeColor = QColor(255, 255, 255, 0);
|
|
||||||
QColor _inactiveColor = QColor(255, 255, 255, 255);
|
|
||||||
Type _type = Horizontal;
|
|
||||||
Direction _direction = LeftToRight;
|
|
||||||
int _height = 100;
|
|
||||||
int _width = 100;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* GRAPHICALITEM_H */
|
|
Loading…
Reference in New Issue
Block a user