From 7660a47003b103ebf032c042e8b05778e2f8d7ae Mon Sep 17 00:00:00 2001 From: Markus Prasser Date: Thu, 6 Oct 2016 16:36:07 +0200 Subject: [PATCH] Adjusted the handling of to be displayed webcams --- data/Labcontrol.conf | 2 ++ src/Lib/settings.cpp | 3 +++ src/Lib/settings.h | 1 + src/mainwindow.cpp | 15 ++++++++------- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/data/Labcontrol.conf b/data/Labcontrol.conf index 3baf634..3fb77c2 100644 --- a/data/Labcontrol.conf +++ b/data/Labcontrol.conf @@ -49,6 +49,8 @@ terminal_emulator_command=/usr/bin/gnome-terminal user_name_on_clients=user vnc_viewer=/usr/bin/vinagre wakeonlan_command=/usr/bin/wakeonlan +# The program used to view the laboratory's webcams +webcam_command=/usr/local/bin/WebcamDisplay # URLs to available webcams webcams="webcam_left|webcam_right" wine_command=/usr/bin/wine diff --git a/src/Lib/settings.cpp b/src/Lib/settings.cpp index 7aba065..a411ad1 100644 --- a/src/Lib/settings.cpp +++ b/src/Lib/settings.cpp @@ -77,6 +77,9 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) : wakeonlanCmd{ ReadSettingsItem( "wakeonlan_command", "Booting the clients will not work.", argSettings, true ) }, + webcamDisplayCmd{ ReadSettingsItem( "webcam_command", + "Displaying the laboratory's webcams will not work.", + argSettings, true ) }, webcams{ argSettings.value( "webcams", "" ).toString().split( '|', QString::SkipEmptyParts, Qt::CaseInsensitive ) }, wineCmd{ ReadSettingsItem( "wine_command", diff --git a/src/Lib/settings.h b/src/Lib/settings.h index 7170e5d..a075f0c 100644 --- a/src/Lib/settings.h +++ b/src/Lib/settings.h @@ -44,6 +44,7 @@ public: const QString userNameOnClients; const QString vncViewer; const QString wakeonlanCmd; + const QString webcamDisplayCmd; const QStringList webcams; const QString wineCmd; const QString wmctrlCmd; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8602adc..5630980 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -176,6 +176,13 @@ void lc::MainWindow::DisableDisfunctionalWidgets() { ui->PBBoot->setEnabled( false ); } + // Deactivate the webcam choosing interface if no webcams are available or the viewer is missing + if ( settings->webcamDisplayCmd.isEmpty() + || settings->webcams.isEmpty() ) { + ui->CBWebcamChooser->setEnabled( false ); + ui->LWebcamChooser->setEnabled( false ); + } + // Disable the disable screensaver function if the 'xset_command' was not set if ( settings->xsetCmd.isEmpty() ) { ui->PBDeactivateScreensaver->setEnabled( false ); @@ -206,7 +213,7 @@ void lc::MainWindow::LoadIconPixmaps() { void lc::MainWindow::on_CBWebcamChooser_activated( int argIndex ) { if ( argIndex != 0 ) { - QString program{ settings->lcInstDir + "/webcam_display" }; + QString program{ settings->webcamDisplayCmd }; QStringList arguments; arguments << ui->CBWebcamChooser->currentText(); @@ -646,12 +653,6 @@ void lc::MainWindow::SetupWidgets() { for ( const auto &s : settings->webcams ) ui->CBWebcamChooser->addItem( s ); } - - // Deactivate the webcam choosing interface, if no webcams are available - if ( ui->CBWebcamChooser->count() == 0 ) { - ui->LWebcamChooser->setEnabled( false ); - ui->CBWebcamChooser->setEnabled( false ); - } clients = nullptr; const QStringList &zTreeEntries = settings->installedZTreeVersions;