diff options
Diffstat (limited to 'src/shared')
| -rw-r--r-- | src/shared/util.cpp | 41 | ||||
| -rw-r--r-- | src/shared/util.h | 6 |
2 files changed, 29 insertions, 18 deletions
diff --git a/src/shared/util.cpp b/src/shared/util.cpp index 441b64bd..4ee4b766 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -1264,7 +1264,7 @@ std::vector<SecurityProduct> Environment::getSecurityProductsFromWMI() const map.insert({
guid,
- {QString::fromStdWString(name), provider, active, upToDate}});
+ {guid, QString::fromStdWString(name), provider, active, upToDate}});
};
{
@@ -1334,7 +1334,7 @@ std::optional<SecurityProduct> Environment::getWindowsFirewall() const }
return SecurityProduct(
- "Windows Firewall", WSC_SECURITY_PROVIDER_FIREWALL, true, true);
+ {}, "Windows Firewall", WSC_SECURITY_PROVIDER_FIREWALL, true, true);
}
@@ -1907,9 +1907,9 @@ std::optional<bool> WindowsInfo::getElevated() const SecurityProduct::SecurityProduct(
- QString name, int provider,
+ QUuid guid, QString name, int provider,
bool active, bool upToDate) :
- m_name(std::move(name)), m_provider(provider),
+ m_guid(std::move(guid)), m_name(std::move(name)), m_provider(provider),
m_active(active), m_upToDate(upToDate)
{
}
@@ -1938,10 +1938,27 @@ QString SecurityProduct::toString() const {
QString s;
- s += m_name + " ";
+ s += m_name + " (" + providerToString() + ")";
+ if (!m_active) {
+ s += ", inactive";
+ }
+
+ if (!m_upToDate) {
+ s += ", definitions outdated";
+ }
+
+ if (!m_guid.isNull()) {
+ s += ", " + m_guid.toString(QUuid::QUuid::WithoutBraces);
+ }
+
+ return s;
+}
+QString SecurityProduct::providerToString() const
+{
QStringList ps;
+
if (m_provider & WSC_SECURITY_PROVIDER_FIREWALL) {
ps.push_back("firewall");
}
@@ -1971,20 +1988,10 @@ QString SecurityProduct::toString() const }
if (ps.empty()) {
- s += "(doesn't provide anything)";
- } else {
- s += "(" + ps.join("|") + ")";
- }
-
- if (!m_active) {
- s += ", inactive";
- }
-
- if (!m_upToDate) {
- s += ", definitions outdated";
+ return "doesn't provider anything";
}
- return s;
+ return ps.join("|");
}
diff --git a/src/shared/util.h b/src/shared/util.h index fc2028db..46764367 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -28,6 +28,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <Windows.h>
#include <versioninfo.h>
+#include <QUuid>
class Executable;
@@ -370,7 +371,7 @@ class SecurityProduct {
public:
SecurityProduct(
- QString name, int provider,
+ QUuid guid, QString name, int provider,
bool active, bool upToDate);
// display name of the product
@@ -394,10 +395,13 @@ public: QString toString() const;
private:
+ QUuid m_guid;
QString m_name;
int m_provider;
bool m_active;
bool m_upToDate;
+
+ QString providerToString() const;
};
|
