diff options
author | Johann Latocha | 2011-03-02 19:03:03 +0100 |
---|---|---|
committer | Johann Latocha | 2011-03-02 19:03:03 +0100 |
commit | 34e46ac3dfefbf0494d45c692bf2f625afc5e6ea (patch) | |
tree | d85d086c5252b02479284005ead0bcaa2ed05472 /src/dialog.cpp | |
parent | window manager intergration removed (diff) | |
download | vmchooser-34e46ac3dfefbf0494d45c692bf2f625afc5e6ea.tar.gz vmchooser-34e46ac3dfefbf0494d45c692bf2f625afc5e6ea.tar.xz vmchooser-34e46ac3dfefbf0494d45c692bf2f625afc5e6ea.zip |
* dbus interface removed
* write pvs config directly
* use "vmchooser --pvs"
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r-- | src/dialog.cpp | 103 |
1 files changed, 39 insertions, 64 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp index 6100d8c..98a60e8 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -1,6 +1,7 @@ #include "dialog.h" #include <QMessageBox> +#include <QDebug> #include "ui_dialog.h" #include "save_restore_session.h" @@ -11,28 +12,13 @@ Dialog::Dialog(QWidget *parent) model_ = new SessionTreeModel(parent); ui->setupUi(this); - QDBusConnection dbus = QDBusConnection::sessionBus(); - ifaceDBus_ = new OrgOpenslxPvsInterface("org.openslx.pvs", "/", dbus, this); - - if (ifaceDBus_->isValid()) { - // PVS is running - QStringList accessOptions; - accessOptions <<trUtf8("None") << trUtf8("View Only") << - trUtf8("Full"); - ui->comboBoxLecturer->insertItems(0, accessOptions); - ui->comboBoxOthers->insertItems(0, accessOptions); - - readPVSSettings(); - ui->PVSOptionsGroupBox->show(); - } else { - ui->PVSOptionsGroupBox->hide(); - } + pvsSettings_ = NULL; + ui->PVSOptionsGroupBox->hide(); } Dialog::~Dialog() { delete ui; delete model_; - delete ifaceDBus_; } void Dialog::changeEvent(QEvent *e) { @@ -59,9 +45,7 @@ void Dialog::on_treeView_activated(QModelIndex index) { } if (s->run()) { - if (ifaceDBus_->isValid()) { - writePVSSettings(); - } + writePVSSettings(); writeSessionName(s->shortDescription()); setVisible(false); @@ -74,7 +58,6 @@ void Dialog::on_treeView_activated(QModelIndex index) { void Dialog::addItems(const QList<Session*>& entries, const QString& section) { this->model_->addItems(entries, section); - ui->treeView->setModel(model_); ui->treeView->expandAll(); } @@ -88,66 +71,48 @@ void Dialog::on_pushButtonStart_clicked() { } void Dialog::readPVSSettings() { - QDBusPendingReply<QString> reply; - - reply = ifaceDBus_->getConfigValue("Permissions/vnc_lecturer"); - reply.waitForFinished(); - if (reply.isValid()) { - if (reply.value() == "rw") { - ui->comboBoxLecturer->setCurrentIndex(2); - } else if (reply.value() == "ro") { - ui->comboBoxLecturer->setCurrentIndex(1); - } else { - ui->comboBoxLecturer->setCurrentIndex(0); - } + if (!pvsSettings_) return; + QString value; + + value = pvsSettings_->value("Permissions/vnc_lecturer").toString(); + if (value == "rw") { + ui->comboBoxLecturer->setCurrentIndex(2); + } else if (value == "ro") { + ui->comboBoxLecturer->setCurrentIndex(1); + } else { + ui->comboBoxLecturer->setCurrentIndex(0); } - reply = ifaceDBus_->getConfigValue("Permissions/vnc_other"); - reply.waitForFinished(); - if (reply.isValid()) { - if (reply.value() == "rw") { - ui->comboBoxOthers->setCurrentIndex(2); - } else if (reply.value() == "ro") { - ui->comboBoxOthers->setCurrentIndex(1); - } else { - ui->comboBoxOthers->setCurrentIndex(0); - } + value = pvsSettings_->value("Permissions/vnc_other").toString(); + if (value == "rw") { + ui->comboBoxOthers->setCurrentIndex(2); + } else if (value == "ro") { + ui->comboBoxOthers->setCurrentIndex(1); + } else { + ui->comboBoxOthers->setCurrentIndex(0); } - - reply = ifaceDBus_->getConfigValue("Permissions/allow_chat"); - reply.waitForFinished(); - if (reply.isValid()) - ui->checkBoxChat->setChecked(reply.value() == "T"); - - reply = ifaceDBus_->getConfigValue("Permissions/allow_filetransfer"); - reply.waitForFinished(); - if (reply.isValid()) - ui->checkBoxFileTransfer->setChecked(reply.value() == "T"); } void Dialog::writePVSSettings() { + if (!pvsSettings_) return; int accessLecturer = ui->comboBoxLecturer->currentIndex(); if (accessLecturer == 2) { - ifaceDBus_->setConfigValue("Permissions/vnc_lecturer", "rw"); + pvsSettings_->setValue("Permissions/vnc_lecturer", "rw"); } else if (accessLecturer == 1) { - ifaceDBus_->setConfigValue("Permissions/vnc_lecturer", "ro"); + pvsSettings_->setValue("Permissions/vnc_lecturer", "ro"); } else { - ifaceDBus_->setConfigValue("Permissions/vnc_lecturer", "no"); + pvsSettings_->setValue("Permissions/vnc_lecturer", "no"); } int accessOthers = ui->comboBoxOthers->currentIndex(); if (accessOthers == 2) { - ifaceDBus_->setConfigValue("Permissions/vnc_other", "rw"); + pvsSettings_->setValue("Permissions/vnc_other", "rw"); } else if (accessOthers == 1) { - ifaceDBus_->setConfigValue("Permissions/vnc_other", "ro"); + pvsSettings_->setValue("Permissions/vnc_other", "ro"); } else { - ifaceDBus_->setConfigValue("Permissions/vnc_other", "no"); + pvsSettings_->setValue("Permissions/vnc_other", "no"); } - - ifaceDBus_->setConfigValue("Permissions/allow_chat", - QString(ui->checkBoxChat->isChecked() ? "T" : "F")); - ifaceDBus_->setConfigValue("Permissions/allow_filetransfer", - QString(ui->checkBoxFileTransfer->isChecked() ? "T" : "F")); + pvsSettings_->sync(); } void Dialog::on_comboBoxLecturer_currentIndexChanged(int index) { @@ -190,3 +155,13 @@ void Dialog::selectSession(const QString& name) { void Dialog::selectPreviousSession() { selectSession(readSessionName()); } + +void Dialog::showSettingsPVS() { + pvsSettings_ = new QSettings("openslx", "pvs", this); + QStringList accessOptions; + accessOptions <<trUtf8("None") << trUtf8("View Only") << trUtf8("Full"); + ui->comboBoxLecturer->insertItems(0, accessOptions); + ui->comboBoxOthers->insertItems(0, accessOptions); + readPVSSettings(); + ui->PVSOptionsGroupBox->show(); +} |