diff --git a/Labcontrol.pro.user.4.8-pre1 b/Labcontrol.pro.user.4.8-pre1 new file mode 100644 index 0000000..7bcc688 --- /dev/null +++ b/Labcontrol.pro.user.4.8-pre1 @@ -0,0 +1,276 @@ + + + + + + EnvironmentId + {e5c02e28-17c9-4196-8348-d8ad584d5f67} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {244db1fd-ad78-44f7-be44-4616619a867c} + 0 + 0 + 0 + + /home/weiss/build-Labcontrol-Desktop-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/weiss/build-Labcontrol-Desktop-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 2 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Labcontrol + + Qt4ProjectManager.Qt4RunConfiguration:/home/weiss/Labcontrol_fork/Labcontrol.pro + true + + Labcontrol.pro + false + + + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/data/Labcontrol.conf b/data/Labcontrol.conf index d04b702..4799cfd 100755 --- a/data/Labcontrol.conf +++ b/data/Labcontrol.conf @@ -92,3 +92,7 @@ webcam_command=/usr/local/bin/WebcamDisplay ztree_installation_directory=/opt/z-Leaves # Script to be called after session crash restart_crashed_session_script=/home/scripts/start_zTree_after_crash.sh +# Client default browser cmd (firefox) - need to be quoted! +client_browser_command="firefox-esr" +# Client cromium cmd- need to be quoted! +client_chromium_command="chromium" diff --git a/src/Lib/client.cpp b/src/Lib/client.cpp index bd6d109..06d88d6 100755 --- a/src/Lib/client.cpp +++ b/src/Lib/client.cpp @@ -21,6 +21,9 @@ #include +// To substitute client name in argURL browser call +#include + #include "client.h" #include "settings.h" #include "lablib.h" @@ -296,20 +299,36 @@ void lc::Client::StartZLeaf( const QString * argFakeName, QString cmd ) { } } -void lc::Client::StartClientBrowser( const QString * const argURL, const bool * const argFullscreen ) { +void lc::Client::StartClientBrowser( const QString * const argURL, const bool * const argFullscreen, const QString * const argBrowser ) { //Declarations QStringList arguments; - // Build arguments list for SSH command - arguments << "-i" << settings->pkeyPathUser - << QString{ settings->userNameOnClients + "@" + ip } - << "DISPLAY=:0.0" - << settings->clientBrowserCmd - << *argURL; - - // Add fullscreen toggle if checked - if (*argFullscreen == true){ - arguments << "& sleep 3 && DISPLAY=:0.0 xdotool key --clearmodifiers F11"; + QString processedArgUrl(*argURL); + QRegularExpression clientRegEx(QStringLiteral("%CLIENT%")); + processedArgUrl.replace(clientRegEx,this->name); + //qDebug() << processedArgUrl; + + if(argBrowser==QString("firefox")){ + // Build arguments list for SSH command + arguments << "-i" << settings->pkeyPathUser + << QString{ settings->userNameOnClients + "@" + ip } + << "DISPLAY=:0.0" + << settings->clientBrowserCmd + << processedArgUrl; + + // Add fullscreen toggle if checked + if (*argFullscreen == true){ + arguments << "& sleep 3 && DISPLAY=:0.0 xdotool key --clearmodifiers F11"; + } + } else if (argBrowser==QString("chromium")) { + // Build arguments list for SSH command + arguments << "-i" << settings->pkeyPathUser + << QString{ settings->userNameOnClients + "@" + ip } + << "DISPLAY=:0.0" + << settings->clientChromiumCmd + << "--noerrdialogs --kiosk" + << "--app='" + processedArgUrl + "'" + << "> /dev/null 2>&1 &disown"; } // Start the process @@ -331,7 +350,34 @@ void lc::Client::StopClientBrowser() { << QString{ settings->userNameOnClients + "@" + ip } << "killall" << settings->clientBrowserCmd - << "& sleep 1 && rm -R /home/ewfuser/.mozilla/firefox/*"; + << "& sleep 1 && rm -R /home/ewfuser/.mozilla/firefox/*" + << "& killall" + << settings->clientChromiumCmd; + + // Start the process + QProcess startClientBrowserProcess; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + startClientBrowserProcess.setProcessEnvironment( env ); + startClientBrowserProcess.startDetached( settings->sshCmd, arguments ); + + // Output message via the debug messages tab + qDebug() << settings->sshCmd << arguments.join( " " ); +} + +void lc::Client::ControlRMB(bool enable) { + //Declarations + QStringList arguments; + + //Build arguments list + if(enable){ + arguments << "-i" << settings->pkeyPathUser + << QString{ settings->userNameOnClients + "@" + ip } + << "DISPLAY=:0 xinput set-button-map 'Microsoft Basic Optical Mouse' 1 2 3 4 5 6 7 8 9 10 11 12 > /dev/null 2>&1 &disown;"; + } else { + arguments << "-i" << settings->pkeyPathUser + << QString{ settings->userNameOnClients + "@" + ip } + << "DISPLAY=:0 xinput set-button-map 'Microsoft Basic Optical Mouse' 1 2 0 4 5 6 7 8 9 10 11 12 > /dev/null 2>&1 &disown;"; + } // Start the process QProcess startClientBrowserProcess; diff --git a/src/Lib/client.h b/src/Lib/client.h index 2b75897..7206e84 100755 --- a/src/Lib/client.h +++ b/src/Lib/client.h @@ -120,13 +120,18 @@ public: * \brief Opens a browser window on the client * @param argURL URL to open in clients browser */ - void StartClientBrowser( const QString *argURL = nullptr, const bool *argFullscreen = nullptr ); + void StartClientBrowser( const QString *argURL = nullptr, const bool *argFullscreen = nullptr, const QString *argBrowser = nullptr ); /*! * \brief Closes all browser instances */ void StopClientBrowser(); + /*! + * \brief Enable/Disable right mouse button + */ + void ControlRMB(bool enable = true); + private: const QString &GetzLeafVersion() const { return zLeafVersion; } diff --git a/src/Lib/settings.cpp b/src/Lib/settings.cpp index 7214061..9d862bf 100755 --- a/src/Lib/settings.cpp +++ b/src/Lib/settings.cpp @@ -34,6 +34,9 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) : clientBrowserCmd{ ReadSettingsItem( "client_browser_command", "Opening a browser window on clients will not work.", argSettings, false ) }, + clientChromiumCmd{ ReadSettingsItem( "client_chromium_command", + "Opening a chromium window on clients will not work.", + argSettings, false ) }, dvipsCmd{ ReadSettingsItem( "dvips_command", "Receipts creation will not work.", argSettings, true ) }, diff --git a/src/Lib/settings.h b/src/Lib/settings.h index 685f66b..ecc8983 100755 --- a/src/Lib/settings.h +++ b/src/Lib/settings.h @@ -49,6 +49,7 @@ public: const int defaultReceiptIndex = 0; const QString browserCmd; const QString clientBrowserCmd; + const QString clientChromiumCmd; const QString dvipsCmd; const QString fileMngr; const QString killallCmd; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7f639ff..5aca148 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -425,7 +425,7 @@ void lc::MainWindow::SetupWidgets() { //DisableDisfunctionalWidgets(); // Set the info text in LInfo on the TInfo tab - ui->LInfo->setText( "This is Labcontrol version 2.1.5\n\n\n\n\n\n" + ui->LInfo->setText( "This is Labcontrol version 2.1.6\n\n\n\n\n\n" "Developers\n\n" "0day-2016 Henning Prömpers\n" "2014-2016 Markus Prasser\n" @@ -885,3 +885,39 @@ void lc::MainWindow::on_PBOpenTerminal_clicked() { } } } + +// Enable RMB +void lc::MainWindow::on_PBEnableRMB_clicked() +{ + // Confirmation dialog + QMessageBox::StandardButton reply; + reply = QMessageBox::question(this, "Confirm", "Really enable the right mouse button on selected clients?", QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) { + qDebug() << "Enabling RMB on chosen clients."; + QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); + for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { + if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { + Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); + client->ControlRMB(true); + } + } + } +} + +// Disable RMB +void lc::MainWindow::on_PBDisableRMB_clicked() +{ + // Confirmation dialog + QMessageBox::StandardButton reply; + reply = QMessageBox::question(this, "Confirm", "Really disable the right mouse button on selected clients?", QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) { + qDebug() << "Disabling RMB on chosen clients."; + QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); + for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { + if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { + Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); + client->ControlRMB(false); + } + } + } +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 154afef..1fdd824 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -129,6 +129,8 @@ private slots: void on_CBReceiptsHeader_activated(int argIndex); void on_ChBPrintanonymousreceipts_clicked(); void on_PBKillzLeaf_clicked(); + void on_PBEnableRMB_clicked(); + void on_PBDisableRMB_clicked(); }; } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index da11085..5a140d8 100755 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -240,13 +240,6 @@ - - - - Qt::Horizontal - - - @@ -259,6 +252,10 @@ Shows the desktop of the selected clients. + + + + View desktop (view only) @@ -271,6 +268,31 @@ + + + + Control right mouse botton (RMB) + + + + + + + + + Enable RMB + + + + + + + Disable RMB + + + + + @@ -335,6 +357,13 @@ + + + + %CLIENT% is a placeholder for hostname in URL + + + @@ -347,16 +376,37 @@ - http:// + http://localhost:8000/%CLIENT% + + + + Use the following browser + + + + + + + + chromium + + + + + firefox + + + + - Fullscreen + Fullscreen (only FF) true