From 6cacb1191590223af6afab5c13acc3664b72e8e3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 29 Mar 2016 16:10:31 +0200 Subject: Feature: Show warning for 64bit VMs if no VT-x available --- src/vsession.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/vsession.cpp') diff --git a/src/vsession.cpp b/src/vsession.cpp index f0038aa..3720bb7 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #if 0 #include // available since Qt 4.7 #endif @@ -165,7 +166,7 @@ bool VSession::isActive() const { QString value(getAttribute("active")); if (value.compare("false") == 0) { - if (debugMode) qDebug() << "'" << shortDescription() << "' not active. Reason: active == false"; + if (debugMode) qDebug() << "'" << shortDescription() << "' not active. Reason: active == false"; return false; } else if (value.count("/") == 1) { // try to interpret value as date range @@ -312,6 +313,10 @@ bool VSession::run() const { qDebug() << "Sarting session " << this->getAttribute("short_description", "param") << " ..."; } + if (g_noVtx && is64Bit()) { + QMessageBox::warning(NULL, QObject::trUtf8("Warning"), QObject::trUtf8("The selected session is based on a 64 bit operating system, but this computer doesn't seem to support this (VT-x/AMD-V not supported by CPU, or disabled in BIOS). You will probably get an error message while the virtualizer is initializing.")); + } + QString command = getAttribute("command"); if (!command.isEmpty()) { return QProcess::startDetached(command); @@ -420,6 +425,17 @@ QList VSession::readXmlFile(const QString& filepath) { return retval; } +bool VSession::is64Bit() const { + return imgtype() == VMWARE && getAttribute("os").endsWith("64"); + // TODO: vmbox, qemu-kvm, ... +} + +QVariant VSession::backgroundRole() const { + if (!g_noVtx || !is64Bit()) + return Session::backgroundRole(); + return QColor(200, 200, 200); +} + bool VSession::operator<(const Session& other) const { int p0 = this->priority(); int p1 = other.priority(); -- cgit v1.2.3-55-g7522