Added functionality to new layout. Moved config location.

remotes/origin/HEAD
Tobias Weiss 7 years ago
parent adcfb722b9
commit 7bea07b7ac

@ -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.

@ -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,9 +308,6 @@ 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
arguments << "-i" << settings->pkeyPathUser
<< QString{ settings->userNameOnClients + "@" + ip }
@ -318,6 +315,11 @@ void lc::Client::StartClientBrowser( const QString * const argURL, const bool *
<< 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;

@ -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
*/

@ -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() ) {

@ -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();

@ -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;
@ -762,33 +783,102 @@ void lc::MainWindow::on_PBKillzTree_clicked()
}
}
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;
}
} else {
qDebug() << "Canceled stopping all selected browser processes";
}
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 );
}
}
}
}
// 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( "" );
}

@ -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();
};
}

@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>658</width>
<width>730</width>
<height>900</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Labcontrol</string>
</property>
@ -18,6 +24,15 @@
<normaloff>../../../../../../usr/local/share/labcontrol/icons/icon.png</normaloff>../../../../../../usr/local/share/labcontrol/icons/icon.png</iconset>
</property>
<widget class="QWidget" name="centralWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QTabWidget" name="TWExperimenterTab">
@ -25,158 +40,108 @@
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>580</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<underline>false</underline>
<kerning>true</kerning>
</font>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
</property>
<property name="tabBarAutoHide">
<bool>false</bool>
</property>
<widget class="QWidget" name="TExperimenterActions">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="title">
<string>Experiment actions</string>
<string>Experiment prepatation</string>
</attribute>
<layout class="QHBoxLayout" name="HLExperimenterTab" stretch="1,1">
<item>
<layout class="QVBoxLayout" name="VLzTreeClientActions">
<item>
<widget class="QGroupBox" name="GBLocalActions">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Experiment preparation / server actions</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="PBShowORSEE">
<widget class="QLabel" name="LPlanSession">
<property name="text">
<string>Show ORSEE</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_ORSEE">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<string>Plan a session or print attendee list</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBShowPreprints">
<property name="text">
<string>Show preprints</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBPrintPaymentFileManually">
<property name="toolTip">
<string>Choose a payment file manually, which will then be printed.</string>
</property>
<property name="text">
<string>Print payment file manually</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_preprints">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBKillzTree">
<property name="toolTip">
<string>Stop all local z-Tree instances</string>
</property>
<property name="text">
<string>Stop z-Tree</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBrestartCrashedSession">
<widget class="QPushButton" name="PBShowORSEE">
<property name="text">
<string>Continue crashed session</string>
<string>Show ORSEE</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_zTree">
<widget class="Line" name="line_ORSEE">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="HLLocalzLeaf">
<item>
<widget class="QPushButton" name="PBStartLocalzLeaf">
<property name="text">
<string>Start local z-Leaf</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBKillLocalzLeaf">
<widget class="QLabel" name="LPrintLocalFiles">
<property name="text">
<string>Stop local z-Leaf</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_localZleaf">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<string>Print local files</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="LFakeName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<widget class="QPushButton" name="PBShowPreprints">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Run zLeaf with another name than local &lt;br/&gt;(or selected client's hostname):&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
<string>Show preprints</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="CBClientNames">
<property name="editable">
<bool>true</bool>
</property>
<property name="currentText">
<string>Choose the name z-Leaf shall have</string>
<widget class="QPushButton" name="PBPrintPaymentFileManually">
<property name="toolTip">
<string>Choose a payment file manually, which will then be printed.</string>
</property>
<item>
<property name="text">
<string>Choose the name the z-Leaf shall have</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBRunzLeaf">
<property name="text">
<string>Run z-Leaf with chosen name</string>
<string>Print payment file manually</string>
</property>
</widget>
</item>
@ -190,7 +155,7 @@
<item>
<widget class="QLabel" name="LWebcamChooser">
<property name="text">
<string>Show webcams:</string>
<string>Show webcams</string>
</property>
</widget>
</item>
@ -228,6 +193,15 @@
</property>
<item>
<widget class="QGroupBox" name="GBClientActions">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Client actions</string>
</property>
@ -259,26 +233,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBStartzLeaf">
<property name="toolTip">
<string>Starts zLeaf on the selected clients with the port given in the 'zTree' groupbox.</string>
</property>
<property name="text">
<string>Start z-Leaf on selected clients</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBKillzLeaf">
<property name="toolTip">
<string>Stops zLeaf on all selected clients</string>
</property>
<property name="text">
<string>Stop z-Leaf on selected clients</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_zLeafActions">
<property name="orientation">
@ -317,7 +271,7 @@
<item>
<widget class="QLabel" name="LUploadFolder">
<property name="text">
<string>Upload folder to all selected clients:</string>
<string>Upload folder to all selected clients</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
@ -363,7 +317,7 @@
<item>
<widget class="QLabel" name="LBrowserActions">
<property name="text">
<string>Start browser on all selected clients:</string>
<string>Start browser on all selected clients</string>
</property>
</widget>
</item>
@ -437,33 +391,27 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>439</height>
</size>
</property>
<attribute name="title">
<string>Session actions</string>
</attribute>
<widget class="QWidget" name="verticalLayoutWidget_2">
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>9</x>
<y>69</y>
<width>311</width>
<height>391</height>
<x>10</x>
<y>10</y>
<width>691</width>
<height>103</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<layout class="QVBoxLayout" name="VLcleanupRecoverLastSession">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="LcleanupRecoverLastSession">
<property name="font">
<font>
<weight>50</weight>
@ -471,43 +419,119 @@
</font>
</property>
<property name="text">
<string>New session</string>
<string>Cleanup / recover last session</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="HLcleanupRecoverLastSession">
<item>
<widget class="QPushButton" name="PBStopZtree">
<property name="text">
<string>Stop z-Tree</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBRecoverCrashedSession">
<property name="text">
<string>Recover crashed session</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="PBKillzLeaf">
<property name="toolTip">
<string>Stops zLeaf on all selected clients</string>
</property>
<property name="text">
<string>Stop z-Leaf on selected clients</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_cleanupRecoverLastSession">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_3">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>691</width>
<height>469</height>
</rect>
</property>
<layout class="QVBoxLayout" name="VLNewSession">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="LNewSession">
<property name="text">
<string>New Session</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_12">
<layout class="QHBoxLayout" name="HLNewSession">
<item>
<widget class="QLabel" name="label_3">
<layout class="QVBoxLayout" name="VLZtree">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="LZTreeVersion">
<property name="text">
<string>z-Tree version</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox"/>
<widget class="QComboBox" name="CBzTreeVersion"/>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="LDataTargetPath">
<property name="text">
<string>Data target path:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_2"/>
<widget class="QComboBox" name="CBDataTargetPath"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="VLZtreeOptions">
<property name="topMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="HLPortSelect">
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="LPort">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<widget class="QSpinBox" name="SBPort">
<property name="minimum">
<number>7000</number>
</property>
@ -521,21 +545,105 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<widget class="Line" name="line_Ztree">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="LTemplateForReceipts">
<property name="text">
<string>Template for receipts</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="CBReceiptsHeader"/>
</item>
<item>
<widget class="QCheckBox" name="ChBPrintAnonymousReceipts">
<property name="text">
<string>Print anonymous receipts</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="LReplaceParticipantNames">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Replace participant names with:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="CBReplaceParticipantNames">
<property name="enabled">
<bool>false</bool>
</property>
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>\hspace{5cm}</string>
</property>
</item>
<item>
<property name="text">
<string>anonym</string>
</property>
</item>
<item>
<property name="text">
<string>anonymous</string>
</property>
</item>
<item>
<property name="text">
<string>nicht ausfüllen</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ChBReceiptsForLocalClients">
<property name="text">
<string>Print receipt for local client</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_Receipts">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ChBRamDisk">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Use ramdisk for gamesafe file</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_5">
<widget class="QCheckBox" name="ChBSessionWithoutAttachedClients">
<property name="text">
<string>Allow session without attached clients</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_6">
<widget class="QCheckBox" name="ChBautoStartClientZleaf">
<property name="text">
<string>Start z-Leaf on clients with the session</string>
</property>
@ -545,14 +653,14 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="PBStartSession">
<property name="text">
<string>Start session</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<spacer name="VSpacerZtree">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -565,103 +673,110 @@
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>621</width>
<height>55</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Cleanup / recover last session</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QVBoxLayout" name="VLZleave">
<item>
<widget class="QPushButton" name="pushButton_2">
<widget class="QLabel" name="L_Zleaves">
<property name="text">
<string>Stop z-Tree</string>
<string>z-Leaves</string>
</property>
<property name="margin">
<number>4</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<widget class="QPushButton" name="PBStartzLeaf">
<property name="toolTip">
<string>Starts zLeaf on the selected clients with the port given in the 'zTree' groupbox.</string>
</property>
<property name="text">
<string>Recover crashed session</string>
<string>Start z-Leaf on selected clients</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<widget class="Line" name="line_StartZleaves">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_6">
<property name="geometry">
<rect>
<x>330</x>
<y>100</y>
<width>301</width>
<height>361</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="LFakeName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Template for receipts:</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Run zLeaf with another name&lt;br/&gt;(select a single client):&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_3"/>
</item>
<widget class="QComboBox" name="CBClientNames">
<property name="editable">
<bool>true</bool>
</property>
<property name="currentText">
<string>Choose the name z-Leaf shall have</string>
</property>
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>Print anonymous receipts</string>
<string>Choose the name z-Leaf shall have</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<widget class="QPushButton" name="PBRunzLeaf">
<property name="text">
<string>Substitute participant names with:</string>
<string>Run z-Leaf with chosen name</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_RunWithOtherName">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_4"/>
<layout class="QHBoxLayout" name="HLLocalzLeaf">
<item>
<widget class="QPushButton" name="PBStartLocalzLeaf">
<property name="text">
<string>Start local z-Leaf</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_4">
<widget class="QPushButton" name="PBKillLocalzLeaf">
<property name="text">
<string>Print receipt for local client</string>
<string>Stop local z-Leaf</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="VSpacerTemplates">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -674,6 +789,10 @@
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="TAdminActions">
@ -793,7 +912,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="TSettings">
<attribute name="title">
<string>Settings</string>
</attribute>
@ -802,8 +921,8 @@
<rect>
<x>10</x>
<y>10</y>
<width>371</width>
<height>451</height>
<width>311</width>
<height>201</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -879,17 +998,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="formLayoutWidget_2">
<property name="geometry">
<rect>
<x>390</x>
<y>10</y>
<width>381</width>
<height>451</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout_2"/>
</widget>
</widget>
<widget class="QWidget" name="TInfo">
<property name="layoutDirection">
@ -918,15 +1026,65 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>256</height>
</size>
</property>
<property name="showGrid">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
<property name="cornerButtonEnabled">
<bool>true</bool>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>115</number>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>30</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>35</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>25</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
</widget>
</item>
</layout>

@ -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 );

Loading…
Cancel
Save