mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-12-18 02:43:42 +00:00
port library
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QNetworkInterface>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
@ -42,7 +43,7 @@ bool AWKeyCache::addKeyToCache(const QString &_type, const QString &_key)
|
||||
|
||||
if (_type == "hdd") {
|
||||
QStringList allDevices = QDir("/dev").entryList(QDir::System, QDir::Name);
|
||||
QStringList devices = allDevices.filter(QRegExp("^[hms]d[a-z]$"));
|
||||
QStringList devices = allDevices.filter(QRegularExpression("^[hms]d[a-z]$"));
|
||||
for (auto &dev : devices) {
|
||||
QString device = QString("/dev/%1").arg(dev);
|
||||
if (cachedValues.contains(device))
|
||||
@ -93,7 +94,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL
|
||||
|
||||
// insert depending keys, refer to AWKeys::calculateValues()
|
||||
// hddtotmb*
|
||||
for (auto &key : _allKeys.filter(QRegExp("^hddtotmb"))) {
|
||||
for (auto &key : _allKeys.filter(QRegularExpression("^hddtotmb"))) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
key.remove("hddtotmb");
|
||||
@ -101,7 +102,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL
|
||||
used << QString("hddfreemb%1").arg(index) << QString("hddmb%1").arg(index);
|
||||
}
|
||||
// hddtotgb*
|
||||
for (auto &key : _allKeys.filter(QRegExp("^hddtotgb"))) {
|
||||
for (auto &key : _allKeys.filter(QRegularExpression("^hddtotgb"))) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
key.remove("hddtotgb");
|
||||
@ -138,7 +139,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL
|
||||
for (auto &key : netKeys) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
QStringList filt = _allKeys.filter(QRegExp(QString("^%1[0-9]{1,}").arg(key)));
|
||||
QStringList filt = _allKeys.filter(QRegularExpression(QString("^%1[0-9]{1,}").arg(key)));
|
||||
for (auto &filtered : filt)
|
||||
used << filtered;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user