summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/dialog.cpp117
-rw-r--r--src/dialog.h6
-rw-r--r--src/main.cpp6
-rw-r--r--src/ui/dialog.ui151
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<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;
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;}</string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:10pt;&quot;&gt;Loading...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
@@ -152,7 +152,7 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:10pt;&quot;&gt;Loading...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
@@ -422,7 +422,7 @@ border:1px solid #999;
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;Click on an item on the left side for more infos.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
@@ -430,103 +430,64 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <spacer name="horizontalSpacer_5">
+ <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="QCheckBox" name="PVS_checkbox">
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="text">
+ <string>Start PVS</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="tristate">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>with Session ID</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxLength">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</item>
</layout>
</item>
<item>
- <widget class="QGroupBox" name="PVSOptionsGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>PVS Options</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="leftMargin">
- <number>9</number>
- </property>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0,0,0,0,0">
- <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>
- <widget class="QComboBox" name="comboBoxLecturer">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </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>
- <item>
- <widget class="QLabel" name="labelOthers">
- <property name="text">
- <string>VNC access by others:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBoxOthers">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <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>
- </item>
- </layout>
- </widget>
- </item>
- <item>
<layout class="QHBoxLayout" name="horizontalLayout2">
<property name="leftMargin">
<number>9</number>