mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-06-27 06:11:45 +00:00
remove dublicates
This commit is contained in:
@ -4,6 +4,7 @@ Ver.1.11.0:
|
|||||||
+ added PTM desktop panel
|
+ added PTM desktop panel
|
||||||
+ added desktop label (tags $name, $number, $total)
|
+ added desktop label (tags $name, $number, $total)
|
||||||
+ added ability to interact with players using mpris
|
+ added ability to interact with players using mpris
|
||||||
|
* rewrite to use submodules
|
||||||
* rewrite dataengine to use tasks
|
* rewrite dataengine to use tasks
|
||||||
* fix nvidia temperature definition
|
* fix nvidia temperature definition
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
+ добавлен виджет PTM desktop panel
|
+ добавлен виджет PTM desktop panel
|
||||||
+ добавлено поле текущий рабочий стол (теги $name, $number, $total)
|
+ добавлено поле текущий рабочий стол (теги $name, $number, $total)
|
||||||
+ добавлена возможность взаимодействия с плеерами через mpris
|
+ добавлена возможность взаимодействия с плеерами через mpris
|
||||||
|
* добавлено использование сабмодулей
|
||||||
* dataengine переписан с использованием tasks
|
* dataengine переписан с использованием tasks
|
||||||
* фикс чтения температуры nvidia
|
* фикс чтения температуры nvidia
|
||||||
|
|
||||||
|
@ -122,43 +122,6 @@ void DesktopPanel::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList DesktopPanel::getDesktopNames()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList list;
|
|
||||||
QString fileName = KGlobal::dirs()->findResource("config", "kwinrc");
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
|
||||||
QFile configFile(fileName);
|
|
||||||
if (!configFile.open(QIODevice::ReadOnly)) return list;
|
|
||||||
|
|
||||||
QString fileStr;
|
|
||||||
QStringList value;
|
|
||||||
bool desktopSection = false;
|
|
||||||
while (true) {
|
|
||||||
fileStr = QString(configFile.readLine()).trimmed();
|
|
||||||
if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
|
|
||||||
if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
|
|
||||||
if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
|
|
||||||
if (fileStr[0] == QChar('[')) desktopSection = false;
|
|
||||||
if (fileStr == QString("[Desktops]")) desktopSection = true;
|
|
||||||
if (desktopSection) {
|
|
||||||
if (fileStr.contains(QChar('='))) {
|
|
||||||
value.clear();
|
|
||||||
for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
|
|
||||||
value.append(fileStr.split(QChar('='))[i]);
|
|
||||||
if (fileStr.split(QChar('='))[0].contains(QString("Name_")))
|
|
||||||
list.append(value.join(QChar('=')));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (configFile.atEnd()) break;
|
|
||||||
}
|
|
||||||
configFile.close();
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<Plasma::Containment *> DesktopPanel::getPanels()
|
QList<Plasma::Containment *> DesktopPanel::getPanels()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -228,6 +191,7 @@ QString DesktopPanel::parsePattern(const QString rawLine, const int num)
|
|||||||
void DesktopPanel::reinit()
|
void DesktopPanel::reinit()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (desktopNames.isEmpty()) return;
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
// labels
|
// labels
|
||||||
@ -274,9 +238,9 @@ void DesktopPanel::changePanelsState()
|
|||||||
|
|
||||||
QList<Plasma::Containment *> panels = getPanels();
|
QList<Plasma::Containment *> panels = getPanels();
|
||||||
for (int i=0; i<panels.count(); i++) {
|
for (int i=0; i<panels.count(); i++) {
|
||||||
if ((configuration[QString("panels")].split(QChar(','))
|
if ((!configuration[QString("panels")].split(QChar(','))
|
||||||
.contains(QString::number(i))) ||
|
.contains(QString::number(i))) &&
|
||||||
(configuration[QString("panels")] == QString("-1")))
|
(configuration[QString("panels")] != QString("-1")))
|
||||||
continue;
|
continue;
|
||||||
bool wasVisible = panels[i]->view()->isVisible();
|
bool wasVisible = panels[i]->view()->isVisible();
|
||||||
int winId = panels[i]->view()->winId();
|
int winId = panels[i]->view()->winId();
|
||||||
@ -337,6 +301,10 @@ void DesktopPanel::dataUpdated(const QString &sourceName, const Plasma::DataEngi
|
|||||||
return;
|
return;
|
||||||
if (sourceName == QString("desktop")) {
|
if (sourceName == QString("desktop")) {
|
||||||
currentDesktop = data[QString("currentNumber")].toInt();
|
currentDesktop = data[QString("currentNumber")].toInt();
|
||||||
|
if (desktopNames.isEmpty()) {
|
||||||
|
desktopNames = data[QString("list")].toString().split(QString(";;"));
|
||||||
|
reinit();
|
||||||
|
}
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,8 +452,6 @@ void DesktopPanel::configChanged()
|
|||||||
configuration[QString("pattern")] = cg.readEntry("pattern", "[$mark$number/$total: $name]");
|
configuration[QString("pattern")] = cg.readEntry("pattern", "[$mark$number/$total: $name]");
|
||||||
configuration[QString("rightStretch")] = cg.readEntry("rightStretch", "2");
|
configuration[QString("rightStretch")] = cg.readEntry("rightStretch", "2");
|
||||||
|
|
||||||
desktopNames = getDesktopNames();
|
|
||||||
|
|
||||||
extsysmonEngine->connectSource(QString("desktop"), this, configuration[QString("interval")].toInt());
|
extsysmonEngine->connectSource(QString("desktop"), this, configuration[QString("interval")].toInt());
|
||||||
|
|
||||||
QString fontFamily = cg.readEntry("currentFontFamily", "Terminus");
|
QString fontFamily = cg.readEntry("currentFontFamily", "Terminus");
|
||||||
|
@ -81,7 +81,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// functions
|
// functions
|
||||||
QStringList getDesktopNames();
|
|
||||||
QList<Plasma::Containment *> getPanels();
|
QList<Plasma::Containment *> getPanels();
|
||||||
QString panelLocationToStr(Plasma::Location loc);
|
QString panelLocationToStr(Plasma::Location loc);
|
||||||
void updateText();
|
void updateText();
|
||||||
|
@ -454,8 +454,7 @@ QMap<QString, QVariant> ExtendedSysMon::getPlayerInfo(const QString playerName,
|
|||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time")) {
|
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time")) {
|
||||||
info[QString("duration")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[0];
|
info[QString("duration")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[0];
|
||||||
info[QString("progress")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[1];
|
info[QString("progress")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[1];
|
||||||
}
|
} else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
|
||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
|
|
||||||
info[QString("title")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
info[QString("title")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -471,8 +470,7 @@ QMap<QString, QVariant> ExtendedSysMon::getPlayerInfo(const QString playerName,
|
|||||||
info[QString("duration")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
info[QString("duration")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("title"))
|
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("title"))
|
||||||
info[QString("title")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
info[QString("title")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int time = qstr.toInt() / 1000;
|
int time = qstr.toInt() / 1000;
|
||||||
info[QString("progress")] = QString::number(time);
|
info[QString("progress")] = QString::number(time);
|
||||||
}
|
}
|
||||||
@ -550,38 +548,31 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
setData(source, QString("custom") + QString::number(i),
|
setData(source, QString("custom") + QString::number(i),
|
||||||
getCustomCmd(configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts)[i]));
|
getCustomCmd(configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts)[i]));
|
||||||
}
|
}
|
||||||
}
|
} else if (source == QString("desktop")) {
|
||||||
else if (source == QString("desktop")) {
|
|
||||||
QMap<QString, QVariant> desktop = getCurrentDesktop(configuration[QString("DESKTOPCMD")]);
|
QMap<QString, QVariant> desktop = getCurrentDesktop(configuration[QString("DESKTOPCMD")]);
|
||||||
for (int i=0; i<desktop.keys().count(); i++)
|
for (int i=0; i<desktop.keys().count(); i++)
|
||||||
setData(source, desktop.keys()[i], desktop[desktop.keys()[i]]);
|
setData(source, desktop.keys()[i], desktop[desktop.keys()[i]]);
|
||||||
}
|
} else if (source == QString("gpu")) {
|
||||||
else if (source == QString("gpu")) {
|
|
||||||
setData(source, QString("GPU"), getGpu(configuration[QString("GPUDEV")]));
|
setData(source, QString("GPU"), getGpu(configuration[QString("GPUDEV")]));
|
||||||
}
|
} else if (source == QString("gputemp")) {
|
||||||
else if (source == QString("gputemp")) {
|
|
||||||
setData(source, QString("GPUTemp"), getGpuTemp(configuration[QString("GPUDEV")]));
|
setData(source, QString("GPUTemp"), getGpuTemp(configuration[QString("GPUDEV")]));
|
||||||
}
|
} else if (source == QString("hddtemp")) {
|
||||||
else if (source == QString("hddtemp")) {
|
|
||||||
QStringList deviceList = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
QStringList deviceList = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
||||||
for (int i=0; i<deviceList.count(); i++)
|
for (int i=0; i<deviceList.count(); i++)
|
||||||
setData(source, deviceList[i],
|
setData(source, deviceList[i],
|
||||||
getHddTemp(configuration[QString("HDDTEMPCMD")], deviceList[i]));
|
getHddTemp(configuration[QString("HDDTEMPCMD")], deviceList[i]));
|
||||||
}
|
} else if (source == QString("pkg")) {
|
||||||
else if (source == QString("pkg")) {
|
|
||||||
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++)
|
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++)
|
||||||
setData(source, QString("pkgCount") + QString::number(i),
|
setData(source, QString("pkgCount") + QString::number(i),
|
||||||
getUpgradeInfo(configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts)[i]));
|
getUpgradeInfo(configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts)[i]));
|
||||||
}
|
} else if (source == QString("player")) {
|
||||||
else if (source == QString("player")) {
|
|
||||||
QMap<QString, QVariant> player = getPlayerInfo(configuration[QString("PLAYER")],
|
QMap<QString, QVariant> player = getPlayerInfo(configuration[QString("PLAYER")],
|
||||||
configuration[QString("MPDADDRESS")],
|
configuration[QString("MPDADDRESS")],
|
||||||
configuration[QString("MPDPORT")],
|
configuration[QString("MPDPORT")],
|
||||||
configuration[QString("MPRIS")]);
|
configuration[QString("MPRIS")]);
|
||||||
for (int i=0; i<player.keys().count(); i++)
|
for (int i=0; i<player.keys().count(); i++)
|
||||||
setData(source, player.keys()[i], player[player.keys()[i]]);
|
setData(source, player.keys()[i], player[player.keys()[i]]);
|
||||||
}
|
} else if (source == QString("ps")) {
|
||||||
else if (source == QString("ps")) {
|
|
||||||
QMap<QString, QVariant> ps = getPsStats();
|
QMap<QString, QVariant> ps = getPsStats();
|
||||||
for (int i=0; i<ps.keys().count(); i++)
|
for (int i=0; i<ps.keys().count(); i++)
|
||||||
setData(source, ps.keys()[i], ps[ps.keys()[i]]);
|
setData(source, ps.keys()[i], ps[ps.keys()[i]]);
|
||||||
|
Reference in New Issue
Block a user