118 lines
2.4 KiB
C++
118 lines
2.4 KiB
C++
/*
|
|
* SaveWorkflowCmd.cpp
|
|
*
|
|
* Created on: 2012-10-16
|
|
* Author: liujunxia
|
|
*/
|
|
#include <QUuid>
|
|
|
|
#include "SaveWorkflowCmd.h"
|
|
#include "PaiObject.h"
|
|
#include "PaiWorkflowDataModel.h"
|
|
#include "WorkflowConst.h"
|
|
#include "PaiBalloonTipSettings.h"
|
|
#include "PaiBalloonTip.h"
|
|
#include "ObjectModelService.h"
|
|
#include "PaiMessageBox.h"
|
|
#include "ConsoleGUIService.h"
|
|
#include "PaiGUIService.h"
|
|
#include "PaiObjectSelection.h"
|
|
#include "Log.h"
|
|
#include "PaiSaveAsWorkflowDialog.h"
|
|
#include "ViewExtension.h"
|
|
#include "PaiWorkflowMaster.h"
|
|
#include "SaveHelper.h"
|
|
#include "DeleteWorkflowCmd.h"
|
|
#include "SaveAsWorkflowCmd.h"
|
|
#include "PaiActionsHistory.h"
|
|
#include "TimeStampLogger.h"
|
|
#include "WorkflowWidget.h"
|
|
|
|
using namespace pai;
|
|
using namespace pai::objectmodel;
|
|
using namespace pai::gui;
|
|
using namespace pai::graphics2d;
|
|
|
|
#define PROPERTIES_VIEW_ID "Properties"
|
|
|
|
namespace pai
|
|
{
|
|
SaveWorkflowCmd::SaveWorkflowCmd(QUuid viewID, pai::objectmodel::PaiWorkflowDataModel *pCurrentWorkflow, QUndoCommand *parent)
|
|
:QUndoCommand(parent)
|
|
{
|
|
m_ViewID = viewID;
|
|
m_bSaveSuccess = true;
|
|
m_pCurrentWorkflow = pCurrentWorkflow;
|
|
}
|
|
|
|
SaveWorkflowCmd::~SaveWorkflowCmd()
|
|
{
|
|
}
|
|
|
|
void SaveWorkflowCmd::undo()
|
|
{
|
|
}
|
|
|
|
void SaveWorkflowCmd::redo()
|
|
{
|
|
|
|
}
|
|
|
|
bool SaveWorkflowCmd::GetSaveResult()
|
|
{
|
|
return m_bSaveSuccess;
|
|
}
|
|
|
|
bool SaveWorkflowCmd::HandleSaveWorkflow()
|
|
{
|
|
|
|
return false;
|
|
}
|
|
|
|
void SaveWorkflowCmd::RefreshProperties(const QUuid & id)
|
|
{
|
|
QList < QUuid > objIDs;
|
|
GetObjectModelService()->GetObjectSelection()->GetSelection(objIDs);
|
|
foreach(QUuid objID, objIDs)
|
|
{
|
|
if(id == objID) // 判断当前要刷新的属性信息当前是否正在显示
|
|
|
|
{
|
|
pai::objectmodel::PaiObject *pObj = GetObjectModelService()->GetObject(id);
|
|
if(pObj)
|
|
{
|
|
PaiTextEdit *pTEdit = GetPropertiesTextEdit();
|
|
if(pTEdit)
|
|
{
|
|
pTEdit->setHtml(pObj->GetProperties());
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (GetObjectModelService()->GetProjectCount() == 0)
|
|
{
|
|
PaiTextEdit *pTEdit = GetPropertiesTextEdit();
|
|
if (pTEdit)
|
|
{
|
|
pTEdit->setHtml("");
|
|
}
|
|
}
|
|
}
|
|
|
|
PaiTextEdit* SaveWorkflowCmd::GetPropertiesTextEdit()
|
|
{
|
|
ViewExtension* pViewExtension =
|
|
dynamic_cast<ViewExtension*> (GetConsoleGUIService()->GetUtilityTabService()->GetExtension(
|
|
PROPERTIES_VIEW_ID));
|
|
if (pViewExtension)
|
|
{
|
|
return dynamic_cast<PaiTextEdit*> (pViewExtension->GetView());
|
|
}
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|