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 | |
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"
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | default.desktop | 2 | ||||
-rw-r--r-- | src/command_line_options.cpp | 4 | ||||
-rw-r--r-- | src/dialog.cpp | 103 | ||||
-rw-r--r-- | src/dialog.h | 5 | ||||
-rw-r--r-- | src/main.cpp | 5 | ||||
-rw-r--r-- | src/org.openslx.pvs.xml | 85 | ||||
-rw-r--r-- | src/ui/dialog.ui | 94 | ||||
-rw-r--r-- | src/vsession.h | 1 | ||||
-rw-r--r-- | src/xsession.h | 1 |
10 files changed, 95 insertions, 209 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 25e8cce..0acd9da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,6 @@ else(QT4_FOUND) message(FATAL_ERROR "Qt4 not found") endif(QT4_FOUND) -set(QT_USE_QTDBUS TRUE) set(QT_USE_QTXML TRUE) set(QT_USE_QTSVG TRUE) @@ -58,9 +57,6 @@ QT4_ADD_RESOURCES(VMCHOOSER_RC_SOURCES ${VMCHOOSER_RESOURCES}) QT4_WRAP_UI(VMCHOOSER_UI_HEADERS ${VMCHOOSER_UIS}) QT4_WRAP_CPP(VMCHOOSER_MOC_SOURCES ${VMCHOOSER_MOC_HEADERS}) -# run qdbusxml2cpp on org.openslx.pvs.xml (taken from pvs build) -QT4_ADD_DBUS_INTERFACE(VMCHOOSER_SOURCES src/org.openslx.pvs.xml pvsinterface ) - # # build vmchooser # diff --git a/default.desktop b/default.desktop index ab2c948..944b771 100644 --- a/default.desktop +++ b/default.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Name=RZ VMChooser Comment=This session logs you into VMChooser -Exec=vmchooser +Exec=vmchooser --pvs TryExec=vmchooser Icon= Type=Applicatio
\ No newline at end of file diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp index 2127c4f..6ace24a 100644 --- a/src/command_line_options.cpp +++ b/src/command_line_options.cpp @@ -11,6 +11,7 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { {"path", required_argument, NULL, 'p'}, {"xpath", required_argument, NULL, 'x'}, {"size", required_argument, NULL, 's'}, + {"pvs", no_argument, NULL, 'b'}, {"version", no_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, {0, 0, 0, 0} @@ -38,6 +39,9 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { case 's': options.insert("size", optarg); break; + case 'b': + options.insert("pvs", "pvs"); + break; case 'v': options.insert("version", "version"); break; 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(); +} diff --git a/src/dialog.h b/src/dialog.h index 1b2e7c9..86896c7 100644 --- a/src/dialog.h +++ b/src/dialog.h @@ -4,9 +4,9 @@ #include <QDialog> #include <QModelIndex> #include <QList> +#include <QSettings> #include "session.h" #include "sessiontreemodel.h" -#include "pvsinterface.h" namespace Ui { class Dialog; @@ -20,6 +20,7 @@ class Dialog : public QDialog { void addItems(const QList<Session*>&, const QString& section); void selectSession(const QString& name); void selectPreviousSession(); + void showSettingsPVS(); protected: void changeEvent(QEvent *e); @@ -27,7 +28,7 @@ class Dialog : public QDialog { private: Ui::Dialog *ui; SessionTreeModel *model_; - OrgOpenslxPvsInterface *ifaceDBus_; + QSettings *pvsSettings_; void readPVSSettings(); void writePVSSettings(); diff --git a/src/main.cpp b/src/main.cpp index 6264923..ff054fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,7 @@ #include <QtAlgorithms> #include <QtGui/QApplication> #include <QDesktopWidget> +#include <QLocale> #include <cstdlib> #include <iostream> @@ -38,6 +39,7 @@ int main(int argc, char *argv[]) { " -p, --path path to vmware .xml files\n" " -x, --xpath path of X Session .desktop files\n" " -s, --size window size <width>x<height>\n" + " -b, --pvs show pvs options\n" " -v, --version print version and exit\n" " -h, --help print usage information and exit\n" "\nFILE can be a vmware .xml or an X .desktop file\n") @@ -164,6 +166,9 @@ int main(int argc, char *argv[]) { QList<Session*> vsessions(VSession::readXmlDir(vSessionPath)); Dialog w; + if (cmdOptions.contains("pvs")) + w.showSettingsPVS(); + w.resize(width, height); if (xsessions.empty() && vsessions.empty()) { std::cerr << a.translate( diff --git a/src/org.openslx.pvs.xml b/src/org.openslx.pvs.xml deleted file mode 100644 index 382e825..0000000 --- a/src/org.openslx.pvs.xml +++ /dev/null @@ -1,85 +0,0 @@ -<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> -<node> - <interface name="org.openslx.pvs"> - <signal name="project"> - <arg name="host" type="s" direction="out"/> - <arg name="port" type="i" direction="out"/> - <arg name="passwd" type="s" direction="out"/> - <arg name="fullscreen" type="b" direction="out"/> - <arg name="smoothTransformation" type="b" direction="out"/> - <arg name="quality" type="i" direction="out"/> - </signal> - <signal name="unproject"> - </signal> - <signal name="chat_receive"> - <arg name="nick_from" type="s" direction="out"/> - <arg name="nick_to" type="s" direction="out"/> - <arg name="msg" type="s" direction="out"/> - </signal> - <signal name="chat_client_add"> - <arg name="nick" type="s" direction="out"/> - </signal> - <signal name="chat_client_remove"> - <arg name="nick" type="s" direction="out"/> - </signal> - <signal name="showMessage"> - <arg name="title" type="s" direction="out"/> - <arg name="msg" type="s" direction="out"/> - <arg name="useDialog" type="b" direction="out"/> - </signal> - <signal name="connected"> - <arg name="host" type="s" direction="out"/> - </signal> - <signal name="disconnected"> - </signal> - <signal name="addHost"> - <arg name="host" type="s" direction="out"/> - </signal> - <signal name="delHost"> - <arg name="host" type="s" direction="out"/> - </signal> - <method name="start"> - <arg type="b" direction="out"/> - </method> - <method name="quit"> - </method> - <method name="chat_send"> - <arg name="nick_to" type="s" direction="in"/> - <arg name="nick_from" type="s" direction="in"/> - <arg name="msg" type="s" direction="in"/> - </method> - <method name="chat_getNickname"> - <arg type="s" direction="out"/> - </method> - <method name="chat_getNicknames"> - <arg type="as" direction="out"/> - </method> - <method name="fileChanged"> - <arg name="path" type="s" direction="in"/> - </method> - <method name="pvsConnect"> - <arg name="host" type="s" direction="in"/> - <arg name="passwd" type="s" direction="in"/> - </method> - <method name="pvsDisconnect"> - </method> - <method name="isConnected"> - <arg type="s" direction="out"/> - </method> - <method name="getAvailableHosts"> - <arg type="as" direction="out"/> - </method> - <method name="getIpByNick"> - <arg type="s" direction="out"/> - <arg name="nick" type="s" direction="in"/> - </method> - <method name="setConfigValue"> - <arg name="key" type="s" direction="in"/> - <arg name="value" type="s" direction="in"/> - </method> - <method name="getConfigValue"> - <arg type="s" direction="out"/> - <arg name="key" type="s" direction="in"/> - </method> - </interface> -</node> diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index e9e2920..9a49987 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>842</width> + <width>542</width> <height>655</height> </rect> </property> @@ -142,15 +142,28 @@ border-bottom:1px solid #ccc; <number>9</number> </property> <item> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> <widget class="QLabel" name="labelLecturer"> <property name="text"> <string>VNC access by lecturer:</string> </property> </widget> </item> - <item row="0" column="1"> + <item> <widget class="QComboBox" name="comboBoxLecturer"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> @@ -160,14 +173,27 @@ border-bottom:1px solid #ccc; </property> </widget> </item> - <item row="1" column="0"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> <widget class="QLabel" name="labelOthers"> <property name="text"> <string>VNC access by others:</string> </property> </widget> </item> - <item row="1" column="1"> + <item> <widget class="QComboBox" name="comboBoxOthers"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> @@ -177,59 +203,21 @@ border-bottom:1px solid #ccc; </property> </widget> </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QCheckBox" name="checkBoxChat"> - <property name="text"> - <string>Accept chat messages</string> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBoxFileTransfer"> - <property name="text"> - <string>Accept file transfers</string> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> </property> - </widget> + </spacer> </item> </layout> </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> </layout> </widget> </item> diff --git a/src/vsession.h b/src/vsession.h index 496e0a2..093ec2f 100644 --- a/src/vsession.h +++ b/src/vsession.h @@ -5,6 +5,7 @@ #include <QList> #include <QDomDocument> #include <QDir> +#include <QProcess> #include "session.h" enum ImgType { diff --git a/src/xsession.h b/src/xsession.h index 2e95a63..72c174c 100644 --- a/src/xsession.h +++ b/src/xsession.h @@ -5,6 +5,7 @@ #include <QList> #include <QDomDocument> #include <QDir> +#include <QProcess> #include "session.h" class XSession : public Session { |