refactor: split formatters and matchers into separated singleton classes (#166)

* split formatter into separated singleton classes

* split data engine matchers to classes

* nodiscard attribute for formatter methods

* small refactoring in matchers

* fix codefactor warnings

* fix test building
This commit is contained in:
2024-04-30 21:52:39 +03:00
parent 95572364c1
commit 64b4618904
182 changed files with 4928 additions and 766 deletions

View File

@ -0,0 +1,63 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include <ksysguard/formatter/Unit.h>
#include <QHash>
#include <memory>
#include "awpluginmatchersettings.h"
class AWPluginFormaterInterface;
class AWPluginMatcherInterface
{
public:
virtual ~AWPluginMatcherInterface() = default;
[[nodiscard]] virtual QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit _units, const AWPluginMatcherSettings &_settings) const = 0;
[[nodiscard]] virtual bool matches(const QString &_source) const = 0;
};
template <typename Matcher> class AWPluginMatcher : public AWPluginMatcherInterface
{
public:
AWPluginMatcher(AWPluginMatcher &) = delete;
void operator=(const AWPluginMatcher &) = delete;
[[nodiscard]] static Matcher *instance()
{
static auto instance = std::make_unique<Matcher>();
return instance.get();
};
[[nodiscard]] static QString device(const QString &_source) { return _source.split('/')[1]; };
[[nodiscard]] static qsizetype index(const QString &_source, const QStringList &_devices)
{
auto device = AWPluginMatcher::device(_source);
return _devices.indexOf(device);
}
protected:
AWPluginMatcher() = default;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherac.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherAC::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"ac", AWPluginFormatterAC::instance()}};
}
bool AWPluginMatcherAC::matches(const QString &_source) const
{
return _source == "extsysmon/battery/ac";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherAC : public AWPluginMatcher<AWPluginMatcherAC>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,38 @@
/***************************************************************************
* 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 "awpluginmatcherbattery.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherBattery::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("extsysmon/battery/");
if (key.contains("rate"))
return {{key, AWPluginFormatterFloat::instance()}};
return {{key, AWPluginFormatterIntegerShort::instance()}};
}
bool AWPluginMatcherBattery::matches(const QString &_source) const
{
return _source.startsWith("extsysmon/battery/");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherBattery : public AWPluginMatcher<AWPluginMatcherBattery>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherbrightness.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherBrightness::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"brightness", AWPluginFormatterIntegerShort::instance()}};
}
bool AWPluginMatcherBrightness::matches(const QString &_source) const
{
return _source == "extsysmon/system/brightness";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherBrightness : public AWPluginMatcher<AWPluginMatcherBrightness>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatchercpu.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherCPU::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"cpu", AWPluginFormatterFloat::instance()}};
}
bool AWPluginMatcherCPU::matches(const QString &_source) const
{
return _source == "cpu/all/usage";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherCPU : public AWPluginMatcher<AWPluginMatcherCPU>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,38 @@
/***************************************************************************
* 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 "awpluginmatchercpucore.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherCPUCore::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("cpu/").remove("/usage");
return {{key, AWPluginFormatterFloat::instance()}};
}
bool AWPluginMatcherCPUCore::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^cpu/cpu.*/usage$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherCPUCore : public AWPluginMatcher<AWPluginMatcherCPUCore>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatchercpufrequency.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherCPUFrequency::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"cpucl", AWPluginFormatterInteger::instance()}};
}
bool AWPluginMatcherCPUFrequency::matches(const QString &_source) const
{
return _source == "cpu/all/averageFrequency";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherCPUFrequency : public AWPluginMatcher<AWPluginMatcherCPUFrequency>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,39 @@
/***************************************************************************
* 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 "awpluginmatchercpufrequencycore.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherCPUFrequencyCore::keys(const QString &_source,
const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto index = _source;
index.remove("cpu/cpu").remove("/frequency");
return {{QString("cpucl%1").arg(index), AWPluginFormatterInteger::instance()}};
}
bool AWPluginMatcherCPUFrequencyCore::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^cpu/cpu.*/frequency$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherCPUFrequencyCore : public AWPluginMatcher<AWPluginMatcherCPUFrequencyCore>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,35 @@
/***************************************************************************
* 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 "awpluginmatchercustom.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherCustom::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("extsysmon/custom/");
return {{key, AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherCustom::matches(const QString &_source) const
{
return _source.startsWith("extsysmon/custom/");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherCustom : public AWPluginMatcher<AWPluginMatcherCustom>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherdesktop.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherDesktop::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"desktop", AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherDesktop::matches(const QString &_source) const
{
return _source == "extsysmon/desktop/name";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherDesktop : public AWPluginMatcher<AWPluginMatcherDesktop>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherdesktopcount.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherDesktopCount::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"tdesktops", AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherDesktopCount::matches(const QString &_source) const
{
return _source == "extsysmon/desktop/count";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherDesktopCount : public AWPluginMatcher<AWPluginMatcherDesktopCount>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherdesktopnumber.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherDesktopNumber::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"ndesktop", AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherDesktopNumber::matches(const QString &_source) const
{
return _source == "extsysmon/desktop/number";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherDesktopNumber : public AWPluginMatcher<AWPluginMatcherDesktopNumber>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatchergpu.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherGPU::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"gpu", AWPluginFormatterFloat::instance()}};
}
bool AWPluginMatcherGPU::matches(const QString &_source) const
{
return _source == "gpu/all/usage";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherGPU : public AWPluginMatcher<AWPluginMatcherGPU>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,40 @@
/***************************************************************************
* 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 "awpluginmatchergpucore.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherGPUCore::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.gpu);
if (index == -1)
return {};
return {{QString("gpu%1").arg(index), AWPluginFormatterFloat::instance()}};
}
bool AWPluginMatcherGPUCore::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^gpu/gpu.*/usage$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherGPUCore : public AWPluginMatcher<AWPluginMatcherGPUCore>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,41 @@
/***************************************************************************
* 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 "awpluginmatchergputemperature.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *>
AWPluginMatcherGPUTemperature::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.gpu);
if (index == -1)
return {};
return {{QString("gputemp%1").arg(index), AWPluginFormatterTemperature::instance()}};
}
bool AWPluginMatcherGPUTemperature::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^gpu/gpu.*/temperature$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherGPUTemperature : public AWPluginMatcher<AWPluginMatcherGPUTemperature>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,40 @@
/***************************************************************************
* 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 "awpluginmatcherhdd.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherHDD::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.disk);
if (index == -1)
return {};
return {{QString("hdd%1").arg(index), AWPluginFormatterFloat::instance()}};
}
bool AWPluginMatcherHDD::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^disk/.*/usedPercent$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherHDD : public AWPluginMatcher<AWPluginMatcherHDD>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,43 @@
/***************************************************************************
* 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 "awpluginmatcherhddfree.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherHDDFree::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.disk);
if (index == -1)
return {};
return {
{QString("hddfreemb%1").arg(index), AWPluginFormatterMemoryMB::instance()},
{QString("hddfreegb%1").arg(index), AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherHDDFree::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^disk/.*/free$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherHDDFree : public AWPluginMatcher<AWPluginMatcherHDDFree>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,40 @@
/***************************************************************************
* 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 "awpluginmatcherhddread.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherHDDRead::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.disk);
if (index == -1)
return {};
return {{QString("hddr%1").arg(index), AWPluginFormatterMemory::instance()}};
}
bool AWPluginMatcherHDDRead::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^disk/.*/read$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherHDDRead : public AWPluginMatcher<AWPluginMatcherHDDRead>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,44 @@
/***************************************************************************
* 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 "awpluginmatcherhddtotal.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *>
AWPluginMatcherHDDTotal::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.disk);
if (index == -1)
return {};
return {
{QString("hddtotmb%1").arg(index), AWPluginFormatterMemoryMB::instance()},
{QString("hddtotgb%1").arg(index), AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherHDDTotal::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^disk/.*/total$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherHDDTotal : public AWPluginMatcher<AWPluginMatcherHDDTotal>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,43 @@
/***************************************************************************
* 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 "awpluginmatcherhddused.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherHDDUsed::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.disk);
if (index == -1)
return {};
return {
{QString("hddmb%1").arg(index), AWPluginFormatterMemoryMB::instance()},
{QString("hddgb%1").arg(index), AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherHDDUsed::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^disk/.*/used$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherHDDUsed : public AWPluginMatcher<AWPluginMatcherHDDUsed>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,41 @@
/***************************************************************************
* 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 "awpluginmatcherhddwrite.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *>
AWPluginMatcherHDDWrite::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.disk);
if (index == -1)
return {};
return {{QString("hddw%1").arg(index), AWPluginFormatterMemory::instance()}};
}
bool AWPluginMatcherHDDWrite::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^disk/.*/write$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherHDDWrite : public AWPluginMatcher<AWPluginMatcherHDDWrite>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,35 @@
/***************************************************************************
* 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 "awpluginmatcherload.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherLoad::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("extsysmon/load/");
return {{key, AWPluginFormatterInteger::instance()}};
}
bool AWPluginMatcherLoad::matches(const QString &_source) const
{
return _source.startsWith("extsysmon/load/");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherLoad : public AWPluginMatcher<AWPluginMatcherLoad>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,35 @@
/***************************************************************************
* 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 "awpluginmatcherloadaverage.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *>
AWPluginMatcherLoadAverage::keys(const QString &_source, const KSysGuard::Unit, const AWPluginMatcherSettings &) const
{
auto time = _source;
time.remove("cpu/loadaverages/loadaverage");
return {{QString("la%1").arg(time), AWPluginFormatterFloatPrecise::instance()}};
}
bool AWPluginMatcherLoadAverage::matches(const QString &_source) const
{
return _source.startsWith("cpu/loadaverages/loadaverage");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherLoadAverage : public AWPluginMatcher<AWPluginMatcherLoadAverage>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatchermemory.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherMemory::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"mem", AWPluginFormatterFloat::instance()}};
}
bool AWPluginMatcherMemory::matches(const QString &_source) const
{
return _source == "memory/physical/usedPercent";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherMemory : public AWPluginMatcher<AWPluginMatcherMemory>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,36 @@
/***************************************************************************
* 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 "awpluginmatchermemoryapplication.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *>
AWPluginMatcherMemoryApplication::keys(const QString &, const KSysGuard::Unit, const AWPluginMatcherSettings &) const
{
return {
{"memmb", AWPluginFormatterMemoryMB::instance()},
{"memgb", AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherMemoryApplication::matches(const QString &_source) const
{
return _source == "memory/physical/application";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherMemoryApplication : public AWPluginMatcher<AWPluginMatcherMemoryApplication>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,36 @@
/***************************************************************************
* 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 "awpluginmatchermemoryfree.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherMemoryFree::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {
{"memfreemb", AWPluginFormatterMemoryMB::instance()},
{"memfreegb", AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherMemoryFree::matches(const QString &_source) const
{
return _source == "memory/physical/free";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherMemoryFree : public AWPluginMatcher<AWPluginMatcherMemoryFree>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,36 @@
/***************************************************************************
* 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 "awpluginmatchermemorytotal.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherMemoryTotal::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {
{"memtotmb", AWPluginFormatterMemoryMB::instance()},
{"memtotgb", AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherMemoryTotal::matches(const QString &_source) const
{
return _source == "memory/physical/total";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherMemoryTotal : public AWPluginMatcher<AWPluginMatcherMemoryTotal>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,36 @@
/***************************************************************************
* 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 "awpluginmatchermemoryused.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherMemoryUsed::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {
{"memusedmb", AWPluginFormatterMemoryMB::instance()},
{"memusedgb", AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherMemoryUsed::matches(const QString &_source) const
{
return _source == "memory/physical/used";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherMemoryUsed : public AWPluginMatcher<AWPluginMatcherMemoryUsed>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,45 @@
/***************************************************************************
* 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 "awpluginmatchernetwork.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherNetwork::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.network);
if (index == -1)
return {};
auto type = _source.endsWith("download") ? "down" : "up";
return {
{QString("%1%2").arg(type).arg(index), AWPluginFormatterNet::instance()},
{QString("%1kb%2").arg(type).arg(index), AWPluginFormatterMemory::instance()},
{QString("%1units%2").arg(type).arg(index), AWPluginFormatterNetUnits::instance()},
};
}
bool AWPluginMatcherNetwork::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^network/.*/(download|upload)$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherNetwork : public AWPluginMatcher<AWPluginMatcherNetwork>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatchernetworkdevice.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherNetworkDevice::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"netdev", AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherNetworkDevice::matches(const QString &_source) const
{
return _source == "extsysmon/network/device";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherNetworkDevice : public AWPluginMatcher<AWPluginMatcherNetworkDevice>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatchernetworkssid.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherNetworkSSID::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"ssid", AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherNetworkSSID::matches(const QString &_source) const
{
return _source == "extsysmon/network/ssid";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherNetworkSSID : public AWPluginMatcher<AWPluginMatcherNetworkSSID>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,45 @@
/***************************************************************************
* 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 "awpluginmatchernetworktotal.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *>
AWPluginMatcherNetworkTotal::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &_settings) const
{
auto index = AWPluginMatcher::index(_source, _settings.network);
if (index == -1)
return {};
auto type = _source.endsWith("Download") ? "down" : "up";
return {
{QString("%1tot%2").arg(type).arg(index), AWPluginFormatterMemoryMB::instance()},
{QString("%1totkb%2").arg(type).arg(index), AWPluginFormatterMemory::instance()},
};
}
bool AWPluginMatcherNetworkTotal::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^network/.*/(totalDownload|totalUpload)$");
return _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherNetworkTotal : public AWPluginMatcher<AWPluginMatcherNetworkTotal>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,35 @@
/***************************************************************************
* 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 "awpluginmatcherplayer.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherPlayer::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("extsysmon/player/");
return {{key, AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherPlayer::matches(const QString &_source) const
{
return _source.startsWith("extsysmon/player/");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherPlayer : public AWPluginMatcher<AWPluginMatcherPlayer>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherps.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherPS::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"pscount", AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherPS::matches(const QString &_source) const
{
return _source == "extsysmon/ps/running";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherPS : public AWPluginMatcher<AWPluginMatcherPS>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherpsprocesses.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherPSProcesses::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"ps", AWPluginFormatterList::instance()}};
}
bool AWPluginMatcherPSProcesses::matches(const QString &_source) const
{
return _source == "extsysmon/ps/list";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherPSProcesses : public AWPluginMatcher<AWPluginMatcherPSProcesses>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherpstotal.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherPSTotal::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"count", AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherPSTotal::matches(const QString &_source) const
{
return _source == "extsysmon/ps/count";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherPSTotal : public AWPluginMatcher<AWPluginMatcherPSTotal>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,35 @@
/***************************************************************************
* 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 "awpluginmatcherquotes.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherQuotes::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("extsysmon/quotes/");
return {{key, AWPluginFormatterDouble::instance()}};
}
bool AWPluginMatcherQuotes::matches(const QString &_source) const
{
return _source.startsWith("extsysmon/quotes/");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherQuotes : public AWPluginMatcher<AWPluginMatcherQuotes>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,35 @@
/***************************************************************************
* 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 "awpluginmatcherrequest.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherRequest::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("extsysmon/requests/");
return {{key, AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherRequest::matches(const QString &_source) const
{
return _source.startsWith("extsysmon/requests/");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherRequest : public AWPluginMatcher<AWPluginMatcherRequest>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,44 @@
/***************************************************************************
* 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 "awpluginmatchersensors.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherSensors::keys(const QString &_source, KSysGuard::Unit _units,
const AWPluginMatcherSettings &_settings) const
{
// temperature
auto index = _settings.sensors.indexOf(_source);
auto key = QString("temp%1").arg(index);
if (index == -1)
return {};
if (_units == KSysGuard::UnitCelsius)
return {{key, AWPluginFormatterTemperature::instance()}};
return {{key, AWPluginFormatterInteger::instance()}};
}
bool AWPluginMatcherSensors::matches(const QString &_source) const
{
static auto regexp = QRegularExpression("^cpu/cpu.*/temperature$");
return _source.startsWith("lmsensors/") || _source == "cpu/all/averageTemperature" || _source.contains(regexp);
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherSensors : public AWPluginMatcher<AWPluginMatcherSensors>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *>
keys(const QString &_source, KSysGuard::Unit _units, const AWPluginMatcherSettings &_settings) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,30 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include <QStringList>
struct AWPluginMatcherSettings {
// devices
QStringList disk;
QStringList gpu;
QStringList mount;
QStringList network;
QStringList sensors;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcherswap.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherSwap::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"swap", AWPluginFormatterFloat::instance()}};
}
bool AWPluginMatcherSwap::matches(const QString &_source) const
{
return _source == "memory/swap/usedPercent";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherSwap : public AWPluginMatcher<AWPluginMatcherSwap>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,36 @@
/***************************************************************************
* 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 "awpluginmatcherswapfree.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherSwapFree::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {
{"swapfreemb", AWPluginFormatterMemoryMB::instance()},
{"swapfreegb", AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherSwapFree::matches(const QString &_source) const
{
return _source == "memory/swap/free";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherSwapFree : public AWPluginMatcher<AWPluginMatcherSwapFree>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,36 @@
/***************************************************************************
* 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 "awpluginmatcherswaptotal.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherSwapTotal::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {
{"swaptotmb", AWPluginFormatterMemoryMB::instance()},
{"swaptotgb", AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherSwapTotal::matches(const QString &_source) const
{
return _source == "memory/swap/total";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherSwapTotal : public AWPluginMatcher<AWPluginMatcherSwapTotal>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,36 @@
/***************************************************************************
* 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 "awpluginmatcherswapused.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherSwapUsed::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {
{"swapmb", AWPluginFormatterMemoryMB::instance()},
{"swapgb", AWPluginFormatterMemoryGB::instance()},
};
}
bool AWPluginMatcherSwapUsed::matches(const QString &_source) const
{
return _source == "memory/swap/used";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherSwapUsed : public AWPluginMatcher<AWPluginMatcherSwapUsed>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,37 @@
/***************************************************************************
* 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 "awpluginmatchertime.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherTime::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {
{"time", AWPluginFormatterTime::instance()}, {"ctime", AWPluginFormatterTimeCustom::instance()},
{"isotime", AWPluginFormatterTimeISO::instance()}, {"longtime", AWPluginFormatterTimeLong::instance()},
{"shorttime", AWPluginFormatterTimeShort::instance()}, {"tstime", AWPluginFormatterNoFormat::instance()},
};
}
bool AWPluginMatcherTime::matches(const QString &_source) const
{
return _source == "extsysmon/time/now";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherTime : public AWPluginMatcher<AWPluginMatcherTime>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,35 @@
/***************************************************************************
* 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 "awpluginmatcherupgrade.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherUpgrade::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("extsysmon/upgrade/");
return {{key, AWPluginFormatterIntegerShort::instance()}};
}
bool AWPluginMatcherUpgrade::matches(const QString &_source) const
{
return _source.startsWith("extsysmon/upgrade/");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherUpgrade : public AWPluginMatcher<AWPluginMatcherUpgrade>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatcheruptime.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherUptime::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"uptime", AWPluginFormatterUptime::instance()}};
}
bool AWPluginMatcherUptime::matches(const QString &_source) const
{
return _source == "os/system/uptime";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherUptime : public AWPluginMatcher<AWPluginMatcherUptime>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,33 @@
/***************************************************************************
* 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 "awpluginmatchervolume.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherVolume::keys(const QString &, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
return {{"volume", AWPluginFormatterIntegerShort::instance()}};
}
bool AWPluginMatcherVolume::matches(const QString &_source) const
{
return _source == "extsysmon/system/volume";
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherVolume : public AWPluginMatcher<AWPluginMatcherVolume>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,38 @@
/***************************************************************************
* 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 "awpluginmatcherweather.h"
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherWeather::keys(const QString &_source, const KSysGuard::Unit,
const AWPluginMatcherSettings &) const
{
auto key = _source;
key.remove("extsysmon/weather/");
if (key.startsWith("temperature"))
return {{key, AWPluginFormatterTemperature::instance()}};
return {{key, AWPluginFormatterNoFormat::instance()}};
}
bool AWPluginMatcherWeather::matches(const QString &_source) const
{
return _source.startsWith("extsysmon/weather/");
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* 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/ *
***************************************************************************/
#pragma once
#include "awpluginmatcher.h"
class AWPluginMatcherWeather : public AWPluginMatcher<AWPluginMatcherWeather>
{
public:
[[nodiscard]] QHash<QString, AWPluginFormaterInterface *> keys(const QString &_source, KSysGuard::Unit,
const AWPluginMatcherSettings &) const override;
[[nodiscard]] bool matches(const QString &_source) const override;
};

View File

@ -0,0 +1,118 @@
/***************************************************************************
* 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 "awpluginmatcherac.h"
#include "awpluginmatcherbattery.h"
#include "awpluginmatcherbrightness.h"
#include "awpluginmatchercpu.h"
#include "awpluginmatchercpucore.h"
#include "awpluginmatchercpufrequency.h"
#include "awpluginmatchercpufrequencycore.h"
#include "awpluginmatchercustom.h"
#include "awpluginmatcherdesktop.h"
#include "awpluginmatcherdesktopcount.h"
#include "awpluginmatcherdesktopnumber.h"
#include "awpluginmatchergpu.h"
#include "awpluginmatchergpucore.h"
#include "awpluginmatchergputemperature.h"
#include "awpluginmatcherhdd.h"
#include "awpluginmatcherhddfree.h"
#include "awpluginmatcherhddread.h"
#include "awpluginmatcherhddtotal.h"
#include "awpluginmatcherhddused.h"
#include "awpluginmatcherhddwrite.h"
#include "awpluginmatcherload.h"
#include "awpluginmatcherloadaverage.h"
#include "awpluginmatchermemory.h"
#include "awpluginmatchermemoryapplication.h"
#include "awpluginmatchermemoryfree.h"
#include "awpluginmatchermemorytotal.h"
#include "awpluginmatchermemoryused.h"
#include "awpluginmatchernetwork.h"
#include "awpluginmatchernetworkdevice.h"
#include "awpluginmatchernetworkssid.h"
#include "awpluginmatchernetworktotal.h"
#include "awpluginmatcherplayer.h"
#include "awpluginmatcherps.h"
#include "awpluginmatcherpsprocesses.h"
#include "awpluginmatcherpstotal.h"
#include "awpluginmatcherquotes.h"
#include "awpluginmatcherrequest.h"
#include "awpluginmatchersensors.h"
#include "awpluginmatcherswap.h"
#include "awpluginmatcherswapfree.h"
#include "awpluginmatcherswaptotal.h"
#include "awpluginmatcherswapused.h"
#include "awpluginmatchertime.h"
#include "awpluginmatcherupgrade.h"
#include "awpluginmatcheruptime.h"
#include "awpluginmatchervolume.h"
#include "awpluginmatcherweather.h"
namespace AWPluginMatchers
{
static QList<AWPluginMatcherInterface *> matchers = {
AWPluginMatcherAC::instance(),
AWPluginMatcherBattery::instance(),
AWPluginMatcherBrightness::instance(),
AWPluginMatcherCPU::instance(),
AWPluginMatcherCPUCore::instance(),
AWPluginMatcherCPUFrequency::instance(),
AWPluginMatcherCPUFrequencyCore::instance(),
AWPluginMatcherCustom::instance(),
AWPluginMatcherDesktop::instance(),
AWPluginMatcherDesktopCount::instance(),
AWPluginMatcherDesktopNumber::instance(),
AWPluginMatcherGPU::instance(),
AWPluginMatcherGPUCore::instance(),
AWPluginMatcherGPUTemperature::instance(),
AWPluginMatcherHDD::instance(),
AWPluginMatcherHDDFree::instance(),
AWPluginMatcherHDDRead::instance(),
AWPluginMatcherHDDTotal::instance(),
AWPluginMatcherHDDUsed::instance(),
AWPluginMatcherHDDWrite::instance(),
AWPluginMatcherLoad::instance(),
AWPluginMatcherLoadAverage::instance(),
AWPluginMatcherMemory::instance(),
AWPluginMatcherMemoryApplication::instance(),
AWPluginMatcherMemoryFree::instance(),
AWPluginMatcherMemoryTotal::instance(),
AWPluginMatcherMemoryUsed::instance(),
AWPluginMatcherNetwork::instance(),
AWPluginMatcherNetworkDevice::instance(),
AWPluginMatcherNetworkSSID::instance(),
AWPluginMatcherNetworkTotal::instance(),
AWPluginMatcherPlayer::instance(),
AWPluginMatcherPS::instance(),
AWPluginMatcherPSProcesses::instance(),
AWPluginMatcherPSTotal::instance(),
AWPluginMatcherQuotes::instance(),
AWPluginMatcherRequest::instance(),
AWPluginMatcherSensors::instance(),
AWPluginMatcherSwap::instance(),
AWPluginMatcherSwapFree::instance(),
AWPluginMatcherSwapTotal::instance(),
AWPluginMatcherSwapUsed::instance(),
AWPluginMatcherTime::instance(),
AWPluginMatcherUpgrade::instance(),
AWPluginMatcherUptime::instance(),
AWPluginMatcherVolume::instance(),
AWPluginMatcherWeather::instance(),
};
};