From 57530207207a6cf9b21433e9da19d8f23091344a Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Wed, 23 Jul 2014 14:04:08 +0200 Subject: Only set the sessionID. Drop old pvs stuff. --- src/dialog.cpp | 117 ++++++++++-------------------------------- src/dialog.h | 6 --- src/main.cpp | 6 --- src/ui/dialog.ui | 151 +++++++++++++++++++++---------------------------------- 4 files changed, 82 insertions(+), 198 deletions(-) diff --git a/src/dialog.cpp b/src/dialog.cpp index f6b67b1..ae157ba 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -32,9 +32,6 @@ Dialog::Dialog(QWidget *parent) strings_[STR_URL_ERROR] = QCoreApplication::instance()->translate("Dialog", "URL Error"); strings_[STR_NO_ITEMS] = QCoreApplication::instance()->translate("Dialog", "No Items"); - pvsSettings_ = NULL; - ui->PVSOptionsGroupBox->hide(); - // Re-center dialog every second to account for resolution changes QRect desktopRect = QApplication::desktop()->availableGeometry(this); oldCenter_ = desktopRect.center(); @@ -94,25 +91,32 @@ void Dialog::on_treeView_activated(QModelIndex index) { return; } - // Run session start script - if (QFile::exists(sessionStartScript)) { - QProcess scriptProcess; - scriptProcess.start(sessionStartScript, QIODevice::ReadOnly); - scriptProcess.waitForFinished(); - scriptProcess.close(); - } - - if (s->run()) { - writePVSSettings(); - ChooserSettings::setSetting("last-session", (s->shortDescription())); - ChooserSettings::setSetting("last-tab", QString::number(activeTab_)); - setVisible(false); - - } else { - QMessageBox::warning( - this, trUtf8("vmchooser"), - trUtf8("Vmchooser failed to run the selected session!")); - } + if (s->run()) { + // Run session start script + if (QFile::exists(sessionStartScript)) { + // Use the current environment variables and add the necessary + // information for the startUpScipt. In this case it is intended to tell + // the startupscript if the PVS should be started. Further in the future + // the session id will be passed this way. + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + if (ui->PVS_checkbox->isChecked()) { + env.insert("PVS_SESSIONID", "xxxx"); + } + QProcess scriptProcess; + scriptProcess.setProcessEnvironment(env); + scriptProcess.start(sessionStartScript, QIODevice::ReadOnly); + scriptProcess.waitForFinished(); + scriptProcess.close(); + } + + ChooserSettings::setSetting("last-session", (s->shortDescription())); + ChooserSettings::setSetting("last-tab", QString::number(activeTab_)); + setVisible(false); + } else { + QMessageBox::warning( + this, trUtf8("vmchooser"), + trUtf8("Vmchooser failed to run the selected session!")); + } } void Dialog::addItems(const QList& entries, int tab) { @@ -157,65 +161,6 @@ void Dialog::on_pushButtonStart_clicked() { this->on_treeView_activated(ui->treeView->selectionModel()->currentIndex()); } -void Dialog::readPVSSettings() { - 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); - } - - 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); - } -} - -void Dialog::writePVSSettings() { - if (!pvsSettings_) return; - int accessLecturer = ui->comboBoxLecturer->currentIndex(); - if (accessLecturer == 2) { - pvsSettings_->setValue("Permissions/vnc_lecturer", "rw"); - } else if (accessLecturer == 1) { - pvsSettings_->setValue("Permissions/vnc_lecturer", "ro"); - } else { - pvsSettings_->setValue("Permissions/vnc_lecturer", "no"); - } - - int accessOthers = ui->comboBoxOthers->currentIndex(); - if (accessOthers == 2) { - pvsSettings_->setValue("Permissions/vnc_other", "rw"); - } else if (accessOthers == 1) { - pvsSettings_->setValue("Permissions/vnc_other", "ro"); - } else { - pvsSettings_->setValue("Permissions/vnc_other", "no"); - } - pvsSettings_->sync(); -} - -void Dialog::on_comboBoxLecturer_currentIndexChanged(int index) { - // TODO (Jan): may others have more access than lecturer? - if (index < ui->comboBoxOthers->currentIndex()) { - ui->comboBoxOthers->setCurrentIndex(index); - } -} - -void Dialog::on_comboBoxOthers_currentIndexChanged(int index) { - // TODO (Jan): may others have more access than lecturer? - if (index > ui->comboBoxLecturer->currentIndex()) { - ui->comboBoxLecturer->setCurrentIndex(index); - } -} - bool Dialog::selectSession(const QString& name) { QModelIndex root(ui->treeView->rootIndex()); @@ -260,16 +205,6 @@ void Dialog::startSession(const QString& name) { autoStartEntry_ = name; } -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(); -} - void Dialog::setTheme() { QString label_l_style, label_r_style; QString backgroundColor, imageLeft, imageRight; diff --git a/src/dialog.h b/src/dialog.h index 39f9bdb..46f2781 100644 --- a/src/dialog.h +++ b/src/dialog.h @@ -31,7 +31,6 @@ class Dialog : public QDialog { void removeStatusString(const int status); bool selectSession(const QString& name); void selectPreviousSession(); - void showSettingsPVS(); void setTheme(); void startSession(const QString& name); @@ -42,22 +41,17 @@ class Dialog : public QDialog { Ui::Dialog *ui; SessionTreeModel *model_[3]; // TODO: Constants/Enum for indices QPushButton *tabs_[3]; - QSettings *pvsSettings_; QPoint oldCenter_; QTimer *centerTimer_; QString autoStartEntry_; int activeTab_; int oldRow_; QString strings_[STR__MAX]; - void readPVSSettings(); - void writePVSSettings(); void onTabButtonChanged(int tab); void configClearButton(); void setListModel(QAbstractItemModel *model); private slots: - void on_comboBoxOthers_currentIndexChanged(int index); - void on_comboBoxLecturer_currentIndexChanged(int index); void on_pushButtonStart_clicked(); void on_pushButtonAbort_clicked(); void on_treeView_activated(QModelIndex index); diff --git a/src/main.cpp b/src/main.cpp index 30e30f3..be7fd76 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -225,14 +225,8 @@ int main(int argc, char *argv[]) { w.setWindowFlags(Qt::FramelessWindowHint); if (cmdOptions.contains("pvs")) { pvsEnabled = true; - } else if (settings.contains("pvs")) { - if (settings.value("pvs").toInt() == 1) - pvsEnabled = true; } - if (pvsEnabled) - w.showSettingsPVS(); - QRect desktopRect = QApplication::desktop()->availableGeometry(&w); if (size == "fullscreen") { width = desktopRect.width(); diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index 204d486..1954595 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -126,7 +126,7 @@ margin-bottom:0px;} <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Loading...</span></p></body></html> @@ -152,7 +152,7 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Loading...</span></p></body></html> @@ -422,7 +422,7 @@ border:1px solid #999; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Click on an item on the left side for more infos.</span></p></body></html> @@ -430,102 +430,63 @@ p, li { white-space: pre-wrap; } + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + Start PVS + + + false + + + false + + + + + + + with Session ID + + + + + + + + 0 + 0 + + + + 5 + + + + + - - - - true - - - PVS Options - - - - 9 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - VNC access by lecturer: - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - VNC access by others: - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - -- cgit v1.2.3-55-g7522