mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2026-02-07 16:59:48 +00:00
update translations
add notifications edit resizing fix reading ps some fixes
This commit is contained in:
@@ -22,7 +22,8 @@ file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
||||
../extsysmon/extscript.cpp)
|
||||
../extsysmon/extscript.cpp
|
||||
../extsysmon/extupgrade.cpp)
|
||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
file (GLOB SUBPROJECT_UI *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
class CustomLabel;
|
||||
class ExtScript;
|
||||
class ExtUpgrade;
|
||||
class GraphicalItem;
|
||||
class QGraphicsGridLayout;
|
||||
class QGraphicsScene;
|
||||
@@ -80,7 +81,7 @@ private slots:
|
||||
// configuration interface
|
||||
void addBar();
|
||||
void addCustomScript();
|
||||
void addNewPkgCommand(QTableWidgetItem *item);
|
||||
void addPkgCommand();
|
||||
void contextMenuBars(const QPoint pos);
|
||||
void contextMenuCustomCommand(const QPoint pos);
|
||||
void contextMenuPkgCommand(const QPoint pos);
|
||||
@@ -88,6 +89,7 @@ private slots:
|
||||
void copyCustomCommand(const QString original);
|
||||
void editBar(QListWidgetItem *item);
|
||||
void editCustomCommand(QListWidgetItem *item);
|
||||
void editPkgCommand(QListWidgetItem *item);
|
||||
void editFanItem(QListWidgetItem *item);
|
||||
void editHddItem(QListWidgetItem *item);
|
||||
void editHddSpeedItem(QListWidgetItem *item);
|
||||
@@ -112,6 +114,7 @@ private:
|
||||
void getGraphicalItems();
|
||||
GraphicalItem *getItemByTag(const QString tag);
|
||||
QList<ExtScript *> initScripts();
|
||||
QList<ExtUpgrade *> initUpgrades();
|
||||
// ui
|
||||
QGraphicsGridLayout *mainLayout = nullptr;
|
||||
CustomLabel *textLabel = nullptr;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <QTextCodec>
|
||||
|
||||
#include <extscript.h>
|
||||
#include <extupgrade.h>
|
||||
#include <graphicalitem.h>
|
||||
#include <fontdialog/fontdialog.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
@@ -350,7 +351,7 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Name: %1", externalScripts[i]->name()));
|
||||
tooltip.append(i18n("Comment: %1", externalScripts[i]->comment()));
|
||||
tooltip.append(i18n("Exec: %1", externalScripts[i]->exec()));
|
||||
tooltip.append(i18n("Exec: %1", externalScripts[i]->executable()));
|
||||
item->setToolTip(tooltip.join(QChar('\n')));
|
||||
uiDEConfig.listWidget_custom->addItem(item);
|
||||
}
|
||||
@@ -376,19 +377,18 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
||||
uiDEConfig.spinBox_mpdport->setValue(deSettings[QString("MPDPORT")].toInt());
|
||||
uiDEConfig.comboBox_mpris->addItem(deSettings[QString("MPRIS")]);
|
||||
uiDEConfig.comboBox_mpris->setCurrentIndex(uiDEConfig.comboBox_mpris->count() - 1);
|
||||
uiDEConfig.tableWidget_pkgCommand->clear();
|
||||
uiDEConfig.tableWidget_pkgCommand->setRowCount(deSettings[QString("PKGCMD")].split(QChar(',')).count() + 1);
|
||||
headerList.clear();
|
||||
headerList.append(i18n("Package manager"));
|
||||
headerList.append(i18n("Null lines"));
|
||||
uiDEConfig.tableWidget_pkgCommand->setHorizontalHeaderLabels(headerList);
|
||||
uiDEConfig.tableWidget_pkgCommand->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
||||
for (int i=0; i<deSettings[QString("PKGCMD")].split(QChar(',')).count(); i++) {
|
||||
uiDEConfig.tableWidget_pkgCommand->setItem(i, 0, new QTableWidgetItem(deSettings[QString("PKGCMD")].split(QChar(','))[i]));
|
||||
uiDEConfig.tableWidget_pkgCommand->setItem(i, 1, new QTableWidgetItem(deSettings[QString("PKGNULL")].split(QChar(','))[i]));
|
||||
QList<ExtUpgrade *> externalUpgrade = initUpgrades();
|
||||
uiDEConfig.listWidget_pkgCommand->clear();
|
||||
for (int i=0; i<externalUpgrade.count(); i++) {
|
||||
QListWidgetItem *item = new QListWidgetItem(externalUpgrade[i]->fileName());
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Name: %1", externalUpgrade[i]->name()));
|
||||
tooltip.append(i18n("Comment: %1", externalUpgrade[i]->comment()));
|
||||
tooltip.append(i18n("Exec: %1", externalUpgrade[i]->executable()));
|
||||
item->setToolTip(tooltip.join(QChar('\n')));
|
||||
uiDEConfig.listWidget_pkgCommand->addItem(item);
|
||||
}
|
||||
uiDEConfig.tableWidget_pkgCommand->setItem(uiDEConfig.tableWidget_pkgCommand->rowCount() - 1, 1,
|
||||
new QTableWidgetItem(QString("0")));
|
||||
externalUpgrade.clear();
|
||||
uiDEConfig.comboBox_playerSelect->setCurrentIndex(
|
||||
uiDEConfig.comboBox_playerSelect->findText(deSettings[QString("PLAYER")], Qt::MatchFixedString));
|
||||
|
||||
@@ -439,12 +439,13 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
||||
this, SLOT(editCustomCommand(QListWidgetItem *)));
|
||||
connect(uiDEConfig.listWidget_custom, SIGNAL(customContextMenuRequested(QPoint)),
|
||||
this, SLOT(contextMenuCustomCommand(QPoint)));
|
||||
connect(uiDEConfig.tableWidget_pkgCommand, SIGNAL(itemChanged(QTableWidgetItem *)),
|
||||
this, SLOT(addNewPkgCommand(QTableWidgetItem *)));
|
||||
connect(uiDEConfig.tableWidget_pkgCommand, SIGNAL(customContextMenuRequested(QPoint)),
|
||||
connect(uiDEConfig.listWidget_pkgCommand, SIGNAL(itemActivated(QListWidgetItem *)),
|
||||
this, SLOT(editPkgCommand(QListWidgetItem *)));
|
||||
connect(uiDEConfig.listWidget_pkgCommand, SIGNAL(customContextMenuRequested(QPoint)),
|
||||
this, SLOT(contextMenuPkgCommand(QPoint)));
|
||||
connect(uiAdvancedConfig.pushButton_bars, SIGNAL(clicked(bool)), this, SLOT(addBar()));
|
||||
connect(uiDEConfig.pushButton_custom, SIGNAL(clicked(bool)), this, SLOT(addCustomScript()));
|
||||
connect(uiDEConfig.pushButton_pkgCommand, SIGNAL(clicked(bool)), this, SLOT(addPkgCommand()));
|
||||
connect(uiWidConfig.pushButton_tags, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||
connect(uiWidConfig.pushButton_br, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||
connect(uiWidConfig.pushButton_font, SIGNAL(clicked(bool)), this, SLOT(setFontFormating()));
|
||||
@@ -546,15 +547,6 @@ void AwesomeWidget::configAccepted()
|
||||
deSettings[QString("MPDADDRESS")] = uiDEConfig.lineEdit_mpdaddress->text();
|
||||
deSettings[QString("MPDPORT")] = QString::number(uiDEConfig.spinBox_mpdport->value());
|
||||
deSettings[QString("MPRIS")] = uiDEConfig.comboBox_mpris->currentText();
|
||||
items.clear();
|
||||
for (int i=0; i<uiDEConfig.tableWidget_pkgCommand->rowCount(); i++)
|
||||
if (uiDEConfig.tableWidget_pkgCommand->item(i, 0) != 0)
|
||||
items.append(uiDEConfig.tableWidget_pkgCommand->item(i, 0)->text());
|
||||
deSettings[QString("PKGCMD")] = items.join(QChar(','));
|
||||
items.clear();
|
||||
for (int i=0; i<uiDEConfig.tableWidget_pkgCommand->rowCount(); i++)
|
||||
if (uiDEConfig.tableWidget_pkgCommand->item(i, 0) != 0)
|
||||
items.append(uiDEConfig.tableWidget_pkgCommand->item(i, 1)->text());
|
||||
deSettings[QString("PKGNULL")] = items.join(QChar(','));
|
||||
deSettings[QString("PLAYER")] = uiDEConfig.comboBox_playerSelect->currentText();
|
||||
writeDataEngineConfiguration(deSettings);
|
||||
@@ -668,7 +660,7 @@ void AwesomeWidget::configChanged()
|
||||
counts[QString("fan")] = configuration[QString("fanDevice")].split(QString("@@")).count();
|
||||
counts[QString("hddtemp")] = configuration[QString("hdd")].split(QString("@@")).count();
|
||||
counts[QString("mount")] = configuration[QString("mount")].split(QString("@@")).count();
|
||||
counts[QString("pkg")] = deSettings[QString("PKGCMD")].split(QChar(',')).count();
|
||||
counts[QString("pkg")] = initUpgrades().count();
|
||||
counts[QString("temp")] = configuration[QString("tempDevice")].split(QString("@@")).count();
|
||||
counts[QString("tooltip")] = 0;
|
||||
counts[QString("tooltip")] += configuration[QString("cpuTooltip")].toInt();
|
||||
@@ -724,7 +716,7 @@ void AwesomeWidget::addCustomScript()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_applet_awesome-widget/desktops");
|
||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/scripts");
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||
i18n("File name"), QLineEdit::Normal,
|
||||
@@ -738,18 +730,21 @@ void AwesomeWidget::addCustomScript()
|
||||
}
|
||||
|
||||
|
||||
void AwesomeWidget::addNewPkgCommand(QTableWidgetItem *item)
|
||||
void AwesomeWidget::addPkgCommand()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if ((item->row() == (uiDEConfig.tableWidget_pkgCommand->rowCount() - 1)) &&
|
||||
(item->column() == 0)) {
|
||||
uiDEConfig.tableWidget_pkgCommand->insertRow(
|
||||
uiDEConfig.tableWidget_pkgCommand->rowCount());
|
||||
uiDEConfig.tableWidget_pkgCommand->setItem(
|
||||
uiDEConfig.tableWidget_pkgCommand->rowCount() - 1, 1,
|
||||
new QTableWidgetItem(QString("0")));
|
||||
}
|
||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/upgrade");
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||
i18n("File name"), QLineEdit::Normal,
|
||||
QString(""), &ok);
|
||||
if ((!ok) || (name.isEmpty())) return;
|
||||
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
||||
|
||||
ExtUpgrade *upgrade = new ExtUpgrade(0, name, dirs, debug);
|
||||
|
||||
upgrade->showConfiguration();
|
||||
}
|
||||
|
||||
|
||||
@@ -806,14 +801,18 @@ void AwesomeWidget::contextMenuCustomCommand(const QPoint pos)
|
||||
void AwesomeWidget::contextMenuPkgCommand(const QPoint pos)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (uiDEConfig.tableWidget_pkgCommand->currentItem() == 0) return;
|
||||
if (uiDEConfig.listWidget_pkgCommand->currentItem() == 0) return;
|
||||
|
||||
QMenu menu(uiDEConfig.tableWidget_pkgCommand);
|
||||
QMenu menu(uiDEConfig.listWidget_pkgCommand);
|
||||
QAction *remove = menu.addAction(QIcon::fromTheme("edit-delete"), i18n("Remove"));
|
||||
QAction *action = menu.exec(uiDEConfig.tableWidget_pkgCommand->viewport()->mapToGlobal(pos));
|
||||
if (action == remove)
|
||||
uiDEConfig.tableWidget_pkgCommand->removeRow(
|
||||
uiDEConfig.tableWidget_pkgCommand->currentRow());
|
||||
QAction *action = menu.exec(uiDEConfig.listWidget_pkgCommand->viewport()->mapToGlobal(pos));
|
||||
if (action == remove) {
|
||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/upgrade");
|
||||
ExtUpgrade *upgrade = new ExtUpgrade(0, uiDEConfig.listWidget_pkgCommand->currentItem()->text(), dirs, debug);
|
||||
upgrade->tryDelete();
|
||||
delete upgrade;
|
||||
uiDEConfig.listWidget_pkgCommand->takeItem(uiDEConfig.listWidget_pkgCommand->currentRow());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -874,7 +873,7 @@ void AwesomeWidget::copyCustomCommand(const QString original)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_applet_awesome-widget/desktops");
|
||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/scripts");
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||
i18n("File name"), QLineEdit::Normal,
|
||||
@@ -929,6 +928,16 @@ void AwesomeWidget::editCustomCommand(QListWidgetItem *item)
|
||||
}
|
||||
|
||||
|
||||
void AwesomeWidget::editPkgCommand(QListWidgetItem *item)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/upgrade");
|
||||
ExtUpgrade *upgrade = new ExtUpgrade(0, item->text(), dirs, debug);
|
||||
upgrade->showConfiguration();
|
||||
}
|
||||
|
||||
|
||||
void AwesomeWidget::editFanItem(QListWidgetItem *item)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@@ -996,6 +1005,33 @@ QList<ExtScript *> AwesomeWidget::initScripts()
|
||||
}
|
||||
|
||||
|
||||
QList<ExtUpgrade *> AwesomeWidget::initUpgrades()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QList<ExtUpgrade *> externalUpgrade;
|
||||
// create directory at $HOME
|
||||
QString localDir = KStandardDirs::locateLocal("data", "plasma_dataengine_extsysmon/upgrade");
|
||||
if (KStandardDirs::makeDir(localDir))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/upgrade");
|
||||
QStringList names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
||||
for (int j=0; j<files.count(); j++) {
|
||||
if (!files[j].endsWith(QString(".desktop"))) continue;
|
||||
if (names.contains(files[j])) continue;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
||||
names.append(files[j]);
|
||||
externalUpgrade.append(new ExtUpgrade(0, files[j], dirs, debug));
|
||||
}
|
||||
}
|
||||
|
||||
return externalUpgrade;
|
||||
}
|
||||
|
||||
|
||||
void AwesomeWidget::setFontFormating()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@@ -345,40 +345,6 @@
|
||||
</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>
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="layout_custom">
|
||||
<item>
|
||||
@@ -421,6 +387,48 @@ del - remove item</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<layout class="QVBoxLayout" name="layout_pkgCommand">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_pkgCommandAdd">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_pkgCommand">
|
||||
<property name="text">
|
||||
<string>Package manager</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_pkgCommand">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_pkgCommand">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_pkgCommand">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -214,7 +214,7 @@ QString GraphicalItem::strType()
|
||||
default:
|
||||
value = QString("Horizontal");
|
||||
break;
|
||||
}\
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user