diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.gitmodules b/.gitmodules old mode 100644 new mode 100755 diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/Doxyfile b/Doxyfile old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Labcontrol.pro b/Labcontrol.pro old mode 100644 new mode 100755 diff --git a/PROGRAMMING.md b/PROGRAMMING.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/data/Labcontrol.conf b/data/Labcontrol.conf old mode 100644 new mode 100755 index 2fdcc83..bf54f48 --- a/data/Labcontrol.conf +++ b/data/Labcontrol.conf @@ -28,7 +28,8 @@ killall_command=/usr/bin/killall labcontrol_installation_directory=/usr/local/share/labcontrol latex_command=/usr/bin/latex # The default name for locally started zLeaves -local_zLeaf_name=local +local_zLeaf_name=local +local_zLeaf_size=1280x1024 lpr_command=/usr/bin/lpr netstat_command=/bin/netstat network_broadcast_address=192.168.1.255 @@ -60,3 +61,5 @@ wmctrl_command=/usr/bin/wmctrl xset_command=/usr/bin/xset # The folder were all zTree versions are installed (in subfolders matching the scheme zTree_X.Y.Z) ztree_installation_directory=/opt/z-Leaves +# Script to be called after session crash +restart_crashed_session_script=/home/scripts/start_zTree_after_crash.sh \ No newline at end of file diff --git a/data/example_header.tex b/data/example_header.tex old mode 100644 new mode 100755 diff --git a/data/icons/boot.png b/data/icons/boot.png old mode 100644 new mode 100755 diff --git a/data/icons/boot.svg b/data/icons/boot.svg old mode 100644 new mode 100755 diff --git a/data/icons/down.png b/data/icons/down.png old mode 100644 new mode 100755 diff --git a/data/icons/down.svg b/data/icons/down.svg old mode 100644 new mode 100755 diff --git a/data/icons/icon.png b/data/icons/icon.png old mode 100644 new mode 100755 diff --git a/data/icons/icon.svg b/data/icons/icon.svg old mode 100644 new mode 100755 diff --git a/data/icons/off.png b/data/icons/off.png old mode 100644 new mode 100755 diff --git a/data/icons/off.svg b/data/icons/off.svg old mode 100644 new mode 100755 diff --git a/data/icons/on.png b/data/icons/on.png old mode 100644 new mode 100755 diff --git a/data/icons/on.svg b/data/icons/on.svg old mode 100644 new mode 100755 diff --git a/data/icons/unknown.png b/data/icons/unknown.png old mode 100644 new mode 100755 diff --git a/data/icons/unknown.svg b/data/icons/unknown.svg old mode 100644 new mode 100755 diff --git a/data/icons/zLeaf.png b/data/icons/zLeaf.png old mode 100644 new mode 100755 diff --git a/data/icons/zLeaf.svg b/data/icons/zLeaf.svg old mode 100644 new mode 100755 diff --git a/doc/manual.tex b/doc/manual.tex old mode 100644 new mode 100755 diff --git a/doc/pictures/startup_screen.png b/doc/pictures/startup_screen.png old mode 100644 new mode 100755 diff --git a/labcontrol.desktop b/labcontrol.desktop old mode 100644 new mode 100755 diff --git a/src/Lib/client.cpp b/src/Lib/client.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/client.h b/src/Lib/client.h old mode 100644 new mode 100755 diff --git a/src/Lib/clienthelpnotificationserver.cpp b/src/Lib/clienthelpnotificationserver.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/clienthelpnotificationserver.h b/src/Lib/clienthelpnotificationserver.h old mode 100644 new mode 100755 diff --git a/src/Lib/clientpinger.cpp b/src/Lib/clientpinger.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/clientpinger.h b/src/Lib/clientpinger.h old mode 100644 new mode 100755 diff --git a/src/Lib/global.h b/src/Lib/global.h old mode 100644 new mode 100755 diff --git a/src/Lib/lablib.cpp b/src/Lib/lablib.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/lablib.h b/src/Lib/lablib.h old mode 100644 new mode 100755 diff --git a/src/Lib/netstatagent.cpp b/src/Lib/netstatagent.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/netstatagent.h b/src/Lib/netstatagent.h old mode 100644 new mode 100755 diff --git a/src/Lib/receipts_handler.cpp b/src/Lib/receipts_handler.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/receipts_handler.h b/src/Lib/receipts_handler.h old mode 100644 new mode 100755 diff --git a/src/Lib/receiptsprinter.cpp b/src/Lib/receiptsprinter.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/receiptsprinter.h b/src/Lib/receiptsprinter.h old mode 100644 new mode 100755 diff --git a/src/Lib/session.cpp b/src/Lib/session.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/session.h b/src/Lib/session.h old mode 100644 new mode 100755 diff --git a/src/Lib/sessionsmodel.cpp b/src/Lib/sessionsmodel.cpp old mode 100644 new mode 100755 diff --git a/src/Lib/sessionsmodel.h b/src/Lib/sessionsmodel.h old mode 100644 new mode 100755 diff --git a/src/Lib/settings.cpp b/src/Lib/settings.cpp old mode 100644 new mode 100755 index 688fa27..fb26344 --- a/src/Lib/settings.cpp +++ b/src/Lib/settings.cpp @@ -47,6 +47,9 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) : "Labcontrol will missbehave with high propability.", argSettings, true ) }, localUserName{ GetLocalUserName() }, + localzLeafSize{ ReadSettingsItem( "local_zLeaf_size", + "Resolution of local zLeaf window", + argSettings, false ) }, lprCmd{ ReadSettingsItem( "lpr_command", "Receipts printing will not work.", argSettings, true ) }, @@ -118,6 +121,9 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) : zTreeInstDir{ ReadSettingsItem( "ztree_installation_directory", "zTree will not be available.", argSettings, true ) }, + restartCrashedSessionScript{ ReadSettingsItem( "restart_crashed_session_script", + "Script to be called after session crash", + argSettings, false ) }, adminUsers{ GetAdminUsers( argSettings ) }, installedLaTeXHeaders{ DetectInstalledLaTeXHeaders() }, installedZTreeVersions{ DetectInstalledzTreeVersions() }, diff --git a/src/Lib/settings.h b/src/Lib/settings.h old mode 100644 new mode 100755 index e981c56..f727369 --- a/src/Lib/settings.h +++ b/src/Lib/settings.h @@ -54,6 +54,7 @@ public: const QString latexCmd; const QString lcInstDir; const QString localUserName; + const QString localzLeafSize; const QString lprCmd; const QString netstatCmd; const QString netwBrdAddr; @@ -78,6 +79,7 @@ public: const QString wmctrlCmd; const QString xsetCmd; const QString zTreeInstDir; + const QString restartCrashedSessionScript; const QStringList adminUsers; const QStringList installedLaTeXHeaders; const QStringList installedZTreeVersions; diff --git a/src/Lib/ztree.cpp b/src/Lib/ztree.cpp old mode 100644 new mode 100755 index 5622908..706d11b --- a/src/Lib/ztree.cpp +++ b/src/Lib/ztree.cpp @@ -30,7 +30,7 @@ lc::ZTree::ZTree( const QString &argZTreeDataTargetPath, const int &argZTreePort const QString &argZTreeVersionPath, QObject *argParent ) : QObject{ argParent } { - QStringList arguments{ QStringList{} << "0x00000001" << settings->wineCmd + QStringList arguments{ QStringList{} << "-c" << "0" << settings->wineCmd << QString{ settings->zTreeInstDir + "/zTree_" + argZTreeVersionPath + "/ztree.exe" } << "/datadir" << QString{ "Z:/" + argZTreeDataTargetPath } @@ -42,6 +42,7 @@ lc::ZTree::ZTree( const QString &argZTreeDataTargetPath, const int &argZTreePort QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); zTreeInstance.setProcessEnvironment( env ); + zTreeInstance.setWorkingDirectory( QDir::homePath() ); zTreeInstance.start( settings->tasksetCmd, arguments, QIODevice::NotOpen ); connect( &zTreeInstance, SIGNAL( finished( int ) ), this, SIGNAL( ZTreeClosed( int ) ) ); diff --git a/src/Lib/ztree.h b/src/Lib/ztree.h old mode 100644 new mode 100755 diff --git a/src/helpmessagesender/HelpMessageSender.pro b/src/helpmessagesender/HelpMessageSender.pro old mode 100644 new mode 100755 diff --git a/src/helpmessagesender/helpmessagewindow.cpp b/src/helpmessagesender/helpmessagewindow.cpp old mode 100644 new mode 100755 diff --git a/src/helpmessagesender/helpmessagewindow.h b/src/helpmessagesender/helpmessagewindow.h old mode 100644 new mode 100755 diff --git a/src/helpmessagesender/helpmessagewindow.ui b/src/helpmessagesender/helpmessagewindow.ui old mode 100644 new mode 100755 diff --git a/src/helpmessagesender/main.cpp b/src/helpmessagesender/main.cpp old mode 100644 new mode 100755 diff --git a/src/localzleafstarter.cpp b/src/localzleafstarter.cpp old mode 100644 new mode 100755 diff --git a/src/localzleafstarter.h b/src/localzleafstarter.h old mode 100644 new mode 100755 diff --git a/src/localzleafstarter.ui b/src/localzleafstarter.ui old mode 100644 new mode 100755 diff --git a/src/main.cpp b/src/main.cpp old mode 100644 new mode 100755 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp old mode 100644 new mode 100755 index 90a34ee..acc776b --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -475,7 +475,12 @@ void lc::MainWindow::on_PBShutdown_clicked() { 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->Shutdown(); + // Do not shut down the server itself + if ( client->name == "self"){ + QMessageBox::information(NULL, "Shutdown canceled", "It is not allowed to shutdown the server itself via labcontrol!"); + } else { + client->Shutdown(); + } } } } @@ -672,6 +677,10 @@ void lc::MainWindow::StartLocalzLeaf( QString argzLeafName, QString argzLeafVers << QString{ settings->zTreeInstDir + "/zTree_" + argzLeafVersion + "/zleaf.exe" } << "/server" << "127.0.0.1" << "/channel" << QString::number( argzTreePort - 7000 ) << "/name" << argzLeafName; + if ( !settings->localzLeafSize.isEmpty() ) { + arguments << "/size" << QString{ settings->localzLeafSize }; + } + startProc.startDetached( settings->tasksetCmd, arguments ); } @@ -718,3 +727,12 @@ void lc::MainWindow::UpdateClientsTableView() { } } } + +// TODO: Implement the functionality of the script in here +void lc::MainWindow::on_PBrestartCrashedSession_clicked() { + QProcess startProc; + startProc.setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); + if ( !settings->restartCrashedSessionScript.isEmpty() ) { + startProc.startDetached( settings->restartCrashedSessionScript); + } +} diff --git a/src/mainwindow.h b/src/mainwindow.h old mode 100644 new mode 100755 index e2c0518..6d56d50 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -116,6 +116,7 @@ private slots: QString argAnonymousReceiptsPlaceholder, QString argLatexHeaderName, QString argDateString ); + void on_PBrestartCrashedSession_clicked(); }; } diff --git a/src/mainwindow.ui b/src/mainwindow.ui old mode 100644 new mode 100755 index 9d873d8..121f9eb --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 800 - 864 + 900 @@ -186,6 +186,13 @@ + + + + Restart crashed session + + + @@ -203,7 +210,13 @@ - + + + + Choose webcam + + + @@ -261,7 +274,7 @@ - Choose file + Choose folder @@ -277,7 +290,7 @@ - Beam file to ~/media4zTree + Beam folder to ~/media4zTree on all clients diff --git a/src/manualprintingsetup.cpp b/src/manualprintingsetup.cpp old mode 100644 new mode 100755 diff --git a/src/manualprintingsetup.h b/src/manualprintingsetup.h old mode 100644 new mode 100755 diff --git a/src/manualprintingsetup.ui b/src/manualprintingsetup.ui old mode 100644 new mode 100755 diff --git a/src/sessiondisplay.cpp b/src/sessiondisplay.cpp old mode 100644 new mode 100755 diff --git a/src/sessiondisplay.h b/src/sessiondisplay.h old mode 100644 new mode 100755 diff --git a/src/sessiondisplay.ui b/src/sessiondisplay.ui old mode 100644 new mode 100755 diff --git a/src/sessionstarter.cpp b/src/sessionstarter.cpp old mode 100644 new mode 100755 index 8d6ae83..44f9940 --- a/src/sessionstarter.cpp +++ b/src/sessionstarter.cpp @@ -186,6 +186,16 @@ void lc::SessionStarter::on_PBStartSession_clicked() { 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 ); + } + } + } + this->deleteLater(); } diff --git a/src/sessionstarter.h b/src/sessionstarter.h old mode 100644 new mode 100755 diff --git a/src/sessionstarter.ui b/src/sessionstarter.ui old mode 100644 new mode 100755 index cbbcd5e..18ad722 --- a/src/sessionstarter.ui +++ b/src/sessionstarter.ui @@ -7,7 +7,7 @@ 0 0 640 - 576 + 600 @@ -254,6 +254,12 @@ Warning: If this is disabled no receipts will be printed for ANY participant who + + + 0 + 0 + + This allows an experimenter to override the normally hard requirement of choosing clients to be attached to the started session and start a session without attached clients. @@ -262,6 +268,13 @@ Warning: If this is disabled no receipts will be printed for ANY participant who + + + + Start z-Leaf on clients with the session + + +