diff options
author | Simon Rettberg | 2019-07-09 11:33:27 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-07-09 11:33:27 +0200 |
commit | 947133905679e19196663bd9923fd063ae4d5b85 (patch) | |
tree | 4edc66c64853ce58fbab49e85c547e4e0dea5070 /src/vsession.cpp | |
parent | vsession.*: Use QStringLiteral for most C-Strings (diff) | |
download | vmchooser2-947133905679e19196663bd9923fd063ae4d5b85.tar.gz vmchooser2-947133905679e19196663bd9923fd063ae4d5b85.tar.xz vmchooser2-947133905679e19196663bd9923fd063ae4d5b85.zip |
Gray out and warn about VMs with missing hypervisor
Diffstat (limited to 'src/vsession.cpp')
-rw-r--r-- | src/vsession.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
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); } |