增加了信号槽状态记录类
parent
a3cf62325a
commit
de338b2cb9
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
namespace Setting
|
namespace Setting
|
||||||
{
|
{
|
||||||
|
|
@ -48,6 +49,7 @@ namespace Setting
|
||||||
}
|
}
|
||||||
BusAPI::BusAPI()
|
BusAPI::BusAPI()
|
||||||
{
|
{
|
||||||
|
_taskDescManager=new TaskDescManager;
|
||||||
_mainSetting = new MainSetting;
|
_mainSetting = new MainSetting;
|
||||||
// _solvers = new SolverManager;
|
// _solvers = new SolverManager;
|
||||||
// _solveOption = new SolveOption;
|
// _solveOption = new SolveOption;
|
||||||
|
|
@ -57,6 +59,7 @@ namespace Setting
|
||||||
}
|
}
|
||||||
BusAPI::~BusAPI()
|
BusAPI::~BusAPI()
|
||||||
{
|
{
|
||||||
|
delete _taskDescManager;
|
||||||
delete _mainSetting;
|
delete _mainSetting;
|
||||||
// delete _solvers;
|
// delete _solvers;
|
||||||
// delete _solveOption;
|
// delete _solveOption;
|
||||||
|
|
@ -242,4 +245,59 @@ namespace Setting
|
||||||
return QCoreApplication::applicationDirPath();
|
return QCoreApplication::applicationDirPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString BusAPI::getTemperturePath()
|
||||||
|
{
|
||||||
|
QString workSpace=_mainSetting->getWorkingDir();
|
||||||
|
QDir dir(workSpace);
|
||||||
|
QString tempFolderName=QString("Temperture");
|
||||||
|
QString temperturePath=dir.absoluteFilePath(tempFolderName);
|
||||||
|
if(!QFile(temperturePath).exists()){
|
||||||
|
dir.mkdir(tempFolderName);
|
||||||
|
}
|
||||||
|
return temperturePath;
|
||||||
|
}
|
||||||
|
const QString& BusAPI::getFekoInstallPath() const
|
||||||
|
{
|
||||||
|
return _mainSetting->getFekoInstallPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BusAPI::setFekoInstallPath(const QString& fekoInstallPath) {
|
||||||
|
_mainSetting->setFekoInstallPath(fekoInstallPath);
|
||||||
|
}
|
||||||
|
const QString& BusAPI::getFekocadPath() const
|
||||||
|
{
|
||||||
|
return _mainSetting->getFekocadPath();
|
||||||
|
}
|
||||||
|
void BusAPI::setFekocadPath(const QString& fekocadPath) {
|
||||||
|
_mainSetting->setFekocadPath(fekocadPath);
|
||||||
|
}
|
||||||
|
const QString& BusAPI::getRunFekoPath() const
|
||||||
|
{
|
||||||
|
return _mainSetting->getRunFekoPath();
|
||||||
|
}
|
||||||
|
void BusAPI::setRunFekoPath(const QString& runFekoPath) {
|
||||||
|
_mainSetting->setRunFekoPath(runFekoPath);
|
||||||
|
}
|
||||||
|
const QString& BusAPI::getPreFekoPath() const
|
||||||
|
{
|
||||||
|
return _mainSetting->getPreFekoPath();
|
||||||
|
}
|
||||||
|
void BusAPI::setPreFekoPath(const QString& preFekoPath) {
|
||||||
|
_mainSetting->setPreFekoPath(preFekoPath);
|
||||||
|
}
|
||||||
|
TaskDescManager* BusAPI::getTaskDescManager()
|
||||||
|
{
|
||||||
|
return _taskDescManager;
|
||||||
|
}
|
||||||
|
TaskDesc* BusAPI::getNewTask()
|
||||||
|
{
|
||||||
|
return _taskDescManager->getNewTask();
|
||||||
|
}
|
||||||
|
TaskDesc* BusAPI::findTask(int taskID)
|
||||||
|
{
|
||||||
|
return _taskDescManager->findTask(taskID);
|
||||||
|
}
|
||||||
|
void BusAPI::removeTask(TaskDesc* task) {
|
||||||
|
_taskDescManager->removeTask(task);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -27,6 +27,8 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include "SettingAPI.h"
|
#include "SettingAPI.h"
|
||||||
|
#include "TaskListClass.h"
|
||||||
|
|
||||||
|
|
||||||
namespace GUI
|
namespace GUI
|
||||||
{
|
{
|
||||||
|
|
@ -39,6 +41,9 @@ namespace GUI
|
||||||
*/
|
*/
|
||||||
namespace Setting
|
namespace Setting
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MainSetting;
|
class MainSetting;
|
||||||
// class SolverManager;
|
// class SolverManager;
|
||||||
// class SolveOption;
|
// class SolveOption;
|
||||||
|
|
@ -65,6 +70,7 @@ namespace Setting
|
||||||
*/
|
*/
|
||||||
QString getApplicationExePath();
|
QString getApplicationExePath();
|
||||||
|
|
||||||
|
QString getTemperturePath();
|
||||||
/**
|
/**
|
||||||
* @brief 设置工作空间
|
* @brief 设置工作空间
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
|
|
@ -204,6 +210,21 @@ namespace Setting
|
||||||
|
|
||||||
void setMessageBkColor(const QColor &bkColor);
|
void setMessageBkColor(const QColor &bkColor);
|
||||||
|
|
||||||
|
const QString& getFekoInstallPath() const;
|
||||||
|
void setFekoInstallPath(const QString& fekoInstallPath);
|
||||||
|
const QString& getFekocadPath() const;
|
||||||
|
void setFekocadPath(const QString& fekocadPath);
|
||||||
|
const QString& getRunFekoPath() const;
|
||||||
|
void setRunFekoPath(const QString& runFekoPath);
|
||||||
|
const QString& getPreFekoPath() const;
|
||||||
|
void setPreFekoPath(const QString& preFekoPath);
|
||||||
|
|
||||||
|
// 任务描述管理
|
||||||
|
TaskDescManager* getTaskDescManager();
|
||||||
|
TaskDesc* getNewTask();
|
||||||
|
TaskDesc* findTask(int taskID);
|
||||||
|
void removeTask(TaskDesc* task);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief 构造函数
|
* @brief 构造函数
|
||||||
|
|
@ -250,6 +271,8 @@ namespace Setting
|
||||||
*/
|
*/
|
||||||
GUI::MainWindow *_mainWindow{};
|
GUI::MainWindow *_mainWindow{};
|
||||||
// bool _isDesignModel{ false };
|
// bool _isDesignModel{ false };
|
||||||
|
private:
|
||||||
|
TaskDescManager* _taskDescManager{};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
/**
|
||||||
|
* @file TaskListClass.cpp
|
||||||
|
* @brief None
|
||||||
|
* @author 陈增辉 (3045316072@qq.com)
|
||||||
|
* @version 2.5.0
|
||||||
|
* @date 24-7-22
|
||||||
|
* @copyright Copyright (c) Since 2024 中科卫星应用研究院 All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "TaskListClass.h"
|
||||||
|
|
||||||
|
namespace Setting {
|
||||||
|
int TaskDesc::TaskNextId=0;
|
||||||
|
|
||||||
|
int TaskDesc::getTaskId() const
|
||||||
|
{
|
||||||
|
return taskID;
|
||||||
|
}
|
||||||
|
void TaskDesc::setTaskId(int taskId)
|
||||||
|
{
|
||||||
|
taskID = taskId;
|
||||||
|
}
|
||||||
|
TaskDesc::TaskDesc(QObject* parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
this->taskID = TaskDesc::NextTaskId(); // 初始化任务ID
|
||||||
|
this->taskClass = TaskClassDesc::OtherTask;
|
||||||
|
this->taskName = "";
|
||||||
|
}
|
||||||
|
TaskDesc::~TaskDesc() {}
|
||||||
|
TaskClassDesc TaskDesc::getTaskClass() const
|
||||||
|
{
|
||||||
|
return taskClass;
|
||||||
|
}
|
||||||
|
void TaskDesc::setTaskClass(TaskClassDesc taskClass)
|
||||||
|
{
|
||||||
|
TaskDesc::taskClass = taskClass;
|
||||||
|
}
|
||||||
|
const QString& TaskDesc::getTaskName() const
|
||||||
|
{
|
||||||
|
return taskName;
|
||||||
|
}
|
||||||
|
void TaskDesc::setTaskName(const QString& taskName)
|
||||||
|
{
|
||||||
|
TaskDesc::taskName = taskName;
|
||||||
|
}
|
||||||
|
int TaskDesc::NextTaskId()
|
||||||
|
{
|
||||||
|
TaskDesc::TaskNextId=TaskDesc::TaskNextId+1;
|
||||||
|
return TaskDesc::TaskNextId;
|
||||||
|
}
|
||||||
|
TaskDescState TaskDesc::getState() const
|
||||||
|
{
|
||||||
|
return _state;
|
||||||
|
}
|
||||||
|
void TaskDesc::setState(TaskDescState state)
|
||||||
|
{
|
||||||
|
_state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskDescManager::TaskDescManager(QObject* parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
this->_TaskDescSet.clear();
|
||||||
|
}
|
||||||
|
TaskDescManager::~TaskDescManager() {
|
||||||
|
this->_TaskDescSet.clear();
|
||||||
|
}
|
||||||
|
TaskDesc* TaskDescManager::getNewTask()
|
||||||
|
{
|
||||||
|
TaskDesc* newTaskDesc = new TaskDesc(this);
|
||||||
|
this->_TaskDescSet.append(newTaskDesc);
|
||||||
|
return newTaskDesc;
|
||||||
|
}
|
||||||
|
TaskDesc* TaskDescManager::findTask(int taskID)
|
||||||
|
{
|
||||||
|
|
||||||
|
int idx=this->getTaskIndexByTaskID(taskID);
|
||||||
|
if(idx==-1){
|
||||||
|
return nullptr;
|
||||||
|
}else{}
|
||||||
|
return this->_TaskDescSet.at(idx);
|
||||||
|
}
|
||||||
|
void TaskDescManager::removeTask(TaskDesc* task) {
|
||||||
|
int idx=this->getTaskIndexByTaskID(task->getTaskId());
|
||||||
|
if(idx==-1){
|
||||||
|
return;
|
||||||
|
}else{}
|
||||||
|
this->_TaskDescSet.removeAt(idx);
|
||||||
|
}
|
||||||
|
int TaskDescManager::getTaskIndexByTaskID(int taskID)
|
||||||
|
{
|
||||||
|
// 从_TaskDescSet折半查找根据TaskID
|
||||||
|
int lastIdx=0;
|
||||||
|
int endIdx=this->_TaskDescSet.size();
|
||||||
|
int midIdx=0;
|
||||||
|
while(lastIdx<endIdx){
|
||||||
|
midIdx=(lastIdx+endIdx)/2;
|
||||||
|
if(this->_TaskDescSet.at(midIdx)->getTaskId()==taskID){
|
||||||
|
return midIdx;
|
||||||
|
}else if(this->_TaskDescSet.at(midIdx)->getTaskId()<taskID){
|
||||||
|
lastIdx=midIdx+1;
|
||||||
|
}else{
|
||||||
|
endIdx=midIdx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Setting
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
* @file TaskListClass.h
|
||||||
|
* @brief 常规任务涉及到数据的处理,如数据的读取、存储、处理等,任务执行监控等,主要用来针对信号槽传递时异步计算的不确定性
|
||||||
|
* @author 陈增辉 (3045316072@qq.com)
|
||||||
|
* @version 2.5.0
|
||||||
|
* @date 24-7-22
|
||||||
|
* @copyright Copyright (c) Since 2024 中科卫星应用研究院 All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LAMPCAE_TASKLISTCLASS_H
|
||||||
|
#define LAMPCAE_TASKLISTCLASS_H
|
||||||
|
#include "SettingAPI.h"
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace Setting {
|
||||||
|
|
||||||
|
enum TaskDescState {
|
||||||
|
UnStart = 0,
|
||||||
|
Running = 1,
|
||||||
|
Finished = 2,
|
||||||
|
Failed = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum TaskClassDesc{
|
||||||
|
WriteTask = 0,
|
||||||
|
ReadTask = 1,
|
||||||
|
OtherTask = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TaskDesc:public QObject{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
TaskDesc(QObject* parent = nullptr);
|
||||||
|
~TaskDesc();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int taskID;
|
||||||
|
TaskClassDesc taskClass;
|
||||||
|
QString taskName;
|
||||||
|
TaskDescState _state;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TaskDescState getState() const;
|
||||||
|
void setState(TaskDescState state);
|
||||||
|
|
||||||
|
public:
|
||||||
|
TaskClassDesc getTaskClass() const;
|
||||||
|
void setTaskClass(TaskClassDesc taskClass);
|
||||||
|
const QString& getTaskName() const;
|
||||||
|
void setTaskName(const QString& taskName);
|
||||||
|
int getTaskId() const;
|
||||||
|
void setTaskId(int taskId);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static int TaskNextId;
|
||||||
|
static int NextTaskId();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 任务管理类
|
||||||
|
class TaskDescManager:public QObject{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
TaskDescManager(QObject* parent = nullptr);
|
||||||
|
~TaskDescManager();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<TaskDesc*> _TaskDescSet{};
|
||||||
|
public:
|
||||||
|
TaskDesc* getNewTask();
|
||||||
|
//void addTask(TaskDesc* task);
|
||||||
|
TaskDesc* findTask(int taskID);
|
||||||
|
void removeTask(TaskDesc* task);
|
||||||
|
private:
|
||||||
|
int getTaskIndexByTaskID(int taskID);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Setting
|
||||||
|
|
||||||
|
#endif // LAMPCAE_TASKLISTCLASS_H
|
||||||
Loading…
Reference in New Issue