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}. 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. 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; QStringList *arguments = nullptr;
arguments = new QStringList; arguments = new QStringList;
if ( !argOpenAsRoot ) { if ( !argOpenAsRoot ) {
*arguments << "--title" << name << "-e" << *arguments << "-e"
QString{ settings->sshCmd + " -i " + settings->pkeyPathUser + " " << QString{ "'" + settings->sshCmd + " -i " + settings->pkeyPathUser + " "
+ settings->userNameOnClients + "@" + ip }; + settings->userNameOnClients + "@" + ip + "'"};
} else { } else {
*arguments << "--title" << name << "-e" << *arguments << "-e" <<
QString{ settings->sshCmd + " -i " + settings->pkeyPathRoot QString{ "'" + settings->sshCmd + " -i " + settings->pkeyPathRoot
+ " " + "root@" + ip }; + " " + "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 + "'" );
} }
QProcess openTerminalProcess; 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; QStringList arguments;
arguments << ip; arguments << ip;
@ -308,16 +308,18 @@ void lc::Client::StartClientBrowser( const QString * const argURL, const bool *
//Declarations //Declarations
QStringList arguments; QStringList arguments;
// Output message via the debug messages tab // Build arguments list for SSH command
qDebug() << settings->sshCmd << arguments.join( " " );
//Build arguments list for SSH command
arguments << "-i" << settings->pkeyPathUser arguments << "-i" << settings->pkeyPathUser
<< QString{ settings->userNameOnClients + "@" + ip } << QString{ settings->userNameOnClients + "@" + ip }
<< "DISPLAY=:0.0" << "DISPLAY=:0.0"
<< settings->clientBrowserCmd << settings->clientBrowserCmd
<< *argURL; << *argURL;
// Add fullscreen toggle if checked
if (*argFullscreen == true){
arguments << "& sleep 3 && DISPLAY=:0.0 xdotool key --clearmodifiers F11";
}
// Start the process // Start the process
QProcess startClientBrowserProcess; QProcess startClientBrowserProcess;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
@ -335,11 +337,9 @@ void lc::Client::StopClientBrowser() {
//Build arguments list //Build arguments list
arguments << "-i" << settings->pkeyPathUser arguments << "-i" << settings->pkeyPathUser
<< QString{ settings->userNameOnClients + "@" + ip } << QString{ settings->userNameOnClients + "@" + ip }
<< "DISPLAY=:0.0"
<< "killall" << "killall"
<< settings->clientBrowserCmd << settings->clientBrowserCmd
<< "&& sleep 1" << "& sleep 1 && rm -R /home/ewfuser/.mozilla/firefox/*";
<< "&& rm -R /home/ewfuser/.mozilla/firefox/*";
// Start the process // Start the process
QProcess startClientBrowserProcess; QProcess startClientBrowserProcess;

@ -103,7 +103,8 @@ public:
void SetSessionPort( int argSP ) { sessionPort = argSP; } void SetSessionPort( int argSP ) { sessionPort = argSP; }
void SetzLeafVersion( const QString &argzLeafV ) { zLeafVersion = argzLeafV; } void SetzLeafVersion( const QString &argzLeafV ) { zLeafVersion = argzLeafV; }
//! Shows the desktop of the given client //! Shows the desktop of the given client
void ShowDesktop(); void ShowDesktopViewOnly();
void ShowDesktopFullControl();
/*! /*!
* \brief Shuts down the client * \brief Shuts down the client
*/ */

@ -26,7 +26,7 @@
lc::Lablib::Lablib( QObject *argParent ) : lc::Lablib::Lablib( QObject *argParent ) :
QObject{ argParent }, QObject{ argParent },
labSettings{ "Economic Laboratory", "Labcontrol", this }, labSettings{ "Labcontrol", "Labcontrol", this },
sessionsModel{ new SessionsModel{ this } } sessionsModel{ new SessionsModel{ this } }
{ {
for ( const auto &s : settings->GetClients() ) { for ( const auto &s : settings->GetClients() ) {

@ -28,7 +28,7 @@ std::unique_ptr< lc::Settings > settings;
int main( int argc, char *argv[] ) { int main( int argc, char *argv[] ) {
QApplication a{ argc, 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; lc::MainWindow w;
w.show(); w.show();

@ -47,6 +47,37 @@ lc::MainWindow::MainWindow( QWidget *argParent ) :
this, &MainWindow::UpdateClientsTableView ); this, &MainWindow::UpdateClientsTableView );
gui_update_timer->start( 500 ); 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() { lc::MainWindow::~MainWindow() {
@ -218,11 +249,6 @@ void lc::MainWindow::DisableDisfunctionalWidgets() {
ui->PBStartzLeaf->setEnabled( false ); 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() ) { if ( settings->zTreeInstDir.isEmpty() ) {
ui->CBClientNames->setEnabled( false ); ui->CBClientNames->setEnabled( false );
ui->LFakeName->setEnabled( false ); ui->LFakeName->setEnabled( false );
@ -271,12 +297,19 @@ void lc::MainWindow::on_CBWebcamChooser_activated( int argIndex ) {
void lc::MainWindow::on_PBBeamFile_clicked() { void lc::MainWindow::on_PBBeamFile_clicked() {
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
const QString fileToBeam{ ui->LEFilePath->text() }; 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 ) { 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->BeamFile( fileToBeam, &settings->pkeyPathUser, &settings->userNameOnClients ); 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() { void lc::MainWindow::on_PBBoot_clicked() {
@ -307,13 +340,6 @@ void lc::MainWindow::on_PBChooseFile_clicked() {
delete file_dialog; 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() { 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) // 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; bool executeOnEveryClient = true;
@ -384,16 +410,6 @@ void lc::MainWindow::on_PBKillLocalzLeaf_clicked() {
qDebug() << program << arguments; 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() { void lc::MainWindow::on_PBOpenFilesystem_clicked() {
// Determine the correct user to be used // Determine the correct user to be used
QString * userToBeUsed = nullptr; QString * userToBeUsed = nullptr;
@ -504,39 +520,6 @@ void lc::MainWindow::on_PBStartLocalzLeaf_clicked() {
localzLeafStarter, SLOT( deleteLater() ) ); 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() { void lc::MainWindow::on_PBStartzLeaf_clicked() {
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { 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) { void lc::MainWindow::on_RBUseLocalUser_toggled(bool checked) {
if ( checked ) { if ( checked ) {
qDebug() << "'RBUseLocalUser' got toggled."; qDebug() << "'RBUseLocalUser' got toggled.";
@ -595,7 +568,7 @@ void lc::MainWindow::SetupWidgets() {
valid_items->squeeze(); valid_items->squeeze();
} else { } else {
QMessageBox messageBox{ QMessageBox::Warning, tr( "Could not construct clients view" ), 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(); messageBox.exec();
ui->CBClientNames->setEnabled( false ); ui->CBClientNames->setEnabled( false );
ui->GBClientActions->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_PBstartBrowser_clicked()
void lc::MainWindow::on_PBrestartCrashedSession_clicked() { {
QProcess startProc; QString argURL = ui->LEURL->text();
startProc.setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); bool argFullscreen = ui->CBFullscreen->checkState();
if ( !settings->restartCrashedSessionScript.isEmpty() ) { QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
startProc.startDetached( settings->restartCrashedSessionScript); 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 }; QString program{ settings->killallCmd };
QStringList arguments; QStringList arguments;
@ -758,37 +779,106 @@ void lc::MainWindow::on_PBKillzTree_clicked()
// Output message via the debug messages tab // Output message via the debug messages tab
qDebug() << program << arguments; qDebug() << program << arguments;
} else { } 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(); // TODO: Implement the functionality of the restore session script in here (no zenity script)
bool argFullscreen = ui->CBFullscreen->checkState(); QProcess startProc;
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); startProc.setProcessEnvironment( QProcessEnvironment::systemEnvironment() );
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { if ( !settings->restartCrashedSessionScript.isEmpty() ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { startProc.startDetached( settings->restartCrashedSessionScript);
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->StartClientBrowser( &argURL, &argFullscreen );
} }
}
} }
void lc::MainWindow::on_PBstopBrowser_clicked() void lc::MainWindow::on_CBDataTargetPath_activated( int argIndex )
{ {
// Confirmation dialog if ( !argIndex ) {
QMessageBox::StandardButton reply; emit RequestNewDataTargetPath();
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(); ui->CBDataTargetPath->setStyleSheet( "" );
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 * >() ); // Open a folder coose dialog if first position in the combo box is clicked
client->StopClientBrowser( ); 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( "" );
}

@ -62,7 +62,6 @@ private slots:
void on_PBChooseFile_clicked(); void on_PBChooseFile_clicked();
void on_PBExecute_clicked(); void on_PBExecute_clicked();
void on_PBKillLocalzLeaf_clicked(); void on_PBKillLocalzLeaf_clicked();
void on_PBKillzLeaf_clicked();
void on_PBOpenFilesystem_clicked(); void on_PBOpenFilesystem_clicked();
void on_PBOpenTerminal_clicked(); void on_PBOpenTerminal_clicked();
void on_PBPrintPaymentFileManually_clicked(); void on_PBPrintPaymentFileManually_clicked();
@ -73,7 +72,8 @@ private slots:
void on_PBStartLocalzLeaf_clicked(); void on_PBStartLocalzLeaf_clicked();
void on_PBStartSession_clicked(); void on_PBStartSession_clicked();
void on_PBStartzLeaf_clicked(); void on_PBStartzLeaf_clicked();
void on_PBViewDesktop_clicked(); void on_PBViewDesktopViewOnly_clicked();
void on_PBViewDesktopFullControl_clicked();
void on_RBUseLocalUser_toggled(bool checked); void on_RBUseLocalUser_toggled(bool checked);
void StartLocalzLeaf( QString argzLeafName, QString argzLeafVersion, int argzTreePort ); void StartLocalzLeaf( QString argzLeafName, QString argzLeafVersion, int argzTreePort );
//! Updates the icons of the QTableView displaying the clients' states //! Updates the icons of the QTableView displaying the clients' states
@ -84,6 +84,12 @@ private slots:
void UpdateClientsTableView(); void UpdateClientsTableView();
signals: signals:
/*Session actions*/
void RequestNewDataTargetPath();
void RequestNewSession( QVector< Client* > argAssocCl, QString argParticipNameReplacement,
bool argPrintLocalReceipts, QString argReceiptsHeader,
QString argzTreeDataTargetPath, quint16 argzTreePort,
QString argzTreeVersion );
private: private:
//! Checks, if the user has administrative rights //! Checks, if the user has administrative rights
@ -113,10 +119,16 @@ private slots:
QString argAnonymousReceiptsPlaceholder, QString argAnonymousReceiptsPlaceholder,
QString argLatexHeaderName, QString argLatexHeaderName,
QString argDateString ); QString argDateString );
void on_PBrestartCrashedSession_clicked();
void on_PBKillzTree_clicked();
void on_PBstartBrowser_clicked(); void on_PBstartBrowser_clicked();
void on_PBstopBrowser_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();
}; };
} }

File diff suppressed because it is too large Load Diff

@ -98,6 +98,7 @@ lc::SessionStarter::SessionStarter( const QVector< quint16 > &argOccupiedPorts,
lc::SessionStarter::~SessionStarter() { lc::SessionStarter::~SessionStarter() {
delete ui; delete ui;
} }
void lc::SessionStarter::CheckIfPortIsOccupied( quint16 argPort ) { void lc::SessionStarter::CheckIfPortIsOccupied( quint16 argPort ) {
if ( occupiedPorts.contains( argPort ) ) { if ( occupiedPorts.contains( argPort ) ) {
CheckIfPortIsOccupied( argPort + 1 ); CheckIfPortIsOccupied( argPort + 1 );

Loading…
Cancel
Save