summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorJohann Latocha2011-03-01 23:03:20 +0100
committerJohann Latocha2011-03-01 23:03:20 +0100
commitb796bbc803613c3061b08b6c3c2a9883724f4684 (patch)
tree210892cb3ab8791b019000d4383de8f351edd841 /src/dialog.cpp
parent[Fix] Startup problems with xsession (Quick&Dirty) (diff)
downloadvmchooser-b796bbc803613c3061b08b6c3c2a9883724f4684.tar.gz
vmchooser-b796bbc803613c3061b08b6c3c2a9883724f4684.tar.xz
vmchooser-b796bbc803613c3061b08b6c3c2a9883724f4684.zip
1) cmd-switch to use a window manager
2) openslx logo added
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 0e888cb..f2765ac 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -6,11 +6,21 @@
#include "save_restore_session.h"
#include "sessiontreeitem.h"
-Dialog::Dialog(QWidget *parent)
+Dialog::Dialog(QString windowmgr, QWidget *parent)
: QDialog(parent), ui(new Ui::Dialog) {
model_ = new SessionTreeModel(parent);
ui->setupUi(this);
+ windowmgr_ = new QProcess(this);
+ // start window manager
+ if (windowmgr != "") {
+ windowmgr_->start(windowmgr);
+ windowmgr_->waitForStarted(3000);
+ if (windowmgr_->error() == QProcess::FailedToStart)
+ QMessageBox::warning(this, tr("Warning"),
+ tr("Window manager '") + windowmgr + tr("' couldn't be started!"));
+ }
+
QDBusConnection dbus = QDBusConnection::sessionBus();
ifaceDBus_ = new OrgOpenslxPvsInterface("org.openslx.pvs", "/", dbus, this);
@@ -33,6 +43,8 @@ Dialog::~Dialog() {
delete ui;
delete model_;
delete ifaceDBus_;
+ windowmgr_->terminate();
+ windowmgr_->waitForFinished(3000);
}
void Dialog::changeEvent(QEvent *e) {
@@ -58,12 +70,19 @@ void Dialog::on_treeView_activated(QModelIndex index) {
return;
}
+ setVisible(false);
+ if (s->type() == Session::XSESSION) {
+ windowmgr_->terminate();
+ windowmgr_->waitForFinished(3000);
+ windowmgr_->kill();
+ }
+
if (s->run()) {
if (ifaceDBus_->isValid()) {
writePVSSettings();
}
writeSessionName(s->shortDescription());
- setVisible(false);
+
} else {
QMessageBox::warning(
this, trUtf8("vmchooser"),