summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-01 14:53:39 +0100
committerSimon Rettberg2019-03-01 14:53:39 +0100
commit00d27f0b9f10154b0af6cd00c18fc27d38a708bf (patch)
treeb9338f254571c59498eeb40b55800134dcb4c700
parentrework url params parsing (diff)
downloadvmchooser2-00d27f0b9f10154b0af6cd00c18fc27d38a708bf.tar.gz
vmchooser2-00d27f0b9f10154b0af6cd00c18fc27d38a708bf.tar.xz
vmchooser2-00d27f0b9f10154b0af6cd00c18fc27d38a708bf.zip
Add button to open beamergui
-rw-r--r--src/dialog.cpp38
-rw-r--r--src/dialog.h1
-rw-r--r--src/i18n/de.ts5
-rw-r--r--src/ui/dialog.ui33
4 files changed, 73 insertions, 4 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 9472269..fb6b95e 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -22,6 +22,8 @@
#include "choosersettings.h"
#include "filedownloader.h"
+static bool isProcessRunning(const QString &binary);
+
Dialog::Dialog(int defaultTab, bool examMode, QWidget *parent)
: QDialog(parent), ui(new Ui::Dialog) {
model_[0] = new SessionTreeModel(parent);
@@ -86,9 +88,16 @@ Dialog::Dialog(int defaultTab, bool examMode, QWidget *parent)
this->selectPreviousSession();
}
- ui->chkAdminMode->setVisible(g_allowVmEdit);
+ ui->chkAdminMode->setVisible(g_allowVmEdit);
ui->chkAdminMode->setEnabled(false);
+ ui->btnScreenSetup->setVisible(isProcessRunning("beamergui"));
+ if (QApplication::screens().size() > 1) {
+ QFont copy = ui->btnScreenSetup->font();
+ copy.setBold(true);
+ ui->btnScreenSetup->setFont(copy);
+ }
+
// TODO: Implement bug report dialog :)
ui->buttonBugReport->setEnabled(false);
QObject::connect(SessionsIconHolder::get(), SIGNAL(iconDownloaded(const QUrl&, const QIcon&)),
@@ -245,6 +254,11 @@ void Dialog::on_pushButtonStart_clicked() {
this->on_treeView_doubleClicked(ui->treeView->selectionModel()->currentIndex());
}
+void Dialog::on_btnScreenSetup_clicked() {
+ qDebug() << "Wooo";
+ QProcess::startDetached("beamergui", QStringList("-w"));
+}
+
bool Dialog::selectSession(const QString& name) {
QModelIndex root(ui->treeView->rootIndex());
@@ -879,3 +893,25 @@ void Dialog::checkAutostart() {
return;
}
}
+
+static bool isProcessRunning(const QString &binary)
+{
+ bool full = binary.contains('/');
+ QDir proc("/proc");
+ for (auto entry : proc.entryInfoList(QStringList(), QDir::NoDotAndDotDot | QDir::AllDirs)) {
+ if (!entry.isReadable())
+ continue;
+ QDir dest = QDir(entry.filePath() + "/exe");
+ if (!dest.isReadable())
+ continue;
+ QString wurst = dest.canonicalPath();
+ if (wurst.isEmpty())
+ continue;
+ qDebug() << wurst;
+ if (full && wurst == binary)
+ return true;
+ if (!full && wurst.mid(wurst.lastIndexOf('/') + 1) == binary)
+ return true;
+ }
+ return false;
+}
diff --git a/src/dialog.h b/src/dialog.h
index b38aeac..c2d3959 100644
--- a/src/dialog.h
+++ b/src/dialog.h
@@ -73,6 +73,7 @@ class Dialog : public QDialog {
private slots:
void on_pushButtonStart_clicked();
void on_pushButtonAbort_clicked();
+ void on_btnScreenSetup_clicked();
void on_treeView_doubleClicked(const QModelIndex& index);
void on_treeView_expanded(const QModelIndex& index);
void on_tabButtonLocal_clicked();
diff --git a/src/i18n/de.ts b/src/i18n/de.ts
index 704791d..a8e0ba0 100644
--- a/src/i18n/de.ts
+++ b/src/i18n/de.ts
@@ -58,6 +58,7 @@
-t, --theme theme
--template-mode how to treat template entries (IGNORE or BUMP)
-p, --pvs show pvs options
+ --pvs-checked check pvs box by default
-D, --debug print debug information
-v, --version print version and exit
-h, --help print usage information and exit
@@ -209,6 +210,10 @@ FILE can be a vmware .xml or an X .desktop file
<source>Edit VM</source>
<translation>Adminmodus (VM Bearbeiten)</translation>
</message>
+ <message>
+ <source>Screen and projector setup</source>
+ <translation>Bildschirm und Beamer konfigurieren</translation>
+ </message>
</context>
<context>
<name>QObject</name>
diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui
index 6516207..751067b 100644
--- a/src/ui/dialog.ui
+++ b/src/ui/dialog.ui
@@ -132,7 +132,7 @@ margin-bottom:0px;}</string>
<string notr="true">&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:'DejaVuSans'; 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';&quot;&gt;Loading...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
@@ -164,7 +164,7 @@ p, li { white-space: pre-wrap; }
<string notr="true">&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:'DejaVuSans'; 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';&quot;&gt;Loading...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
@@ -492,7 +492,7 @@ border:1px solid #999;
<string notr="true">&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:'DejaVuSans'; 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';&quot;&gt;Click on an item on the left side for more information&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
@@ -582,6 +582,33 @@ p, li { white-space: pre-wrap; }
</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="QPushButton" name="btnScreenSetup">
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Screen and projector setup</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>