Reformat Session

remotes/origin/HEAD
markuspg 7 years ago
parent f345d88315
commit 847c83d2d4

@ -68,7 +68,8 @@ QVariant lc::Session::GetDataItem( int argIndex )
{
switch (argIndex) {
case 0:
return QVariant{ zTreeVersionPath.split( '_', QString::KeepEmptyParts, Qt::CaseInsensitive )[ 1 ] };
return QVariant{zTreeVersionPath.split('_', QString::KeepEmptyParts,
Qt::CaseInsensitive)[1]};
case 1:
return QVariant{zTreePort};
default:
@ -87,7 +88,8 @@ void lc::Session::InitializeClasses()
zTreeDataTargetPath.append("/" + date_string + "-" + QString::number(zTreePort));
qDebug() << "New session's chosen_zTree_data_target_path:" << zTreeDataTargetPath;
zTreeInstance = new ZTree{ zTreeDataTargetPath, zTreePort, zTreeVersionPath, this };
zTreeInstance = new ZTree{zTreeDataTargetPath, zTreePort,
zTreeVersionPath, this};
connect(zTreeInstance, &ZTree::ZTreeClosed,
this, &Session::OnzTreeClosed);
// Only create a 'Receipts_Handler' instance, if all neccessary variables were set
@ -111,12 +113,12 @@ void lc::Session::RenameWindow()
// Example: wmctrl -r <window name> -T <new name>
QStringList arguments;
arguments << "-r" << "zTree - Untitled Treatment 1" << "-T" << QString{ "zTree on port " + QString::number( zTreePort ) };
arguments << "-r" << "zTree - Untitled Treatment 1" << "-T"
<< QString{"zTree on port " + QString::number(zTreePort)};
// Start the process
QProcess renameZTreeWindowProcess;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
renameZTreeWindowProcess.setProcessEnvironment( env );
renameZTreeWindowProcess.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
renameZTreeWindowProcess.startDetached(settings->wmctrlCmd, arguments);
qDebug() << "Renamed window";

@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 Markus Prasser
* Copyright 2014-2018 Markus Prasser, Tobias Weiss
*
* This file is part of Labcontrol.
*
@ -34,18 +34,20 @@ class Client;
/*!
This class represents an entire session with its zTree instance and the corresponding lcReceiptsHandler instance.
*/
class Session : public QObject {
class Session : public QObject
{
Q_OBJECT
public:
const int zTreePort = 7000; //! The port this session's zTree instance is running on
//! The port this session's zTree instance is running on
const int zTreePort = 7000;
Session(QVector<Client *> &&argAssocClients, const QString &argZTreeDataTargetPath,
const quint16 argZTreePort, const QString &argZTreeVersionPath,
bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, QObject *argParent = nullptr);
~Session();
~Session() override;
/*! Returns the data item with the given index
*
@ -69,13 +71,19 @@ private slots:
void RenameWindow();
private:
const QString anonymousReceiptsPlaceholder; //! Placeholder which shall be inserted for participant names if anonymous printing is desired (QString != "")
//! Placeholder which shall be inserted for participant names if anonymous printing is desired (QString != "")
const QString anonymousReceiptsPlaceholder;
const QVector<Client *> assocClients;
const QString latexHeaderName; //! The name of the chosen LaTeX header
const bool printReceiptsForLocalClients = true; //! True if receipts shall be printed for local clients
QString zTreeDataTargetPath; //! The path were the data of this zTree instance's session will be saved
ZTree *zTreeInstance= nullptr; //! The session's zTree instance
const QString zTreeVersionPath; //! The path to the version of zTree used by this session's instance
//! The name of the chosen LaTeX header
const QString latexHeaderName;
//! True if receipts shall be printed for local clients
const bool printReceiptsForLocalClients = true;
//! The path were the data of this zTree instance's session will be saved
QString zTreeDataTargetPath;
//! The session's zTree instance
ZTree *zTreeInstance = nullptr;
//! The path to the version of zTree used by this session's instance
const QString zTreeVersionPath;
};
}

Loading…
Cancel
Save