Reformat Session

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

@ -68,7 +68,8 @@ QVariant lc::Session::GetDataItem( int argIndex )
{ {
switch (argIndex) { switch (argIndex) {
case 0: case 0:
return QVariant{ zTreeVersionPath.split( '_', QString::KeepEmptyParts, Qt::CaseInsensitive )[ 1 ] }; return QVariant{zTreeVersionPath.split('_', QString::KeepEmptyParts,
Qt::CaseInsensitive)[1]};
case 1: case 1:
return QVariant{zTreePort}; return QVariant{zTreePort};
default: default:
@ -87,7 +88,8 @@ void lc::Session::InitializeClasses()
zTreeDataTargetPath.append("/" + date_string + "-" + QString::number(zTreePort)); zTreeDataTargetPath.append("/" + date_string + "-" + QString::number(zTreePort));
qDebug() << "New session's chosen_zTree_data_target_path:" << zTreeDataTargetPath; 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, connect(zTreeInstance, &ZTree::ZTreeClosed,
this, &Session::OnzTreeClosed); this, &Session::OnzTreeClosed);
// Only create a 'Receipts_Handler' instance, if all neccessary variables were set // 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> // Example: wmctrl -r <window name> -T <new name>
QStringList arguments; 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 // Start the process
QProcess renameZTreeWindowProcess; QProcess renameZTreeWindowProcess;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); renameZTreeWindowProcess.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
renameZTreeWindowProcess.setProcessEnvironment( env );
renameZTreeWindowProcess.startDetached(settings->wmctrlCmd, arguments); renameZTreeWindowProcess.startDetached(settings->wmctrlCmd, arguments);
qDebug() << "Renamed window"; 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. * 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. 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 Q_OBJECT
public: 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, Session(QVector<Client *> &&argAssocClients, const QString &argZTreeDataTargetPath,
const quint16 argZTreePort, const QString &argZTreeVersionPath, const quint16 argZTreePort, const QString &argZTreeVersionPath,
bool argPrintReceiptsForLocalClients, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, QObject *argParent = nullptr); const QString &argLatexHeaderName, QObject *argParent = nullptr);
~Session(); ~Session() override;
/*! Returns the data item with the given index /*! Returns the data item with the given index
* *
@ -69,13 +71,19 @@ private slots:
void RenameWindow(); void RenameWindow();
private: 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 QVector<Client *> assocClients;
const QString latexHeaderName; //! The name of the chosen LaTeX header //! The name of the chosen LaTeX header
const bool printReceiptsForLocalClients = true; //! True if receipts shall be printed for local clients const QString latexHeaderName;
QString zTreeDataTargetPath; //! The path were the data of this zTree instance's session will be saved //! True if receipts shall be printed for local clients
ZTree *zTreeInstance= nullptr; //! The session's zTree instance const bool printReceiptsForLocalClients = true;
const QString zTreeVersionPath; //! The path to the version of zTree used by this session's instance //! 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