summaryrefslogtreecommitdiffstats
path: root/src/vsession.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2016-03-29 16:10:31 +0200
committerSimon Rettberg2016-03-29 16:10:31 +0200
commit6cacb1191590223af6afab5c13acc3664b72e8e3 (patch)
tree94f3e2b29cc645d27716117ec14b965c82c7d311 /src/vsession.cpp
parentdur dur... (diff)
downloadvmchooser2-6cacb1191590223af6afab5c13acc3664b72e8e3.tar.gz
vmchooser2-6cacb1191590223af6afab5c13acc3664b72e8e3.tar.xz
vmchooser2-6cacb1191590223af6afab5c13acc3664b72e8e3.zip
Feature: Show warning for 64bit VMs if no VT-x available
Diffstat (limited to 'src/vsession.cpp')
-rw-r--r--src/vsession.cpp18
1 files changed, 17 insertions, 1 deletions
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 <QThread>
#include <QStringList>
#include <QIcon>
+#include <QMessageBox>
#if 0
#include <QHostInfo> // 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<Session*> 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();