Reformat ZTree

remotes/origin/HEAD
markuspg 7 years ago
parent 7f532cbd21
commit 688c1ee3fd

@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 Markus Prasser
* Copyright 2014-2018 Markus Prasser, Tobias Weiss
*
* This file is part of Labcontrol.
*
@ -17,11 +17,13 @@
* along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.
*/
#include <memory>
#include "session.h"
#include "settings.h"
#include <QDir>
#include <memory>
extern std::unique_ptr< lc::Settings > settings;
lc::Session::Session( QVector< Client * > &&argAssocClients,
@ -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" ) );
@ -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 <window name> -T <new name>
QStringList arguments;

@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 Markus Prasser
* Copyright 2014-2018 Markus Prasser, Tobias Weiss
*
* This file is part of Labcontrol.
*
@ -17,16 +17,17 @@
* along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.
*/
#include <memory>
#include "settings.h"
#include "ztree.h"
#include <QDebug>
#include <QDir>
#include "settings.h"
#include "ztree.h"
#include <memory>
extern std::unique_ptr<lc::Settings> settings;
lc::ZTree::ZTree( const QString &argZTreeDataTargetPath, const int &argZTreePort,
lc::ZTree::ZTree(const QString &argZTreeDataTargetPath, const int argZTreePort,
const QString &argZTreeVersionPath, QObject *argParent) :
QObject{argParent}
{
@ -40,8 +41,7 @@ lc::ZTree::ZTree( const QString &argZTreeDataTargetPath, const int &argZTreePort
<< "/leafdir" << QString{"Z:/" + argZTreeDataTargetPath}
<< "/channel" << QString::number(argZTreePort - 7000)};
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
zTreeInstance.setProcessEnvironment( env );
zTreeInstance.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
zTreeInstance.setWorkingDirectory(QDir::homePath());
zTreeInstance.start(settings->tasksetCmd, arguments, QIODevice::NotOpen);
connect(&zTreeInstance, SIGNAL(finished(int)),

@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 Markus Prasser
* Copyright 2014-2018 Markus Prasser, Tobias Weiss
*
* This file is part of Labcontrol.
*
@ -20,24 +20,23 @@
#ifndef ZTREE_H
#define ZTREE_H
#include <QDir>
#include <QPlainTextEdit>
#include <QProcess>
#include "global.h"
#include <QProcess>
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,
const int argZTreePort, const QString &argZTreeVersionPath,
QObject *argParent = nullptr);
signals:
@ -47,6 +46,6 @@ private:
QProcess zTreeInstance;
};
}
} // namespace lc
#endif // ZTREE_H

Loading…
Cancel
Save