From b796bbc803613c3061b08b6c3c2a9883724f4684 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Tue, 1 Mar 2011 23:03:20 +0100 Subject: 1) cmd-switch to use a window manager 2) openslx logo added --- src/dialog.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/dialog.cpp') 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"), -- cgit v1.2.3-55-g7522