From 947133905679e19196663bd9923fd063ae4d5b85 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 9 Jul 2019 11:33:27 +0200 Subject: Gray out and warn about VMs with missing hypervisor --- src/vsession.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/vsession.cpp') diff --git a/src/vsession.cpp b/src/vsession.cpp index 41098b7..78185e4 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -19,6 +19,7 @@ #include "vsession.h" #include "sessionsiconholder.h" #include "userldapdata.h" +#include "virtualizer.h" static QProcess _process; @@ -216,8 +217,14 @@ bool VSession::isLocked() const { return getAttribute(QStringLiteral("locked")).compare(QStringLiteral("true")) == 0; } -bool VSession::isValid() const { - return !getAttribute(QStringLiteral("image_name")).isEmpty(); +QString VSession::checkCanRunInternal() const { + if (getAttribute(QStringLiteral("image_name")).isEmpty()) + return QObject::trUtf8("XML error: image_name is empty"); + const Virtualizer* virt = Virtualizer::get(virtualizer()); + if (!virt->isAvailable) + return QObject::trUtf8("Virtualizer '%1' is not enabled.").arg(virt->id); + // Seems OK + return QString(); } int VSession::priority() const { @@ -359,7 +366,7 @@ bool VSession::needsVtx() const { } QVariant VSession::foregroundRole() const { - if (!g_noVtx || !needsVtx()) + if ((!g_noVtx || !needsVtx()) && canRun()) return Session::foregroundRole(); return QColor(180, 180, 180); } -- cgit v1.2.3-55-g7522