summaryrefslogtreecommitdiffstats
path: root/src/vsession.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-09 11:33:27 +0200
committerSimon Rettberg2019-07-09 11:33:27 +0200
commit947133905679e19196663bd9923fd063ae4d5b85 (patch)
tree4edc66c64853ce58fbab49e85c547e4e0dea5070 /src/vsession.cpp
parentvsession.*: Use QStringLiteral for most C-Strings (diff)
downloadvmchooser2-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.cpp13
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);
}