From 7bea07b7ac3a7bebb1a76bb4850a6381d73517c3 Mon Sep 17 00:00:00 2001 From: Tobias Weiss Date: Sat, 9 Sep 2017 16:19:48 +0200 Subject: [PATCH] Added functionality to new layout. Moved config location. --- doc/manual.tex | 2 +- src/Lib/client.cpp | 54 +-- src/Lib/client.h | 3 +- src/Lib/lablib.cpp | 2 +- src/main.cpp | 2 +- src/mainwindow.cpp | 280 +++++++++----- src/mainwindow.h | 20 +- src/mainwindow.ui | 818 ++++++++++++++++++++++++----------------- src/sessionstarter.cpp | 1 + 9 files changed, 722 insertions(+), 460 deletions(-) diff --git a/doc/manual.tex b/doc/manual.tex index 5bc94ed..107271a 100755 --- a/doc/manual.tex +++ b/doc/manual.tex @@ -93,7 +93,7 @@ Like already mentioned all \emph{z-Tree} and \emph{z-Leaf} versions should be co The directories in the \texttt{data} directory should be copied to the \emph{zTree installation directory}. -Afterwards place the \texttt{Labcontrol.conf} in a subfolder \texttt{Economic Laboratory} in the place where \emph{QSettings} stores its definitions on your platform (on \emph{Linux} this would be \texttt{/etc/xdg/Economic Laboratory/Labcontrol.conf}) and adjust it to your needs and prerequisites. +Afterwards place the \texttt{Labcontrol.conf} in a subfolder \texttt{Labcontrol} in the place where \emph{QSettings} stores its definitions on your platform (on \emph{Linux} this would be \texttt{/etc/xdg/Labcontrol/Labcontrol.conf}) and adjust it to your needs and prerequisites. To allow \emph{Labcontrol} to control the clients password-less public-key authentication must be available at least for the experiment user on the clients. For administration this is also required for \texttt{root}. Also all clients should be known by \texttt{ /etc/ssh/ssh\_known\_hosts}. This file must be readable by the users! If this is missing \emph{Labcontrol} will query the user on every connection attempt, which is not user-friendly. diff --git a/src/Lib/client.cpp b/src/Lib/client.cpp index 3680dc2..0a86444 100755 --- a/src/Lib/client.cpp +++ b/src/Lib/client.cpp @@ -157,26 +157,13 @@ void lc::Client::OpenTerminal( const QString &argCommand, const bool &argOpenAsR QStringList *arguments = nullptr; arguments = new QStringList; if ( !argOpenAsRoot ) { - *arguments << "--title" << name << "-e" << - QString{ settings->sshCmd + " -i " + settings->pkeyPathUser + " " - + settings->userNameOnClients + "@" + ip }; + *arguments << "-e" + << QString{ "'" + settings->sshCmd + " -i " + settings->pkeyPathUser + " " + + settings->userNameOnClients + "@" + ip + "'"}; } else { - *arguments << "--title" << name << "-e" << - QString{ settings->sshCmd + " -i " + settings->pkeyPathRoot - + " " + "root@" + ip }; - } - - if ( settings->termEmulCmd.contains( "konsole" ) ) { - arguments->prepend( "--new-tab" ); - arguments->prepend( "--show-tabbar" ); - } else { - if ( settings->termEmulCmd.contains( "gnome-terminal" ) ) { - arguments->prepend( "--tab" ); - } - } - - if ( !argCommand.isEmpty() ) { - arguments->last().append( " '" + argCommand + "'" ); + *arguments << "-e" << + QString{ "'" + settings->sshCmd + " -i " + settings->pkeyPathRoot + + " " + "root@" + ip + "'"}; } QProcess openTerminalProcess; @@ -208,7 +195,20 @@ void lc::Client::SetStateToZLEAF_RUNNING( QString argClientIP ) { } } -void lc::Client::ShowDesktop() { +void lc::Client::ShowDesktopViewOnly() { + QStringList arguments; + arguments << ip; + + QProcess showDesktopProcess; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + showDesktopProcess.setProcessEnvironment( env ); + showDesktopProcess.startDetached( settings->vncViewer, arguments ); + + // Output message via the debug messages tab + qDebug() << settings->vncViewer << arguments.join( " " ); +} + +void lc::Client::ShowDesktopFullControl() { QStringList arguments; arguments << ip; @@ -308,16 +308,18 @@ void lc::Client::StartClientBrowser( const QString * const argURL, const bool * //Declarations QStringList arguments; - // Output message via the debug messages tab - qDebug() << settings->sshCmd << arguments.join( " " ); - - //Build arguments list for SSH command + // 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"; + } + // Start the process QProcess startClientBrowserProcess; QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); @@ -335,11 +337,9 @@ void lc::Client::StopClientBrowser() { //Build arguments list arguments << "-i" << settings->pkeyPathUser << QString{ settings->userNameOnClients + "@" + ip } - << "DISPLAY=:0.0" << "killall" << settings->clientBrowserCmd - << "&& sleep 1" - << "&& rm -R /home/ewfuser/.mozilla/firefox/*"; + << "& sleep 1 && rm -R /home/ewfuser/.mozilla/firefox/*"; // Start the process QProcess startClientBrowserProcess; diff --git a/src/Lib/client.h b/src/Lib/client.h index 22f78fe..6cf1893 100755 --- a/src/Lib/client.h +++ b/src/Lib/client.h @@ -103,7 +103,8 @@ public: void SetSessionPort( int argSP ) { sessionPort = argSP; } void SetzLeafVersion( const QString &argzLeafV ) { zLeafVersion = argzLeafV; } //! Shows the desktop of the given client - void ShowDesktop(); + void ShowDesktopViewOnly(); + void ShowDesktopFullControl(); /*! * \brief Shuts down the client */ diff --git a/src/Lib/lablib.cpp b/src/Lib/lablib.cpp index 1f82560..3fcca0f 100755 --- a/src/Lib/lablib.cpp +++ b/src/Lib/lablib.cpp @@ -26,7 +26,7 @@ lc::Lablib::Lablib( QObject *argParent ) : QObject{ argParent }, - labSettings{ "Economic Laboratory", "Labcontrol", this }, + labSettings{ "Labcontrol", "Labcontrol", this }, sessionsModel{ new SessionsModel{ this } } { for ( const auto &s : settings->GetClients() ) { diff --git a/src/main.cpp b/src/main.cpp index d9f7695..ba01477 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ std::unique_ptr< lc::Settings > settings; int main( int argc, char *argv[] ) { QApplication a{ argc, argv }; - settings.reset( new lc::Settings{ QSettings{ "Economic Laboratory", "Labcontrol" } } ); + settings.reset( new lc::Settings{ QSettings{ "Labcontrol", "Labcontrol" } } ); lc::MainWindow w; w.show(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d467e91..26cff83 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -47,6 +47,37 @@ lc::MainWindow::MainWindow( QWidget *argParent ) : this, &MainWindow::UpdateClientsTableView ); gui_update_timer->start( 500 ); } + + /* session actions */ + + // Add z-Tree versions to the corresponding combo box + ui->CBzTreeVersion->addItem( tr( "Please choose a version:" ) ); + ui->CBzTreeVersion->addItems( settings->installedZTreeVersions ); + + // Add default path to the corresponding combo box + ui->CBDataTargetPath->addItem( tr( "Set a new path HERE" ) ); + ui->CBDataTargetPath->addItem( QDir::homePath() ); + ui->CBDataTargetPath->addItem( QDir::homePath() + "/zTreeData" ); + ui->CBDataTargetPath->setCurrentIndex( 2 ); + connect( this, &MainWindow::RequestNewDataTargetPath, + this, &MainWindow::GetNewDataTargetPath ); + + if ( settings->dvipsCmd.isEmpty() || settings->latexCmd.isEmpty() + || settings->lcInstDir.isEmpty() || settings->lprCmd.isEmpty() + || settings->postscriptViewer.isEmpty() || settings->ps2pdfCmd.isEmpty() + || settings->rmCmd.isEmpty() || settings->vncViewer.isEmpty() ) { + QMessageBox::information( this, tr( "Receipts printing will not work" ), + tr( "Some component essential for receipts creation and" + " printing is missing. No receipts will be created or" + " printed." ), QMessageBox::Ok ); + } else { + ui->CBReceiptsHeader->addItems( settings->installedLaTeXHeaders ); + + if ( settings->defaultReceiptIndex + && settings->defaultReceiptIndex < ui->CBReceiptsHeader->count() ) { + ui->CBReceiptsHeader->setCurrentIndex( settings->defaultReceiptIndex ); + } + } } lc::MainWindow::~MainWindow() { @@ -218,11 +249,6 @@ void lc::MainWindow::DisableDisfunctionalWidgets() { ui->PBStartzLeaf->setEnabled( false ); } - // Disable the disable screensaver function if the 'xset_command' was not set - //if ( settings->xsetCmd.isEmpty() ) { - // ui->PBDeactivateScreensaver->setEnabled( false ); - //} - if ( settings->zTreeInstDir.isEmpty() ) { ui->CBClientNames->setEnabled( false ); ui->LFakeName->setEnabled( false ); @@ -271,12 +297,19 @@ void lc::MainWindow::on_CBWebcamChooser_activated( int argIndex ) { void lc::MainWindow::on_PBBeamFile_clicked() { QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); const QString fileToBeam{ ui->LEFilePath->text() }; + if(fileToBeam == ""){ + QMessageBox::information(this, "Upload failed", "You didn't choose any folder to upload."); + } else { + //Iterate over the selected clients to upload the file for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); client->BeamFile( fileToBeam, &settings->pkeyPathUser, &settings->userNameOnClients ); } } + // Inform the user about the path + QMessageBox::information(this, "Upload completed", "The folder was copied to all selected clients.\nThe path on every client is /home/ewfuser" + fileToBeam.mid(fileToBeam.lastIndexOf('/')) +".\nDon't forget to adjust the media path within zTree!"); + } } void lc::MainWindow::on_PBBoot_clicked() { @@ -307,13 +340,6 @@ void lc::MainWindow::on_PBChooseFile_clicked() { delete file_dialog; } -/*void lc::MainWindow::on_PBDeactivateScreensaver_clicked() { - for ( auto s : settings->GetClients() ) { - if ( s->GetClientState() >= state_t::RESPONDING ) - s->DeactiveScreensaver(); - } -}*/ - void lc::MainWindow::on_PBExecute_clicked() { // This will be set to false, if the command shall be executed only on the chosen clients (that's if not all clients are up) bool executeOnEveryClient = true; @@ -384,16 +410,6 @@ void lc::MainWindow::on_PBKillLocalzLeaf_clicked() { qDebug() << program << arguments; } -void lc::MainWindow::on_PBKillzLeaf_clicked() { - 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->KillZLeaf(); - } - } -} - void lc::MainWindow::on_PBOpenFilesystem_clicked() { // Determine the correct user to be used QString * userToBeUsed = nullptr; @@ -504,39 +520,6 @@ void lc::MainWindow::on_PBStartLocalzLeaf_clicked() { localzLeafStarter, SLOT( deleteLater() ) ); } -void lc::MainWindow::on_PBStartSession_clicked() { - SessionStarter *sessionStarter = new SessionStarter{ lablib->GetOccupiedPorts(), this }; - sessionStarter->setWindowFlags( Qt::Window ); - sessionStarter->show(); - connect( sessionStarter, &SessionStarter::RequestNewSession, - lablib, &Lablib::StartNewSession ); - connect( sessionStarter, &SessionStarter::destroyed, - sessionStarter, &SessionStarter::deleteLater ); -// // Show an error message, if no zTree version was chosen yet -// if (ui->CBzTreeVersion->currentIndex() == 0) { -// QMessageBox messageBox{ QMessageBox::Warning, tr("Unset zTree version"), tr("There is no zTree version chosen yet. Please choose one."), QMessageBox::Ok, this }; -// messageBox.exec(); -// return; -// } - -// // Ask a second time, if no valid LaTeX header was set -// if (ui->CBReceiptsHeader->currentText() == "None found") { -// QMessageBox messageBox{ QMessageBox::Information, tr("No valid LaTeX header chosen"), -// tr("No valid LaTeX header was chosen. Receipts creation and printing will not work. Shall a new zTree instance be started nonetheless?"), QMessageBox::Yes | QMessageBox::No, this }; -// messageBox.exec(); -// if (messageBox.clickedButton() == messageBox.button(QMessageBox::No)) -// return; -// } - -// ui->CBDataTargetPath->setStyleSheet( "" ); -// ui->CBPrintanonymousreceipts->setStyleSheet( "" ); -// ui->CBReceiptsHeader->setStyleSheet( "" ); -// ui->CBReceiptsforLocalClients->setStyleSheet( "" ); -// ui->SBPort->setStyleSheet( "" ); - -// lablib->StartNewZTreeInstance(); -} - void lc::MainWindow::on_PBStartzLeaf_clicked() { QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { @@ -547,16 +530,6 @@ void lc::MainWindow::on_PBStartzLeaf_clicked() { } } -void lc::MainWindow::on_PBViewDesktop_clicked() { - QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); - for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { - if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { - Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); - client->ShowDesktop(); - } - } -} - void lc::MainWindow::on_RBUseLocalUser_toggled(bool checked) { if ( checked ) { qDebug() << "'RBUseLocalUser' got toggled."; @@ -595,7 +568,7 @@ void lc::MainWindow::SetupWidgets() { valid_items->squeeze(); } else { QMessageBox messageBox{ QMessageBox::Warning, tr( "Could not construct clients view" ), - tr( "The creation of the clients view failed. Please check the file '/etc/xdg/Economic Laboratory/Labcontrol.conf'." ), QMessageBox::Ok, this }; + tr( "The creation of the clients view failed. Please check the file '/etc/xdg/Labcontrol/Labcontrol.conf'." ), QMessageBox::Ok, this }; messageBox.exec(); ui->CBClientNames->setEnabled( false ); ui->GBClientActions->setEnabled( false ); @@ -732,16 +705,64 @@ void lc::MainWindow::UpdateClientsTableView() { } } -// TODO: Implement the functionality of the restore session script in here (no zenity script) -void lc::MainWindow::on_PBrestartCrashedSession_clicked() { - QProcess startProc; - startProc.setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); - if ( !settings->restartCrashedSessionScript.isEmpty() ) { - startProc.startDetached( settings->restartCrashedSessionScript); +void lc::MainWindow::on_PBstartBrowser_clicked() +{ + QString argURL = ui->LEURL->text(); + bool argFullscreen = ui->CBFullscreen->checkState(); + 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->StartClientBrowser( &argURL, &argFullscreen ); + } + } +} + +void lc::MainWindow::on_PBstopBrowser_clicked() +{ + // Confirmation dialog + QMessageBox::StandardButton reply; + reply = QMessageBox::question(this, "Confirm", "Really kill all selected browser instances?", QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) { + 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->StopClientBrowser( ); + } + } + } else { + qDebug() << "Canceled stopping all selected browser processes"; + } +} + +// View only VNC Button +void lc::MainWindow::on_PBViewDesktopViewOnly_clicked() +{ + QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); + for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { + if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { + Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); + client->ShowDesktopViewOnly(); + } + } +} + +void lc::MainWindow::on_PBViewDesktopFullControl_clicked() +{ + QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); + for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { + if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { + Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); + client->ShowDesktopFullControl(); + } } } -void lc::MainWindow::on_PBKillzTree_clicked() + +/* Session action functions */ + +void lc::MainWindow::on_PBStopZtree_clicked() { QString program{ settings->killallCmd }; QStringList arguments; @@ -758,37 +779,106 @@ void lc::MainWindow::on_PBKillzTree_clicked() // Output message via the debug messages tab qDebug() << program << arguments; } else { - qDebug() << "Canceled stopping all z-Tree processes"; + qDebug() << "Canceled stopping all z-Tree processes"; } } -void lc::MainWindow::on_PBstartBrowser_clicked() +void lc::MainWindow::on_PBRecoverCrashedSession_clicked() { - QString argURL = ui->LEURL->text(); - bool argFullscreen = ui->CBFullscreen->checkState(); - 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->StartClientBrowser( &argURL, &argFullscreen ); + // TODO: Implement the functionality of the restore session script in here (no zenity script) + QProcess startProc; + startProc.setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); + if ( !settings->restartCrashedSessionScript.isEmpty() ) { + startProc.startDetached( settings->restartCrashedSessionScript); } - } } -void lc::MainWindow::on_PBstopBrowser_clicked() +void lc::MainWindow::on_CBDataTargetPath_activated( int argIndex ) { - // Confirmation dialog - QMessageBox::StandardButton reply; - reply = QMessageBox::question(this, "Confirm", "Really kill all selected browser instances?", QMessageBox::Yes|QMessageBox::No); - if (reply == QMessageBox::Yes) { - 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->StopClientBrowser( ); + if ( !argIndex ) { + emit RequestNewDataTargetPath(); + } + + ui->CBDataTargetPath->setStyleSheet( "" ); +} + +// Open a folder coose dialog if first position in the combo box is clicked +void lc::MainWindow::GetNewDataTargetPath() { + QFileDialog fileDialog{ this }; + fileDialog.setFileMode( QFileDialog::Directory ); + fileDialog.setDirectory( QDir::homePath() ); + fileDialog.setOption( QFileDialog::ShowDirsOnly, true ); + fileDialog.setOption( QFileDialog::DontUseNativeDialog, true ); + if ( fileDialog.exec() ) { + const QString fileName = fileDialog.selectedFiles().at( 0 ); + ui->CBDataTargetPath->addItem( fileName ); + ui->CBDataTargetPath->setCurrentText( fileName ); + } +} + +// Start session button actions +void lc::MainWindow::on_PBStartSession_clicked() { + if ( ui->CBzTreeVersion->currentIndex() == 0 ) { + QMessageBox::information( this, tr( "No z-Tree version chosen" ), + tr( "A z-Tree version was not chosen, yet. This setting is" + " mandatory." ), QMessageBox::Ok ); + return; + } + + const QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); + if( !ui->ChBSessionWithoutAttachedClients->isChecked() ) { + if ( !activatedItems.length() ) { + QMessageBox::information( this, tr( "Canceled, no clients were chosen" ), + tr( "The start of a new session was canceled." + " Some clients have to be selected first or the" + " creation of sessions without clients must be" + " allowed with the checkbox close to the bottom" ) ); + return; + } + } + + QString anonymousReceiptsPlaceholder; + if ( ui->ChBPrintAnonymousReceipts->isChecked() ) { + anonymousReceiptsPlaceholder = ui->CBReplaceParticipantNames->currentText(); + } + + QVector< Client* > associatedClients; + for ( auto cit = activatedItems.cbegin(); cit != activatedItems.cend(); ++cit ) { + if ( ( *cit ).data( Qt::DisplayRole ).type() != 0 ) { + Client *client = static_cast< Client* >( ( *cit ).data( Qt::UserRole ).value< void* >() ); + client->SetSessionPort( ui->SBPort->value() ); + client->SetzLeafVersion( ui->CBzTreeVersion->currentText() ); + associatedClients.append( client ); + } + } + + emit RequestNewSession( associatedClients, anonymousReceiptsPlaceholder, + ui->ChBReceiptsForLocalClients->isChecked(), + ui->CBReceiptsHeader->currentText(), + ui->CBDataTargetPath->currentText(), + static_cast< quint16 >( ui->SBPort->value() ), + ui->CBzTreeVersion->currentText() ); + + //Start z-Leaf on selected clients if checkbox is activated + if( ui->ChBautoStartClientZleaf->isChecked() ) { + for ( auto cit = activatedItems.cbegin(); cit != activatedItems.cend(); ++cit ) { + if ( ( *cit ).data( Qt::DisplayRole ).type() != 0 ) { + Client *client = static_cast< Client* >( ( *cit ).data( Qt::UserRole ).value< void * >() ); + client->StartZLeaf( nullptr ); } } - } else { - qDebug() << "Canceled stopping all selected browser processes"; } } + +// Anonymous receipients header check box +void lc::MainWindow::on_ChBPrintanonymousreceipts_clicked() +{ + ui->LReplaceParticipantNames->setEnabled(true); + ui->CBReplaceParticipantNames->setEnabled(true); +} + +void lc::MainWindow::on_CBReceiptsHeader_activated(int argIndex) +{ + Q_UNUSED( argIndex ); + ui->CBReceiptsHeader->setStyleSheet( "" ); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 2761216..0b78ac5 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -62,7 +62,6 @@ private slots: void on_PBChooseFile_clicked(); void on_PBExecute_clicked(); void on_PBKillLocalzLeaf_clicked(); - void on_PBKillzLeaf_clicked(); void on_PBOpenFilesystem_clicked(); void on_PBOpenTerminal_clicked(); void on_PBPrintPaymentFileManually_clicked(); @@ -73,7 +72,8 @@ private slots: void on_PBStartLocalzLeaf_clicked(); void on_PBStartSession_clicked(); void on_PBStartzLeaf_clicked(); - void on_PBViewDesktop_clicked(); + void on_PBViewDesktopViewOnly_clicked(); + void on_PBViewDesktopFullControl_clicked(); void on_RBUseLocalUser_toggled(bool checked); void StartLocalzLeaf( QString argzLeafName, QString argzLeafVersion, int argzTreePort ); //! Updates the icons of the QTableView displaying the clients' states @@ -84,6 +84,12 @@ private slots: void UpdateClientsTableView(); signals: + /*Session actions*/ + void RequestNewDataTargetPath(); + void RequestNewSession( QVector< Client* > argAssocCl, QString argParticipNameReplacement, + bool argPrintLocalReceipts, QString argReceiptsHeader, + QString argzTreeDataTargetPath, quint16 argzTreePort, + QString argzTreeVersion ); private: //! Checks, if the user has administrative rights @@ -113,10 +119,16 @@ private slots: QString argAnonymousReceiptsPlaceholder, QString argLatexHeaderName, QString argDateString ); - void on_PBrestartCrashedSession_clicked(); - void on_PBKillzTree_clicked(); void on_PBstartBrowser_clicked(); void on_PBstopBrowser_clicked(); + + /* Session actions */ + void on_PBStopZtree_clicked(); + void on_PBRecoverCrashedSession_clicked(); + void GetNewDataTargetPath(); + void on_CBDataTargetPath_activated( int argIndex ); + void on_CBReceiptsHeader_activated(int argIndex); + void on_ChBPrintanonymousreceipts_clicked(); }; } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 066a1af..7d2cf24 100755 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -6,10 +6,16 @@ 0 0 - 658 + 730 900 + + + 0 + 0 + + Labcontrol @@ -18,6 +24,15 @@ ../../../../../../usr/local/share/labcontrol/icons/icon.png../../../../../../usr/local/share/labcontrol/icons/icon.png + + true + + + + 0 + 0 + + @@ -25,158 +40,108 @@ true - + 0 0 + + + 640 + 580 + + + + + 0 + 0 + + + + + false + true + + - 0 + 1 + + + true + + + false + + true + + + + 0 + 0 + + - Experiment actions + Experiment prepatation + + + 0 + 0 + + Experiment preparation / server actions - - - Show ORSEE - - - - - - - Qt::Horizontal - - - - - + - Show preprints + Plan a session or print attendee list - - - Choose a payment file manually, which will then be printed. - + - Print payment file manually + Show ORSEE - + Qt::Horizontal - - - Stop all local z-Tree instances - - - Stop z-Tree - - - - - + - Continue crashed session - - - - - - - Qt::Horizontal - - - - - - - - - Start local z-Leaf - - - - - - - Stop local z-Leaf - - - - - - - - - Qt::Horizontal + Print local files - - - true - - - - 16777215 - 16777215 - - + - <html><head/><body><p>Run zLeaf with another name than local <br/>(or selected client's hostname):</p></body></html> - - - Qt::RichText - - - false - - - true + Show preprints - - - true - - - Choose the name z-Leaf shall have + + + Choose a payment file manually, which will then be printed. - - - Choose the name the z-Leaf shall have - - - - - - - Run z-Leaf with chosen name + Print payment file manually @@ -190,7 +155,7 @@ - Show webcams: + Show webcams @@ -228,6 +193,15 @@ + + true + + + + 0 + 0 + + Client actions @@ -259,26 +233,6 @@ - - - - Starts zLeaf on the selected clients with the port given in the 'zTree' groupbox. - - - Start z-Leaf on selected clients - - - - - - - Stops zLeaf on all selected clients - - - Stop z-Leaf on selected clients - - - @@ -317,7 +271,7 @@ - Upload folder to all selected clients: + Upload folder to all selected clients Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft @@ -363,7 +317,7 @@ - Start browser on all selected clients: + Start browser on all selected clients @@ -437,33 +391,27 @@ true + + + 0 + 439 + + Session actions - + - 9 - 69 - 311 - 391 + 10 + 10 + 691 + 103 - - - 9 - - - 9 - - - 9 - - - 9 - + - + 50 @@ -471,215 +419,386 @@ - New session + Cleanup / recover last session - + - + - z-Tree version + Stop z-Tree - - - - + - Data target path: + Recover crashed session - - - - - - - - - Port: - - - - - - - 7000 - - - 10000 - - - - - - - - Use ramdisk for gamesafe file - - - - - - - Allow session without attached clients - - - - - - - Start z-Leaf on clients with the session + + + Stops zLeaf on all selected clients - - true - - - - - - Start session + Stop z-Leaf on selected clients - + - Qt::Vertical - - - - 20 - 40 - + Qt::Horizontal - + - + 10 - 10 - 621 - 55 + 120 + 691 + 469 - + + + QLayout::SetDefaultConstraint + - - - - 50 - false - - + - Cleanup / recover last session + New Session - + - - - Stop z-Tree + + + 9 - - - - - - Recover crashed session + + 9 - - - - - - - - Qt::Horizontal - - - - - - - - - 330 - 100 - 301 - 361 - - - - - - - Template for receipts: - - - - - - - - - - Print anonymous receipts - - - - - - - Substitute participant names with: - - - - - - - - - - Print receipt for local client - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - false - + + 9 + + + 9 + + + + + z-Tree version + + + + + + + + + + Data target path: + + + + + + + + + + 0 + + + + + + + Port: + + + + + + + 7000 + + + 10000 + + + + + + + + + + + Qt::Horizontal + + + + + + + Template for receipts + + + + + + + + + + Print anonymous receipts + + + + + + + false + + + Replace participant names with: + + + + + + + false + + + true + + + + \hspace{5cm} + + + + + anonym + + + + + anonymous + + + + + nicht ausfüllen + + + + + + + + Print receipt for local client + + + false + + + + + + + Qt::Horizontal + + + + + + + true + + + Use ramdisk for gamesafe file + + + + + + + Allow session without attached clients + + + + + + + Start z-Leaf on clients with the session + + + true + + + + + + + Start session + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + z-Leaves + + + 4 + + + + + + + Starts zLeaf on the selected clients with the port given in the 'zTree' groupbox. + + + Start z-Leaf on selected clients + + + + + + + Qt::Horizontal + + + + + + + true + + + + 16777215 + 16777215 + + + + <html><head/><body><p>Run zLeaf with another name<br/>(select a single client):</p></body></html> + + + Qt::RichText + + + false + + + true + + + + + + + true + + + Choose the name z-Leaf shall have + + + + Choose the name z-Leaf shall have + + + + + + + + Run z-Leaf with chosen name + + + + + + + Qt::Horizontal + + + + + + + + + Start local z-Leaf + + + + + + + Stop local z-Leaf + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + false + Admin actions @@ -793,7 +912,7 @@ - + Settings @@ -802,8 +921,8 @@ 10 10 - 371 - 451 + 311 + 201 @@ -879,17 +998,6 @@ - - - - 390 - 10 - 381 - 451 - - - - @@ -918,15 +1026,65 @@ true + + + 0 + 0 + + 0 256 - + + + 8 + + + false + + Qt::LeftToRight + + + false + + + true + + + true + + + true + + + true + + + 115 + + + 30 + + + true + + + true + + + 35 + + + 25 + + + true + diff --git a/src/sessionstarter.cpp b/src/sessionstarter.cpp index 44f9940..1c44be4 100755 --- a/src/sessionstarter.cpp +++ b/src/sessionstarter.cpp @@ -98,6 +98,7 @@ lc::SessionStarter::SessionStarter( const QVector< quint16 > &argOccupiedPorts, lc::SessionStarter::~SessionStarter() { delete ui; } + void lc::SessionStarter::CheckIfPortIsOccupied( quint16 argPort ) { if ( occupiedPorts.contains( argPort ) ) { CheckIfPortIsOccupied( argPort + 1 );