summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorManuel Schneider2014-07-23 14:04:08 +0200
committerManuel Schneider2014-07-23 14:04:08 +0200
commit57530207207a6cf9b21433e9da19d8f23091344a (patch)
treea78f898a84b186bd6fbf593bf6939828af3dc57e /src/dialog.cpp
parentFix missing details on startup (diff)
downloadvmchooser2-57530207207a6cf9b21433e9da19d8f23091344a.tar.gz
vmchooser2-57530207207a6cf9b21433e9da19d8f23091344a.tar.xz
vmchooser2-57530207207a6cf9b21433e9da19d8f23091344a.zip
Only set the sessionID. Drop old pvs stuff.
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp117
1 files changed, 26 insertions, 91 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<Session*>& 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;