Skip to content

Commit

Permalink
resizable image
Browse files Browse the repository at this point in the history
  • Loading branch information
mjoppich committed Feb 20, 2017
1 parent ebf89d7 commit 92087bc
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/app/AdvancedStreamBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "AdvancedStreamBox.h"


AdvancedCornerWidget::AdvancedCornerWidget(AdvancedStreamBox* pParentBox)
AdvancedCornerWidget::AdvancedCornerWidget(QWidget* pParentBox)
{
m_oMouseStart = QPoint(-1,-1);
m_oMouseEnd = QPoint(-1,-1);
Expand Down
4 changes: 2 additions & 2 deletions src/app/AdvancedStreamBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class AdvancedCornerWidget : public QWidget {

public:

AdvancedCornerWidget(AdvancedStreamBox* pParentBox);
AdvancedCornerWidget(QWidget* pParentBox);

void updateWidgetGeometry();

Expand All @@ -139,7 +139,7 @@ class AdvancedCornerWidget : public QWidget {
QPoint m_oMouseEnd;
QSize m_oCurrentSize;

AdvancedStreamBox* m_pParentBox;
QWidget* m_pParentBox;

};

Expand Down
4 changes: 4 additions & 0 deletions src/app/ProcessLauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class ProcessLauncher : public QObject
}
*/

QIODevice::OpenMode eMode = QIODevice::ReadWrite;

std::cout << "Running QProcess for: " << m_sProgram.toStdString() << " " << m_sParam.toStdString() << std::endl;
Expand Down Expand Up @@ -227,6 +228,9 @@ class ProcessLauncher : public QObject
LOGLVL( oArgs.join(',').toStdString(), Logging::ERR);

QProcess* pProcess = m_pProcess;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
pProcess->setProcessEnvironment(env);


this->connect(m_pProcess, static_cast<void(QProcess::*)(QProcess::ProcessError)>(&QProcess::errorOccurred),
[pProcess, this](QProcess::ProcessError errorCode){
Expand Down
5 changes: 5 additions & 0 deletions src/parsing/nodes/ExecutionDeferredNode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//
// Created by joppich on 2/20/17.
//

#include "ExecutionDeferredNode.h"
38 changes: 38 additions & 0 deletions src/parsing/nodes/ExecutionDeferredNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// Created by joppich on 2/20/17.
//

#ifndef BIOGUI_EXECUTIONDEFERREDNODE_H
#define BIOGUI_EXECUTIONDEFERREDNODE_H


#include <QProcess>
#include "ExecutionNode.h"
#include <src/app/ExecuteThread.h>


class ExecutionDeferredNode : public ExecutionNode {

public:

ExecutionDeferredNode(QDomElement* pElement)
: ExecutionNode(pElement)
{
m_bDeferred = (this->getDomElementAttribute(pElement, "DEFERRED", "true").toUpper().compare("TRUE", Qt::CaseInsensitive) == 0);

}

virtual std::string evaluateDeferred( std::map< std::string, ExecutionNode*>* pID2Node,
std::map<std::string, std::string>* pInputID2Value,
std::map<std::string, WidgetFunctionNode*>* pInputID2FunctionWidget,
QProcess* pProcess, ExecuteThread* pThread, bool bDeferred) = 0;

protected:

bool m_bDeferred;


};


#endif //BIOGUI_EXECUTIONDEFERREDNODE_H
5 changes: 4 additions & 1 deletion src/parsing/nodes/ExecutionExecuteNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ class ExecutionExecuteNode : public ExecutionExecutableNode {
if (bDeferred)
{
// only output nodes
if (ExecutionOutputNode* pOutPutnode = dynamic_cast<ExecutionOutputNode*>( m_vChildren.at(i) ))
if (ExecutionDeferredNode* pOutPutnode = dynamic_cast<ExecutionDeferredNode*>( m_vChildren.at(i) ))
{
sReturn = sReturn + pOutPutnode->evaluateDeferred(pID2Node, pInputID2Value, pInputID2FunctionWidget, pProcess, pThread, bDeferred);
}



} else {

if (pProcess != NULL)
Expand Down
27 changes: 22 additions & 5 deletions src/parsing/nodes/ExecutionMessageBoxNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
#define BIOGUI_EXECUTIONMESSAGEBOXNODE_H

#include "ExecutionNode.h"
#include "ExecutionDeferredNode.h"

#include <QDialogButtonBox>
#include <QMessageBox>

class ExecutionMessageBoxNode : public ExecutionNode {
class ExecutionMessageBoxNode : public ExecutionDeferredNode {

public:

enum MB_TYPE {INFO, ALERT, QUESTION} ;

ExecutionMessageBoxNode(QDomElement* pElement)
: ExecutionNode(pElement)
: ExecutionDeferredNode(pElement)
{
m_sTag = "messagebox";

Expand Down Expand Up @@ -50,11 +51,19 @@ class ExecutionMessageBoxNode : public ExecutionNode {

}

std::string evaluate( std::map< std::string, ExecutionNode*>* pID2Node,
std::map<std::string, std::string>* pInputID2Value,
std::map<std::string, WidgetFunctionNode*>* pInputID2FunctionWidget)
virtual std::string evaluateDeferred( std::map< std::string, ExecutionNode*>* pID2Node,
std::map<std::string, std::string>* pInputID2Value,
std::map<std::string, WidgetFunctionNode*>* pInputID2FunctionWidget,
QProcess* pProcess, ExecuteThread* pThread, bool bDeferred)
{

if (m_bDeferred && !bDeferred)
return "";

if (!m_bDeferred && bDeferred)
return "";


if (m_sValue.size() > 0)
{

Expand Down Expand Up @@ -99,6 +108,14 @@ class ExecutionMessageBoxNode : public ExecutionNode {

}

std::string evaluate( std::map< std::string, ExecutionNode*>* pID2Node,
std::map<std::string, std::string>* pInputID2Value,
std::map<std::string, WidgetFunctionNode*>* pInputID2FunctionWidget)
{

return this->evaluateDeferred(pID2Node, pInputID2Value, pInputID2FunctionWidget, NULL, NULL, false);
}

protected:

void addNodeAttributes(std::vector<std::string>& vAttributes)
Expand Down
7 changes: 3 additions & 4 deletions src/parsing/nodes/ExecutionOutputNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@
#include <fstream>

#include "ExecutionNode.h"
#include "ExecutionDeferredNode.h"

class ExecutionOutputNode : public ExecutionNode {
class ExecutionOutputNode : public ExecutionDeferredNode {

public:
ExecutionOutputNode(QDomElement* pElement)
: ExecutionNode(pElement)
: ExecutionDeferredNode(pElement)
{

m_sType = this->getDomElementAttribute(pElement, "TYPE", "STD").toUpper().toStdString();
Expand All @@ -49,7 +50,6 @@ class ExecutionOutputNode : public ExecutionNode {
m_sHost = this->getDomElementAttribute(pElement, "host", "").toStdString();
m_iPort = std::stoi(this->getDomElementAttribute(pElement, "port", "25").toStdString());

m_bDefferred = (this->getDomElementAttribute(pElement, "DEFERRED", "true").toUpper().compare("TRUE", Qt::CaseInsensitive) == 0);


if (m_sTo.size() == 0)
Expand Down Expand Up @@ -308,7 +308,6 @@ class ExecutionOutputNode : public ExecutionNode {
std::string m_sHost;
int m_iPort;

bool m_bDefferred;



Expand Down
35 changes: 28 additions & 7 deletions src/parsing/nodes/ExecutionUpdateNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,63 @@


#include "ExecutionNode.h"
#include "ExecutionDeferredNode.h"

class ExecutionUpdateNode : public ExecutionNode {
class ExecutionUpdateNode : public ExecutionDeferredNode {

public:

ExecutionUpdateNode(QDomElement* pElement)
: ExecutionNode(pElement)
: ExecutionDeferredNode(pElement)
{
m_sValue = this->getDomElementAttribute(pElement, "VALUE", "").toStdString();

m_sTarget = this->getDomElementAttribute(pElement, "TARGET", "");
m_sAttribute = this->getDomElementAttribute(pElement, "ATTRIB", "");



}

virtual ~ExecutionUpdateNode()
{

}

std::string evaluate( std::map< std::string, ExecutionNode*>* pID2Node,
std::map<std::string, std::string>* pInputID2Value,
std::map<std::string, WidgetFunctionNode*>* pInputID2FunctionWidget)
virtual std::string evaluateDeferred( std::map< std::string, ExecutionNode*>* pID2Node,
std::map<std::string, std::string>* pInputID2Value,
std::map<std::string, WidgetFunctionNode*>* pInputID2FunctionWidget,
QProcess* pProcess, ExecuteThread* pThread, bool bDeferred)
{

if (m_bDeferred && !bDeferred)
return "";

if (!m_bDeferred && bDeferred)
return "";

std::map<std::string, WidgetFunctionNode*>::iterator oIt = pInputID2FunctionWidget->find(m_sTarget.toStdString());

if (oIt != pInputID2FunctionWidget->end())
{
std::string resolvedValue = this->parseDynamicValues(m_sValue, pID2Node, pInputID2Value, pInputID2FunctionWidget);

// do something
oIt->second->setAttribute( m_sAttribute.toStdString(), m_sValue );
oIt->second->setAttribute( m_sAttribute.toStdString(), resolvedValue );

return m_sValue;
}

return "";

}

std::string evaluate( std::map< std::string, ExecutionNode*>* pID2Node,
std::map<std::string, std::string>* pInputID2Value,
std::map<std::string, WidgetFunctionNode*>* pInputID2FunctionWidget)
{

return this->evaluateDeferred(pID2Node, pInputID2Value, pInputID2FunctionWidget, NULL, NULL, false);
}

protected:
Expand All @@ -67,12 +88,12 @@ class ExecutionUpdateNode : public ExecutionNode {
vAttributes.push_back("TARGET");
vAttributes.push_back("ATTRIB");
vAttributes.push_back("VALUE");
vAttributes.push_back("DEFERRED");
}

QString m_sAttribute;
QString m_sTarget;


};


Expand Down

0 comments on commit 92087bc

Please sign in to comment.