Changed file permissions for group writing, added size parameter for local zleaf. renamed Beam file to Beam folder, disabled self shutdown, fixed webcam dropdown (added Choose webcam entry), added autostart z-leaf on client with session button, added Restart crashed session button

remotes/origin/HEAD
Tobias Weiss 8 years ago
parent f27e5cde1d
commit f1cd123a79

@ -28,7 +28,8 @@ killall_command=/usr/bin/killall
labcontrol_installation_directory=/usr/local/share/labcontrol labcontrol_installation_directory=/usr/local/share/labcontrol
latex_command=/usr/bin/latex latex_command=/usr/bin/latex
# The default name for locally started zLeaves # The default name for locally started zLeaves
local_zLeaf_name=local local_zLeaf_name=local
local_zLeaf_size=1280x1024
lpr_command=/usr/bin/lpr lpr_command=/usr/bin/lpr
netstat_command=/bin/netstat netstat_command=/bin/netstat
network_broadcast_address=192.168.1.255 network_broadcast_address=192.168.1.255
@ -60,3 +61,5 @@ wmctrl_command=/usr/bin/wmctrl
xset_command=/usr/bin/xset xset_command=/usr/bin/xset
# The folder were all zTree versions are installed (in subfolders matching the scheme zTree_X.Y.Z) # The folder were all zTree versions are installed (in subfolders matching the scheme zTree_X.Y.Z)
ztree_installation_directory=/opt/z-Leaves ztree_installation_directory=/opt/z-Leaves
# Script to be called after session crash
restart_crashed_session_script=/home/scripts/start_zTree_after_crash.sh

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

@ -47,6 +47,9 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
"Labcontrol will missbehave with high propability.", "Labcontrol will missbehave with high propability.",
argSettings, true ) }, argSettings, true ) },
localUserName{ GetLocalUserName() }, localUserName{ GetLocalUserName() },
localzLeafSize{ ReadSettingsItem( "local_zLeaf_size",
"Resolution of local zLeaf window",
argSettings, false ) },
lprCmd{ ReadSettingsItem( "lpr_command", lprCmd{ ReadSettingsItem( "lpr_command",
"Receipts printing will not work.", "Receipts printing will not work.",
argSettings, true ) }, argSettings, true ) },
@ -118,6 +121,9 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
zTreeInstDir{ ReadSettingsItem( "ztree_installation_directory", zTreeInstDir{ ReadSettingsItem( "ztree_installation_directory",
"zTree will not be available.", "zTree will not be available.",
argSettings, true ) }, argSettings, true ) },
restartCrashedSessionScript{ ReadSettingsItem( "restart_crashed_session_script",
"Script to be called after session crash",
argSettings, false ) },
adminUsers{ GetAdminUsers( argSettings ) }, adminUsers{ GetAdminUsers( argSettings ) },
installedLaTeXHeaders{ DetectInstalledLaTeXHeaders() }, installedLaTeXHeaders{ DetectInstalledLaTeXHeaders() },
installedZTreeVersions{ DetectInstalledzTreeVersions() }, installedZTreeVersions{ DetectInstalledzTreeVersions() },

@ -54,6 +54,7 @@ public:
const QString latexCmd; const QString latexCmd;
const QString lcInstDir; const QString lcInstDir;
const QString localUserName; const QString localUserName;
const QString localzLeafSize;
const QString lprCmd; const QString lprCmd;
const QString netstatCmd; const QString netstatCmd;
const QString netwBrdAddr; const QString netwBrdAddr;
@ -78,6 +79,7 @@ public:
const QString wmctrlCmd; const QString wmctrlCmd;
const QString xsetCmd; const QString xsetCmd;
const QString zTreeInstDir; const QString zTreeInstDir;
const QString restartCrashedSessionScript;
const QStringList adminUsers; const QStringList adminUsers;
const QStringList installedLaTeXHeaders; const QStringList installedLaTeXHeaders;
const QStringList installedZTreeVersions; const QStringList installedZTreeVersions;

@ -30,7 +30,7 @@ lc::ZTree::ZTree( const QString &argZTreeDataTargetPath, const int &argZTreePort
const QString &argZTreeVersionPath, QObject *argParent ) : const QString &argZTreeVersionPath, QObject *argParent ) :
QObject{ argParent } QObject{ argParent }
{ {
QStringList arguments{ QStringList{} << "0x00000001" << settings->wineCmd QStringList arguments{ QStringList{} << "-c" << "0" << settings->wineCmd
<< QString{ settings->zTreeInstDir + "/zTree_" << QString{ settings->zTreeInstDir + "/zTree_"
+ argZTreeVersionPath + "/ztree.exe" } + argZTreeVersionPath + "/ztree.exe" }
<< "/datadir" << QString{ "Z:/" + argZTreeDataTargetPath } << "/datadir" << QString{ "Z:/" + argZTreeDataTargetPath }
@ -42,6 +42,7 @@ lc::ZTree::ZTree( const QString &argZTreeDataTargetPath, const int &argZTreePort
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
zTreeInstance.setProcessEnvironment( env ); zTreeInstance.setProcessEnvironment( env );
zTreeInstance.setWorkingDirectory( QDir::homePath() );
zTreeInstance.start( settings->tasksetCmd, arguments, QIODevice::NotOpen ); zTreeInstance.start( settings->tasksetCmd, arguments, QIODevice::NotOpen );
connect( &zTreeInstance, SIGNAL( finished( int ) ), connect( &zTreeInstance, SIGNAL( finished( int ) ),
this, SIGNAL( ZTreeClosed( int ) ) ); this, SIGNAL( ZTreeClosed( int ) ) );

@ -475,7 +475,12 @@ void lc::MainWindow::on_PBShutdown_clicked() {
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); 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" } << QString{ settings->zTreeInstDir + "/zTree_" + argzLeafVersion + "/zleaf.exe" }
<< "/server" << "127.0.0.1" << "/channel" << "/server" << "127.0.0.1" << "/channel"
<< QString::number( argzTreePort - 7000 ) << "/name" << argzLeafName; << QString::number( argzTreePort - 7000 ) << "/name" << argzLeafName;
if ( !settings->localzLeafSize.isEmpty() ) {
arguments << "/size" << QString{ settings->localzLeafSize };
}
startProc.startDetached( settings->tasksetCmd, arguments ); 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);
}
}

@ -116,6 +116,7 @@ private slots:
QString argAnonymousReceiptsPlaceholder, QString argAnonymousReceiptsPlaceholder,
QString argLatexHeaderName, QString argLatexHeaderName,
QString argDateString ); QString argDateString );
void on_PBrestartCrashedSession_clicked();
}; };
} }

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>864</height> <height>900</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -186,6 +186,13 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QPushButton" name="PBrestartCrashedSession">
<property name="text">
<string>Restart crashed session</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -203,7 +210,13 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="CBWebcamChooser"/> <widget class="QComboBox" name="CBWebcamChooser">
<item>
<property name="text">
<string>Choose webcam</string>
</property>
</item>
</widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="PBDeactivateScreensaver"> <widget class="QPushButton" name="PBDeactivateScreensaver">
@ -261,7 +274,7 @@
<item> <item>
<widget class="QPushButton" name="PBChooseFile"> <widget class="QPushButton" name="PBChooseFile">
<property name="text"> <property name="text">
<string>Choose file</string> <string>Choose folder</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -277,7 +290,7 @@
<item> <item>
<widget class="QPushButton" name="PBBeamFile"> <widget class="QPushButton" name="PBBeamFile">
<property name="text"> <property name="text">
<string>Beam file to ~/media4zTree</string> <string>Beam folder to ~/media4zTree on all clients</string>
</property> </property>
</widget> </widget>
</item> </item>

@ -186,6 +186,16 @@ void lc::SessionStarter::on_PBStartSession_clicked() {
static_cast< quint16 >( ui->SBPort->value() ), static_cast< quint16 >( ui->SBPort->value() ),
ui->CBzTreeVersion->currentText() ); 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(); this->deleteLater();
} }

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>640</width> <width>640</width>
<height>576</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -254,6 +254,12 @@ Warning: If this is disabled no receipts will be printed for ANY participant who
</item> </item>
<item> <item>
<widget class="QCheckBox" name="ChBSessionWithoutClients"> <widget class="QCheckBox" name="ChBSessionWithoutClients">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip"> <property name="toolTip">
<string>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.</string> <string>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.</string>
</property> </property>
@ -262,6 +268,13 @@ Warning: If this is disabled no receipts will be printed for ANY participant who
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="ChBautoStartClientZleaf">
<property name="text">
<string>Start z-Leaf on clients with the session</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="PBStartSession"> <widget class="QPushButton" name="PBStartSession">
<property name="toolTip"> <property name="toolTip">

Loading…
Cancel
Save