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/dialog.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/dialog.cpp') diff --git a/src/dialog.cpp b/src/dialog.cpp index a0b9a47..d87753a 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -133,6 +133,10 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index) if (s == nullptr) // no valid session has been selected, do nothing return; + // Check preconditions. The method might show error messages and return false + if (!s->canRun(true)) + return; + // These two are up here in case run-virt cares... if (Config::isSet(Config::PVS)) { if (ui->PVS_checkbox->isChecked()) { @@ -203,7 +207,7 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index) centerTimer_->stop(); // Stop the auto-center/auto-quit timer, so we don't kill the session :> setVisible(false); } else { - QMessageBox::warning( + QMessageBox::critical( this, trUtf8("vmchooser"), trUtf8("Vmchooser failed to run the selected session!")); } @@ -232,6 +236,8 @@ void Dialog::addItems(const QList& entries, int tab) { || prev.contains(it->shortDescription())) { matches.append(it); } + // Also check for validity + it->checkCanRun(); } if (!matches.isEmpty()) { addItems(matches, TAB_RECENT_COURSES); -- cgit v1.2.3-55-g7522