split data engine matchers to classes

This commit is contained in:
2024-04-29 18:09:48 +03:00
parent 3db85cb38f
commit 168385300a
55 changed files with 1544 additions and 201 deletions

View File

@ -0,0 +1,53 @@
/***************************************************************************
* 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;
static Matcher *instance()
{
static auto instance = std::make_unique<Matcher>();
return instance.get();
};
protected:
AWPluginMatcher() = default;
};

View File

@ -0,0 +1,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,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 "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,28 @@
/***************************************************************************
* 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,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,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 "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,28 @@
/***************************************************************************
* 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,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,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 "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,28 @@
/***************************************************************************
* 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,34 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,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 "awpluginmatchergpucore.h"
#include <QRegularExpression>
#include "formatters/formatters.h"
QHash<QString, AWPluginFormaterInterface *> AWPluginMatcherGPUCore::keys(const QString &_source, const KSysGuard::Unit, const AWPluginMatcherSettings &_settings) const
{
auto device = _source;
device.remove("gpu/").remove("/usage");
auto index = _settings.gpu.indexOf(device);
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,28 @@
/***************************************************************************
* 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 device = _source;
device.remove("gpu/").remove("/temperature");
auto index = _settings.gpu.indexOf(device);
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,28 @@
/***************************************************************************
* 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,42 @@
/***************************************************************************
* 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
{
// read speed
auto device = _source;
device.remove("disk/").remove("/read");
auto index = _settings.disk.indexOf(device);
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,28 @@
/***************************************************************************
* 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,42 @@
/***************************************************************************
* 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
{
// read speed
auto device = _source;
device.remove("disk/").remove("/write");
auto index = _settings.disk.indexOf(device);
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,28 @@
/***************************************************************************
* 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,34 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,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 "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,28 @@
/***************************************************************************
* 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,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 "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,28 @@
/***************************************************************************
* 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,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 "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,28 @@
/***************************************************************************
* 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,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,32 @@
/***************************************************************************
* 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,28 @@
/***************************************************************************
* 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,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,65 @@
/***************************************************************************
* 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 "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 "awpluginmatcherhddread.h"
#include "awpluginmatcherhddwrite.h"
#include "awpluginmatcherloadaverage.h"
#include "awpluginmatchermemoryapplication.h"
#include "awpluginmatchermemoryfree.h"
#include "awpluginmatchermemoryused.h"
#include "awpluginmatchernetworkdevice.h"
#include "awpluginmatchernetworkssid.h"
namespace AWPluginMatchers {
static QList<AWPluginMatcherInterface *> matchers = {
AWPluginMatcherAC::instance(),
AWPluginMatcherBattery::instance(),
AWPluginMatcherCPU::instance(),
AWPluginMatcherCPUCore::instance(),
AWPluginMatcherCPUFrequency::instance(),
AWPluginMatcherCPUFrequencyCore::instance(),
AWPluginMatcherCustom::instance(),
AWPluginMatcherDesktop::instance(),
AWPluginMatcherDesktopCount::instance(),
AWPluginMatcherDesktopNumber::instance(),
AWPluginMatcherGPU::instance(),
AWPluginMatcherGPUCore::instance(),
AWPluginMatcherGPUTemperature::instance(),
AWPluginMatcherHDDRead::instance(),
AWPluginMatcherHDDWrite::instance(),
AWPluginMatcherLoadAverage::instance(),
AWPluginMatcherMemoryApplication::instance(),
AWPluginMatcherMemoryFree::instance(),
AWPluginMatcherMemoryUsed::instance(),
AWPluginMatcherNetworkDevice::instance(),
AWPluginMatcherNetworkSSID::instance(),
};
};