diff --git a/src/Lib/session.cpp b/src/Lib/session.cpp
old mode 100755
new mode 100644
index 0e79879..ea9e93e
--- a/src/Lib/session.cpp
+++ b/src/Lib/session.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 Markus Prasser
+ * Copyright 2014-2018 Markus Prasser, Tobias Weiss
*
* This file is part of Labcontrol.
*
@@ -17,14 +17,16 @@
* along with Labcontrol. If not, see .
*/
-#include
-
#include "session.h"
#include "settings.h"
+#include
+
+#include
+
extern std::unique_ptr< lc::Settings > settings;
-lc::Session::Session( QVector< Client* > &&argAssocClients,
+lc::Session::Session( QVector< Client * > &&argAssocClients,
const QString &argZTreeDataTargetPath, const quint16 argZTreePort,
const QString &argZTreeVersionPath, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder,
@@ -54,14 +56,16 @@ lc::Session::Session( QVector< Client* > &&argAssocClients,
}
}
-lc::Session::~Session() {
+lc::Session::~Session()
+{
for ( auto &client : assocClients ) {
client->SetSessionPort( 0 );
client->SetzLeafVersion( "" );
}
}
-QVariant lc::Session::GetDataItem( int argIndex ) {
+QVariant lc::Session::GetDataItem( int argIndex )
+{
switch ( argIndex ) {
case 0:
return QVariant{ zTreeVersionPath.split( '_', QString::KeepEmptyParts, Qt::CaseInsensitive )[ 1 ] };
@@ -72,7 +76,8 @@ QVariant lc::Session::GetDataItem( int argIndex ) {
}
}
-void lc::Session::InitializeClasses() {
+void lc::Session::InitializeClasses()
+{
// Create the new data directory
QDir dir{ zTreeDataTargetPath };
QString date_string( QDateTime::currentDateTime().toString( "yyMMdd_hhmm" ) );
@@ -87,7 +92,7 @@ void lc::Session::InitializeClasses() {
this, &Session::OnzTreeClosed );
// Only create a 'Receipts_Handler' instance, if all neccessary variables were set
if ( latexHeaderName != "None found" && !settings->dvipsCmd.isEmpty()
- && !settings->latexCmd.isEmpty() ) {
+ && !settings->latexCmd.isEmpty() ) {
new ReceiptsHandler{ zTreeDataTargetPath, printReceiptsForLocalClients,
anonymousReceiptsPlaceholder, latexHeaderName, this };
} else {
@@ -95,12 +100,14 @@ void lc::Session::InitializeClasses() {
}
}
-void lc::Session::OnzTreeClosed( int argExitCode ) {
+void lc::Session::OnzTreeClosed( int argExitCode )
+{
qDebug() << "z-Tree running on port" << zTreePort << "closed with exit code" << argExitCode;
emit SessionFinished( this );
}
-void lc::Session::RenameWindow() {
+void lc::Session::RenameWindow()
+{
// Example: wmctrl -r -T
QStringList arguments;
diff --git a/src/Lib/ztree.cpp b/src/Lib/ztree.cpp
old mode 100755
new mode 100644
index 706d11b..4c1c3e5
--- a/src/Lib/ztree.cpp
+++ b/src/Lib/ztree.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 Markus Prasser
+ * Copyright 2014-2018 Markus Prasser, Tobias Weiss
*
* This file is part of Labcontrol.
*
@@ -17,35 +17,35 @@
* along with Labcontrol. If not, see .
*/
-#include
+#include "settings.h"
+#include "ztree.h"
#include
+#include
-#include "settings.h"
-#include "ztree.h"
+#include
-extern std::unique_ptr< lc::Settings > settings;
+extern std::unique_ptr settings;
-lc::ZTree::ZTree( const QString &argZTreeDataTargetPath, const int &argZTreePort,
- const QString &argZTreeVersionPath, QObject *argParent ) :
- QObject{ argParent }
+lc::ZTree::ZTree(const QString &argZTreeDataTargetPath, const int argZTreePort,
+ const QString &argZTreeVersionPath, QObject *argParent) :
+ QObject{argParent}
{
- QStringList arguments{ QStringList{} << "-c" << "0" << settings->wineCmd
- << QString{ settings->zTreeInstDir + "/zTree_"
- + argZTreeVersionPath + "/ztree.exe" }
- << "/datadir" << QString{ "Z:/" + argZTreeDataTargetPath }
- << "/privdir" << QString{ "Z:/" + argZTreeDataTargetPath }
- << "/gsfdir" << QString{ "Z:/" + argZTreeDataTargetPath }
- << "/tempdir" << QString{ "Z:/" + argZTreeDataTargetPath }
- << "/leafdir" << QString{ "Z:/" + argZTreeDataTargetPath }
- << "/channel" << QString::number( argZTreePort - 7000 ) };
+ QStringList arguments{QStringList{} << "-c" << "0" << settings->wineCmd
+ << QString{settings->zTreeInstDir + "/zTree_"
+ + argZTreeVersionPath + "/ztree.exe"}
+ << "/datadir" << QString{"Z:/" + argZTreeDataTargetPath}
+ << "/privdir" << QString{"Z:/" + argZTreeDataTargetPath}
+ << "/gsfdir" << QString{"Z:/" + argZTreeDataTargetPath}
+ << "/tempdir" << QString{"Z:/" + argZTreeDataTargetPath}
+ << "/leafdir" << QString{"Z:/" + argZTreeDataTargetPath}
+ << "/channel" << QString::number(argZTreePort - 7000)};
- QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
- zTreeInstance.setProcessEnvironment( env );
- zTreeInstance.setWorkingDirectory( QDir::homePath() );
- zTreeInstance.start( settings->tasksetCmd, arguments, QIODevice::NotOpen );
- connect( &zTreeInstance, SIGNAL( finished( int ) ),
- this, SIGNAL( ZTreeClosed( int ) ) );
+ zTreeInstance.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
+ zTreeInstance.setWorkingDirectory(QDir::homePath());
+ zTreeInstance.start(settings->tasksetCmd, arguments, QIODevice::NotOpen);
+ connect(&zTreeInstance, SIGNAL(finished(int)),
+ this, SIGNAL(ZTreeClosed(int)));
- qDebug() << settings->tasksetCmd << arguments.join( " " );
+ qDebug() << settings->tasksetCmd << arguments.join(" ");
}
diff --git a/src/Lib/ztree.h b/src/Lib/ztree.h
old mode 100755
new mode 100644
index 2935189..1684b07
--- a/src/Lib/ztree.h
+++ b/src/Lib/ztree.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 Markus Prasser
+ * Copyright 2014-2018 Markus Prasser, Tobias Weiss
*
* This file is part of Labcontrol.
*
@@ -20,33 +20,32 @@
#ifndef ZTREE_H
#define ZTREE_H
-#include
-#include
-#include
-
#include "global.h"
+#include
+
namespace lc {
//! A class to contain running zTree instances.
/*!
This class is element of every session and is used to handle all zTree related data.
*/
-class ZTree: public QObject {
+class ZTree: public QObject
+{
Q_OBJECT
public:
- ZTree( const QString &argZTreeDataTargetPath,
- const int &argZTreePort, const QString &argZTreeVersionPath,
- QObject *argParent = nullptr );
+ ZTree(const QString &argZTreeDataTargetPath,
+ const int argZTreePort, const QString &argZTreeVersionPath,
+ QObject *argParent = nullptr);
signals:
- void ZTreeClosed( int argExitCode );
+ void ZTreeClosed(int argExitCode);
private:
QProcess zTreeInstance;
};
-}
+} // namespace lc
#endif // ZTREE_H