You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.5 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
*
* @file FITKAbstractAutoSaver.h
* @brief 声明抽象自动保存器,用于自动保存工程文件、脚本等
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*
*/
#ifndef _FITKABSTRACT_AUTO_SAVER_H___
#define _FITKABSTRACT_AUTO_SAVER_H___
#include "FITKAppFrameworkAPI.h"
#include <QObject>
class QTimer;
namespace AppFrame
{
/**
* @brief 抽象自动保存器,间隔一定时间执行一次
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
class FITKAppFrameworkAPI FITKAbstractAutoSaver : public QObject
{
Q_OBJECT
public:
/**
* @brief Construct a new FITKAbstractAutoSaver object
* @param[i] msc 触发时间间隔 单位毫秒
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
explicit FITKAbstractAutoSaver(const int & msc = 120000);
/**
* @brief Destroy the FITKAbstractAutoSaver object
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
virtual ~FITKAbstractAutoSaver();
/**
* @brief 启动自动保存器
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
virtual void start();
/**
* @brief 停止计时
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
virtual void stop();
/**
* @brief 设置时间间隔默认2分钟
* @param[i] msc 触发时间间隔 单位毫秒
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
void setTimeInterval(const int & msc =120000 );
/**
* @brief 自动保存逻辑
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
virtual void autoSave() = 0;
/**
* @brief 程序正常运行结束,执行操作
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
virtual void finalize() = 0;
private slots:
/**
* @brief 超时信号
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
void timeOutSlot();
private:
/**
* @brief 计时器
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-09-13
*/
QTimer* _timer{};
};
}
#endif