From 00d27f0b9f10154b0af6cd00c18fc27d38a708bf Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 1 Mar 2019 14:53:39 +0100 Subject: Add button to open beamergui --- src/dialog.cpp | 38 +++++++++++++++++++++++++++++++++++++- src/dialog.h | 1 + src/i18n/de.ts | 5 +++++ src/ui/dialog.ui | 33 ++++++++++++++++++++++++++++++--- 4 files changed, 73 insertions(+), 4 deletions(-) (limited to 'src') 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 Edit VM Adminmodus (VM Bearbeiten) + + Screen and projector setup + Bildschirm und Beamer konfigurieren + QObject 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;} <!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:'DejaVuSans'; 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';">Loading...</span></p></body></html> @@ -164,7 +164,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:'DejaVuSans'; 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';">Loading...</span></p></body></html> @@ -492,7 +492,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:'DejaVuSans'; 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';">Click on an item on the left side for more information</span></p></body></html> @@ -581,6 +581,33 @@ p, li { white-space: pre-wrap; } + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 9 + 50 + false + + + + Screen and projector setup + + + -- cgit v1.2.3-55-g7522